Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-12-22 09:29:05 +0000
committerEike Stepper2010-12-22 09:29:05 +0000
commite89b4d46b027d0a192902534151b800e1e2e9ca5 (patch)
tree3b5595605cedb9d19efacb1d224acde15aacf0e6 /plugins/org.eclipse.emf.cdo.ui/src
parent46a577d9b19d68cd177122004ead41993578fdd6 (diff)
downloadcdo-e89b4d46b027d0a192902534151b800e1e2e9ca5.tar.gz
cdo-e89b4d46b027d0a192902534151b800e1e2e9ca5.tar.xz
cdo-e89b4d46b027d0a192902534151b800e1e2e9ca5.zip
reveal new elements in treeviewers
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java4
2 files changed, 10 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java
index 177bf9c95f..80b1013e92 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java
@@ -16,6 +16,7 @@ import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.EresourceFactory;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.ui.CDOItemProvider;
import org.eclipse.emf.cdo.view.CDOView;
@@ -75,7 +76,9 @@ public class CreateResourceNodeAction extends ViewAction
@Override
protected void doRun(IProgressMonitor progressMonitor) throws Exception
{
+ CDOTransaction transaction = getTransaction();
CDOResourceNode node = null;
+
if (createFolder)
{
node = EresourceFactory.eINSTANCE.createCDOResourceFolder();
@@ -93,14 +96,17 @@ public class CreateResourceNodeAction extends ViewAction
{
if (selectedNode instanceof CDOResourceFolder)
{
- getTransaction().createResource(selectedNode.getPath() + "/" + resourceNodeName); //$NON-NLS-1$
+ node = transaction.createResource(selectedNode.getPath() + "/" + resourceNodeName); //$NON-NLS-1$
}
else
{
- getTransaction().createResource(resourceNodeName);
+ node = transaction.createResource(resourceNodeName);
}
}
+ transaction.commit();
+
itemProvider.refreshViewer(true);
+ itemProvider.selectElement(node, true);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
index bc36a4b42e..7faf7e8cd4 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
@@ -127,9 +127,9 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
{
CDOResourceNode node = (CDOResourceNode)element;
CDOResourceNode parent = (CDOResourceNode)node.eContainer();
- if (parent.isRoot())
+ if (parent == null || parent.isRoot())
{
- return parent.cdoView();
+ return node.cdoView();
}
return parent;

Back to the top