Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Roldan Betancort2010-03-15 21:54:48 +0000
committerVictor Roldan Betancort2010-03-15 21:54:48 +0000
commit03ee307637e7f299bef992f7b329c353fdb9dccf (patch)
treec0590cc3b0e86a64da6ebd7b948eee0ea1bb6224
parenta8db8cdf518fa4c7225e5735f7b45f5da3d7b222 (diff)
downloadcdo-03ee307637e7f299bef992f7b329c353fdb9dccf.tar.gz
cdo-03ee307637e7f299bef992f7b329c353fdb9dccf.tar.xz
cdo-03ee307637e7f299bef992f7b329c353fdb9dccf.zip
304226: [UI] Include support for branching in CDOSessionView
https://bugs.eclipse.org/bugs/show_bug.cgi?id=304226
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/CreateBranchActionDelegate.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/SharedIcons.java56
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangeViewTargetAction.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BranchSelectionDialog.java174
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java135
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties11
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java21
13 files changed, 365 insertions, 75 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
index 9e6a9e0963..28c7fe17ee 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
@@ -274,10 +274,10 @@ public class CDOBranchImpl extends Container<CDOBranch> implements InternalCDOBr
{
if (isProxy())
{
- return MessageFormat.format("Branch[id={0}, PROXY]", id);
+ return MessageFormat.format("Branch[id={0}, PROXY]", id); //$NON-NLS-1$
}
- return MessageFormat.format("Branch[id={0}, name={1}]", id, name);
+ return MessageFormat.format("Branch[id={0}, name={1}]", id, name); //$NON-NLS-1$
}
private synchronized void loadIfNeeded()
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
index 9981547405..4326c488ac 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchManagerImpl.java
@@ -214,9 +214,9 @@ public class CDOBranchManagerImpl extends Lifecycle implements InternalCDOBranch
protected void doBeforeActivate() throws Exception
{
super.doBeforeActivate();
- checkNull(branchLoader, "branchLoader");
- checkNull(timeProvider, "timeProvider");
- checkNull(mainBranch, "mainBranch");
+ checkNull(branchLoader, "branchLoader"); //$NON-NLS-1$
+ checkNull(timeProvider, "timeProvider"); //$NON-NLS-1$
+ checkNull(mainBranch, "mainBranch"); //$NON-NLS-1$
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java
index f8eab50700..d9007a8b3c 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointImpl.java
@@ -80,6 +80,6 @@ public class CDOBranchPointImpl implements CDOBranchPoint
@Override
public String toString()
{
- return MessageFormat.format("BranchPoint[{0}, {1}]", branch, CDOCommonUtil.formatTimeStamp(timeStamp));
+ return MessageFormat.format("BranchPoint[{0}, {1}]", branch, CDOCommonUtil.formatTimeStamp(timeStamp)); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java
index a5c5f73334..3e40da0876 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchPointRangeImpl.java
@@ -43,6 +43,6 @@ public class CDOBranchPointRangeImpl implements CDOBranchPointRange
@Override
public String toString()
{
- return MessageFormat.format("Range[{0}, {1}]", startPoint, endPoint);
+ return MessageFormat.format("Range[{0}, {1}]", startPoint, endPoint); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java
index 825aecaeec..f321c7b577 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchVersionImpl.java
@@ -68,6 +68,6 @@ public class CDOBranchVersionImpl implements CDOBranchVersion
@Override
public String toString()
{
- return MessageFormat.format("BranchVersion[{0}, v{1}]", branch, version);
+ return MessageFormat.format("BranchVersion[{0}, v{1}]", branch, version); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/CreateBranchActionDelegate.java b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/CreateBranchActionDelegate.java
index e1861f053a..f2c2a608f2 100644
--- a/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/CreateBranchActionDelegate.java
+++ b/plugins/org.eclipse.emf.cdo.ui.ide/src/org/eclipse/emf/cdo/ui/internal/ide/actions/CreateBranchActionDelegate.java
@@ -70,6 +70,11 @@ public class CreateBranchActionDelegate extends LongRunningActionDelegate
return "Branch name cannot be empty";
}
+ if (newText.contains(CDOBranch.PATH_SEPARATOR))
+ {
+ return "Branch name cannot contain path separators";
+ }
+
BranchNode branchNode = UIUtil.getElement(getSelection(), BranchNode.class);
CDOBranch branch = branchNode.getBranch();
if (branch.getBranch(newText) != null)
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/SharedIcons.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/SharedIcons.java
index cdbd2feb43..07dee35919 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/SharedIcons.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/SharedIcons.java
@@ -24,6 +24,10 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*/
public class SharedIcons
{
+ private static final String IMAGE_FORMAT_GIF = ".gif"; //$NON-NLS-1$
+
+ private static final String IMAGE_FORMAT_PNG = ".png"; //$NON-NLS-1$
+
private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay());
private static final String ETOOL = "etool16/"; //$NON-NLS-1$
@@ -34,49 +38,55 @@ public class SharedIcons
private static final String WIZBAN = "wizban/"; //$NON-NLS-1$
- public static final String ETOOL_OPEN_SESSION = ETOOL + "open_session"; //$NON-NLS-1$
+ public static final String ETOOL_OPEN_SESSION = ETOOL + "open_session" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
+
+ public static final String ETOOL_OPEN_EDITOR = ETOOL + "open_editor" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
+
+ public static final String OBJ_SESSION = OBJ + "cdo_session" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
+
+ public static final String OBJ_SESSION_SYNCING = OBJ + "cdo_session_syncing" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String ETOOL_OPEN_EDITOR = ETOOL + "open_editor"; //$NON-NLS-1$
+ public static final String OBJ_SESSION_OFFLINE = OBJ + "cdo_session_offline" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_SESSION = OBJ + "cdo_session"; //$NON-NLS-1$
+ public static final String OBJ_EDITOR = OBJ + "cdo_editor" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_SESSION_SYNCING = OBJ + "cdo_session_syncing"; //$NON-NLS-1$
+ public static final String OBJ_EDITOR_READWRITE = OBJ + "cdo_editor_readwrite" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_SESSION_OFFLINE = OBJ + "cdo_session_offline"; //$NON-NLS-1$
+ public static final String OBJ_EDITOR_READONLY = OBJ + "cdo_editor_readonly" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EDITOR = OBJ + "cdo_editor"; //$NON-NLS-1$
+ public static final String OBJ_EDITOR_HISTORICAL = OBJ + "cdo_editor_historical" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EDITOR_READWRITE = OBJ + "cdo_editor_readwrite"; //$NON-NLS-1$
+ public static final String OBJ_EPACKAGE = OBJ + "EPackage" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EDITOR_READONLY = OBJ + "cdo_editor_readonly"; //$NON-NLS-1$
+ public static final String OBJ_RESOURCE = OBJ + "CDOResource" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EDITOR_HISTORICAL = OBJ + "cdo_editor_historical"; //$NON-NLS-1$
+ public static final String OBJ_RESOURCE_FOLDER = OBJ + "CDOResourceFolder" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EPACKAGE = OBJ + "EPackage"; //$NON-NLS-1$
+ public static final String OBJ_EPACKAGE_CONVERTED = OBJ + "EPackageConverted" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_RESOURCE = OBJ + "CDOResource"; //$NON-NLS-1$
+ public static final String OBJ_EPACKAGE_LEGACY = OBJ + "EPackageLegacy" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_RESOURCE_FOLDER = OBJ + "CDOResourceFolder"; //$NON-NLS-1$
+ public static final String OBJ_EPACKAGE_NATIVE = OBJ + "EPackageNative" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EPACKAGE_CONVERTED = OBJ + "EPackageConverted"; //$NON-NLS-1$
+ public static final String OBJ_EPACKAGE_DYNAMIC = OBJ + "EPackageDynamic" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EPACKAGE_LEGACY = OBJ + "EPackageLegacy"; //$NON-NLS-1$
+ public static final String OBJ_EPACKAGE_UNKNOWN = OBJ + "EPackageUnknown" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EPACKAGE_NATIVE = OBJ + "EPackageNative"; //$NON-NLS-1$
+ public static final String OBJ_ECLASS = OBJ + "EClass" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EPACKAGE_DYNAMIC = OBJ + "EPackageDynamic"; //$NON-NLS-1$
+ public static final String VIEW_SESSIONS = VIEW + "cdo_sessions" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_EPACKAGE_UNKNOWN = OBJ + "EPackageUnknown"; //$NON-NLS-1$
+ public static final String WIZBAN_PACKAGE_MANAGER = WIZBAN + "PackageManager" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String OBJ_ECLASS = OBJ + "EClass"; //$NON-NLS-1$
+ public static final String WIZBAN_PROTOCOL_PROBLEM = WIZBAN + "ProtocolProblem" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String VIEW_SESSIONS = VIEW + "cdo_sessions"; //$NON-NLS-1$
+ public static final String WIZBAN_TARGET_SELECTION = WIZBAN + "BranchBanner" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String WIZBAN_PACKAGE_MANAGER = WIZBAN + "PackageManager"; //$NON-NLS-1$
+ public static final String WIZBAN_TIME_SELECTION = WIZBAN + "TimeBanner" + IMAGE_FORMAT_GIF; //$NON-NLS-1$
- public static final String WIZBAN_PROTOCOL_PROBLEM = WIZBAN + "ProtocolProblem"; //$NON-NLS-1$
+ public static final String ETOOL_TIME_PICK_BUTTON_ICON = ETOOL + "clock" + IMAGE_FORMAT_PNG; //$NON-NLS-1$
- public static final String WIZBAN_TARGET_SELECTION = WIZBAN + "BranchBanner"; //$NON-NLS-1$
+ public static final String ETOOL_SLIDER_ICON = ETOOL + "slider" + IMAGE_FORMAT_PNG; //$NON-NLS-1$
public static Image getImage(String key)
{
@@ -141,6 +151,6 @@ public class SharedIcons
private static String mangleKey(String key)
{
- return "icons/full/" + key + ".gif"; //$NON-NLS-1$ //$NON-NLS-2$
+ return "icons/full/" + key; //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangeViewTargetAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangeViewTargetAction.java
index cd6bf1bec4..60c9c7136b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangeViewTargetAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangeViewTargetAction.java
@@ -6,11 +6,11 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - initial API and implementation
*/
package org.eclipse.emf.cdo.internal.ui.actions;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.internal.ui.dialogs.BranchSelectionDialog;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.view.CDOView;
@@ -20,7 +20,7 @@ import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.ui.IWorkbenchPage;
/**
- * @author Eike Stepper
+ * @author Victor Roldan Betancort
*/
public class ChangeViewTargetAction extends ViewAction
{
@@ -28,11 +28,11 @@ public class ChangeViewTargetAction extends ViewAction
private static final String TITLE = Messages.getString("ChangeViewTargetAction_0"); //$NON-NLS-1$
- private CDOBranch targerBranch;
+ private CDOBranchPoint targetBranchPoint;
public ChangeViewTargetAction(IWorkbenchPage page, CDOView view)
{
- super(page, TITLE + INTERACTIVE, "Change the target CDOBranch of a CDOView", null, view);
+ super(page, TITLE + INTERACTIVE, Messages.getString("ChangeViewTargetAction.0"), null, view); //$NON-NLS-1$
setId(ID);
}
@@ -42,8 +42,8 @@ public class ChangeViewTargetAction extends ViewAction
BranchSelectionDialog dialog = new BranchSelectionDialog(getPage(), getView());
if (dialog.open() == Dialog.OK)
{
- targerBranch = dialog.getTargetBranch();
- if (targerBranch == null)
+ targetBranchPoint = dialog.getTargetBranchPoint();
+ if (targetBranchPoint == null)
{
cancel();
}
@@ -60,6 +60,6 @@ public class ChangeViewTargetAction extends ViewAction
protected void doRun(IProgressMonitor progressMonitor) throws Exception
{
CDOView view = getView();
- view.setBranch(targerBranch);
+ view.setBranchPoint(targetBranchPoint.getBranch(), targetBranchPoint.getTimeStamp());
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BranchSelectionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BranchSelectionDialog.java
index 0018725478..2023fae100 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BranchSelectionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BranchSelectionDialog.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.internal.ui.dialogs;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.view.CDOView;
@@ -30,12 +31,22 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbenchPage;
+import java.util.Date;
+
/**
* @author Victor Roldan Betancort
*/
@@ -45,8 +56,26 @@ public class BranchSelectionDialog extends TitleAreaDialog
private CDOBranch targetBranch;
+ private CDOBranchPoint targetBranchPoint;
+
private TreeViewer viewer;
+ private Button headRadio;
+
+ private Button baseRadio;
+
+ private Button timeRadio;
+
+ private Text timeText;
+
+ private long selectedTimeStamp;
+
+ private Button browseTimeButton;
+
+ // private Button pointRadio;
+
+ // private Combo pointCombo;
+
public BranchSelectionDialog(IWorkbenchPage page, CDOView view)
{
super(page.getWorkbenchWindow().getShell());
@@ -64,50 +93,167 @@ public class BranchSelectionDialog extends TitleAreaDialog
setTitle(Messages.getString("BranchSelectionDialog_1")); //$NON-NLS-1$
setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TARGET_SELECTION));
+ targetBranchPoint = view.getBranch().getPoint(view.getTimeStamp());
+
viewer = new TreeViewer(composite, SWT.BORDER);
viewer.getControl().setLayoutData(UIUtil.createGridData(true, true));
viewer.setContentProvider(new BranchContentProvider());
viewer.setLabelProvider(new BranchLabelProvider());
viewer.setInput(view.getSession().getBranchManager());
-
viewer.addSelectionChangedListener(new ISelectionChangedListener()
{
public void selectionChanged(SelectionChangedEvent event)
{
IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if (selection.getFirstElement().equals(view.getBranch()))
+ checkValidSelection(selection);
+ }
+ });
+
+ Group pointGroup = new Group(composite, SWT.NONE);
+ pointGroup.setText(Messages.getString("BranchSelectionDialog.0")); //$NON-NLS-1$
+ pointGroup.setLayout(new GridLayout(3, false));
+ pointGroup.setLayoutData(UIUtil.createGridData());
+ headRadio = new Button(pointGroup, SWT.RADIO);
+ headRadio.setText(Messages.getString("BranchSelectionDialog.1")); //$NON-NLS-1$
+ new Label(pointGroup, SWT.NONE);
+ new Label(pointGroup, SWT.NONE);
+ baseRadio = new Button(pointGroup, SWT.RADIO);
+ baseRadio.setText(Messages.getString("BranchSelectionDialog.2")); //$NON-NLS-1$
+ new Label(pointGroup, SWT.NONE);
+ new Label(pointGroup, SWT.NONE);
+ timeRadio = new Button(pointGroup, SWT.RADIO);
+ timeRadio.setText(Messages.getString("BranchSelectionDialog.3")); //$NON-NLS-1$
+ timeText = new Text(pointGroup, SWT.BORDER);
+ timeText.setText(new Date(view.getSession().getRepositoryInfo().getCreationTime()).toString());
+ timeText.setEditable(false);
+ browseTimeButton = new Button(pointGroup, SWT.NONE);
+ browseTimeButton.setImage(SharedIcons.getImage(SharedIcons.ETOOL_TIME_PICK_BUTTON_ICON));
+ // pointRadio = new Button(pointGroup, SWT.RADIO);
+ // pointRadio.setText(Messages.getString("BranchSelectionDialog.4")); //$NON-NLS-1$
+ // pointCombo = new Combo(pointGroup, SWT.NONE);
+ // new Label(pointGroup, SWT.NONE);
+
+ // Selection Listener
+ SelectionListener selectionListener = new SelectionListener()
+ {
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ checkValidSelection((IStructuredSelection)viewer.getSelection());
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ checkValidSelection((IStructuredSelection)viewer.getSelection());
+ }
+ };
+ headRadio.addSelectionListener(selectionListener);
+ baseRadio.addSelectionListener(selectionListener);
+ timeRadio.addSelectionListener(selectionListener);
+ // pointRadio.addSelectionListener(selectionListener);
+
+ timeText.addModifyListener(new ModifyListener()
+ {
+
+ public void modifyText(ModifyEvent e)
+ {
+ if (timeRadio.getSelection())
{
- BranchSelectionDialog.this.setErrorMessage(Messages.getString("BranchSelectionDialog_2")); //$NON-NLS-1$
- BranchSelectionDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(false);
+ updateSelectedPoint();
}
- else
+ }
+ });
+
+ // head as default selection
+ headRadio.setSelection(true);
+
+ browseTimeButton.addSelectionListener(new SelectionListener()
+ {
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ OpenAuditDialog dialog = new OpenAuditDialog(UIUtil.getActiveWorkbenchPage());
+ if (dialog.open() == IDialogConstants.OK_ID)
{
- BranchSelectionDialog.this.setErrorMessage(null);
- BranchSelectionDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(true);
+ timeText.setText(new Date(dialog.getTimeStamp()).toString());
+ selectedTimeStamp = dialog.getTimeStamp();
}
}
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
});
+ viewer.expandAll();
+
return composite;
}
+ private void checkValidSelection(IStructuredSelection selection)
+ {
+ CDOBranch branch = (CDOBranch)selection.getFirstElement();
+ if (getSelectedPoint(branch).equals(targetBranchPoint))
+ {
+ BranchSelectionDialog.this.setErrorMessage(Messages.getString("BranchSelectionDialog_2")); //$NON-NLS-1$
+ BranchSelectionDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(false);
+ }
+ else
+ {
+ if (branch.isMainBranch() && baseRadio.getSelection())
+ {
+ BranchSelectionDialog.this.setErrorMessage(Messages.getString("BranchSelectionDialog.5")); //$NON-NLS-1$
+ BranchSelectionDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(false);
+ }
+ else
+ {
+ targetBranch = branch;
+ BranchSelectionDialog.this.setErrorMessage(null);
+ BranchSelectionDialog.this.getButton(IDialogConstants.OK_ID).setEnabled(true);
+ }
+
+ }
+ }
+
@Override
protected void okPressed()
{
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- Object obj = selection.getFirstElement();
+ updateSelectedPoint();
+ super.okPressed();
+ }
- if (obj instanceof CDOBranch)
+ protected void updateSelectedPoint()
+ {
+ if (targetBranch != null)
{
- targetBranch = (CDOBranch)obj;
+ targetBranchPoint = getSelectedPoint(targetBranch);
}
+ }
- super.okPressed();
+ protected CDOBranchPoint getSelectedPoint(CDOBranch branch)
+ {
+ if (headRadio.getSelection())
+ {
+ return branch.getHead();
+ }
+ else if (baseRadio.getSelection())
+ {
+ return branch.getBase();
+ }
+ else if (timeRadio.getSelection())
+ {
+ return branch.getPoint(selectedTimeStamp);
+ }
+ // else if (pointRadio.getSelection())
+ // {
+ // return branch.getHead();
+ // }
+ return branch.getHead();
}
- public CDOBranch getTargetBranch()
+ public CDOBranchPoint getTargetBranchPoint()
{
- return targetBranch;
+ return targetBranchPoint;
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
index 57eeeb1b9f..69faa9e98f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
@@ -76,11 +76,11 @@ public class OpenAuditDialog extends TitleAreaDialog
composite.setLayout(new GridLayout(3, false));
setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
new Label(composite, SWT.NONE).setText(Messages.getString("OpenAuditDialog.1")); //$NON-NLS-1$
- dateControl = new DateTime(composite, SWT.DATE);
- timeControl = new DateTime(composite, SWT.TIME);
+ dateControl = new DateTime(composite, SWT.DATE | SWT.BORDER);
+ timeControl = new DateTime(composite, SWT.TIME | SWT.BORDER);
return composite;
}
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 54646010bd..81bccbeacd 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
@@ -34,6 +34,7 @@ import org.eclipse.emf.internal.cdo.CDOLegacyWrapper;
import org.eclipse.emf.internal.cdo.CDOStateMachine;
import org.eclipse.net4j.util.transaction.TransactionException;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.actions.LongRunningAction;
import org.eclipse.net4j.util.ui.actions.SafeAction;
@@ -98,6 +99,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -130,10 +132,16 @@ import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IActionBars;
@@ -165,6 +173,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Date;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Iterator;
@@ -639,7 +648,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
if (updateProblemIndication)
{
- BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.eclipse.emf.cdo.ui", 0, null,
+ BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.eclipse.emf.cdo.ui", 0, null, //$NON-NLS-1$
new Object[] { editingDomain.getResourceSet() });
for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values())
{
@@ -701,8 +710,8 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
*/
protected boolean handleDirtyConflict()
{
- return MessageDialog.openQuestion(getSite().getShell(), getString("_UI_FileConflict_label"),
- getString("_WARN_FileConflict"));
+ return MessageDialog.openQuestion(getSite().getShell(), getString("_UI_FileConflict_label"), //$NON-NLS-1$
+ getString("_WARN_FileConflict")); //$NON-NLS-1$
}
/**
@@ -964,8 +973,8 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
*/
protected void createContextMenuFor(StructuredViewer viewer)
{
- MenuManager contextMenu = new MenuManager("#PopUp");
- contextMenu.add(new Separator("additions"));
+ MenuManager contextMenu = new MenuManager("#PopUp"); //$NON-NLS-1$
+ contextMenu.add(new Separator("additions")); //$NON-NLS-1$
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(this);
Menu menu = contextMenu.createContextMenu(viewer.getControl());
@@ -1098,16 +1107,16 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
{
- BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString(
- "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object)resource
+ BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString( //$NON-NLS-1$
+ "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object)resource //$NON-NLS-1$
: exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
}
else if (exception != null)
{
- return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString(
- "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
+ return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString( //$NON-NLS-1$
+ "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); //$NON-NLS-1$
}
else
{
@@ -1146,7 +1155,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
createContextMenuFor(selectionViewer);
int pageIndex = addPage(tree);
- setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+ setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
getSite().getShell().getDisplay().asyncExec(new Runnable()
{
@@ -1199,7 +1208,24 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
// Create a page for the selection tree view.
//
- Tree tree = new Tree(getContainer(), SWT.MULTI);
+
+ getContainer().setLayoutData(UIUtil.createGridData());
+ getContainer().setLayout(UIUtil.createGridLayout(1));
+ Composite composite = UIUtil.createGridComposite(getContainer(), 1);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(UIUtil.createGridLayout(1));
+ Tree tree = new Tree(composite, SWT.MULTI | SWT.BORDER);
+ tree.setLayoutData(UIUtil.createGridData());
+
+ boolean sliderAllowed = !(view instanceof CDOTransaction)
+ && view.getSession().getRepositoryInfo().isSupportingAudits()
+ && view.getSession().getRepositoryInfo().isSupportingBranches();
+
+ if (sliderAllowed)
+ {
+ createTimeSlider(composite);
+ }
+
selectionViewer = new TreeViewer(tree);
setCurrentViewer(selectionViewer);
@@ -1207,13 +1233,12 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
selectionViewer.setLabelProvider(createLabelProvider());
selectionViewer.setInput(viewerInput);
- // selectionViewer.setSelection(new StructuredSelection(viewerInput),
- // true);
+ // selectionViewer.setSelection(new StructuredSelection(viewerInput), true);
new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
createContextMenuFor(selectionViewer);
- int pageIndex = addPage(tree);
+ int pageIndex = addPage(composite);
setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
setActivePage(0);
@@ -1313,6 +1338,80 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
/**
* @ADDED
*/
+ private void createTimeSlider(final Composite composite)
+ {
+ final Group group = new Group(composite, SWT.NONE);
+ group.setLayoutData(UIUtil.createEmptyGridData());
+ group.setLayout(UIUtil.createGridLayout(1));
+ group.setText(Messages.getString("CDOEditor.0")); //$NON-NLS-1$
+ group.setVisible(false);
+
+ final Composite groupComposite = UIUtil.createGridComposite(group, 1);
+ Scale scale = new Scale(groupComposite, SWT.HORIZONTAL);
+ scale.setLayoutData(new GridData(SWT.FILL, 50, true, false));
+ groupComposite.setLayoutData(new GridData(SWT.FILL, 50, true, false));
+ groupComposite.setLayout(UIUtil.createGridLayout(1));
+
+ final Label dateLabel = new Label(groupComposite, SWT.None);
+
+ scale.setMinimum(Integer.MIN_VALUE);
+ scale.setMaximum(Integer.MAX_VALUE);
+ final long startTimeStamp = view.getSession().getRepositoryInfo().getCreationTime();
+ dateLabel.setText(new Date(startTimeStamp).toString());
+ final long endTimeStamp = view.getSession().getLastUpdateTime();
+ final long absoluteTimeWindowLength = endTimeStamp - startTimeStamp;
+ final long scaleFactor = (long)2 * Integer.MAX_VALUE;
+ final double stepSize = (double)absoluteTimeWindowLength / (double)scaleFactor;
+
+ scale.addSelectionListener(new SelectionListener()
+ {
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ Scale scale = (Scale)e.widget;
+ int value = scale.getSelection();
+ long absolute = value < 0 ? (long)Math.abs(value) : (long)Math.abs(value) + (long)Integer.MAX_VALUE;
+ double mapToLong = stepSize * absolute;
+ long timeStamp = startTimeStamp + Math.round(mapToLong);
+ dateLabel.setText(new Date(timeStamp).toString());
+ view.setTimeStamp(timeStamp);
+ selectionViewer.refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e)
+ {
+ }
+ });
+
+ IAction action = new Action()
+ {
+ @Override
+ public void run()
+ {
+ if (group.isVisible())
+ {
+ group.setLayoutData(UIUtil.createEmptyGridData());
+ composite.layout();
+ }
+ else
+ {
+ group.setLayoutData(new GridData(SWT.FILL, 50, true, false));
+ composite.layout();
+ }
+ group.setVisible(!group.isVisible());
+ super.run();
+ }
+ };
+ action.setEnabled(true);
+ getActionBars().getToolBarManager().add(action);
+ action.setChecked(false);
+ action.setImageDescriptor(SharedIcons.getDescriptor(SharedIcons.ETOOL_SLIDER_ICON));
+ action.setToolTipText(Messages.getString("CDOEditor.1")); //$NON-NLS-1$
+ }
+
+ /**
+ * @ADDED
+ */
protected IContentProvider createContentProvider()
{
return new AdapterFactoryContentProvider(adapterFactory);
@@ -1951,25 +2050,25 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
case 0:
{
- statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected")); //$NON-NLS-1$
break;
}
case 1:
{
String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
- statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text)); //$NON-NLS-1$
break;
}
default:
{
- statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
+ statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size()))); //$NON-NLS-1$
break;
}
}
}
else
{
- statusLineManager.setMessage("");
+ statusLineManager.setMessage(""); //$NON-NLS-1$
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
index 3d4b2b5465..18a7dc01e0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
@@ -18,7 +18,13 @@ AbstractLockObjectsAction.0=Error
AbstractLockObjectsAction.1=Cannot obtain locks
BranchSelectionDialog_0=Change View Target
BranchSelectionDialog_1=Please choose the target Branch
-BranchSelectionDialog_2=The selected branch is current
+BranchSelectionDialog_2=The selected branch point is current
+BranchSelectionDialog.0=Branch Point
+BranchSelectionDialog.1=head
+BranchSelectionDialog.2=Base
+BranchSelectionDialog.3=Time
+BranchSelectionDialog.4=Commit Point
+BranchSelectionDialog.5=Cannot select base point for the main branch
BulkAddDialog.0=Bulk Add
BulkAddDialog.1=Select a child type and number of child instances
BulkAddDialog.2=Type:
@@ -26,6 +32,8 @@ BulkAddDialog.3=Instances:
BulkAddDialog.4=Select a feature
BulkAddDialog.5=Enter a valid number of instances (>0)
CDOActionBarContributor_0=Locking
+CDOEditor.0=Target Time
+CDOEditor.1=Open Target Time Slider
CDOEditor.17=Transaction error
CDOEditor.18=An error occured while committing the transaction.\nSee Error Log for details.
CDOEditor.23=New Root
@@ -89,6 +97,7 @@ CDOWatchListView.8=Reset Changes
CDOWatchListView.9=Reset all change notifications from the selected subscriptions
ChangePassiveUpdateAction.1=Passive Updates
ChangeViewTargetAction_0=Change Target
+ChangeViewTargetAction.0=Change the target CDOBranch of a CDOView
CloseSessionAction.0=Close
CloseSessionAction.1=Close the CDO session
CloseSessionAction.2=You have uncommitted changes. Do you want to discard them?
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
index 2876c0a4e4..160e5029ff 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
@@ -254,6 +254,27 @@ public final class UIUtil
return new GridData(SWT.FILL, SWT.FILL, true, true);
}
+ /**
+ * @since 3.0
+ */
+ public static GridData createEmptyGridData()
+ {
+ GridData data = new GridData();
+ data.heightHint = 0;
+ data.widthHint = 0;
+ data.horizontalSpan = 0;
+ data.horizontalAlignment = 0;
+ data.horizontalIndent = 0;
+ data.verticalAlignment = 0;
+ data.verticalIndent = 0;
+ data.verticalSpan = 0;
+ data.minimumHeight = 0;
+ data.minimumWidth = 0;
+ data.grabExcessHorizontalSpace = false;
+ data.grabExcessVerticalSpace = false;
+ return data;
+ }
+
public static GridData createGridData(boolean grabHorizontal, boolean grabVertical)
{
return new GridData(SWT.FILL, SWT.FILL, grabHorizontal, grabVertical);

Back to the top