Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-01-31 16:10:41 +0000
committerCamille Letavernier2014-01-31 16:10:41 +0000
commit87a380b7deb824c8f034a4ab2313a796374ef76d (patch)
tree5361e5ff0964602bc27608fe91f0eb9752c6f803 /plugins/views
parent3d98d0203b66ab05bda7c24d2c032c83391023fd (diff)
downloadorg.eclipse.papyrus-87a380b7deb824c8f034a4ab2313a796374ef76d.tar.gz
org.eclipse.papyrus-87a380b7deb824c8f034a4ab2313a796374ef76d.tar.xz
org.eclipse.papyrus-87a380b7deb824c8f034a4ab2313a796374ef76d.zip
417396: [CSS] The CSS Engine shall support label visibility & mask
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417396 - Refactor the MaskManaged Label framework. Replace bitmask (integer) values with collections of String - Partial commit. Some diagrams don't compile (Preferences, LabelParser)
Diffstat (limited to 'plugins/views')
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java41
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java71
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java6
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java114
4 files changed, 155 insertions, 77 deletions
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java
index c222cc5b896..55bf938b168 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/AbstractPropertyEditor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* 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
@@ -19,6 +19,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.AbstractListEditor;
import org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor;
+import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.views.properties.Activator;
import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.contexts.Property;
@@ -33,7 +34,7 @@ import org.eclipse.swt.widgets.Control;
* An Abstract class to factorize code for PropertyEditors. PropertyEditors are
* <strong>not</strong> required to extend this class, but could benefit from
* its methods.
- *
+ *
* @author Camille Letavernier
*/
public abstract class AbstractPropertyEditor implements IChangeListener, CustomizablePropertyEditor {
@@ -98,7 +99,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Constructor. Constructs a new PropertyEditor with the given ListEditor
- *
+ *
* @param editor
*/
protected AbstractPropertyEditor(AbstractListEditor editor) {
@@ -107,7 +108,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Constructor. Constructs a new PropertyEditor with the given ValueEditor
- *
+ *
* @param editor
*/
protected AbstractPropertyEditor(AbstractValueEditor editor) {
@@ -116,7 +117,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the ListEditor for this PropertyEditor
- *
+ *
* @param editor
*/
protected void setEditor(AbstractListEditor editor) {
@@ -126,7 +127,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the ValueEditor for this PropertyEditor
- *
+ *
* @param editor
*/
protected void setEditor(AbstractValueEditor editor) {
@@ -161,6 +162,10 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
Activator.log.error(ex);
}
+ if(getInputObservable() instanceof ICommitListener && getEditor() != null) {
+ getEditor().addCommitListener((ICommitListener)getInputObservable());
+ }
+
updateLabel();
updateDescription();
}
@@ -195,7 +200,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Applies the readOnly state to the editor
- *
+ *
* @param readOnly
* Indicates if this widget should be read-only
*/
@@ -225,7 +230,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
* Sets the property path for this PropertyEditor.
* The propertyPath elements should be separated by ":"
* e.g. UML:NamedElement:name
- *
+ *
* @param path
*/
public void setProperty(String path) {
@@ -269,7 +274,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the input DataSource for this Property editor.
- *
+ *
* @param input
*/
public void setInput(DataSource input) {
@@ -336,7 +341,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Finds the property associated to the Editor's {@link #propertyPath}
- *
+ *
* @return The property associated to the Editor's {@link #propertyPath}
*/
protected Property getModelProperty() {
@@ -357,7 +362,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Marks this editor as readOnly
- *
+ *
* @param readOnly
*/
public void setReadOnly(boolean readOnly) {
@@ -376,7 +381,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Tests if this editor is read-only
- *
+ *
* @return
* True if this editor is read-only
*/
@@ -420,7 +425,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Returns the IObservable for this propertyEditor, or null if it is
* not available
- *
+ *
* @return The IObservable associated to this propertyEditor
*/
protected IObservable getInputObservable() {
@@ -446,7 +451,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the editor's Layout Data
- *
+ *
* @param data
*/
public void setLayoutData(Object data) {
@@ -457,7 +462,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Returns the editor's Layout Data
- *
+ *
* @return
* The editor's layout data
*/
@@ -467,7 +472,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Indicates whether the editor's label should be displayed or not
- *
+ *
* @param showLabel
*/
public void setShowLabel(boolean showLabel) {
@@ -480,7 +485,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Indicates whether the editor's label is displayed or not
- *
+ *
* @return
* true if the label should be displayed
*/
@@ -491,7 +496,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener, Customi
/**
* Sets the label for this editor. The label will replace the property's
* default label
- *
+ *
* @param customLabel
* The label to use with this property editor
*/
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java
index 30d6147b387..a3f343ff168 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/IntegerMask.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* 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
@@ -12,103 +12,62 @@
package org.eclipse.papyrus.views.properties.widgets;
import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProvider;
-import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderListener;
import org.eclipse.swt.widgets.Composite;
/**
* A widget to edit mask-based Integer values
* The integer value is interpreted as a list of boolean values
* The widget cannot use more than 32 masks
- *
+ *
* @author Camille Letavernier
*/
-public class IntegerMask extends AbstractPropertyEditor implements XWTCompliantMaskProviderListener {
-
- private org.eclipse.papyrus.infra.widgets.editors.IntegerMask editor;
-
- private XWTCompliantMaskProvider maskProvider;
-
- private boolean maskProviderReady = false;
+@Deprecated
+public class IntegerMask extends InvalidWidget {
/**
- *
+ *
* Constructor.
- *
+ *
* @param parent
* The composite in which this widget will be created
* @param style
*/
public IntegerMask(Composite parent, int style) {
- editor = createIntegerMask(parent, style);
- setEditor(editor);
- }
-
- /**
- * Creates the integer mask.
- *
- * @param parent
- * The composite in which the widget will be displayed
- * @param style
- * The style for the widget
- * @return the integer mask.
- */
- protected org.eclipse.papyrus.infra.widgets.editors.IntegerMask createIntegerMask(Composite parent, int style) {
- return new org.eclipse.papyrus.infra.widgets.editors.IntegerMask(parent, style);
- }
-
- @Override
- protected void checkInput() {
- if(maskProvider != null && maskProviderReady) {
- super.checkInput();
- }
+ super(parent, style);
}
/**
* @return the number of columns for this editor
- *
+ *
*/
public int getNumColumns() {
- return editor.getNumColumns();
+ return 0;
}
/**
* Sets the number of columns for this editor. The mask checkboxes will be
* distributed according to this number
- *
+ *
* @param numColumns
*/
public void setNumColumns(int numColumns) {
- editor.setNumColumns(numColumns);
+ //
}
/**
* Sets the MaskProvider for this editor
- *
+ *
* @param provider
*/
public void setMaskProvider(XWTCompliantMaskProvider provider) {
- if(this.maskProvider != null) {
- maskProvider.removeMaskProviderListener(this);
- }
-
- maskProviderReady = false;
- this.maskProvider = provider;
- provider.addMaskProviderListener(this);
- checkInput();
+ //
}
/**
- *
+ *
* @return the MaskProvider associated to this editor
*/
public XWTCompliantMaskProvider getMaskProvider() {
- return maskProvider;
- }
-
- public void notifyReady(XWTCompliantMaskProvider provider) {
- this.maskProviderReady = true;
- editor.setMasks(maskProvider.getMasks());
- provider.removeMaskProviderListener(this);
- checkInput();
+ return null;
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java
index fbfe2ee3fc9..e18d9a9f62d 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/MaskProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* 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
@@ -18,12 +18,12 @@ import java.util.Map;
*
* @author Camille Letavernier
*
- * @see IntegerMask
+ * @see StringMask
*/
public interface MaskProvider {
/**
* @return the list of masks and their String descriptions
*/
- public Map<Integer, String> getMasks();
+ public Map<String, String> getMasks();
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java
new file mode 100644
index 00000000000..3cf53f78487
--- /dev/null
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/StringMask.java
@@ -0,0 +1,114 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.widgets;
+
+import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProvider;
+import org.eclipse.papyrus.views.properties.providers.XWTCompliantMaskProviderListener;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A widget to edit mask-based Integer values
+ * The integer value is interpreted as a list of boolean values
+ * The widget cannot use more than 32 masks
+ *
+ * @author Camille Letavernier
+ */
+public class StringMask extends AbstractPropertyEditor implements XWTCompliantMaskProviderListener {
+
+ private org.eclipse.papyrus.infra.widgets.editors.StringMask editor;
+
+ private XWTCompliantMaskProvider maskProvider;
+
+ private boolean maskProviderReady = false;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which this widget will be created
+ * @param style
+ */
+ public StringMask(Composite parent, int style) {
+ editor = createStringMask(parent, style);
+ setEditor(editor);
+ }
+
+ /**
+ * Creates the integer mask.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed
+ * @param style
+ * The style for the widget
+ * @return the integer mask.
+ */
+ protected org.eclipse.papyrus.infra.widgets.editors.StringMask createStringMask(Composite parent, int style) {
+ return new org.eclipse.papyrus.infra.widgets.editors.StringMask(parent, style);
+ }
+
+ @Override
+ protected void checkInput() {
+ if(maskProvider != null && maskProviderReady) {
+ super.checkInput();
+ }
+ }
+
+ /**
+ * @return the number of columns for this editor
+ *
+ */
+ public int getNumColumns() {
+ return editor.getNumColumns();
+ }
+
+ /**
+ * Sets the number of columns for this editor. The mask checkboxes will be
+ * distributed according to this number
+ *
+ * @param numColumns
+ */
+ public void setNumColumns(int numColumns) {
+ editor.setNumColumns(numColumns);
+ }
+
+ /**
+ * Sets the MaskProvider for this editor
+ *
+ * @param provider
+ */
+ public void setMaskProvider(XWTCompliantMaskProvider provider) {
+ if(this.maskProvider != null) {
+ maskProvider.removeMaskProviderListener(this);
+ }
+
+ maskProviderReady = false;
+ this.maskProvider = provider;
+ provider.addMaskProviderListener(this);
+ checkInput();
+ }
+
+ /**
+ *
+ * @return the MaskProvider associated to this editor
+ */
+ public XWTCompliantMaskProvider getMaskProvider() {
+ return maskProvider;
+ }
+
+ public void notifyReady(XWTCompliantMaskProvider provider) {
+ this.maskProviderReady = true;
+ editor.setMasks(maskProvider.getMasks());
+ provider.removeMaskProviderListener(this);
+ checkInput();
+ }
+}

Back to the top