summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-26 02:20:27 (EDT)
committerEike Stepper2007-07-26 02:20:27 (EDT)
commitb298c14cdbc55a38c9a59276db9f3314af77c71f (patch)
tree379966134bf8925f541571fc9c0a9544c6a0ee72
parent31659516a9b4a2e6851d30edd348b94c03601508 (diff)
downloadcdo-b298c14cdbc55a38c9a59276db9f3314af77c71f.zip
cdo-b298c14cdbc55a38c9a59276db9f3314af77c71f.tar.gz
cdo-b298c14cdbc55a38c9a59276db9f3314af77c71f.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java65
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackageAction.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java128
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java6
-rw-r--r--plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java59
17 files changed, 361 insertions, 36 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
index 84a60e1..21964d0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
@@ -16,7 +16,7 @@ public final class CloseSessionAction extends SessionAction
}
@Override
- protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
getSession().close();
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
index 17e8d51..c8aa54a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
@@ -16,7 +16,7 @@ public final class CloseViewAction extends ViewAction
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
getView().close();
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java
index bb77e82..64426ce 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceAction.java
@@ -12,18 +12,20 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public final class CreateResourceAction extends ViewAction
{
+ private static final String TITLE = "Create Resource";
+
private String resourcePath;
public CreateResourceAction(IWorkbenchPage page, CDOView view)
{
- super(page, "Create Resource", "Create a CDO resource", null, view);
+ super(page, TITLE, "Create a CDO resource", null, view);
}
@Override
- protected void preRun(IWorkbenchPage page) throws Exception
+ protected void preRun() throws Exception
{
- InputDialog dialog = new InputDialog(page.getWorkbenchWindow().getShell(), "Create Resource",
- "Enter resource path:", "/res" + (ViewAction.lastResourceNumber + 1), null);
+ InputDialog dialog = new InputDialog(getShell(), TITLE, "Enter resource path:", "/res"
+ + (ViewAction.lastResourceNumber + 1), null);
if (dialog.open() == InputDialog.OK)
{
++ViewAction.lastResourceNumber;
@@ -36,9 +38,9 @@ public final class CreateResourceAction extends ViewAction
}
@Override
- protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
getTransaction().createResource(resourcePath);
- CDOEditor.open(page, getView(), resourcePath);
+ CDOEditor.open(getPage(), getView(), resourcePath);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java
new file mode 100644
index 0000000..cc22a6b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java
@@ -0,0 +1,65 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.net4j.ui.actions.LongRunningAction;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @author Eike Stepper
+ * @ADDED
+ */
+public abstract class EditingDomainAction extends LongRunningAction
+{
+ protected EditingDomain editingDomain;
+
+ public EditingDomainAction(String text, ImageDescriptor image)
+ {
+ super(text, image);
+ }
+
+ public EditingDomainAction(String text, int style)
+ {
+ super(text, style);
+ }
+
+ public EditingDomainAction(String text, String toolTipText, ImageDescriptor image)
+ {
+ super(text, toolTipText, image);
+ }
+
+ public EditingDomainAction(String text, String toolTipText)
+ {
+ super(text, toolTipText);
+ }
+
+ public EditingDomainAction(String text)
+ {
+ super(text);
+ }
+
+ public EditingDomain getEditingDomain()
+ {
+ return editingDomain;
+ }
+
+ public void setEditingDomain(EditingDomain editingDomain)
+ {
+ this.editingDomain = editingDomain;
+ }
+
+ public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
+ {
+ setPage(workbenchPart.getSite().getPage());
+ setEditingDomain(workbenchPart instanceof IEditingDomainProvider ? ((IEditingDomainProvider)workbenchPart)
+ .getEditingDomain() : null);
+ }
+
+ public void update()
+ {
+ setEnabled(editingDomain != null);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java
new file mode 100644
index 0000000..09fb0fb
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java
@@ -0,0 +1,20 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author Eike Stepper
+ * @ADDED
+ */
+public class ExportResourceAction extends EditingDomainAction
+{
+ public ExportResourceAction()
+ {
+ super("Export Resource...");
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor monitor) throws Exception
+ {
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java
new file mode 100644
index 0000000..3c64ab7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java
@@ -0,0 +1,54 @@
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ * @ADDED
+ */
+public class ImportResourceAction extends EditingDomainAction
+{
+ private static final String TITLE = "Import Resource";
+
+ private List<URI> uris;
+
+ public ImportResourceAction()
+ {
+ super("Import Resource...");
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ResourceDialog dialog = new ResourceDialog(getShell(), TITLE, SWT.OPEN | SWT.MULTI)
+ {
+ @Override
+ protected boolean processResources()
+ {
+ return true;
+ }
+ };
+
+ if (dialog.open() == ResourceDialog.OK)
+ {
+ uris = dialog.getURIs();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor monitor) throws Exception
+ {
+ MessageDialog.openInformation(getShell(), TITLE, uris.toString());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
index 360e70e..23a1dc9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
@@ -12,19 +12,20 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public final class LoadResourceAction extends ViewAction
{
+ private static final String TITLE = "Load Resource";
+
private String resourcePath;
public LoadResourceAction(IWorkbenchPage page, CDOView view)
{
- super(page, "Load Resource", "Load a CDO resource", null, view);
+ super(page, TITLE, "Load a CDO resource", null, view);
}
@Override
- protected void preRun(IWorkbenchPage page) throws Exception
+ protected void preRun() throws Exception
{
String uri = ViewAction.lastResourceNumber == 0 ? "" : "/res" + ViewAction.lastResourceNumber;
- InputDialog dialog = new InputDialog(page.getWorkbenchWindow().getShell(), "Load Resource", "Enter resource path:",
- uri, null);
+ InputDialog dialog = new InputDialog(getShell(), TITLE, "Enter resource path:", uri, null);
if (dialog.open() == InputDialog.OK)
{
resourcePath = dialog.getValue();
@@ -36,8 +37,8 @@ public final class LoadResourceAction extends ViewAction
}
@Override
- protected void doRun(final IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
- CDOEditor.open(page, getView(), resourcePath);
+ CDOEditor.open(getPage(), getView(), resourcePath);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java
index 1fb6d16..bf5283b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java
@@ -21,15 +21,15 @@ public class ManagePackagesAction extends SessionAction
}
@Override
- protected void preRun(IWorkbenchPage page) throws Exception
+ protected void preRun() throws Exception
{
- PackageManagerDialog dialog = new PackageManagerDialog(page, getSession());
+ PackageManagerDialog dialog = new PackageManagerDialog(getPage(), getSession());
dialog.open();
cancel();
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
index 3971bfc..d19a7d8 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
@@ -20,7 +20,7 @@ public final class OpenAuditAction extends SessionAction
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
getSession().openAudit(new ResourceSetImpl(), System.currentTimeMillis());
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
index 1b2e95f..6d6c291 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
@@ -13,17 +13,19 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public final class OpenResourceEditorAction extends EntryAction
{
+ private static final String TITLE = "Open Editor";
+
public OpenResourceEditorAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
CDOViewHistory.Entry entry)
{
- super(page, "Open Editor", "Open a CDO editor for this resource", null, entry);
+ super(page, TITLE, "Open a CDO editor for this resource", null, entry);
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
CDOView view = getEntry().getView();
String resourcePath = getEntry().getResourcePath();
- CDOEditor.open(page, view, resourcePath);
+ CDOEditor.open(getPage(), view, resourcePath);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
index 4a5c66b..aa54d72 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
@@ -20,7 +20,7 @@ public final class OpenTransactionAction extends SessionAction
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
getSession().openTransaction(new ResourceSetImpl());
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
index 92fec48..a199457 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
@@ -20,7 +20,7 @@ public final class OpenViewAction extends SessionAction
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
getSession().openView(new ResourceSetImpl());
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java
index 03e2c47..6a11f16 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java
@@ -11,14 +11,16 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public final class OpenViewEditorAction extends ViewAction
{
+ private static final String TITLE = "Open Editor";
+
public OpenViewEditorAction(IWorkbenchPage page, CDOView view)
{
- super(page, "Open Editor", "Open a CDO editor for this view", null, view);
+ super(page, TITLE, "Open a CDO editor for this view", null, view);
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
- CDOEditor.open(page, getView(), null);
+ CDOEditor.open(getPage(), getView(), null);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackageAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackageAction.java
index e39abea..f0b217a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackageAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackageAction.java
@@ -23,9 +23,9 @@ public abstract class RegisterPackageAction extends SessionAction
}
@Override
- protected void preRun(IWorkbenchPage page) throws Exception
+ protected void preRun() throws Exception
{
- ePackage = getEPackage(page, getSession());
+ ePackage = getEPackage(getPage(), getSession());
if (ePackage == null)
{
cancel();
@@ -33,7 +33,7 @@ public abstract class RegisterPackageAction extends SessionAction
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
CDOPackageRegistry packageRegistry = getSession().getPackageRegistry();
packageRegistry.putEPackage(ePackage);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
index 898884e..b25b4da 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
@@ -6,6 +6,9 @@
*/
package org.eclipse.emf.cdo.internal.ui.editor;
+import org.eclipse.emf.cdo.internal.ui.actions.ExportResourceAction;
+import org.eclipse.emf.cdo.internal.ui.actions.ImportResourceAction;
+
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
@@ -48,6 +51,21 @@ import java.util.Collection;
public class CDOActionBarContributor extends EditingDomainActionBarContributor implements ISelectionChangedListener
{
/**
+ * @ADDED
+ */
+ public static final String LOAD_RESOURCE_ID = "load-resource";
+
+ /**
+ * @ADDED
+ */
+ public static final String IMPORT_RESOURCE_ID = "import-resource";
+
+ /**
+ * @ADDED
+ */
+ public static final String EXPORT_RESOURCE_ID = "export-resource";
+
+ /**
* This keeps track of the active editor. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
@@ -151,16 +169,28 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
*/
protected IMenuManager createSiblingMenuManager;
+ protected ImportResourceAction importResourceAction;
+
+ protected ExportResourceAction exportResourceAction;
+
/**
* This creates an instance of the contributor. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
- * @generated
+ * @generated NOT
*/
public CDOActionBarContributor()
{
super(ADDITIONS_LAST_STYLE);
loadResourceAction = new LoadResourceAction();
+ loadResourceAction.setId(LOAD_RESOURCE_ID);
+
+ importResourceAction = new ImportResourceAction();
+ importResourceAction.setId(IMPORT_RESOURCE_ID);
+
+ exportResourceAction = new ExportResourceAction();
+ exportResourceAction.setId(EXPORT_RESOURCE_ID);
+
validateAction = new ValidateAction();
controlAction = new ControlAction();
}
@@ -448,6 +478,20 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
*
* @generated
*/
+ protected void addGlobalActionsGen(IMenuManager menuManager)
+ {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions"));
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction);
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ menuManager.insertAfter("ui-actions", refreshViewerAction);
+
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * @ADDED
+ */
@Override
protected void addGlobalActions(IMenuManager menuManager)
{
@@ -458,6 +502,33 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
menuManager.insertAfter("ui-actions", refreshViewerAction);
super.addGlobalActions(menuManager);
+
+ if (loadResourceAction != null)
+ {
+ if (exportResourceAction != null)
+ {
+ menuManager.insertAfter(LOAD_RESOURCE_ID, exportResourceAction);
+ }
+
+ if (importResourceAction != null)
+ {
+ menuManager.insertAfter(LOAD_RESOURCE_ID, importResourceAction);
+ }
+ }
+ else
+ {
+ if (importResourceAction != null)
+ {
+ menuManager.insertBefore("additions-end", importResourceAction);
+ }
+
+ if (exportResourceAction != null)
+ {
+ menuManager.insertAfter("additions-end", exportResourceAction);
+ }
+
+ menuManager.insertBefore("additions-end", new Separator());
+ }
}
/**
@@ -472,4 +543,59 @@ public class CDOActionBarContributor extends EditingDomainActionBarContributor i
return true;
}
+ /**
+ * @ADDED
+ */
+ @Override
+ public void activate()
+ {
+ if (importResourceAction != null)
+ {
+ importResourceAction.setActiveWorkbenchPart(activeEditor);
+ }
+
+ if (exportResourceAction != null)
+ {
+ exportResourceAction.setActiveWorkbenchPart(activeEditor);
+ }
+
+ super.activate();
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void deactivate()
+ {
+ if (importResourceAction != null)
+ {
+ importResourceAction.setActiveWorkbenchPart(null);
+ }
+
+ if (exportResourceAction != null)
+ {
+ exportResourceAction.setActiveWorkbenchPart(null);
+ }
+
+ super.deactivate();
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void update()
+ {
+ super.update();
+ if (importResourceAction != null)
+ {
+ importResourceAction.update();
+ }
+
+ if (exportResourceAction != null)
+ {
+ exportResourceAction.update();
+ }
+ }
} \ No newline at end of file
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 b7b231c..399de4d 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
@@ -1920,7 +1920,9 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
MenuManager submenuManager = new MenuManager(cdoPackage.getPackageURI());
for (CDOClass cdoClass : cdoClasses)
{
- submenuManager.add(new CreateRootAction(cdoClass));
+ // TODO Optimize/cache this?
+ CreateRootAction action = new CreateRootAction(cdoClass);
+ submenuManager.add(action);
populated = true;
}
@@ -2166,7 +2168,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
}
@Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ protected void doRun(IProgressMonitor monitor) throws Exception
{
Resource resource = null;
IStructuredSelection ssel = (IStructuredSelection)editorSelection;
diff --git a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java
index 50ecae9..02f85c0 100644
--- a/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java
+++ b/plugins/org.eclipse.net4j.ui/src/org/eclipse/net4j/ui/actions/LongRunningAction.java
@@ -18,7 +18,9 @@ import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
/**
* @author Eike Stepper
@@ -66,6 +68,55 @@ public abstract class LongRunningAction extends SafeAction
this.page = page;
}
+ public LongRunningAction()
+ {
+ }
+
+ public LongRunningAction(String text, ImageDescriptor image)
+ {
+ super(text, image);
+ }
+
+ public LongRunningAction(String text, int style)
+ {
+ super(text, style);
+ }
+
+ public LongRunningAction(String text, String toolTipText, ImageDescriptor image)
+ {
+ super(text, toolTipText, image);
+ }
+
+ public LongRunningAction(String text, String toolTipText)
+ {
+ super(text, toolTipText);
+ }
+
+ public LongRunningAction(String text)
+ {
+ super(text);
+ }
+
+ public void setPage(IWorkbenchPage page)
+ {
+ this.page = page;
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ public IWorkbenchWindow getWorkbenchWindow()
+ {
+ return page.getWorkbenchWindow();
+ }
+
+ public Shell getShell()
+ {
+ return getWorkbenchWindow().getShell();
+ }
+
protected final int getTotalWork()
{
return totalWork;
@@ -90,7 +141,7 @@ public abstract class LongRunningAction extends SafeAction
protected final void doRun() throws Exception
{
totalWork = IProgressMonitor.UNKNOWN;
- preRun(page);
+ preRun();
if (totalWork != 0)
{
new Job(getText())
@@ -102,7 +153,7 @@ public abstract class LongRunningAction extends SafeAction
try
{
setStatus(Status.OK_STATUS);
- doRun(page, monitor);
+ doRun(monitor);
return status;
}
catch (Exception ex)
@@ -118,11 +169,11 @@ public abstract class LongRunningAction extends SafeAction
}
}
- protected void preRun(IWorkbenchPage page) throws Exception
+ protected void preRun() throws Exception
{
}
- protected abstract void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception;
+ protected abstract void doRun(IProgressMonitor monitor) throws Exception;
protected IStatus handleException(Exception ex)
{