Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/core')
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.edit/plugin.properties2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/contexts/provider/ConstraintDescriptorItemProvider.java24
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/PropertyEditorItemProvider.java24
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/ReferenceAttributeItemProvider.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/UiItemProviderAdapterFactory.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/UIToXML.qvto3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/XMLToUI.qvto6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model.xwt/build.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.ecore6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.genmodel8
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ConstraintDescriptor.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ContextsPackage.java30
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/Tab.java49
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ConstraintDescriptorImpl.java54
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ContextsPackageImpl.java11
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/DataContextElementImpl.java10
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/TabImpl.java268
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/PropertyEditor.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/UiPackage.java126
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/PropertyEditorImpl.java54
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiFactoryImpl.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiPackageImpl.java25
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiAdapterFactory.java8
-rw-r--r--plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiSwitch.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/model/Environment.xmi2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/RootPackage.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootFactoryImpl.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootPackageImpl.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/Activator.java8
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/AbstractConstraint.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/JavaInstanceOf.java47
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EcorePropertyEditorFactory.java108
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EditionDialog.java10
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/PropertyEditorFactory.java38
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/EMFObservableList.java117
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservable.java32
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableList.java172
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableValue.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableList.java309
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableValue.java86
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/Messages.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/messages.properties3
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/AbstractModelElement.java13
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/CompositeModelElement.java28
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/DataSource.java10
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/EMFModelElement.java17
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/ModelElement.java17
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/preferences/Preferences.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/ConfigurationManager.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultConstraintEngine.java14
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultDisplayEngine.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/StereotypeModelElement.java39
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/EMFHelper.java51
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/Util.java8
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/AbstractPropertyEditor.java98
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/EnumRadio.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/InvalidWidget.java4
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiInteger.java5
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiReference.java8
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiString.java10
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/ReferenceDialog.java32
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/StringFileSelector.java63
-rw-r--r--plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/xwt/XWTTabDescriptor.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/META-INF/MANIFEST.MF11
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/Activator.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/ReferenceValueFactory.java3
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/StringEditionFactory.java84
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/AbstractEditor.java22
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelectionListener.java18
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelector.java9
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/InputDialog.java185
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleStringEditor.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueEditor.java81
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueSelectorDialog.java51
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/ReferenceDialog.java193
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/SelectionEditor.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringEditor.java19
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringFileSelector.java175
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringLabel.java2
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/Messages.java10
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/messages.properties7
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/providers/CollectionContentProvider.java6
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/ReferenceSelector.java34
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StandardSelector.java25
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StringSelector.java34
-rw-r--r--plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/util/FileUtil.java74
86 files changed, 2298 insertions, 958 deletions
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.edit/plugin.properties b/plugins/core/org.eclipse.papyrus.properties.model.edit/plugin.properties
index 6c61ee30765..be52f0772fe 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.edit/plugin.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.model.edit/plugin.properties
@@ -173,3 +173,5 @@ _UI_Context_dependencies_feature = Dependencies
_UI_Property_description_feature = Description
_UI_ContentProviderType_type = Content Provider Type
_UI_PropertyEditor_contentProviderClass_feature = Content Provider Class
+_UI_ConstraintDescriptor_overrideable_feature = Overrideable
+_UI_PropertyEditor_showLabel_feature = Show Label
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/contexts/provider/ConstraintDescriptorItemProvider.java b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/contexts/provider/ConstraintDescriptorItemProvider.java
index 33cb1a7af6c..8c5fc454829 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/contexts/provider/ConstraintDescriptorItemProvider.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/contexts/provider/ConstraintDescriptorItemProvider.java
@@ -72,6 +72,7 @@ public class ConstraintDescriptorItemProvider
addNamePropertyDescriptor(object);
addConstraintTypePropertyDescriptor(object);
addOverriddenConstraintsPropertyDescriptor(object);
+ addOverrideablePropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -143,6 +144,28 @@ public class ConstraintDescriptorItemProvider
}
/**
+ * This adds a property descriptor for the Overrideable feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addOverrideablePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ConstraintDescriptor_overrideable_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ConstraintDescriptor_overrideable_feature", "_UI_ConstraintDescriptor_type"),
+ ContextsPackage.Literals.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
@@ -211,6 +234,7 @@ public class ConstraintDescriptorItemProvider
switch (notification.getFeatureID(ConstraintDescriptor.class)) {
case ContextsPackage.CONSTRAINT_DESCRIPTOR__NAME:
+ case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case ContextsPackage.CONSTRAINT_DESCRIPTOR__CONSTRAINTS:
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/PropertyEditorItemProvider.java b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/PropertyEditorItemProvider.java
index e9094ae4c13..83f7b66b970 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/PropertyEditorItemProvider.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/PropertyEditorItemProvider.java
@@ -67,6 +67,7 @@ public class PropertyEditorItemProvider
addReadOnlyPropertyDescriptor(object);
addWidgetTypePropertyDescriptor(object);
addContentProviderClassPropertyDescriptor(object);
+ addShowLabelPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
@@ -160,6 +161,28 @@ public class PropertyEditorItemProvider
}
/**
+ * This adds a property descriptor for the Show Label feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addShowLabelPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_PropertyEditor_showLabel_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_PropertyEditor_showLabel_feature", "_UI_PropertyEditor_type"),
+ UiPackage.Literals.PROPERTY_EDITOR__SHOW_LABEL,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
@@ -226,6 +249,7 @@ public class PropertyEditorItemProvider
switch (notification.getFeatureID(PropertyEditor.class)) {
case UiPackage.PROPERTY_EDITOR__READ_ONLY:
case UiPackage.PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS:
+ case UiPackage.PROPERTY_EDITOR__SHOW_LABEL:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
case UiPackage.PROPERTY_EDITOR__UNRESOLVED_PROPERTY:
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/ReferenceAttributeItemProvider.java b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/ReferenceAttributeItemProvider.java
index d850c42b230..49d185cbc9f 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/ReferenceAttributeItemProvider.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/ReferenceAttributeItemProvider.java
@@ -169,12 +169,12 @@ public class ReferenceAttributeItemProvider
newChildDescriptors.add
(createChildParameter
(UiPackage.Literals.REFERENCE_ATTRIBUTE__VALUE,
- UiFactory.eINSTANCE.createLayout()));
+ UiFactory.eINSTANCE.createUnknownComponent()));
newChildDescriptors.add
(createChildParameter
(UiPackage.Literals.REFERENCE_ATTRIBUTE__VALUE,
- UiFactory.eINSTANCE.createUnknownComponent()));
+ UiFactory.eINSTANCE.createLayout()));
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/UiItemProviderAdapterFactory.java b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/UiItemProviderAdapterFactory.java
index 059653787d0..90ce3a7e72e 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/UiItemProviderAdapterFactory.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model.edit/src-gen/org/eclipse/papyrus/properties/ui/provider/UiItemProviderAdapterFactory.java
@@ -362,10 +362,10 @@ public class UiItemProviderAdapterFactory extends UiAdapterFactory implements Co
if (standardWidgetItemProvider != null) standardWidgetItemProvider.dispose();
if (propertyEditorItemProvider != null) propertyEditorItemProvider.dispose();
if (compositeWidgetItemProvider != null) compositeWidgetItemProvider.dispose();
+ if (unknownComponentItemProvider != null) unknownComponentItemProvider.dispose();
if (layoutItemProvider != null) layoutItemProvider.dispose();
if (valueAttributeItemProvider != null) valueAttributeItemProvider.dispose();
if (referenceAttributeItemProvider != null) referenceAttributeItemProvider.dispose();
- if (unknownComponentItemProvider != null) unknownComponentItemProvider.dispose();
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/UIToXML.qvto b/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/UIToXML.qvto
index 61e381ab789..2a9a83017ad 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/UIToXML.qvto
+++ b/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/UIToXML.qvto
@@ -96,6 +96,9 @@ mapping PropertyEditor::toEditorXML() : XML::Element inherits Widget::toWidgetXM
if self.readOnly then
children := children->including(createAttribute("readOnly", "true"))
endif;
+ if not self.showLabel then
+ children := children->including(createAttribute("showLabel", "false"))
+ endif;
addNamespace(self.widgetType.namespace, self);
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/XMLToUI.qvto b/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/XMLToUI.qvto
index 093e31fbb5a..0a6d0fc2c62 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/XMLToUI.qvto
+++ b/plugins/core/org.eclipse.papyrus.properties.model.xwt/Transformation/XMLToUI.qvto
@@ -126,13 +126,15 @@ mapping XML::Element::toPropertyEditor() : PropertyEditor inherits XML::Element:
endif;
_property := prop;
- //Remove the readOnlyAttribute, as it is an actual property (i.e. not generic) in the UI Model
+ //Remove the readOnly and showLabel Attributes, as they are actual properties (i.e. not generic) in the UI Model
//Avoids dupplication of the attribute
var readOnlyAttribute := result.attributes->any(e | e.name = "readOnly");
- result.attributes := result.attributes->excluding(readOnlyAttribute);
+ var showLabelAttribute := result.attributes->any(e | e.name = "showLabel");
+ result.attributes := result.attributes->excluding(readOnlyAttribute)->excluding(showLabelAttribute);
unresolvedProperty := prop.oclAsType(UnknownProperty);
readOnly := self.children->exists(e | e.oclIsKindOf(XML::Attribute) and e.oclAsType(XML::Attribute).name = 'readOnly' and e.oclAsType(XML::Attribute).value='true');
+ showLabel := self.children->exists(e | e.oclIsKindOf(XML::Attribute) and e.oclAsType(XML::Attribute).name = 'showLabel' and e.oclAsType(XML::Attribute).value='true');
}
query XML::Element::getPropertyName() : String {
diff --git a/plugins/core/org.eclipse.papyrus.properties.model.xwt/build.properties b/plugins/core/org.eclipse.papyrus.properties.model.xwt/build.properties
index 2a289c74938..acc9d1f12f0 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model.xwt/build.properties
+++ b/plugins/core/org.eclipse.papyrus.properties.model.xwt/build.properties
@@ -4,4 +4,5 @@ bin.includes = META-INF/,\
.,\
plugin.xml,\
Transformation/,\
- OSGI-INF/
+ OSGI-INF/,\
+ about.html
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.ecore b/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.ecore
index a78c4125487..2e238bd10ec 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.ecore
+++ b/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.ecore
@@ -173,6 +173,9 @@
eType="#//contexts/ConfigProperty" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="overriddenConstraints"
upperBound="-1" eType="#//contexts/ConstraintDescriptor"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="overrideable" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+ defaultValueLiteral="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ConfigProperty" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1"
@@ -210,6 +213,9 @@
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="contentProviderClass"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="showLabel" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"
+ defaultValueLiteral="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="CompositeWidget" eSuperTypes="#//ui/Widget">
<eStructuralFeatures xsi:type="ecore:EReference" name="layout" lowerBound="1"
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.genmodel b/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.genmodel
index 74dfdb3fed6..623b9ee5433 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.genmodel
+++ b/plugins/core/org.eclipse.papyrus.properties.model/Model/Properties.genmodel
@@ -134,6 +134,7 @@
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Properties.ecore#//contexts/ConstraintDescriptor/properties"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference Properties.ecore#//contexts/ConstraintDescriptor/overriddenConstraints"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Properties.ecore#//contexts/ConstraintDescriptor/overrideable"/>
</genClasses>
<genClasses image="false" ecoreClass="Properties.ecore#//contexts/ConfigProperty">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Properties.ecore#//contexts/ConfigProperty/name"/>
@@ -165,6 +166,7 @@
ecoreFeature="ecore:EReference Properties.ecore#//ui/PropertyEditor/widgetType"/>
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Properties.ecore#//ui/PropertyEditor/unresolvedProperty"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Properties.ecore#//ui/PropertyEditor/contentProviderClass"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Properties.ecore#//ui/PropertyEditor/showLabel"/>
</genClasses>
<genClasses ecoreClass="Properties.ecore#//ui/CompositeWidget">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Properties.ecore#//ui/CompositeWidget/layout"/>
@@ -172,6 +174,9 @@
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference Properties.ecore#//ui/CompositeWidget/widgetType"/>
</genClasses>
+ <genClasses ecoreClass="Properties.ecore#//ui/UnknownComponent">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Properties.ecore#//ui/UnknownComponent/typeName"/>
+ </genClasses>
<genClasses ecoreClass="Properties.ecore#//ui/Layout">
<genFeatures notify="false" createChild="false" propertySortChoices="true"
ecoreFeature="ecore:EReference Properties.ecore#//ui/Layout/layoutType"/>
@@ -185,9 +190,6 @@
<genClasses ecoreClass="Properties.ecore#//ui/ReferenceAttribute">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Properties.ecore#//ui/ReferenceAttribute/value"/>
</genClasses>
- <genClasses ecoreClass="Properties.ecore#//ui/UnknownComponent">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Properties.ecore#//ui/UnknownComponent/typeName"/>
- </genClasses>
</nestedGenPackages>
</genPackages>
</genmodel:GenModel>
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ConstraintDescriptor.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ConstraintDescriptor.java
index ef03e0164a0..55ba67d80e4 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ConstraintDescriptor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ConstraintDescriptor.java
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.properties.environment.ConstraintType;
* <li>{@link org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#getConstraints <em>Constraints</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#getProperties <em>Properties</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#getOverriddenConstraints <em>Overridden Constraints</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#isOverrideable <em>Overrideable</em>}</li>
* </ul>
* </p>
*
@@ -162,4 +163,31 @@ public interface ConstraintDescriptor extends EObject {
*/
EList<ConstraintDescriptor> getOverriddenConstraints();
+ /**
+ * Returns the value of the '<em><b>Overrideable</b></em>' attribute.
+ * The default value is <code>"true"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Overrideable</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Overrideable</em>' attribute.
+ * @see #setOverrideable(boolean)
+ * @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getConstraintDescriptor_Overrideable()
+ * @model default="true" required="true"
+ * @generated
+ */
+ boolean isOverrideable();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#isOverrideable <em>Overrideable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Overrideable</em>' attribute.
+ * @see #isOverrideable()
+ * @generated
+ */
+ void setOverrideable(boolean value);
+
} // ConstraintDescriptor
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ContextsPackage.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ContextsPackage.java
index 73f7ea71bf3..ca88cdd2296 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ContextsPackage.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/ContextsPackage.java
@@ -791,13 +791,22 @@ public interface ContextsPackage extends EPackage {
int CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS = 5;
/**
+ * The feature id for the '<em><b>Overrideable</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int CONSTRAINT_DESCRIPTOR__OVERRIDEABLE = 6;
+
+ /**
* The number of structural features of the '<em>Constraint Descriptor</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int CONSTRAINT_DESCRIPTOR_FEATURE_COUNT = 6;
+ int CONSTRAINT_DESCRIPTOR_FEATURE_COUNT = 7;
/**
* The meta object id for the '{@link org.eclipse.papyrus.properties.contexts.impl.ConfigPropertyImpl <em>Config Property</em>}' class.
@@ -1475,6 +1484,17 @@ public interface ContextsPackage extends EPackage {
EReference getConstraintDescriptor_OverriddenConstraints();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#isOverrideable <em>Overrideable</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Overrideable</em>'.
+ * @see org.eclipse.papyrus.properties.contexts.ConstraintDescriptor#isOverrideable()
+ * @see #getConstraintDescriptor()
+ * @generated
+ */
+ EAttribute getConstraintDescriptor_Overrideable();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.papyrus.properties.contexts.ConfigProperty <em>Config Property</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -2006,6 +2026,14 @@ public interface ContextsPackage extends EPackage {
EReference CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS = eINSTANCE.getConstraintDescriptor_OverriddenConstraints();
/**
+ * The meta object literal for the '<em><b>Overrideable</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute CONSTRAINT_DESCRIPTOR__OVERRIDEABLE = eINSTANCE.getConstraintDescriptor_Overrideable();
+
+ /**
* The meta object literal for the '{@link org.eclipse.papyrus.properties.contexts.impl.ConfigPropertyImpl <em>Config Property</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/Tab.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/Tab.java
index f0e81f997b3..14943c38b19 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/Tab.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/Tab.java
@@ -13,20 +13,20 @@ import org.eclipse.emf.ecore.EObject;
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Tab</b></em>'.
* <!-- end-user-doc -->
- *
+ *
* <p>
* The following features are supported:
* <ul>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getLabel <em>Label</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getId <em>Id</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getCategory <em>Category</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getImage <em>Image</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getAfterTab <em>After Tab</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getSections <em>Sections</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#isIndented <em>Indented</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getLabel <em>Label</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getCategory <em>Category</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getImage <em>Image</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getAfterTab <em>After Tab</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#getSections <em>Sections</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.Tab#isIndented <em>Indented</em>}</li>
* </ul>
* </p>
- *
+ *
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab()
* @model
* @generated
@@ -40,7 +40,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>Label</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>Label</em>' attribute.
* @see #setLabel(String)
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_Label()
@@ -53,9 +52,7 @@ public interface Tab extends EObject {
* Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.Tab#getLabel <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>Label</em>' attribute.
+ * @param value the new value of the '<em>Label</em>' attribute.
* @see #getLabel()
* @generated
*/
@@ -68,7 +65,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>Id</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>Id</em>' attribute.
* @see #setId(String)
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_Id()
@@ -81,9 +77,7 @@ public interface Tab extends EObject {
* Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.Tab#getId <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>Id</em>' attribute.
+ * @param value the new value of the '<em>Id</em>' attribute.
* @see #getId()
* @generated
*/
@@ -96,7 +90,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>Category</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>Category</em>' attribute.
* @see #setCategory(String)
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_Category()
@@ -109,9 +102,7 @@ public interface Tab extends EObject {
* Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.Tab#getCategory <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>Category</em>' attribute.
+ * @param value the new value of the '<em>Category</em>' attribute.
* @see #getCategory()
* @generated
*/
@@ -124,7 +115,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>Image</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>Image</em>' attribute.
* @see #setImage(String)
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_Image()
@@ -137,9 +127,7 @@ public interface Tab extends EObject {
* Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.Tab#getImage <em>Image</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>Image</em>' attribute.
+ * @param value the new value of the '<em>Image</em>' attribute.
* @see #getImage()
* @generated
*/
@@ -152,7 +140,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>After Tab</em>' reference isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>After Tab</em>' reference.
* @see #setAfterTab(Tab)
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_AfterTab()
@@ -165,9 +152,7 @@ public interface Tab extends EObject {
* Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.Tab#getAfterTab <em>After Tab</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>After Tab</em>' reference.
+ * @param value the new value of the '<em>After Tab</em>' reference.
* @see #getAfterTab()
* @generated
*/
@@ -182,7 +167,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>Sections</em>' containment reference list isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>Sections</em>' containment reference list.
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_Sections()
* @see org.eclipse.papyrus.properties.contexts.Section#getTab
@@ -199,7 +183,6 @@ public interface Tab extends EObject {
* If the meaning of the '<em>Indented</em>' attribute isn't clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
- *
* @return the value of the '<em>Indented</em>' attribute.
* @see #setIndented(boolean)
* @see org.eclipse.papyrus.properties.contexts.ContextsPackage#getTab_Indented()
@@ -212,9 +195,7 @@ public interface Tab extends EObject {
* Sets the value of the '{@link org.eclipse.papyrus.properties.contexts.Tab#isIndented <em>Indented</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
- * @param value
- * the new value of the '<em>Indented</em>' attribute.
+ * @param value the new value of the '<em>Indented</em>' attribute.
* @see #isIndented()
* @generated
*/
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ConstraintDescriptorImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ConstraintDescriptorImpl.java
index 3970f166519..bb99888ea7a 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ConstraintDescriptorImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ConstraintDescriptorImpl.java
@@ -44,6 +44,7 @@ import org.eclipse.papyrus.properties.environment.ConstraintType;
* <li>{@link org.eclipse.papyrus.properties.contexts.impl.ConstraintDescriptorImpl#getConstraints <em>Constraints</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.contexts.impl.ConstraintDescriptorImpl#getProperties <em>Properties</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.contexts.impl.ConstraintDescriptorImpl#getOverriddenConstraints <em>Overridden Constraints</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.ConstraintDescriptorImpl#isOverrideable <em>Overrideable</em>}</li>
* </ul>
* </p>
*
@@ -111,6 +112,26 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
protected EList<ConstraintDescriptor> overriddenConstraints;
/**
+ * The default value of the '{@link #isOverrideable() <em>Overrideable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isOverrideable()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean OVERRIDEABLE_EDEFAULT = true;
+
+ /**
+ * The cached value of the '{@link #isOverrideable() <em>Overrideable</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isOverrideable()
+ * @generated
+ * @ordered
+ */
+ protected boolean overrideable = OVERRIDEABLE_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -270,6 +291,27 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
* <!-- end-user-doc -->
* @generated
*/
+ public boolean isOverrideable() {
+ return overrideable;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setOverrideable(boolean newOverrideable) {
+ boolean oldOverrideable = overrideable;
+ overrideable = newOverrideable;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE, oldOverrideable, overrideable));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
@@ -334,6 +376,8 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
return getProperties();
case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS:
return getOverriddenConstraints();
+ case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE:
+ return isOverrideable();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -368,6 +412,9 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
getOverriddenConstraints().clear();
getOverriddenConstraints().addAll((Collection<? extends ConstraintDescriptor>)newValue);
return;
+ case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE:
+ setOverrideable((Boolean)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -398,6 +445,9 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS:
getOverriddenConstraints().clear();
return;
+ case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE:
+ setOverrideable(OVERRIDEABLE_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -422,6 +472,8 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
return properties != null && !properties.isEmpty();
case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS:
return overriddenConstraints != null && !overriddenConstraints.isEmpty();
+ case ContextsPackage.CONSTRAINT_DESCRIPTOR__OVERRIDEABLE:
+ return overrideable != OVERRIDEABLE_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -438,6 +490,8 @@ public class ConstraintDescriptorImpl extends EObjectImpl implements ConstraintD
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
+ result.append(", overrideable: ");
+ result.append(overrideable);
result.append(')');
return result.toString();
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ContextsPackageImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ContextsPackageImpl.java
index 1f8af1058be..c7d776d8ff6 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ContextsPackageImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/ContextsPackageImpl.java
@@ -694,6 +694,15 @@ public class ContextsPackageImpl extends EPackageImpl implements ContextsPackage
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getConstraintDescriptor_Overrideable() {
+ return (EAttribute)constraintDescriptorEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getConfigProperty() {
return configPropertyEClass;
}
@@ -834,6 +843,7 @@ public class ContextsPackageImpl extends EPackageImpl implements ContextsPackage
createEReference(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__CONSTRAINTS);
createEReference(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__PROPERTIES);
createEReference(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__OVERRIDDEN_CONSTRAINTS);
+ createEAttribute(constraintDescriptorEClass, CONSTRAINT_DESCRIPTOR__OVERRIDEABLE);
configPropertyEClass = createEClass(CONFIG_PROPERTY);
createEAttribute(configPropertyEClass, CONFIG_PROPERTY__NAME);
@@ -949,6 +959,7 @@ public class ContextsPackageImpl extends EPackageImpl implements ContextsPackage
initEReference(getConstraintDescriptor_Constraints(), this.getConstraintDescriptor(), null, "constraints", null, 0, -1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getConstraintDescriptor_Properties(), this.getConfigProperty(), null, "properties", null, 0, -1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getConstraintDescriptor_OverriddenConstraints(), this.getConstraintDescriptor(), null, "overriddenConstraints", null, 0, -1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getConstraintDescriptor_Overrideable(), ecorePackage.getEBoolean(), "overrideable", "true", 1, 1, ConstraintDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(configPropertyEClass, ConfigProperty.class, "ConfigProperty", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getConfigProperty_Name(), ecorePackage.getEString(), "name", null, 1, 1, ConfigProperty.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/DataContextElementImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/DataContextElementImpl.java
index f80a42e5d79..b5c8540a0fc 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/DataContextElementImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/DataContextElementImpl.java
@@ -353,8 +353,14 @@ public class DataContextElementImpl extends EObjectImpl implements DataContextEl
if(object.getClass() == getClass()) {
DataContextElement element = (DataContextElement)object;
- if(!getName().equals(element.getName())) {
- return false;
+ if(getName() == null) {
+ if(element.getName() != null) {
+ return false;
+ }
+ } else {
+ if(!getName().equals(element.getName())) {
+ return false;
+ }
}
if(getPackage() == null) {
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/TabImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/TabImpl.java
index 3a3dfc4f492..37e8eb12597 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/TabImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/contexts/impl/TabImpl.java
@@ -28,16 +28,16 @@ import org.eclipse.papyrus.properties.contexts.Tab;
* <p>
* The following features are implemented:
* <ul>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getLabel <em>Label</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getId <em>Id</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getCategory <em>Category</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getImage <em>Image</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getAfterTab <em>After Tab</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getSections <em>Sections</em>}</li>
- * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#isIndented <em>Indented</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getLabel <em>Label</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getId <em>Id</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getCategory <em>Category</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getImage <em>Image</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getAfterTab <em>After Tab</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#getSections <em>Sections</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.contexts.impl.TabImpl#isIndented <em>Indented</em>}</li>
* </ul>
* </p>
- *
+ *
* @generated
*/
public class TabImpl extends EObjectImpl implements Tab {
@@ -46,7 +46,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getLabel()
* @generated
* @ordered
@@ -57,7 +56,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getLabel()
* @generated
* @ordered
@@ -68,7 +66,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getId()
* @generated
* @ordered
@@ -79,7 +76,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getId()
* @generated
* @ordered
@@ -90,7 +86,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The default value of the '{@link #getCategory() <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getCategory()
* @generated
* @ordered
@@ -101,7 +96,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #getCategory() <em>Category</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getCategory()
* @generated
* @ordered
@@ -112,7 +106,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The default value of the '{@link #getImage() <em>Image</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getImage()
* @generated
* @ordered
@@ -123,7 +116,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #getImage() <em>Image</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getImage()
* @generated
* @ordered
@@ -134,7 +126,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #getAfterTab() <em>After Tab</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getAfterTab()
* @generated
* @ordered
@@ -145,7 +136,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #getSections() <em>Sections</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #getSections()
* @generated
* @ordered
@@ -156,7 +146,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The default value of the '{@link #isIndented() <em>Indented</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #isIndented()
* @generated
* @ordered
@@ -167,7 +156,6 @@ public class TabImpl extends EObjectImpl implements Tab {
* The cached value of the '{@link #isIndented() <em>Indented</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @see #isIndented()
* @generated
* @ordered
@@ -177,7 +165,6 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
protected TabImpl() {
@@ -187,7 +174,6 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
@@ -198,7 +184,6 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public String getLabel() {
@@ -208,20 +193,18 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void setLabel(String newLabel) {
String oldLabel = label;
label = newLabel;
- if(eNotificationRequired())
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.TAB__LABEL, oldLabel, label));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public String getId() {
@@ -231,20 +214,18 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
- if(eNotificationRequired())
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.TAB__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public String getCategory() {
@@ -254,20 +235,18 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void setCategory(String newCategory) {
String oldCategory = category;
category = newCategory;
- if(eNotificationRequired())
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.TAB__CATEGORY, oldCategory, category));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public String getImage() {
@@ -277,28 +256,26 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void setImage(String newImage) {
String oldImage = image;
image = newImage;
- if(eNotificationRequired())
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.TAB__IMAGE, oldImage, image));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public Tab getAfterTab() {
- if(afterTab != null && afterTab.eIsProxy()) {
+ if (afterTab != null && afterTab.eIsProxy()) {
InternalEObject oldAfterTab = (InternalEObject)afterTab;
afterTab = (Tab)eResolveProxy(oldAfterTab);
- if(afterTab != oldAfterTab) {
- if(eNotificationRequired())
+ if (afterTab != oldAfterTab) {
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContextsPackage.TAB__AFTER_TAB, oldAfterTab, afterTab));
}
}
@@ -308,7 +285,6 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public Tab basicGetAfterTab() {
@@ -318,24 +294,22 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void setAfterTab(Tab newAfterTab) {
Tab oldAfterTab = afterTab;
afterTab = newAfterTab;
- if(eNotificationRequired())
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.TAB__AFTER_TAB, oldAfterTab, afterTab));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public EList<Section> getSections() {
- if(sections == null) {
+ if (sections == null) {
sections = new EObjectContainmentWithInverseEList<Section>(Section.class, this, ContextsPackage.TAB__SECTIONS, ContextsPackage.SECTION__TAB);
}
return sections;
@@ -344,7 +318,6 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public boolean isIndented() {
@@ -354,28 +327,26 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
public void setIndented(boolean newIndented) {
boolean oldIndented = indented;
indented = newIndented;
- if(eNotificationRequired())
+ if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ContextsPackage.TAB__INDENTED, oldIndented, indented));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch(featureID) {
- case ContextsPackage.TAB__SECTIONS:
- return ((InternalEList<InternalEObject>)(InternalEList<?>)getSections()).basicAdd(otherEnd, msgs);
+ switch (featureID) {
+ case ContextsPackage.TAB__SECTIONS:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getSections()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
@@ -383,14 +354,13 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch(featureID) {
- case ContextsPackage.TAB__SECTIONS:
- return ((InternalEList<?>)getSections()).basicRemove(otherEnd, msgs);
+ switch (featureID) {
+ case ContextsPackage.TAB__SECTIONS:
+ return ((InternalEList<?>)getSections()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
@@ -398,28 +368,26 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch(featureID) {
- case ContextsPackage.TAB__LABEL:
- return getLabel();
- case ContextsPackage.TAB__ID:
- return getId();
- case ContextsPackage.TAB__CATEGORY:
- return getCategory();
- case ContextsPackage.TAB__IMAGE:
- return getImage();
- case ContextsPackage.TAB__AFTER_TAB:
- if(resolve)
- return getAfterTab();
- return basicGetAfterTab();
- case ContextsPackage.TAB__SECTIONS:
- return getSections();
- case ContextsPackage.TAB__INDENTED:
- return isIndented();
+ switch (featureID) {
+ case ContextsPackage.TAB__LABEL:
+ return getLabel();
+ case ContextsPackage.TAB__ID:
+ return getId();
+ case ContextsPackage.TAB__CATEGORY:
+ return getCategory();
+ case ContextsPackage.TAB__IMAGE:
+ return getImage();
+ case ContextsPackage.TAB__AFTER_TAB:
+ if (resolve) return getAfterTab();
+ return basicGetAfterTab();
+ case ContextsPackage.TAB__SECTIONS:
+ return getSections();
+ case ContextsPackage.TAB__INDENTED:
+ return isIndented();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -427,35 +395,34 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
- switch(featureID) {
- case ContextsPackage.TAB__LABEL:
- setLabel((String)newValue);
- return;
- case ContextsPackage.TAB__ID:
- setId((String)newValue);
- return;
- case ContextsPackage.TAB__CATEGORY:
- setCategory((String)newValue);
- return;
- case ContextsPackage.TAB__IMAGE:
- setImage((String)newValue);
- return;
- case ContextsPackage.TAB__AFTER_TAB:
- setAfterTab((Tab)newValue);
- return;
- case ContextsPackage.TAB__SECTIONS:
- getSections().clear();
- getSections().addAll((Collection<? extends Section>)newValue);
- return;
- case ContextsPackage.TAB__INDENTED:
- setIndented((Boolean)newValue);
- return;
+ switch (featureID) {
+ case ContextsPackage.TAB__LABEL:
+ setLabel((String)newValue);
+ return;
+ case ContextsPackage.TAB__ID:
+ setId((String)newValue);
+ return;
+ case ContextsPackage.TAB__CATEGORY:
+ setCategory((String)newValue);
+ return;
+ case ContextsPackage.TAB__IMAGE:
+ setImage((String)newValue);
+ return;
+ case ContextsPackage.TAB__AFTER_TAB:
+ setAfterTab((Tab)newValue);
+ return;
+ case ContextsPackage.TAB__SECTIONS:
+ getSections().clear();
+ getSections().addAll((Collection<? extends Section>)newValue);
+ return;
+ case ContextsPackage.TAB__INDENTED:
+ setIndented((Boolean)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -463,33 +430,32 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
public void eUnset(int featureID) {
- switch(featureID) {
- case ContextsPackage.TAB__LABEL:
- setLabel(LABEL_EDEFAULT);
- return;
- case ContextsPackage.TAB__ID:
- setId(ID_EDEFAULT);
- return;
- case ContextsPackage.TAB__CATEGORY:
- setCategory(CATEGORY_EDEFAULT);
- return;
- case ContextsPackage.TAB__IMAGE:
- setImage(IMAGE_EDEFAULT);
- return;
- case ContextsPackage.TAB__AFTER_TAB:
- setAfterTab((Tab)null);
- return;
- case ContextsPackage.TAB__SECTIONS:
- getSections().clear();
- return;
- case ContextsPackage.TAB__INDENTED:
- setIndented(INDENTED_EDEFAULT);
- return;
+ switch (featureID) {
+ case ContextsPackage.TAB__LABEL:
+ setLabel(LABEL_EDEFAULT);
+ return;
+ case ContextsPackage.TAB__ID:
+ setId(ID_EDEFAULT);
+ return;
+ case ContextsPackage.TAB__CATEGORY:
+ setCategory(CATEGORY_EDEFAULT);
+ return;
+ case ContextsPackage.TAB__IMAGE:
+ setImage(IMAGE_EDEFAULT);
+ return;
+ case ContextsPackage.TAB__AFTER_TAB:
+ setAfterTab((Tab)null);
+ return;
+ case ContextsPackage.TAB__SECTIONS:
+ getSections().clear();
+ return;
+ case ContextsPackage.TAB__INDENTED:
+ setIndented(INDENTED_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -497,26 +463,25 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
- switch(featureID) {
- case ContextsPackage.TAB__LABEL:
- return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
- case ContextsPackage.TAB__ID:
- return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
- case ContextsPackage.TAB__CATEGORY:
- return CATEGORY_EDEFAULT == null ? category != null : !CATEGORY_EDEFAULT.equals(category);
- case ContextsPackage.TAB__IMAGE:
- return IMAGE_EDEFAULT == null ? image != null : !IMAGE_EDEFAULT.equals(image);
- case ContextsPackage.TAB__AFTER_TAB:
- return afterTab != null;
- case ContextsPackage.TAB__SECTIONS:
- return sections != null && !sections.isEmpty();
- case ContextsPackage.TAB__INDENTED:
- return indented != INDENTED_EDEFAULT;
+ switch (featureID) {
+ case ContextsPackage.TAB__LABEL:
+ return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
+ case ContextsPackage.TAB__ID:
+ return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
+ case ContextsPackage.TAB__CATEGORY:
+ return CATEGORY_EDEFAULT == null ? category != null : !CATEGORY_EDEFAULT.equals(category);
+ case ContextsPackage.TAB__IMAGE:
+ return IMAGE_EDEFAULT == null ? image != null : !IMAGE_EDEFAULT.equals(image);
+ case ContextsPackage.TAB__AFTER_TAB:
+ return afterTab != null;
+ case ContextsPackage.TAB__SECTIONS:
+ return sections != null && !sections.isEmpty();
+ case ContextsPackage.TAB__INDENTED:
+ return indented != INDENTED_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -524,28 +489,25 @@ public class TabImpl extends EObjectImpl implements Tab {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- *
* @generated
*/
@Override
public String toString() {
- if(eIsProxy())
- return super.toString();
-
- return getCategory() + ":" + getId();
- // StringBuffer result = new StringBuffer(super.toString());
- // result.append(" (label: ");
- // result.append(label);
- // result.append(", id: ");
- // result.append(id);
- // result.append(", category: ");
- // result.append(category);
- // result.append(", image: ");
- // result.append(image);
- // result.append(", indented: ");
- // result.append(indented);
- // result.append(')');
- // return result.toString();
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (label: ");
+ result.append(label);
+ result.append(", id: ");
+ result.append(id);
+ result.append(", category: ");
+ result.append(category);
+ result.append(", image: ");
+ result.append(image);
+ result.append(", indented: ");
+ result.append(indented);
+ result.append(')');
+ return result.toString();
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/PropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/PropertyEditor.java
index 1b352de84ae..178981025df 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/PropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/PropertyEditor.java
@@ -24,6 +24,7 @@ import org.eclipse.papyrus.properties.environment.PropertyEditorType;
* <li>{@link org.eclipse.papyrus.properties.ui.PropertyEditor#getWidgetType <em>Widget Type</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.ui.PropertyEditor#getUnresolvedProperty <em>Unresolved Property</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.ui.PropertyEditor#getContentProviderClass <em>Content Provider Class</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.ui.PropertyEditor#isShowLabel <em>Show Label</em>}</li>
* </ul>
* </p>
*
@@ -163,4 +164,31 @@ public interface PropertyEditor extends Widget {
*/
void setContentProviderClass(String value);
+ /**
+ * Returns the value of the '<em><b>Show Label</b></em>' attribute.
+ * The default value is <code>"true"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Show Label</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Show Label</em>' attribute.
+ * @see #setShowLabel(boolean)
+ * @see org.eclipse.papyrus.properties.ui.UiPackage#getPropertyEditor_ShowLabel()
+ * @model default="true" required="true"
+ * @generated
+ */
+ boolean isShowLabel();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.properties.ui.PropertyEditor#isShowLabel <em>Show Label</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Show Label</em>' attribute.
+ * @see #isShowLabel()
+ * @generated
+ */
+ void setShowLabel(boolean value);
+
} // PropertyEditor
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/UiPackage.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/UiPackage.java
index f4f4426e175..e41206abea3 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/UiPackage.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/UiPackage.java
@@ -236,13 +236,22 @@ public interface UiPackage extends EPackage {
int PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS = WIDGET_FEATURE_COUNT + 4;
/**
+ * The feature id for the '<em><b>Show Label</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROPERTY_EDITOR__SHOW_LABEL = WIDGET_FEATURE_COUNT + 5;
+
+ /**
* The number of structural features of the '<em>Property Editor</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int PROPERTY_EDITOR_FEATURE_COUNT = WIDGET_FEATURE_COUNT + 5;
+ int PROPERTY_EDITOR_FEATURE_COUNT = WIDGET_FEATURE_COUNT + 6;
/**
* The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.CompositeWidgetImpl <em>Composite Widget</em>}' class.
@@ -307,173 +316,173 @@ public interface UiPackage extends EPackage {
* @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getLayout()
* @generated
*/
- int LAYOUT = 6;
+ int LAYOUT = 7;
/**
- * The feature id for the '<em><b>Attributes</b></em>' containment reference list.
+ * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.WidgetAttributeImpl <em>Widget Attribute</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.properties.ui.impl.WidgetAttributeImpl
+ * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getWidgetAttribute()
* @generated
- * @ordered
*/
- int LAYOUT__ATTRIBUTES = UI_COMPONENT__ATTRIBUTES;
+ int WIDGET_ATTRIBUTE = 8;
/**
- * The feature id for the '<em><b>Layout Type</b></em>' reference.
+ * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.ValueAttributeImpl <em>Value Attribute</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.properties.ui.impl.ValueAttributeImpl
+ * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getValueAttribute()
* @generated
- * @ordered
*/
- int LAYOUT__LAYOUT_TYPE = UI_COMPONENT_FEATURE_COUNT + 0;
+ int VALUE_ATTRIBUTE = 9;
/**
- * The number of structural features of the '<em>Layout</em>' class.
+ * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.ReferenceAttributeImpl <em>Reference Attribute</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.properties.ui.impl.ReferenceAttributeImpl
+ * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getReferenceAttribute()
* @generated
- * @ordered
*/
- int LAYOUT_FEATURE_COUNT = UI_COMPONENT_FEATURE_COUNT + 1;
+ int REFERENCE_ATTRIBUTE = 10;
/**
- * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.WidgetAttributeImpl <em>Widget Attribute</em>}' class.
+ * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.UnknownComponentImpl <em>Unknown Component</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see org.eclipse.papyrus.properties.ui.impl.WidgetAttributeImpl
- * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getWidgetAttribute()
+ * @see org.eclipse.papyrus.properties.ui.impl.UnknownComponentImpl
+ * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getUnknownComponent()
* @generated
*/
- int WIDGET_ATTRIBUTE = 7;
+ int UNKNOWN_COMPONENT = 6;
/**
- * The feature id for the '<em><b>Name</b></em>' attribute.
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int WIDGET_ATTRIBUTE__NAME = ELEMENT_FEATURE_COUNT + 0;
+ int UNKNOWN_COMPONENT__ATTRIBUTES = WIDGET__ATTRIBUTES;
/**
- * The number of structural features of the '<em>Widget Attribute</em>' class.
+ * The feature id for the '<em><b>Type Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int WIDGET_ATTRIBUTE_FEATURE_COUNT = ELEMENT_FEATURE_COUNT + 1;
+ int UNKNOWN_COMPONENT__TYPE_NAME = WIDGET_FEATURE_COUNT + 0;
/**
- * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.ValueAttributeImpl <em>Value Attribute</em>}' class.
+ * The number of structural features of the '<em>Unknown Component</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see org.eclipse.papyrus.properties.ui.impl.ValueAttributeImpl
- * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getValueAttribute()
* @generated
+ * @ordered
*/
- int VALUE_ATTRIBUTE = 8;
+ int UNKNOWN_COMPONENT_FEATURE_COUNT = WIDGET_FEATURE_COUNT + 1;
/**
- * The feature id for the '<em><b>Name</b></em>' attribute.
+ * The feature id for the '<em><b>Attributes</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int VALUE_ATTRIBUTE__NAME = WIDGET_ATTRIBUTE__NAME;
+ int LAYOUT__ATTRIBUTES = UI_COMPONENT__ATTRIBUTES;
/**
- * The feature id for the '<em><b>Value</b></em>' attribute.
+ * The feature id for the '<em><b>Layout Type</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int VALUE_ATTRIBUTE__VALUE = WIDGET_ATTRIBUTE_FEATURE_COUNT + 0;
+ int LAYOUT__LAYOUT_TYPE = UI_COMPONENT_FEATURE_COUNT + 0;
/**
- * The number of structural features of the '<em>Value Attribute</em>' class.
+ * The number of structural features of the '<em>Layout</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int VALUE_ATTRIBUTE_FEATURE_COUNT = WIDGET_ATTRIBUTE_FEATURE_COUNT + 1;
+ int LAYOUT_FEATURE_COUNT = UI_COMPONENT_FEATURE_COUNT + 1;
/**
- * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.ReferenceAttributeImpl <em>Reference Attribute</em>}' class.
+ * The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see org.eclipse.papyrus.properties.ui.impl.ReferenceAttributeImpl
- * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getReferenceAttribute()
* @generated
+ * @ordered
*/
- int REFERENCE_ATTRIBUTE = 9;
+ int WIDGET_ATTRIBUTE__NAME = ELEMENT_FEATURE_COUNT + 0;
/**
- * The feature id for the '<em><b>Name</b></em>' attribute.
+ * The number of structural features of the '<em>Widget Attribute</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int REFERENCE_ATTRIBUTE__NAME = WIDGET_ATTRIBUTE__NAME;
+ int WIDGET_ATTRIBUTE_FEATURE_COUNT = ELEMENT_FEATURE_COUNT + 1;
/**
- * The feature id for the '<em><b>Value</b></em>' containment reference.
+ * The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int REFERENCE_ATTRIBUTE__VALUE = WIDGET_ATTRIBUTE_FEATURE_COUNT + 0;
+ int VALUE_ATTRIBUTE__NAME = WIDGET_ATTRIBUTE__NAME;
/**
- * The number of structural features of the '<em>Reference Attribute</em>' class.
+ * The feature id for the '<em><b>Value</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int REFERENCE_ATTRIBUTE_FEATURE_COUNT = WIDGET_ATTRIBUTE_FEATURE_COUNT + 1;
+ int VALUE_ATTRIBUTE__VALUE = WIDGET_ATTRIBUTE_FEATURE_COUNT + 0;
/**
- * The meta object id for the '{@link org.eclipse.papyrus.properties.ui.impl.UnknownComponentImpl <em>Unknown Component</em>}' class.
+ * The number of structural features of the '<em>Value Attribute</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
- * @see org.eclipse.papyrus.properties.ui.impl.UnknownComponentImpl
- * @see org.eclipse.papyrus.properties.ui.impl.UiPackageImpl#getUnknownComponent()
* @generated
+ * @ordered
*/
- int UNKNOWN_COMPONENT = 10;
+ int VALUE_ATTRIBUTE_FEATURE_COUNT = WIDGET_ATTRIBUTE_FEATURE_COUNT + 1;
/**
- * The feature id for the '<em><b>Attributes</b></em>' containment reference list.
+ * The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int UNKNOWN_COMPONENT__ATTRIBUTES = WIDGET__ATTRIBUTES;
+ int REFERENCE_ATTRIBUTE__NAME = WIDGET_ATTRIBUTE__NAME;
/**
- * The feature id for the '<em><b>Type Name</b></em>' attribute.
+ * The feature id for the '<em><b>Value</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int UNKNOWN_COMPONENT__TYPE_NAME = WIDGET_FEATURE_COUNT + 0;
+ int REFERENCE_ATTRIBUTE__VALUE = WIDGET_ATTRIBUTE_FEATURE_COUNT + 0;
/**
- * The number of structural features of the '<em>Unknown Component</em>' class.
+ * The number of structural features of the '<em>Reference Attribute</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
- int UNKNOWN_COMPONENT_FEATURE_COUNT = WIDGET_FEATURE_COUNT + 1;
+ int REFERENCE_ATTRIBUTE_FEATURE_COUNT = WIDGET_ATTRIBUTE_FEATURE_COUNT + 1;
/**
@@ -604,6 +613,17 @@ public interface UiPackage extends EPackage {
EAttribute getPropertyEditor_ContentProviderClass();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.properties.ui.PropertyEditor#isShowLabel <em>Show Label</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Show Label</em>'.
+ * @see org.eclipse.papyrus.properties.ui.PropertyEditor#isShowLabel()
+ * @see #getPropertyEditor()
+ * @generated
+ */
+ EAttribute getPropertyEditor_ShowLabel();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.papyrus.properties.ui.CompositeWidget <em>Composite Widget</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -880,6 +900,14 @@ public interface UiPackage extends EPackage {
EAttribute PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS = eINSTANCE.getPropertyEditor_ContentProviderClass();
/**
+ * The meta object literal for the '<em><b>Show Label</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PROPERTY_EDITOR__SHOW_LABEL = eINSTANCE.getPropertyEditor_ShowLabel();
+
+ /**
* The meta object literal for the '{@link org.eclipse.papyrus.properties.ui.impl.CompositeWidgetImpl <em>Composite Widget</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/PropertyEditorImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/PropertyEditorImpl.java
index 120d89fc5be..b57d7503be5 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/PropertyEditorImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/PropertyEditorImpl.java
@@ -34,6 +34,7 @@ import org.eclipse.papyrus.properties.ui.UiPackage;
* <li>{@link org.eclipse.papyrus.properties.ui.impl.PropertyEditorImpl#getWidgetType <em>Widget Type</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.ui.impl.PropertyEditorImpl#getUnresolvedProperty <em>Unresolved Property</em>}</li>
* <li>{@link org.eclipse.papyrus.properties.ui.impl.PropertyEditorImpl#getContentProviderClass <em>Content Provider Class</em>}</li>
+ * <li>{@link org.eclipse.papyrus.properties.ui.impl.PropertyEditorImpl#isShowLabel <em>Show Label</em>}</li>
* </ul>
* </p>
*
@@ -111,6 +112,26 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
protected String contentProviderClass = CONTENT_PROVIDER_CLASS_EDEFAULT;
/**
+ * The default value of the '{@link #isShowLabel() <em>Show Label</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isShowLabel()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SHOW_LABEL_EDEFAULT = true;
+
+ /**
+ * The cached value of the '{@link #isShowLabel() <em>Show Label</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isShowLabel()
+ * @generated
+ * @ordered
+ */
+ protected boolean showLabel = SHOW_LABEL_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
@@ -295,6 +316,27 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
* <!-- end-user-doc -->
* @generated
*/
+ public boolean isShowLabel() {
+ return showLabel;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setShowLabel(boolean newShowLabel) {
+ boolean oldShowLabel = showLabel;
+ showLabel = newShowLabel;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, UiPackage.PROPERTY_EDITOR__SHOW_LABEL, oldShowLabel, showLabel));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
@@ -324,6 +366,8 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
return getUnresolvedProperty();
case UiPackage.PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS:
return getContentProviderClass();
+ case UiPackage.PROPERTY_EDITOR__SHOW_LABEL:
+ return isShowLabel();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -351,6 +395,9 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
case UiPackage.PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS:
setContentProviderClass((String)newValue);
return;
+ case UiPackage.PROPERTY_EDITOR__SHOW_LABEL:
+ setShowLabel((Boolean)newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -378,6 +425,9 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
case UiPackage.PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS:
setContentProviderClass(CONTENT_PROVIDER_CLASS_EDEFAULT);
return;
+ case UiPackage.PROPERTY_EDITOR__SHOW_LABEL:
+ setShowLabel(SHOW_LABEL_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -400,6 +450,8 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
return unresolvedProperty != null;
case UiPackage.PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS:
return CONTENT_PROVIDER_CLASS_EDEFAULT == null ? contentProviderClass != null : !CONTENT_PROVIDER_CLASS_EDEFAULT.equals(contentProviderClass);
+ case UiPackage.PROPERTY_EDITOR__SHOW_LABEL:
+ return showLabel != SHOW_LABEL_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -418,6 +470,8 @@ public class PropertyEditorImpl extends WidgetImpl implements PropertyEditor {
result.append(readOnly);
result.append(", contentProviderClass: ");
result.append(contentProviderClass);
+ result.append(", showLabel: ");
+ result.append(showLabel);
result.append(')');
return result.toString();
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiFactoryImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiFactoryImpl.java
index cdf75b4b9cf..1c8c0ce2878 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiFactoryImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiFactoryImpl.java
@@ -64,10 +64,10 @@ public class UiFactoryImpl extends EFactoryImpl implements UiFactory {
case UiPackage.STANDARD_WIDGET: return createStandardWidget();
case UiPackage.PROPERTY_EDITOR: return createPropertyEditor();
case UiPackage.COMPOSITE_WIDGET: return createCompositeWidget();
+ case UiPackage.UNKNOWN_COMPONENT: return createUnknownComponent();
case UiPackage.LAYOUT: return createLayout();
case UiPackage.VALUE_ATTRIBUTE: return createValueAttribute();
case UiPackage.REFERENCE_ATTRIBUTE: return createReferenceAttribute();
- case UiPackage.UNKNOWN_COMPONENT: return createUnknownComponent();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiPackageImpl.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiPackageImpl.java
index 6a35dcfd620..28064fbbe05 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiPackageImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/impl/UiPackageImpl.java
@@ -301,6 +301,15 @@ public class UiPackageImpl extends EPackageImpl implements UiPackage {
* <!-- end-user-doc -->
* @generated
*/
+ public EAttribute getPropertyEditor_ShowLabel() {
+ return (EAttribute)propertyEditorEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EClass getCompositeWidget() {
return compositeWidgetEClass;
}
@@ -466,12 +475,16 @@ public class UiPackageImpl extends EPackageImpl implements UiPackage {
createEReference(propertyEditorEClass, PROPERTY_EDITOR__WIDGET_TYPE);
createEReference(propertyEditorEClass, PROPERTY_EDITOR__UNRESOLVED_PROPERTY);
createEAttribute(propertyEditorEClass, PROPERTY_EDITOR__CONTENT_PROVIDER_CLASS);
+ createEAttribute(propertyEditorEClass, PROPERTY_EDITOR__SHOW_LABEL);
compositeWidgetEClass = createEClass(COMPOSITE_WIDGET);
createEReference(compositeWidgetEClass, COMPOSITE_WIDGET__LAYOUT);
createEReference(compositeWidgetEClass, COMPOSITE_WIDGET__WIDGETS);
createEReference(compositeWidgetEClass, COMPOSITE_WIDGET__WIDGET_TYPE);
+ unknownComponentEClass = createEClass(UNKNOWN_COMPONENT);
+ createEAttribute(unknownComponentEClass, UNKNOWN_COMPONENT__TYPE_NAME);
+
layoutEClass = createEClass(LAYOUT);
createEReference(layoutEClass, LAYOUT__LAYOUT_TYPE);
@@ -483,9 +496,6 @@ public class UiPackageImpl extends EPackageImpl implements UiPackage {
referenceAttributeEClass = createEClass(REFERENCE_ATTRIBUTE);
createEReference(referenceAttributeEClass, REFERENCE_ATTRIBUTE__VALUE);
-
- unknownComponentEClass = createEClass(UNKNOWN_COMPONENT);
- createEAttribute(unknownComponentEClass, UNKNOWN_COMPONENT__TYPE_NAME);
}
/**
@@ -525,11 +535,11 @@ public class UiPackageImpl extends EPackageImpl implements UiPackage {
standardWidgetEClass.getESuperTypes().add(this.getWidget());
propertyEditorEClass.getESuperTypes().add(this.getWidget());
compositeWidgetEClass.getESuperTypes().add(this.getWidget());
+ unknownComponentEClass.getESuperTypes().add(this.getWidget());
layoutEClass.getESuperTypes().add(this.getUIComponent());
widgetAttributeEClass.getESuperTypes().add(this.getElement());
valueAttributeEClass.getESuperTypes().add(this.getWidgetAttribute());
referenceAttributeEClass.getESuperTypes().add(this.getWidgetAttribute());
- unknownComponentEClass.getESuperTypes().add(this.getWidget());
// Initialize classes and features; add operations and parameters
initEClass(elementEClass, Element.class, "Element", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -548,12 +558,16 @@ public class UiPackageImpl extends EPackageImpl implements UiPackage {
initEReference(getPropertyEditor_WidgetType(), theEnvironmentPackage.getPropertyEditorType(), null, "widgetType", null, 1, 1, PropertyEditor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getPropertyEditor_UnresolvedProperty(), theContextsPackage.getUnknownProperty(), null, "unresolvedProperty", null, 0, 1, PropertyEditor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getPropertyEditor_ContentProviderClass(), ecorePackage.getEString(), "contentProviderClass", null, 0, 1, PropertyEditor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPropertyEditor_ShowLabel(), ecorePackage.getEBoolean(), "showLabel", "true", 1, 1, PropertyEditor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(compositeWidgetEClass, CompositeWidget.class, "CompositeWidget", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getCompositeWidget_Layout(), this.getLayout(), null, "layout", null, 1, 1, CompositeWidget.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getCompositeWidget_Widgets(), this.getWidget(), null, "widgets", null, 0, -1, CompositeWidget.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getCompositeWidget_WidgetType(), theEnvironmentPackage.getCompositeWidgetType(), null, "widgetType", null, 1, 1, CompositeWidget.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(unknownComponentEClass, UnknownComponent.class, "UnknownComponent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getUnknownComponent_TypeName(), ecorePackage.getEString(), "typeName", null, 1, 1, UnknownComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
initEClass(layoutEClass, Layout.class, "Layout", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getLayout_LayoutType(), theEnvironmentPackage.getLayoutType(), null, "layoutType", null, 1, 1, Layout.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@@ -566,9 +580,6 @@ public class UiPackageImpl extends EPackageImpl implements UiPackage {
initEClass(referenceAttributeEClass, ReferenceAttribute.class, "ReferenceAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getReferenceAttribute_Value(), this.getUIComponent(), null, "value", null, 1, 1, ReferenceAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEClass(unknownComponentEClass, UnknownComponent.class, "UnknownComponent", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getUnknownComponent_TypeName(), ecorePackage.getEString(), "typeName", null, 1, 1, UnknownComponent.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
// Create resource
createResource(eNS_URI);
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiAdapterFactory.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiAdapterFactory.java
index 4ecfbcaa325..7e0de13e97b 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiAdapterFactory.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiAdapterFactory.java
@@ -96,6 +96,10 @@ public class UiAdapterFactory extends AdapterFactoryImpl {
return createCompositeWidgetAdapter();
}
@Override
+ public Adapter caseUnknownComponent(UnknownComponent object) {
+ return createUnknownComponentAdapter();
+ }
+ @Override
public Adapter caseLayout(Layout object) {
return createLayoutAdapter();
}
@@ -112,10 +116,6 @@ public class UiAdapterFactory extends AdapterFactoryImpl {
return createReferenceAttributeAdapter();
}
@Override
- public Adapter caseUnknownComponent(UnknownComponent object) {
- return createUnknownComponentAdapter();
- }
- @Override
public Adapter defaultCase(EObject object) {
return createEObjectAdapter();
}
diff --git a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiSwitch.java b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiSwitch.java
index ac2ba266108..3817898f71b 100644
--- a/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiSwitch.java
+++ b/plugins/core/org.eclipse.papyrus.properties.model/src-gen/org/eclipse/papyrus/properties/ui/util/UiSwitch.java
@@ -120,6 +120,15 @@ public class UiSwitch<T> extends Switch<T> {
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case UiPackage.UNKNOWN_COMPONENT: {
+ UnknownComponent unknownComponent = (UnknownComponent)theEObject;
+ T result = caseUnknownComponent(unknownComponent);
+ if (result == null) result = caseWidget(unknownComponent);
+ if (result == null) result = caseUIComponent(unknownComponent);
+ if (result == null) result = caseElement(unknownComponent);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
case UiPackage.LAYOUT: {
Layout layout = (Layout)theEObject;
T result = caseLayout(layout);
@@ -151,15 +160,6 @@ public class UiSwitch<T> extends Switch<T> {
if (result == null) result = defaultCase(theEObject);
return result;
}
- case UiPackage.UNKNOWN_COMPONENT: {
- UnknownComponent unknownComponent = (UnknownComponent)theEObject;
- T result = caseUnknownComponent(unknownComponent);
- if (result == null) result = caseWidget(unknownComponent);
- if (result == null) result = caseUIComponent(unknownComponent);
- if (result == null) result = caseElement(unknownComponent);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
default: return defaultCase(theEObject);
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/model/Environment.xmi b/plugins/core/org.eclipse.papyrus.properties/model/Environment.xmi
index a5facaeb930..54717501441 100644
--- a/plugins/core/org.eclipse.papyrus.properties/model/Environment.xmi
+++ b/plugins/core/org.eclipse.papyrus.properties/model/Environment.xmi
@@ -4,6 +4,7 @@
<constraintTypes label="EMF Instance Of" constraintClass="org.eclipse.papyrus.properties.constraints.EMFInstanceOfConstraint"/>
<constraintTypes label="True Constraint" constraintClass="org.eclipse.papyrus.properties.constraints.TrueConstraint"/>
<constraintTypes label="EMF Query" constraintClass="org.eclipse.papyrus.properties.constraints.EMFQueryConstraint"/>
+ <constraintTypes label="Java Instance Of" constraintClass="org.eclipse.papyrus.properties.constraints.JavaInstanceOf"/>
<widgetTypes label="Label" widgetClass="Label"/>
<widgetTypes label="Text" widgetClass="Text"/>
<propertyEditorTypes label="StringEditor" widgetClass="StringEditor" namespace="//@namespaces.3"/>
@@ -24,6 +25,7 @@
<propertyEditorTypes label="MultiInteger" widgetClass="MultiInteger" namespace="//@namespaces.3" type="Integer" multiplicity="-1"/>
<propertyEditorTypes label="ViewEditor" widgetClass="ViewEditor" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
<propertyEditorTypes label="InvalidWidget" widgetClass="InvalidWidget" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="FileSelector" widgetClass="StringFileSelector" namespace="//@namespaces.3"/>
<compositeWidgetTypes label="Composite" widgetClass="Composite"/>
<compositeWidgetTypes label="Group" widgetClass="Group"/>
<layoutTypes label="GridLayout" widgetClass="GridLayout"/>
diff --git a/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/RootPackage.java b/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/RootPackage.java
index 92b06e99e5d..5148110b3af 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/RootPackage.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/RootPackage.java
@@ -35,7 +35,7 @@ public interface RootPackage extends EPackage {
*
* @generated
*/
- String eNAME = "root";
+ String eNAME = "root"; //$NON-NLS-1$
/**
* The package namespace URI.
@@ -44,7 +44,7 @@ public interface RootPackage extends EPackage {
*
* @generated
*/
- String eNS_URI = "http://www.eclipse.org/papyrus/properties/root";
+ String eNS_URI = "http://www.eclipse.org/papyrus/properties/root"; //$NON-NLS-1$
/**
* The package namespace name.
@@ -53,7 +53,7 @@ public interface RootPackage extends EPackage {
*
* @generated
*/
- String eNS_PREFIX = "root";
+ String eNS_PREFIX = "root"; //$NON-NLS-1$
/**
* The singleton instance of the package.
diff --git a/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootFactoryImpl.java b/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootFactoryImpl.java
index 6ebb5ef7688..0256b9d7430 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootFactoryImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootFactoryImpl.java
@@ -34,7 +34,7 @@ public class RootFactoryImpl extends EFactoryImpl implements RootFactory {
*/
public static RootFactory init() {
try {
- RootFactory theRootFactory = (RootFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/properties/root");
+ RootFactory theRootFactory = (RootFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/properties/root"); //$NON-NLS-1$
if(theRootFactory != null) {
return theRootFactory;
}
@@ -67,7 +67,7 @@ public class RootFactoryImpl extends EFactoryImpl implements RootFactory {
case RootPackage.PROPERTIES_ROOT:
return createPropertiesRoot();
default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootPackageImpl.java b/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootPackageImpl.java
index 9009192053f..d5c38c2c5a2 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootPackageImpl.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src-gen/org/eclipse/papyrus/properties/root/impl/RootPackageImpl.java
@@ -209,9 +209,9 @@ public class RootPackageImpl extends EPackageImpl implements RootPackage {
// Add supertypes to classes
// Initialize classes and features; add operations and parameters
- initEClass(propertiesRootEClass, PropertiesRoot.class, "PropertiesRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getPropertiesRoot_Environments(), theEnvironmentPackage.getEnvironment(), null, "environments", null, 0, -1, PropertiesRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getPropertiesRoot_Contexts(), theContextsPackage.getContext(), null, "contexts", null, 0, -1, PropertiesRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEClass(propertiesRootEClass, PropertiesRoot.class, "PropertiesRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEReference(getPropertiesRoot_Environments(), theEnvironmentPackage.getEnvironment(), null, "environments", null, 0, -1, PropertiesRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
+ initEReference(getPropertiesRoot_Contexts(), theContextsPackage.getContext(), null, "contexts", null, 0, -1, PropertiesRoot.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
// Create resource
createResource(eNS_URI);
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/Activator.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/Activator.java
index ae4c5100334..849a4ea2e30 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/Activator.java
@@ -107,7 +107,7 @@ public class Activator extends AbstractUIPlugin {
*/
public Image getImage(String pluginId, String path) {
final ImageRegistry registry = getImageRegistry();
- String key = pluginId + "/" + path;
+ String key = pluginId + "/" + path; //$NON-NLS-1$
Image image = registry.get(key);
if(image == null) {
registry.put(key, AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, path));
@@ -125,11 +125,11 @@ public class Activator extends AbstractUIPlugin {
* The Image at the given location, or null if none was found
*/
public Image getImageFromPlugin(String imagePath) {
- if(imagePath.startsWith("/")) {
+ if(imagePath.startsWith("/")) { //$NON-NLS-1$
String pluginId, path;
imagePath = imagePath.substring(1, imagePath.length());
- pluginId = imagePath.substring(0, imagePath.indexOf("/"));
- path = imagePath.substring(imagePath.indexOf("/"), imagePath.length());
+ pluginId = imagePath.substring(0, imagePath.indexOf("/")); //$NON-NLS-1$
+ path = imagePath.substring(imagePath.indexOf("/"), imagePath.length()); //$NON-NLS-1$
return getImage(pluginId, path);
} else {
return getImage(imagePath);
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/AbstractConstraint.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/AbstractConstraint.java
index 5e8188fade9..e0742b4afa7 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/AbstractConstraint.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/AbstractConstraint.java
@@ -62,9 +62,6 @@ public abstract class AbstractConstraint implements Constraint {
}
}
- if(descriptor.getOverriddenConstraints().contains(constraint.getDescriptor()))
- return true;
-
return false;
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/JavaInstanceOf.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/JavaInstanceOf.java
new file mode 100644
index 00000000000..6c2e6c0f88b
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/constraints/JavaInstanceOf.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * 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.properties.constraints;
+
+import org.eclipse.papyrus.properties.contexts.ConfigProperty;
+import org.eclipse.papyrus.properties.contexts.ConstraintDescriptor;
+import org.eclipse.papyrus.properties.contexts.ValueProperty;
+import org.eclipse.papyrus.properties.util.ClassLoader;
+
+public class JavaInstanceOf extends AbstractConstraint {
+
+ private Class<?> clazz;
+
+ @Override
+ public void setConstraintDescriptor(ConstraintDescriptor descriptor) {
+ super.setConstraintDescriptor(descriptor);
+ ClassLoader loader = new ClassLoader();
+ for(ConfigProperty property : descriptor.getProperties()) {
+ if(property.getName().equals("class") && property instanceof ValueProperty) { //$NON-NLS-1$
+ clazz = loader.loadClass(((ValueProperty)property).getValue());
+ }
+ }
+ }
+
+ public boolean match(Object selection) {
+ if(clazz == null) {
+ return false;
+ }
+
+ return clazz.isInstance(selection);
+ }
+
+ @Override
+ protected boolean equivalent(Constraint constraint) {
+ return false; //TODO
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EcorePropertyEditorFactory.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EcorePropertyEditorFactory.java
index d49dda52b21..755aebb477a 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EcorePropertyEditorFactory.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EcorePropertyEditorFactory.java
@@ -12,10 +12,23 @@
package org.eclipse.papyrus.properties.creation;
import java.util.Collection;
+import java.util.List;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.papyrus.properties.Activator;
+import org.eclipse.papyrus.properties.messages.Messages;
+import org.eclipse.papyrus.properties.util.EMFHelper;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.MenuListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
/**
@@ -29,12 +42,20 @@ import org.eclipse.papyrus.properties.Activator;
*/
public class EcorePropertyEditorFactory extends PropertyEditorFactory {
+ private EClass type;
+
private EClass eClass;
private String nsUri;
private String className;
+ private boolean menuVisible = false;
+
+ public EcorePropertyEditorFactory(EClass type) {
+ this.type = type;
+ }
+
/**
*
* Constructor.
@@ -44,18 +65,19 @@ public class EcorePropertyEditorFactory extends PropertyEditorFactory {
}
- /**
+ /*
* Creates a new EcorePropertyEditorFactory. The given EClass is used to instantiate
* a new EObject when the {@link #createObject} method is called.
* Constructor.
*
* @param eClass
+ *
+ * public EcorePropertyEditorFactory(EClass eClass) {
+ * this.eClass = eClass;
+ * this.nsUri = eClass.getEPackage().getNsURI();
+ * this.className = eClass.getName();
+ * }
*/
- public EcorePropertyEditorFactory(EClass eClass) {
- this.eClass = eClass;
- this.nsUri = eClass.getEPackage().getNsURI();
- this.className = eClass.getName();
- }
/**
* @return the nsUri of the EClass used by this factory to instantiate new EObjects
@@ -114,8 +136,76 @@ public class EcorePropertyEditorFactory extends PropertyEditorFactory {
}
@Override
- public Object createObject() {
- return eClass.getEPackage().getEFactoryInstance().create(eClass);
+ public Object createObject(Control widget) {
+ EClass eClass = chooseEClass(widget);
+ if(eClass == null) {
+ return null;
+ }
+
+ EObject instance = eClass.getEPackage().getEFactoryInstance().create(eClass);
+ return super.createObject(widget, instance);
+ }
+
+ private EClass chooseEClass(Control widget) {
+ if(eClass != null) {
+ return eClass;
+ }
+
+ List<EClass> availableClasses = EMFHelper.getSubclassesOf(type, true);
+
+ System.out.println(availableClasses);
+
+ final Menu menu = new Menu(widget);
+ for(EClass eClass : availableClasses) {
+ final MenuItem item = new MenuItem(menu, SWT.NONE);
+ item.setText(eClass.getName());
+ item.setData("eClass", eClass); //$NON-NLS-1$
+ item.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ EcorePropertyEditorFactory.this.eClass = (EClass)item.getData("eClass"); //$NON-NLS-1$
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Nothing
+ }
+
+ });
+ }
+
+ menu.addMenuListener(new MenuListener() {
+
+ public void menuHidden(MenuEvent e) {
+ menuVisible = false;
+ }
+
+ public void menuShown(MenuEvent e) {
+ //Nothing
+ }
+
+ });
+
+ menu.setVisible(true);
+ menuVisible = true;
+
+ //The menu is blocking the thread
+ Display display = widget.getDisplay();
+ while(menu.isVisible()) {
+ try {
+ if(!display.readAndDispatch()) {
+ display.sleep();
+ }
+ } catch (Throwable ex) {
+ Activator.log.error(ex);
+ }
+ }
+ if(!display.isDisposed())
+ display.update();
+
+ EClass eClass = this.eClass;
+ this.eClass = null;
+
+ return eClass;
}
@Override
@@ -125,6 +215,6 @@ public class EcorePropertyEditorFactory extends PropertyEditorFactory {
@Override
public String getCreationDialogTitle() {
- return "Create a new " + className;
+ return Messages.EcorePropertyEditorFactory_CreateANew + className;
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EditionDialog.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EditionDialog.java
index 70e6be32a95..4ec2e3d03c4 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EditionDialog.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/EditionDialog.java
@@ -20,6 +20,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.properties.Activator;
import org.eclipse.papyrus.properties.contexts.Section;
import org.eclipse.papyrus.properties.contexts.View;
+import org.eclipse.papyrus.properties.messages.Messages;
import org.eclipse.papyrus.properties.runtime.DefaultDisplayEngine;
import org.eclipse.papyrus.properties.runtime.DisplayEngine;
import org.eclipse.papyrus.properties.xwt.XWTSection;
@@ -59,9 +60,9 @@ public class EditionDialog extends SelectionDialog {
@Override
public void create() {
- setTitle("Create a new Element");
+ setTitle(Messages.EditionDialog_CreateANewElement);
super.create();
- getShell().setImage(Activator.getDefault().getImage("org.eclipse.papyrus.widgets", "/icons/papyrus.png")); //$NON-NLS-1$
+ getShell().setImage(Activator.getDefault().getImage("org.eclipse.papyrus.widgets", "/icons/papyrus.png")); //$NON-NLS-1$ //$NON-NLS-2$
getShell().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -109,11 +110,6 @@ public class EditionDialog extends SelectionDialog {
getShell().setSize(600, 400);
for(View view : views) {
-
- // if(getShell().getText() == null || getShell().getText().equals("")) {
- // getShell().setText(view.getName());
- // }
-
for(Section section : view.getSections()) {
XWTSection xwtSection = new XWTSection(section, view, display);
sections.add(xwtSection);
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/PropertyEditorFactory.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/PropertyEditorFactory.java
index d89730ffc14..a583aeee874 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/PropertyEditorFactory.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/creation/PropertyEditorFactory.java
@@ -18,6 +18,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.properties.contexts.View;
+import org.eclipse.papyrus.properties.messages.Messages;
import org.eclipse.papyrus.properties.runtime.ConfigurationManager;
import org.eclipse.papyrus.properties.runtime.ConstraintEngine;
import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
@@ -46,10 +47,25 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
}
/**
- * {@inheritDoc}
+ * Return a null value. Implementors should override when object creation
+ * needs to be supported. Implementors may rely on {@link #createObject(Control, Object)}
+ *
+ * @see org.eclipse.papyrus.widgets.creation.ReferenceValueFactory#createObject(org.eclipse.swt.widgets.Control)
+ * @see #createObject(org.eclipse.swt.widgets.Control, Object)
+ *
+ * @param widget
+ * The widget from which this method is called. May be used to retrieve the current shell
+ * @return
+ * The newly created object
*/
public Object createObject(Control widget) {
- Object source = createObject();
+ return null;
+ }
+
+ /**
+ * Facility
+ */
+ protected Object createObject(Control widget, Object source) {
if(source == null)
return null;
@@ -97,7 +113,7 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
* @param source
* The object to edit
*/
- public void edit(Control widget, Object source) {
+ public Object edit(Control widget, Object source) {
IStructuredSelection selection = new StructuredSelection(source);
ConstraintEngine constraintEngine = ConfigurationManager.instance.constraintEngine;
@@ -110,24 +126,14 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
dialog.open();
}
- }
- /**
- * Creates a new empty instance. The instance will then be edited through
- * the matching property view, if any.
- * Subclasses should override this method if canCreateObject returns true
- *
- * @return
- * The newly created object
- */
- protected Object createObject() {
- return null;
+ return source;
}
/**
* The standard Property Editor Factory cannot instantiate new objects.
* However, subclasses may override this method to return true if they
- * implement {@link #createObject()}
+ * implement {@link #createObject(Control)}
*
* @see org.eclipse.papyrus.widgets.creation.ReferenceValueFactory#canCreateObject()
*
@@ -146,6 +152,6 @@ public class PropertyEditorFactory implements ReferenceValueFactory {
* @see #createObject()
*/
public String getCreationDialogTitle() {
- return "Create a new element";
+ return Messages.PropertyEditorFactory_CreateANewElement;
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/EMFObservableList.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/EMFObservableList.java
index b5ee83788e8..e9af039ee91 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/EMFObservableList.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/EMFObservableList.java
@@ -15,7 +15,6 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
-import org.eclipse.core.databinding.observable.list.ListDiff;
import org.eclipse.core.databinding.observable.list.ObservableList;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
@@ -40,7 +39,7 @@ import org.eclipse.papyrus.widgets.editors.ICommitListener;
public class EMFObservableList extends ObservableList implements ICommitListener {
/**
- * The list of commands that haven't been executed
+ * The list of commands that haven't been executed yet
*/
protected List<Command> commands = new LinkedList<Command>();
@@ -94,6 +93,10 @@ public class EMFObservableList extends ObservableList implements ICommitListener
*/
public void commit(AbstractEditor editor) {
+ if(commands.isEmpty()) {
+ return;
+ }
+
CompoundCommand compoundCommand = new CompoundCommand() {
@Override
@@ -142,11 +145,6 @@ public class EMFObservableList extends ObservableList implements ICommitListener
commands.clear();
}
- @Override
- protected void fireListChange(ListDiff diff) {
- super.fireListChange(diff);
- }
-
/**
* Refresh the cached list by copying the real list
*/
@@ -158,7 +156,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public void add(int index, Object value) {
- Command command = AddCommand.create(editingDomain, source, feature, value, index);
+ Command command = getAddCommand(index, value);
commands.add(command);
wrappedList.add(index, value);
@@ -167,7 +165,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public void clear() {
- Command command = RemoveCommand.create(editingDomain, source, feature, new LinkedList<Object>(wrappedList));
+ Command command = getClearCommand();
commands.add(command);
wrappedList.clear();
@@ -176,7 +174,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public boolean add(Object o) {
- Command command = AddCommand.create(editingDomain, source, feature, o);
+ Command command = getAddCommand(o);
commands.add(command);
boolean result = wrappedList.add(o);
@@ -186,7 +184,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public boolean remove(Object o) {
- Command command = RemoveCommand.create(editingDomain, source, feature, o);
+ Command command = getRemoveCommand(o);
commands.add(command);
@@ -197,7 +195,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public boolean addAll(Collection c) {
- Command command = AddCommand.create(editingDomain, source, feature, c);
+ Command command = getAddAllCommand(c);
commands.add(command);
boolean result = wrappedList.addAll(c);
@@ -207,7 +205,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public boolean addAll(int index, Collection c) {
- Command command = AddCommand.create(editingDomain, source, feature, c, index);
+ Command command = getAddAllCommand(index, c);
commands.add(command);
boolean result = wrappedList.addAll(index, c);
@@ -217,7 +215,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public boolean removeAll(Collection c) {
- Command command = RemoveCommand.create(editingDomain, source, feature, c);
+ Command command = getRemoveCommand(c);
commands.add(command);
boolean result = wrappedList.removeAll(c);
@@ -227,17 +225,8 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public boolean retainAll(Collection c) {
- List<Object> objectsToRemove = new LinkedList<Object>();
- for(Object object : c) {
- if(!contains(object)) {
- objectsToRemove.add(object);
- }
- }
- if(!objectsToRemove.isEmpty()) {
- Command command = RemoveCommand.create(editingDomain, source, feature, objectsToRemove);
- commands.add(command);
-
- }
+ Command command = getRetainAllCommand(c);
+ commands.add(command);
boolean result = wrappedList.retainAll(c);
fireListChange(null);
@@ -246,7 +235,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public Object set(int index, Object element) {
- Command command = SetCommand.create(editingDomain, source, feature, element, index);
+ Command command = getSetCommand(index, element);
commands.add(command);
Object result = wrappedList.set(index, element);
@@ -256,18 +245,13 @@ public class EMFObservableList extends ObservableList implements ICommitListener
@Override
public Object move(int oldIndex, int newIndex) {
- Object value = get(oldIndex);
- if(value != null) {
- Command remove = RemoveCommand.create(editingDomain, source, feature, value);
- Command add = AddCommand.create(editingDomain, source, feature, value, newIndex);
- commands.add(remove);
- commands.add(add);
+ commands.addAll(getMoveCommands(oldIndex, newIndex));
- wrappedList.remove(oldIndex);
- wrappedList.add(newIndex, value);
+ Object value = get(oldIndex);
+ wrappedList.remove(oldIndex);
+ wrappedList.add(newIndex, value);
- fireListChange(null);
- }
+ fireListChange(null);
return value;
}
@@ -276,7 +260,7 @@ public class EMFObservableList extends ObservableList implements ICommitListener
public Object remove(int index) {
Object value = get(index);
if(value != null) {
- Command command = RemoveCommand.create(editingDomain, source, feature, value);
+ Command command = getRemoveCommand(index);
commands.add(command);
}
@@ -285,4 +269,63 @@ public class EMFObservableList extends ObservableList implements ICommitListener
return result;
}
+ protected Command getAddCommand(int index, Object value) {
+ return AddCommand.create(editingDomain, source, feature, value, index);
+ }
+
+ protected Command getAddCommand(Object value) {
+ return AddCommand.create(editingDomain, source, feature, value);
+ }
+
+ protected Command getAddAllCommand(Collection<?> values) {
+ return AddCommand.create(editingDomain, source, feature, values);
+ }
+
+ protected Command getAddAllCommand(int index, Collection<?> values) {
+ return AddCommand.create(editingDomain, source, feature, values, index);
+ }
+
+ protected Command getClearCommand() {
+ return getRemoveAllCommand(new LinkedList<Object>(wrappedList));
+ }
+
+ protected Command getRemoveCommand(int index) {
+ Object value = get(index);
+ return getRemoveCommand(value);
+ }
+
+ protected Command getRemoveCommand(Object value) {
+ return RemoveCommand.create(editingDomain, source, feature, value);
+ }
+
+ protected Command getRemoveAllCommand(Collection<?> values) {
+ return RemoveCommand.create(editingDomain, source, feature, values);
+ }
+
+ protected List<Command> getMoveCommands(int oldIndex, int newIndex) {
+ Object value = get(oldIndex);
+ List<Command> commands = new LinkedList<Command>();
+ commands.add(getRemoveCommand(value));
+ commands.add(getAddCommand(newIndex, value));
+ return commands;
+ }
+
+ protected Command getRetainAllCommand(Collection<?> values) {
+ List<Object> objectsToRemove = new LinkedList<Object>();
+ for(Object object : values) {
+ if(!contains(object)) {
+ objectsToRemove.add(object);
+ }
+ }
+ if(!objectsToRemove.isEmpty()) {
+ return getRemoveAllCommand(objectsToRemove);
+ } else {
+ return null;
+ }
+ }
+
+ protected Command getSetCommand(int index, Object value) {
+ return SetCommand.create(editingDomain, source, feature, value, index);
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservable.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservable.java
new file mode 100644
index 00000000000..e045dc677f9
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservable.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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.properties.databinding;
+
+import org.eclipse.core.databinding.observable.IObservable;
+
+/**
+ * An interface for Composite IObservables
+ *
+ * @author Camille Letavernier
+ */
+public interface MultipleObservable extends IObservable {
+
+ /**
+ * Adds an IObservable to this composite Observable
+ *
+ * @param observable
+ * The IObservable to add
+ * @return
+ * true if the observable has been successfully added, false otherwise
+ */
+ public boolean add(IObservable observable);
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableList.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableList.java
new file mode 100644
index 00000000000..70b41640c93
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableList.java
@@ -0,0 +1,172 @@
+/*****************************************************************************
+ * 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.properties.databinding;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.list.ObservableList;
+import org.eclipse.papyrus.widgets.editors.AbstractEditor;
+import org.eclipse.papyrus.widgets.editors.ICommitListener;
+
+//TODO : Implement the getters
+//The list may be either the union or the intersection of all sublists
+//Union : allows the "remove" and "removeAll" on a group of lists (Even if one of the sublists doesn't contain the given element)
+//Intersection : Closer to the behavior of the CompositeValue (The current value is displayed only if it is shared by all elements)
+//The Union is probably a better solution
+//Simple solution : bind read operations to the first sub-list
+
+/**
+ * A Composite ObservableList. Modifications are forwarded to each sublist
+ * The read operations are not supported. This list behaves as if it were empty
+ *
+ * @author Camille Letavernier
+ */
+public class MultipleObservableList extends ObservableList implements ICommitListener, MultipleObservable {
+
+ List<IObservableList> observableLists = new LinkedList<IObservableList>();
+
+ public MultipleObservableList() {
+ super(new LinkedList<Object>(), Object.class);
+ }
+
+ @Override
+ public void add(int index, Object element) {
+ for(IObservableList observableList : observableLists) {
+ observableList.add(index, element);
+ }
+ }
+
+ @Override
+ public void clear() {
+ for(IObservableList observableList : observableLists) {
+ observableList.clear();
+ }
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ boolean contains = false;
+
+ for(IObservableList observableList : observableLists) {
+ if(observableList.contains(o)) {
+ contains = true;
+ } else {
+ return false;
+ }
+ }
+
+ return contains;
+ }
+
+ @Override
+ public boolean add(Object o) {
+ for(IObservableList observableList : observableLists) {
+ observableList.add(o);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ for(IObservableList observableList : observableLists) {
+ observableList.remove(o);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean containsAll(Collection c) {
+ boolean containsAll = false;
+ for(IObservableList observableList : observableLists) {
+ containsAll = containsAll && observableList.containsAll(c);
+ }
+ return containsAll;
+ }
+
+ @Override
+ public boolean addAll(Collection c) {
+ for(IObservableList observableList : observableLists) {
+ observableList.addAll(c);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection c) {
+ for(IObservableList observableList : observableLists) {
+ observableList.addAll(index, c);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean removeAll(Collection c) {
+ for(IObservableList observableList : observableLists) {
+ observableList.removeAll(c);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean retainAll(Collection c) {
+ for(IObservableList observableList : observableLists) {
+ observableList.retainAll(c);
+ }
+ return true;
+ }
+
+ @Override
+ public Object set(int index, Object element) {
+ for(IObservableList observableList : observableLists) {
+ observableList.set(index, element);
+ }
+ return null;
+ }
+
+ @Override
+ public Object move(int oldIndex, int newIndex) {
+ for(IObservableList observableList : observableLists) {
+ observableList.move(oldIndex, newIndex);
+ }
+ return null;
+ }
+
+ @Override
+ public Object remove(int index) {
+ for(IObservableList observableList : observableLists) {
+ observableList.remove(index);
+ }
+ return null;
+ }
+
+ public void commit(AbstractEditor editor) {
+ for(IObservableList observableList : observableLists) {
+ if(observableList instanceof ICommitListener) {
+ ((ICommitListener)observableList).commit(editor);
+ }
+ }
+ }
+
+ public boolean add(IObservable observable) {
+ if(observable instanceof IObservableList) {
+ observableLists.add((IObservableList)observable);
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableValue.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableValue.java
index 5638aaf9cd2..0f8b56062ef 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableValue.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/MultipleObservableValue.java
@@ -15,6 +15,7 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.core.databinding.observable.value.IObservableValue;
@@ -27,18 +28,7 @@ import org.eclipse.core.databinding.observable.value.IObservableValue;
*
* All sub-elements will be edited at the same time, with the same value.
*/
-public class MultipleObservableValue extends AbstractObservableValue {
-
- /**
- *
- * Constructs an instance of MultipleObservableValue with a single sub-element
- *
- * @param observable
- *
- */
- public MultipleObservableValue(IObservableValue observable) {
- observableValues.add(observable);
- }
+public class MultipleObservableValue extends AbstractObservableValue implements MultipleObservable {
/**
*
@@ -135,14 +125,12 @@ public class MultipleObservableValue extends AbstractObservableValue {
}
}
- /**
- * Adds an observableValue to the list of sub-elements
- *
- * @param observableValue
- * The observableValue to add
- */
- public void addObservable(IObservableValue observableValue) {
- observableValues.add(observableValue);
+ public boolean add(IObservable observable) {
+ if(observable instanceof MultipleObservableValue) {
+ observableValues.add((IObservableValue)observable);
+ return true;
+ }
+ return false;
}
private List<IObservableValue> observableValues = new LinkedList<IObservableValue>();
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableList.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableList.java
deleted file mode 100644
index 08a5c7fafa0..00000000000
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableList.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*****************************************************************************
- * 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
- * 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.properties.databinding;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.databinding.observable.Realm;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.databinding.EObjectObservableList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.diagram.common.command.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.properties.Activator;
-import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.service.edit.service.IElementEditService;
-
-/**
- * An ObservableList used to edit collections of EObjects through
- * Papyrus commands
- *
- * @author Camille Letavernier
- *
- */
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class PapyrusObservableList extends EObjectObservableList {
-
- private EditingDomain domain;
-
- /**
- * Constructor.
- *
- * @param eObject
- * The EObject to edit
- * @param eStructuralFeature
- * The structural feature to edit
- * @param domain
- * The editing domain on which the commands will be executed
- */
- public PapyrusObservableList(EObject eObject, EStructuralFeature eStructuralFeature, EditingDomain domain) {
- super(eObject, eStructuralFeature);
- this.domain = domain;
- }
-
- /**
- *
- * Constructor.
- *
- * @param realm
- * @param eObject
- * The EObject to edit
- * @param eStructuralFeature
- * The structural feature to edit
- * @param domain
- * The editing domain on which the commands will be executed
- */
- public PapyrusObservableList(Realm realm, EObject eObject, EStructuralFeature eStructuralFeature, EditingDomain domain) {
- super(realm, eObject, eStructuralFeature);
- this.domain = domain;
- }
-
- @Override
- public void add(int index, Object value) {
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- values.add(index, value);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
-
- @Override
- public void clear() {
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- SetRequest request = new SetRequest(eObject, eStructuralFeature, Collections.EMPTY_LIST);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
-
- @Override
- public boolean add(Object o) {
- boolean result = false;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.add(o);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public boolean remove(Object o) {
- boolean result = false;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.remove(o);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public boolean addAll(Collection c) {
- boolean result = false;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.addAll(c);
-
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public boolean addAll(int index, Collection c) {
- boolean result = false;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.addAll(index, c);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public boolean removeAll(Collection c) {
- boolean result = false;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.removeAll(c);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public boolean retainAll(Collection c) {
- List<Object> objectsToRemove = new LinkedList<Object>();
- for(Object object : c) {
- if(!contains(object)) {
- objectsToRemove.add(object);
- }
- }
-
- boolean result = false;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.removeAll(objectsToRemove);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public Object set(int index, Object element) {
- Object result = null;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.set(index, element);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public Object move(int oldIndex, int newIndex) {
- Object result = null;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.remove(oldIndex);
- values.add(newIndex, result);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-
- @Override
- public Object remove(int index) {
- Object result = null;
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- List<Object> values = new LinkedList<Object>(this);
- result = values.remove(index);
- SetRequest request = new SetRequest(eObject, eStructuralFeature, values);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- return result;
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableValue.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableValue.java
deleted file mode 100644
index 3f2277de714..00000000000
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/databinding/PapyrusObservableValue.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * 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
- * 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.properties.databinding;
-
-import org.eclipse.core.databinding.observable.Realm;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.databinding.EObjectObservableValue;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.diagram.common.command.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.properties.Activator;
-import org.eclipse.papyrus.service.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.service.edit.service.IElementEditService;
-
-/**
- * An ObservableValue used to edit EObject properties through
- * Papyrus commands
- *
- * @author Camille Letavernier
- *
- */
-public class PapyrusObservableValue extends EObjectObservableValue {
-
- private EditingDomain domain;
-
- /**
- *
- * Constructor.
- *
- * @param eObject
- * The EObject to edit
- * @param eStructuralFeature
- * The structural feature to edit
- * @param domain
- * The editing domain on which the commands will be executed
- */
- public PapyrusObservableValue(EObject eObject, EStructuralFeature eStructuralFeature, EditingDomain domain) {
- this(Realm.getDefault(), eObject, eStructuralFeature, domain);
- }
-
- /**
- *
- * Constructor.
- *
- * @param realm
- * @param eObject
- * The EObject to edit
- * @param eStructuralFeature
- * The structural feature to edit
- * @param domain
- * The editing domain on which the commands will be executed
- */
- public PapyrusObservableValue(Realm realm, EObject eObject, EStructuralFeature eStructuralFeature, EditingDomain domain) {
- super(realm, eObject, eStructuralFeature);
- this.domain = domain;
- }
-
- @Override
- protected void doSetValue(Object value) {
- try {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved());
- if(provider != null) {
- SetRequest request = new SetRequest(eObject, eStructuralFeature, value);
- ICommand createGMFCommand = provider.getEditCommand(request);
-
- Command emfCommand = new GMFtoEMFCommandWrapper(createGMFCommand);
-
- domain.getCommandStack().execute(emfCommand);
- }
- } catch (Exception ex) {
- Activator.log.error(ex);
- }
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/Messages.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/Messages.java
index cd0991a1898..e2156f041e6 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/Messages.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/Messages.java
@@ -17,11 +17,17 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.properties.messages.messages"; //$NON-NLS-1$
+ public static String EcorePropertyEditorFactory_CreateANew;
+
+ public static String EditionDialog_CreateANewElement;
+
public static String Preferences_Contexts;
public static String Preferences_Custom;
public static String Preferences_Plugin;
+
+ public static String PropertyEditorFactory_CreateANewElement;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/messages.properties b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/messages.properties
index 31132838baf..2cbbfb20f7e 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/messages.properties
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/messages/messages.properties
@@ -1,3 +1,6 @@
+EcorePropertyEditorFactory_CreateANew=Create a new
+EditionDialog_CreateANewElement=Create a new Element
Preferences_Contexts=Contexts :
Preferences_Custom=custom
Preferences_Plugin=plugin
+PropertyEditorFactory_CreateANewElement=Create a new element
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/AbstractModelElement.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/AbstractModelElement.java
index 42460c5598f..9c128b088af 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/AbstractModelElement.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/AbstractModelElement.java
@@ -13,7 +13,9 @@ package org.eclipse.papyrus.properties.modelelement;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.properties.contexts.Property;
+import org.eclipse.papyrus.properties.creation.PropertyEditorFactory;
import org.eclipse.papyrus.properties.runtime.ConfigurationManager;
+import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
@@ -63,4 +65,15 @@ public abstract class AbstractModelElement implements ModelElement {
return ConfigurationManager.instance.getProperty(propertyPath, dataSource.getView().getContext());
}
+ /**
+ * @see org.eclipse.papyrus.properties.modelelement.ModelElement#getValueFactory(java.lang.String)
+ *
+ * @param propertyPath
+ * @return a default factory based on the property view configuration to
+ * edit objects, as if they were selected in an editor
+ */
+ public ReferenceValueFactory getValueFactory(String propertyPath) {
+ return new PropertyEditorFactory();
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/CompositeModelElement.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/CompositeModelElement.java
index 5a9bebbf5a8..d889468bdde 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/CompositeModelElement.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/CompositeModelElement.java
@@ -14,8 +14,10 @@ package org.eclipse.papyrus.properties.modelelement;
import java.util.LinkedList;
import java.util.List;
+import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.properties.databinding.MultipleObservable;
import org.eclipse.papyrus.properties.databinding.MultipleObservableValue;
import org.eclipse.papyrus.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
@@ -32,12 +34,30 @@ import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
*/
public class CompositeModelElement extends AbstractModelElement {
- public IObservableValue getObservable(String propertyPath) {
- MultipleObservableValue observableValue = new MultipleObservableValue();
+ public IObservable getObservable(String propertyPath) {
+
+ MultipleObservable observableComposite = null;
+
for(ModelElement element : elements) {
- observableValue.addObservable((IObservableValue)element.getObservable(propertyPath));
+ IObservable observable = element.getObservable(propertyPath);
+
+ if(observableComposite == null) {
+ if(observable instanceof IObservableValue) {
+ observableComposite = new MultipleObservableValue();
+ } else {
+ return null; //The support for CompositeObservableList is too complicated.
+ //There are too many non-trivial choices (Union or Intersection display,
+ //unadapted behavior of MultipleValueEditors, ...)
+ //observableComposite = new MultipleObservableList();
+ }
+ }
+
+ if(!observableComposite.add(observable)) {
+ return null;
+ }
}
- return observableValue;
+
+ return observableComposite;
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/DataSource.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/DataSource.java
index 327d4cbedec..34b75fc4347 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/DataSource.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/DataSource.java
@@ -25,6 +25,7 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.properties.Activator;
import org.eclipse.papyrus.properties.contexts.View;
+import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
@@ -72,7 +73,7 @@ public class DataSource implements IChangeListener {
this.selection = selection;
}
- private ModelElement getModelElement(String propertyPath) {
+ public ModelElement getModelElement(String propertyPath) {
//ConfigurationManager.instance.getProperty(propertyPath)
String key = propertyPath.substring(0, propertyPath.lastIndexOf(":")); //$NON-NLS-1$
ModelElement element = elements.get(key);
@@ -253,4 +254,11 @@ public class DataSource implements IChangeListener {
return false;
return element.forceRefresh(getLocalPropertyPath(propertyPath));
}
+
+ public ReferenceValueFactory getValueFactory(String propertyPath) {
+ ModelElement element = getModelElement(propertyPath);
+ if(element == null)
+ return null;
+ return element.getValueFactory(getLocalPropertyPath(propertyPath));
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/EMFModelElement.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/EMFModelElement.java
index df7da8b9916..4ddfcd09dfd 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/EMFModelElement.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/EMFModelElement.java
@@ -25,11 +25,13 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.papyrus.properties.Activator;
+import org.eclipse.papyrus.properties.creation.EcorePropertyEditorFactory;
import org.eclipse.papyrus.properties.databinding.EMFObservableList;
import org.eclipse.papyrus.properties.databinding.EMFObservableValue;
import org.eclipse.papyrus.properties.providers.EMFObjectLabelProvider;
import org.eclipse.papyrus.properties.providers.EcoreEnumeratorContentProvider;
import org.eclipse.papyrus.properties.providers.EcoreReferenceContentProvider;
+import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
@@ -238,4 +240,19 @@ public class EMFModelElement extends AbstractModelElement {
return false;
return feature.isDerived();
}
+
+ @Override
+ public ReferenceValueFactory getValueFactory(String propertyPath) {
+ EStructuralFeature feature = getFeature(propertyPath);
+ if(feature != null) {
+ if(feature instanceof EReference) {
+ EReference reference = (EReference)feature;
+ if(reference.isContainment()) {
+ return new EcorePropertyEditorFactory(reference.getEReferenceType());
+ }
+ }
+ }
+
+ return super.getValueFactory(propertyPath);
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/ModelElement.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/ModelElement.java
index 5a45c5cf9c4..cfb6234eb00 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/ModelElement.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/modelelement/ModelElement.java
@@ -13,6 +13,7 @@ package org.eclipse.papyrus.properties.modelelement;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
@@ -103,7 +104,21 @@ public interface ModelElement {
* @param localPropertyPath
* @return
*/
- public boolean forceRefresh(String localPropertyPath);
+ public boolean forceRefresh(String propertyPath);
+ /**
+ * Sets the DataSource associated to this model element
+ *
+ * @param source
+ * The DataSource to associate to this model element
+ */
public void setDataSource(DataSource source);
+
+ /**
+ * @return the default factory used to handle operations such as object
+ * creation or edition, or null if these operations are not supported.
+ * This factory will typically be used by Multiple value editors, to
+ * create or edit a single entry.
+ */
+ public ReferenceValueFactory getValueFactory(String propertyPath);
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/preferences/Preferences.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/preferences/Preferences.java
index d4aa7febed4..4ba54b910bc 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/preferences/Preferences.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/preferences/Preferences.java
@@ -105,7 +105,7 @@ public class Preferences extends PreferencePage implements IWorkbenchPreferenceP
}
private String getLabel(Context context) {
- return context.getName() + " (" + (ConfigurationManager.instance.isPlugin(context) ? Messages.Preferences_Plugin : Messages.Preferences_Custom) + ")"; //$NON-NLS-1$ //$NON-NLS-4$
+ return context.getName() + " (" + (ConfigurationManager.instance.isPlugin(context) ? Messages.Preferences_Plugin : Messages.Preferences_Custom) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-4$
}
private final ContextState contextState = new ContextState();
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/ConfigurationManager.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/ConfigurationManager.java
index 1fccebbf64a..5c38237789d 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/ConfigurationManager.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/ConfigurationManager.java
@@ -566,8 +566,8 @@ public class ConfigurationManager {
}
public Property getProperty(String propertyPath, Context context) {
- String elementName = propertyPath.substring(0, propertyPath.lastIndexOf(":"));
- String propertyName = propertyPath.substring(propertyPath.lastIndexOf(":") + 1, propertyPath.length());
+ String elementName = propertyPath.substring(0, propertyPath.lastIndexOf(":")); //$NON-NLS-1$
+ String propertyName = propertyPath.substring(propertyPath.lastIndexOf(":") + 1, propertyPath.length()); //$NON-NLS-1$
Set<DataContextElement> elements = new HashSet<DataContextElement>();
Collection<Context> allContexts;
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultConstraintEngine.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultConstraintEngine.java
index 74290988069..754d62b9f5f 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultConstraintEngine.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultConstraintEngine.java
@@ -55,7 +55,7 @@ public class DefaultConstraintEngine implements ConstraintEngine {
constraint.setConstraintDescriptor(descriptor);
constraints.add(constraint);
} catch (Exception ex) {
- Activator.log.error(ex);
+ Activator.log.error("Cannot load constraint " + descriptor.getName(), ex); //$NON-NLS-1$
}
}
}
@@ -103,9 +103,9 @@ public class DefaultConstraintEngine implements ConstraintEngine {
}
}
- //Activator.log.debug("Filtered Constraints : " + matchedConstraints); //$NON-NLS-1$
+ Activator.log.warn("Filtered Constraints : " + matchedConstraints); //$NON-NLS-1$
resolveConstraintConflicts(matchedConstraints);
- Activator.log.debug("Filtered Constraints : " + matchedConstraints); //$NON-NLS-1$
+ Activator.log.warn("Filtered Constraints : " + matchedConstraints); //$NON-NLS-1$
return matchedConstraints;
}
@@ -117,8 +117,14 @@ public class DefaultConstraintEngine implements ConstraintEngine {
if(c == c2)
continue;
- if(c.overrides(c2)) {
+ if(c.getDescriptor().getOverriddenConstraints().contains(c2.getDescriptor())) {
matchedConstraints.remove(c2);
+ continue;
+ }
+
+ if(c2.getDescriptor().isOverrideable() && c.overrides(c2)) {
+ matchedConstraints.remove(c2);
+ continue;
}
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultDisplayEngine.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultDisplayEngine.java
index cb90073821b..a2d1227823c 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultDisplayEngine.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/DefaultDisplayEngine.java
@@ -183,7 +183,7 @@ public class DefaultDisplayEngine implements DisplayEngine {
Context context = (Context)tab.eContainer();
if(context.eResource() == null) {
context = ConfigurationManager.instance.getContext(context.getName());
- Activator.log.warn("No resource for Context : " + context + " ; refreshing the model"); //$NON-NLS-1$
+ Activator.log.warn("No resource for Context : " + context + " ; refreshing the model"); //$NON-NLS-1$ //$NON-NLS-2$
}
URI sectionURI = URI.createURI(section.getSectionFile());
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/StereotypeModelElement.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/StereotypeModelElement.java
deleted file mode 100644
index c0fe0be2e0c..00000000000
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/runtime/StereotypeModelElement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * 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
- * 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.properties.runtime;
-
-import org.eclipse.core.databinding.observable.IObservable;
-import org.eclipse.emf.databinding.FeaturePath;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.properties.databinding.PapyrusObservableList;
-import org.eclipse.papyrus.properties.databinding.PapyrusObservableValue;
-import org.eclipse.papyrus.properties.modelelement.EMFModelElement;
-
-public class StereotypeModelElement extends EMFModelElement {
-
- public StereotypeModelElement(EObject source, EditingDomain domain) {
- super(source, domain);
- }
-
- @Override
- public IObservable getObservable(String propertyPath) {
- FeaturePath featurePath = getFeaturePath(propertyPath);
- EStructuralFeature feature = getFeature(featurePath);
- if(feature.getUpperBound() != 1) {
- return new PapyrusObservableList(getSource(featurePath), feature, domain);
- }
-
- return new PapyrusObservableValue(getSource(featurePath), feature, domain);
- }
-}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/EMFHelper.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/EMFHelper.java
index ebc651e7e88..9de810f7c68 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/EMFHelper.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/EMFHelper.java
@@ -12,6 +12,7 @@
package org.eclipse.papyrus.properties.util;
import java.io.IOException;
+import java.util.LinkedList;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
@@ -203,5 +204,55 @@ public class EMFHelper {
return null;
}
+ /**
+ * Return the root package containing the given package, or the package
+ * itself if it is already the root
+ *
+ * @param ePackage
+ * @return
+ */
+ public static EPackage getRootPackage(EPackage ePackage) {
+ if(ePackage.getESuperPackage() == null) {
+ return ePackage;
+ }
+ return getRootPackage(ePackage.getESuperPackage());
+ }
+
+
+ /**
+ * Return the list of Concrete (ie. non-abstract) that are subtypes
+ * of the given EClass
+ *
+ * @param type
+ * @return
+ */
+ public static List<EClass> getSubclassesOf(EClass type, boolean concreteClassesOnly) {
+ List<EClass> result = new LinkedList<EClass>();
+ if(concreteClassesOnly || !type.isAbstract()) {
+ result.add(type);
+ }
+
+ EPackage ePackage = getRootPackage(type.getEPackage());
+ getSubclassesOf(type, ePackage, result, concreteClassesOnly);
+ return result;
+ }
+
+ private static void getSubclassesOf(EClass type, EPackage fromPackage, List<EClass> result, boolean concreteClassesOnly) {
+ for(EClassifier classifier : fromPackage.getEClassifiers()) {
+ if(classifier instanceof EClass) {
+ EClass eClass = (EClass)classifier;
+ if(eClass.getEAllSuperTypes().contains(type)) {
+ if(concreteClassesOnly || !eClass.isAbstract()) {
+ result.add(eClass);
+ }
+ }
+ }
+ }
+
+ for(EPackage subPackage : fromPackage.getESubpackages()) {
+ getSubclassesOf(type, subPackage, result, concreteClassesOnly);
+ }
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/Util.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/Util.java
index f7e620af964..d1325223e08 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/Util.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/util/Util.java
@@ -222,14 +222,14 @@ public class Util {
return string.trim();
}
- String[] stringChunks = string.split("\n|\r|\r\n|\n\r");
+ String[] stringChunks = string.split("\n|\r|\r\n|\n\r"); //$NON-NLS-1$
List<String> chunks = new LinkedList<String>();
for(String chunk : stringChunks) {
chunk = chunk.trim();
if(chunk.length() > maxCharPerLine) {
- Matcher matcher = Pattern.compile("(.{0," + maxCharPerLine + "}\\b\\p{Punct}?)").matcher(chunk);
+ Matcher matcher = Pattern.compile("(.{0," + maxCharPerLine + "}\\b\\p{Punct}?)").matcher(chunk); //$NON-NLS-1$ //$NON-NLS-2$
while(matcher.find()) {
String group = matcher.group(1);
chunks.add(group);
@@ -239,9 +239,9 @@ public class Util {
}
}
- String result = "";
+ String result = ""; //$NON-NLS-1$
for(String chunk : chunks) {
- result += chunk.trim() + "\n";
+ result += chunk.trim() + "\n"; //$NON-NLS-1$
}
return result.trim();
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/AbstractPropertyEditor.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/AbstractPropertyEditor.java
index 8941d171336..0efc3b45c38 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/AbstractPropertyEditor.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/AbstractPropertyEditor.java
@@ -15,6 +15,7 @@ import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.papyrus.properties.Activator;
import org.eclipse.papyrus.properties.contexts.Context;
import org.eclipse.papyrus.properties.contexts.Property;
import org.eclipse.papyrus.properties.modelelement.DataSource;
@@ -71,6 +72,11 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
*/
protected IObservableValue observableValue;
+ /**
+ * Indicates if the editor's label should be displayed
+ */
+ protected boolean showLabel = true;
+
public static int descriptionMaxCharPerLine = 200;
/**
@@ -161,15 +167,25 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
valueEditor.setModelObservable(inputObservableValue);
}
- AbstractEditor editor = getEditor();
- if(editor != null)
- editor.setReadOnly(isReadOnly);
+ applyReadOnly(isReadOnly);
if(input.forceRefresh(propertyPath)) {
input.addChangeListener(this);
}
}
+ /**
+ * Applies the readOnly state to the editor
+ *
+ * @param readOnly
+ * Indicates if this widget should be read-only
+ */
+ protected void applyReadOnly(boolean readOnly) {
+ AbstractEditor editor = getEditor();
+ if(editor != null)
+ editor.setReadOnly(readOnly);
+ }
+
public void handleChange(ChangeEvent event) {
AbstractEditor editor = getEditor();
if(editor != null) {
@@ -200,10 +216,12 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
label += " *"; //$NON-NLS-1$
}
- if(valueEditor != null) {
- valueEditor.setLabel(label);
- } else if(listEditor != null) {
- listEditor.setLabel(label);
+ if(showLabel) {
+ if(valueEditor != null) {
+ valueEditor.setLabel(label);
+ } else if(listEditor != null) {
+ listEditor.setLabel(label);
+ }
}
}
@@ -236,7 +254,7 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
*/
protected String getLabel() {
Property property = getModelProperty();
- if(property == null || property.getLabel() == null || property.getLabel().trim().equals(""))
+ if(property == null || property.getLabel() == null || property.getLabel().trim().equals("")) //$NON-NLS-1$
return Util.getLabel(getLocalPropertyPath());
return property.getLabel();
@@ -247,12 +265,12 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
* The description is the widget's ToolTipText
*/
protected void updateDescription() {
- String description = "";
+ String description = ""; //$NON-NLS-1$
Property property = getModelProperty();
if(property != null)
description = property.getDescription();
- if(description == null || description.trim().equals("")) {
+ if(description == null || description.trim().equals("")) { //$NON-NLS-1$
return;
}
@@ -312,8 +330,13 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
* available
*/
protected IObservableList getInputObservableList() {
- if(observableList == null)
- observableList = (IObservableList)input.getObservable(propertyPath);
+ if(observableList == null) {
+ try {
+ observableList = (IObservableList)input.getObservable(propertyPath);
+ } catch (Exception ex) {
+ Activator.log.error("Cannot find a valid IObservable for " + propertyPath, ex); //$NON-NLS-1$
+ }
+ }
return observableList;
}
@@ -323,8 +346,13 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
* available
*/
protected IObservableValue getInputObservableValue() {
- if(observableValue == null)
- observableValue = (IObservableValue)input.getObservable(propertyPath);
+ if(observableValue == null) {
+ try {
+ observableValue = (IObservableValue)input.getObservable(propertyPath);
+ } catch (Exception ex) {
+ Activator.log.error("Cannot find a valid IObservable for " + propertyPath, ex); //$NON-NLS-1$
+ }
+ }
return observableValue;
}
@@ -335,4 +363,46 @@ public abstract class AbstractPropertyEditor implements IChangeListener {
protected String getLocalPropertyPath() {
return propertyPath.substring(propertyPath.lastIndexOf(":") + 1); //$NON-NLS-1$
}
+
+ /**
+ * Sets the editor's Layout Data
+ *
+ * @param data
+ */
+ public void setLayoutData(Object data) {
+ if(getEditor() != null)
+ getEditor().setLayoutData(data);
+ }
+
+ /**
+ * Returns the editor's Layout Data
+ *
+ * @param data
+ * @return
+ */
+ public Object getLayoutData() {
+ return getEditor() == null ? null : getEditor().getLayoutData();
+ }
+
+ /**
+ * Indicates whether the editor's label should be displayed or not
+ *
+ * @param showLabel
+ */
+ public void setShowLabel(boolean showLabel) {
+ AbstractEditor editor = getEditor();
+ this.showLabel = showLabel;
+ if(editor != null) {
+ editor.setDisplayLabel(showLabel);
+ }
+ }
+
+ /**
+ * Indicates whether the editor's label is displayed or not
+ *
+ * @return
+ */
+ public boolean getShowLabel() {
+ return this.showLabel;
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/EnumRadio.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/EnumRadio.java
index f387e6b045f..ad3e86c202f 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/EnumRadio.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/EnumRadio.java
@@ -55,7 +55,7 @@ public class EnumRadio extends AbstractPropertyEditor {
@Override
protected void doBinding() {
- enumRadio.setProviders(input.getContentProvider(propertyPath), null);
+ enumRadio.setProviders(input.getContentProvider(propertyPath), input.getLabelProvider(propertyPath));
super.doBinding();
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/InvalidWidget.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/InvalidWidget.java
index 5de9ec0ef8b..d7c3f968a77 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/InvalidWidget.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/InvalidWidget.java
@@ -38,8 +38,8 @@ public class InvalidWidget extends AbstractPropertyEditor {
StringLabel editor = new StringLabel(parent, style);
setEditor(editor);
- editor.getValueLabel().setText("Property view Error : invalid widget type");
- editor.getValueLabel().setImage(Activator.getDefault().getImage("icons/error.gif"));
+ editor.getValueLabel().setText("Property view Error : invalid widget type"); //$NON-NLS-1$
+ editor.getValueLabel().setImage(Activator.getDefault().getImage("icons/error.gif")); //$NON-NLS-1$
}
@Override
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiInteger.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiInteger.java
index dcdfd7d854f..3a271a4985e 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiInteger.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiInteger.java
@@ -11,6 +11,7 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.widgets;
+import org.eclipse.papyrus.widgets.editors.ICommitListener;
import org.eclipse.papyrus.widgets.editors.MultipleIntegerEditor;
import org.eclipse.swt.widgets.Composite;
@@ -46,6 +47,10 @@ public class MultiInteger extends AbstractPropertyEditor {
editor.setOrdered(input.isOrdered(propertyPath));
editor.setUnique(input.isUnique(propertyPath));
+ if(getInputObservableList() instanceof ICommitListener) {
+ editor.addCommitListener((ICommitListener)getInputObservableList());
+ }
+
super.doBinding();
}
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiReference.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiReference.java
index b26e6169c06..3b206804e24 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiReference.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiReference.java
@@ -12,7 +12,6 @@
package org.eclipse.papyrus.properties.widgets;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.properties.creation.PropertyEditorFactory;
import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.editors.ICommitListener;
import org.eclipse.papyrus.widgets.editors.MultipleReferenceEditor;
@@ -48,8 +47,6 @@ public class MultiReference extends AbstractPropertyEditor {
*/
public MultiReference(Composite parent, int style) {
editor = new MultipleReferenceEditor(parent, style);
- factory = new PropertyEditorFactory();
- editor.setFactory(factory);
super.setEditor(editor);
}
@@ -65,6 +62,11 @@ public class MultiReference extends AbstractPropertyEditor {
editor.setProviders(contentProvider, labelProvider);
editor.setOrdered(input.isOrdered(propertyPath));
editor.setUnique(input.isUnique(propertyPath));
+ if(factory == null) {
+ editor.setFactory(input.getValueFactory(propertyPath));
+ } else {
+ editor.setFactory(factory);
+ }
super.doBinding();
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiString.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiString.java
index db01d12f452..1e5a96aac50 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiString.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/MultiString.java
@@ -11,6 +11,8 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.widgets;
+import org.eclipse.jface.viewers.ListViewer;
+import org.eclipse.papyrus.widgets.editors.ICommitListener;
import org.eclipse.papyrus.widgets.editors.MultipleStringEditor;
import org.eclipse.swt.widgets.Composite;
@@ -46,6 +48,14 @@ public class MultiString extends AbstractPropertyEditor {
editor.setOrdered(input.isOrdered(propertyPath));
editor.setUnique(input.isUnique(propertyPath));
+ if(getInputObservableList() instanceof ICommitListener) {
+ editor.addCommitListener((ICommitListener)getInputObservableList());
+ }
+
super.doBinding();
}
+
+ public ListViewer getViewer() {
+ return editor.getViewer();
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/ReferenceDialog.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/ReferenceDialog.java
index 82574fd6813..b6bcd805bf3 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/ReferenceDialog.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/ReferenceDialog.java
@@ -11,6 +11,7 @@
*****************************************************************************/
package org.eclipse.papyrus.properties.widgets;
+import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
import org.eclipse.swt.widgets.Composite;
@@ -29,6 +30,12 @@ public class ReferenceDialog extends AbstractPropertyEditor {
protected org.eclipse.papyrus.widgets.editors.ReferenceDialog editor;
/**
+ * The ValueFactory used to create or edit Objects directly from
+ * this editor
+ */
+ protected ReferenceValueFactory factory;
+
+ /**
* Constructor.
*
* @param parent
@@ -46,7 +53,32 @@ public class ReferenceDialog extends AbstractPropertyEditor {
IStaticContentProvider provider = input.getContentProvider(propertyPath);
editor.setLabelProvider(input.getLabelProvider(propertyPath));
editor.setContentProvider(provider);
+ if(factory == null) { //Use the default factory from the DataSource
+ editor.setValueFactory(input.getValueFactory(propertyPath));
+ } else { //Use the factory explicitly specified
+ editor.setValueFactory(factory);
+ }
+
super.doBinding();
}
+ /**
+ * Sets the ValueFactory used to create or edit Objects directly from
+ * this editor
+ *
+ * @param factory
+ */
+ public void setFactory(ReferenceValueFactory factory) {
+ this.factory = factory;
+ editor.setValueFactory(factory);
+ }
+
+ /**
+ * @return The ValueFactory used to create or edit Objects directly from
+ * this editor
+ */
+ public ReferenceValueFactory getFactory() {
+ return factory;
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/StringFileSelector.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/StringFileSelector.java
new file mode 100644
index 00000000000..5bdf5dfa422
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/widgets/StringFileSelector.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * 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.properties.widgets;
+
+import org.eclipse.swt.widgets.Composite;
+
+
+public class StringFileSelector extends AbstractPropertyEditor {
+
+ protected org.eclipse.papyrus.widgets.editors.StringFileSelector selector;
+
+ protected String[] filterExtensions, filterNames;
+
+ protected boolean allowWorkspace = true, allowFileSystem = true;
+
+ public StringFileSelector(Composite parent, int style) {
+ selector = new org.eclipse.papyrus.widgets.editors.StringFileSelector(parent, style);
+ super.setEditor(selector);
+ }
+
+ public void setFilterExtensions(String[] filterExtensions) {
+ this.filterExtensions = filterExtensions;
+ checkFilters();
+ }
+
+ public void setFilterNames(String[] filterNames) {
+ this.filterNames = filterNames;
+ checkFilters();
+ }
+
+ protected void checkFilters() {
+ if(filterExtensions != null && filterNames != null) {
+
+ }
+ }
+
+ public void setAllowWorkspace(boolean allowWorkspace) {
+ this.allowWorkspace = allowWorkspace;
+ selector.setAllowWorkspace(allowWorkspace);
+ }
+
+ public boolean getAllowWorkspace() {
+ return allowWorkspace;
+ }
+
+ public void setAllowFileSystem(boolean allowFileSystem) {
+ this.allowFileSystem = allowFileSystem;
+ selector.setAllowFileSystem(allowFileSystem);
+ }
+
+ public boolean getAllowFileSystem() {
+ return allowFileSystem;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/xwt/XWTTabDescriptor.java b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/xwt/XWTTabDescriptor.java
index 02eccbda9bb..9a29612ac3e 100644
--- a/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/xwt/XWTTabDescriptor.java
+++ b/plugins/core/org.eclipse.papyrus.properties/src/org/eclipse/papyrus/properties/xwt/XWTTabDescriptor.java
@@ -56,7 +56,7 @@ public class XWTTabDescriptor extends AbstractTabDescriptor {
public String getCategory() {
String category = tab.getCategory();
- return category == null ? "" : category;
+ return category == null ? "" : category; //$NON-NLS-1$
}
public String getId() {
diff --git a/plugins/core/org.eclipse.papyrus.widgets/META-INF/MANIFEST.MF b/plugins/core/org.eclipse.papyrus.widgets/META-INF/MANIFEST.MF
index ddc5c4ec18b..7d901254c96 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/META-INF/MANIFEST.MF
+++ b/plugins/core/org.eclipse.papyrus.widgets/META-INF/MANIFEST.MF
@@ -11,12 +11,15 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.databinding,
org.eclipse.jface.databinding,
org.eclipse.papyrus.log;bundle-version="0.8.0",
- org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100"
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.100",
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.eclipse.ui.ide;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.widgets,
- org.eclipse.papyrus.widgets.editors,
+Export-Package: org.eclipse.papyrus.widgets,
org.eclipse.papyrus.widgets.creation,
+ org.eclipse.papyrus.widgets.editors,
org.eclipse.papyrus.widgets.providers,
- org.eclipse.papyrus.widgets.selectors
+ org.eclipse.papyrus.widgets.selectors,
+ org.eclipse.papyrus.widgets.util
Bundle-Localization: plugin
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/Activator.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/Activator.java
index 505db2eee72..a4d8e916a65 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/Activator.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/Activator.java
@@ -98,7 +98,7 @@ public class Activator extends AbstractUIPlugin {
*/
public Image getImage(String pluginId, String path) {
final ImageRegistry registry = getImageRegistry();
- String key = pluginId + "/" + path;
+ String key = pluginId + "/" + path; //$NON-NLS-1$
Image image = registry.get(key);
if(image == null) {
registry.put(key, AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, path));
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/ReferenceValueFactory.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/ReferenceValueFactory.java
index d82bc70d6f2..8d30f6d7f83 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/ReferenceValueFactory.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/ReferenceValueFactory.java
@@ -85,6 +85,7 @@ public interface ReferenceValueFactory {
* The widget calling the factory. May be used for example to retrieve the shell for opening a Dialog.
* @param object
* The object to edit
+ * @return the edited object, or null if the object has been edited "in place"
*/
- public void edit(Control widget, Object object);
+ public Object edit(Control widget, Object object);
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/StringEditionFactory.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/StringEditionFactory.java
new file mode 100644
index 00000000000..1064cdc824a
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/creation/StringEditionFactory.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * 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.widgets.creation;
+
+import java.util.Collection;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.widgets.editors.InputDialog;
+import org.eclipse.papyrus.widgets.messages.Messages;
+import org.eclipse.swt.widgets.Control;
+
+
+public class StringEditionFactory implements ReferenceValueFactory {
+
+ private String title = Messages.StringEditionFactory_EnterANewValue;
+
+ private String label = Messages.StringEditionFactory_EnterANewValue;
+
+ private IInputValidator validator;
+
+ public StringEditionFactory() {
+ }
+
+ public StringEditionFactory(String title, String label) {
+ this.title = title;
+ this.label = label;
+ }
+
+ public StringEditionFactory(IInputValidator validator) {
+ this.validator = validator;
+ }
+
+ public StringEditionFactory(String title, String label, IInputValidator validator) {
+ this.title = title;
+ this.label = label;
+ this.validator = validator;
+ }
+
+ public boolean canCreateObject() {
+ return false;
+ }
+
+ public Object createObject(Control widget) {
+ return null;
+ }
+
+ public Collection<Object> validateObjects(Collection<Object> objectsToValidate) {
+ return objectsToValidate;
+ }
+
+ public boolean canEdit() {
+ return true;
+ }
+
+ public Object edit(Control widget, Object object) {
+ if(!(object instanceof String)) {
+ return object;
+ }
+
+ InputDialog dialog = new InputDialog(widget.getShell(), title, label, (String)object, validator);
+
+ int result = dialog.open();
+ if(result == Window.OK) {
+ String newValue = dialog.getText();
+ return newValue;
+ }
+
+ return object;
+ }
+
+ public void setValidator(IInputValidator validator) {
+ this.validator = validator;
+ }
+}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/AbstractEditor.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/AbstractEditor.java
index bcdeed5323f..2e008261989 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/AbstractEditor.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/AbstractEditor.java
@@ -44,6 +44,11 @@ public abstract class AbstractEditor extends Composite {
protected Label label;
/**
+ * The label value for this editor
+ */
+ protected String labelText;
+
+ /**
* The set of elements listening on changes from this editor
*/
protected Set<ICommitListener> commitListeners = new HashSet<ICommitListener>();
@@ -169,6 +174,8 @@ public abstract class AbstractEditor extends Composite {
* The new text for this editor's label
*/
public void setLabel(String label) {
+ this.labelText = label;
+
if(this.label != null) {
this.label.setText(label);
} else {
@@ -178,6 +185,21 @@ public abstract class AbstractEditor extends Composite {
}
/**
+ * Show or delete the Label Widget.
+ *
+ * @param displayLabel
+ */
+ public void setDisplayLabel(boolean displayLabel) {
+ if(displayLabel) {
+ setLabel(labelText);
+ } else {
+ if(this.label != null) {
+ this.label.dispose();
+ }
+ }
+ }
+
+ /**
* Adds a commit listener to this editor. A Commit event is
* fired when a modification occures on this editor.
*
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelectionListener.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelectionListener.java
new file mode 100644
index 00000000000..ac44710a12d
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelectionListener.java
@@ -0,0 +1,18 @@
+/*****************************************************************************
+ * 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.widgets.editors;
+
+
+public interface IElementSelectionListener {
+
+ public void addElements(Object[] elements);
+}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelector.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelector.java
index b2d1107b39d..3503c05a8b2 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelector.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/IElementSelector.java
@@ -63,4 +63,13 @@ public interface IElementSelector {
*/
public void clearTemporaryElements();
+ /**
+ * Adds a new listener to this selector.
+ * The selector can inform the listener that new elements have
+ * been selected
+ *
+ * @param listener
+ */
+ public void addElementSelectionListener(IElementSelectionListener listener);
+
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/InputDialog.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/InputDialog.java
new file mode 100644
index 00000000000..352c81b66cf
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/InputDialog.java
@@ -0,0 +1,185 @@
+/*****************************************************************************
+ * 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.widgets.editors;
+
+
+import java.util.Collections;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.papyrus.widgets.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+/**
+ * A Dialog used to input a String. The dialog uses a IInputValidator
+ * to check the string, and can display an error message.
+ *
+ * @author Camille Letavernier
+ */
+public class InputDialog extends SelectionDialog {
+
+ /**
+ * The initial value for the string
+ */
+ protected String initialValue;
+
+ /**
+ * The string validator
+ */
+ protected IInputValidator validator;
+
+ /**
+ * The label used to display the error message
+ */
+ protected Label errorLabel;
+
+ /**
+ * The label used to display the error icon
+ */
+ protected Label errorImage;
+
+ /**
+ * The text widget used to input a new string
+ */
+ protected Text input;
+
+ /**
+ * The dialog's title
+ */
+ protected String title;
+
+ /**
+ * The label describing the kind of text to input
+ */
+ protected String labelText;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parentShell
+ * The shell in which the dialog will be opened
+ * @param title
+ * The dialog's title
+ * @param initialValue
+ * The dialog's initial value
+ * @param validator
+ * The validator used to check the input string
+ */
+ public InputDialog(Shell parentShell, String title, String label, String initialValue, IInputValidator validator) {
+ super(parentShell);
+ this.initialValue = initialValue;
+ this.validator = validator;
+ this.title = title;
+ this.labelText = label;
+ }
+
+ @Override
+ protected Composite getDialogArea() {
+ return (Composite)super.getDialogArea();
+ }
+
+ @Override
+ public void create() {
+ super.create();
+
+ ((GridLayout)getDialogArea().getLayout()).numColumns = 2;
+
+ errorImage = new Label(getDialogArea(), SWT.NONE);
+ errorImage.setImage(Activator.getDefault().getImage("/icons/error.gif")); //$NON-NLS-1$
+
+ errorLabel = new Label(getDialogArea(), SWT.NONE);
+ errorLabel.setVisible(false);
+
+ Label label = new Label(getDialogArea(), SWT.None);
+ if(labelText != null)
+ label.setText(labelText);
+ label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
+ input = new Text(getDialogArea(), SWT.BORDER);
+ input.setText(initialValue);
+ input.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
+ input.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ //Nothing
+ }
+
+ public void keyReleased(KeyEvent e) {
+ validate();
+ }
+
+ });
+
+ getShell().setImage(Activator.getDefault().getImage("/icons/papyrus.png")); //$NON-NLS-1$
+
+ if(title != null)
+ getShell().setText(title);
+
+ validate();
+ getShell().pack();
+ }
+
+ /**
+ * Validates the current string. If the string isn't valid,
+ * and error message will be displayed.
+ */
+ protected void validate() {
+ if(validator == null) {
+ errorLabel.setVisible(false);
+ errorImage.setVisible(false);
+ getOkButton().setEnabled(true);
+ return;
+ }
+
+ String errorMessage = validator.isValid(input.getText());
+ if(errorMessage == null) {
+ errorLabel.setVisible(false);
+ errorImage.setVisible(false);
+ getOkButton().setEnabled(true);
+ } else {
+ errorLabel.setText(errorMessage);
+ errorLabel.setVisible(true);
+ errorImage.setVisible(true);
+ getOkButton().setEnabled(false);
+ }
+
+ getDialogArea().layout(true);
+ }
+
+ @Override
+ protected void okPressed() {
+ setResult(Collections.singletonList(input.getText()));
+ super.okPressed();
+ }
+
+ /**
+ * @return the input text from this dialog, or null
+ * if the dialog has been canceled
+ */
+ public String getText() {
+ Object[] result = getResult();
+ if(result == null || result.length == 0)
+ return null;
+ return (String)result[0];
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleStringEditor.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleStringEditor.java
index d69ff39f7d2..737646587fc 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleStringEditor.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleStringEditor.java
@@ -11,6 +11,7 @@
*****************************************************************************/
package org.eclipse.papyrus.widgets.editors;
+import org.eclipse.papyrus.widgets.creation.StringEditionFactory;
import org.eclipse.papyrus.widgets.selectors.StringSelector;
import org.eclipse.swt.widgets.Composite;
@@ -35,6 +36,7 @@ public class MultipleStringEditor extends MultipleValueEditor {
*/
public MultipleStringEditor(Composite parent, int style) {
super(parent, style, new StringSelector());
+ setFactory(new StringEditionFactory());
}
/**
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueEditor.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueEditor.java
index a707e22c599..5ab92ef4b74 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueEditor.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueEditor.java
@@ -16,6 +16,7 @@ import java.util.LinkedList;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -31,6 +32,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -152,13 +154,15 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
listData.minimumHeight = 80;
list.setLayoutData(listData);
+ list.addSelectionListener(this);
+
listViewer = new ListViewer(list);
- listViewer.setContentProvider(new CollectionContentProvider());
+ listViewer.setContentProvider(CollectionContentProvider.instance);
createListControls();
this.selector = selector;
- dialog = new MultipleValueSelectorDialog(parent.getShell(), selector, label, unique);
+ dialog = new MultipleValueSelectorDialog(parent.getShell(), selector, label, unique, ordered);
if(label != null)
dialog.setTitle(label);
@@ -169,7 +173,7 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
updateControls();
}
- private void updateControls() {
+ protected void updateControls() {
add.setEnabled(!readOnly);
remove.setEnabled(!readOnly);
up.setEnabled(ordered && !readOnly);
@@ -275,30 +279,19 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
* @param ordered
*/
protected void createListControls() {
- up = new Button(controlsSection, SWT.PUSH);
- up.setImage(Activator.getDefault().getImage("/icons/Up_12x12.gif")); //$NON-NLS-1$
- up.addSelectionListener(this);
- up.setToolTipText(Messages.MultipleValueEditor_MoveSelectedElementsUp);
-
- down = new Button(controlsSection, SWT.PUSH);
- down.setImage(Activator.getDefault().getImage("/icons/Down_12x12.gif")); //$NON-NLS-1$
- down.addSelectionListener(this);
- down.setToolTipText(Messages.MultipleValueEditor_MoveSelectedElementsDown);
-
- add = new Button(controlsSection, SWT.PUSH);
- add.setImage(Activator.getDefault().getImage("/icons/Add_12x12.gif")); //$NON-NLS-1$
- add.addSelectionListener(this);
- add.setToolTipText(Messages.MultipleValueEditor_AddElements);
-
- remove = new Button(controlsSection, SWT.PUSH);
- remove.setImage(Activator.getDefault().getImage("/icons/Delete_12x12.gif")); //$NON-NLS-1$
- remove.addSelectionListener(this);
- remove.setToolTipText(Messages.MultipleValueEditor_RemoveSelectedElements);
-
- edit = new Button(controlsSection, SWT.PUSH);
- edit.setImage(Activator.getDefault().getImage("/icons/Edit_12x12.gif")); //$NON-NLS-1$
- edit.addSelectionListener(this);
- edit.setToolTipText(Messages.MultipleValueEditor_EditSelectedValue);
+ up = createButton(Activator.getDefault().getImage("/icons/Up_12x12.gif"), Messages.MultipleValueEditor_MoveSelectedElementsUp); //$NON-NLS-1$
+ down = createButton(Activator.getDefault().getImage("/icons/Down_12x12.gif"), Messages.MultipleValueEditor_MoveSelectedElementsDown); //$NON-NLS-1$
+ add = createButton(Activator.getDefault().getImage("/icons/Add_12x12.gif"), Messages.MultipleValueEditor_AddElements); //$NON-NLS-1$
+ remove = createButton(Activator.getDefault().getImage("/icons/Delete_12x12.gif"), Messages.MultipleValueEditor_RemoveSelectedElements); //$NON-NLS-1$
+ edit = createButton(Activator.getDefault().getImage("/icons/Edit_12x12.gif"), Messages.MultipleValueEditor_EditSelectedValue); //$NON-NLS-1$
+ }
+
+ protected Button createButton(Image image, String toolTipText) {
+ Button button = new Button(controlsSection, SWT.PUSH);
+ button.setImage(image); //$NON-NLS-1$
+ button.addSelectionListener(this);
+ button.setToolTipText(toolTipText);
+ return button;
}
@Override
@@ -360,6 +353,12 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
commit();
}
+ @Override
+ protected void commit() {
+ super.commit();
+ listViewer.refresh();
+ }
+
/**
* Handle remove Action
*/
@@ -422,7 +421,19 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
return;
}
- referenceFactory.edit(this, selection.getFirstElement());
+ int index = listViewer.getList().getSelectionIndex();
+
+ Object currentValue = selection.getFirstElement();
+ Object newValue = referenceFactory.edit(this.edit, selection.getFirstElement());
+
+ if(newValue != currentValue && newValue != null) {
+ modelProperty.remove(index);
+ modelProperty.add(index, newValue);
+
+ //commit(); // The commit only occurs in the case where we modify the list (We don't commit direct edition on objects)
+ }
+
+ commit();
}
/**
@@ -442,7 +453,9 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
* {@inheritDoc}
*/
public void widgetDefaultSelected(SelectionEvent e) {
- //Nothing
+ if(e.widget == list && edit.isEnabled()) {
+ editAction();
+ }
}
/**
@@ -456,13 +469,15 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
/**
* Refreshes the viewer when a change occurs on the ObservableList
+ * TODO : Problem : a change occurring on an element of the list is not sent here
+ * TODO : When undoing a command, the change event is not received (Although it modifies the list itself)
*
* @see org.eclipse.core.databinding.observable.IChangeListener#handleChange(org.eclipse.core.databinding.observable.ChangeEvent)
*
* @param event
*/
public void handleChange(ChangeEvent event) {
- listViewer.refresh(true);
+ listViewer.refresh();
}
/**
@@ -508,4 +523,10 @@ public class MultipleValueEditor extends AbstractListEditor implements Selection
list.setToolTipText(text);
super.setLabelToolTipText(text);
}
+
+ @Override
+ public void setModelObservable(IObservableList modelProperty) {
+ super.setModelObservable(modelProperty);
+ updateControls();
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueSelectorDialog.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueSelectorDialog.java
index 68da2e45c89..60c2956afda 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueSelectorDialog.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/MultipleValueSelectorDialog.java
@@ -47,7 +47,7 @@ import org.eclipse.ui.dialogs.SelectionDialog;
* @author Camille Letavernier
*
*/
-public class MultipleValueSelectorDialog extends SelectionDialog implements SelectionListener {
+public class MultipleValueSelectorDialog extends SelectionDialog implements SelectionListener, IElementSelectionListener {
/**
* The object selector
@@ -158,7 +158,7 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
* The element selector used by this dialog
*/
public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector) {
- this(parentShell, selector, null, false);
+ this(parentShell, selector, null, false, false);
}
/**
@@ -172,7 +172,7 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
* The title of this dialog
*/
public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, String title) {
- this(parentShell, selector, title, false);
+ this(parentShell, selector, title, false, false);
}
/**
@@ -187,7 +187,7 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
* True if the values returned by this dialog should be unique
*/
public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, boolean unique) {
- this(parentShell, selector, null, unique);
+ this(parentShell, selector, null, unique, false);
}
/**
@@ -203,7 +203,7 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
* @param unique
* True if the values returned by this dialog should be unique
*/
- public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique) {
+ public MultipleValueSelectorDialog(Shell parentShell, IElementSelector selector, String title, boolean unique, boolean ordered) {
super(parentShell);
Assert.isNotNull(selector, "The element selector should be defined"); //$NON-NLS-1$
this.selector = selector;
@@ -211,6 +211,9 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
setHelpAvailable(false);
setTitle(title);
this.unique = unique;
+ this.ordered = ordered;
+
+ selector.addElementSelectionListener(this);
}
/**
@@ -222,18 +225,24 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
Composite parent = getDialogArea();
GridLayout layout = (GridLayout)parent.getLayout();
- layout.numColumns = 4;
- layout.makeColumnsEqualWidth = false;
+ layout.numColumns = 2;
+ layout.makeColumnsEqualWidth = true;
- createSelectorSection(parent);
- createControlsSection(parent);
- createListSection(parent);
- createRightButtonsSection(parent);
+ Composite selectorPane = new Composite(parent, SWT.NONE);
+ selectorPane.setLayout(new GridLayout(2, false));
+ selectorPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- getShell().setSize(400, 300);
- getShell().layout();
+ Composite selectedPane = new Composite(parent, SWT.NONE);
+ selectedPane.setLayout(new GridLayout(2, false));
+ selectedPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- setResult(new LinkedList<Object>(allElements));
+ createSelectorSection(selectorPane);
+ createControlsSection(selectorPane);
+ createListSection(selectedPane);
+ createRightButtonsSection(selectedPane);
+
+ getShell().setSize(600, 400);
+ getShell().layout();
super.getShell().setImage(Activator.getDefault().getImage("/icons/papyrus.png")); //$NON-NLS-1$
@@ -305,7 +314,7 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
selectedElements.setLayoutData(data);
selectedElementsViewer = new ListViewer(selectedElements);
- selectedElementsViewer.setContentProvider(new CollectionContentProvider());
+ selectedElementsViewer.setContentProvider(CollectionContentProvider.instance);
if(labelProvider != null)
selectedElementsViewer.setLabelProvider(labelProvider);
@@ -468,7 +477,7 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
if(factory == null)
return;
- Object newObject = factory.createObject(getShell());
+ Object newObject = factory.createObject(this.create);
if(newObject == null)
return;
@@ -515,8 +524,6 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
selector.setSelectedElements(allElements.toArray());
selectedElementsViewer.setSelection(null);
selectedElementsViewer.refresh();
-
- setResult(new LinkedList<Object>(allElements));
}
/**
@@ -532,7 +539,6 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
protected void removeAllAction() {
allElements.clear();
selector.setSelectedElements(new Object[0]);
- setResult(new LinkedList<Object>());
selectedElementsViewer.setSelection(null);
selectedElementsViewer.refresh();
}
@@ -552,12 +558,10 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
* @param elements
* The elements to be added
*/
- private void addElements(Object[] elements) {
+ public void addElements(Object[] elements) {
if(elements != null) {
allElements.addAll(Arrays.asList(elements));
selectedElementsViewer.refresh();
-
- setResult(new LinkedList<Object>(allElements));
}
}
@@ -573,6 +577,9 @@ public class MultipleValueSelectorDialog extends SelectionDialog implements Sele
factory.validateObjects(objectsToValidate);
selector.clearTemporaryElements();
}
+
+ setResult(new LinkedList<Object>(allElements));
+
super.okPressed();
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/ReferenceDialog.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/ReferenceDialog.java
index e7664b5e726..b82579d0395 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/ReferenceDialog.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/ReferenceDialog.java
@@ -15,9 +15,11 @@ import java.util.Collections;
import org.eclipse.core.databinding.observable.ChangeEvent;
import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.papyrus.widgets.Activator;
+import org.eclipse.papyrus.widgets.creation.ReferenceValueFactory;
import org.eclipse.papyrus.widgets.messages.Messages;
import org.eclipse.papyrus.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
@@ -28,9 +30,12 @@ import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Widget;
/**
* An editor representing a single reference as a Label
@@ -42,7 +47,7 @@ import org.eclipse.swt.widgets.Composite;
* @author Camille Letavernier
*
*/
-public class ReferenceDialog extends AbstractValueEditor implements IChangeListener, DisposeListener {
+public class ReferenceDialog extends AbstractValueEditor implements IChangeListener, DisposeListener, SelectionListener {
/**
* The CLabel displaying the current value
@@ -50,9 +55,19 @@ public class ReferenceDialog extends AbstractValueEditor implements IChangeListe
protected final CLabel currentValueLabel;
/**
- * The Button used to edit the current value
+ * The Button used to browse the available values
*/
- protected final Button openDialogButton;
+ protected final Button browseValuesButton;
+
+ /**
+ * The Button used to create a new instance
+ */
+ protected final Button createInstanceButton;
+
+ /**
+ * The Button used to edit the current object
+ */
+ protected final Button editInstanceButton;
/**
* The Button used to unset the current value
@@ -81,6 +96,11 @@ public class ReferenceDialog extends AbstractValueEditor implements IChangeListe
protected Object value;
/**
+ * The factory used to create or edit objects directly from this editor
+ */
+ protected ReferenceValueFactory valueFactory;
+
+ /**
*
* Constructs a new ReferenceDialog in the given parent Composite.
* The style will be applied to the CLabel displaying the current value.
@@ -91,56 +111,91 @@ public class ReferenceDialog extends AbstractValueEditor implements IChangeListe
public ReferenceDialog(Composite parent, int style) {
super(parent, style);
- ((GridLayout)getLayout()).numColumns = 4;
+ ((GridLayout)getLayout()).numColumns = 6;
currentValueLabel = factory.createCLabel(this, null, SWT.BORDER | style);
currentValueLabel.setLayoutData(getDefaultLayoutData());
dialog = new TreeSelectorDialog(parent.getShell());
- openDialogButton = factory.createButton(this, null, SWT.PUSH);
- openDialogButton.setImage(Activator.getDefault().getImage("/icons/browse_12x12.gif")); //$NON-NLS-1$
- openDialogButton.setToolTipText(Messages.ReferenceDialog_EditValue);
- openDialogButton.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- dialog.setInitialElementSelections(Collections.singletonList(getValue()));
- int result = dialog.open();
- if(result == Window.OK) {
- Object[] newValue = dialog.getResult();
- if(newValue.length == 0) {
- modelProperty.setValue(null);
- } else {
- modelProperty.setValue(newValue[0]);
- }
- updateLabel();
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // Nothing
- }
-
- });
+ browseValuesButton = factory.createButton(this, null, SWT.PUSH);
+ browseValuesButton.setImage(Activator.getDefault().getImage("/icons/browse_12x12.gif")); //$NON-NLS-1$
+ browseValuesButton.setToolTipText(Messages.ReferenceDialog_EditValue);
+ browseValuesButton.addSelectionListener(this);
unsetButton = factory.createButton(this, null, SWT.PUSH);
unsetButton.setImage(Activator.getDefault().getImage("/icons/Delete_12x12.gif")); //$NON-NLS-1$
unsetButton.setToolTipText(Messages.ReferenceDialog_UnsetValue);
- unsetButton.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- if(modelProperty != null) {
- modelProperty.setValue(null);
- } else {
- handleChange(null);
- }
- }
+ unsetButton.addSelectionListener(this);
- public void widgetDefaultSelected(SelectionEvent e) {
- //Nothing
+ createInstanceButton = factory.createButton(this, null, SWT.PUSH);
+ createInstanceButton.setImage(Activator.getDefault().getImage("/icons/Add_12x12.gif")); //$NON-NLS-1$
+ createInstanceButton.setToolTipText(Messages.ReferenceDialog_CreateANewObject);
+ createInstanceButton.addSelectionListener(this);
+
+ editInstanceButton = factory.createButton(this, null, SWT.PUSH);
+ editInstanceButton.setImage(Activator.getDefault().getImage("/icons/Edit_12x12.gif")); //$NON-NLS-1$
+ editInstanceButton.setToolTipText(Messages.ReferenceDialog_EditTheCurrentValue);
+ editInstanceButton.addSelectionListener(this);
+
+ updateControls();
+ }
+
+ /**
+ * The action executed when the "browse" button is selected
+ * Choose a value from a selection of already created objects
+ */
+ protected void browseAction() {
+ dialog.setInitialElementSelections(Collections.singletonList(getValue()));
+ int result = dialog.open();
+ if(result == Window.OK) {
+ Object[] newValue = dialog.getResult();
+ if(newValue.length == 0) {
+ modelProperty.setValue(null);
+ } else {
+ modelProperty.setValue(newValue[0]);
}
+ updateLabel();
+ }
+ }
- });
+ /**
+ * The action executed when the "create" button is selected
+ * Create a new instance and assign it to this reference
+ */
+ protected void createAction() {
+ if(valueFactory != null && valueFactory.canCreateObject()) {
+ Object value = valueFactory.createObject(createInstanceButton);
+ if(value == null)
+ return;
+ valueFactory.validateObjects(Collections.singleton(value));
+ modelProperty.setValue(value);
+ }
+ }
+
+ /**
+ * The action executed when the "edit" button is selected
+ * Edits the object that is currently selected
+ */
+ protected void editAction() {
+ Object currentValue = modelProperty.getValue();
+ if(currentValue != null && valueFactory != null && valueFactory.canEdit()) {
+ Object newValue = valueFactory.edit(editInstanceButton, modelProperty.getValue());
+ if(newValue != currentValue)
+ modelProperty.setValue(value);
+ }
+ }
+
+ /**
+ * The action executed when the "unset" button is selected
+ * Sets the current reference to null
+ */
+ protected void unsetAction() {
+ if(modelProperty != null) {
+ modelProperty.setValue(null);
+ } else {
+ handleChange(null);
+ }
}
/**
@@ -227,7 +282,7 @@ public class ReferenceDialog extends AbstractValueEditor implements IChangeListe
@Override
public void setReadOnly(boolean readOnly) {
currentValueLabel.setEnabled(!readOnly);
- openDialogButton.setEnabled(!readOnly);
+ browseValuesButton.setEnabled(!readOnly);
unsetButton.setEnabled(!readOnly);
}
@@ -281,9 +336,65 @@ public class ReferenceDialog extends AbstractValueEditor implements IChangeListe
}
@Override
+ public void setModelObservable(IObservableValue modelProperty) {
+ super.setModelObservable(modelProperty);
+ updateControls();
+ }
+
+ @Override
public void setToolTipText(String text) {
super.setLabelToolTipText(text);
currentValueLabel.setToolTipText(text);
}
+ public void setValueFactory(ReferenceValueFactory factory) {
+ valueFactory = factory;
+ updateControls();
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ Widget widget = e.widget;
+ if(widget == browseValuesButton) {
+ browseAction();
+ } else if(widget == createInstanceButton) {
+ createAction();
+ } else if(widget == editInstanceButton) {
+ editAction();
+ } else if(widget == unsetButton) {
+ unsetAction();
+ }
+ updateControls();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //Nothing
+ }
+
+ /**
+ * Updates the buttons' status
+ */
+ protected void updateControls() {
+ //Check if the edit & create buttons should be displayed
+ boolean exclude = valueFactory == null || !valueFactory.canCreateObject();
+ setExclusion(editInstanceButton, exclude);
+ setExclusion(createInstanceButton, exclude);
+
+ //If they are displayed, check if they should be enabled
+ if(!exclude) {
+ editInstanceButton.setEnabled(valueFactory != null && valueFactory.canEdit() && modelProperty != null && modelProperty.getValue() != null);
+ createInstanceButton.setEnabled(valueFactory != null && valueFactory.canCreateObject());
+ }
+ }
+
+ private void setExclusion(Control control, boolean exclude) {
+ if(control.getLayoutData() == null) {
+ GridData data = new GridData();
+ data.exclude = exclude;
+ control.setLayoutData(data);
+ } else {
+ GridData data = (GridData)control.getLayoutData();
+ data.exclude = exclude;
+ }
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/SelectionEditor.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/SelectionEditor.java
index 3272f8c2ced..0acd6c5c2b8 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/SelectionEditor.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/SelectionEditor.java
@@ -279,7 +279,7 @@ public class SelectionEditor extends Composite implements SelectionListener {
selectedElementsViewer = new ListViewer(selectedElements);
- selectedElementsViewer.setContentProvider(new CollectionContentProvider());
+ selectedElementsViewer.setContentProvider(CollectionContentProvider.instance);
if(labelProvider != null)
selectedElementsViewer.setLabelProvider(labelProvider);
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringEditor.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringEditor.java
index 9019a3583d6..3a260ee0726 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringEditor.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringEditor.java
@@ -65,15 +65,17 @@ public class StringEditor extends AbstractValueEditor implements KeyListener {
super(parent, label);
GridData data = getDefaultLayoutData();
- text = factory.createText(this, null, style);
- text.setLayoutData(data);
if((style & SWT.MULTI) != 0) {
data.heightHint = 55;
style = style | SWT.V_SCROLL;
- if(label != null) {
- super.label.setLayoutData(getLabelLayoutData());
- }
+ }
+
+ text = factory.createText(this, null, style);
+ text.setLayoutData(data);
+
+ if(label != null) {
+ super.label.setLayoutData(getLabelLayoutData());
}
//We listen on Carriage Return only if the editor isn't multiline
@@ -113,7 +115,7 @@ public class StringEditor extends AbstractValueEditor implements KeyListener {
*/
public void keyReleased(KeyEvent e) {
if((e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) && e.stateMask == SWT.NONE) {
- text.notifyListeners(SWT.FocusOut, new Event());
+ notifyChange();
}
}
@@ -143,6 +145,11 @@ public class StringEditor extends AbstractValueEditor implements KeyListener {
return !text.isEnabled();
}
+ protected void notifyChange() {
+ text.notifyListeners(SWT.FocusOut, new Event());
+ commit();
+ }
+
@Override
public void setToolTipText(String tooltip) {
text.setToolTipText(tooltip);
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringFileSelector.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringFileSelector.java
new file mode 100644
index 00000000000..c4d4ad70147
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringFileSelector.java
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * 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.widgets.editors;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.widgets.messages.Messages;
+import org.eclipse.papyrus.widgets.util.FileUtil;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.ui.dialogs.ResourceSelectionDialog;
+
+
+public class StringFileSelector extends StringEditor {
+
+ private Button browse;
+
+ private Button browseWorkspace;
+
+ private List<String> filterNames;
+
+ private List<String> filterExtensions;
+
+ public StringFileSelector(Composite parent, int style) {
+ super(parent, style);
+ ((GridLayout)getLayout()).numColumns = 5;
+
+ browse = factory.createButton(this, Messages.StringFileSelector_Browse, SWT.PUSH);
+ browse.setLayoutData(new GridData());
+ browseWorkspace = factory.createButton(this, Messages.StringFileSelector_BrowseWorkspace, SWT.PUSH);
+ browseWorkspace.setLayoutData(new GridData());
+
+ browse.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ File file = FileUtil.getFile(text.getText());
+
+ FileDialog dialog = new FileDialog(getShell());
+ dialog.setFileName(file.getAbsolutePath());
+ dialog.setFilterExtensions(filterExtensions.toArray(new String[filterExtensions.size()]));
+ dialog.setFilterNames(filterNames.toArray(new String[filterNames.size()]));
+ String result = dialog.open();
+ if(result == null) { //Cancel
+ return;
+ }
+ setResult(result);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //Nothing
+ }
+
+ });
+
+ filterNames = new LinkedList<String>();
+ filterExtensions = new LinkedList<String>();
+
+
+ browseWorkspace.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot();
+ IFile currentFile = FileUtil.getIFile(text.getText());
+
+ ResourceSelectionDialog dialog = new ResourceSelectionDialog(getShell(), workspace, ""); //$NON-NLS-1$
+
+ if(currentFile != null && currentFile.exists()) {
+ dialog.setInitialSelections(new IFile[]{ currentFile });
+ }
+
+ int code = dialog.open();
+ if(code == Window.OK) {
+ Object[] result = dialog.getResult();
+ if(result.length > 0) {
+ Object file = result[0];
+ if(file instanceof IFile) {
+ setResult((IFile)file);
+ }
+ }
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ //Nothing
+ }
+
+ });
+ }
+
+ protected void setResult(IFile file) {
+ text.setText(file.getFullPath().toString());
+ notifyChange();
+ }
+
+ protected void setResult(File file) {
+ text.setText(file.getAbsolutePath());
+ notifyChange();
+ }
+
+ protected void setResult(String path) {
+ text.setText(path);
+ notifyChange();
+ }
+
+ public void setFilters(String[] filterExtensions, String[] filterNames) {
+ setFilterNames(filterNames);
+ setFilterExtensions(filterExtensions);
+ }
+
+ public void setFilterExtensions(String[] filterExtensions) {
+ this.filterExtensions = Arrays.asList(filterExtensions);
+ }
+
+ public void setFilterNames(String[] filterNames) {
+ this.filterNames = Arrays.asList(filterNames);
+ }
+
+ public void addFilteredExtension(String filteredExtension, String filterName) {
+ if(filteredExtension != null) {
+ if(filterName == null) {
+ filterName = filteredExtension;
+ }
+
+ filterExtensions.add(filteredExtension);
+ filterNames.add(filterName);
+ }
+ }
+
+ @Override
+ public Object getEditableType() {
+ return String.class;
+ }
+
+ @Override
+ public void setReadOnly(boolean readOnly) {
+ super.setReadOnly(readOnly);
+ browse.setEnabled(!readOnly);
+ browseWorkspace.setEnabled(!readOnly);
+ }
+
+ public void setAllowWorkspace(boolean allowWorkspace) {
+ //((GridData)browseWorkspace.getLayoutData()).exclude = !allowWorkspace;
+ browseWorkspace.setEnabled(allowWorkspace);
+ layout();
+ }
+
+ public void setAllowFileSystem(boolean allowFileSystem) {
+ //((GridData)browse.getLayoutData()).exclude = !allowFileSystem;
+ browse.setEnabled(allowFileSystem);
+ layout();
+ }
+
+}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringLabel.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringLabel.java
index 31e51388a5c..5c1aa42f9c6 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringLabel.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/editors/StringLabel.java
@@ -41,7 +41,7 @@ public class StringLabel extends AbstractValueEditor implements IChangeListener
*/
public StringLabel(Composite parent, int style) {
super(parent, style);
- valueLabel = factory.createCLabel(this, "", style);
+ valueLabel = factory.createCLabel(this, "", style); //$NON-NLS-1$
valueLabel.setLayoutData(getDefaultLayoutData());
labelProvider = new LabelProvider();
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/Messages.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/Messages.java
index 85259bc4ed2..918851714ce 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/Messages.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/Messages.java
@@ -51,6 +51,10 @@ public class Messages extends NLS {
/** The Multiple value selector dialog_ remove all elements. */
public static String MultipleValueSelectorDialog_RemoveAllElements;
+ public static String ReferenceDialog_CreateANewObject;
+
+ public static String ReferenceDialog_EditTheCurrentValue;
+
/** The Reference dialog_ edit value */
public static String ReferenceDialog_EditValue;
@@ -66,6 +70,12 @@ public class Messages extends NLS {
/** the Enum radio_ no value */
public static String EnumRadio_NoValue;
+ public static String StringEditionFactory_EnterANewValue;
+
+ public static String StringFileSelector_Browse;
+
+ public static String StringFileSelector_BrowseWorkspace;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/messages.properties b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/messages.properties
index 973772b5f2f..66b1dd3bf4f 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/messages.properties
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/messages/messages.properties
@@ -8,8 +8,13 @@ MultipleValueSelectorDialog_AddSelectedElements=Add selected elements
MultipleValueSelectorDialog_RemoveAllElements=Remove all elements
MultipleValueSelectorDialog_CreateNewElement=Create a new element
MultipleValueSelectorDialog_DeleteNewElement=Deletes a newly created element
+ReferenceDialog_CreateANewObject=Create a new object
+ReferenceDialog_EditTheCurrentValue=Edit the current value
ReferenceDialog_EditValue=Edit the reference value
ReferenceDialog_SelectValue=Select the value for this reference
ReferenceDialog_Unset=<Unset>
ReferenceDialog_UnsetValue=Unset the reference value
-EnumRadio_NoValue=There is no value to select \ No newline at end of file
+EnumRadio_NoValue=There is no value to select
+StringEditionFactory_EnterANewValue=Enter the new value
+StringFileSelector_Browse=Browse
+StringFileSelector_BrowseWorkspace=Browse workspace
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/providers/CollectionContentProvider.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/providers/CollectionContentProvider.java
index 6e6202995fd..f00f0ac0f2b 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/providers/CollectionContentProvider.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/providers/CollectionContentProvider.java
@@ -24,6 +24,10 @@ import org.eclipse.jface.viewers.Viewer;
*/
public class CollectionContentProvider implements IStructuredContentProvider {
+ private CollectionContentProvider() {
+
+ }
+
/**
* {@inheritDoc}
*/
@@ -56,4 +60,6 @@ public class CollectionContentProvider implements IStructuredContentProvider {
return new Object[]{};
}
+
+ public static CollectionContentProvider instance = new CollectionContentProvider();
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/ReferenceSelector.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/ReferenceSelector.java
index fe6e53a40a2..8e88feffa34 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/ReferenceSelector.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/ReferenceSelector.java
@@ -21,10 +21,13 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.papyrus.widgets.editors.IElementSelectionListener;
import org.eclipse.papyrus.widgets.editors.IElementSelector;
import org.eclipse.papyrus.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.widgets.providers.IStaticContentProvider;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -71,6 +74,9 @@ public class ReferenceSelector implements IElementSelector {
*/
protected boolean multiSelection;
+
+ private Set<IElementSelectionListener> elementSelectionListeners = new HashSet<IElementSelectionListener>();
+
/**
* The set of selected elements. If the selector is marked as "unique",
* these elements will be filtered in the Tree.
@@ -201,7 +207,7 @@ public class ReferenceSelector implements IElementSelector {
this.contentProvider = new EncapsulatedContentProvider(staticContentProvider);
if(fTree != null) {
fTree.getViewer().setContentProvider(contentProvider);
- fTree.getViewer().setInput("");
+ fTree.getViewer().setInput(""); //$NON-NLS-1$
}
}
@@ -216,7 +222,7 @@ public class ReferenceSelector implements IElementSelector {
// filter.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
final PatternFilter filter = new PatternFilter();
- filter.setPattern("*");
+ filter.setPattern("*"); //$NON-NLS-1$
fTree = new FilteredTree(content, SWT.MULTI | SWT.BORDER, new PatternFilter(), true);
@@ -224,7 +230,7 @@ public class ReferenceSelector implements IElementSelector {
fTree.getViewer().getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if(contentProvider != null) {
fTree.getViewer().setContentProvider(contentProvider);
- fTree.getViewer().setInput("");
+ fTree.getViewer().setInput(""); //$NON-NLS-1$
}
if(labelProvider != null) {
fTree.getViewer().setLabelProvider(labelProvider);
@@ -248,12 +254,34 @@ public class ReferenceSelector implements IElementSelector {
}
}
});
+
+ //Adds double-click support
+ fTree.getViewer().getTree().addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ // Nothing
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ if(!elementSelectionListeners.isEmpty()) {
+ Object[] selectedElements = getSelectedElements();
+ for(IElementSelectionListener listener : elementSelectionListeners) {
+ listener.addElements(selectedElements);
+ }
+ }
+ }
+
+ });
}
public void setUnique(boolean unique) {
this.unique = unique;
}
+ public void addElementSelectionListener(IElementSelectionListener listener) {
+ elementSelectionListeners.add(listener);
+ }
+
// /**
// * A Text field to let the user type its own filter
// *
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StandardSelector.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StandardSelector.java
index 2c36accdd80..359427ac86d 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StandardSelector.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StandardSelector.java
@@ -12,10 +12,15 @@
package org.eclipse.papyrus.widgets.selectors;
import java.lang.reflect.Constructor;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.runtime.Assert;
import org.eclipse.papyrus.widgets.Activator;
+import org.eclipse.papyrus.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.widgets.editors.AbstractValueEditor;
+import org.eclipse.papyrus.widgets.editors.ICommitListener;
+import org.eclipse.papyrus.widgets.editors.IElementSelectionListener;
import org.eclipse.papyrus.widgets.editors.IElementSelector;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
@@ -35,10 +40,12 @@ public class StandardSelector implements IElementSelector {
private Class<? extends AbstractValueEditor> editorClass;
/**
- * The AbstractValueEditor used by this selecotr
+ * The AbstractValueEditor used by this selector
*/
private AbstractValueEditor editor;
+ private Set<IElementSelectionListener> elementSelectionListeners = new HashSet<IElementSelectionListener>();
+
/**
* Instantiates this selector, using the specified editor class
*
@@ -85,6 +92,18 @@ public class StandardSelector implements IElementSelector {
try {
Constructor<? extends AbstractValueEditor> construct = editorClass.getDeclaredConstructor(Composite.class, Integer.TYPE);
editor = construct.newInstance(parent, SWT.BORDER);
+ editor.addCommitListener(new ICommitListener() {
+
+ public void commit(AbstractEditor editor) {
+ if(!elementSelectionListeners.isEmpty()) {
+ Object value = StandardSelector.this.editor.getValue();
+ for(IElementSelectionListener listener : elementSelectionListeners) {
+ listener.addElements(new Object[]{ value });
+ }
+ }
+ }
+
+ });
} catch (Exception ex) {
Activator.log.error(ex);
}
@@ -98,4 +117,8 @@ public class StandardSelector implements IElementSelector {
//Ignored
}
+ public void addElementSelectionListener(IElementSelectionListener listener) {
+ elementSelectionListeners.add(listener);
+ }
+
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StringSelector.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StringSelector.java
index 94b40eb000b..af98b04fba8 100644
--- a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StringSelector.java
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/selectors/StringSelector.java
@@ -11,8 +11,14 @@
*****************************************************************************/
package org.eclipse.papyrus.widgets.selectors;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.papyrus.widgets.editors.IElementSelectionListener;
import org.eclipse.papyrus.widgets.editors.IElementSelector;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
@@ -37,6 +43,8 @@ public class StringSelector implements IElementSelector {
*/
protected boolean multiline;
+ protected Set<IElementSelectionListener> elementSelectionListeners = new HashSet<IElementSelectionListener>();
+
/**
* Constructs a single-line String Selector
*/
@@ -77,6 +85,28 @@ public class StringSelector implements IElementSelector {
*/
public void createControls(Composite parent) {
text = new Text(parent, (multiline ? SWT.MULTI : SWT.NONE) | SWT.BORDER);
+ if(!multiline) {
+ text.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+ //Nothing
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if((e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) && e.stateMask == SWT.NONE) {
+ if(!elementSelectionListeners.isEmpty()) {
+ Object[] result = getSelectedElements();
+ if(!result[0].equals("")) { //$NON-NLS-1$
+ for(IElementSelectionListener listener : elementSelectionListeners) {
+ listener.addElements(result);
+ }
+ }
+ }
+ }
+ }
+
+ });
+ }
}
/**
@@ -101,4 +131,8 @@ public class StringSelector implements IElementSelector {
public void clearTemporaryElements() {
//Ignored
}
+
+ public void addElementSelectionListener(IElementSelectionListener listener) {
+ elementSelectionListeners.add(listener);
+ }
}
diff --git a/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/util/FileUtil.java b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/util/FileUtil.java
new file mode 100644
index 00000000000..de096645357
--- /dev/null
+++ b/plugins/core/org.eclipse.papyrus.widgets/src/org/eclipse/papyrus/widgets/util/FileUtil.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * 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.widgets.util;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.papyrus.widgets.Activator;
+
+
+public class FileUtil {
+
+ public static String getPath(IFile file, boolean absolute) {
+ if(absolute) {
+ return file.getLocation().toString();
+ }
+ return file.getFullPath().toString();
+ }
+
+ public static IFile getIFile(String location) {
+ //Search the file in the workspace
+ IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot();
+ IPath path = new Path(location);
+ IFile currentFile = null;
+ try {
+ currentFile = workspace.getFile(path);
+ } catch (IllegalArgumentException ex) {
+ //Ignore
+ }
+
+ //Then search it on the disk
+ if(currentFile == null || !currentFile.exists()) {
+ currentFile = workspace.getFileForLocation(path);
+ }
+
+ return currentFile;
+ }
+
+ public static File getFile(String location) {
+ IFile iFile = getIFile(location);
+ if(iFile == null || !iFile.exists()) {
+ return new File(location);
+ }
+
+ return new File(iFile.getLocationURI());
+ }
+
+ public static File getWorkspaceFile(String location) {
+ IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot();
+ IPath path = new Path(location);
+ IFile currentFile = null;
+ try {
+ currentFile = workspace.getFile(path);
+ } catch (IllegalArgumentException ex) {
+ Activator.log.error(ex);
+ return null;
+ }
+
+ return currentFile.getLocation().toFile();
+ }
+}

Back to the top