Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2011-09-25 19:03:50 +0000
committerMartin Fluegge2011-09-25 19:03:50 +0000
commit69b5c9ecaf1edc80e4270892ee76a83e185d446e (patch)
tree07acbec2349a3127242c67967fa8771b6e7f213e /plugins
parent9eec85bb8884ca82791f1f8bc4bb00f2f0d4af34 (diff)
downloadcdo-69b5c9ecaf1edc80e4270892ee76a83e185d446e.tar.gz
cdo-69b5c9ecaf1edc80e4270892ee76a83e185d446e.tar.xz
cdo-69b5c9ecaf1edc80e4270892ee76a83e185d446e.zip
[319486] [Dawn] Implement locking mechanism for extended editors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319486
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml12
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java13
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java5
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java57
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/icons/dawn_locked_16x16.gifbin0 -> 901 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java103
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java84
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java162
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn/plugin.xml1
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.editpartstylizers.exsd245
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.elementstylizerfactory.exsd123
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/IDawnElementStylizerFactory.java20
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/spi/DawnState.java2
25 files changed, 840 insertions, 160 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn.gmf/META-INF/MANIFEST.MF
index 5a4d01f9f2..1d82057b73 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.emf.cdo.dawn.gmf
+Bundle-SymbolicName: org.eclipse.emf.cdo.dawn.gmf;singleton:=true
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.emf.cdo.dawn.gmf.Activator
Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
@@ -30,6 +30,7 @@ Export-Package: org.eclipse.emf.cdo.dawn.gmf;version="2.0.0",
org.eclipse.emf.cdo.dawn.gmf.elementtypes;version="2.0.0",
org.eclipse.emf.cdo.dawn.gmf.notifications.impl;version="2.0.0",
org.eclipse.emf.cdo.dawn.gmf.resources;version="2.0.0",
+ org.eclipse.emf.cdo.dawn.gmf.stylizer;version="2.0.0",
org.eclipse.emf.cdo.dawn.gmf.synchronize;version="2.0.0",
org.eclipse.emf.cdo.dawn.gmf.util;version="2.0.0",
org.eclipse.emf.cdo.dawn.transaction;version="2.0.0"
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties b/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties
index d7e2da6db7..60f663427c 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties
@@ -4,6 +4,7 @@ bin.includes = META-INF/,\
.,\
copyright.txt,\
plugin.properties,\
- about.html
+ about.html,\
+ plugin.xml
src.includes = copyright.txt,\
about.html
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml b/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml
new file mode 100644
index 0000000000..ea27d6e262
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.emf.cdo.dawn.elementstylizerfactory">
+ <DawnElementStylizerFactory
+ factory="org.eclipse.emf.cdo.dawn.gmf.stylizer.DawnGMFElementStylizerFactory"
+ priority="1 - Lowest">
+ </DawnElementStylizerFactory>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java
index c8e26c81d3..125c6abb2a 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java
@@ -10,6 +10,9 @@
*/
package org.eclipse.emf.cdo.dawn.gmf.appearance;
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
+
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.util.EditPartUtilities;
@@ -41,7 +44,7 @@ public class DawnAppearancer
*/
public static void setEditPartConflicted(EditPart editPart, int type)
{
- DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setConflicted(editPart, type);
@@ -66,7 +69,7 @@ public class DawnAppearancer
*/
public static void setEditPartDefault(EditPart editPart)
{
- DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setDefault(editPart);
@@ -78,7 +81,7 @@ public class DawnAppearancer
*/
public static void setEditPartLocked(EditPart editPart, int type)
{
- DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setLocked(editPart, type);
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java
index 8856c69736..0b7ee013a4 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java
@@ -10,7 +10,7 @@
*/
package org.eclipse.emf.cdo.dawn.gmf.appearance;
-import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnDefaultElementStylizer;
import org.eclipse.gef.EditPart;
@@ -23,20 +23,38 @@ import org.eclipse.gef.EditPart;
* @author Martin Fluegge
* @since 2.0
*/
-public interface DawnEditPartStylizer extends DawnElementStylizer<EditPart>
+public abstract class DawnEditPartStylizer extends DawnDefaultElementStylizer
{
/**
* @since 2.0
*/
- public void setDefault(EditPart editPart);
+ public abstract void setDefault(EditPart editPart);
/**
* @since 2.0
*/
- public void setConflicted(EditPart editPart, int type);
+ public abstract void setConflicted(EditPart editPart, int type);
/**
* @since 2.0
*/
- public void setLocked(EditPart editPart, int type);
+ public abstract void setLocked(EditPart editPart, int type);
+
+ @Override
+ public void setDefault(Object element)
+ {
+ setDefault((EditPart)element);
+ }
+
+ @Override
+ public void setConflicted(Object element, int type)
+ {
+ setConflicted((EditPart)element, type);
+ }
+
+ @Override
+ public void setLocked(Object element, int type)
+ {
+ setLocked((EditPart)element, type);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java
index 47a27727f0..ffefd74d41 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java
@@ -34,7 +34,9 @@ import java.util.Map;
/**
* @author Martin Fluegge
* @since 2.0
+ * @deprecated
*/
+@Deprecated
public class DawnEditPartStylizerRegistry
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnEditPartStylizerRegistry.class);
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java
index d741d8c4fc..076a56af67 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java
@@ -12,6 +12,7 @@ package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
import org.eclipse.emf.workspace.AbstractEMFOperation;
@@ -36,12 +37,13 @@ import org.eclipse.swt.graphics.Color;
* @author Martin Fluegge
* @since 2.0
*/
-public class DawnBasicConnectionEditPartStylizerImpl implements DawnEditPartStylizer
+public class DawnBasicConnectionEditPartStylizerImpl extends DawnEditPartStylizer
{
/**
* @since 2.0
*/
+ @Override
public void setDefault(EditPart editPart)
{
setEdge(editPart, DawnColorConstants.COLOR_NO_CONFLICT);
@@ -50,9 +52,11 @@ public class DawnBasicConnectionEditPartStylizerImpl implements DawnEditPartStyl
/**
* @since 2.0
*/
+ @Override
public void setConflicted(EditPart editPart, int type)
{
- Color color = DawnColorConstants.COLOR_DELETE_CONFLICT;
+ // Color color = DawnColorConstants.COLOR_DELETE_CONFLICT;
+ Color color = getForegroundColor(editPart, DawnState.CONFLICT);
setEdge(editPart, color);
}
@@ -91,6 +95,7 @@ public class DawnBasicConnectionEditPartStylizerImpl implements DawnEditPartStyl
/**
* @since 2.0
*/
+ @Override
public void setLocked(EditPart editPart, int type)
{
Color color = null;
@@ -98,12 +103,12 @@ public class DawnBasicConnectionEditPartStylizerImpl implements DawnEditPartStyl
{
case DawnAppearancer.TYPE_LOCKED_LOCALLY:
{
- color = DawnColorConstants.COLOR_LOCKED_REMOTELY;
+ color = getBackgroundColor(editPart, DawnState.LOCKED_LOCALLY);
break;
}
case DawnAppearancer.TYPE_LOCKED_GLOBALLY:
{
- color = DawnColorConstants.COLOR_LOCKED_LOCALLY;
+ color = getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY);
break;
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java
index eff43c66f2..0f7f7f1989 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java
@@ -18,11 +18,12 @@ import org.eclipse.gef.EditPart;
* @author Martin Fluegge
* @since 2.0
*/
-public class DawnBasicDiagramStylizerImpl implements DawnEditPartStylizer
+public class DawnBasicDiagramStylizerImpl extends DawnEditPartStylizer
{
/**
* @since 2.0
*/
+ @Override
public void setDefault(EditPart editpart)
{
}
@@ -30,6 +31,7 @@ public class DawnBasicDiagramStylizerImpl implements DawnEditPartStylizer
/**
* @since 2.0
*/
+ @Override
public void setConflicted(EditPart editpart, int type)
{
}
@@ -37,6 +39,7 @@ public class DawnBasicDiagramStylizerImpl implements DawnEditPartStylizer
/**
* @since 2.0
*/
+ @Override
public void setLocked(EditPart editpart, int type)
{
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java
index 878c359e21..0c47203800 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java
@@ -12,7 +12,7 @@ package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
-import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
import org.eclipse.draw2d.Border;
import org.eclipse.draw2d.IFigure;
@@ -26,11 +26,12 @@ import org.eclipse.swt.graphics.Color;
* @since 2.0
*/
-public class DawnBasicGraphicalEditPartStylizerImpl implements DawnEditPartStylizer
+public class DawnBasicGraphicalEditPartStylizerImpl extends DawnEditPartStylizer
{
/**
* @since 2.0
*/
+ @Override
public void setDefault(EditPart editPart)
{
setBorder(editPart, null);
@@ -39,17 +40,20 @@ public class DawnBasicGraphicalEditPartStylizerImpl implements DawnEditPartStyli
/**
* @since 2.0
*/
+ @Override
public void setConflicted(EditPart editPart, int type)
{
- setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ setBorder(editPart, getForegroundColor(editPart, DawnState.CONFLICT), DawnAppearancer.DEFAULT_BORDER_THICKNESS);
}
/**
* @since 2.0
*/
+ @Override
public void setLocked(EditPart editPart, int type)
{
- setBorder(editPart, DawnColorConstants.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY),
+ DawnAppearancer.DEFAULT_BORDER_THICKNESS);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java
index f89c5c0370..1a29bcea34 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java
@@ -11,6 +11,7 @@
package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
import org.eclipse.gef.EditPart;
@@ -27,11 +28,11 @@ public class DawnBasicNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPar
setBorder(editPart, DawnColorConstants.COLOR_NO_CONFLICT, 0);
}
- @Override
- public void setConflicted(EditPart editPart, int type)
- {
- setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
+ // @Override
+ // public void setConflicted(EditPart editPart, int type)
+ // {
+ // setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ // }
@Override
public void setLocked(EditPart editPart, int type)
@@ -40,12 +41,14 @@ public class DawnBasicNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPar
{
case DawnAppearancer.TYPE_LOCKED_GLOBALLY:
{
- setBorder(editPart, DawnColorConstants.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY),
+ DawnAppearancer.DEFAULT_BORDER_THICKNESS);
break;
}
case DawnAppearancer.TYPE_LOCKED_LOCALLY:
{
- setBorder(editPart, DawnColorConstants.COLOR_LOCKED_LOCALLY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_LOCALLY),
+ DawnAppearancer.DEFAULT_BORDER_THICKNESS);
break;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java
index 56dc940b27..4ece40f8ef 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java
@@ -11,16 +11,17 @@
package org.eclipse.emf.cdo.dawn.gmf.editors.impl;
import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
import org.eclipse.emf.cdo.dawn.editors.impl.DawnAbstractEditorSupport;
import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizerRegistry;
import org.eclipse.emf.cdo.dawn.gmf.notifications.impl.DawnGMFHandler;
import org.eclipse.emf.cdo.dawn.gmf.notifications.impl.DawnGMFLockingHandler;
+import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnChangeHelper;
import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener;
import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
import org.eclipse.emf.cdo.transaction.CDOTransactionHandlerBase;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
@@ -125,7 +126,7 @@ public class DawnGMFEditorSupport extends DawnAbstractEditorSupport
CDOUtil.getCDOObject(element).cdoWriteLock().lock();
}
}
- DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setLocked(editPart, DawnAppearancer.TYPE_LOCKED_LOCALLY);
@@ -139,6 +140,7 @@ public class DawnGMFEditorSupport extends DawnAbstractEditorSupport
if (objectToBeUnlocked instanceof EditPart)
{
EditPart editPart = (EditPart)objectToBeUnlocked;
+
Object model = editPart.getModel();
if (model instanceof EObject)
@@ -150,7 +152,7 @@ public class DawnGMFEditorSupport extends DawnAbstractEditorSupport
CDOUtil.getCDOObject(element).cdoWriteLock().unlock();
}
}
- DawnEditPartStylizer stylizer = DawnEditPartStylizerRegistry.instance.getStylizer(editPart);
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
if (stylizer != null)
{
stylizer.setDefault(editPart);
@@ -184,10 +186,12 @@ public class DawnGMFEditorSupport extends DawnAbstractEditorSupport
else if (object.cdoWriteLock().isLockedByOthers())
{
DawnAppearancer.setEditPartLocked(editPart, DawnAppearancer.TYPE_LOCKED_GLOBALLY);
+ DawnChangeHelper.deactivateEditPart(editPart);
}
else
{
DawnAppearancer.setEditPartDefault(editPart);
+ DawnChangeHelper.activateEditPart(editPart);
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java
new file mode 100644
index 0000000000..c5777b678c
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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
+ */
+package org.eclipse.emf.cdo.dawn.gmf.stylizer;
+
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.appearance.IDawnElementStylizerFactory;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicConnectionEditPartStylizerImpl;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicGraphicalEditPartStylizerImpl;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicNodeEditPartStylizerImpl;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicTextAwareEditPartStylizerImpl;
+
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnGMFElementStylizerFactory implements IDawnElementStylizerFactory
+{
+ public DawnElementStylizer getElementStylizer(Object object)
+ {
+ DawnElementStylizer stylizer = null;
+ if (object instanceof ConnectionEditPart)
+ {
+ stylizer = new DawnBasicConnectionEditPartStylizerImpl();
+ }
+ else if (object instanceof NodeEditPart)
+ {
+ stylizer = new DawnBasicNodeEditPartStylizerImpl();
+ }
+ else if (object instanceof DiagramEditPart)
+ {
+ stylizer = new DawnBasicNodeEditPartStylizerImpl();
+ }
+ else if (object instanceof ITextAwareEditPart)
+ {
+ stylizer = new DawnBasicTextAwareEditPartStylizerImpl();
+ }
+ else
+ {
+ // In the case that there is no match we use a simple border styled stylizer.
+ stylizer = new DawnBasicGraphicalEditPartStylizerImpl();
+ }
+
+ return stylizer;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.dawn.ui/META-INF/MANIFEST.MF
index 8b8249a8c7..052779fb0a 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/META-INF/MANIFEST.MF
@@ -14,12 +14,14 @@ Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Export-Package: org.eclipse.emf.cdo.dawn.internal.ui.bundle;version="2.0.0",
+Export-Package: org.eclipse.emf.cdo.dawn.internal.ui.bundle;version="2.0.0";x-internal:=true,
org.eclipse.emf.cdo.dawn.ui;version="2.0.0",
org.eclipse.emf.cdo.dawn.ui.composites;version="2.0.0",
org.eclipse.emf.cdo.dawn.ui.handlers;version="2.0.0";x-internal:=true,
org.eclipse.emf.cdo.dawn.ui.helper;version="2.0.0",
+ org.eclipse.emf.cdo.dawn.ui.icons;version="2.0.0",
org.eclipse.emf.cdo.dawn.ui.messages;version="2.0.0",
+ org.eclipse.emf.cdo.dawn.ui.stylizer;version="2.0.0",
org.eclipse.emf.cdo.dawn.ui.views;version="2.0.0",
org.eclipse.emf.cdo.dawn.ui.wizards;version="2.0.0",
org.eclipse.emf.cdo.dawn.ui.wizards.dialogs;version="2.0.0"
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/icons/dawn_locked_16x16.gif b/plugins/org.eclipse.emf.cdo.dawn.ui/icons/dawn_locked_16x16.gif
new file mode 100644
index 0000000000..e87e04a0e2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/icons/dawn_locked_16x16.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java
index 228c56c8ca..56a86a7082 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java
@@ -10,6 +10,10 @@
*/
package org.eclipse.emf.cdo.dawn.ui;
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
import org.eclipse.emf.cdo.ui.CDOLabelProvider;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.emf.cdo.view.CDOView;
@@ -19,6 +23,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
/**
* @author Martin Fluegge
@@ -36,15 +41,58 @@ public class DawnLabelProvider extends CDOLabelProvider
{
// makes sure that the object is adapted
Color foreground = super.getForeground(object);
- if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLocked())
+
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
{
- return DawnColorConstants.COLOR_LOCKED_LOCALLY;
+ return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
}
else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
{
- return DawnColorConstants.COLOR_LOCKED_REMOTELY;
+ return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
}
// Use default
return foreground;
}
+
+ @Override
+ public Color getBackground(Object object)
+ {
+ // makes sure that the object is adapted
+ Color background = super.getBackground(object);
+
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+ // Use default
+ return background;
+ }
+
+ @Override
+ public Image getImage(Object object)
+ {
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getImage(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getImage(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+
+ return super.getImage(object);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java
new file mode 100644
index 0000000000..535c83ecbe
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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
+ */
+package org.eclipse.emf.cdo.dawn.ui.icons;
+
+import org.eclipse.emf.cdo.dawn.internal.ui.bundle.OM;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Based on the implementation from org.eclipse.emf.cdo.ui.shared.SharedIcons. TODO clarify with Eike whether we could
+ * provide a better extensibility.
+ *
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnIconRegistry
+{
+ private static final String GIF = ".gif"; //$NON-NLS-1$
+
+ private static final String PNG = ".png"; //$NON-NLS-1$
+
+ private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay());
+
+ private static final String ICONS_FOLDER = "icons/"; //$NON-NLS-1$
+
+ public static final String LOCKED = ICONS_FOLDER + "dawn_locked_16x16" + GIF; //$NON-NLS-1$
+
+ public static final String DAWN_LIGHT = ICONS_FOLDER + "dawn_16x16" + PNG; //$NON-NLS-1$
+
+ public static final String DAWN_DARK = ICONS_FOLDER + "dawn_16x16" + GIF; //$NON-NLS-1$
+
+ public static Image getImage(String key)
+ {
+ Image image = REGISTRY.get(key);
+ if (image == null)
+ {
+ createDescriptor(key);
+ image = REGISTRY.get(key);
+ }
+
+ // For some reason, sometimes images get disposed.
+ // In that case, create and put in registry again.
+ if (image.isDisposed())
+ {
+ REGISTRY.remove(key);
+ createDescriptor(key);
+ image = REGISTRY.get(key);
+ }
+
+ return image;
+ }
+
+ public static ImageDescriptor getDescriptor(String key)
+ {
+ ImageDescriptor descriptor = REGISTRY.getDescriptor(key);
+ if (descriptor == null)
+ {
+ descriptor = createDescriptor(key);
+ }
+
+ return descriptor;
+ }
+
+ private static ImageDescriptor createDescriptor(String key)
+ {
+ ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(OM.BUNDLE_ID, key);
+ if (descriptor != null)
+ {
+ REGISTRY.put(key, descriptor);
+ }
+
+ return descriptor;
+ }
+
+ private static Display getDisplay()
+ {
+ Display display = Display.getCurrent();
+ if (display == null)
+ {
+ display = Display.getDefault();
+ }
+
+ if (display == null)
+ {
+ throw new IllegalStateException("display == null"); //$NON-NLS-1$
+ }
+
+ return display;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java
new file mode 100644
index 0000000000..20cbcd3e07
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.stylizer;
+
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
+import org.eclipse.emf.cdo.dawn.ui.icons.DawnIconRegistry;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnDefaultElementStylizer implements DawnElementStylizer
+{
+ public void setDefault(Object element)
+ {
+ }
+
+ public void setConflicted(Object element, int type)
+ {
+ }
+
+ public void setLocked(Object element, int type)
+ {
+ }
+
+ public Image getImage(Object element, DawnState state)
+ {
+ switch (state)
+ {
+ case LOCKED_LOCALLY:
+ {
+ return DawnIconRegistry.getImage(DawnIconRegistry.LOCKED);
+ }
+ case LOCKED_REMOTELY:
+ {
+ return DawnIconRegistry.getImage(DawnIconRegistry.LOCKED);
+ }
+ }
+ return null;
+ }
+
+ public Color getForegroundColor(Object element, DawnState state)
+ {
+ switch (state)
+ {
+ case CONFLICT:
+ {
+ return DawnColorConstants.COLOR_DELETE_CONFLICT;
+ }
+ }
+
+ return null;
+ }
+
+ public Color getBackgroundColor(Object element, DawnState state)
+ {
+ switch (state)
+ {
+ case LOCKED_LOCALLY:
+ {
+ return DawnColorConstants.COLOR_LOCKED_LOCALLY;
+ }
+ case LOCKED_REMOTELY:
+ {
+ return DawnColorConstants.COLOR_LOCKED_REMOTELY;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java
new file mode 100644
index 0000000000..81c93b4bb2
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.stylizer;
+
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.appearance.IDawnElementStylizerFactory;
+import org.eclipse.emf.cdo.dawn.internal.ui.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This registry provides the DawnElementStylizer implementation for a given object.
+ *
+ * @see org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnElementStylizerRegistry
+{
+ private static final String ATTRIBUTE_PRIORITY = "priority";
+
+ private static final String ATTRIIBUTE_FACTORY = "factory";
+
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnElementStylizerRegistry.class);
+
+ private static final String DAWN_STYLIZER_FACTORY_EXTENSION_POINT_ID = "org.eclipse.emf.cdo.dawn.elementstylizerfactory";
+
+ public static DawnElementStylizerRegistry instance = new DawnElementStylizerRegistry();
+
+ private Map<String, DawnElementStylizer> registeredStylizers = new HashMap<String, DawnElementStylizer>();
+
+ private Map<String, FactoryContainer> stylizerFactories = new HashMap<String, FactoryContainer>();
+
+ private DawnDefaultElementStylizer dawnDefaultElementStylizer;
+
+ /**
+ * @since 2.0
+ */
+ public DawnElementStylizer getStylizer(Object object)
+ {
+ DawnElementStylizer stylizer = registeredStylizers.get(object.getClass().getCanonicalName());
+
+ if (stylizer == null)
+ {
+ stylizer = getStylizerFromExtensionPoint(object);
+ registeredStylizers.put(object.getClass().getCanonicalName(), stylizer);
+ }
+
+ if (stylizer == null)
+ {
+ stylizer = getDefaultStylizer(object);
+ }
+
+ return stylizer;
+ }
+
+ private DawnElementStylizer getDefaultStylizer(Object object)
+ {
+ dawnDefaultElementStylizer = new DawnDefaultElementStylizer();
+ return dawnDefaultElementStylizer;
+ }
+
+ private DawnElementStylizer getStylizerFromExtensionPoint(Object object)
+ {
+ Map<String, FactoryContainer> factories = getFactories();
+ DawnElementStylizer elementStylizer = null;
+ int lastPriority = -1;
+
+ for (FactoryContainer factoryContainer : factories.values())
+ {
+ DawnElementStylizer currentElementStylizer = factoryContainer.getFactory().getElementStylizer(object);
+ if (currentElementStylizer != null)
+ {
+ int priority = factoryContainer.getPriority();
+ if (priority > lastPriority)
+ {
+ elementStylizer = currentElementStylizer;
+ lastPriority = priority;
+ }
+ }
+ }
+
+ return elementStylizer;
+ }
+
+ private Map<String, FactoryContainer> getFactories()
+ {
+ try
+ {
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ DAWN_STYLIZER_FACTORY_EXTENSION_POINT_ID);
+ for (IConfigurationElement e : config)
+ {
+ String factoryClassName = e.getAttribute(ATTRIIBUTE_FACTORY);
+ if (!stylizerFactories.containsKey(factoryClassName))
+ {
+ IDawnElementStylizerFactory stylizer = (IDawnElementStylizerFactory)e
+ .createExecutableExtension(ATTRIIBUTE_FACTORY);
+
+ int priority = Integer.parseInt(e.getAttribute(ATTRIBUTE_PRIORITY).substring(0, 1));
+
+ FactoryContainer container = new FactoryContainer(priority, stylizer);
+
+ stylizerFactories.put(factoryClassName, container);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registered IDawnElementStylizerFactory {0} ", stylizer); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ catch (InvalidRegistryObjectException e)
+ {
+ e.printStackTrace();
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ }
+
+ return stylizerFactories;
+ }
+
+ private class FactoryContainer
+ {
+ private int priority;
+
+ private IDawnElementStylizerFactory factory;
+
+ public FactoryContainer(int priority, IDawnElementStylizerFactory factory)
+ {
+ this.priority = priority;
+ this.factory = factory;
+ }
+
+ public IDawnElementStylizerFactory getFactory()
+ {
+ return factory;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java
index 2bd1fd1a68..86b384711f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java
@@ -26,7 +26,6 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public class DawnItemProvider extends CDOItemProvider
{
-
private final DawnExplorer dawnExplorer;
public DawnItemProvider(IWorkbenchPage page, DawnExplorer dawnExplorer, IElementFilter rootElementFilter)
diff --git a/plugins/org.eclipse.emf.cdo.dawn/plugin.xml b/plugins/org.eclipse.emf.cdo.dawn/plugin.xml
index 2195a87505..0f805e8c67 100644
--- a/plugins/org.eclipse.emf.cdo.dawn/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.dawn/plugin.xml
@@ -13,6 +13,7 @@
<plugin>
<extension-point id="org.eclipse.emf.cdo.dawn.listeners" name="DawnListeners" schema="schema/org.eclipse.emf.cdo.dawn.listeners.exsd"/>
<extension-point id="org.eclipse.emf.cdo.dawn.editpartstylizers" name="Dawn EditPart Stylizers" schema="schema/org.eclipse.emf.cdo.dawn.editpartstylizers.exsd"/>
+ <extension-point id="org.eclipse.emf.cdo.dawn.elementstylizerfactory" name="DawnElementStylizerFactory" schema="schema/org.eclipse.emf.cdo.dawn.elementstylizerfactory.exsd"/>
<extension
point="org.eclipse.emf.ecore.extension_parser">
<parser
diff --git a/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.editpartstylizers.exsd b/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.editpartstylizers.exsd
index 7909bec2bc..b758fe1d91 100644
--- a/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.editpartstylizers.exsd
+++ b/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.editpartstylizers.exsd
@@ -1,120 +1,125 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.emf.cdo.dawn" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.emf.cdo.dawn" id="org.eclipse.emf.cdo.dawn.editpartstylizers" name="Dawn EditPart Stylizers"/>
- </appinfo>
- <documentation>
- This extension point is used to define custom EditPartStylizers which can define the appearance of the EditPart&apos;s view.
-An EditPartStylizer can influence the visual representation of the models state.
-Dawn knows three states - default, conflicted and locked. By implementing an own DawnEditPartStylizer you can influence the appearance of the three states for your EditPart and it&apos;s related models. New stylizer can be registered to Dawn using this extension point.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence minOccurs="1" maxOccurs="unbounded">
- <element ref="DawnEditPartStylizers"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="DawnEditPartStylizers">
- <complexType>
- <attribute name="editpart" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.gef.EditPart"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="stylizer" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.emf.cdo.dawn.appearance.DawnEditPartStylizer"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- 0.2.0
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- Following is an example of how a EditPartStylizer can be registered:
-&lt;pre&gt;
- &lt;DawnEditPartStylizers editpart=&quot;org.eclipse.emf.cdo.dawn.examples.acore.classdiagram.diagram.edit.parts.AClassEditPart&quot;
- stylizer=&quot;org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicNodeEditPartStylizerImpl&quot;&gt;
- &lt;/DawnEditPartStylizers&gt;
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- To customize the EditPart you must implement the interface org.eclipse.emf.cdo.dawn.appearance.EditPartStylizer. For Graphical EditParts this is typically done by extending the org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicGraphicalEditPartStylizer. Set this implementation for the &lt;b&gt;stylizer&lt;/b&gt; attribute. The &lt;b&gt;editpart&lt;b/&gt; attribute takes the EditPart which should be customized.
- </documentation>
- </annotation>
-
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.cdo.dawn" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.cdo.dawn" id="org.eclipse.emf.cdo.dawn.editpartstylizers" name="Dawn EditPart Stylizers"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to define custom EditPartStylizers which can define the appearance of the EditPart&apos;s view.
+An EditPartStylizer can influence the visual representation of the models state.
+Dawn knows three states - default, conflicted and locked. By implementing an own DawnEditPartStylizer you can influence the appearance of the three states for your EditPart and it&apos;s related models. New stylizer can be registered to Dawn using this extension point.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="DawnEditPartStylizers"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="DawnEditPartStylizers">
+ <annotation>
+ <appinfo>
+ <meta.element deprecated="true"/>
+ </appinfo>
+ </annotation>
+ <complexType>
+ <attribute name="editpart" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.gef.EditPart"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="stylizer" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.cdo.dawn.appearance.DawnEditPartStylizer"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ Following is an example of how a EditPartStylizer can be registered:
+&lt;pre&gt;
+ &lt;DawnEditPartStylizers editpart=&quot;org.eclipse.emf.cdo.dawn.examples.acore.classdiagram.diagram.edit.parts.AClassEditPart&quot;
+ stylizer=&quot;org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicNodeEditPartStylizerImpl&quot;&gt;
+ &lt;/DawnEditPartStylizers&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ To customize the EditPart you must implement the interface org.eclipse.emf.cdo.dawn.appearance.EditPartStylizer. For Graphical EditParts this is typically done by extending the org.eclipse.emf.cdo.dawn.appearance.impl.DawnBasicGraphicalEditPartStylizer. Set this implementation for the &lt;b&gt;stylizer&lt;/b&gt; attribute. The &lt;b&gt;editpart&lt;b/&gt; attribute takes the EditPart which should be customized.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.&lt;br&gt;
+All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.elementstylizerfactory.exsd b/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.elementstylizerfactory.exsd
new file mode 100644
index 0000000000..52a7a87447
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn/schema/org.eclipse.emf.cdo.dawn.elementstylizerfactory.exsd
@@ -0,0 +1,123 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.cdo.dawn" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.cdo.dawn" id="org.eclipse.emf.cdo.dawn.elementstylizerfactory" name="DawnElementStylizerFactory"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="DawnElementStylizerFactory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="DawnElementStylizerFactory">
+ <complexType>
+ <attribute name="priority" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="1 - Lowest">
+ </enumeration>
+ <enumeration value="2 - Low">
+ </enumeration>
+ <enumeration value="3 - Medium">
+ </enumeration>
+ <enumeration value="4 - High">
+ </enumeration>
+ <enumeration value="5 - Highest">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="factory" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.cdo.dawn.appearance.IDawnElementStylizerFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java
index 77fb74e1d1..ad4026a7bb 100644
--- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java
+++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/DawnElementStylizer.java
@@ -10,6 +10,11 @@
*/
package org.eclipse.emf.cdo.dawn.appearance;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
/**
* This interface is used do influence the appearance of an UI element by a certain state. Implementations allow to
* change the appearance for the adapted types of editors.
@@ -17,11 +22,26 @@ package org.eclipse.emf.cdo.dawn.appearance;
* @author Martin Fluegge
* @since 2.0
*/
-public interface DawnElementStylizer<T>
+public interface DawnElementStylizer
{
- public void setDefault(T element);
+ public void setDefault(Object element);
+
+ public void setConflicted(Object element, int type);
+
+ public void setLocked(Object element, int type);
+
+ /**
+ * Returns the image that represents the state for the given object.
+ */
+ public Image getImage(Object element, DawnState state);
- public void setConflicted(T element, int type);
+ /**
+ * Returns the foreground color that represents the state for the given object.
+ */
+ public Color getForegroundColor(Object element, DawnState state);
- public void setLocked(T element, int type);
+ /**
+ * Returns the background color that represents the state for the given object.
+ */
+ public Color getBackgroundColor(Object element, DawnState state);
}
diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/IDawnElementStylizerFactory.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/IDawnElementStylizerFactory.java
new file mode 100644
index 0000000000..13559164e9
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/appearance/IDawnElementStylizerFactory.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.appearance;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public interface IDawnElementStylizerFactory
+{
+ public DawnElementStylizer getElementStylizer(Object object);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/spi/DawnState.java b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/spi/DawnState.java
index 09d823e118..e1d9cd3b0b 100644
--- a/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/spi/DawnState.java
+++ b/plugins/org.eclipse.emf.cdo.dawn/src/org/eclipse/emf/cdo/dawn/spi/DawnState.java
@@ -16,5 +16,5 @@ package org.eclipse.emf.cdo.dawn.spi;
*/
public enum DawnState
{
- LOCKED_LOCALLY, LOCKED_REMOTELY, INVALID, CLEAN
+ LOCKED_LOCALLY, LOCKED_REMOTELY, DIRTY, CLEAN, CONFLICT
}

Back to the top