Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2015-06-03 07:59:16 -0400
committerCamille Letavernier2015-06-04 09:41:47 -0400
commitad69d08a4166c1e7f7cc9c7e26ca0844d3c05dab (patch)
treef0f5ac2e1f7f828afdc24f919fa93c3d09c1451a /plugins/views/properties
parentc45a373b6a73d5aeb79d1f7f473f75fedf457be2 (diff)
downloadorg.eclipse.papyrus-ad69d08a4166c1e7f7cc9c7e26ca0844d3c05dab.tar.gz
org.eclipse.papyrus-ad69d08a4166c1e7f7cc9c7e26ca0844d3c05dab.tar.xz
org.eclipse.papyrus-ad69d08a4166c1e7f7cc9c7e26ca0844d3c05dab.zip
Bug 469247 - [View] it shall be possible for Property views defined by
plugin to be unapply by default. https://bugs.eclipse.org/bugs/show_bug.cgi?id=469247 Change-Id: I3a2e1ed7ba65af07749fd940f8f7eb3735ac4dad Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net> Reviewed-on: https://git.eclipse.org/r/49347 Tested-by: Hudson CI Reviewed-by: Gabriel Pascual <gabriel.pascual@all4tec.net> Reviewed-by: Camille Letavernier <camille.letavernier@cea.fr>
Diffstat (limited to 'plugins/views/properties')
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/META-INF/MANIFEST.MF10
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.ecore1
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.genmodel1
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/schema/context.exsd7
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/ContextDescriptor.java47
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/Preferences.java4
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/PreferencesPackage.java61
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/ContextDescriptorImpl.java61
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesImpl.java2
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesPackageImpl.java30
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/util/PreferencesAdapterFactory.java6
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/extensions/ContextExtensionPoint.java28
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java2
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java68
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/PreferencesMigrator.java15
15 files changed, 278 insertions, 65 deletions
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/META-INF/MANIFEST.MF b/plugins/views/properties/org.eclipse.papyrus.views.properties/META-INF/MANIFEST.MF
index 903416303f8..92c66e02257 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/META-INF/MANIFEST.MF
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/META-INF/MANIFEST.MF
@@ -11,7 +11,10 @@ Export-Package: org.eclipse.papyrus.views.properties,
org.eclipse.papyrus.views.properties.util,
org.eclipse.papyrus.views.properties.widgets,
org.eclipse.papyrus.views.properties.widgets.layout,
- org.eclipse.papyrus.views.properties.xwt
+ org.eclipse.papyrus.views.properties.xwt,
+ org.eclipse.papyrus.views.properties.runtime.preferences,
+ org.eclipse.papyrus.views.properties.runtime.preferences.impl,
+ org.eclipse.papyrus.views.properties.runtime.preferences.util
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
bin
@@ -19,7 +22,7 @@ Bundle-Name: %pluginName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.emf;bundle-version="2.6.0",
- org.eclipse.emf.ecore;bundle-version="2.6.0",
+ org.eclipse.emf.ecore;bundle-version="2.6.0";visibility:=reexport,
org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
org.eclipse.emf.databinding;bundle-version="1.2.0",
org.eclipse.ui;bundle-version="3.6.0",
@@ -50,6 +53,5 @@ Bundle-Version: 1.1.0.qualifier
Eclipse-BuddyPolicy: dependent
Bundle-Activator: org.eclipse.papyrus.views.properties.Activator
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.views.properties;singleton:=t
- rue
+Bundle-SymbolicName: org.eclipse.papyrus.views.properties;singleton:=true
Bundle-Description: %pluginDescription
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.ecore b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.ecore
index ddec7991f0c..a8433b6fcf6 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.ecore
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.ecore
@@ -17,6 +17,7 @@
<details key="documentation" value="Whether the context was explicitly deleted by the user. If not explicitly deleted, and there isn't currently a matching context available, then the context is deemed to be missing."/>
</eAnnotations>
</eStructuralFeatures>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="appliedByDefault" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Preferences">
<eStructuralFeatures xsi:type="ecore:EReference" name="contexts" upperBound="-1"
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.genmodel b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.genmodel
index 1c8637224cf..f7fe329a5ee 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.genmodel
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Preferences.genmodel
@@ -14,6 +14,7 @@
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Preferences.ecore#//ContextDescriptor/applied"/>
<genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Preferences.ecore#//ContextDescriptor/prototype"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute Preferences.ecore#//ContextDescriptor/deleted"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Preferences.ecore#//ContextDescriptor/appliedByDefault"/>
</genClasses>
<genClasses ecoreClass="Preferences.ecore#//Preferences">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference Preferences.ecore#//Preferences/contexts"/>
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/context.exsd b/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/context.exsd
index 20feaf5e27d..1a8c125efa6 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/context.exsd
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/schema/context.exsd
@@ -66,6 +66,13 @@
</documentation>
</annotation>
</attribute>
+ <attribute name="appliedByDefault" type="boolean">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/ContextDescriptor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/ContextDescriptor.java
index d2669191b64..c5933a8b9fe 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/ContextDescriptor.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/ContextDescriptor.java
@@ -21,13 +21,14 @@ import org.eclipse.emf.ecore.EObject;
*
* <p>
* The following features are supported:
+ * </p>
* <ul>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isApplied <em>Applied</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getPrototype <em>Prototype</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isDeleted <em>Deleted</em>}</li>
+ * <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isAppliedByDefault <em>Applied By Default</em>}</li>
* </ul>
- * </p>
*
* @see org.eclipse.papyrus.views.properties.runtime.preferences.PreferencesPackage#getContextDescriptor()
* @model
@@ -81,8 +82,7 @@ public interface ContextDescriptor extends EObject {
boolean isApplied();
/**
- * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isApplied <em>Applied</em>}'
- * attribute.
+ * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isApplied <em>Applied</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -98,8 +98,7 @@ public interface ContextDescriptor extends EObject {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
- * References the descriptor of the context from which a context was copied. This allows the configuration manager to apply the original context
- * when the copy is not available. This process is recursive over a chain of missing prototypes.
+ * References the descriptor of the context from which a context was copied. This allows the configuration manager to apply the original context when the copy is not available. This process is recursive over a chain of missing prototypes.
* <!-- end-model-doc -->
*
* @return the value of the '<em>Prototype</em>' reference.
@@ -111,8 +110,7 @@ public interface ContextDescriptor extends EObject {
ContextDescriptor getPrototype();
/**
- * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getPrototype <em>Prototype</em>}'
- * reference.
+ * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getPrototype <em>Prototype</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -128,8 +126,7 @@ public interface ContextDescriptor extends EObject {
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
- * Whether the context was explicitly deleted by the user. If not explicitly deleted, and there isn't currently a matching context available, then
- * the context is deemed to be missing.
+ * Whether the context was explicitly deleted by the user. If not explicitly deleted, and there isn't currently a matching context available, then the context is deemed to be missing.
* <!-- end-model-doc -->
*
* @return the value of the '<em>Deleted</em>' attribute.
@@ -141,8 +138,7 @@ public interface ContextDescriptor extends EObject {
boolean isDeleted();
/**
- * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isDeleted <em>Deleted</em>}'
- * attribute.
+ * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isDeleted <em>Deleted</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -153,4 +149,33 @@ public interface ContextDescriptor extends EObject {
*/
void setDeleted(boolean value);
+ /**
+ * Returns the value of the '<em><b>Applied By Default</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Applied By Default</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ *
+ * @return the value of the '<em>Applied By Default</em>' attribute.
+ * @see #setAppliedByDefault(boolean)
+ * @see org.eclipse.papyrus.views.properties.runtime.preferences.PreferencesPackage#getContextDescriptor_AppliedByDefault()
+ * @model
+ * @generated
+ */
+ boolean isAppliedByDefault();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isAppliedByDefault <em>Applied By Default</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @param value
+ * the new value of the '<em>Applied By Default</em>' attribute.
+ * @see #isAppliedByDefault()
+ * @generated
+ */
+ void setAppliedByDefault(boolean value);
+
} // ContextDescriptor
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/Preferences.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/Preferences.java
index cfe2d5657d7..ebf2c38c94b 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/Preferences.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/Preferences.java
@@ -22,11 +22,11 @@ import org.eclipse.emf.ecore.EObject;
*
* <p>
* The following features are supported:
+ * </p>
* <ul>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences#getContexts <em>Contexts</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences#getVersion <em>Version</em>}</li>
* </ul>
- * </p>
*
* @see org.eclipse.papyrus.views.properties.runtime.preferences.PreferencesPackage#getPreferences()
* @model
@@ -39,7 +39,7 @@ public interface Preferences extends EObject {
*
* @generated NOT
*/
- int CURRENT_VERSION = 2;
+ int CURRENT_VERSION = 3;
/**
* Returns the value of the '<em><b>Contexts</b></em>' containment reference list.
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/PreferencesPackage.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/PreferencesPackage.java
index 2b62c23e5cc..214a2a18c17 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/PreferencesPackage.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/PreferencesPackage.java
@@ -73,8 +73,7 @@ public interface PreferencesPackage extends EPackage {
PreferencesPackage eINSTANCE = org.eclipse.papyrus.views.properties.runtime.preferences.impl.PreferencesPackageImpl.init();
/**
- * The meta object id for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl
- * <em>Context Descriptor</em>}' class.
+ * The meta object id for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl <em>Context Descriptor</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -125,6 +124,16 @@ public interface PreferencesPackage extends EPackage {
int CONTEXT_DESCRIPTOR__DELETED = 3;
/**
+ * The feature id for the '<em><b>Applied By Default</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ * @ordered
+ */
+ int CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT = 4;
+
+ /**
* The number of structural features of the '<em>Context Descriptor</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -132,7 +141,7 @@ public interface PreferencesPackage extends EPackage {
* @generated
* @ordered
*/
- int CONTEXT_DESCRIPTOR_FEATURE_COUNT = 4;
+ int CONTEXT_DESCRIPTOR_FEATURE_COUNT = 5;
/**
* The meta object id for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.PreferencesImpl <em>Preferences</em>}' class.
@@ -177,8 +186,7 @@ public interface PreferencesPackage extends EPackage {
/**
- * Returns the meta object for class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor
- * <em>Context Descriptor</em>}'.
+ * Returns the meta object for class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor <em>Context Descriptor</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -189,8 +197,7 @@ public interface PreferencesPackage extends EPackage {
EClass getContextDescriptor();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getName
- * <em>Name</em>}'.
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -202,8 +209,7 @@ public interface PreferencesPackage extends EPackage {
EAttribute getContextDescriptor_Name();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isApplied
- * <em>Applied</em>}'.
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isApplied <em>Applied</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -215,8 +221,7 @@ public interface PreferencesPackage extends EPackage {
EAttribute getContextDescriptor_Applied();
/**
- * Returns the meta object for the reference '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getPrototype
- * <em>Prototype</em>}'.
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#getPrototype <em>Prototype</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -228,8 +233,7 @@ public interface PreferencesPackage extends EPackage {
EReference getContextDescriptor_Prototype();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isDeleted
- * <em>Deleted</em>}'.
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isDeleted <em>Deleted</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -241,6 +245,18 @@ public interface PreferencesPackage extends EPackage {
EAttribute getContextDescriptor_Deleted();
/**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isAppliedByDefault <em>Applied By Default</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return the meta object for the attribute '<em>Applied By Default</em>'.
+ * @see org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor#isAppliedByDefault()
+ * @see #getContextDescriptor()
+ * @generated
+ */
+ EAttribute getContextDescriptor_AppliedByDefault();
+
+ /**
* Returns the meta object for class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences <em>Preferences</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -252,7 +268,7 @@ public interface PreferencesPackage extends EPackage {
EClass getPreferences();
/**
- * Returns the meta object for the containment reference list ' {@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences#getContexts <em>Contexts</em>}'.
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences#getContexts <em>Contexts</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -264,8 +280,7 @@ public interface PreferencesPackage extends EPackage {
EReference getPreferences_Contexts();
/**
- * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences#getVersion
- * <em>Version</em>}'.
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences#getVersion <em>Version</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -302,8 +317,7 @@ public interface PreferencesPackage extends EPackage {
interface Literals {
/**
- * The meta object literal for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl
- * <em>Context Descriptor</em>}' class.
+ * The meta object literal for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl <em>Context Descriptor</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -350,7 +364,16 @@ public interface PreferencesPackage extends EPackage {
EAttribute CONTEXT_DESCRIPTOR__DELETED = eINSTANCE.getContextDescriptor_Deleted();
/**
- * The meta object literal for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.PreferencesImpl <em>Preferences</em>} ' class.
+ * The meta object literal for the '<em><b>Applied By Default</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ EAttribute CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT = eINSTANCE.getContextDescriptor_AppliedByDefault();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.PreferencesImpl <em>Preferences</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/ContextDescriptorImpl.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/ContextDescriptorImpl.java
index 0b94c037fbf..0c73d80ec63 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/ContextDescriptorImpl.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/ContextDescriptorImpl.java
@@ -26,13 +26,14 @@ import org.eclipse.papyrus.views.properties.runtime.preferences.PreferencesPacka
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
+ * </p>
* <ul>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl#isApplied <em>Applied</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl#getPrototype <em>Prototype</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl#isDeleted <em>Deleted</em>}</li>
+ * <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.ContextDescriptorImpl#isAppliedByDefault <em>Applied By Default</em>}</li>
* </ul>
- * </p>
*
* @generated
*/
@@ -116,6 +117,28 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
protected boolean deleted = DELETED_EDEFAULT;
/**
+ * The default value of the '{@link #isAppliedByDefault() <em>Applied By Default</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #isAppliedByDefault()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean APPLIED_BY_DEFAULT_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isAppliedByDefault() <em>Applied By Default</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @see #isAppliedByDefault()
+ * @generated
+ * @ordered
+ */
+ protected boolean appliedByDefault = APPLIED_BY_DEFAULT_EDEFAULT;
+
+ /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
@@ -257,6 +280,30 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
*
* @generated
*/
+ public boolean isAppliedByDefault() {
+ return appliedByDefault;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setAppliedByDefault(boolean newAppliedByDefault) {
+ boolean oldAppliedByDefault = appliedByDefault;
+ appliedByDefault = newAppliedByDefault;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET, PreferencesPackage.CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT, oldAppliedByDefault, appliedByDefault));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
@@ -271,6 +318,8 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
return basicGetPrototype();
case PreferencesPackage.CONTEXT_DESCRIPTOR__DELETED:
return isDeleted();
+ case PreferencesPackage.CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT:
+ return isAppliedByDefault();
}
return super.eGet(featureID, resolve, coreType);
}
@@ -296,6 +345,9 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
case PreferencesPackage.CONTEXT_DESCRIPTOR__DELETED:
setDeleted((Boolean) newValue);
return;
+ case PreferencesPackage.CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT:
+ setAppliedByDefault((Boolean) newValue);
+ return;
}
super.eSet(featureID, newValue);
}
@@ -321,6 +373,9 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
case PreferencesPackage.CONTEXT_DESCRIPTOR__DELETED:
setDeleted(DELETED_EDEFAULT);
return;
+ case PreferencesPackage.CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT:
+ setAppliedByDefault(APPLIED_BY_DEFAULT_EDEFAULT);
+ return;
}
super.eUnset(featureID);
}
@@ -342,6 +397,8 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
return prototype != null;
case PreferencesPackage.CONTEXT_DESCRIPTOR__DELETED:
return deleted != DELETED_EDEFAULT;
+ case PreferencesPackage.CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT:
+ return appliedByDefault != APPLIED_BY_DEFAULT_EDEFAULT;
}
return super.eIsSet(featureID);
}
@@ -365,6 +422,8 @@ public class ContextDescriptorImpl extends EObjectImpl implements ContextDescrip
result.append(applied);
result.append(", deleted: ");
result.append(deleted);
+ result.append(", appliedByDefault: ");
+ result.append(appliedByDefault);
result.append(')');
return result.toString();
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesImpl.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesImpl.java
index a21e5d8082c..9a5b8c0ce27 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesImpl.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesImpl.java
@@ -33,11 +33,11 @@ import org.eclipse.papyrus.views.properties.runtime.preferences.PreferencesPacka
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
+ * </p>
* <ul>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.PreferencesImpl#getContexts <em>Contexts</em>}</li>
* <li>{@link org.eclipse.papyrus.views.properties.runtime.preferences.impl.PreferencesImpl#getVersion <em>Version</em>}</li>
* </ul>
- * </p>
*
* @generated
*/
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesPackageImpl.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesPackageImpl.java
index dfa934bb34b..b3933dbc203 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesPackageImpl.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/impl/PreferencesPackageImpl.java
@@ -49,11 +49,15 @@ public class PreferencesPackageImpl extends EPackageImpl implements PreferencesP
private EClass preferencesEClass = null;
/**
- * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the
- * package
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>
- * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also performs initialization of the package, or returns the registered package, if one already exists. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see org.eclipse.papyrus.views.properties.runtime.preferences.PreferencesPackage#eNS_URI
@@ -76,7 +80,9 @@ public class PreferencesPackageImpl extends EPackageImpl implements PreferencesP
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>
- * This method is used to initialize {@link PreferencesPackage#eINSTANCE} when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. <!-- begin-user-doc --> <!-- end-user-doc -->
+ * This method is used to initialize {@link PreferencesPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @see #eNS_URI
* @see #createPackageContents()
@@ -164,6 +170,16 @@ public class PreferencesPackageImpl extends EPackageImpl implements PreferencesP
*
* @generated
*/
+ public EAttribute getContextDescriptor_AppliedByDefault() {
+ return (EAttribute) contextDescriptorEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
public EClass getPreferences() {
return preferencesEClass;
}
@@ -226,6 +242,7 @@ public class PreferencesPackageImpl extends EPackageImpl implements PreferencesP
createEAttribute(contextDescriptorEClass, CONTEXT_DESCRIPTOR__APPLIED);
createEReference(contextDescriptorEClass, CONTEXT_DESCRIPTOR__PROTOTYPE);
createEAttribute(contextDescriptorEClass, CONTEXT_DESCRIPTOR__DELETED);
+ createEAttribute(contextDescriptorEClass, CONTEXT_DESCRIPTOR__APPLIED_BY_DEFAULT);
preferencesEClass = createEClass(PREFERENCES);
createEReference(preferencesEClass, PREFERENCES__CONTEXTS);
@@ -269,9 +286,10 @@ public class PreferencesPackageImpl extends EPackageImpl implements PreferencesP
initEClass(contextDescriptorEClass, ContextDescriptor.class, "ContextDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getContextDescriptor_Name(), ecorePackage.getEString(), "name", null, 1, 1, ContextDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getContextDescriptor_Applied(), ecorePackage.getEBoolean(), "applied", "true", 1, 1, ContextDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getContextDescriptor_Prototype(), this.getContextDescriptor(), null, "prototype", null, 0, 1, ContextDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE,
- !IS_DERIVED, IS_ORDERED);
+ initEReference(getContextDescriptor_Prototype(), this.getContextDescriptor(), null, "prototype", null, 0, 1, ContextDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED,
+ IS_ORDERED);
initEAttribute(getContextDescriptor_Deleted(), ecorePackage.getEBoolean(), "deleted", null, 1, 1, ContextDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getContextDescriptor_AppliedByDefault(), ecorePackage.getEBoolean(), "appliedByDefault", null, 0, 1, ContextDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(preferencesEClass, Preferences.class, "Preferences", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getPreferences_Contexts(), this.getContextDescriptor(), null, "contexts", null, 0, -1, Preferences.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/util/PreferencesAdapterFactory.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/util/PreferencesAdapterFactory.java
index 94fc4f52255..4d946e5930d 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/util/PreferencesAdapterFactory.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src-gen/org/eclipse/papyrus/views/properties/runtime/preferences/util/PreferencesAdapterFactory.java
@@ -81,7 +81,6 @@ public class PreferencesAdapterFactory extends AdapterFactoryImpl {
* @generated
*/
protected PreferencesSwitch<Adapter> modelSwitch = new PreferencesSwitch<Adapter>() {
-
@Override
public Adapter caseContextDescriptor(ContextDescriptor object) {
return createContextDescriptorAdapter();
@@ -115,8 +114,7 @@ public class PreferencesAdapterFactory extends AdapterFactoryImpl {
/**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor
- * <em>Context Descriptor</em>}'.
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor <em>Context Descriptor</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
@@ -131,7 +129,7 @@ public class PreferencesAdapterFactory extends AdapterFactoryImpl {
}
/**
- * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences <em>Preferences</em>} '.
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.views.properties.runtime.preferences.Preferences <em>Preferences</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/extensions/ContextExtensionPoint.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/extensions/ContextExtensionPoint.java
index de5b1884f1a..bf54e07569d 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/extensions/ContextExtensionPoint.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/extensions/ContextExtensionPoint.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2015 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,8 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - adds isVisible implementation
+ *
*****************************************************************************/
package org.eclipse.papyrus.views.properties.extensions;
@@ -28,6 +30,14 @@ import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
*/
public class ContextExtensionPoint {
+
+ /** The Constant IS_CUSTOMIZABLE. */
+ private static final String IS_CUSTOMIZABLE = "isCustomizable";//$NON-NLS-1$
+
+ /** The Constant IS_VISIBLE. */
+ private static final String APPLIED_BY_DEFAULT = "appliedByDefault";//$NON-NLS-1$
+
+ /** The extension id. */
private final String EXTENSION_ID = "org.eclipse.papyrus.views.properties.context"; //$NON-NLS-1$
/**
@@ -41,15 +51,23 @@ public class ContextExtensionPoint {
final String contextResource = e.getAttribute("contextModel"); //$NON-NLS-1$
final boolean isCustomizable;
- if (Arrays.asList(e.getAttributeNames()).contains("isCustomizable")) {
- isCustomizable = Boolean.parseBoolean(e.getAttribute("isCustomizable")); //$NON-NLS-1$
+ if (Arrays.asList(e.getAttributeNames()).contains(IS_CUSTOMIZABLE)) {
+ isCustomizable = Boolean.parseBoolean(e.getAttribute(IS_CUSTOMIZABLE));
} else {
isCustomizable = true; // Default value
}
+
+ final boolean appliedByDefault;
+ if (Arrays.asList(e.getAttributeNames()).contains(APPLIED_BY_DEFAULT)) {
+ appliedByDefault = Boolean.parseBoolean(e.getAttribute(APPLIED_BY_DEFAULT));
+ } else {
+ appliedByDefault = true; // Default value
+ }
+
URI uri = URI.createURI("ppe:/context/" + e.getContributor().getName() + "/" + contextResource); //$NON-NLS-1$ //$NON-NLS-2$
- //URI uri = URI.createPlatformPluginURI(e.getContributor().getName() + "/" + contextResource, true); //$NON-NLS-1$
- ConfigurationManager.getInstance().addContext(uri, isCustomizable);
+ ConfigurationManager.getInstance().addContext(uri, appliedByDefault, isCustomizable);
+
} catch (IOException ex) {
Activator.log.error("The plugin " + e.getContributor() + " contributed an invalid extension for " + EXTENSION_ID, ex); //$NON-NLS-1$//$NON-NLS-2$
} catch (Exception ex) {
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java
index f27ef3b7a3e..990a7a1cffb 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/preferences/Preferences.java
@@ -107,7 +107,7 @@ public class Preferences extends PreferencePage implements IWorkbenchPreferenceP
@Override
public void performDefaults() {
for (Context context : ConfigurationManager.getInstance().getContexts()) {
- boolean applied = ConfigurationManager.getInstance().isPlugin(context);
+ boolean applied = ConfigurationManager.getInstance().isAppliedByDefault(context);
Button checkbox = checkboxes.get(context);
if (checkbox != null) {
checkbox.setSelection(applied);
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java
index 6aada05ec73..29283c9ba88 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/ConfigurationManager.java
@@ -359,7 +359,7 @@ public class ConfigurationManager {
*
* @param context
* @return
- * true if the given context is enabled.
+ * true if the given context is enabled.
*
* @see Preferences
*/
@@ -444,27 +444,73 @@ public class ConfigurationManager {
}
/**
+ * Return true if the context has a desciptor.
+ *
+ * @param context
+ * @return
+ */
+ private boolean hasDescriptor(Context context) {
+ Boolean value = false;
+
+ if ((context.getName() != null && !context.getName().equals(""))) { //$NON-NLS-1$
+
+ Iterator<ContextDescriptor> contextIterator = preferences.getContexts().iterator();
+ while (contextIterator.hasNext() && !value) {
+ if (contextIterator.next().getName().equals(context.getName())) {
+ value = true;
+ }
+ }
+ }
+ return value;
+ }
+
+ /**
* Adds a context via its URI. The URI should represent a valid Context model.
* The model is loaded in the ConfigurationManager's resourceSet.
*
* @param uri
* The context's URI
+ * @param customizable
+ * if is customizable
* @throws IOException
* If the model behind this URI is not a valid Context
*/
public void addContext(URI uri, boolean customizable) throws IOException {
+ addContext(uri, true, customizable);
+ }
+
+ /**
+ * Adds a context via its URI. The URI should represent a valid Context model.
+ * The model is loaded in the ConfigurationManager's resourceSet.
+ *
+ * @param uri
+ * The context's URI
+ * @param appliedByDefault
+ * if is applied by default
+ * @param customizable
+ * if is customizable
+ * @throws IOException
+ * If the model behind this URI is not a valid Context
+ */
+ public void addContext(URI uri, boolean appliedByDefault, boolean customizable) throws IOException {
EObject firstRootObject = loadEMFModel(uri);
if (firstRootObject != null) {
for (EObject rootObject : firstRootObject.eResource().getContents()) {
if (rootObject instanceof Context) {
Context context = (Context) rootObject;
- addContext(context, findDescriptor(context).isApplied(), customizable);
+ addContext(context, hasDescriptor(context) ? findDescriptor(context).isApplied() : appliedByDefault, customizable);
+
+ findDescriptor(context).setAppliedByDefault(appliedByDefault);
}
}
}
}
+ public Boolean isAppliedByDefault(Context context) {
+ return findDescriptor(context).isAppliedByDefault();
+ }
+
/**
* Adds a context via its URI. The URI should represent a valid Context model.
* The model is loaded in the ConfigurationManager's resourceSet.
@@ -475,7 +521,7 @@ public class ConfigurationManager {
* If the model behind this URI is not a valid Context
*/
public void addContext(URI uri) throws IOException {
- addContext(uri, true);
+ addContext(uri, true, true);
}
/**
@@ -654,7 +700,7 @@ public class ConfigurationManager {
*
* @param context
* @return
- * True if the context comes from a plugin, and is thus read-only
+ * True if the context comes from a plugin, and is thus read-only
*/
public boolean isPlugin(Context context) {
// a missing context can't be a plug-in context because plug-ins can't go missing
@@ -680,7 +726,7 @@ public class ConfigurationManager {
* @param uri
* The URI from which the Context is loaded
* @return
- * The loaded context
+ * The loaded context
* @throws IOException
* If the URI doesn't represent a valid Context model
*/
@@ -707,7 +753,7 @@ public class ConfigurationManager {
/**
* @return
- * The PropertiesRoot for the Property view framework. The PropertiesRoot contains
+ * The PropertiesRoot for the Property view framework. The PropertiesRoot contains
* all registered Environments and Contexts (Whether they are enabled or disabled)
*/
public PropertiesRoot getPropertiesRoot() {
@@ -720,7 +766,7 @@ public class ConfigurationManager {
* @param contextName
* The name of the context to retrieve
* @return
- * The context corresponding to the given name
+ * The context corresponding to the given name
*/
public Context getContext(String contextName) {
for (Context context : getContexts()) {
@@ -888,7 +934,7 @@ public class ConfigurationManager {
/**
* @param name
* @return
- * The namespace corresponding to the given name
+ * The namespace corresponding to the given name
*/
public Namespace getNamespaceByName(String name) {
for (Environment environment : root.getEnvironments()) {
@@ -905,7 +951,7 @@ public class ConfigurationManager {
/**
* @param property
* @return
- * the default PropertyEditorType for the given Property
+ * the default PropertyEditorType for the given Property
*/
public PropertyEditorType getDefaultEditorType(Property property) {
return getDefaultEditorType(property.getType(), property.getMultiplicity() != 1);
@@ -987,7 +1033,7 @@ public class ConfigurationManager {
* @param propertyPath
* @param context
* @return
- * The property associated to the given propertyPath
+ * The property associated to the given propertyPath
*/
public Property getProperty(String propertyPath, Context context) {
String elementName = propertyPath.substring(0, propertyPath.lastIndexOf(":")); //$NON-NLS-1$
@@ -1032,7 +1078,7 @@ public class ConfigurationManager {
* be displayed at the same time
*
* @return
- * The list of conflicts
+ * The list of conflicts
*/
public Collection<ConfigurationConflict> checkConflicts() {
Map<String, List<Context>> sections = new HashMap<String, List<Context>>();
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/PreferencesMigrator.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/PreferencesMigrator.java
index 5bcf729cb77..ccafcc8077f 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/PreferencesMigrator.java
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/runtime/PreferencesMigrator.java
@@ -18,6 +18,7 @@ import java.util.Locale;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.views.properties.Activator;
+import org.eclipse.papyrus.views.properties.contexts.Context;
import org.eclipse.papyrus.views.properties.runtime.preferences.ContextDescriptor;
import org.eclipse.papyrus.views.properties.runtime.preferences.Preferences;
@@ -91,4 +92,18 @@ class PreferencesMigrator {
}
}
}
+
+ void migrateFrom2To3(Preferences preferences) {
+ // new version3 introduce appliedByDefault, by default only context defined by plugin are applied
+ for (ContextDescriptor next : new java.util.ArrayList<ContextDescriptor>(preferences.getContexts())) {
+ Context context = manager.getContext(next.getName());
+ if (context != null) {
+ if (ConfigurationManager.getInstance().isPlugin(context)) {
+ next.setAppliedByDefault(true);
+ } else {
+ next.setAppliedByDefault(false);
+ }
+ }
+ }
+ }
}

Back to the top