- if (obj instanceof WorkspaceElem) {
- WorkspaceElem we = (WorkspaceElem) obj;
- DistributionEditorInput dei = new DistributionEditorInput(we
- .getRepoElem().getRepository(), we.getRepoElem()
- .getCredentials(), we.getRepoElem().getLabel(), we
- .getRepoElem().getDescription(), we.getWorkspaceName());
- try {
- DistPlugin.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage()
- .openEditor(dei, DistributionEditor.ID);
- } catch (PartInitException e) {
- ErrorFeedback.show(
- "Cannot open editor for " + we.getWorkspaceName(), e);
+
+ if (obj instanceof RepoElem) {
+ RepoElem rpNode = (RepoElem) obj;
+ if (!rpNode.isConnected()) {
+ rpNode.login();
+ treeViewer.refresh(obj);
+ }
+ } else if (obj instanceof WorkspaceElem) {
+ WorkspaceElem wn = (WorkspaceElem) obj;
+ if (!wn.isConnected())
+ wn.login();
+ else {
+ WorkspaceElem we = (WorkspaceElem) obj;
+
+ try {
+ RepoElem repoElem = we.getRepoElem();
+ Map<String, String> params = new HashMap<String, String>();
+
+ Node repoNode = repoElem.getRepoNode();
+ if (repoNode != null)
+ params.put(OpenWorkspaceEditor.PARAM_REPO_NODE_PATH,
+ repoNode.getPath());
+ params.put(OpenWorkspaceEditor.PARAM_REPO_URI,
+ repoElem.getUri());
+ params.put(OpenWorkspaceEditor.PARAM_WORKSPACE_NAME,
+ we.getWorkspaceName());
+ CommandUtils.callCommand(OpenWorkspaceEditor.ID, params);
+ } catch (RepositoryException re) {
+ throw new SlcException(
+ "Cannot get path for node while "
+ + "setting parameters of command OpenWorkspaceEditor",
+ re);
+ }