diff options
author | Gabriel Pascual | 2014-04-29 16:24:08 +0000 |
---|---|---|
committer | Gabriel Pascual | 2014-04-30 12:54:50 +0000 |
commit | a174352dd68d69367bcb468722a0bd0938802e2a (patch) | |
tree | 14fc0e595c8b9bdb1528dda11783bd4e8f994509 /plugins/views | |
parent | e770c8764a6f9a9c60315a689d5fc583286616c1 (diff) | |
download | org.eclipse.papyrus-a174352dd68d69367bcb468722a0bd0938802e2a.tar.gz org.eclipse.papyrus-a174352dd68d69367bcb468722a0bd0938802e2a.tar.xz org.eclipse.papyrus-a174352dd68d69367bcb468722a0bd0938802e2a.zip |
430079: [CSS] Papyrus shall provide features to define local theme
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430079
Patch 3 :
- Fix major issue
- Fix comment's remarks
Patch 2 :
- Rebase to pass hudson verification
Pathch 1 :
- Use workspace relative path for selected css files during CSS theme
edition
- Fix "restore default" button action in CSS preference page
- Harmonisation of all UI for theme icon selection
- Add dialog to confirm theme deletion
- Refactor to resolve some dependency problems
- Creation of widget for XWT theme view
- Add embedded style sheets in CSS Workspace engine working
- Fix problems of label provider for CSS themes properties view
- Add workspace themes preference page
- Add definition of theme property view
- Fix saving step of an edited theme from workspace
- Fix loading of theme icon in label provider - Fix behavior of theme
edition dialog fields
- Add edition action on style sheets list
- Add move up and move down actions in edition dialog
- Add actions (add and delete) to dialog
- Resolution staying conflicts after last merge
- Add edition theme dialog from project explorer
- Minor modification of Style sheet metamodel
- Modify CSS engine and theme manager to look at workspace theme
contributions
- Add theme creation by selecting one or more CSS files
- Add dialog to define theme from CSS file in workspace
- Create one menu for two actions to manage local theme
- Manage command ID in handler
- Fix containment relationship in model
- Add draft of theme creation from a CSS selection
- Modification of style sheets model
- Add popup menu on CSS file
Change-Id: Ie46281e334252bfbed727c18a431677761db2a45
Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
Diffstat (limited to 'plugins/views')
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; + } +} |