Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-02-22 16:21:40 +0000
committerEike Stepper2015-02-23 05:49:06 +0000
commit9c12b9143fadefb1fe0543d6615a55a5807c0c1a (patch)
tree888a93f6f7e7034124183ace5130e5a5fb2cc8f3 /plugins/org.eclipse.emf.cdo.ui
parentd1925e4c2974aa288f1d8dea7a1d3922fcaecc1c (diff)
downloadcdo-9c12b9143fadefb1fe0543d6615a55a5807c0c1a.tar.gz
cdo-9c12b9143fadefb1fe0543d6615a55a5807c0c1a.tar.xz
cdo-9c12b9143fadefb1fe0543d6615a55a5807c0c1a.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/actions/OpenDurableViewAction.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/TransactionalBackgroundAction.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectCommitDialog.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java42
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java63
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOInteractiveExceptionHandler.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelDecorator.java56
15 files changed, 207 insertions, 123 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java
index aae78eb29e..30ba017851 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java
@@ -17,6 +17,8 @@ import org.eclipse.emf.cdo.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IWorkbenchPage;
@@ -54,15 +56,23 @@ public final class OpenDurableViewAction extends AbstractOpenViewAction
@Override
protected void doRun(IProgressMonitor progressMonitor) throws Exception
{
+ CDOSession session = getSession();
+ CDOView view = null;
+
try
{
- CDOSession session = getSession();
CDOTransaction transaction = session.openTransaction(areaID);
- OpenTransactionAction.configureTransaction(transaction);
+ CDOUtil.configureView(transaction);
+ view = transaction;
}
catch (IllegalStateException ex)
{
- getSession().openView(areaID);
+ view = getSession().openView(areaID);
+ }
+
+ if (view != null)
+ {
+ CDOUtil.configureView(view);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
index fd66c170ff..d94204c9d9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
@@ -14,8 +14,8 @@ package org.eclipse.emf.cdo.internal.ui.actions;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.transaction.CDOTransactionCommentator;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IWorkbenchPage;
@@ -44,12 +44,7 @@ public final class OpenTransactionAction extends AbstractOpenViewAction
public static CDOTransaction openTransaction(CDOSession session)
{
CDOTransaction transaction = session.openTransaction();
- configureTransaction(transaction);
+ CDOUtil.configureView(transaction);
return transaction;
}
-
- public static void configureTransaction(CDOTransaction transaction)
- {
- new CDOTransactionCommentator(transaction);
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
index fec859f666..ab09a6a1d1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
@@ -14,6 +14,8 @@ package org.eclipse.emf.cdo.internal.ui.actions;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IWorkbenchPage;
@@ -36,6 +38,7 @@ public final class OpenViewAction extends AbstractOpenViewAction
protected void doRun(IProgressMonitor progressMonitor) throws Exception
{
CDOSession session = getSession();
- session.openView();
+ CDOView view = session.openView();
+ CDOUtil.configureView(view);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/TransactionalBackgroundAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/TransactionalBackgroundAction.java
index 94ca9c1693..d8fbe28991 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/TransactionalBackgroundAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/TransactionalBackgroundAction.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
import org.eclipse.emf.cdo.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.ui.actions.LongRunningAction;
@@ -46,7 +47,7 @@ public abstract class TransactionalBackgroundAction extends LongRunningAction
{
CDOView view = object.cdoView();
CDOTransaction transaction = view.getSession().openTransaction(view.getBranch());
- OpenTransactionAction.configureTransaction(transaction);
+ CDOUtil.configureView(transaction);
return transaction;
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java
index d34a3e5324..5ec0b2f4c4 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.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
* Victor Roldan Betancort - maintenance
@@ -84,15 +84,10 @@ public class BulkAddDialog extends TitleAreaDialog
}
@Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
protected Control createDialogArea(Composite parent)
{
+ getShell().setText(TITLE);
+
Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(2, false));
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 edcc1ea5f1..638a77f617 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
@@ -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
* Victor Roldan Betancort - maintenance
@@ -62,22 +62,16 @@ public class OpenAuditDialog extends TitleAreaDialog
}
@Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
protected Control createDialogArea(Composite parent)
{
+ getShell().setText(TITLE);
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
+
Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(3, false));
- setTitle(TITLE);
- 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 | SWT.BORDER);
timeControl = new DateTime(composite, SWT.TIME | SWT.BORDER);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java
index a996240c7c..1b2b1766d7 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.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
* Victor Roldan Betancort - maintenance
@@ -57,22 +57,16 @@ public class OpenDurableViewDialog extends TitleAreaDialog
}
@Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
protected Control createDialogArea(Composite parent)
{
+ getShell().setText(TITLE);
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
+
Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(3, false));
- setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
-
new Label(composite, SWT.NONE).setText(Messages.getString("OpenDurableViewDialog.1")); //$NON-NLS-1$
idControl = new Text(composite, SWT.BORDER);
idControl.setLayoutData(UIUtil.createGridData(true, false));
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java
index 95698e3e48..e47c966ef2 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java
@@ -41,6 +41,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -93,20 +94,20 @@ public class PackageRegistryDialog extends TitleAreaDialog
}
@Override
- protected void configureShell(Shell newShell)
+ protected Point getInitialSize()
{
- super.configureShell(newShell);
- newShell.setText(TITLE);
- newShell.setSize(660, 500);
+ return new Point(660, 500);
}
@Override
protected Control createDialogArea(Composite parent)
{
- Composite composite = (Composite)super.createDialogArea(parent);
+ getShell().setText(TITLE);
setTitle(session.toString());
setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
+ Composite composite = (Composite)super.createDialogArea(parent);
+
viewer = new TableViewer(composite, SWT.NONE);
Table table = viewer.getTable();
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
index 83bd1e6a23..7f19286889 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
@@ -55,22 +55,16 @@ public class RollbackTransactionDialog extends TitleAreaDialog
}
@Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- @Override
protected Control createDialogArea(Composite parent)
{
+ getShell().setText(title);
+ setTitle(description);
+ setTitleImage(getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION));
+
Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(new GridLayout(1, false));
- setTitle(description);
- setTitleImage(getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION));
-
Label label = new Label(composite, SWT.NONE);
label.setText(formatMessage());
label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
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 81af27dd4a..105fcf17bb 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
@@ -24,12 +24,12 @@ import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
/**
@@ -111,10 +111,9 @@ public class SelectBranchPointDialog extends TitleAreaDialog implements Validati
}
@Override
- protected void configureShell(Shell newShell)
+ protected Point getInitialSize()
{
- super.configureShell(newShell);
- newShell.setSize(700, 500);
+ return new Point(700, 500);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectCommitDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectCommitDialog.java
index 873c3ac937..6bf265874e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectCommitDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectCommitDialog.java
@@ -20,12 +20,14 @@ import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
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.Shell;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IWorkbenchPage;
/**
@@ -66,10 +68,9 @@ public class SelectCommitDialog extends TitleAreaDialog
}
@Override
- protected void configureShell(Shell newShell)
+ protected Point getInitialSize()
{
- super.configureShell(newShell);
- newShell.setSize(750, 600);
+ return new Point(750, 600);
}
@Override
@@ -108,6 +109,35 @@ public class SelectCommitDialog extends TitleAreaDialog
commitHistoryComposite.setLayoutData(UIUtil.createGridData());
commitHistoryComposite.setInput(new CommitHistoryComposite.Input(session, null, null));
+ final Display display = parent.getDisplay();
+ display.asyncExec(new Runnable()
+ {
+ private long end = System.currentTimeMillis() + 5000L;
+
+ public void run()
+ {
+ if (!commitHistoryComposite.isDisposed())
+ {
+ Table table = commitHistoryComposite.getTableViewer().getTable();
+ if (table.getItemCount() != 0)
+ {
+ Object data = table.getItem(0).getData();
+ if (data instanceof CDOCommitInfo)
+ {
+ setCommitInfo((CDOCommitInfo)data);
+ table.select(0);
+ return;
+ }
+ }
+
+ if (System.currentTimeMillis() < end)
+ {
+ display.asyncExec(this);
+ }
+ }
+ }
+ });
+
return area;
}
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 ff93a5c1dd..08914412d1 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
@@ -1034,33 +1034,37 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
public void commandStackChanged(final EventObject event)
{
- getContainer().getDisplay().asyncExec(new Runnable()
+ Composite container = getContainer();
+ if (!container.isDisposed())
{
- public void run()
+ container.getDisplay().asyncExec(new Runnable()
{
- firePropertyChange(IEditorPart.PROP_DIRTY);
-
- // Try to select the affected objects.
- //
- Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
- if (mostRecentCommand != null)
- {
- setSelectionToViewer(mostRecentCommand.getAffectedObjects());
- }
- for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();)
+ public void run()
{
- PropertySheetPage propertySheetPage = i.next();
- if (propertySheetPage.getControl().isDisposed())
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null)
{
- i.remove();
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
}
- else
+ for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();)
{
- propertySheetPage.refresh();
+ PropertySheetPage propertySheetPage = i.next();
+ if (propertySheetPage.getControl().isDisposed())
+ {
+ i.remove();
+ }
+ else
+ {
+ propertySheetPage.refresh();
+ }
}
}
- }
- });
+ });
+ }
}
});
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
index dfc889e4f8..c50d36d512 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java
@@ -23,6 +23,7 @@ import org.eclipse.emf.cdo.transaction.CDOTransactionStartedEvent;
import org.eclipse.emf.cdo.view.CDOObjectHandler;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
+import org.eclipse.emf.cdo.view.CDOViewLocksChangedEvent;
import org.eclipse.net4j.util.container.IContainerDelta;
import org.eclipse.net4j.util.container.IContainerEvent;
@@ -37,6 +38,7 @@ import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.PlatformUI;
import java.util.List;
@@ -90,6 +92,15 @@ public class CDOEventHandler
checkDetachedSelection(e.getDetachedObjects());
viewInvalidated(e.getDirtyObjects());
}
+ else if (event instanceof CDOViewLocksChangedEvent)
+ {
+ CDOViewLocksChangedEvent e = (CDOViewLocksChangedEvent)event;
+ List<CDOObject> objects = e.getAffectedObjects(view);
+ if (!objects.isEmpty())
+ {
+ updateElement(objects.toArray());
+ }
+ }
else if (event instanceof CDOTransactionFinishedEvent)
{
// CDOTransactionFinishedEvent e = (CDOTransactionFinishedEvent)event;
@@ -259,19 +270,23 @@ public class CDOEventHandler
{
try
{
- treeViewer.getControl().getDisplay().asyncExec(new Runnable()
+ Control control = treeViewer.getControl();
+ if (!control.isDisposed())
{
- public void run()
+ control.getDisplay().asyncExec(new Runnable()
{
- try
- {
- treeViewer.refresh(true);
- }
- catch (Exception ignore)
+ public void run()
{
+ try
+ {
+ treeViewer.refresh(true);
+ }
+ catch (Exception ignore)
+ {
+ }
}
- }
- });
+ });
+ }
}
catch (Exception ignore)
{
@@ -285,19 +300,31 @@ public class CDOEventHandler
{
try
{
- treeViewer.getControl().getDisplay().asyncExec(new Runnable()
+ Control control = treeViewer.getControl();
+ if (!control.isDisposed())
{
- public void run()
+ control.getDisplay().asyncExec(new Runnable()
{
- try
- {
- treeViewer.update(element, null);
- }
- catch (Exception ignore)
+ public void run()
{
+ try
+ {
+ if (element instanceof Object[])
+ {
+ Object[] elements = (Object[])element;
+ treeViewer.update(elements, null);
+ }
+ else
+ {
+ treeViewer.update(element, null);
+ }
+ }
+ catch (Exception ignore)
+ {
+ }
}
- }
- });
+ });
+ }
}
catch (Exception ignore)
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOInteractiveExceptionHandler.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOInteractiveExceptionHandler.java
index fef4b2bf46..0c89c0a17b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOInteractiveExceptionHandler.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOInteractiveExceptionHandler.java
@@ -37,7 +37,7 @@ import java.text.MessageFormat;
/**
* A <code>CDOSession</code> {@link org.eclipse.emf.cdo.session.CDOSession.ExceptionHandler ExceptionHandler}
* implementation that shows exception information on a UI {@link ExceptionDialog dialog}
- *
+ *
* @author Eike Stepper
* @since 2.0
* @see org.eclipse.emf.cdo.session.CDOSession.ExceptionHandler
@@ -124,7 +124,7 @@ public class CDOInteractiveExceptionHandler implements CDOSession.ExceptionHandl
/**
* A dialog that shows CDO related exceptions in a convenient manner.
- *
+ *
* @author Eike Stepper
* @see org.eclipse.emf.cdo.ui.CDOInteractiveExceptionHandler
*/
@@ -148,15 +148,15 @@ public class CDOInteractiveExceptionHandler implements CDOSession.ExceptionHandl
}
@Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
protected Control createDialogArea(Composite parent)
{
+ getShell().setText(TITLE);
+
+ String attemptsStr = attempt == 1 ? Messages.getString("CDOInteractiveExceptionHandler.1") : Messages.getString("CDOInteractiveExceptionHandler.2"); //$NON-NLS-1$ //$NON-NLS-2$
+ setTitle(MessageFormat.format(
+ Messages.getString("CDOInteractiveExceptionHandler.3"), session, attempt, attemptsStr));//$NON-NLS-1$
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PROTOCOL_PROBLEM));
+
GridLayout layout = UIUtil.createGridLayout(1);
layout.marginWidth = 10;
layout.marginHeight = 10;
@@ -165,11 +165,6 @@ public class CDOInteractiveExceptionHandler implements CDOSession.ExceptionHandl
composite.setLayoutData(UIUtil.createGridData());
composite.setLayout(layout);
- String attemptsStr = attempt == 1 ? Messages.getString("CDOInteractiveExceptionHandler.1") : Messages.getString("CDOInteractiveExceptionHandler.2"); //$NON-NLS-1$ //$NON-NLS-2$
- setTitle(MessageFormat.format(
- Messages.getString("CDOInteractiveExceptionHandler.3"), session, attempt, attemptsStr));//$NON-NLS-1$
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PROTOCOL_PROBLEM));
-
String str = IOUtil.toString(exception);
str = str.replaceAll("\r", ""); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelDecorator.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelDecorator.java
index f0aa625afc..9d5d737cc7 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelDecorator.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelDecorator.java
@@ -16,8 +16,12 @@ import org.eclipse.emf.cdo.CDOElement.StateProvider;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.lock.CDOLockOwner;
+import org.eclipse.emf.cdo.common.lock.CDOLockState;
import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
@@ -26,6 +30,7 @@ import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.om.pref.OMPreferencesChangeEvent;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.spi.cdo.FSMUtil;
import org.eclipse.emf.spi.cdo.InternalCDOObject;
import org.eclipse.emf.spi.cdo.InternalCDOView;
@@ -55,6 +60,10 @@ public class CDOLabelDecorator implements ILabelDecorator
public static final String DECORATOR_ID = "org.eclipse.emf.cdo.ui.CDOLabelDecorator"; //$NON-NLS-1$
+ private static final Image LOCK_OVERLAY = SharedIcons.getImage(SharedIcons.OVR_LOCK);
+
+ private static final Image LOCK_SELF_OVERLAY = SharedIcons.getImage(SharedIcons.OVR_LOCK_SELF);
+
private String pattern;
private IListener preferenceListener = new IListener()
@@ -76,6 +85,11 @@ public class CDOLabelDecorator implements ILabelDecorator
OM.PREFS.addListener(preferenceListener);
}
+ public CDOLabelDecorator(String pattern)
+ {
+ this.pattern = pattern;
+ }
+
public void dispose()
{
OM.PREFS.removeListener(preferenceListener);
@@ -91,15 +105,9 @@ public class CDOLabelDecorator implements ILabelDecorator
return StringUtil.replace(unparsedPattern, DECORATION_PROPOSALS, DECORATION_ARGS);
}
- public CDOLabelDecorator(String pattern)
- {
- this.pattern = pattern;
- }
-
public Image decorateImage(Image image, Object element)
{
- // Use default
- return null;
+ return decorate(image, element);
}
public String decorateText(String text, Object element)
@@ -175,4 +183,38 @@ public class CDOLabelDecorator implements ILabelDecorator
return state.toString().toLowerCase();
}
+
+ /**
+ * @since 4.4
+ */
+ public static Image decorate(Image image, Object element)
+ {
+ if (element instanceof EObject)
+ {
+ EObject eObject = (EObject)element;
+ CDOObject cdoObject = CDOUtil.getCDOObject(eObject);
+ if (cdoObject != null)
+ {
+ CDOLockState lockState = cdoObject.cdoLockState();
+ if (lockState != null)
+ {
+ CDOLockOwner owner = lockState.getWriteLockOwner();
+ if (owner != null)
+ {
+ if (owner.equals(cdoObject.cdoView()))
+ {
+ image = OM.getOverlayImage(image, LOCK_SELF_OVERLAY, 10, 0);
+ }
+ else
+ {
+ image = OM.getOverlayImage(image, LOCK_OVERLAY, 10, 0);
+ }
+ }
+ }
+ }
+ }
+
+ // Use default
+ return image;
+ }
}

Back to the top