Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-02-21 08:55:40 +0000
committerEike Stepper2015-02-21 09:36:19 +0000
commitd0cf654686666cdea5ff5e819e694bc11acc5e7e (patch)
treebba4f8a97b464b30d2591ae954e45622df5f7714 /plugins/org.eclipse.emf.cdo.ui
parenta24a72c2fde0681cc558adc0482d6d735f65d732 (diff)
downloadcdo-d0cf654686666cdea5ff5e819e694bc11acc5e7e.tar.gz
cdo-d0cf654686666cdea5ff5e819e694bc11acc5e7e.tar.xz
cdo-d0cf654686666cdea5ff5e819e694bc11acc5e7e.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/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java105
2 files changed, 71 insertions, 36 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java
index 215cd90655..81af27dd4a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java
@@ -186,7 +186,7 @@ public class SelectBranchPointDialog extends TitleAreaDialog implements Validati
protected void createCommitsTab(Composite parent)
{
- CommitHistoryComposite control = new CommitHistoryComposite(parent, SWT.NONE)
+ CommitHistoryComposite control = new CommitHistoryComposite(parent, SWT.BORDER)
{
@Override
protected void commitInfoChanged(CDOCommitInfo newCommitInfo)
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java
index 85774a4423..ad68025bbb 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/CommitHistoryComposite.java
@@ -81,6 +81,8 @@ public class CommitHistoryComposite extends Composite
}
};
+ private int viewerStyle;
+
private TableViewer tableViewer;
private LabelProvider labelProvider;
@@ -89,9 +91,11 @@ public class CommitHistoryComposite extends Composite
private Input input;
- public CommitHistoryComposite(Composite parent, int style)
+ public CommitHistoryComposite(Composite parent, int viewerStyle)
{
- super(parent, style);
+ super(parent, SWT.NONE);
+ this.viewerStyle = viewerStyle;
+
setLayout(new FillLayout(SWT.HORIZONTAL));
tableViewer = createTableViewer();
@@ -116,6 +120,14 @@ public class CommitHistoryComposite extends Composite
netRenderer = new NetRenderer(tableViewer);
}
+ /**
+ * @since 4.4
+ */
+ public final int getViewerStyle()
+ {
+ return viewerStyle;
+ }
+
public final TableViewer getTableViewer()
{
return tableViewer;
@@ -203,7 +215,7 @@ public class CommitHistoryComposite extends Composite
protected TableViewer createTableViewer()
{
- return new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
+ return new TableViewer(this, getViewerStyle() | SWT.FULL_SELECTION | SWT.MULTI);
}
protected ContentProvider createContentProvider()
@@ -305,17 +317,17 @@ public class CommitHistoryComposite extends Composite
private final CDOObject object;
- public Input(Object delegate)
+ private final boolean offline;
+
+ public Input(Object delegate) throws IllegalInputException
{
CDOSession sessionAdapter = AdapterUtil.adapt(delegate, CDOSession.class);
if (sessionAdapter != null)
{
session = sessionAdapter;
- assertNotWorkspace();
-
+ offline = determineOffline();
branch = null;
object = null;
- session.addListener(lifecycleListener);
return;
}
@@ -325,10 +337,8 @@ public class CommitHistoryComposite extends Composite
branch = branchAdapter;
session = (CDOSession)((CDOSessionProtocol)((InternalCDOBranchManager)branch.getBranchManager())
.getBranchLoader()).getSession();
- assertNotWorkspace();
-
+ offline = determineOffline();
object = null;
- session.addListener(lifecycleListener);
return;
}
@@ -337,11 +347,9 @@ public class CommitHistoryComposite extends Composite
{
CDOView view = viewAdapter;
session = view.getSession();
- assertNotWorkspace();
-
- branch = view.getBranch();
+ offline = determineOffline();
+ branch = offline ? null : view.getBranch();
object = null;
- view.addListener(lifecycleListener);
return;
}
@@ -355,32 +363,23 @@ public class CommitHistoryComposite extends Composite
if (view != null && cdoObject.cdoState() != CDOState.NEW)
{
session = view.getSession();
- branch = view.getBranch();
- object = cdoObject;
- view.addListener(lifecycleListener);
+ offline = determineOffline();
+ branch = offline ? null : view.getBranch();
+ object = offline ? null : cdoObject;
return;
}
}
}
- throw new IllegalStateException("Illegal input: " + delegate);
- }
-
- private void assertNotWorkspace()
- {
- IRegistry<String, Object> properties = session.properties();
- if (properties.containsKey("org.eclipse.emf.cdo.workspace.CDOWorkspace"))
- {
- throw new IllegalStateException("Offline input: " + session);
- }
+ throw new IllegalInputException("Illegal input: " + delegate);
}
public Input(CDOSession session, CDOBranch branch, CDOObject object)
{
this.session = session;
- this.branch = branch;
- this.object = object;
- EventUtil.addListener(getLifecycle(), lifecycleListener);
+ offline = determineOffline();
+ this.branch = offline ? null : branch;
+ this.object = offline ? null : object;
}
public final CDOSession getSession()
@@ -398,6 +397,14 @@ public class CommitHistoryComposite extends Composite
return object;
}
+ /**
+ * @since 4.4
+ */
+ public final boolean isOffline()
+ {
+ return offline;
+ }
+
@Override
public int hashCode()
{
@@ -458,22 +465,25 @@ public class CommitHistoryComposite extends Composite
@Override
public String toString()
{
- String str = "Repostory: " + session.getRepositoryInfo().getName();
- if (branch != null)
+ if (offline)
{
- str += ", Branch: " + branch.getPathName();
+ return "Offline: " + session;
}
+ String string = "Repository: " + session.getRepositoryInfo().getName() + ", Branch: "
+ + (branch != null ? branch.getPathName() : CDOBranch.MAIN_BRANCH_NAME);
+
if (object != null)
{
- str += ", Object: " + object;
+ string += ", Object: " + object;
}
- return str;
+ return string;
}
public void activate() throws LifecycleException
{
+ EventUtil.addListener(getLifecycle(), lifecycleListener);
}
public Exception deactivate()
@@ -496,6 +506,11 @@ public class CommitHistoryComposite extends Composite
protected final Object getLifecycle()
{
+ if (offline)
+ {
+ return null;
+ }
+
if (object != null)
{
return object.cdoView();
@@ -503,6 +518,26 @@ public class CommitHistoryComposite extends Composite
return session;
}
+
+ private boolean determineOffline()
+ {
+ IRegistry<String, Object> properties = session.properties();
+ return properties.containsKey("org.eclipse.emf.cdo.workspace.CDOWorkspace");
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 4.4
+ */
+ public static class IllegalInputException extends Exception
+ {
+ private static final long serialVersionUID = 1L;
+
+ public IllegalInputException(String message)
+ {
+ super(message);
+ }
+ }
}
/**

Back to the top