Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-03-19 08:51:36 +0000
committerEike Stepper2015-03-19 09:30:32 +0000
commit300015ebc05db0c99569aa0a0511a04125c927e6 (patch)
tree90d82e4285329ba04e46675eecd2614ab83572a2
parent6f45700d6655330bdec97d48683ec38b52ceacd9 (diff)
downloadcdo-300015ebc05db0c99569aa0a0511a04125c927e6.tar.gz
cdo-300015ebc05db0c99569aa0a0511a04125c927e6.tar.xz
cdo-300015ebc05db0c99569aa0a0511a04125c927e6.zip
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/new_checkout.gif (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_offlline.gif)bin339 -> 339 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/new_checkout_quick.gif (renamed from plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_online.gif)bin337 -> 337 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml78
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/actions/CheckoutCommitInfoActionDelegate.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandlerQuick.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java5
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java1
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeAction.java12
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeActionDelegate.java10
18 files changed, 264 insertions, 99 deletions
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_offlline.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/new_checkout.gif
index 37e893f3d4..37e893f3d4 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_offlline.gif
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/new_checkout.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_online.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/new_checkout_quick.gif
index 9b79110d6b..9b79110d6b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/checkout_online.gif
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/new_checkout_quick.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 09b2a3871c..479e5a96a8 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -407,23 +407,6 @@
</decorator>
</extension>
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="true"
- id="org.eclipse.emf.cdo.explorer.ui.contribution1"
- objectClass="org.eclipse.emf.cdo.common.commit.CDOCommitInfo">
- <action
- class="org.eclipse.emf.cdo.explorer.ui.actions.CheckoutCommitInfoActionDelegate"
- enablesFor="1"
- icon="icons/checkout_online.gif"
- id="org.eclipse.emf.cdo.explorer.ui.CheckoutCommitInfo"
- label="Checkout..."
- menubarPath="additions"
- style="push">
- </action>
- </objectContribution>
- </extension>
-
<extension point="org.eclipse.ui.commands">
<command
id="org.eclipse.emf.cdo.explorer.ui.RepositoryConnect"
@@ -438,13 +421,9 @@
name="Checkout Repository"
defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandler"/>
<command
- id="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckoutOnline"
- name="Checkout Repository Online"
- defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandlerQuick$Online"/>
- <command
- id="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckoutOffline"
- name="Checkout Repository Offline"
- defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandlerQuick$Offline"/>
+ id="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckoutQuick"
+ name="Checkout Repository Quick"
+ defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandlerQuick"/>
<command
id="org.eclipse.emf.cdo.explorer.ui.CheckoutOpen"
name="Open Checkout"
@@ -547,7 +526,7 @@
locationURI="popup:org.eclipse.ui.popup.any?after=group.checkout">
<command
commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckout"
- icon="icons/checkout_online.gif"
+ icon="icons/new_checkout.gif"
label="Checkout..."
style="push"
tooltip="Check the repository out into the Project Explorer">
@@ -563,9 +542,9 @@
</visibleWhen>
</command>
<command
- commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckoutOnline"
- icon="icons/checkout_online.gif"
- label="Checkout Online"
+ commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckoutQuick"
+ icon="icons/new_checkout_quick.gif"
+ label="Checkout Quick"
style="push"
tooltip="Check the repository out as an online connection">
<visibleWhen checkEnabled="false">
@@ -579,23 +558,6 @@
</with>
</visibleWhen>
</command>
- <command
- commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckoutOffline"
- icon="icons/checkout_offlline.gif"
- label="Checkout Offline"
- style="push"
- tooltip="Check the repository out as an offline connection">
- <visibleWhen checkEnabled="false">
- <with variable="activeMenuSelection">
- <and>
- <count value="1"/>
- <iterate>
- <adapt type="org.eclipse.emf.cdo.explorer.repositories.CDORepositoryElement"/>
- </iterate>
- </and>
- </with>
- </visibleWhen>
- </command>
</menuContribution>
<menuContribution
allPopups="false"
@@ -755,4 +717,30 @@
</menuContribution>
</extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.emf.cdo.explorer.ui.contribution1"
+ objectClass="org.eclipse.emf.cdo.common.commit.CDOCommitInfo">
+ <action
+ class="org.eclipse.emf.cdo.explorer.ui.actions.CheckoutCommitInfoActionDelegate$Quick"
+ enablesFor="1"
+ icon="icons/new_checkout_quick.gif"
+ id="org.eclipse.emf.cdo.explorer.ui.CheckoutCommitInfo"
+ label="Checkout Quick"
+ menubarPath="additions"
+ style="push">
+ </action>
+ <action
+ class="org.eclipse.emf.cdo.explorer.ui.actions.CheckoutCommitInfoActionDelegate"
+ enablesFor="1"
+ icon="icons/new_checkout.gif"
+ id="org.eclipse.emf.cdo.explorer.ui.CheckoutCommitInfo"
+ label="Checkout..."
+ menubarPath="additions"
+ style="push">
+ </action>
+ </objectContribution>
+ </extension>
+
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/actions/CheckoutCommitInfoActionDelegate.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/actions/CheckoutCommitInfoActionDelegate.java
index 4be6b196cf..ce580024f0 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/actions/CheckoutCommitInfoActionDelegate.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/actions/CheckoutCommitInfoActionDelegate.java
@@ -12,8 +12,10 @@ package org.eclipse.emf.cdo.explorer.ui.actions;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryElement;
+import org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandler;
import org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandlerQuick;
import org.eclipse.emf.cdo.internal.explorer.repositories.CDORepositoryImpl;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -76,11 +78,28 @@ public class CheckoutCommitInfoActionDelegate extends LongRunningActionDelegate
}
};
- RepositoryCheckoutHandlerQuick.checkout(repositoryElement, "online");
+ checkout(repositoryElement);
}
}
}
}
}
}
+
+ protected void checkout(CDORepositoryElement repositoryElement)
+ {
+ RepositoryCheckoutHandler.checkout(getShell(), repositoryElement);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class Quick extends CheckoutCommitInfoActionDelegate
+ {
+ @Override
+ protected void checkout(CDORepositoryElement repositoryElement)
+ {
+ RepositoryCheckoutHandlerQuick.checkout(repositoryElement, CDOCheckout.TYPE_ONLINE_HISTORICAL);
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java
index 7c282cddf0..cc2f80ab8b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutContentProvider.java
@@ -90,6 +90,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -255,6 +256,8 @@ public class CDOCheckoutContentProvider implements ICommonContentProvider, IProp
private Object input;
+ public static final String PROJECT_EXPLORER_ID = "org.eclipse.ui.navigator.ProjectExplorer";
+
public CDOCheckoutContentProvider()
{
}
@@ -778,7 +781,7 @@ public class CDOCheckoutContentProvider implements ICommonContentProvider, IProp
return null;
}
- public void selectObject(final Object object)
+ public void selectObjects(final Object... objects)
{
final Control control = viewer.getControl();
if (!control.isDisposed())
@@ -794,29 +797,44 @@ public class CDOCheckoutContentProvider implements ICommonContentProvider, IProp
return;
}
- LinkedList<Object> path = new LinkedList<Object>();
- CDOCheckout checkout = CDOExplorerUtil.walkUp(object, path);
- if (checkout != null)
+ for (Object object : objects)
{
- viewer.setExpandedState(checkout, true);
+ LinkedList<Object> path = new LinkedList<Object>();
+ CDOCheckout checkout = CDOExplorerUtil.walkUp(object, path);
+ if (checkout != null)
+ {
+ viewer.setExpandedState(checkout, true);
- path.removeFirst();
- path.removeLast();
+ if (!path.isEmpty())
+ {
+ path.removeFirst();
+ }
- for (Object object : path)
- {
- viewer.setExpandedState(object, true);
- }
+ if (!path.isEmpty())
+ {
+ path.removeLast();
+ }
- viewer.setSelection(new StructuredSelection(object), true);
- if (viewer.getSelection().isEmpty())
- {
- if (isObjectLoading(object) || System.currentTimeMillis() < end)
+ for (Object parent : path)
{
- display.timerExec(50, this);
+ viewer.setExpandedState(parent, true);
}
}
}
+
+ viewer.setSelection(new StructuredSelection(objects), true);
+ IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
+
+ Set<Object> actual = new HashSet<Object>(Arrays.asList(selection.toArray()));
+ Set<Object> expected = new HashSet<Object>(Arrays.asList(objects));
+
+ if (!actual.equals(expected))
+ {
+ if (isObjectLoading(objects) || System.currentTimeMillis() < end)
+ {
+ display.timerExec(50, this);
+ }
+ }
}
});
}
@@ -961,11 +979,19 @@ public class CDOCheckoutContentProvider implements ICommonContentProvider, IProp
}
}
- private static boolean isObjectLoading(Object object)
+ private static boolean isObjectLoading(Object... objects)
{
synchronized (LOADING_OBJECTS)
{
- return LOADING_OBJECTS.contains(object);
+ for (Object object : objects)
+ {
+ if (LOADING_OBJECTS.contains(object))
+ {
+ return true;
+ }
+ }
+
+ return false;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java
index 264584fe60..7f4d297160 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/NewActionProvider.java
@@ -461,7 +461,7 @@ public class NewActionProvider extends CommonActionProvider implements ISelectio
CDOCheckoutContentProvider contentProvider = getContentProvider();
if (contentProvider != null)
{
- contentProvider.selectObject(object);
+ contentProvider.selectObjects(object);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java
index 03bbba19e5..94ff1e0914 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/actions/ShowInActionProvider.java
@@ -18,6 +18,7 @@ import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+import org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutContentProvider;
import org.eclipse.emf.cdo.internal.explorer.AbstractElement;
import org.eclipse.emf.cdo.internal.explorer.checkouts.OfflineCDOCheckout;
import org.eclipse.emf.cdo.internal.explorer.repositories.LocalCDORepository;
@@ -112,6 +113,13 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
if (selectedElement instanceof CDORepository)
{
final CDORepository repository = (CDORepository)selectedElement;
+
+ CDOCheckout[] checkouts = repository.getCheckouts();
+ if (checkouts.length != 0)
+ {
+ filled |= addAction(menu, repository, new ShowInProjectExplorerAction(page, checkouts));
+ }
+
if (repository.isConnected())
{
if (repository.isLocal())
@@ -418,13 +426,38 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
/**
* @author Eike Stepper
*/
+ private static final class ShowInProjectExplorerAction extends ShowInViewAction
+ {
+ private final CDOCheckout[] checkouts;
+
+ public ShowInProjectExplorerAction(IWorkbenchPage page, CDOCheckout[] checkouts)
+ {
+ super(page, CDOCheckoutContentProvider.PROJECT_EXPLORER_ID);
+ this.checkouts = checkouts;
+ }
+
+ @Override
+ protected void run(IViewPart viewPart) throws Exception
+ {
+ CDOCheckoutContentProvider checkoutContentProvider = CDOCheckoutContentProvider
+ .getInstance(CDOCheckoutContentProvider.PROJECT_EXPLORER_ID);
+ if (checkoutContentProvider != null)
+ {
+ checkoutContentProvider.selectObjects((Object[])checkouts);
+ }
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
private static final class ShowInSessionsViewAction extends ShowInViewAction
{
private final CDORepository repository;
private final CDOCheckout checkout;
- private ShowInSessionsViewAction(IWorkbenchPage page, CDORepository repository, CDOCheckout checkout)
+ public ShowInSessionsViewAction(IWorkbenchPage page, CDORepository repository, CDOCheckout checkout)
{
super(page, CDOSessionsView.ID);
this.repository = repository;
@@ -519,7 +552,7 @@ public class ShowInActionProvider extends AbstractActionProvider<Object>
{
private final File folder;
- private ShowInSystemExplorerAction(File folder)
+ public ShowInSystemExplorerAction(File folder)
{
this.folder = folder;
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java
index d256285148..4ad0ddc60a 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutBranchPointPage.java
@@ -140,7 +140,15 @@ public class CheckoutBranchPointPage extends CheckoutWizardPage
final CheckoutWizard wizard = getWizard();
String type = wizard.getTypePage().getType();
- branchPointComposite.setAllowTimeStamp(!CDOCheckout.TYPE_ONLINE_TRANSACTIONAL.equals(type));
+ if (CDOCheckout.TYPE_ONLINE_TRANSACTIONAL.equals(type))
+ {
+ branchPointComposite.setAllowTimeStamp(false);
+ }
+ else
+ {
+ branchPointComposite.setAllowTimeStamp(true);
+ branchPointComposite.getSelectTimeComposite().setTimeStamp(timeStamp);
+ }
final Display display = branchPointComposite.getDisplay();
display.asyncExec(new Runnable()
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java
index 5d9e2de917..bdbb98f736 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutLabelPage.java
@@ -236,4 +236,26 @@ public class CheckoutLabelPage extends CheckoutWizardPage
labelText.setText("");
}
}
+
+ public static String getUniqueLabel(String label)
+ {
+ Set<String> names = new HashSet<String>();
+
+ CDOCheckoutManager checkoutManager = CDOExplorerUtil.getCheckoutManager();
+ for (CDOCheckout checkout : checkoutManager.getCheckouts())
+ {
+ names.add(checkout.getLabel());
+ }
+
+ for (int i = 1; i < Integer.MAX_VALUE; i++)
+ {
+ String name = i == 1 ? label : label + " (" + i + ")";
+ if (!names.contains(name))
+ {
+ return name;
+ }
+ }
+
+ throw new IllegalStateException("Too many checkouts");
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java
index 4acccb03e3..b635832627 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/CheckoutWizard.java
@@ -10,12 +10,14 @@
*/
package org.eclipse.emf.cdo.explorer.ui.checkouts.wizards;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckoutManager;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryElement;
import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+import org.eclipse.emf.cdo.explorer.ui.checkouts.CDOCheckoutContentProvider;
import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ui.UIUtil;
@@ -33,6 +35,10 @@ import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IImportWizard;
import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.IViewDescriptor;
import java.util.Properties;
@@ -137,6 +143,12 @@ public class CheckoutWizard extends Wizard implements IImportWizard, IPageChange
int branchID = selectedElement.getBranchID();
long timeStamp = selectedElement.getTimeStamp();
+
+ if (timeStamp != CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ typePage.setType(CDOCheckout.TYPE_ONLINE_HISTORICAL);
+ }
+
branchPointPage.setBranchPoint(branchID, timeStamp);
}
}
@@ -162,6 +174,8 @@ public class CheckoutWizard extends Wizard implements IImportWizard, IPageChange
CDOCheckoutManager checkoutManager = CDOExplorerUtil.getCheckoutManager();
CDOCheckout checkout = checkoutManager.addCheckout(properties);
checkout.open();
+
+ showInProjectExplorer(checkout);
}
catch (Exception ex)
{
@@ -188,4 +202,44 @@ public class CheckoutWizard extends Wizard implements IImportWizard, IPageChange
return true;
}
+
+ public static void showInProjectExplorer(final CDOCheckout checkout)
+ {
+ UIUtil.getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+
+ IViewDescriptor viewDescriptor = workbench.getViewRegistry().find(
+ CDOCheckoutContentProvider.PROJECT_EXPLORER_ID);
+ if (viewDescriptor != null)
+ {
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ if (window != null)
+ {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null)
+ {
+ try
+ {
+ page.showView(viewDescriptor.getId());
+
+ CDOCheckoutContentProvider checkoutContentProvider = CDOCheckoutContentProvider
+ .getInstance(CDOCheckoutContentProvider.PROJECT_EXPLORER_ID);
+ if (checkoutContentProvider != null)
+ {
+ checkoutContentProvider.selectObjects(checkout);
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ }
+ }
+ }
+ });
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java
index d447907b74..bcf6c88c88 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/wizards/NewWizard.java
@@ -157,7 +157,7 @@ public abstract class NewWizard extends Wizard implements INewWizard
view.waitForUpdate(commitInfo.getTimeStamp());
CDOObject newObject = view.getObject(newID);
- contentProvider.selectObject(newObject);
+ contentProvider.selectObjects(newObject);
}
return Status.OK_STATUS;
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandlerQuick.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandlerQuick.java
index 9cf7d26456..04cd5b6bc4 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandlerQuick.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandlerQuick.java
@@ -14,6 +14,8 @@ import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.repositories.CDORepository;
import org.eclipse.emf.cdo.explorer.repositories.CDORepositoryElement;
+import org.eclipse.emf.cdo.explorer.ui.checkouts.wizards.CheckoutLabelPage;
+import org.eclipse.emf.cdo.explorer.ui.checkouts.wizards.CheckoutWizard;
import org.eclipse.emf.cdo.internal.explorer.checkouts.CDOCheckoutImpl;
import org.eclipse.net4j.util.ui.handlers.AbstractBaseHandler;
@@ -26,20 +28,17 @@ import java.util.Properties;
/**
* @author Eike Stepper
*/
-public abstract class RepositoryCheckoutHandlerQuick extends AbstractBaseHandler<CDORepositoryElement>
+public class RepositoryCheckoutHandlerQuick extends AbstractBaseHandler<CDORepositoryElement>
{
- private final String type;
-
- protected RepositoryCheckoutHandlerQuick(String type)
+ public RepositoryCheckoutHandlerQuick()
{
super(CDORepositoryElement.class, false);
- this.type = type;
}
@Override
protected void doExecute(ExecutionEvent event, IProgressMonitor monitor) throws Exception
{
- checkout(elements.get(0), type);
+ checkout(elements.get(0), CDOCheckout.TYPE_ONLINE_TRANSACTIONAL);
}
public static void checkout(CDORepositoryElement repositoryElement, String type)
@@ -48,7 +47,7 @@ public abstract class RepositoryCheckoutHandlerQuick extends AbstractBaseHandler
Properties properties = new Properties();
properties.setProperty("type", type);
- properties.setProperty("label", repository.getLabel());
+ properties.setProperty("label", CheckoutLabelPage.getUniqueLabel(repository.getLabel()));
properties.setProperty("repository", repository.getID());
properties.setProperty("branchID", Integer.toString(repositoryElement.getBranchID()));
properties.setProperty("timeStamp", Long.toString(repositoryElement.getTimeStamp()));
@@ -57,27 +56,7 @@ public abstract class RepositoryCheckoutHandlerQuick extends AbstractBaseHandler
CDOCheckout checkout = CDOExplorerUtil.getCheckoutManager().addCheckout(properties);
checkout.open();
- }
-
- /**
- * @author Eike Stepper
- */
- public static final class Online extends RepositoryCheckoutHandlerQuick
- {
- public Online()
- {
- super(CDOCheckout.TYPE_ONLINE_TRANSACTIONAL);
- }
- }
- /**
- * @author Eike Stepper
- */
- public static final class Offline extends RepositoryCheckoutHandlerQuick
- {
- public Offline()
- {
- super(CDOCheckout.TYPE_OFFLINE);
- }
+ CheckoutWizard.showInProjectExplorer(checkout);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
index 6c7fede8b8..9c99aa6f7d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutImpl.java
@@ -113,6 +113,11 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
{
}
+ public CDOCheckoutImpl(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
+
@Override
public final CDOCheckoutManagerImpl getManager()
{
@@ -319,7 +324,7 @@ public abstract class CDOCheckoutImpl extends AbstractElement implements CDOChec
public void setReadOnly(boolean readOnly)
{
- if (state != State.Open)
+ if (state != State.Closed)
{
throw new IllegalStateException("Checkout is not closed: " + this);
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java
index 4f337e4e01..7e19653d37 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/CDOCheckoutManagerImpl.java
@@ -86,6 +86,11 @@ public class CDOCheckoutManagerImpl extends AbstractManager<CDOCheckout> impleme
return new OnlineCDOCheckout();
}
+ if (CDOCheckout.TYPE_ONLINE_HISTORICAL.equals(type))
+ {
+ return new OnlineCDOCheckout(true);
+ }
+
if (CDOCheckout.TYPE_OFFLINE.equals(type))
{
return new OfflineCDOCheckout();
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java
index 81adf45a6a..55c65a40c9 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/checkouts/OnlineCDOCheckout.java
@@ -31,6 +31,11 @@ public class OnlineCDOCheckout extends CDOCheckoutImpl
{
}
+ public OnlineCDOCheckout(boolean readOnly)
+ {
+ super(readOnly);
+ }
+
public boolean isOffline()
{
return false;
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java
index 67cfb3595a..5b76c8c6d9 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java
@@ -142,6 +142,7 @@ public abstract class LongRunningAction extends SafeAction
return PlatformUI.getWorkbench().getDisplay();
}
+ @Override
public Shell getShell()
{
IWorkbenchWindow workbenchWindow = getWorkbenchWindow();
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeAction.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeAction.java
index 41153be571..c51a03ff05 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeAction.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeAction.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -12,10 +12,12 @@ package org.eclipse.net4j.util.ui.actions;
import org.eclipse.net4j.util.internal.ui.bundle.OM;
import org.eclipse.net4j.util.internal.ui.messages.Messages;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Shell;
/**
* @author Eike Stepper
@@ -55,6 +57,14 @@ public abstract class SafeAction extends Action
super(text);
}
+ /**
+ * @since 3.5
+ */
+ public Shell getShell()
+ {
+ return UIUtil.getShell();
+ }
+
@Override
public final void run()
{
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeActionDelegate.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeActionDelegate.java
index ed1e1eea6b..2d393982eb 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeActionDelegate.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/SafeActionDelegate.java
@@ -12,10 +12,12 @@ package org.eclipse.net4j.util.ui.actions;
import org.eclipse.net4j.util.internal.ui.bundle.OM;
import org.eclipse.net4j.util.internal.ui.messages.Messages;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IActionDelegate;
/**
@@ -36,6 +38,14 @@ public abstract class SafeActionDelegate implements IActionDelegate
{
}
+ /**
+ * @since 3.5
+ */
+ public Shell getShell()
+ {
+ return UIUtil.getShell();
+ }
+
public IAction getAction()
{
return action;

Back to the top