summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-25 05:03:40 (EDT)
committerEike Stepper2007-07-25 05:03:40 (EDT)
commit1c0e66e3f03c4c4291b0f5229fdfb658d24148ac (patch)
tree8e5cb552a1db4f6da11ec9bba7eaeb3a02bbb314
parent236ede4eb55fcabec8604950cd64f469355eacb9 (diff)
downloadcdo-1c0e66e3f03c4c4291b0f5229fdfb658d24148ac.zip
cdo-1c0e66e3f03c4c4291b0f5229fdfb658d24148ac.tar.gz
cdo-1c0e66e3f03c4c4291b0f5229fdfb658d24148ac.tar.bz2
*** empty log message ***
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java37
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java52
2 files changed, 50 insertions, 39 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java
index eadae2b..7114711 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageManagerDialog.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.cdo.internal.ui.dialogs;
import org.eclipse.emf.cdo.CDOSession;
import org.eclipse.emf.cdo.internal.ui.SharedIcons;
import org.eclipse.emf.cdo.internal.ui.actions.RegisterCDOPackageAction;
+import org.eclipse.emf.cdo.internal.ui.views.CDOItemProvider;
import org.eclipse.emf.cdo.protocol.model.CDOPackage;
import org.eclipse.emf.cdo.util.CDOUtil;
@@ -84,7 +85,7 @@ public class PackageManagerDialog extends TitleAreaDialog
protected Control createDialogArea(Composite parent)
{
Composite composite = (Composite)super.createDialogArea(parent);
- setTitle(TITLE);
+ setTitle("Packages of " + CDOItemProvider.getSessionLabel(session));
setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
viewer = new TableViewer(composite, SWT.NONE);
@@ -128,9 +129,21 @@ public class PackageManagerDialog extends TitleAreaDialog
new RegisterCDOPackageAction(page, session)
{
@Override
- protected void postRegistration(EPackage package1)
+ protected void postRegistration(EPackage ePackage)
{
- viewer.refresh();
+ page.getWorkbenchWindow().getShell().getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ viewer.refresh();
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
+ });
}
}.run();
}
@@ -234,15 +247,12 @@ public class PackageManagerDialog extends TitleAreaDialog
private CDOSession session;
- private Content[] elements;
-
public ContentProvider()
{
}
public void dispose()
{
- elements = null;
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
@@ -252,28 +262,17 @@ public class PackageManagerDialog extends TitleAreaDialog
if (!ObjectUtil.equals(session, newInput))
{
session = (CDOSession)newInput;
- elements = null;
}
}
}
public Object[] getElements(Object inputElement)
{
- if (inputElement == session)
+ if (inputElement != session)
{
- if (elements == null)
- {
- elements = createContent();
- }
-
- return elements;
+ return NO_ELEMENTS;
}
- return NO_ELEMENTS;
- }
-
- private Content[] createContent()
- {
Map<String, Content> map = new HashMap();
for (Entry<String, Object> entry : session.getPackageRegistry().entrySet())
{
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
index 8878917..1445c36 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOItemProvider.java
@@ -175,34 +175,17 @@ public class CDOItemProvider extends ContainerItemProvider
{
if (obj instanceof CDOSession)
{
- CDOSession session = (CDOSession)obj;
- IConnector connector = session.getChannel().getConnector();
- String repositoryName = session.getRepositoryName();
- return connector.getURL() + "/" + repositoryName + " [" + session.getSessionID() + "]";
- }
-
- if (obj instanceof CDOTransaction)
- {
- CDOTransaction transaction = (CDOTransaction)obj;
- return MessageFormat.format("{0}Transaction [{1}]", transaction.isDirty() ? "*" : "", transaction.getID());
- }
-
- if (obj instanceof CDOAudit)
- {
- CDOAudit audit = (CDOAudit)obj;
- return MessageFormat.format("Audit [{0,date} {0,time}]", audit.getTimeStamp());
+ return getSessionLabel((CDOSession)obj);
}
if (obj instanceof CDOView)
{
- CDOView view = (CDOView)obj;
- return MessageFormat.format("View [{0}]", view.getID());
+ return getViewLabel((CDOView)obj);
}
if (obj instanceof CDOViewHistory.Entry)
{
- CDOViewHistory.Entry entry = (CDOViewHistory.Entry)obj;
- return (entry.getView().isDirty() ? "*" : "") + entry.getResourcePath();
+ return getHistroyEntryLabel((CDOViewHistory.Entry)obj);
}
return super.getText(obj);
@@ -235,6 +218,35 @@ public class CDOItemProvider extends ContainerItemProvider
return super.getImage(obj);
}
+ public static String getSessionLabel(CDOSession session)
+ {
+ IConnector connector = session.getChannel().getConnector();
+ String repositoryName = session.getRepositoryName();
+ return connector.getURL() + "/" + repositoryName + " [" + session.getSessionID() + "]";
+ }
+
+ public static String getViewLabel(CDOView view)
+ {
+ if (view instanceof CDOTransaction)
+ {
+ CDOTransaction transaction = (CDOTransaction)view;
+ return MessageFormat.format("{0}Transaction [{1}]", transaction.isDirty() ? "*" : "", transaction.getID());
+ }
+
+ if (view instanceof CDOAudit)
+ {
+ CDOAudit audit = (CDOAudit)view;
+ return MessageFormat.format("Audit [{0,date} {0,time}]", audit.getTimeStamp());
+ }
+
+ return MessageFormat.format("View [{0}]", view.getID());
+ }
+
+ public static String getHistroyEntryLabel(CDOViewHistory.Entry entry)
+ {
+ return (entry.getView().isDirty() ? "*" : "") + entry.getResourcePath();
+ }
+
@Override
protected void fillContextMenu(IMenuManager manager, ITreeSelection selection)
{