Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2010-12-23 13:01:12 +0000
committerEike Stepper2010-12-23 13:01:12 +0000
commite23d1c385db2b49b4330998b16e05136987ffd7a (patch)
tree4e1cfaf41c58c04ff1165febaf4295ff4e5cc18a /plugins/org.eclipse.emf.cdo.ui.workspace
parentbe25079fe43113bdfe2a9ce909eae34e299b4425 (diff)
downloadcdo-e23d1c385db2b49b4330998b16e05136987ffd7a.tar.gz
cdo-e23d1c385db2b49b4330998b16e05136987ffd7a.tar.xz
cdo-e23d1c385db2b49b4330998b16e05136987ffd7a.zip
[327405] Provide an offline CDOWorkspace with Checkout/Update/Commit workflows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=327405
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui.workspace')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAction.java69
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAsAction.java30
2 files changed, 48 insertions, 51 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAction.java b/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAction.java
index 5520ec398b..90904b6eab 100644
--- a/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAction.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
@@ -45,11 +44,21 @@ public class CheckoutAction implements IObjectActionDelegate
this.part = part;
}
+ public IWorkbenchPart getPart()
+ {
+ return part;
+ }
+
public void selectionChanged(IAction action, ISelection selection)
{
this.selection = selection;
}
+ public ISelection getSelection()
+ {
+ return selection;
+ }
+
public void run(IAction action)
{
if (selection instanceof IStructuredSelection)
@@ -57,40 +66,36 @@ public class CheckoutAction implements IObjectActionDelegate
final Object element = ((IStructuredSelection)selection).getFirstElement();
if (element instanceof ICheckoutSource)
{
- final ICheckoutSource checkoutSource = (ICheckoutSource)element;
- String projectNameDefault = checkoutSource.getRepositoryLocation().getRepositoryName();
-
- Shell shell = part.getSite().getShell();
- CheckoutDialog dialog = new CheckoutDialog(shell, projectNameDefault);
+ ICheckoutSource checkoutSource = (ICheckoutSource)element;
+ String projectName = checkoutSource.getRepositoryLocation().getRepositoryName();
+ checkout(checkoutSource, projectName);
+ }
+ }
+ }
- if (dialog.open() == CheckoutDialog.OK)
+ protected void checkout(final ICheckoutSource checkoutSource, final String projectName)
+ {
+ new Job("Checking out...")
+ {
+ @Override
+ protected IStatus run(IProgressMonitor monitor)
+ {
+ try
{
- final String projectName = dialog.getProjectName();
-
- new Job("Checking out...")
- {
- @Override
- protected IStatus run(IProgressMonitor monitor)
- {
- try
- {
- CDOFS.checkout(checkoutSource, projectName, monitor);
- return Status.OK_STATUS;
- }
- catch (CoreException ex)
- {
- ex.printStackTrace();
- return ex.getStatus();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- return new Status(IStatus.ERROR, OM.BUNDLE_ID, ex.getLocalizedMessage(), ex);
- }
- }
- }.schedule();
+ CDOFS.checkout(checkoutSource, projectName, monitor);
+ return Status.OK_STATUS;
+ }
+ catch (CoreException ex)
+ {
+ ex.printStackTrace();
+ return ex.getStatus();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return new Status(IStatus.ERROR, OM.BUNDLE_ID, ex.getLocalizedMessage(), ex);
}
}
- }
+ }.schedule();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAsAction.java b/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAsAction.java
index bfa1f1a1c8..6f027cd13d 100644
--- a/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui.workspace/src/org/eclipse/emf/cdo/ui/internal/workspace/CheckoutAsAction.java
@@ -11,35 +11,27 @@
*/
package org.eclipse.emf.cdo.ui.internal.workspace;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.emf.cdo.location.ICheckoutSource;
+
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
/**
* @author Eike Stepper
*/
-public class CheckoutAsAction implements IObjectActionDelegate
+public class CheckoutAsAction extends CheckoutAction
{
- private Shell shell;
-
public CheckoutAsAction()
{
}
- public void setActivePart(IAction action, IWorkbenchPart targetPart)
- {
- shell = targetPart.getSite().getShell();
- }
-
- public void selectionChanged(IAction action, ISelection selection)
- {
- }
-
- public void run(IAction action)
+ @Override
+ protected void checkout(ICheckoutSource checkoutSource, String projectName)
{
- MessageDialog.openInformation(shell, "CDO Model Repository Client UI Workspace", "Checkout... was executed.");
+ Shell shell = getPart().getSite().getShell();
+ CheckoutDialog dialog = new CheckoutDialog(shell, projectName);
+ if (dialog.open() == CheckoutDialog.OK)
+ {
+ super.checkout(checkoutSource, dialog.getProjectName());
+ }
}
}

Back to the top