Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features/org.eclipse.emf.cdo.compare-feature/feature.xml2
-rw-r--r--features/org.eclipse.emf.cdo.compare-feature/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutLabelProvider.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutState.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.compare/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java21
-rw-r--r--plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/internal/compare/bundle/OM.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java43
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/bundle/OM.java13
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java75
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java108
18 files changed, 218 insertions, 116 deletions
diff --git a/features/org.eclipse.emf.cdo.compare-feature/feature.xml b/features/org.eclipse.emf.cdo.compare-feature/feature.xml
index ad573417b9..b0e0a48f5b 100644
--- a/features/org.eclipse.emf.cdo.compare-feature/feature.xml
+++ b/features/org.eclipse.emf.cdo.compare-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.emf.cdo.compare"
label="%featureName"
- version="4.7.2.qualifier"
+ version="4.8.0.qualifier"
provider-name="%providerName"
license-feature="org.eclipse.emf.cdo.license"
license-feature-version="0.0.0">
diff --git a/features/org.eclipse.emf.cdo.compare-feature/pom.xml b/features/org.eclipse.emf.cdo.compare-feature/pom.xml
index e9e17bb8f2..60026704e9 100644
--- a/features/org.eclipse.emf.cdo.compare-feature/pom.xml
+++ b/features/org.eclipse.emf.cdo.compare-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.emf.cdo.compare</artifactId>
- <version>4.7.2-SNAPSHOT</version>
+ <version>4.8.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutLabelProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutLabelProvider.java
index f0dac3886b..b9b25353af 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutLabelProvider.java
@@ -15,6 +15,7 @@ import org.eclipse.emf.cdo.internal.ui.ViewerUtil;
import org.eclipse.emf.cdo.transfer.CDOTransferElement;
import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.emf.ecore.EClass;
@@ -226,12 +227,12 @@ public class CDOCheckoutLabelProvider extends LabelProvider implements ICommonLa
{
if (object instanceof ViewerUtil.Pending)
{
- return ContainerItemProvider.PENDING_IMAGE;
+ return ContainerItemProvider.pendingImage();
}
if (object instanceof ViewerUtil.Error)
{
- return ContainerItemProvider.ERROR_IMAGE;
+ return UIUtil.errorImage();
}
try
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutState.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutState.java
index 086541d048..96e7fb4759 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutState.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOCheckoutState.java
@@ -361,7 +361,7 @@ public final class CDOCheckoutState
{
if (object instanceof ViewerUtil.Pending)
{
- return ContainerItemProvider.PENDING_COLOR;
+ return ContainerItemProvider.pendingColor();
}
if (object instanceof CDOObject)
@@ -508,7 +508,7 @@ public final class CDOCheckoutState
if (element instanceof ViewerUtil.Pending)
{
- return ContainerItemProvider.PENDING_IMAGE;
+ return ContainerItemProvider.pendingImage();
}
if (element instanceof CDOElement)
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java
index c1f8ca4e05..265953e523 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/internal/ui/bundle/OM.java
@@ -10,15 +10,11 @@
*/
package org.eclipse.emf.cdo.transfer.internal.ui.bundle;
-import org.eclipse.emf.cdo.transfer.ui.TransferLabelProvider;
-import org.eclipse.emf.cdo.transfer.ui.swt.TransferDetailsComposite.UnmappedModelsLabelProvider;
-
import org.eclipse.net4j.util.om.OMBundle;
import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.log.OMLogger;
import org.eclipse.net4j.util.om.trace.OMTracer;
import org.eclipse.net4j.util.ui.UIActivator;
-import org.eclipse.net4j.util.ui.UIUtil;
/**
* The <em>Operations & Maintenance</em> class of this bundle.
@@ -51,12 +47,6 @@ public abstract class OM
protected void doStart() throws Exception
{
INSTANCE = this;
-
- UIUtil.syncExec(() -> {
- // Bug 577425: If the classes below are first accessed from a non-UI thread SWT throws "Invalid thread access".
- TransferLabelProvider.GRAY.isDisposed();
- UnmappedModelsLabelProvider.GRAY.isDisposed();
- });
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java
index ed983127f0..328669951a 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/TransferLabelProvider.java
@@ -37,9 +37,9 @@ import org.eclipse.swt.graphics.Image;
*/
public class TransferLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider
{
- public static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+ public static final Color GRAY = UIUtil.initResource(display -> display.getSystemColor(SWT.COLOR_GRAY));
- public static final Color RED = UIUtil.getDisplay().getSystemColor(SWT.COLOR_RED);
+ public static final Color RED = UIUtil.initResource(display -> display.getSystemColor(SWT.COLOR_RED));
private CDOTransfer transfer;
diff --git a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java
index c93216a2f1..37927d327f 100644
--- a/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java
+++ b/plugins/org.eclipse.emf.cdo.transfer.ui/src/org/eclipse/emf/cdo/transfer/ui/swt/TransferDetailsComposite.java
@@ -587,9 +587,11 @@ public class TransferDetailsComposite extends Composite implements IListener
*/
public static class UnmappedModelsLabelProvider extends LabelProvider implements IColorProvider
{
- public static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+ @Deprecated
+ public static final Color GRAY = null;
- public static final Color RED = UIUtil.getDisplay().getSystemColor(SWT.COLOR_RED);
+ @Deprecated
+ public static final Color RED = null;
private CDOTransfer transfer;
@@ -627,11 +629,11 @@ public class TransferDetailsComposite extends Composite implements IListener
ModelTransferResolution resolution = context.getResolution(uri);
if (resolution != null) // TODO Test type of resolution
{
- return GRAY;
+ return UIUtil.grayColor();
}
}
- return RED;
+ return UIUtil.redColor();
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF
index 8b9a7cdd62..dfabc23b77 100644
--- a/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui.compare/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.ui.compare;singleton:=true
-Bundle-Version: 4.6.3.qualifier
+Bundle-Version: 4.7.0.qualifier
Bundle-Activator: org.eclipse.emf.cdo.ui.internal.compare.bundle.OM$Activator
Bundle-Vendor: %providerName
Bundle-ClassPath: .
@@ -21,7 +21,7 @@ Import-Package: com.google.common.base;version="[27.0.0,30.2.0)",
com.google.common.collect;version="[27.0.0,30.2.0)",
com.google.common.cache;version="[27.0.0,30.2.0)",
com.google.common.util.concurrent;version="[27.0.0,30.2.0)"
-Export-Package: org.eclipse.emf.cdo.ui.compare;version="4.6.3",
- org.eclipse.emf.cdo.ui.internal.compare;version="4.6.3";x-friends:="org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.cdo.ui.internal.compare.bundle;version="4.6.3";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.ui.compare;version="4.7.0",
+ org.eclipse.emf.cdo.ui.internal.compare;version="4.7.0";x-friends:="org.eclipse.emf.cdo.explorer.ui",
+ org.eclipse.emf.cdo.ui.internal.compare.bundle;version="4.7.0";x-internal:=true
Automatic-Module-Name: org.eclipse.emf.cdo.ui.compare
diff --git a/plugins/org.eclipse.emf.cdo.ui.compare/pom.xml b/plugins/org.eclipse.emf.cdo.ui.compare/pom.xml
index 5512332f7c..4e24f1b829 100644
--- a/plugins/org.eclipse.emf.cdo.ui.compare/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.ui.compare/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.ui.compare</artifactId>
- <version>4.6.3-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java b/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java
index ae46604f22..d7dee71ad9 100644
--- a/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java
+++ b/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/compare/CDOCompareEditorUtil.java
@@ -96,8 +96,10 @@ public final class CDOCompareEditorUtil
{
/**
* @since 4.6
+ * @deprecated As of 4.7 use {@link #compareImage()}.
*/
- public static final Image COMPARE_IMAGE = OM.getImage("icons/compare.gif");
+ @Deprecated
+ public static final Image COMPARE_IMAGE = null;
/**
* @since 4.4
@@ -119,11 +121,26 @@ public final class CDOCompareEditorUtil
private static final ThreadLocal<List<Runnable>> DISPOSE_RUNNABLES = new ThreadLocal<>();
+ private static Image compareImage;
+
private CDOCompareEditorUtil()
{
}
/**
+ * @since 4.7
+ */
+ public static Image compareImage()
+ {
+ if (compareImage == null)
+ {
+ compareImage = OM.getImage("icons/compare.gif");
+ }
+
+ return compareImage;
+ }
+
+ /**
* @since 4.4
*/
public static void closeTransactionAfterCommit(CDOTransaction transaction)
@@ -849,7 +866,7 @@ public final class CDOCompareEditorUtil
@Override
public Image getTitleImage()
{
- return COMPARE_IMAGE;
+ return compareImage();
}
public void setDisposeRunnables(List<Runnable> disposeRunnables)
diff --git a/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/internal/compare/bundle/OM.java b/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/internal/compare/bundle/OM.java
index 15086e27b5..a6be4c1f42 100644
--- a/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/internal/compare/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.ui.compare/src/org/eclipse/emf/cdo/ui/internal/compare/bundle/OM.java
@@ -11,14 +11,11 @@
*/
package org.eclipse.emf.cdo.ui.internal.compare.bundle;
-import org.eclipse.emf.cdo.ui.compare.CDOCompareEditorUtil;
-
import org.eclipse.net4j.util.om.OMBundle;
import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.log.OMLogger;
import org.eclipse.net4j.util.om.trace.OMTracer;
import org.eclipse.net4j.util.ui.UIActivator;
-import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
@@ -68,14 +65,5 @@ public abstract class OM
super(BUNDLE);
INSTANCE = this;
}
-
- @Override
- protected void doStart() throws Exception
- {
- UIUtil.syncExec(() -> {
- // Bug 577425: If the classes below are first accessed from a non-UI thread SWT throws "Invalid thread access".
- CDOCompareEditorUtil.COMPARE_IMAGE.isDisposed();
- });
- }
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
index 1d686e8488..57256e95e3 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
@@ -11,10 +11,8 @@
*/
package org.eclipse.emf.cdo.internal.ui.bundle;
-import org.eclipse.emf.cdo.internal.ui.dialogs.PackageRegistryDialog;
import org.eclipse.emf.cdo.ui.CDOEditorOpener;
import org.eclipse.emf.cdo.ui.CDOLabelDecorator;
-import org.eclipse.emf.cdo.ui.CDOLabelProvider;
import org.eclipse.emf.cdo.ui.OverlayImage;
import org.eclipse.net4j.util.om.OMBundle;
@@ -24,7 +22,6 @@ import org.eclipse.net4j.util.om.pref.OMPreference;
import org.eclipse.net4j.util.om.pref.OMPreferences;
import org.eclipse.net4j.util.om.trace.OMTracer;
import org.eclipse.net4j.util.ui.UIActivator;
-import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.emf.common.CommonPlugin;
import org.eclipse.emf.common.util.URI;
@@ -151,12 +148,6 @@ public abstract class OM
protected void doStart() throws Exception
{
CDOEditorOpener.Registry.INSTANCE.activate();
-
- UIUtil.syncExec(() -> {
- // Bug 577425: If the classes below are first accessed from a non-UI thread SWT throws "Invalid thread access".
- PackageRegistryDialog.PRODUCT_GROUP.toString();
- CDOLabelProvider.getColor(null);
- });
}
@Override
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 d7953cf21f..a3ac33b886 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
@@ -65,8 +65,6 @@ public class PackageRegistryDialog extends TitleAreaDialog
private static final String TITLE = Messages.getString("PackageRegistryDialog.0"); //$NON-NLS-1$
- private static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
-
private IWorkbenchPage page;
private CDOSession session;
@@ -306,7 +304,7 @@ public class PackageRegistryDialog extends TitleAreaDialog
return null;
}
- return GRAY;
+ return UIUtil.grayColor();
}
}
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 b27c725e34..2519dd2a29 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
@@ -1653,7 +1653,7 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
{
if (element instanceof ViewerUtil.Pending)
{
- return ContainerItemProvider.PENDING_IMAGE;
+ return ContainerItemProvider.pendingImage();
}
Image image = super.getImage(element);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java
index 873f142ad1..776adaf975 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java
@@ -33,8 +33,6 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
/**
* A {@link org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider AdapterFactoryLabelProvider} specialization
@@ -49,13 +47,7 @@ import org.eclipse.ui.PlatformUI;
*/
public class CDOLabelProvider extends AdapterFactoryLabelProvider implements IColorProvider, IFontProvider
{
- private static final Color COLOR_PERMISSION_NONE = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
-
- private static final Color COLOR_PERMISSION_READ = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_CYAN);
-
- private static final Color COLOR_CONFLICT = UIUtil.getDisplay().getSystemColor(SWT.COLOR_RED);
-
- private static final Image ERROR_IMAGE = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ private static Color readPermissionColor;
private Font bold;
@@ -132,7 +124,7 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
}
catch (Exception ex)
{
- return ERROR_IMAGE;
+ return getErrorImage();
}
}
@@ -222,17 +214,17 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
{
if (object.cdoConflict())
{
- return COLOR_CONFLICT;
+ return getConflictColor();
}
CDOPermission permission = object.cdoPermission();
switch (permission)
{
case NONE:
- return COLOR_PERMISSION_NONE;
+ return getNoPermissionColor();
case READ:
- return COLOR_PERMISSION_READ;
+ return getReadPermissionColor();
default:
//$FALL-THROUGH$
@@ -246,4 +238,29 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
// Use default
return null;
}
+
+ private static Color getNoPermissionColor()
+ {
+ return UIUtil.grayColor();
+ }
+
+ private static Color getReadPermissionColor()
+ {
+ if (readPermissionColor == null)
+ {
+ readPermissionColor = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_CYAN);
+ }
+
+ return readPermissionColor;
+ }
+
+ private static Color getConflictColor()
+ {
+ return UIUtil.redColor();
+ }
+
+ private static Image getErrorImage()
+ {
+ return UIUtil.errorImage();
+ }
}
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/bundle/OM.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/bundle/OM.java
index 699d60476c..2b0f279f4d 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/internal/ui/bundle/OM.java
@@ -15,8 +15,6 @@ import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.net4j.util.om.log.OMLogger;
import org.eclipse.net4j.util.om.trace.OMTracer;
import org.eclipse.net4j.util.ui.UIActivator;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -52,16 +50,5 @@ public abstract class OM
super(BUNDLE);
INSTANCE = this;
}
-
- @Override
- protected void doStart() throws Exception
- {
- UIUtil.syncExec(() -> {
- // Bug 577425: If the classes below are first accessed from a non-UI thread SWT throws "Invalid thread access".
- ContainerItemProvider.PENDING_COLOR.isDisposed();
- ContainerItemProvider.PENDING_IMAGE.isDisposed();
- ContainerItemProvider.ERROR_IMAGE.isDisposed();
- });
- }
}
}
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 71121d8974..166060bde1 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
@@ -50,6 +50,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
@@ -63,6 +64,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
+import java.util.function.Function;
/**
* @author Eike Stepper
@@ -74,11 +76,56 @@ public final class UIUtil
*/
public static final String ERROR_LOG_ID = "org.eclipse.pde.runtime.LogView"; //$NON-NLS-1$
+ private static Color redColor;
+
+ private static Color grayColor;
+
+ private static Image errorImage;
+
private UIUtil()
{
}
/**
+ * @since 3.12
+ */
+ public static Color redColor()
+ {
+ if (redColor == null)
+ {
+ redColor = UIUtil.getDisplay().getSystemColor(SWT.COLOR_RED);
+ }
+
+ return redColor;
+ }
+
+ /**
+ * @since 3.12
+ */
+ public static Color grayColor()
+ {
+ if (grayColor == null)
+ {
+ grayColor = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+ }
+
+ return grayColor;
+ }
+
+ /**
+ * @since 3.12
+ */
+ public static Image errorImage()
+ {
+ if (errorImage == null)
+ {
+ errorImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
+ }
+
+ return errorImage;
+ }
+
+ /**
* @since 3.1
*/
public static void copyToClipboard(Display display, String text)
@@ -563,6 +610,34 @@ public final class UIUtil
}
/**
+ * @since 3.12
+ */
+ public static <T> T initResource(Function<Display, T> initializer)
+ {
+ Display display = getDisplay();
+ if (display == null)
+ {
+ OM.LOG.warn("Display is not available");
+ return null;
+ }
+
+ Object[] result = { null };
+
+ try
+ {
+ syncExec(() -> result[0] = initializer.apply(display));
+ }
+ catch (Throwable ex)
+ {
+ OM.LOG.warn(ex);
+ }
+
+ @SuppressWarnings("unchecked")
+ T value = (T)result[0];
+ return value;
+ }
+
+ /**
* @since 3.5
*/
public static void syncExec(Runnable runnable)
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
index 815e4dfe4a..6752da382d 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
@@ -52,20 +52,9 @@ import java.util.Objects;
*/
public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends ItemProvider<CONTAINER>
{
- /**
- * @since 3.5
- */
- public static final Color PENDING_COLOR = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
+ private static Color pendingColor;
- /**
- * @since 3.5
- */
- public static final Image PENDING_IMAGE = SharedIcons.getImage(SharedIcons.OBJ_PENDING);
-
- /**
- * @since 3.5
- */
- public static final Image ERROR_IMAGE = SharedIcons.getImage(SharedIcons.OBJ_ERROR);
+ private static Image pendingImage;
private Map<Object, Node> nodes = new HashMap<>();
@@ -410,7 +399,7 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
{
if (obj instanceof ContainerItemProvider.SlowElement)
{
- return PENDING_COLOR;
+ return pendingColor();
}
return super.getForeground(obj);
@@ -421,18 +410,44 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
{
if (obj instanceof ContainerItemProvider.SlowElement)
{
- return PENDING_IMAGE;
+ return pendingImage();
}
if (obj instanceof ContainerItemProvider.ErrorElement)
{
- return ERROR_IMAGE;
+ return UIUtil.errorImage();
}
return super.getImage(obj);
}
/**
+ * @since 3.12
+ */
+ public static Color pendingColor()
+ {
+ if (pendingColor == null)
+ {
+ pendingColor = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
+ }
+
+ return pendingColor;
+ }
+
+ /**
+ * @since 3.12
+ */
+ public static Image pendingImage()
+ {
+ if (pendingImage == null)
+ {
+ pendingImage = SharedIcons.getImage(SharedIcons.OBJ_PENDING);
+ }
+
+ return pendingImage;
+ }
+
+ /**
* @since 3.5
*/
public static IContainer<Object> createSlowInput(final String text)
@@ -970,6 +985,31 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
/**
* @author Eike Stepper
* @since 3.1
+ */
+ public class ErrorElement
+ {
+ private IContainer<Object> container;
+
+ public ErrorElement(IContainer<Object> container)
+ {
+ this.container = container;
+ }
+
+ public IContainer<Object> getContainer()
+ {
+ return container;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getErrorText(container);
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @since 3.1
* @deprecated As of 3.5 use {@link SlowElement}.
*/
@Deprecated
@@ -990,27 +1030,23 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
}
/**
- * @author Eike Stepper
- * @since 3.1
+ * @since 3.5
+ * @deprecated As of 3.12 use {@link #pendingColor()}.
*/
- public class ErrorElement
- {
- private IContainer<Object> container;
-
- public ErrorElement(IContainer<Object> container)
- {
- this.container = container;
- }
+ @Deprecated
+ public static final Color PENDING_COLOR = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
- public IContainer<Object> getContainer()
- {
- return container;
- }
+ /**
+ * @since 3.5
+ * @deprecated As of 3.12 use {@link #pendingImage()}.
+ */
+ @Deprecated
+ public static final Image PENDING_IMAGE = SharedIcons.getImage(SharedIcons.OBJ_PENDING);
- @Override
- public String toString()
- {
- return getErrorText(container);
- }
- }
+ /**
+ * @since 3.5
+ * @deprecated As of 3.12 use {@link UIUtil#errorImage()}.
+ */
+ @Deprecated
+ public static final Image ERROR_IMAGE = SharedIcons.getImage(SharedIcons.OBJ_ERROR);
}

Back to the top