Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-03-02 11:37:51 +0000
committerEike Stepper2015-03-02 11:37:51 +0000
commit873ce15ef684e0c8dc70462c00038cec986d132f (patch)
tree7ade71f7302e8374672d2890e5d5eb014ea1d9b1 /plugins/org.eclipse.emf.cdo.ui
parent07d6b27f8f7255780603bc0b27caef8c53dbe1d9 (diff)
downloadcdo-873ce15ef684e0c8dc70462c00038cec986d132f.tar.gz
cdo-873ce15ef684e0c8dc70462c00038cec986d132f.tar.xz
cdo-873ce15ef684e0c8dc70462c00038cec986d132f.zip
[458349] Consolidate UI
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=458349
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/.settings/.api_filters8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch65
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java188
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/TimeSlider.java247
4 files changed, 377 insertions, 131 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.ui/.settings/.api_filters
index b7ef41db0b..79baef5146 100644
--- a/plugins/org.eclipse.emf.cdo.ui/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo.ui/.settings/.api_filters
@@ -1524,4 +1524,12 @@
</message_arguments>
</filter>
</resource>
+ <resource path="src/org/eclipse/emf/cdo/ui/widgets/TimeSlider.java" type="org.eclipse.emf.cdo.ui.widgets.TimeSlider">
+ <filter id="571473929">
+ <message_arguments>
+ <message_argument value="Scale"/>
+ <message_argument value="TimeSlider"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch b/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch
index 6e0233741c..6d2960c051 100644
--- a/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch
+++ b/plugins/org.eclipse.emf.cdo.ui/CDOClient1.launch
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
+<setAttribute key="additional_plugins">
+<setEntry value="javax.servlet:3.0.0.v201112011016:default:false"/>
+<setEntry value="javax.servlet:3.1.0.v201410161800:default:false"/>
+</setAttribute>
<booleanAttribute key="append.args" value="true"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
@@ -11,6 +15,8 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/CDOClient1"/>
<booleanAttribute key="default" value="true"/>
+<stringAttribute key="featureDefaultLocation" value="workspace"/>
+<stringAttribute key="featurePluginResolution" value="workspace"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../ws-cdo.client1"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
@@ -23,11 +29,68 @@
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -nosplash&#13;&#10;-console&#13;&#10;-clean"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -nosplash&#13;&#10;-clean"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:MaxPermSize=512m&#13;&#10;-Xms40m&#13;&#10;-Xmx1g&#13;&#10;-Dosgi.console.enable.builtin=true&#13;&#10;-Dosgi.checkConfiguration=false"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<setAttribute key="selected_features">
+<setEntry value="org.eclipse.e4.rcp:default"/>
+<setEntry value="org.eclipse.ecf.core.feature:default"/>
+<setEntry value="org.eclipse.ecf.core.ssl.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.httpclient4.ssl.feature:default"/>
+<setEntry value="org.eclipse.ecf.filetransfer.ssl.feature:default"/>
+<setEntry value="org.eclipse.emf.cdo.compare:default"/>
+<setEntry value="org.eclipse.emf.cdo.doc:default"/>
+<setEntry value="org.eclipse.emf.cdo.epp:default"/>
+<setEntry value="org.eclipse.emf.cdo.examples:default"/>
+<setEntry value="org.eclipse.emf.cdo.explorer:default"/>
+<setEntry value="org.eclipse.emf.cdo.license:default"/>
+<setEntry value="org.eclipse.emf.cdo.migrator:default"/>
+<setEntry value="org.eclipse.emf.cdo.server.db:default"/>
+<setEntry value="org.eclipse.emf.cdo.server:default"/>
+<setEntry value="org.eclipse.emf.cdo:default"/>
+<setEntry value="org.eclipse.emf.common:default"/>
+<setEntry value="org.eclipse.emf.ecore:default"/>
+<setEntry value="org.eclipse.emf.ecp.emfforms.runtime.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.categorization.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.compoundcontrol.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.custom.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.group.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.horizontal.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.label.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.rule.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.stack.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.table.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.template.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.treemasterdetail.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.unset.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.validation.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.view.vertical.feature:default"/>
+<setEntry value="org.eclipse.emf.ecp.viewmodel.feature:default"/>
+<setEntry value="org.eclipse.equinox.executable:default"/>
+<setEntry value="org.eclipse.equinox.p2.core.feature:default"/>
+<setEntry value="org.eclipse.equinox.p2.extras.feature:default"/>
+<setEntry value="org.eclipse.equinox.p2.rcp.feature:default"/>
+<setEntry value="org.eclipse.equinox.p2.user.ui:default"/>
+<setEntry value="org.eclipse.help:default"/>
+<setEntry value="org.eclipse.jdt:default"/>
+<setEntry value="org.eclipse.net4j.db.doc:default"/>
+<setEntry value="org.eclipse.net4j.db.h2:default"/>
+<setEntry value="org.eclipse.net4j.db:default"/>
+<setEntry value="org.eclipse.net4j.doc:default"/>
+<setEntry value="org.eclipse.net4j.sdk:default"/>
+<setEntry value="org.eclipse.net4j.ui:default"/>
+<setEntry value="org.eclipse.net4j.util.doc:default"/>
+<setEntry value="org.eclipse.net4j.util.ui:default"/>
+<setEntry value="org.eclipse.net4j.util:default"/>
+<setEntry value="org.eclipse.net4j:default"/>
+<setEntry value="org.eclipse.pde:default"/>
+<setEntry value="org.eclipse.platform:default"/>
+<setEntry value="org.eclipse.rcp:default"/>
+</setAttribute>
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.servlet@default:default,org.apache.lucene.analysis@default:default,org.apache.lucene.core@default:default,org.apache.lucene.highlighter@default:default,org.apache.lucene.memory@default:default,org.apache.lucene.misc@default:default,org.apache.lucene.queries@default:default,org.apache.lucene.snowball@default:default,org.apache.lucene.spellchecker@default:default,org.apache.lucene@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.compare@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.filesystem.win32.x86_64@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net.win32.x86_64@default:false,org.eclipse.core.net@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.emf.common.ui@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.compare@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.edit@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.edit.ui@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security.win32.x86_64@default:false,org.eclipse.equinox.security@default:default,org.eclipse.help.base@default:default,org.eclipse.help.ui@default:default,org.eclipse.help@default:default,org.eclipse.jetty.continuation@default:default,org.eclipse.jetty.http@default:default,org.eclipse.jetty.io@default:default,org.eclipse.jetty.security@default:default,org.eclipse.jetty.server@default:default,org.eclipse.jetty.servlet@default:default,org.eclipse.jetty.util@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.platform@default:default,org.eclipse.swt.win32.win32.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.team.ui@default:default,org.eclipse.text@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ui.intro@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.ui.net@default:default,org.eclipse.ui.trace@default:default,org.eclipse.ui.views.log@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.win32@default:false,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.h2@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.admin@default:default,org.eclipse.emf.cdo.common@default:default,org.eclipse.emf.cdo.compare@default:default,org.eclipse.emf.cdo.edit@default:default,org.eclipse.emf.cdo.examples.company.edit@default:default,org.eclipse.emf.cdo.examples.company@default:default,org.eclipse.emf.cdo.location@default:default,org.eclipse.emf.cdo.net4j@default:default,org.eclipse.emf.cdo.security.edit@default:default,org.eclipse.emf.cdo.security.editor@default:default,org.eclipse.emf.cdo.security@default:default,org.eclipse.emf.cdo.team@default:default,org.eclipse.emf.cdo.transfer.repository@default:default,org.eclipse.emf.cdo.transfer.ui@default:default,org.eclipse.emf.cdo.transfer.workspace.ui@default:default,org.eclipse.emf.cdo.transfer.workspace@default:default,org.eclipse.emf.cdo.transfer@default:default,org.eclipse.emf.cdo.ui.admin@default:default,org.eclipse.emf.cdo.ui.efs@default:default,org.eclipse.emf.cdo.ui.ide@default:default,org.eclipse.emf.cdo.ui.location@default:default,org.eclipse.emf.cdo.ui.shared@default:default,org.eclipse.emf.cdo.ui@default:default,org.eclipse.emf.cdo@default:default,org.eclipse.net4j.db.h2@default:default,org.eclipse.net4j.db@default:default,org.eclipse.net4j.jvm@default:default,org.eclipse.net4j.tcp@default:default,org.eclipse.net4j.ui.shared@default:default,org.eclipse.net4j.ui@default:default,org.eclipse.net4j.util.ui@default:default,org.eclipse.net4j.util@default:default,org.eclipse.net4j@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
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 08914412d1..030f4fe7fe 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
@@ -13,6 +13,7 @@
package org.eclipse.emf.cdo.internal.ui.editor;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
@@ -24,12 +25,13 @@ import org.eclipse.emf.cdo.internal.ui.bundle.OM;
import org.eclipse.emf.cdo.internal.ui.dialogs.BulkAddDialog;
import org.eclipse.emf.cdo.internal.ui.dialogs.RollbackTransactionDialog;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.ui.CDOEditorInput;
import org.eclipse.emf.cdo.ui.CDOEventHandler;
import org.eclipse.emf.cdo.ui.CDOLabelProvider;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.ui.widgets.TimeSlider;
import org.eclipse.emf.cdo.util.CDOURIUtil;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.util.ValidationException;
@@ -115,11 +117,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeViewerListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
@@ -130,8 +130,6 @@ 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.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
@@ -139,7 +137,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
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;
@@ -173,14 +170,10 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.EventObject;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-//import org.eclipse.emf.cdo.internal.ui.editor.provider.CDOItemProviderAdapterFactory;
-//import org.eclipse.core.runtime.NullProgressMonitor;
/**
* @author Eike Stepper
@@ -1209,17 +1202,63 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
// Create a page for the selection tree view.
getContainer().setLayoutData(UIUtil.createGridData());
getContainer().setLayout(UIUtil.createGridLayout(1));
- Composite composite = UIUtil.createGridComposite(getContainer(), 1);
+
+ final Composite composite = UIUtil.createGridComposite(getContainer(), 1);
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(UIUtil.createGridLayout(1));
+
Tree tree = new Tree(composite, SWT.MULTI);
tree.setLayoutData(UIUtil.createGridData());
- final Set<CDOID> expandedIDs = new HashSet<CDOID>();
- final boolean sliderAllowed = view.isReadOnly() && view.getSession().getRepositoryInfo().isSupportingAudits();
- if (sliderAllowed)
+ final boolean timeSliderAllowed = view.isReadOnly() && view.getSession().getRepositoryInfo().isSupportingAudits();
+ if (timeSliderAllowed)
{
- createTimeSlider(composite, expandedIDs);
+ IAction toolbarToggleAction = new Action()
+ {
+ private Group group;
+
+ private TimeSlider timeSlider;
+
+ @Override
+ public void run()
+ {
+ if (group == null)
+ {
+ group = new Group(composite, SWT.NONE);
+ group.setLayoutData(new GridData(SWT.FILL, 50, true, false));
+ group.setLayout(new FillLayout());
+ group.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+
+ timeSlider = new TimeSlider(group, SWT.HORIZONTAL)
+ {
+ @Override
+ protected void timeStampChanged(long timeStamp)
+ {
+ super.timeStampChanged(timeStamp);
+ group.setText(formatTimeSliderLabel(timeStamp));
+ }
+ };
+
+ timeSlider.connect(view, selectionViewer);
+ group.setText(formatTimeSliderLabel(timeSlider.getTimeStamp()));
+ }
+ else
+ {
+ timeSlider.disconnect();
+ group.dispose();
+ group = null;
+ timeSlider = null;
+ }
+
+ composite.layout();
+ }
+ };
+
+ toolbarToggleAction.setEnabled(true);
+ toolbarToggleAction.setChecked(false);
+ toolbarToggleAction.setImageDescriptor(SharedIcons.getDescriptor(SharedIcons.ETOOL_SLIDER));
+ toolbarToggleAction.setToolTipText(Messages.getString("CDOEditor.1")); //$NON-NLS-1$
+ getActionBars().getToolBarManager().add(toolbarToggleAction);
}
selectionViewer = new TreeViewer(tree)
@@ -1227,7 +1266,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
@Override
public void setSelection(ISelection selection, boolean reveal)
{
- if (sliderAllowed && selection instanceof IStructuredSelection)
+ if (timeSliderAllowed && selection instanceof IStructuredSelection)
{
IStructuredSelection ssel = (IStructuredSelection)selection;
for (Iterator<?> it = ssel.iterator(); it.hasNext();)
@@ -1258,38 +1297,6 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
}
};
- selectionViewer.addTreeListener(new ITreeViewerListener()
- {
- public void treeExpanded(TreeExpansionEvent event)
- {
- CDOID id = getID(event.getElement());
- if (id != null)
- {
- expandedIDs.add(id);
- }
- }
-
- public void treeCollapsed(TreeExpansionEvent event)
- {
- CDOID id = getID(event.getElement());
- if (id != null)
- {
- expandedIDs.remove(id);
- }
- }
-
- protected CDOID getID(Object element)
- {
- if (element instanceof EObject)
- {
- CDOObject object = CDOUtil.getCDOObject((EObject)element);
- return object.cdoID();
- }
-
- return null;
- }
- });
-
setCurrentViewer(selectionViewer);
selectionViewer.setContentProvider(createContentProvider());
@@ -1445,89 +1452,10 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
});
}
- /**
- * @ADDED
- */
- protected void createTimeSlider(final Composite composite, final Set<CDOID> expandedIDs)
+ protected String formatTimeSliderLabel(long timeStamp)
{
- final CDOSession session = view.getSession();
- final long startTimeStamp = session.getRepositoryInfo().getCreationTime();
- final long endTimeStamp = session.getLastUpdateTime();
-
- final int MIN = 0;
- final int MAX = 100000;
- final long absoluteTimeWindowLength = endTimeStamp - startTimeStamp;
- final long scaleFactor = MAX - MIN;
- final double stepSize = (double)absoluteTimeWindowLength / (double)scaleFactor;
-
- final Group group = new Group(composite, SWT.NONE);
- group.setLayoutData(UIUtil.createEmptyGridData());
- group.setLayout(new FillLayout());
- group.setText(CDOCommonUtil.formatTimeStamp(endTimeStamp));
- group.setVisible(false);
-
- final Scale scale = new Scale(group, SWT.HORIZONTAL);
- scale.setMinimum(MIN);
- scale.setMaximum(MAX);
- scale.setSelection(MAX);
-
- scale.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- long value = scale.getSelection();
- long timeStamp = startTimeStamp + Math.round(stepSize * value);
-
- group.setText(CDOCommonUtil.formatTimeStamp(timeStamp));
-
- view.setTimeStamp(timeStamp);
- selectionViewer.refresh();
- setExpandedStates();
- }
-
- protected void setExpandedStates()
- {
- for (CDOID id : expandedIDs)
- {
- try
- {
- CDOObject object = view.getObject(id);
- selectionViewer.setExpandedState(object, true);
- }
- catch (Exception ex)
- {
- // Ignore
- }
- }
- }
- });
-
- IAction action = new Action()
- {
- @Override
- public void run()
- {
- if (group.isVisible())
- {
- group.setVisible(false);
- group.setLayoutData(UIUtil.createEmptyGridData());
- composite.layout();
- }
- else
- {
- group.setVisible(true);
- group.setLayoutData(new GridData(SWT.FILL, 50, true, false));
- composite.layout();
- }
- }
- };
-
- action.setEnabled(true);
- action.setChecked(false);
- action.setImageDescriptor(SharedIcons.getDescriptor(SharedIcons.ETOOL_SLIDER));
- action.setToolTipText(Messages.getString("CDOEditor.1")); //$NON-NLS-1$
- getActionBars().getToolBarManager().add(action);
+ CDOBranchPoint branchPoint = CDOBranchUtil.normalizeBranchPoint(view.getBranch(), timeStamp);
+ return branchPoint.getBranch().getPathName() + " [" + CDOCommonUtil.formatTimeStamp(timeStamp) + "]";
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/TimeSlider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/TimeSlider.java
new file mode 100644
index 0000000000..eae38c27af
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/TimeSlider.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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
+ */
+package org.eclipse.emf.cdo.ui.widgets;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPointRange;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOStaleReferencePolicy;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.view.CDOViewTargetChangedEvent;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.jface.viewers.ITreeViewerListener;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Scale;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @since 4.4
+ */
+public class TimeSlider extends Scale implements IListener, ITreeViewerListener
+{
+ private static final int MIN = 0;
+
+ private static final int MAX = 100000;
+
+ private static final double FACTOR = MAX - MIN;
+
+ private final Set<CDOID> expandedIDs = new HashSet<CDOID>();
+
+ private long startTimeStamp;
+
+ private long endTimeStamp;
+
+ private long absoluteTimeWindowLength;
+
+ private double stepSize;
+
+ private long timeStamp;
+
+ private CDOStaleReferencePolicy.DynamicProxy.Enhanced staleReferencePolicy;
+
+ private CDOView view;
+
+ private TreeViewer viewer;
+
+ public TimeSlider(Composite parent, int style)
+ {
+ super(parent, style);
+ setMinimum(MIN);
+ setMaximum(MAX);
+ setSelection(MAX);
+ setPageIncrement(MAX - MIN);
+
+ addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ long value = getSelection();
+ long timeStamp = startTimeStamp + Math.round(stepSize * value);
+ setTimeStamp(timeStamp);
+
+ viewer.refresh();
+ setExpandedStates();
+ }
+
+ protected void setExpandedStates()
+ {
+ for (CDOID id : expandedIDs)
+ {
+ try
+ {
+ CDOObject object = view.getObject(id);
+ viewer.setExpandedState(object, true);
+ }
+ catch (Exception ex)
+ {
+ // Ignore
+ }
+ }
+ }
+ });
+ }
+
+ public final long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(long timeStamp)
+ {
+ if (timeStamp == CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ timeStamp = endTimeStamp;
+ }
+ else if (timeStamp < startTimeStamp)
+ {
+ timeStamp = startTimeStamp;
+ }
+ else if (timeStamp > endTimeStamp)
+ {
+ timeStamp = endTimeStamp;
+ }
+
+ if (this.timeStamp != timeStamp)
+ {
+ this.timeStamp = timeStamp;
+ timeStampChanged(timeStamp);
+ }
+ }
+
+ public void connect(CDOView view, TreeViewer viewer)
+ {
+ disconnect();
+
+ this.view = view;
+ this.viewer = viewer;
+
+ for (Object element : viewer.getExpandedElements())
+ {
+ CDOID id = getID(element);
+ if (id != null)
+ {
+ expandedIDs.add(id);
+ }
+ }
+
+ viewer.addTreeListener(this);
+
+ CDOObject input = CDOUtil.getCDOObject((EObject)viewer.getInput());
+ CDOBranchPointRange lifetime = CDOUtil.getLifetime(input);
+
+ startTimeStamp = lifetime.getStartPoint().getTimeStamp();
+ endTimeStamp = lifetime.getEndPoint().getTimeStamp();
+ if (endTimeStamp == CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ CDOSession session = view.getSession();
+ endTimeStamp = session.getLastUpdateTime();
+ }
+
+ absoluteTimeWindowLength = endTimeStamp - startTimeStamp;
+ stepSize = absoluteTimeWindowLength / FACTOR;
+
+ setTimeStamp(endTimeStamp);
+
+ staleReferencePolicy = new CDOStaleReferencePolicy.DynamicProxy.Enhanced(view);
+ view.addListener(this);
+ }
+
+ public void disconnect()
+ {
+ if (staleReferencePolicy != null)
+ {
+ view.removeListener(this);
+ staleReferencePolicy.dispose();
+ staleReferencePolicy = null;
+
+ expandedIDs.clear();
+ viewer.removeTreeListener(this);
+
+ viewer = null;
+ view = null;
+ }
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof CDOViewTargetChangedEvent)
+ {
+ CDOViewTargetChangedEvent e = (CDOViewTargetChangedEvent)event;
+ setTimeStamp(e.getBranchPoint().getTimeStamp());
+ }
+ }
+
+ public void treeExpanded(TreeExpansionEvent event)
+ {
+ CDOID id = getID(event.getElement());
+ if (id != null)
+ {
+ expandedIDs.add(id);
+ }
+ }
+
+ public void treeCollapsed(TreeExpansionEvent event)
+ {
+ CDOID id = getID(event.getElement());
+ if (id != null)
+ {
+ expandedIDs.remove(id);
+ }
+ }
+
+ @Override
+ public void dispose()
+ {
+ disconnect();
+ super.dispose();
+ }
+
+ protected void timeStampChanged(long timeStamp)
+ {
+ view.setTimeStamp(timeStamp);
+ }
+
+ @Override
+ protected void checkSubclass()
+ {
+ // Allow overriding.
+ }
+
+ private CDOID getID(Object element)
+ {
+ if (element instanceof EObject)
+ {
+ CDOObject object = CDOUtil.getCDOObject((EObject)element, false);
+ if (object != null)
+ {
+ return object.cdoID();
+ }
+ }
+
+ return null;
+ }
+}

Back to the top