Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/views/properties')
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi111
-rw-r--r--plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java175
2 files changed, 231 insertions, 55 deletions
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi
index b311164df1a..6bf05b56904 100644
--- a/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/model/Environment.xmi
@@ -1,55 +1,56 @@
-<?xml version="1.0" encoding="ASCII"?>
-<environment:Environment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
- <constraintTypes label="EMF Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/>
- <constraintTypes label="True Constraint (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/>
- <constraintTypes label="EMF Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/>
- <constraintTypes label="Java Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/>
- <constraintTypes label="Java Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/>
- <modelElementFactories name="EMF Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.EMFModelElementFactory"/>
- <modelElementFactories name="Annotation Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.AnnotationModelElementFactory"/>
- <modelElementFactories name="Basic preferences Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.PreferencesModelElementFactory"/>
- <widgetTypes label="Label" widgetClass="Label"/>
- <widgetTypes label="Text" widgetClass="Text"/>
- <widgetTypes label="Button" widgetClass="Button"/>
- <propertyEditorTypes label="StringEditor" widgetClass="StringEditor" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringMultiline" widgetClass="StringMultiline" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringLabel (Read-only)" widgetClass="StringLabel" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringCombo" widgetClass="StringCombo" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="FileSelector" widgetClass="StringFileSelector" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="BooleanCombo" widgetClass="BooleanCombo" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="BooleanCheckbox" widgetClass="BooleanCheckbox" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="BooleanRadio" widgetClass="BooleanRadio" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="BooleanToggle" widgetClass="BooleanToggle" namespace="//@namespaces.3" type="Boolean"/>
- <propertyEditorTypes label="IntegerEditor" widgetClass="IntegerEditor" namespace="//@namespaces.3" type="Integer"/>
- <propertyEditorTypes label="IntegerSpinner" widgetClass="IntegerSpinner" namespace="//@namespaces.3" type="Integer"/>
- <propertyEditorTypes label="EnumCombo" widgetClass="EnumCombo" namespace="//@namespaces.3" type="Enumeration"/>
- <propertyEditorTypes label="EnumRadio (No preview)" widgetClass="EnumRadio" namespace="//@namespaces.3" type="Enumeration"/>
- <propertyEditorTypes label="ReferenceCombo" widgetClass="ReferenceCombo" namespace="//@namespaces.3" type="Reference"/>
- <propertyEditorTypes label="ReferenceDialog" widgetClass="ReferenceDialog" namespace="//@namespaces.3" type="Reference"/>
- <propertyEditorTypes label="ViewEditor" widgetClass="ViewEditor" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
- <propertyEditorTypes label="ReferenceLabel (Read-only)" widgetClass="ReferenceLabel" namespace="//@namespaces.3" type="Reference"/>
- <propertyEditorTypes label="MultiReference" widgetClass="MultiReference" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
- <propertyEditorTypes label="MultiReferenceWithPropertyView" widgetClass="MultiReferencePropertyEditorWithPropertyView" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
- <propertyEditorTypes label="MultiString" widgetClass="MultiString" namespace="//@namespaces.3" multiplicity="-1"/>
- <propertyEditorTypes label="MultipleFileEditor" widgetClass="MultiStringFile" namespace="//@namespaces.3" multiplicity="-1"/>
- <propertyEditorTypes label="MultiInteger" widgetClass="MultiInteger" namespace="//@namespaces.3" type="Integer" multiplicity="-1"/>
- <propertyEditorTypes label="InvalidWidget" widgetClass="InvalidWidget" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="StringMultiline with References" widgetClass="StringMultilineWithReferences" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="FloatEditor" widgetClass="FloatEditor" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="DoubleEditor" widgetClass="DoubleEditor" namespace="//@namespaces.3"/>
- <propertyEditorTypes label="UnlimitedNaturalEditor" widgetClass="UnlimitedNaturalEditor" namespace="//@namespaces.3"/>
- <compositeWidgetTypes label="Composite" widgetClass="Composite"/>
- <compositeWidgetTypes label="Group" widgetClass="Group"/>
- <layoutTypes label="GridLayout" widgetClass="GridLayout"/>
- <layoutTypes label="FillLayout" widgetClass="FillLayout"/>
- <layoutTypes label="RowLayout" widgetClass="RowLayout"/>
- <layoutTypes label="PropertiesLayout" widgetClass="PropertiesLayout" namespace="//@namespaces.4"/>
- <namespaces prefix="" name="" value="http://www.eclipse.org/xwt/presentation"/>
- <namespaces prefix="" name="x" value="http://www.eclipse.org/xwt"/>
- <namespaces name="j" value="java.lang"/>
- <namespaces name="ppe" value="org.eclipse.papyrus.views.properties.widgets"/>
- <namespaces name="ppel" value="org.eclipse.papyrus.views.properties.widgets.layout"/>
- <namespaces name="ppec" value="org.eclipse.papyrus.views.properties.creation"/>
- <miscClasses label="EMF object factory" class="EcorePropertyEditorFactory" namespace="//@namespaces.5"/>
- <miscClasses label="Property view Edition factory" class="PropertyEditorFactory" namespace="//@namespaces.5"/>
-</environment:Environment>
+<?xml version="1.0" encoding="ASCII"?>
+<environment:Environment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
+ <constraintTypes label="EMF Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFInstanceOfConstraint"/>
+ <constraintTypes label="True Constraint (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.TrueConstraint"/>
+ <constraintTypes label="EMF Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.EMFQueryConstraint"/>
+ <constraintTypes label="Java Instance Of (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaInstanceOf"/>
+ <constraintTypes label="Java Query (Deprecated)" constraintClass="org.eclipse.papyrus.infra.constraints.constraints.JavaQueryConstraint"/>
+ <modelElementFactories name="EMF Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.EMFModelElementFactory"/>
+ <modelElementFactories name="Annotation Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.AnnotationModelElementFactory"/>
+ <modelElementFactories name="Basic preferences Factory" factoryClass="org.eclipse.papyrus.views.properties.modelelement.PreferencesModelElementFactory"/>
+ <widgetTypes label="Label" widgetClass="Label"/>
+ <widgetTypes label="Text" widgetClass="Text"/>
+ <widgetTypes label="Button" widgetClass="Button"/>
+ <propertyEditorTypes label="StringEditor" widgetClass="StringEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringMultiline" widgetClass="StringMultiline" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringLabel (Read-only)" widgetClass="StringLabel" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringCombo" widgetClass="StringCombo" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="FileSelector" widgetClass="StringFileSelector" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="BooleanCombo" widgetClass="BooleanCombo" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="BooleanCheckbox" widgetClass="BooleanCheckbox" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="BooleanRadio" widgetClass="BooleanRadio" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="BooleanToggle" widgetClass="BooleanToggle" namespace="//@namespaces.3" type="Boolean"/>
+ <propertyEditorTypes label="IntegerEditor" widgetClass="IntegerEditor" namespace="//@namespaces.3" type="Integer"/>
+ <propertyEditorTypes label="IntegerSpinner" widgetClass="IntegerSpinner" namespace="//@namespaces.3" type="Integer"/>
+ <propertyEditorTypes label="EnumCombo" widgetClass="EnumCombo" namespace="//@namespaces.3" type="Enumeration"/>
+ <propertyEditorTypes label="EnumRadio (No preview)" widgetClass="EnumRadio" namespace="//@namespaces.3" type="Enumeration"/>
+ <propertyEditorTypes label="ReferenceCombo" widgetClass="ReferenceCombo" namespace="//@namespaces.3" type="Reference"/>
+ <propertyEditorTypes label="ReferenceDialog" widgetClass="ReferenceDialog" namespace="//@namespaces.3" type="Reference"/>
+ <propertyEditorTypes label="ViewEditor" widgetClass="ViewEditor" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
+ <propertyEditorTypes label="ReferenceLabel (Read-only)" widgetClass="ReferenceLabel" namespace="//@namespaces.3" type="Reference"/>
+ <propertyEditorTypes label="MultiReference" widgetClass="MultiReference" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
+ <propertyEditorTypes label="MultiReferenceWithPropertyView" widgetClass="MultiReferencePropertyEditorWithPropertyView" namespace="//@namespaces.3" type="Reference" multiplicity="-1"/>
+ <propertyEditorTypes label="MultiString" widgetClass="MultiString" namespace="//@namespaces.3" multiplicity="-1"/>
+ <propertyEditorTypes label="MultipleFileEditor" widgetClass="MultiStringFile" namespace="//@namespaces.3" multiplicity="-1"/>
+ <propertyEditorTypes label="MultiInteger" widgetClass="MultiInteger" namespace="//@namespaces.3" type="Integer" multiplicity="-1"/>
+ <propertyEditorTypes label="InvalidWidget" widgetClass="InvalidWidget" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="StringMultiline with References" widgetClass="StringMultilineWithReferences" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="FloatEditor" widgetClass="FloatEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="DoubleEditor" widgetClass="DoubleEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="UnlimitedNaturalEditor" widgetClass="UnlimitedNaturalEditor" namespace="//@namespaces.3"/>
+ <propertyEditorTypes label="Browse Path Button" widgetClass="BrowseFilePropertyEditor" namespace="//@namespaces.3"/>
+ <compositeWidgetTypes label="Composite" widgetClass="Composite"/>
+ <compositeWidgetTypes label="Group" widgetClass="Group"/>
+ <layoutTypes label="GridLayout" widgetClass="GridLayout"/>
+ <layoutTypes label="FillLayout" widgetClass="FillLayout"/>
+ <layoutTypes label="RowLayout" widgetClass="RowLayout"/>
+ <layoutTypes label="PropertiesLayout" widgetClass="PropertiesLayout" namespace="//@namespaces.4"/>
+ <namespaces prefix="" name="" value="http://www.eclipse.org/xwt/presentation"/>
+ <namespaces prefix="" name="x" value="http://www.eclipse.org/xwt"/>
+ <namespaces name="j" value="java.lang"/>
+ <namespaces name="ppe" value="org.eclipse.papyrus.views.properties.widgets"/>
+ <namespaces name="ppel" value="org.eclipse.papyrus.views.properties.widgets.layout"/>
+ <namespaces name="ppec" value="org.eclipse.papyrus.views.properties.creation"/>
+ <miscClasses label="EMF object factory" class="EcorePropertyEditorFactory" namespace="//@namespaces.5"/>
+ <miscClasses label="Property view Edition factory" class="PropertyEditorFactory" namespace="//@namespaces.5"/>
+</environment:Environment>
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java
new file mode 100644
index 00000000000..a2d0f078be4
--- /dev/null
+++ b/plugins/views/properties/org.eclipse.papyrus.views.properties/src/org/eclipse/papyrus/views/properties/widgets/BrowseFilePropertyEditor.java
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.views.properties.widgets;
+
+import org.eclipse.papyrus.infra.widgets.editors.BrowseFileEditor;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * Property editor for attribute that need a file selection.
+ * Its display have unique button with an associated menu to choice where file comes frome.
+ */
+public class BrowseFilePropertyEditor extends AbstractPropertyEditor {
+
+ /** The browse file editor. */
+ private BrowseFileEditor browseFileEditor = null;
+
+ /** The filtered extensions This should be a 1-1 mapping with {@link #filterNames}. */
+ protected String[] filterExtensions = null;
+
+ /**
+ * The name of the filters.
+ * This should be a 1-1 mapping with {@link #filterExtensions}
+ */
+ protected String[] filterNames = null;
+
+ /** Enables the "browse workspace" feature. */
+ protected boolean allowWorkspace = true;
+
+ /** Enables the "browse file system" feature. */
+ protected boolean allowFileSystem = true;
+
+ /**
+ * Instantiates a new browse file property editor.
+ *
+ * @param parent
+ * the parent
+ * @param style
+ * the style
+ */
+ public BrowseFilePropertyEditor(Composite parent, int style) {
+ browseFileEditor = createBrowseFileEditor(parent, style);
+ super.setEditor(browseFileEditor);
+ }
+
+ /**
+ * Set label to browse button.
+ *
+ * @param buttonLabel
+ * Label to set
+ */
+ public void setButtonLabel(String buttonLabel) {
+ browseFileEditor.setButtonLabel(buttonLabel);
+ }
+
+
+ /**
+ * @return Label of browse button
+ */
+ public String getButtonLabel() {
+ return browseFileEditor.getButtonLabel();
+ }
+
+ /**
+ * Creates the browse file editor.
+ *
+ * @param parent
+ * the parent
+ * @param style
+ * the style
+ * @return the browse file editor
+ */
+ private BrowseFileEditor createBrowseFileEditor(Composite parent, int style) {
+
+ return new BrowseFileEditor(parent, style);
+ }
+
+ /**
+ * Sets the filter extensions.
+ *
+ * @param filterExtensions
+ * the new filter extensions
+ */
+ public void setFilterExtensions(String[] filterExtensions) {
+ this.filterExtensions = filterExtensions;
+ checkFilters();
+ }
+
+ /**
+ * Gets the filter extensions.
+ *
+ * @return the filter extensions
+ */
+ public String[] getFilterExtensions() {
+ return this.filterExtensions;
+ }
+
+ /**
+ * Sets the filter names.
+ *
+ * @param filterNames
+ * the new filter names
+ */
+ public void setFilterNames(String[] filterNames) {
+ this.filterNames = filterNames;
+ checkFilters();
+ }
+
+ /**
+ * Gets the filter names.
+ *
+ * @return the filter names
+ */
+ public String[] getFilterNames() {
+ return this.filterNames;
+ }
+
+ /**
+ * Checks if the filters are valid.
+ */
+ protected void checkFilters() {
+ if(filterExtensions != null && filterNames != null) {
+ browseFileEditor.setFilters(filterExtensions, filterNames);
+ }
+ }
+
+ /**
+ * Indicates whether the editor should allow browsing the workspace or not.
+ *
+ * @param allowWorkspace
+ * the new allow workspace
+ */
+ public void setAllowWorkspace(boolean allowWorkspace) {
+ this.allowWorkspace = allowWorkspace;
+ browseFileEditor.setAllowWorkspace(allowWorkspace);
+ }
+
+ /**
+ * Gets the allow workspace.
+ *
+ * @return true if the editor can browse the workspace
+ */
+ public boolean getAllowWorkspace() {
+ return allowWorkspace;
+ }
+
+ /**
+ * Indicates whether the editor should allow browsing the file system or not.
+ *
+ * @param allowFileSystem
+ * the new allow file system
+ */
+ public void setAllowFileSystem(boolean allowFileSystem) {
+ this.allowFileSystem = allowFileSystem;
+ browseFileEditor.setAllowFileSystem(allowFileSystem);
+ }
+
+ /**
+ * Gets the allow file system.
+ *
+ * @return true if the editor can browse the fileSystem
+ */
+ public boolean getAllowFileSystem() {
+ return allowFileSystem;
+ }
+}

Back to the top