Skip to content

Commit

Permalink
dbeaver/pro#3336 RCP model refactoring. Remove VFS from base model
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed Sep 13, 2024
1 parent ceefea4 commit 12e5b8a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBIcon;
import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.DBPObject;
Expand All @@ -37,7 +36,6 @@
import java.util.List;

public class DBNResourceManagerProject extends DBNAbstractResourceManagerNode {
private static final Log log = Log.getLog(DBNResourceManagerProject.class);

private final RMProject project;

Expand Down Expand Up @@ -123,29 +121,29 @@ public DBNNode refreshNode(DBRProgressMonitor monitor, Object source) throws DBE
return this;
}

@Override
public String toString() {
return getNodeDisplayName();
}


@NotNull
@Override
public DBPProject getOwnerProject() {
List<? extends DBPProject> globalProjects = getModel().getModelProjects();
if (globalProjects == null) {
return null;
}
for (DBPProject modelProject : globalProjects) {
if (CommonUtils.equalObjects(modelProject.getId(), project.getId())) {
return modelProject;
if (globalProjects != null) {
for (DBPProject modelProject : globalProjects) {
if (CommonUtils.equalObjects(modelProject.getId(), project.getId())) {
return modelProject;
}
}
}
return null;
throw new IllegalStateException("Project '" + project.getId() + "' not found in workspace");
}

@Nullable
@Override
public DBPObject getObjectDetails(@NotNull DBRProgressMonitor monitor, @NotNull SMSessionContext sessionContext, @NotNull Object dataSource) throws DBException {
return project;
}

@Override
public String toString() {
return getNodeDisplayName();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ public DBPObject getObjectDetails(@NotNull DBRProgressMonitor monitor, @NotNull
return resource;
}

@NotNull
@Override
public DBPProject getOwnerProject() {
return getParentNode().getOwnerProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
package io.cloudbeaver.model.session;

import io.cloudbeaver.WebProjectImpl;
import org.eclipse.core.runtime.IAdaptable;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.app.DBPProject;
import org.jkiss.dbeaver.model.app.DBPWorkspace;
Expand Down Expand Up @@ -132,6 +134,11 @@ public void dispose() {
clearProjects();
}

@Override
public DBPImage getResourceIcon(IAdaptable resourceAdapter) {
return null;
}

public void setActiveProject(DBPProject activeProject) {
this.activeProject = (WebProjectImpl) activeProject;
}
Expand Down

0 comments on commit 12e5b8a

Please sign in to comment.