diff options
author | Pauline DEVILLE | 2017-09-06 13:19:41 +0000 |
---|---|---|
committer | Benoit Maggi | 2017-09-07 15:18:28 +0000 |
commit | a19b14e596cbd8f2a6cac3e4bf5b7d05caa4b643 (patch) | |
tree | 2b0a4ac7230970dc5f20d230e5e0493400a4763b | |
parent | b17beb38df83897cc36857678365d1ebc0eeaf30 (diff) | |
download | org.eclipse.papyrus-a19b14e596cbd8f2a6cac3e4bf5b7d05caa4b643.tar.gz org.eclipse.papyrus-a19b14e596cbd8f2a6cac3e4bf5b7d05caa4b643.tar.xz org.eclipse.papyrus-a19b14e596cbd8f2a6cac3e4bf5b7d05caa4b643.zip |
Bug 519870 - [Wizard] Template-Transformation should provide an option
to be checked by default
*add option in template extention point to check by default
*check by default for UML Primitive type
Change-Id: Ifc742e430c912a0fddde5b9e09854b1c0b5d5d6c
Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
6 files changed, 109 insertions, 35 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/schema/templates.exsd b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/schema/templates.exsd index abae969166d..185396c9ba9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/schema/templates.exsd +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/schema/templates.exsd @@ -139,7 +139,7 @@ <attribute name="language" type="string" use="required"> <annotation> <documentation> - + Reference the id of the architecture framework </documentation> </annotation> </attribute> @@ -153,6 +153,13 @@ </appinfo> </annotation> </attribute> + <attribute name="selectedByDefault" type="boolean" use="default" value="false"> + <annotation> + <documentation> + Define if it is selected by default or not + </documentation> + </annotation> + </attribute> </complexType> </element> @@ -161,7 +168,7 @@ <meta.section type="since"/> </appinfo> <documentation> - [Enter the first release in which this extension point appears.] + 1.0.0 </documentation> </annotation> @@ -172,9 +179,25 @@ <meta.section type="implementation"/> </appinfo> <documentation> - [Enter information about supplied implementation of this extension point.] + /org.eclipse.papyrus.uml.templaterepository/plugin.xml </documentation> </annotation> + <annotation> + <appinfo> + <meta.section type="copyright"/> + </appinfo> + <documentation> + /***************************************************************************** + * 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 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + *****************************************************************************/ + </documentation> + </annotation> </schema> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/AbstractModelTemplateContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/AbstractModelTemplateContentProvider.java index ea6ff33a21a..e985b18f36f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/AbstractModelTemplateContentProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/AbstractModelTemplateContentProvider.java @@ -46,6 +46,8 @@ public abstract class AbstractModelTemplateContentProvider implements IStructure protected static final String TRANSFO_URI = "Transformation_URI"; //$NON-NLS-1$
+ protected static final String SELECT_BY_DEFAULT = "selectedByDefault"; //$NON-NLS-1$
+
/** The my template descriptions. */
protected ModelTemplateDescription[] myTemplateDescriptions;
@@ -98,6 +100,7 @@ public abstract class AbstractModelTemplateContentProvider implements IStructure configElement.getAttribute(ATTRIBUTE_NOTATION_FILE), configElement.getAttribute(ATTRIBUTE_DI_FILE));
template.setLanguage(configElement.getAttribute(ATTRIBUTE_LANGUAGE));
template.setTransfo(configElement.getAttribute(TRANSFO_URI));
+ template.setSelectedByDefault(Boolean.valueOf(configElement.getAttribute(SELECT_BY_DEFAULT)));
templates.add(template);
}
return templates;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateCheckStateProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateCheckStateProvider.java new file mode 100644 index 00000000000..5d65bfb2eb5 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateCheckStateProvider.java @@ -0,0 +1,49 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pauline DEVILLE (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.wizards.template; + +import org.eclipse.jface.viewers.ICheckStateProvider; + +/** + * This Provider is used to determine if the template is selected by default of not + */ +public class ModelTemplateCheckStateProvider implements ICheckStateProvider { + + /** + * @see org.eclipse.jface.viewers.ICheckStateProvider#isChecked(java.lang.Object) + * + * @param element + * @return + */ + @Override + public boolean isChecked(Object element) { + if (element instanceof ModelTemplateDescription) { + ModelTemplateDescription description = (ModelTemplateDescription) element; + return description.isSelectedByDefault(); + } + return false; + } + + /** + * @see org.eclipse.jface.viewers.ICheckStateProvider#isGrayed(java.lang.Object) + * + * @param element + * @return + */ + @Override + public boolean isGrayed(Object element) { + return false; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateDescription.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateDescription.java index d904fc9b08c..569e1d52269 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateDescription.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/ModelTemplateDescription.java @@ -23,9 +23,6 @@ public class ModelTemplateDescription { /** The name. */
private String name;
-
-
-
/** The uml_path. */
private String uml_path;
@@ -43,19 +40,21 @@ public class ModelTemplateDescription { private String transfoURI;
+ private Boolean selectedByDefault;
+
/**
* Instantiates a new model template description.
*
* @param name
- * the name
+ * the name
* @param pluginId
- * the plugin id
+ * the plugin id
* @param uml_path
- * the uml_path
+ * the uml_path
* @param notation_path
- * the notation_path
+ * the notation_path
* @param di_path
- * the di_path
+ * the di_path
*/
public ModelTemplateDescription(String name, String pluginId, String uml_path, String notation_path, String di_path) {
super();
@@ -73,7 +72,7 @@ public class ModelTemplateDescription { * Sets the language.
*
* @param language
- * the new language
+ * the new language
*/
public void setLanguage(String language) {
this.language = language;
@@ -88,28 +87,12 @@ public class ModelTemplateDescription { return name;
}
- // /**
- // * @return the metamodelURI
- // */
- // public String getMetamodelURI() {
- // return metamodelURI;
- // }
-
- /**
- * Gets the path.
- *
- * @return the path
- */
-
-
/**
* Gets the file name.
*
* @return the file name
*/
public String getFileName() {
- // String[] pathParts = uml_path.split("/"); //$NON-NLS-1$
- // return pathParts[pathParts.length - 1];
return WizardsHelper.getFileNameWithoutExtension(uml_path);
}
@@ -144,7 +127,7 @@ public class ModelTemplateDescription { * Sets the uml_path.
*
* @param uml_path
- * the new uml_path
+ * the new uml_path
*/
public void setUml_path(String uml_path) {
this.uml_path = uml_path;
@@ -171,7 +154,7 @@ public class ModelTemplateDescription { * Sets the di_path.
*
* @param di_path
- * the new di_path
+ * the new di_path
*/
public void setDi_path(String di_path) {
this.di_path = di_path;
@@ -190,12 +173,25 @@ public class ModelTemplateDescription { * Sets the notation_path.
*
* @param notation_path
- * the new notation_path
+ * the new notation_path
*/
public void setNotation_path(String notation_path) {
this.notation_path = notation_path;
}
+ /**
+ * @return the selectedByDefault
+ */
+ public Boolean isSelectedByDefault() {
+ return selectedByDefault;
+ }
+ /**
+ * @param selectedByDefault
+ * the selectedByDefault to set
+ */
+ public void setSelectedByDefault(Boolean selectedByDefault) {
+ this.selectedByDefault = selectedByDefault;
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/SelectModelTemplateComposite.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/SelectModelTemplateComposite.java index 9a053662d18..d623fd89844 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/SelectModelTemplateComposite.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/template/SelectModelTemplateComposite.java @@ -118,6 +118,7 @@ public class SelectModelTemplateComposite extends Composite { templateTableViewer.getTable().setLayoutData(gridTable);
templateTableViewer.getTable().setBackground(composite.getBackground());
templateTableViewer.setContentProvider(new ModelTemplateTransfoProvider());
+ templateTableViewer.setCheckStateProvider(new ModelTemplateCheckStateProvider());
templateTableViewer.setLabelProvider(new ModelTemplatesLabelProvider());
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.templaterepository/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.templaterepository/plugin.xml index 130d0cdb211..4c69008a942 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.templaterepository/plugin.xml +++ b/plugins/uml/org.eclipse.papyrus.uml.templaterepository/plugin.xml @@ -5,17 +5,19 @@ point="org.eclipse.papyrus.uml.diagram.wizards.templates"> <transformation Transformation="org.eclipse.papyrus.uml.templaterepository.ImportUMLPrimitiveTypes" - id="org.eclipse.papyrus.uml.templaterepository.ImportUMLPrimitiveTypesInModel" + id="org.eclipse.papyrus.uml.templaterepository.ImportUMLPrimitiveTypesInModel" language="org.eclipse.papyrus.infra.services.edit.TypeContext" - name="A UML model with basic primitive types"> + name="A UML model with basic primitive types" + selectedByDefault="true"> </transformation> <transformation Transformation="org.eclipse.papyrus.uml.templaterepository.ImportUMLPrimitiveTypes" id="org.eclipse.papyrus.uml.templaterepository.ImportUMLPrimitiveTypesInProfile" language="org.eclipse.papyrus.uml.architecture.Profile" - name="A UML profile with basic primitive types"> - </transformation> + name="A UML profile with basic primitive types" + selectedByDefault="true"> + </transformation> </extension> </plugin> |