Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-03-14 07:23:36 +0000
committerEike Stepper2011-03-14 07:23:36 +0000
commit00217a7fb636b2bab238038a5d3094d840fbfa10 (patch)
tree1aeff3f3364299a9941326f7f72862e5f1109ba9 /plugins/org.eclipse.emf.cdo.ui
parent1a719a7eba6c61b75247f90ec122946b5e728fba (diff)
downloadcdo-00217a7fb636b2bab238038a5d3094d840fbfa10.tar.gz
cdo-00217a7fb636b2bab238038a5d3094d840fbfa10.tar.xz
cdo-00217a7fb636b2bab238038a5d3094d840fbfa10.zip
enabled bulk add by default in CDOEditor
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.options1
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java89
3 files changed, 43 insertions, 49 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/.options b/plugins/org.eclipse.emf.cdo.ui/.options
index 79322d02b3..b767ded8ee 100644
--- a/plugins/org.eclipse.emf.cdo.ui/.options
+++ b/plugins/org.eclipse.emf.cdo.ui/.options
@@ -3,4 +3,3 @@
org.eclipse.emf.cdo.ui/debug = true
org.eclipse.emf.cdo.ui/test = false
-org.eclipse.emf.cdo.ui/test.bulk_add = false
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
index dc055a0872..066ef1cbba 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
@@ -36,8 +36,6 @@ public abstract class OM
public static final OMTracer TEST = BUNDLE.tracer("test"); //$NON-NLS-1$
- public static final OMTracer TEST_BULK_ADD = TEST.tracer("bulk_add"); //$NON-NLS-1$
-
public static final OMLogger LOG = BUNDLE.logger();
public static final OMPreferences PREFS = BUNDLE.preferences();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index 179b35bf8b..9f78d37bb4 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -2237,65 +2237,62 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$
}
- if (OM.TEST_BULK_ADD.isEnabled())
+ IStructuredSelection sel = (IStructuredSelection)editorSelection;
+ if (sel.size() == 1)
{
- IStructuredSelection sel = (IStructuredSelection)editorSelection;
- if (sel.size() == 1)
+ Object element = sel.getFirstElement();
+ if (element instanceof EObject)
{
- Object element = sel.getFirstElement();
- if (element instanceof EObject)
+ final EObject object = (EObject)element;
+ final List<EReference> features = new ArrayList<EReference>();
+ for (EReference containment : object.eClass().getEAllContainments())
{
- final EObject object = (EObject)element;
- final List<EReference> features = new ArrayList<EReference>();
- for (EReference containment : object.eClass().getEAllContainments())
+ if (containment.isMany())
{
- if (containment.isMany())
- {
- features.add(containment);
- }
+ features.add(containment);
}
+ }
- if (!features.isEmpty())
- {
- final IWorkbenchPage page = getSite().getPage();
- menuManager.insertBefore(
- "edit", new LongRunningAction(page, Messages.getString("CDOEditor.26") + SafeAction.INTERACTIVE) //$NON-NLS-1$ //$NON-NLS-2$
- {
- private EReference feature;
+ if (!features.isEmpty())
+ {
+ final IWorkbenchPage page = getSite().getPage();
+ menuManager.insertBefore(
+ "edit", new LongRunningAction(page, Messages.getString("CDOEditor.26") + SafeAction.INTERACTIVE) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ private EReference feature;
- private int instances;
+ private int instances;
- @Override
- protected void preRun() throws Exception
+ @Override
+ protected void preRun() throws Exception
+ {
+ BulkAddDialog dialog = new BulkAddDialog(page, features);
+ if (dialog.open() == BulkAddDialog.OK)
{
- BulkAddDialog dialog = new BulkAddDialog(page, features);
- if (dialog.open() == BulkAddDialog.OK)
- {
- feature = dialog.getFeature();
- instances = dialog.getInstances();
- }
- else
- {
- cancel();
- }
+ feature = dialog.getFeature();
+ instances = dialog.getInstances();
}
-
- @SuppressWarnings("unchecked")
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ else
{
- List<EObject> children = new ArrayList<EObject>();
- for (int i = 0; i < instances; i++)
- {
- EObject child = EcoreUtil.create(feature.getEReferenceType());
- children.add(child);
- }
+ cancel();
+ }
+ }
- List<EObject> list = (EList<EObject>)object.eGet(feature);
- list.addAll(children);
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ List<EObject> children = new ArrayList<EObject>();
+ for (int i = 0; i < instances; i++)
+ {
+ EObject child = EcoreUtil.create(feature.getEReferenceType());
+ children.add(child);
}
- });
- }
+
+ List<EObject> list = (EList<EObject>)object.eGet(feature);
+ list.addAll(children);
+ }
+ });
}
}
}

Back to the top