Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-09-23 06:25:46 -0400
committerEike Stepper2013-09-23 06:25:46 -0400
commit97e1886dec12db9c7d6e156fe60c140e70d14e5a (patch)
tree2faaa94ce411cf03031753032f61297555eea754
parent4f2176c313c1ae9a92e99cdcd4a38a00c80b8ff5 (diff)
downloadcdo-97e1886dec12db9c7d6e156fe60c140e70d14e5a.tar.gz
cdo-97e1886dec12db9c7d6e156fe60c140e70d14e5a.tar.xz
cdo-97e1886dec12db9c7d6e156fe60c140e70d14e5a.zip
[417800] [UI] Use colors to reflect security permissions in the
CDOEditor and the CDOSessionsView https://bugs.eclipse.org/bugs/show_bug.cgi?id=417800
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF32
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java44
3 files changed, 61 insertions, 28 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index 655e7ef625..0ead766298 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/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;singleton:=true
-Bundle-Version: 4.2.100.qualifier
+Bundle-Version: 4.3.0.qualifier
Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.OM$Activator
Bundle-Vendor: %providerName
Bundle-ClassPath: .
@@ -23,7 +23,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";reso
org.eclipse.emf.cdo.transfer.ui;bundle-version="[4.2.0,5.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.transfer.repository;bundle-version="[4.2.0,5.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.ui.shared;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.2.100";
+Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -32,15 +32,15 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.2.100";
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.actions;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.actions;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.bundle;version="4.2.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.ui.dialogs;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.bundle;version="4.3.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.ui.dialogs;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
@@ -48,56 +48,56 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.2.100";
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.dnd;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.dnd;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.editor;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.editor;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.filters;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.filters;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.history;version="4.2.100";x-internal:=true,
- org.eclipse.emf.cdo.internal.ui.messages;version="4.2.100";x-friends:="org.eclipse.emf.cdo.tests.ui",
- org.eclipse.emf.cdo.internal.ui.perspectives;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.history;version="4.3.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.ui.messages;version="4.3.0";x-friends:="org.eclipse.emf.cdo.tests.ui",
+ org.eclipse.emf.cdo.internal.ui.perspectives;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.preferences;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.preferences;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.transfer;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.transfer;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.internal.ui.views;version="4.2.100";
+ org.eclipse.emf.cdo.internal.ui.views;version="4.3.0";
x-friends:="org.eclipse.emf.cdo.ui.defs,
org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
org.eclipse.emf.cdo.dawn.ui,
org.eclipse.emf.cdo.explorer",
- org.eclipse.emf.cdo.ui;version="4.2.100",
- org.eclipse.emf.cdo.ui.widgets;version="4.2.100"
+ org.eclipse.emf.cdo.ui;version="4.3.0",
+ org.eclipse.emf.cdo.ui.widgets;version="4.3.0"
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
index ed2f1e62f6..2c12579932 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java
@@ -11,6 +11,7 @@
*/
package org.eclipse.emf.cdo.ui;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.CDOCommonRepository.State;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
@@ -71,6 +72,7 @@ import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.LabelProviderChangedEvent;
import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorRegistry;
@@ -431,6 +433,17 @@ public class CDOItemProvider extends ContainerItemProvider<IContainer<Object>>
}
@Override
+ public Color getForeground(Object obj)
+ {
+ if (obj instanceof CDOObject)
+ {
+ return CDOLabelProvider.getColor((CDOObject)obj);
+
+ }
+ return super.getForeground(obj);
+ }
+
+ @Override
public Font getFont(Object obj)
{
if (obj instanceof CDOTransaction)
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 e653d2a51f..7165dde9ac 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
@@ -10,6 +10,8 @@
*/
package org.eclipse.emf.cdo.ui;
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.ui.UIUtil;
@@ -42,6 +44,8 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
{
private static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+ private static final Color YELLOW = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_YELLOW);
+
private static final Color RED = UIUtil.getDisplay().getSystemColor(SWT.COLOR_RED);
private Font bold;
@@ -117,16 +121,21 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
@Override
public Color getForeground(Object object)
{
+ return getColor(FSMUtil.adapt(object, view));
+ }
+
+ @Override
+ public Font getFont(Object object)
+ {
try
{
InternalCDOObject cdoObject = FSMUtil.adapt(object, view);
switch (cdoObject.cdoState())
{
- case PROXY:
- return GRAY;
-
+ case NEW:
+ case DIRTY:
case CONFLICT:
- return RED;
+ return bold;
}
}
catch (RuntimeException ignore)
@@ -137,18 +146,29 @@ public class CDOLabelProvider extends AdapterFactoryLabelProvider implements ICo
return null;
}
- @Override
- public Font getFont(Object object)
+ /**
+ * @since 4.3
+ */
+ public static Color getColor(CDOObject object)
{
try
{
- InternalCDOObject cdoObject = FSMUtil.adapt(object, view);
- switch (cdoObject.cdoState())
+ if (object.cdoConflict())
{
- case NEW:
- case DIRTY:
- case CONFLICT:
- return bold;
+ return RED;
+ }
+
+ CDOPermission permission = object.cdoPermission();
+ switch (permission)
+ {
+ case NONE:
+ return GRAY;
+
+ case READ:
+ return YELLOW;
+
+ default:
+ //$FALL-THROUGH$
}
}
catch (RuntimeException ignore)

Back to the top