Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/customization/org.eclipse.papyrus.customization.properties/src')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/Activator.java68
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java144
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java10
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ResourceEditorInput.java11
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/UIEditor.java113
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ViewFilter.java40
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java24
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java25
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionAction.java52
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionWidgetAction.java24
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCopyAction.java8
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCutAction.java10
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoDeleteAction.java28
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoPasteAction.java10
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java24
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextAction.java13
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextState.java2
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewAction.java23
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewState.java109
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ValidationAction.java6
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java146
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/messages/Messages.java4
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java50
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java12
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java37
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java18
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java55
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java18
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/SectionNameObservableValue.java32
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/perspective/CustomizationPerspectiveFactory.java5
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencePage.java29
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencesInitializer.java4
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java12
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ConstraintDescriptorContentProvider.java26
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextContentProvider.java14
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextLabelProvider.java58
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DataContextElementContentProvider.java39
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DependencyContentProvider.java12
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java10
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyContentProvider.java50
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java16
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/TabContentProvider.java20
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/DataContextsImageQuery.java5
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ShowContextQuery.java4
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ViewsImageQuery.java5
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/AbstractContextStorageActionProvider.java11
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionRegistry.java19
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionUtil.java32
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextCopyAction.java23
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextDeleteAction.java17
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextEditAction.java17
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextStorageActionProvider.java17
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextCopyAction.java66
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextDeleteAction.java18
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextEditAction.java12
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextStorageActionProvider.java6
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CopyContextAction.java22
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CustomizationDialog.java107
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java11
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/OpenCustomization.java8
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java10
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java12
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ProjectUtil.java34
63 files changed, 965 insertions, 902 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/Activator.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/Activator.java
index fe7e3d110d8..89c0c48ad26 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/Activator.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/Activator.java
@@ -66,47 +66,47 @@ public class Activator extends AbstractUIPlugin {
return Activator.plugin;
}
- // private ICustomizationManager fCustomizationManager;
+ // private ICustomizationManager fCustomizationManager;
/**
*
* @return the customization manager in charge to adapt element in modisco
*/
- // public ICustomizationManager getCustomizationManager() {
- // if(this.fCustomizationManager == null) {
- // this.fCustomizationManager = ICustomizationManagerFactory.DEFAULT.getOrCreateICustomizationManager(new ResourceSetImpl());
- // init(this.fCustomizationManager);
- // }
- // return this.fCustomizationManager;
+ // public ICustomizationManager getCustomizationManager() {
+ // if(this.fCustomizationManager == null) {
+ // this.fCustomizationManager = ICustomizationManagerFactory.DEFAULT.getOrCreateICustomizationManager(new ResourceSetImpl());
+ // init(this.fCustomizationManager);
+ // }
+ // return this.fCustomizationManager;
//
- // return org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager();
- // }
+ // return org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager();
+ // }
- // private void init(final ICustomizationManager customizationManager) {
- // customizationManager.setShowContainer(false);
- // customizationManager.setShowDerivedLinks(true);
- // customizationManager.setShowEmptyLinks(true);
+ // private void init(final ICustomizationManager customizationManager) {
+ // customizationManager.setShowContainer(false);
+ // customizationManager.setShowDerivedLinks(true);
+ // customizationManager.setShowEmptyLinks(true);
//
- // try {
- // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
- // for(MetamodelView metamodelView : registryDefaultCustomizations) {
- // //FIXME: One of the default uiCustom files in Papyrus has a side effect to call resolveAll on the resource set. While this is generally not a problem in Papyrus,
- // //it becomes critical with the properties view customization, as the resource set contains hundreds of proxies to xwt files (Which are really expensive to load)
- // //It seems that this uiCustom query cannot be easily fixed, so we disable it in this context.
- // //The query which tries to (indirectly) resolve all: org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.IsDiagramContainer
- // //Used by: PapyrusNotationFacet.querySet -> PapyrusNotationFacet.uiCustom
- // if("PapyrusNotationFacet".equals(metamodelView.getName())) {
- // continue; //Disable this specific uiCustom
- // }
+ // try {
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ // for(MetamodelView metamodelView : registryDefaultCustomizations) {
+ // //FIXME: One of the default uiCustom files in Papyrus has a side effect to call resolveAll on the resource set. While this is generally not a problem in Papyrus,
+ // //it becomes critical with the properties view customization, as the resource set contains hundreds of proxies to xwt files (Which are really expensive to load)
+ // //It seems that this uiCustom query cannot be easily fixed, so we disable it in this context.
+ // //The query which tries to (indirectly) resolve all: org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.IsDiagramContainer
+ // //Used by: PapyrusNotationFacet.querySet -> PapyrusNotationFacet.uiCustom
+ // if("PapyrusNotationFacet".equals(metamodelView.getName())) {
+ // continue; //Disable this specific uiCustom
+ // }
//
- // customizationManager.registerCustomization(metamodelView);
- // }
+ // customizationManager.registerCustomization(metamodelView);
+ // }
//
- // customizationManager.loadCustomizations();
- // } catch (Throwable e) {
+ // customizationManager.loadCustomizations();
+ // } catch (Throwable e) {
// Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
- // }
- // }
+ // }
+ // }
/**
* @return The IPath representing the plugin's preferences folder location
@@ -119,7 +119,7 @@ public class Activator extends AbstractUIPlugin {
* Returns the image at the given path from this plugin
*
* @param path
- * the path of the image to be displayed
+ * the path of the image to be displayed
* @return The Image at the given location, or null if it couldn't be found
*/
public Image getImage(String path) {
@@ -130,9 +130,9 @@ public class Activator extends AbstractUIPlugin {
* Returns the image from the given image descriptor
*
* @param pluginId
- * The plugin in which the image is located
+ * The plugin in which the image is located
* @param path
- * The path to the image from the plugin
+ * The path to the image from the plugin
* @return
* The Image at the given location, or null if it couldn't be found
*/
@@ -140,7 +140,7 @@ public class Activator extends AbstractUIPlugin {
final ImageRegistry registry = getImageRegistry();
String key = pluginId + "/" + path; //$NON-NLS-1$
Image image = registry.get(key);
- if(image == null) {
+ if (image == null) {
registry.put(key, AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, path));
image = registry.get(key);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java
index 93b3575de31..e692ac63d2f 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -45,7 +45,7 @@ import org.eclipse.papyrus.views.properties.contexts.View;
* The Action bar contributor for the Context Editor
* Mainly serves as an Adapter for the Ecore actions, as the Ecore actions are
* not natively compatible with the EMF Facet tree objects
- *
+ *
* @author Camille Letavernier
*/
public class ContextEditorActionBarContributor extends EcoreActionBarContributor {
@@ -53,9 +53,9 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
private int i = 0;
/**
- *
+ *
* Constructor.
- *
+ *
*/
public ContextEditorActionBarContributor() {
super();
@@ -75,17 +75,17 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
@Override
protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> result = super.generateCreateChildActions(descriptors, selection);
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- if(sSelection.size() == 1) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection sSelection = (IStructuredSelection) selection;
+ if (sSelection.size() == 1) {
Object firstElement = sSelection.getFirstElement();
- if(firstElement instanceof View) {
- result.addAll(createChildForView(selection, (View)sSelection.getFirstElement()));
- } else if(firstElement instanceof Section) {
+ if (firstElement instanceof View) {
+ result.addAll(createChildForView(selection, (View) sSelection.getFirstElement()));
+ } else if (firstElement instanceof Section) {
result.addAll(createChildForSection(selection));
- } else if(firstElement instanceof Tab) {
+ } else if (firstElement instanceof Tab) {
removeChildActionsForTab(result);
- } else if(firstElement instanceof Context) {
+ } else if (firstElement instanceof Context) {
removeChildActionsForContext(result);
}
}
@@ -97,14 +97,14 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
@Override
protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> result = super.generateCreateSiblingActions(descriptors, selection);
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
- if(sSelection.size() == 1) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection sSelection = (IStructuredSelection) selection;
+ if (sSelection.size() == 1) {
Object firstElement = sSelection.getFirstElement();
- if(firstElement instanceof Section) {
+ if (firstElement instanceof Section) {
removeSiblingActionsForSection(result);
- createSiblingActionsForSection(sSelection, (Section)firstElement);
- } else if(firstElement instanceof View || firstElement instanceof Tab) {
+ createSiblingActionsForSection(sSelection, (Section) firstElement);
+ } else if (firstElement instanceof View || firstElement instanceof Tab) {
removeSiblingActionsForViewAndTab(result);
}
}
@@ -114,17 +114,17 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Remove the unused actions from the Tab's create child section
- *
+ *
* @param actions
- * The actions generated by the Ecore action bar
+ * The actions generated by the Ecore action bar
*/
protected void removeChildActionsForTab(Collection<IAction> actions) {
Iterator<IAction> iterator = actions.iterator();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
IAction action = iterator.next();
- if(action instanceof CreateChildAction) {
- CreateChildAction createChildAction = (CreateChildAction)action;
- if(createChildAction.getText().equals("Section")) { //It's the only relevant property we have access to... //$NON-NLS-1$
+ if (action instanceof CreateChildAction) {
+ CreateChildAction createChildAction = (CreateChildAction) action;
+ if (createChildAction.getText().equals("Section")) { //It's the only relevant property we have access to... //$NON-NLS-1$
iterator.remove();
}
}
@@ -133,18 +133,18 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Remove the unused actions from the Context's create child section
- *
+ *
* @param actions
- * The actions generated by the Ecore action bar
+ * The actions generated by the Ecore action bar
*/
protected void removeChildActionsForContext(Collection<IAction> actions) {
Iterator<IAction> iterator = actions.iterator();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
IAction action = iterator.next();
- if(action instanceof CreateChildAction) {
- CreateChildAction createChildAction = (CreateChildAction)action;
- if(!ToggleDataContextAction.showDataContext) {
- if(createChildAction.getText().equals("Data Context Root")) { //It's the only relevant property we have access to... //$NON-NLS-1$
+ if (action instanceof CreateChildAction) {
+ CreateChildAction createChildAction = (CreateChildAction) action;
+ if (!ToggleDataContextAction.showDataContext) {
+ if (createChildAction.getText().equals("Data Context Root")) { //It's the only relevant property we have access to... //$NON-NLS-1$
iterator.remove();
}
}
@@ -154,17 +154,17 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Remove the unused actions from the Tab and View's create sibling section
- *
+ *
* @param actions
- * The actions generated by the Ecore action bar
+ * The actions generated by the Ecore action bar
*/
protected void removeSiblingActionsForViewAndTab(Collection<IAction> actions) {
Iterator<IAction> iterator = actions.iterator();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
IAction action = iterator.next();
- if(action instanceof CreateSiblingAction) {
- CreateSiblingAction createSiblingAction = (CreateSiblingAction)action;
- if(createSiblingAction.getText().equals("Data Context Root")) { //It's the only relevant property we have access to... //$NON-NLS-1$
+ if (action instanceof CreateSiblingAction) {
+ CreateSiblingAction createSiblingAction = (CreateSiblingAction) action;
+ if (createSiblingAction.getText().equals("Data Context Root")) { //It's the only relevant property we have access to... //$NON-NLS-1$
iterator.remove();
}
}
@@ -173,17 +173,17 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Remove the unused actions from the Section's create sibling section
- *
+ *
* @param actions
- * The actions generated by the Ecore action bar
+ * The actions generated by the Ecore action bar
*/
protected void removeSiblingActionsForSection(Collection<IAction> actions) {
Iterator<IAction> iterator = actions.iterator();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
IAction action = iterator.next();
- if(action instanceof CreateSiblingAction) {
- CreateSiblingAction createSiblingAction = (CreateSiblingAction)action;
- if(createSiblingAction.getText().equals("Section")) { //It's the only relevant property we have access to... //$NON-NLS-1$
+ if (action instanceof CreateSiblingAction) {
+ CreateSiblingAction createSiblingAction = (CreateSiblingAction) action;
+ if (createSiblingAction.getText().equals("Section")) { //It's the only relevant property we have access to... //$NON-NLS-1$
iterator.remove();
}
}
@@ -192,41 +192,41 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Adds new actions in the Section's create sibling section
- *
+ *
* @param selection
- * The current selection
+ * The current selection
* @param section
- * The section for which we want to add new actions
+ * The section for which we want to add new actions
* @return
* The list of newly created {@link IAction}s
*/
protected Collection<IAction> createSiblingActionsForSection(ISelection selection, Section section) {
Collection<IAction> actions = new LinkedList<IAction>();
- //TODO : We need to retrieve the view owning the section. It is only possible with an access to the
- //ITreeElements, which we don't have here. Find a way to retrieve it.
+ // TODO : We need to retrieve the view owning the section. It is only possible with an access to the
+ // ITreeElements, which we don't have here. Find a way to retrieve it.
- // String sectionName = getSectionName(view.getContext());
- // String sectionFile = getSectionFile(sectionName);
- // IAction action = new CreateSectionAction(selection, sectionName, sectionFile);
- // actions.add(action);
+ // String sectionName = getSectionName(view.getContext());
+ // String sectionFile = getSectionFile(sectionName);
+ // IAction action = new CreateSectionAction(selection, sectionName, sectionFile);
+ // actions.add(action);
return actions;
}
/**
* Adds new actions in the View's create child section
- *
+ *
* @param selection
- * The current selection
+ * The current selection
* @param view
- * The View for which we want to add new actions
+ * The View for which we want to add new actions
* @return
* The list of newly created {@link IAction}s
*/
protected Collection<IAction> createChildForView(ISelection selection, View view) {
Collection<IAction> actions = new LinkedList<IAction>();
- if(view.getContext() == null) {
+ if (view.getContext() == null) {
return actions;
}
@@ -240,17 +240,17 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Generate a name for a new section in the given context
- *
+ *
* @param context
- * The context in which the new section will be created
+ * The context in which the new section will be created
* @return
* The generated name (Which should be unique in the given context)
*/
protected String getSectionName(Context context) {
String name;
- while(true) {
+ while (true) {
name = "Section " + i; //$NON-NLS-1$
- if(isValidName(name, context)) {
+ if (isValidName(name, context)) {
return name;
}
i++;
@@ -259,18 +259,18 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Tests if a section name is valid
- *
+ *
* @param sectionName
- * The name to test
+ * The name to test
* @param context
- * The Context in which the section name will be used
+ * The Context in which the section name will be used
* @return
* True is the name is a valid section name
*/
protected boolean isValidName(String sectionName, Context context) {
- for(Tab tab : context.getTabs()) {
- for(Section section : tab.getSections()) {
- if(section.getName().equals(sectionName)) {
+ for (Tab tab : context.getTabs()) {
+ for (Section section : tab.getSections()) {
+ if (section.getName().equals(sectionName)) {
return false;
}
}
@@ -280,9 +280,9 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Return the path of the section file from a section name
- *
+ *
* @param sectionName
- * The name of the section
+ * The name of the section
* @return
* The path to the section's XWT file
*/
@@ -292,9 +292,9 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
/**
* Adds new actions to the Section's create child section
- *
+ *
* @param selection
- * The current seleection
+ * The current seleection
* @return
* The newly created {@link IAction}s
*/
@@ -322,8 +322,8 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
@Override
protected boolean removeAllReferencesOnDelete() {
- return false; //When true, the whole model is loaded on "delete" actions, including *.xwt files
- //(Which cannot contain references to the deleted element, and are really slow to load)
+ return false; // When true, the whole model is loaded on "delete" actions, including *.xwt files
+ // (Which cannot contain references to the deleted element, and are really slow to load)
}
@Override
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java
index efd6d56b7c2..8883512cc84 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/MoDiscoDropAdapter.java
@@ -35,9 +35,9 @@ public class MoDiscoDropAdapter extends EditingDomainViewerDropAdapter {
* Constructor.
*
* @param domain
- * The Editing domain for this Drop Adapter
+ * The Editing domain for this Drop Adapter
* @param viewer
- * The Viewer for this Drop Adapter
+ * The Viewer for this Drop Adapter
*/
public MoDiscoDropAdapter(EditingDomain domain, Viewer viewer) {
super(domain, viewer);
@@ -45,8 +45,8 @@ public class MoDiscoDropAdapter extends EditingDomainViewerDropAdapter {
@Override
protected Collection<?> extractDragSource(Object object) {
- if(object instanceof ISelection) {
- return super.extractDragSource(ActionUtil.getAdaptedSelection((ISelection)object));
+ if (object instanceof ISelection) {
+ return super.extractDragSource(ActionUtil.getAdaptedSelection((ISelection) object));
} else {
return super.extractDragSource(object);
}
@@ -56,7 +56,7 @@ public class MoDiscoDropAdapter extends EditingDomainViewerDropAdapter {
protected Object extractDropTarget(Widget item) {
Object dropTarget = super.extractDropTarget(item);
EObject eObject = EMFHelper.getEObject(dropTarget);
- if(eObject != null) {
+ if (eObject != null) {
return eObject;
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ResourceEditorInput.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ResourceEditorInput.java
index 466681be6a3..b68eccad2db 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ResourceEditorInput.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ResourceEditorInput.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -43,6 +43,7 @@ public class ResourceEditorInput extends URIEditorInput {
return resource;
}
+ @Override
public boolean exists() {
ResourceSet rset = resource.getResourceSet();
@@ -51,12 +52,14 @@ public class ResourceEditorInput extends URIEditorInput {
return (rset != null) && rset.getURIConverter().exists(resource.getURI(), null);
}
+ @Override
public ImageDescriptor getImageDescriptor() {
return null;
}
+ @Override
public String getName() {
- if(name == null) {
+ if (name == null) {
name = resource.getURI().lastSegment();
}
@@ -66,13 +69,15 @@ public class ResourceEditorInput extends URIEditorInput {
/**
* Unlike the superclass, I am not persistable because a {@link Resource} is a transient
* object.
- *
+ *
* @return {@code false}
*/
+ @Override
public IPersistableElement getPersistable() {
return null;
}
+ @Override
public String getToolTipText() {
return resource.getURI().toString();
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/UIEditor.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/UIEditor.java
index 19ea7e7e636..e9ec2377b75 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/UIEditor.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/UIEditor.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -88,7 +88,7 @@ import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
* A customization editor for Contexts from the Papyrus Property View.
* The Editor is based on the Ecore reflective editor and the EMF Facet
* customizable content & label providers
- *
+ *
* @author Camille Letavernier
*/
public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageContributor, CommandStackListener {
@@ -109,15 +109,15 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
Composite gParent = new Composite(getContainer(), SWT.NONE);
gParent.setLayout(new FillLayout());
- //SashForm parent = new SashForm(gParent, SWT.VERTICAL | SWT.V_SCROLL | SWT.H_SCROLL);
- //parent.setLayout(new FillLayout());
+ // SashForm parent = new SashForm(gParent, SWT.VERTICAL | SWT.V_SCROLL | SWT.H_SCROLL);
+ // parent.setLayout(new FillLayout());
Composite parent = new Composite(gParent, SWT.NONE);
parent.setLayout(new PropertiesLayout());
// Only creates the other pages if there is something that can be edited
//
- if(!getEditingDomain().getResourceSet().getResources().isEmpty()) {
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
// Create a page for the selection tree view.
//
@@ -128,7 +128,7 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
@Override
public void commit(AbstractEditor editor) {
- filter.setPattern((String)filterPattern.getValue());
+ filter.setPattern((String) filterPattern.getValue());
selectionViewer.refresh();
}
@@ -138,10 +138,10 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
selectionViewer = new TreeViewer(tree);
- selectionViewer.setFilters(new ViewerFilter[]{ filter });
+ selectionViewer.setFilters(new ViewerFilter[] { filter });
setCurrentViewer(selectionViewer);
ContextContentProvider contentProvider = new ContextContentProvider();
- //contentProvider.getCustomizationManager().installCustomPainter(tree);
+ // contentProvider.getCustomizationManager().installCustomPainter(tree);
ILabelProvider labelProvider = new ContextLabelProvider();
@@ -161,9 +161,9 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
setActivePage(0);
- // Preview preview = new Preview(this);
- // preview.createPartControl(parent);
- // addPreview(preview);
+ // Preview preview = new Preview(this);
+ // preview.createPartControl(parent);
+ // addPreview(preview);
parent.layout();
}
@@ -177,7 +177,7 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
@Override
public void controlResized(ControlEvent event) {
- if(!guard) {
+ if (!guard) {
guard = true;
hideTabs();
guard = false;
@@ -189,36 +189,37 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
changePerspective();
- //FIXME ppe:/ conversion
- //This is a hack. The ppe:/ URIs are not correctly converted when the model is saved.
+ // FIXME ppe:/ conversion
+ // This is a hack. The ppe:/ URIs are not correctly converted when the model is saved.
getEditingDomain().getResourceSet().getURIConverter().getURIHandlers().add(0, new PropertiesURIHandler());
}
protected void changePerspective() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if(activePage == null) {
+ if (activePage == null) {
return;
}
IPerspectiveDescriptor descriptor = activePage.getPerspective();
- if(descriptor.getId().equals(Activator.CUSTOMIZATION_PERSPECTIVE_ID)) {
+ if (descriptor.getId().equals(Activator.CUSTOMIZATION_PERSPECTIVE_ID)) {
return;
}
boolean openPerspective = false;
- // if(CustomizationPreferencePage.askForConfirmation()) {
- // int defaultIndex = CustomizationPreferencePage.openCustomizationPerspective() ? 0 : 1;
- // System.out.println(getContainer().getShell());
- // MessageDialog confirmationDialog = new MessageDialog(getContainer().getShell(), Messages.UIEditor_ChangePerspective, null, Messages.UIEditor_ChangePerspectiveMessage, MessageDialog.QUESTION, new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, defaultIndex);
- // confirmationDialog.open();
- // openPerspective = confirmationDialog.getReturnCode() == 0;
- // } else {
- // openPerspective = CustomizationPreferencePage.openCustomizationPerspective();
- // }
-
- if(openPerspective) {
+ // if(CustomizationPreferencePage.askForConfirmation()) {
+ // int defaultIndex = CustomizationPreferencePage.openCustomizationPerspective() ? 0 : 1;
+ // System.out.println(getContainer().getShell());
+ // MessageDialog confirmationDialog = new MessageDialog(getContainer().getShell(), Messages.UIEditor_ChangePerspective, null, Messages.UIEditor_ChangePerspectiveMessage, MessageDialog.QUESTION, new String[]{ IDialogConstants.YES_LABEL,
+ // IDialogConstants.NO_LABEL }, defaultIndex);
+ // confirmationDialog.open();
+ // openPerspective = confirmationDialog.getReturnCode() == 0;
+ // } else {
+ // openPerspective = CustomizationPreferencePage.openCustomizationPerspective();
+ // }
+
+ if (openPerspective) {
try {
PlatformUI.getWorkbench().showPerspective(Activator.CUSTOMIZATION_PERSPECTIVE_ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
} catch (WorkbenchException ex) {
@@ -238,7 +239,7 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
- Transfer[] transfers = new Transfer[]{ LocalTransfer.getInstance() };
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new MoDiscoDropAdapter(editingDomain, viewer));
}
@@ -256,9 +257,9 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
saveAsDialog.setMessage(EcoreEditorPlugin.INSTANCE.getString("_UI_SaveAs_message")); //$NON-NLS-1$
saveAsDialog.open();
IPath path = saveAsDialog.getResult();
- if(path != null) {
+ if (path != null) {
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if(file != null) {
+ if (file != null) {
ResourceSet resourceSet = editingDomain.getResourceSet();
Resource currentResource = resourceSet.getResources().get(0);
String currentExtension = currentResource.getURI().fileExtension();
@@ -267,13 +268,13 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
URI newURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
String newExtension = newURI.fileExtension();
- if(currentExtension.equals(ECORE_FILE_EXTENSION) && newExtension.equals(EMOF_FILE_EXTENSION) || currentExtension.equals(EMOF_FILE_EXTENSION) && newExtension.equals(ECORE_FILE_EXTENSION)) {
+ if (currentExtension.equals(ECORE_FILE_EXTENSION) && newExtension.equals(EMOF_FILE_EXTENSION) || currentExtension.equals(EMOF_FILE_EXTENSION) && newExtension.equals(ECORE_FILE_EXTENSION)) {
Resource newResource = resourceSet.createResource(newURI);
newResource.getContents().addAll(currentResource.getContents());
resourceSet.getResources().remove(0);
resourceSet.getResources().move(0, newResource);
} else {
- //System.out.println("Replace " + currentURI + " by " + newURI);
+ // System.out.println("Replace " + currentURI + " by " + newURI);
currentResource.setURI(newURI);
}
@@ -282,13 +283,13 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
setPartName(file.getName());
Context context = getContext();
- if(context != null) {
+ if (context != null) {
EcoreUtil.resolveAll(context);
- for(Resource resource : currentResource.getResourceSet().getResources()) {
- if(resource != currentResource) {
- if(isRelative(currentURI, resource)) {
+ for (Resource resource : currentResource.getResourceSet().getResources()) {
+ if (resource != currentResource) {
+ if (isRelative(currentURI, resource)) {
URI newResourceURI = resource.getURI().deresolve(currentURI).resolve(newURI);
- //System.out.println("Replace " + resource.getURI() + " by " + newResourceURI);
+ // System.out.println("Replace " + resource.getURI() + " by " + newResourceURI);
resource.setURI(newResourceURI);
}
}
@@ -303,8 +304,8 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
private boolean isRelative(URI baseURI, Resource resource) {
URI resourceURI = resource.getURI();
URI uri = resourceURI.deresolve(baseURI);
- if(uri.isRelative()) {
- if(!(uri.toString().startsWith("..") || uri.toString().startsWith("/"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (uri.isRelative()) {
+ if (!(uri.toString().startsWith("..") || uri.toString().startsWith("/"))) { //$NON-NLS-1$ //$NON-NLS-2$
return true;
}
}
@@ -313,22 +314,22 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
protected Context getContext() {
EObject object = getEditingDomain().getResourceSet().getResources().get(0).getContents().get(0);
- if(object instanceof Context) {
- return (Context)object;
+ if (object instanceof Context) {
+ return (Context) object;
}
return null;
}
private void refreshContext() {
Context context = getContext();
- if(context != null) {
+ if (context != null) {
ConfigurationManager.getInstance().refresh(context);
}
}
@Override
public IPropertySheetPage getPropertySheetPage() {
- if(iPropertySheetPage == null) {
+ if (iPropertySheetPage == null) {
iPropertySheetPage = new TabbedPropertySheetPage(this);
}
return iPropertySheetPage;
@@ -341,7 +342,7 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
/**
* Registers a Preview to this Editor
- *
+ *
* @param preview
*/
public void addPreview(Preview preview) {
@@ -352,7 +353,7 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
/**
* Unregisters a Preview from this editor
- *
+ *
* @param preview
*/
public void removePreview(Preview preview) {
@@ -362,11 +363,11 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
@Override
public void dispose() {
- for(Preview preview : previews) {
+ for (Preview preview : previews) {
selectionViewer.removeSelectionChangedListener(preview);
}
previews.clear();
- if(iPropertySheetPage != null) {
+ if (iPropertySheetPage != null) {
iPropertySheetPage.dispose();
}
super.dispose();
@@ -380,20 +381,20 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
@Override
public void commandStackChanged(EventObject event) {
getViewer().refresh();
- for(Preview preview : previews) {
+ for (Preview preview : previews) {
preview.displayView();
}
}
@Override
public void createModel() {
- if(getEditorInput() instanceof ResourceEditorInput) {
+ if (getEditorInput() instanceof ResourceEditorInput) {
// override the editing domain with one that uses the resource's
// resource set, which already exists
- ResourceSet resourceSet = ((ResourceEditorInput)getEditorInput()).getResource().getResourceSet();
+ ResourceSet resourceSet = ((ResourceEditorInput) getEditorInput()).getResource().getResourceSet();
- if(resourceSet != null) {
+ if (resourceSet != null) {
editingDomain = new AdapterFactoryEditingDomain(editingDomain.getAdapterFactory(), editingDomain.getCommandStack(), resourceSet);
}
}
@@ -429,13 +430,13 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
// Try to select the affected objects.
//
- Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
- if(mostRecentCommand != null) {
+ Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
setSelectionToViewer(mostRecentCommand.getAffectedObjects());
}
- for(Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();) {
+ for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext();) {
PropertySheetPage propertySheetPage = i.next();
- if(propertySheetPage.getControl().isDisposed()) {
+ if (propertySheetPage.getControl().isDisposed()) {
i.remove();
} else {
propertySheetPage.refresh();
@@ -446,7 +447,7 @@ public class UIEditor extends EcoreEditor implements ITabbedPropertySheetPageCon
}
});
- //Replace the parent editing domain with a standard one. We don't want to override the isReadOnly() method.
+ // Replace the parent editing domain with a standard one. We don't want to override the isReadOnly() method.
editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack);
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ViewFilter.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ViewFilter.java
index e5c8f0b42b1..d97955f1ae6 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ViewFilter.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ViewFilter.java
@@ -42,24 +42,24 @@ public class ViewFilter extends ViewerFilter {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
- if(matcher == null) {
+ if (matcher == null) {
return true;
}
EObject semantic = EMFHelper.getEObject(element);
- if(semantic != null) {
- if(semantic instanceof View) {
- String viewName = ((View)semantic).getName();
- if(viewName == null) {
+ if (semantic != null) {
+ if (semantic instanceof View) {
+ String viewName = ((View) semantic).getName();
+ if (viewName == null) {
return true;
}
return matcher.match(viewName);
- } else if(semantic instanceof DataContextPackage) {
- //FIXME : The filter doesn't work correctly for displaying a DataContextElement in a Package
- return select((DataContextPackage)semantic);
- } else if(semantic instanceof DataContextElement) {
- return select((DataContextElement)semantic);
+ } else if (semantic instanceof DataContextPackage) {
+ // FIXME : The filter doesn't work correctly for displaying a DataContextElement in a Package
+ return select((DataContextPackage) semantic);
+ } else if (semantic instanceof DataContextElement) {
+ return select((DataContextElement) semantic);
}
}
@@ -74,22 +74,22 @@ public class ViewFilter extends ViewerFilter {
* @return
*/
private boolean select(DataContextPackage dataContextPackage) {
- if(dataContextPackage.getName() == null) {
+ if (dataContextPackage.getName() == null) {
return true;
}
- if(matcher.match(dataContextPackage.getName())) {
+ if (matcher.match(dataContextPackage.getName())) {
return true;
}
- for(DataContextElement subElement : dataContextPackage.getElements()) {
- if(subElement instanceof DataContextPackage) {
- if(select((DataContextPackage)subElement)) {
+ for (DataContextElement subElement : dataContextPackage.getElements()) {
+ if (subElement instanceof DataContextPackage) {
+ if (select((DataContextPackage) subElement)) {
return true;
}
}
- if(select(subElement)) {
+ if (select(subElement)) {
return true;
}
}
@@ -98,17 +98,17 @@ public class ViewFilter extends ViewerFilter {
}
private boolean select(DataContextElement dataContextElement) {
- if(dataContextElement.getName() == null) {
+ if (dataContextElement.getName() == null) {
return true;
}
- if(matcher.match(dataContextElement.getName())) {
+ if (matcher.match(dataContextElement.getName())) {
return true;
}
DataContextPackage dataContextPackage = dataContextElement.getPackage();
- while(dataContextPackage != null) {
- if(matcher.match(dataContextPackage.getName())) {
+ while (dataContextPackage != null) {
+ if (matcher.match(dataContextPackage.getName())) {
return true;
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java
index 40dfc7ee2aa..0289d83afe9 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@ import org.eclipse.swt.graphics.Image;
* An EMF Compound Command with support for Images, Tooltip text and description
* (From CommandActionDelegate)
* The first sub-command should be a CommandActionDelegate
- *
+ *
* @author Camille Letavernier
*/
public class CompoundCommandActionDelegate extends CompoundCommand implements CommandActionDelegate {
@@ -31,32 +31,36 @@ public class CompoundCommandActionDelegate extends CompoundCommand implements Co
/**
* Sets the Image for this command
- *
+ *
* @param image
- * The image to display on the command
+ * The image to display on the command
*/
public void setImage(Image image) {
this.image = image;
}
+ @Override
public Object getImage() {
- if(image == null)
- return ((CommandActionDelegate)getCommandList().get(0)).getImage();
- else
+ if (image == null) {
+ return ((CommandActionDelegate) getCommandList().get(0)).getImage();
+ } else {
return image;
+ }
}
+ @Override
public String getText() {
- return ((CommandActionDelegate)getCommandList().get(0)).getText();
+ return ((CommandActionDelegate) getCommandList().get(0)).getText();
}
+ @Override
public String getToolTipText() {
- return ((CommandActionDelegate)getCommandList().get(0)).getToolTipText();
+ return ((CommandActionDelegate) getCommandList().get(0)).getToolTipText();
}
@Override
public String getDescription() {
- return ((CommandActionDelegate)getCommandList().get(0)).getDescription();
+ return ((CommandActionDelegate) getCommandList().get(0)).getDescription();
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java
index 67d375d8632..94337d44b18 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@ import org.eclipse.papyrus.customization.properties.Activator;
/**
* A command to create an EMF resource
- *
+ *
* @author Camille Letavernier
*/
public class CreateResourceCommand extends AbstractCommand implements CommandActionDelegate {
@@ -40,15 +40,15 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
private Resource resource;
/**
- *
+ *
* Constructor. A Command to create an EMF Resource. The command can be undone.
- *
+ *
* @param object
- * The EObject to persist in the resource
+ * The EObject to persist in the resource
* @param uri
- * The location of the resource
+ * The location of the resource
* @param resourceSet
- * The resourceSet in which the resource should be created
+ * The resourceSet in which the resource should be created
*/
public CreateResourceCommand(EObject object, URI uri, ResourceSet resourceSet) {
super("Create new " + object.eClass().getName(), "Creates a new " + object.eClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
@@ -57,9 +57,10 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
this.resourceSet = resourceSet;
}
+ @Override
public void execute() {
resource = resourceSet.getResource(uri, false);
- if(resource == null) {
+ if (resource == null) {
Activator.log.debug("+++ Creating " + uri);
fileAlreadyExists = false;
resource = resourceSet.createResource(uri);
@@ -69,14 +70,15 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
resource.getContents().add(object);
}
+ @Override
public void redo() {
execute();
}
@Override
public void undo() {
- //Do not unload the resource if it was created before this command was executed
- if(!fileAlreadyExists) {
+ // Do not unload the resource if it was created before this command was executed
+ if (!fileAlreadyExists) {
Activator.log.debug("--- Deleting " + resource.getURI());
try {
resourceSet.getResources().remove(resource);
@@ -89,14 +91,17 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
}
}
+ @Override
public Object getImage() {
return null;
}
+ @Override
public String getText() {
return getLabel();
}
+ @Override
public String getToolTipText() {
return getDescription();
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionAction.java
index aef909d7e75..b1999aadfde 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,22 +41,22 @@ import org.eclipse.papyrus.views.properties.ui.ValueAttribute;
/**
* A Command for create a {@link Section} in the given View.
- *
+ *
* In the physical EMF Model, the section is owned by a Tab, and referenced
* by one or more views. However, in the logical model used by the Customization
* editor (Which is slightly different to be simpler), the view directly owns the
* section, and the section refers to its Tab.
- *
+ *
* This command creates the section in the default Tab, and creates a reference
* from the view to the section.
- *
+ *
* It also instantiates the XWT Resource associated to this sections, and fills
* it with a default Composite widget and Layout.
- *
+ *
* The command can be undone in a single operation.
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class CreateSectionAction extends StaticSelectionCommandAction {
@@ -66,24 +66,24 @@ public class CreateSectionAction extends StaticSelectionCommandAction {
/**
* Constructor.
- *
+ *
* Creates a new CreateSectionAction, with the given name and file.
* The sectionFile is a relative path from the section's URI, which is
* the same as it's owning view.
- *
+ *
* @param selection
- * The current selection
+ * The current selection
* @param sectionName
- * The new section's name
+ * The new section's name
* @param sectionFile
- * The path to the section's XWT resource
+ * The path to the section's XWT resource
*/
public CreateSectionAction(ISelection selection, String sectionName, String sectionFile) {
this.sectionName = sectionName;
this.sectionFile = sectionFile;
- if(selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection)selection;
+ if (selection instanceof IStructuredSelection) {
+ this.selection = (IStructuredSelection) selection;
configureAction(selection);
}
}
@@ -92,31 +92,31 @@ public class CreateSectionAction extends StaticSelectionCommandAction {
protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection) {
Object selectedElement = selection.getFirstElement();
View view = null;
- if(selectedElement instanceof View) {
- view = (View)selectedElement;
+ if (selectedElement instanceof View) {
+ view = (View) selectedElement;
}
- if(view == null) {
+ if (view == null) {
return UnexecutableCommand.INSTANCE;
}
EObject tab = null;
- for(Section section : view.getSections()) {
- if(section.getTab() != null) {
+ for (Section section : view.getSections()) {
+ if (section.getTab() != null) {
tab = section.getTab();
break;
}
}
- if(tab == null) {
- Context context = (Context)view.eContainer();
- if(context.getTabs().size() > 0) {
+ if (tab == null) {
+ Context context = (Context) view.eContainer();
+ if (context.getTabs().size() > 0) {
tab = context.getTabs().get(0);
}
}
- if(tab == null) {
+ if (tab == null) {
return UnexecutableCommand.INSTANCE;
}
@@ -146,7 +146,7 @@ public class CreateSectionAction extends StaticSelectionCommandAction {
CompositeWidget newWidget = UiFactory.eINSTANCE.createCompositeWidget();
- for(Map.Entry<String, String> entry : getNamespaces().entrySet()) {
+ for (Map.Entry<String, String> entry : getNamespaces().entrySet()) {
ValueAttribute attribute = UiFactory.eINSTANCE.createValueAttribute();
attribute.setName(entry.getKey());
attribute.setValue(entry.getValue());
@@ -173,7 +173,7 @@ public class CreateSectionAction extends StaticSelectionCommandAction {
private Command getCreateResourceCommand(CompositeWidget newWidget, Section section, Resource baseResource) {
URI widgetURI;
- if(section.getSectionFile() == null || section.getSectionFile().equals("")) { //$NON-NLS-1$
+ if (section.getSectionFile() == null || section.getSectionFile().equals("")) { //$NON-NLS-1$
section.setSectionFile(getSectionFile());
}
@@ -185,7 +185,7 @@ public class CreateSectionAction extends StaticSelectionCommandAction {
}
private Command getSetWidgetCommand(CompositeWidget newWidget, Section section) {
- if(section.getWidget() == null) {
+ if (section.getWidget() == null) {
return SetCommand.create(editingDomain, section, section.eClass().getEStructuralFeature("widget"), newWidget); //$NON-NLS-1$
} else {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionWidgetAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionWidgetAction.java
index 5ae86d0adac..b20e5fb063c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionWidgetAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateSectionWidgetAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,7 +34,7 @@ import org.eclipse.papyrus.views.properties.ui.ValueAttribute;
/**
* An Action to create a section's XWT Resource, with a default Composite
* and layout.
- *
+ *
* @author Camille Letavernier
*/
public class CreateSectionWidgetAction extends StaticSelectionCommandAction {
@@ -43,18 +43,18 @@ public class CreateSectionWidgetAction extends StaticSelectionCommandAction {
/**
* Constructor.
- *
+ *
* @param selection
- * The current selection. The first element should be a Section.
+ * The current selection. The first element should be a Section.
*/
public CreateSectionWidgetAction(ISelection selection) {
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection sSelection = (IStructuredSelection)selection;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection sSelection = (IStructuredSelection) selection;
Object selectedElement = sSelection.getFirstElement();
- if(selectedElement instanceof Section) {
- section = (Section)selectedElement;
+ if (selectedElement instanceof Section) {
+ section = (Section) selectedElement;
}
}
configureAction(selection);
@@ -62,7 +62,7 @@ public class CreateSectionWidgetAction extends StaticSelectionCommandAction {
@Override
protected Command createActionCommand(EditingDomain editingDomain, Collection<?> collection) {
- if(section == null) {
+ if (section == null) {
return UnexecutableCommand.INSTANCE;
}
@@ -80,7 +80,7 @@ public class CreateSectionWidgetAction extends StaticSelectionCommandAction {
CompositeWidget newWidget = UiFactory.eINSTANCE.createCompositeWidget();
- for(Map.Entry<String, String> entry : getNamespaces().entrySet()) {
+ for (Map.Entry<String, String> entry : getNamespaces().entrySet()) {
ValueAttribute attribute = UiFactory.eINSTANCE.createValueAttribute();
attribute.setName(entry.getKey());
attribute.setValue(entry.getValue());
@@ -107,7 +107,7 @@ public class CreateSectionWidgetAction extends StaticSelectionCommandAction {
private Command getCreateResourceCommand(CompositeWidget newWidget) {
URI widgetURI;
- if(section.getSectionFile() == null || section.getSectionFile().equals("")) { //$NON-NLS-1$
+ if (section.getSectionFile() == null || section.getSectionFile().equals("")) { //$NON-NLS-1$
section.setSectionFile(section.getName() + ".xwt"); //$NON-NLS-1$
}
@@ -119,7 +119,7 @@ public class CreateSectionWidgetAction extends StaticSelectionCommandAction {
}
private Command getSetWidgetCommand(CompositeWidget newWidget) {
- if(section.getWidget() == null) {
+ if (section.getWidget() == null) {
return SetCommand.create(editingDomain, section, section.eClass().getEStructuralFeature("widget"), newWidget); //$NON-NLS-1$
} else {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCopyAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCopyAction.java
index a354736763b..cc96a4acee2 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCopyAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCopyAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.customization.properties.util.ActionUtil;
/**
* An adapter for the EMF "Copy" Action, compatible with the
* MoDisco customizable content provider.
- *
+ *
* @author Camille Letavernier
*/
public class MoDiscoCopyAction extends CopyAction {
@@ -34,9 +34,9 @@ public class MoDiscoCopyAction extends CopyAction {
/**
* Constructor.
- *
+ *
* @param domain
- * The Editing domain on which the action will be executed
+ * The Editing domain on which the action will be executed
*/
public MoDiscoCopyAction(EditingDomain domain) {
super(domain);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCutAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCutAction.java
index e28d70c4904..456aff8fa05 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCutAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoCutAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.customization.properties.util.ActionUtil;
/**
* An adapter for the EMF "Cut" Action, compatible with the
* MoDisco customizable content provider.
- *
+ *
* @author Camille Letavernier
*/
public class MoDiscoCutAction extends CutAction {
@@ -33,11 +33,11 @@ public class MoDiscoCutAction extends CutAction {
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param domain
- * The Editing domain on which the command will be executed
+ * The Editing domain on which the command will be executed
*/
public MoDiscoCutAction(EditingDomain domain) {
super(domain);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoDeleteAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoDeleteAction.java
index 21023f7e3d2..68733f86f72 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoDeleteAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoDeleteAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,20 +21,20 @@ import org.eclipse.papyrus.customization.properties.util.ActionUtil;
/**
* An adapter for the EMF "Delete" Action, compatible with the
* MoDisco customizable content provider.
- *
+ *
* @author Camille Letavernier
*/
public class MoDiscoDeleteAction extends DeleteAction {
/**
* Constructor.
- *
+ *
* @param domain
- * The editing domain on which the action will be called
+ * The editing domain on which the action will be called
* @param removeAllReferences
- * If true, all references to the deleted object will be removed.
- * This causes the whole resourceSet to be loaded, which may
- * lead to performance issues.
+ * If true, all references to the deleted object will be removed.
+ * This causes the whole resourceSet to be loaded, which may
+ * lead to performance issues.
*/
public MoDiscoDeleteAction(EditingDomain domain, boolean removeAllReferences) {
super(domain, removeAllReferences);
@@ -42,22 +42,22 @@ public class MoDiscoDeleteAction extends DeleteAction {
/**
* Constructor. All references to the deleted object will be removed.
- *
+ *
* @param domain
- * The editing domain on which the action will be called
+ * The editing domain on which the action will be called
*/
public MoDiscoDeleteAction(EditingDomain domain) {
super(domain);
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param removeAllReferences
- * If true, all references to the deleted object will be removed.
- * This causes the whole resourceSet to be loaded, which may
- * lead to performance issues.
+ * If true, all references to the deleted object will be removed.
+ * This causes the whole resourceSet to be loaded, which may
+ * lead to performance issues.
*/
public MoDiscoDeleteAction(boolean removeAllReferences) {
super(removeAllReferences);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoPasteAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoPasteAction.java
index b75e631e19a..a4e7a922504 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoPasteAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/MoDiscoPasteAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.customization.properties.util.ActionUtil;
/**
* An adapter for the EMF "Paste" Action, compatible with the
* MoDisco customizable content provider.
- *
+ *
* @author Camille Letavernier
*/
public class MoDiscoPasteAction extends PasteAction {
@@ -33,11 +33,11 @@ public class MoDiscoPasteAction extends PasteAction {
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param domain
- * The editing domain on which the command will be called
+ * The editing domain on which the command will be called
*/
public MoDiscoPasteAction(EditingDomain domain) {
super(domain);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java
index 68ea485d589..43a4b08ab9c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@ import org.eclipse.swt.graphics.Image;
* An EMF Compound Command with support for Images, Tooltip text and description
* (From CommandActionDelegate)
* The first sub-command should be a CommandActionDelegate
- *
+ *
* @author Camille Letavernier
*/
public class StrictCompoundCommandActionDelegate extends StrictCompoundCommand implements CommandActionDelegate {
@@ -32,32 +32,36 @@ public class StrictCompoundCommandActionDelegate extends StrictCompoundCommand i
/**
* Sets the Image for this command
- *
+ *
* @param image
- * The image to display on the command
+ * The image to display on the command
*/
public void setImage(Image image) {
this.image = image;
}
+ @Override
public Object getImage() {
- if(image == null)
- return ((CommandActionDelegate)getCommandList().get(0)).getImage();
- else
+ if (image == null) {
+ return ((CommandActionDelegate) getCommandList().get(0)).getImage();
+ } else {
return image;
+ }
}
+ @Override
public String getText() {
- return ((CommandActionDelegate)getCommandList().get(0)).getText();
+ return ((CommandActionDelegate) getCommandList().get(0)).getText();
}
+ @Override
public String getToolTipText() {
- return ((CommandActionDelegate)getCommandList().get(0)).getToolTipText();
+ return ((CommandActionDelegate) getCommandList().get(0)).getToolTipText();
}
@Override
public String getDescription() {
- return ((CommandActionDelegate)getCommandList().get(0)).getDescription();
+ return ((CommandActionDelegate) getCommandList().get(0)).getDescription();
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextAction.java
index d1ea2769cbf..b9fd7660f98 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,9 +20,9 @@ import org.eclipse.ui.PlatformUI;
/**
* An action to toggle the display of the DataContextElements in the UIEditor
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ToggleDataContextAction extends AbstractHandler {
@@ -31,16 +31,17 @@ public class ToggleDataContextAction extends AbstractHandler {
*/
public static boolean showDataContext = false;
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
showDataContext = !showDataContext;
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if(editor instanceof UIEditor) {
- UIEditor uiEditor = (UIEditor)editor;
+ if (editor instanceof UIEditor) {
+ UIEditor uiEditor = (UIEditor) editor;
uiEditor.getViewer().refresh();
}
// State state = event.getCommand().getState("org.eclipse.papyrus.customization.properties.displayContextState"); //$NON-NLS-1$
- // state.setValue(showDataContext);
+ // state.setValue(showDataContext);
return null;
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextState.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextState.java
index 5af54e83de2..46759e5aafe 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextState.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ToggleDataContextState.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewAction.java
index 621a14fa8f0..dcf42eda113 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,39 +23,40 @@ import org.eclipse.ui.part.ViewPart;
/**
* An action to toggle the UIEditor Preview
- *
+ *
* @author Camille Letavernier
*/
public class TogglePreviewAction extends AbstractHandler {
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
- //System.out.println("Toggle");
+ // System.out.println("Toggle");
event.getCommand().getState("org.eclipse.papyrus.customization.properties.previewstate"); //$NON-NLS-1$
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- if(activePage == null) {
+ if (activePage == null) {
return null;
}
- //System.out.println("ActivePage is " + activePage);
+ // System.out.println("ActivePage is " + activePage);
IViewReference viewReference = null;
- for(IViewReference reference : activePage.getViewReferences()) {
- if(reference.getId().equals(Activator.PREVIEW_ID)) {
+ for (IViewReference reference : activePage.getViewReferences()) {
+ if (reference.getId().equals(Activator.PREVIEW_ID)) {
viewReference = reference;
}
}
try {
- if(viewReference == null) {
- //System.out.println("Opening view");
+ if (viewReference == null) {
+ // System.out.println("Opening view");
activePage.showView(Activator.PREVIEW_ID);
} else {
- //System.out.println("Closing view");
- activePage.hideView((ViewPart)viewReference.getPart(false));
+ // System.out.println("Closing view");
+ activePage.hideView((ViewPart) viewReference.getPart(false));
}
} catch (PartInitException ex) {
Activator.log.error(ex);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewState.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewState.java
index 1042c7119a4..afd4a3de093 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewState.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/TogglePreviewState.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import org.eclipse.ui.IWorkbenchWindow;
* A State to determine if the Preview view is opened in the current perspective
* The State should listen on the workbench an update itself when the perspective
* changes, or when the preview is opened or closed
- *
+ *
* @FIXME : the state is not correctly retrieved
* @author Camille Letavernier
*/
@@ -32,39 +32,39 @@ public class TogglePreviewState extends State implements IWindowListener, IPartL
private boolean isPreviewOpen;
public TogglePreviewState() {
- // System.out.println("Building ToggleState");
+ // System.out.println("Building ToggleState");
//
- // IWorkbench workbench = PlatformUI.getWorkbench();
+ // IWorkbench workbench = PlatformUI.getWorkbench();
//
- // workbench.addWindowListener(this);
- // for(IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
- // System.out.println("Listening on " + window);
- // window.getPartService().addPartListener(this);
- // }
- // refreshState();
+ // workbench.addWindowListener(this);
+ // for(IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
+ // System.out.println("Listening on " + window);
+ // window.getPartService().addPartListener(this);
+ // }
+ // refreshState();
}
private void refreshState() {
- // isPreviewOpen = false;
- // System.out.println("Refresh state");
+ // isPreviewOpen = false;
+ // System.out.println("Refresh state");
//
- // IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- // if(window != null) {
- // IWorkbenchPage page = window.getActivePage();
+ // IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ // if(window != null) {
+ // IWorkbenchPage page = window.getActivePage();
//
- // if(page != null) {
- // for(IViewReference reference : page.getViewReferences()) {
- // if(reference.getId().equals(Activator.PREVIEW_ID)) {
- // isPreviewOpen = true;
- // break;
- // }
- // }
- // }
- // }
+ // if(page != null) {
+ // for(IViewReference reference : page.getViewReferences()) {
+ // if(reference.getId().equals(Activator.PREVIEW_ID)) {
+ // isPreviewOpen = true;
+ // break;
+ // }
+ // }
+ // }
+ // }
//
- // System.out.println("IsOpen : " + isPreviewOpen);
+ // System.out.println("IsOpen : " + isPreviewOpen);
//
- // setValue(isPreviewOpen);
+ // setValue(isPreviewOpen);
}
@Override
@@ -72,71 +72,80 @@ public class TogglePreviewState extends State implements IWindowListener, IPartL
return isPreviewOpen;
}
- //IWindowListener
+ // IWindowListener
+ @Override
public void windowOpened(IWorkbenchWindow window) {
- //System.out.println("Listening on " + window);
+ // System.out.println("Listening on " + window);
window.getPartService().addPartListener(this);
refreshState();
}
+ @Override
public void windowClosed(IWorkbenchWindow window) {
- //window.removePageListener(this);
+ // window.removePageListener(this);
window.getPartService().removePartListener(this);
}
- //IPageListener
+ // IPageListener
//
- // public void pageOpened(IWorkbenchPage page) {
- // page.addPartListener(this);
- // }
+ // public void pageOpened(IWorkbenchPage page) {
+ // page.addPartListener(this);
+ // }
//
- // public void pageClosed(IWorkbenchPage page) {
- // page.removePartListener(this);
- // }
+ // public void pageClosed(IWorkbenchPage page) {
+ // page.removePartListener(this);
+ // }
- //IPartListener
+ // IPartListener
+ @Override
public void partOpened(IWorkbenchPart part) {
- if(part instanceof Preview) {
- //System.out.println("Closing preview");
+ if (part instanceof Preview) {
+ // System.out.println("Closing preview");
refreshState();
}
}
+ @Override
public void partClosed(IWorkbenchPart part) {
- if(part instanceof Preview) {
- //System.out.println("Closing preview");
+ if (part instanceof Preview) {
+ // System.out.println("Closing preview");
refreshState();
}
}
- //Ignored methods
+ // Ignored methods
+ @Override
public void partActivated(IWorkbenchPart part) {
- // System.out.println("Part activated");
- // refreshState();
+ // System.out.println("Part activated");
+ // refreshState();
}
+ @Override
public void partBroughtToTop(IWorkbenchPart part) {
- //Nothing
+ // Nothing
}
+ @Override
public void partDeactivated(IWorkbenchPart part) {
- // System.out.println("Part activated");
- // refreshState();
+ // System.out.println("Part activated");
+ // refreshState();
}
+ @Override
public void windowActivated(IWorkbenchWindow window) {
- //Nothing
+ // Nothing
}
+ @Override
public void windowDeactivated(IWorkbenchWindow window) {
- //Nothing
+ // Nothing
}
public void pageActivated(IWorkbenchPage page) {
- //Nothing
+ // Nothing
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ValidationAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ValidationAction.java
index 3056ba1a175..45dd7877775 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ValidationAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/ValidationAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,13 +18,13 @@ import org.eclipse.papyrus.customization.properties.util.ActionUtil;
/**
* An adapter for the EMF "Validate" Action, compatible with the
* MoDisco customizable content provider.
- *
+ *
* @author Camille Letavernier
*/
public class ValidationAction extends ValidateAction {
@Override
public boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection((IStructuredSelection)ActionUtil.getAdaptedSelection(selection));
+ return super.updateSelection((IStructuredSelection) ActionUtil.getAdaptedSelection(selection));
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
index 50befdfc36a..09b27ecd5b5 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
@@ -10,7 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Use URIs to support non-URL-compatible storage (CDO)
* Christian W. Damus (CEA) - bug 417409
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.editor.preview;
@@ -130,7 +130,7 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
* Creates the preview control in the given composite.
*
* @param container
- * The SWT Composite in which the preview should be displayed
+ * The SWT Composite in which the preview should be displayed
*/
@Override
public void createPartControl(Composite container) {
@@ -151,51 +151,51 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
GridData data;
- // Label preview = new Label(controls, SWT.NONE);
+ // Label preview = new Label(controls, SWT.NONE);
// preview.setImage(Activator.getDefault().getImage("/icons/preview.png")); //$NON-NLS-1$
- // data = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
- // preview.setLayoutData(data);
+ // data = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
+ // preview.setLayoutData(data);
- // Label previewText = new Label(controls, SWT.NONE);
- // previewText.setText(Messages.Preview_preview);
- // data = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
- // previewText.setLayoutData(data);
+ // Label previewText = new Label(controls, SWT.NONE);
+ // previewText.setText(Messages.Preview_preview);
+ // data = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
+ // previewText.setLayoutData(data);
previewTitle = new Label(controls, SWT.NONE);
data = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
previewTitle.setLayoutData(data);
- // final Button togglePreview = new Button(controls, SWT.CHECK);
- // togglePreview.setText(Messages.Preview_disablePreview);
- // togglePreview.addSelectionListener(new SelectionListener() {
+ // final Button togglePreview = new Button(controls, SWT.CHECK);
+ // togglePreview.setText(Messages.Preview_disablePreview);
+ // togglePreview.addSelectionListener(new SelectionListener() {
//
- // public void widgetSelected(SelectionEvent e) {
- // enabled = !enabled;
- // displayView();
- // }
+ // public void widgetSelected(SelectionEvent e) {
+ // enabled = !enabled;
+ // displayView();
+ // }
//
- // public void widgetDefaultSelected(SelectionEvent e) {
- // //Nothing
- // }
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ // //Nothing
+ // }
//
- // });
+ // });
previewDisabled = new Label(parent, SWT.NONE);
previewDisabled.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
contents = new CTabFolder(parent, SWT.VERTICAL);
- //If currentEditors is empty, the preview is displayed in a view and
- //should listen to the workbench to know about the activeEditor
- if(currentEditors.isEmpty()) {
+ // If currentEditors is empty, the preview is displayed in a view and
+ // should listen to the workbench to know about the activeEditor
+ if (currentEditors.isEmpty()) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if(window != null) {
+ if (window != null) {
activePage = window.getActivePage();
- if(activePage != null) {
+ if (activePage != null) {
IEditorPart editorPart = activePage.getActiveEditor();
- if(editorPart instanceof UIEditor) {
- setEditor((UIEditor)editorPart);
+ if (editorPart instanceof UIEditor) {
+ setEditor((UIEditor) editorPart);
}
activePage.addPartListener(this);
@@ -222,7 +222,7 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
private void refreshDisplay() {
Point size = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- if(scrolledParent.getSize().x > 0) {
+ if (scrolledParent.getSize().x > 0) {
size.x = scrolledParent.getSize().x - 30;
}
parent.setSize(size);
@@ -233,12 +233,12 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
* can then be interpreted by XWT. Returns the URL to this file.
*
* @param section
- * The section for which we want to persist the XWT Resource
+ * The section for which we want to persist the XWT Resource
* @return
* The URL to the XWT Resource
*/
private URL saveTmp(Section section) {
- if(section.getSectionFile() == null || section.getWidget() == null) {
+ if (section.getSectionFile() == null || section.getWidget() == null) {
return null;
}
@@ -246,13 +246,13 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
path = path.append("/preview/"); //$NON-NLS-1$
try {
File previewDirectory = path.toFile();
- if(!previewDirectory.exists()) {
+ if (!previewDirectory.exists()) {
previewDirectory.mkdirs();
}
File xwtFile = path.append(section.getSectionFile()).toFile();
- if(!xwtFile.exists()) {
+ if (!xwtFile.exists()) {
xwtFile.getParentFile().mkdirs();
xwtFile.createNewFile();
}
@@ -260,10 +260,10 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
OutputStream os = new FileOutputStream(xwtFile);
try {
Map<Object, Object> options = new HashMap<Object, Object>();
- //The outputstream cannot be formatted. If format is true, this is
- //the real file (and not the preview file) that will be formatted
+ // The outputstream cannot be formatted. If format is true, this is
+ // the real file (and not the preview file) that will be formatted
options.put(XWTResource.OPTION_FORMAT, false);
- if(section.getWidget() == null || section.getWidget().eResource() == null) {
+ if (section.getWidget() == null || section.getWidget().eResource() == null) {
return null;
}
section.getWidget().eResource().save(os, options);
@@ -282,12 +282,12 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
* Sets the view to display in the preview
*
* @param view
- * The view to display
+ * The view to display
*/
public void setView(View view) {
this.currentView = view;
- if(view != null) {
- if(view.getName() == null) {
+ if (view != null) {
+ if (view.getName() == null) {
previewTitle.setText(Messages.Preview_Unnamed);
} else {
previewTitle.setText(view.getName());
@@ -301,7 +301,7 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
}
private void setPreviewError(String message) {
- if(message != null) {
+ if (message != null) {
previewDisabled.setText(message);
previewDisabled.setVisible(true);
} else {
@@ -317,23 +317,23 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
public void displayView() {
contents.dispose();
- if(!enabled) {
+ if (!enabled) {
setPreviewError(Messages.Preview_previewIsDisabled);
return;
}
- if(currentView == null) {
+ if (currentView == null) {
setPreviewError(Messages.Preview_noSelectedView);
return;
}
setPreviewError(null);
- if(displayEngine != null) {
+ if (displayEngine != null) {
// Dispose of the old engine before employing a new one
displayEngine.dispose();
}
-
+
displayEngine = new DefaultDisplayEngine();
Map<Tab, Composite> tabs = new HashMap<Tab, Composite>();
@@ -342,11 +342,11 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
boolean activeTab = false;
- for(Tab tab : getTabs(currentView)) {
+ for (Tab tab : getTabs(currentView)) {
CTabItem tabItem = new CTabItem(contents, SWT.NONE);
tabItem.setText(tab.getLabel());
- if(tab.getLabel().equals(selectedTab) || !activeTab) {
+ if (tab.getLabel().equals(selectedTab) || !activeTab) {
contents.setSelection(tabItem);
activeTab = true;
}
@@ -369,16 +369,16 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
});
}
- for(Section section : currentView.getSections()) {
+ for (Section section : currentView.getSections()) {
Composite tabControl = tabs.get(section.getTab());
- if(tabControl == null) {
- Activator.log.warn("The section doesn't have a tab"); //Bug in section deletion: it is still referenced by the views
+ if (tabControl == null) {
+ Activator.log.warn("The section doesn't have a tab"); // Bug in section deletion: it is still referenced by the views
continue;
}
Composite pView = new Composite(tabControl, SWT.NONE);
pView.setLayout(new GridLayout(1, false));
URL sectionURL = saveTmp(section);
- if(sectionURL != null) {
+ if (sectionURL != null) {
displayEngine.createSection(pView, section, URI.createURI(sectionURL.toExternalForm(), true), null);
}
}
@@ -390,9 +390,9 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
List<Tab> tabs = new LinkedList<Tab>();
- for(Section section : view.getSections()) {
+ for (Section section : view.getSections()) {
Tab tab = section.getTab();
- if(tab != null && !tabs.contains(tab)) {
+ if (tab != null && !tabs.contains(tab)) {
tabs.add(tab);
}
}
@@ -404,11 +404,11 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
Tab afterTab1 = tab1.getAfterTab();
Tab afterTab2 = tab2.getAfterTab();
- if(isAfter(tab1, afterTab2, new HashSet<Tab>())) {
+ if (isAfter(tab1, afterTab2, new HashSet<Tab>())) {
return -1;
}
- if(isAfter(tab2, afterTab1, new HashSet<Tab>())) {
+ if (isAfter(tab2, afterTab1, new HashSet<Tab>())) {
return 1;
}
@@ -421,18 +421,18 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
}
private boolean isAfter(Tab tab1, Tab tab2, Set<Tab> checkedTabs) {
- if(checkedTabs.contains(tab2)) {
+ if (checkedTabs.contains(tab2)) {
Activator.log.warn("Loop in the afterTabs"); //$NON-NLS-1$
return false;
}
checkedTabs.add(tab2);
- if(tab2 == null) {
+ if (tab2 == null) {
return false;
}
- if(tab1.equals(tab2)) {
+ if (tab1.equals(tab2)) {
return true;
}
@@ -443,25 +443,25 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
* The preview listens on
*
* @param event
- * The SelectionChangedEvent
+ * The SelectionChangedEvent
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- if(selection.size() == 1) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.size() == 1) {
TreeElement child = null;
- TreeElement treeElement = (TreeElement)selection.getFirstElement();
+ TreeElement treeElement = (TreeElement) selection.getFirstElement();
do {
EObject semantic = EMFHelper.getEObject(treeElement);
- if(semantic instanceof View) {
- setView((View)semantic);
+ if (semantic instanceof View) {
+ setView((View) semantic);
return;
}
child = treeElement;
treeElement = treeElement.getParent();
- } while(child != treeElement && treeElement != null);
+ } while (child != treeElement && treeElement != null);
}
}
@@ -469,8 +469,8 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
* Activate or deactivate the preview
*
* @param enabled
- * If true, the preview will be activated. Otherwise, it will
- * be disabled
+ * If true, the preview will be activated. Otherwise, it will
+ * be disabled
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
@@ -483,37 +483,37 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
@Override
public void partActivated(IWorkbenchPart part) {
- if(part instanceof UIEditor) {
- setEditor((UIEditor)part);
+ if (part instanceof UIEditor) {
+ setEditor((UIEditor) part);
}
}
@Override
public void partBroughtToTop(IWorkbenchPart part) {
- //Nothing
+ // Nothing
}
@Override
public void partClosed(IWorkbenchPart part) {
- //Nothing
+ // Nothing
}
@Override
public void partDeactivated(IWorkbenchPart part) {
- //Nothing
+ // Nothing
}
@Override
public void partOpened(IWorkbenchPart part) {
- //Nothing
+ // Nothing
}
@Override
public void dispose() {
- for(UIEditor editor : currentEditors) {
+ for (UIEditor editor : currentEditors) {
editor.removePreview(this);
}
- if(activePage != null) {
+ if (activePage != null) {
activePage.removePartListener(this);
}
super.dispose();
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/messages/Messages.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/messages/Messages.java
index ff5c0d0ac1f..2018a645cf3 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/messages/Messages.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/messages/Messages.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -41,7 +41,7 @@ public class Messages extends NLS {
public static String CustomizationDialog_configurationWithSameNameExists;
public static String CustomizationDialog_copy;
-
+
public static String CustomizationDialog_copyToWorkspace;
public static String CustomizationDialog_copyOf;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
index 63d01c00974..f53f3f88b25 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElement.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 417409
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.modelelement;
@@ -75,12 +75,12 @@ public class CustomizationModelElement extends AbstractModelElement {
* Constructs a new ModelElement.
*
* @param delegate
- * If this model element cannot handle a given property, it will
- * delegate the call to a standard EMF ModelElement
+ * If this model element cannot handle a given property, it will
+ * delegate the call to a standard EMF ModelElement
*/
public CustomizationModelElement(EMFModelElement delegate) {
this.delegate = delegate;
- if(providers == null) {
+ if (providers == null) {
initializeProviders();
}
}
@@ -99,7 +99,7 @@ public class CustomizationModelElement extends AbstractModelElement {
@Override
public IObservable doGetObservable(String propertyPath) {
EStructuralFeature feature = delegate.getFeature(propertyPath);
- if(ContextsPackage.eINSTANCE.getSection_Name() == feature) {
+ if (ContextsPackage.eINSTANCE.getSection_Name() == feature) {
return new SectionNameObservableValue(delegate.getSource(), feature, delegate.getDomain());
}
return delegate.getObservable(propertyPath);
@@ -108,21 +108,21 @@ public class CustomizationModelElement extends AbstractModelElement {
@Override
public IStaticContentProvider getContentProvider(String propertyPath) {
EStructuralFeature feature = delegate.getFeature(propertyPath);
- if(feature == null) {
+ if (feature == null) {
return EmptyContentProvider.instance;
}
IStaticContentProvider provider = findProvider(feature);
- if(provider == null) {
+ if (provider == null) {
return delegate.getContentProvider(propertyPath);
}
- if(provider instanceof ITreeContentProvider) {
- IStrategyBasedContentProvider strategyProvider = getStrategyProvider((ITreeContentProvider)provider);
+ if (provider instanceof ITreeContentProvider) {
+ IStrategyBasedContentProvider strategyProvider = getStrategyProvider((ITreeContentProvider) provider);
- if(feature.getEType() == EnvironmentPackage.eINSTANCE.getPropertyEditorType()) {
- return new PropertyEditorTypeContentProvider(strategyProvider, (PropertyEditor)delegate.getSource());
+ if (feature.getEType() == EnvironmentPackage.eINSTANCE.getPropertyEditorType()) {
+ return new PropertyEditorTypeContentProvider(strategyProvider, (PropertyEditor) delegate.getSource());
} else {
return new EMFGraphicalContentProvider(strategyProvider, ConfigurationManager.getInstance().getResourceSet(), "history_" + feature.getName());
}
@@ -139,32 +139,32 @@ public class CustomizationModelElement extends AbstractModelElement {
protected IStaticContentProvider findProvider(EStructuralFeature feature) {
EClassifier classifier = feature.getEType();
- if(providers.containsKey(classifier)) {
+ if (providers.containsKey(classifier)) {
return providers.get(classifier);
- } else if(classifier == ContextsPackage.eINSTANCE.getProperty()) {
+ } else if (classifier == ContextsPackage.eINSTANCE.getProperty()) {
return new PropertyContentProvider(delegate.getSource());
- } else if(classifier == ContextsPackage.eINSTANCE.getTab()) {
- //Sections can only be moved to tabs from non-plugin contexts
+ } else if (classifier == ContextsPackage.eINSTANCE.getTab()) {
+ // Sections can only be moved to tabs from non-plugin contexts
boolean editableTabsOnly = delegate.getSource() instanceof Section;
return new TabContentProvider(delegate.getSource(), editableTabsOnly);
- } else if(classifier instanceof EClass && EMFHelper.isSubclass((EClass)classifier, ConstraintsPackage.eINSTANCE.getConstraintDescriptor())) {
- return new ConstraintDescriptorContentProvider(delegate.getSource(), (EClass)classifier);
- } else if(isDataContextElement(classifier)) {
- return new DataContextElementContentProvider((DataContextElement)delegate.getSource());
- } else if(classifier == ContextsPackage.eINSTANCE.getContext()) {
- return new DependencyContentProvider((Context)delegate.getSource());
+ } else if (classifier instanceof EClass && EMFHelper.isSubclass((EClass) classifier, ConstraintsPackage.eINSTANCE.getConstraintDescriptor())) {
+ return new ConstraintDescriptorContentProvider(delegate.getSource(), (EClass) classifier);
+ } else if (isDataContextElement(classifier)) {
+ return new DataContextElementContentProvider((DataContextElement) delegate.getSource());
+ } else if (classifier == ContextsPackage.eINSTANCE.getContext()) {
+ return new DependencyContentProvider((Context) delegate.getSource());
}
return null;
}
private boolean isDataContextElement(EClassifier classifier) {
- if(classifier == ContextsPackage.eINSTANCE.getDataContextElement()) {
+ if (classifier == ContextsPackage.eINSTANCE.getDataContextElement()) {
return true;
}
- if(classifier instanceof EClass) {
- EClass eClass = (EClass)classifier;
+ if (classifier instanceof EClass) {
+ EClass eClass = (EClass) classifier;
return eClass.getEAllSuperTypes().contains(ContextsPackage.eINSTANCE.getDataContextElement());
}
@@ -193,7 +193,7 @@ public class CustomizationModelElement extends AbstractModelElement {
@Override
public boolean isEditable(String propertyPath) {
- if(delegate.getFeature(propertyPath) == ContextsPackage.eINSTANCE.getSection_SectionFile()) {
+ if (delegate.getFeature(propertyPath) == ContextsPackage.eINSTANCE.getSection_SectionFile()) {
return false;
}
return delegate.isEditable(propertyPath);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java
index 9a3d00d99d1..176f3a6805a 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/CustomizationModelElementFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2014 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
@@ -23,22 +23,22 @@ import org.eclipse.papyrus.views.properties.modelelement.EMFModelElementFactory;
/**
* A Factory for build {@link CustomizationModelElement}s
- *
+ *
* @author Camille Letavernier
*/
public class CustomizationModelElementFactory extends AbstractModelElementFactory<CustomizationModelElement> {
private static final EMFModelElementFactory emfFactory = new EMFModelElementFactory();
-
+
@Override
protected CustomizationModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
- return new CustomizationModelElement((EMFModelElement)emfFactory.createFromSource(sourceElement, context));
+ return new CustomizationModelElement((EMFModelElement) emfFactory.createFromSource(sourceElement, context));
}
-
+
@Override
protected void updateModelElement(CustomizationModelElement modelElement, Object newSourceElement) {
EObject eObject = EMFHelper.getEObject(newSourceElement);
- if(eObject == null) {
+ if (eObject == null) {
throw new IllegalArgumentException("Cannot resolve EObject selection: " + newSourceElement);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java
index 06f1e8ebbde..d38e3c5be0d 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElement.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2014 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
@@ -39,28 +39,28 @@ import org.eclipse.papyrus.views.properties.ui.WidgetAttribute;
* XWT relies a lot on reflectivity, as it is based on an XML syntax.
* However, in some cases, we like to have real attributes, to use them as
* specific properties in the Property view.
- *
+ *
* This ModelElement is a bridge between reflective properties and predefined
* properties.
- *
+ *
* It has been designed to use pre-defined {@link ConfigProperty} and {@link WidgetAttribute}, but can also be used for other EMF classes based on
* a key/value pair.
- *
+ *
* For example, some layouts need a "numColumns" property, but not all of them.
* In fact, this property is specific to the "GridLayout" and
* "PropertiesLayout". This property is defined via a key/value pair
* (i.e. a {@link WidgetAttribute} which name is "numColumns" and the value is the
* number of columns). However, in the property view, we want to display a field "Number
* of Columns" when we select a GridLayout or PropertiesLayout.
- *
+ *
* The same goes for Constraints : EMFInstanceOf needs a "nsUri" and
* "className" {@link ConfigProperty}, while "UmlInstanceOf" needs a
* "umlClassName" {@link ConfigProperty}.
- *
- *
+ *
+ *
* @see GenericPropertyModelElementFactory
* @see GenericAttributeModelElementFactory
- *
+ *
* @author Camille Letavernier
*/
public class GenericAttributeModelElement extends AbstractModelElement {
@@ -78,21 +78,21 @@ public class GenericAttributeModelElement extends AbstractModelElement {
private EClass createAsReference;
/**
- *
+ *
* Constructs a new ModelElement for handling generic, reflective properties
- *
+ *
* @param source
- * The EObject being edited
+ * The EObject being edited
* @param domain
- * The Editing domain on which the commands will be executed
+ * The Editing domain on which the commands will be executed
* @param createIn
- * The Feature in which the new value will be created
+ * The Feature in which the new value will be created
* @param createFrom
- * The EFactory used to instantiate the value
+ * The EFactory used to instantiate the value
* @param createAsValue
- * The EClass used to instantiate the value, if the value is an instance of datatype
+ * The EClass used to instantiate the value, if the value is an instance of datatype
* @param createAsReference
- * The EClass used to instantiate the value, if the value is a reference to an instance of EClass
+ * The EClass used to instantiate the value, if the value is a reference to an instance of EClass
*/
public GenericAttributeModelElement(EObject source, EditingDomain domain, EStructuralFeature createIn, EFactory createFrom, EClass createAsValue, EClass createAsReference) {
this.source = source;
@@ -112,12 +112,13 @@ public class GenericAttributeModelElement extends AbstractModelElement {
public IStaticContentProvider getContentProvider(String propertyPath) {
return new AbstractStaticContentProvider() {
+ @Override
public Object[] getElements() {
Collection<EObject> result = ItemPropertyDescriptor.getReachableObjectsOfType(source, EcorePackage.eINSTANCE.getEObject());
Iterator<EObject> iterator = result.iterator();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
EObject eObject = iterator.next();
- if(!(eObject instanceof org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query)) {
+ if (!(eObject instanceof org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query)) {
iterator.remove();
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java
index 063125a3c1f..7efa8feaa66 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeModelElementFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2014 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
@@ -28,17 +28,17 @@ import org.eclipse.papyrus.views.properties.ui.WidgetAttribute;
/**
* A ModelElementFactory for handling {@link WidgetAttribute} properties
- *
+ *
* @author Camille Letavernier
*/
public class GenericAttributeModelElementFactory extends AbstractModelElementFactory<GenericAttributeModelElement> {
- //Source : Group
- //context : Custom:Attribute:Group
+ // Source : Group
+ // context : Custom:Attribute:Group
@Override
protected GenericAttributeModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
EObject source = EMFHelper.getEObject(sourceElement);
- if(source == null) {
+ if (source == null) {
Activator.log.warn("Unable to resolve the source element to an EObject"); //$NON-NLS-1$
return null;
}
@@ -52,14 +52,14 @@ public class GenericAttributeModelElementFactory extends AbstractModelElementFac
return new GenericAttributeModelElement(source, domain, attributes, UiFactory.eINSTANCE, valueAttribute, referenceAttribute);
}
- // public List<ModelElement> createFromDataSource(ModelElement currentElement, DataSource source, String propertyPath, DataContextElement context) {
- // throw new UnsupportedOperationException();
- // }
+ // public List<ModelElement> createFromDataSource(ModelElement currentElement, DataSource source, String propertyPath, DataContextElement context) {
+ // throw new UnsupportedOperationException();
+ // }
@Override
protected void updateModelElement(GenericAttributeModelElement modelElement, Object newSourceElement) {
EObject eObject = EMFHelper.getEObject(newSourceElement);
- if(eObject == null) {
+ if (eObject == null) {
throw new IllegalArgumentException("Cannot resolve EObject selection: " + newSourceElement);
}
modelElement.source = eObject;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java
index 7c7a084f2de..7af07b75af8 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericAttributeObservable.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,9 +28,9 @@ import org.eclipse.emf.edit.domain.EditingDomain;
* An observable value for manipulating reflective properties
* (Based on a key/value pair). The modifications are based on EMF
* commands.
- *
+ *
* @see GenericAttributeModelElement
- *
+ *
* @author Camille Letavernier
*/
public class GenericAttributeObservable extends AbstractObservableValue {
@@ -50,23 +50,23 @@ public class GenericAttributeObservable extends AbstractObservableValue {
private String propertyPath;
/**
- *
+ *
* Constructor.
- *
+ *
* @param source
- * The EObject being edited
+ * The EObject being edited
* @param domain
- * The Editing domain on which the commands will be executed
+ * The Editing domain on which the commands will be executed
* @param createIn
- * The Feature in which the value will be set
+ * The Feature in which the value will be set
* @param createFrom
- * The Factory used to instantiate the new value
+ * The Factory used to instantiate the new value
* @param createAsValue
- * The EClass that will be instantiated for the new value, if it is an attribute
+ * The EClass that will be instantiated for the new value, if it is an attribute
* @param createAsReference
- * The EClass that will be instantiated for the new value, if it is a reference
+ * The EClass that will be instantiated for the new value, if it is a reference
* @param propertyPath
- * The value of the "name" attribute (Which is the "key" of the property)
+ * The value of the "name" attribute (Which is the "key" of the property)
*/
public GenericAttributeObservable(EObject source, EditingDomain domain, EStructuralFeature createIn, EFactory createFrom, EClass createAsValue, EClass createAsReference, String propertyPath) {
this.source = source;
@@ -78,6 +78,7 @@ public class GenericAttributeObservable extends AbstractObservableValue {
this.propertyPath = propertyPath;
}
+ @Override
public Object getValueType() {
return Object.class;
}
@@ -85,7 +86,7 @@ public class GenericAttributeObservable extends AbstractObservableValue {
@Override
protected Object doGetValue() {
EObject attribute = findAttribute();
- if(attribute == null) {
+ if (attribute == null) {
return null;
}
Object result = attribute.eGet(attribute.eClass().getEStructuralFeature("value")); //$NON-NLS-1$
@@ -95,15 +96,15 @@ public class GenericAttributeObservable extends AbstractObservableValue {
/**
* Browse the existing attributes in the given feature, and returns the
* one with the same name, if it exists, or null otherwise.
- *
+ *
* @return The attribute being edited, if it already exists, or null otherwise
*/
@SuppressWarnings("unchecked")
protected EObject findAttribute() {
- EList<? extends EObject> allAttributes = (EList<? extends EObject>)source.eGet(createIn);
- for(EObject attribute : allAttributes) {
- if(createAsValue.isInstance(attribute) || createAsReference.isInstance(attribute)) {
- if(attribute.eGet(attribute.eClass().getEStructuralFeature("name")).equals(propertyPath)) { //$NON-NLS-1$
+ EList<? extends EObject> allAttributes = (EList<? extends EObject>) source.eGet(createIn);
+ for (EObject attribute : allAttributes) {
+ if (createAsValue.isInstance(attribute) || createAsReference.isInstance(attribute)) {
+ if (attribute.eGet(attribute.eClass().getEStructuralFeature("name")).equals(propertyPath)) { //$NON-NLS-1$
return attribute;
}
}
@@ -116,34 +117,34 @@ public class GenericAttributeObservable extends AbstractObservableValue {
public void doSetValue(final Object value) {
final Object oldValue = doGetValue();
- if(value != null && value.equals(oldValue)) {
+ if (value != null && value.equals(oldValue)) {
return;
}
EObject attribute = findAttribute();
- EList<? extends EObject> collection = (EList<? extends EObject>)source.eGet(createIn);
+ EList<? extends EObject> collection = (EList<? extends EObject>) source.eGet(createIn);
CompoundCommand command = new CompoundCommand(String.format("Set %s value", propertyPath)) {
@Override
public boolean prepare() {
- //Only test the first command's canExecute(), as the following ones depend on the execution of the first one
- //Can we use a StrictCompoundCommand here ?
- if(commandList.isEmpty()) {
+ // Only test the first command's canExecute(), as the following ones depend on the execution of the first one
+ // Can we use a StrictCompoundCommand here ?
+ if (commandList.isEmpty()) {
return true;
}
return commandList.get(0).canExecute();
}
};
- if(value == null || value.equals("")) { //$NON-NLS-1$
- if(attribute != null) {
+ if (value == null || value.equals("")) { //$NON-NLS-1$
+ if (attribute != null) {
RemoveCommand rCommand = new RemoveCommand(domain, collection, attribute);
command.append(rCommand);
}
} else {
- if(attribute == null) {
- if(value instanceof String) {
+ if (attribute == null) {
+ if (value instanceof String) {
attribute = createFrom.create(createAsValue);
} else {
attribute = createFrom.create(createAsReference);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
index 4745a06dc1c..0d93398b839 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/GenericPropertyModelElementFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2014 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
@@ -28,18 +28,18 @@ import org.eclipse.papyrus.views.properties.modelelement.AbstractModelElementFac
/**
* A ModelElementFactory for handling {@link ConfigProperty} properties
- *
+ *
* @author Camille Letavernier
*/
public class GenericPropertyModelElementFactory extends AbstractModelElementFactory<GenericAttributeModelElement> {
- //Source : Group
- //context : Custom:Attribute:Group
+ // Source : Group
+ // context : Custom:Attribute:Group
@Override
protected GenericAttributeModelElement doCreateFromSource(Object sourceElement, DataContextElement context) {
EObject source = EMFHelper.getEObject(sourceElement);
- if(source == null) {
+ if (source == null) {
Activator.log.warn("Unable to resolve the source element to an EObject"); //$NON-NLS-1$
return null;
}
@@ -53,14 +53,14 @@ public class GenericPropertyModelElementFactory extends AbstractModelElementFact
return new GenericAttributeModelElement(source, domain, attributes, ConstraintsFactory.eINSTANCE, valueProperty, referenceProperty);
}
- // public List<ModelElement> createFromDataSource(ModelElement currentElement, DataSource source, String propertyPath, DataContextElement context) {
- // throw new UnsupportedOperationException();
- // }
+ // public List<ModelElement> createFromDataSource(ModelElement currentElement, DataSource source, String propertyPath, DataContextElement context) {
+ // throw new UnsupportedOperationException();
+ // }
@Override
protected void updateModelElement(GenericAttributeModelElement modelElement, Object newSourceElement) {
EObject eObject = EMFHelper.getEObject(newSourceElement);
- if(eObject == null) {
+ if (eObject == null) {
throw new IllegalArgumentException("Cannot resolve EObject selection: " + newSourceElement);
}
modelElement.source = eObject;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/SectionNameObservableValue.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/SectionNameObservableValue.java
index 52a58ca84e6..965c3a087a8 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/SectionNameObservableValue.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/modelelement/SectionNameObservableValue.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,21 +30,21 @@ import org.eclipse.papyrus.views.properties.contexts.Section;
* name. When the section's name changes, the XWT resource should
* be moved as well, and the section's sectionFile property should
* be updated.
- *
+ *
* @author Camille Letavernier
*/
public class SectionNameObservableValue extends EMFObservableValue {
/**
- *
+ *
* Constructor.
- *
+ *
* @param eObject
- * The EObject (Section) being edited
+ * The EObject (Section) being edited
* @param eStructuralFeature
- * The feature ("name") being editing
+ * The feature ("name") being editing
* @param domain
- * The editing domain on which the commands will be called
+ * The editing domain on which the commands will be called
*/
public SectionNameObservableValue(EObject eObject, EStructuralFeature eStructuralFeature, EditingDomain domain) {
super(eObject, eStructuralFeature, domain);
@@ -53,7 +53,7 @@ public class SectionNameObservableValue extends EMFObservableValue {
@Override
public void doSetValue(Object value) {
CompoundCommand command = new CompoundCommand();
- String name = (String)value;
+ String name = (String) value;
command.append(getSetCommand(name));
command.append(getMoveCommand(name));
command.append(getSetSectionFileCommand(name));
@@ -62,29 +62,29 @@ public class SectionNameObservableValue extends EMFObservableValue {
/**
* Returns a command to change the section's sectionFile when the name changes
- *
+ *
* @param name
- * The name of the section we are editing
+ * The name of the section we are editing
* @return
* The command to change the section's sectionFile
*/
protected Command getSetSectionFileCommand(String name) {
- return new SetCommand(domain, eObject, ContextsPackage.eINSTANCE.getSection_SectionFile(), "ui/" + name + ".xwt"); //$NON-NLS-1$ //$NON-NLS-2$
+ return new SetCommand(domain, eObject, ContextsPackage.eINSTANCE.getSection_SectionFile(), "ui/" + name + ".xwt"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Returns the EMF command to move the section's XWT Resource
- *
+ *
* @param name
- * The new name of the section
+ * The new name of the section
* @return
* The EMF command to move the section's XWT Resource
*/
protected Command getMoveCommand(String name) {
- Section section = (Section)eObject;
+ Section section = (Section) eObject;
- //TODO : Create a command for that
- if(section.getWidget() != null) {
+ // TODO : Create a command for that
+ if (section.getWidget() != null) {
URI newURI = URI.createURI("ui/" + name + ".xwt"); //$NON-NLS-1$ //$NON-NLS-2$
newURI = newURI.resolve(section.eResource().getURI());
ResourceSet resourceSet = section.eResource().getResourceSet();
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/perspective/CustomizationPerspectiveFactory.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/perspective/CustomizationPerspectiveFactory.java
index 6dcf260fe8f..4da66b1451b 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/perspective/CustomizationPerspectiveFactory.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/perspective/CustomizationPerspectiveFactory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@ import org.eclipse.ui.IPerspectiveFactory;
/**
* A Factory for instantiating the Customization perspective
- *
+ *
* @author Camille Letavernier
*/
public class CustomizationPerspectiveFactory implements IPerspectiveFactory {
@@ -26,6 +26,7 @@ public class CustomizationPerspectiveFactory implements IPerspectiveFactory {
private final static String PROJECT_EXPLORER = "org.eclipse.ui.navigator.ProjectExplorer"; //$NON-NLS-1$
+ @Override
public void createInitialLayout(IPageLayout layout) {
layout.addView(PROJECT_EXPLORER, IPageLayout.LEFT, 0.20f, layout.getEditorArea());
layout.addView(PROPERTIES, IPageLayout.BOTTOM, 0.7f, layout.getEditorArea());
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencePage.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencePage.java
index 22626154d56..3009b03476d 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencePage.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencePage.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,7 @@
*****************************************************************************/
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
/**
* This page handles preferences for dialog boxes
- *
+ *
* @author Camille Letavernier
*/
public class CustomizationPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
@@ -43,22 +43,22 @@ public class CustomizationPreferencePage extends FieldEditorPreferencePage imple
public final static String OPEN_CUSTOMIZATION_PERSPECTIVE = "openCustomizationPerspective"; //$NON-NLS-1$
/**
- *
+ *
*/
public final static String ASK_FOR_CONFIRMATION = "askForConfirmation"; //$NON-NLS-1$
/**
- *
+ *
* Constructor.
- *
+ *
*/
public CustomizationPreferencePage() {
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param style
*/
public CustomizationPreferencePage(int style) {
@@ -66,9 +66,9 @@ public class CustomizationPreferencePage extends FieldEditorPreferencePage imple
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param title
* @param style
*/
@@ -77,9 +77,9 @@ public class CustomizationPreferencePage extends FieldEditorPreferencePage imple
}
/**
- *
+ *
* Constructor.
- *
+ *
* @param title
* @param image
* @param style
@@ -88,6 +88,7 @@ public class CustomizationPreferencePage extends FieldEditorPreferencePage imple
super(title, image, style);
}
+ @Override
public void init(IWorkbench workbench) {
setPreferenceStore(Activator.getDefault().getPreferenceStore());
setDescription(Messages.CustomizationPreferencePage_PropertyViewCustomizationPreferences);
@@ -101,7 +102,7 @@ public class CustomizationPreferencePage extends FieldEditorPreferencePage imple
/**
* Indicates if the customization perspective should be opened
- *
+ *
* @return true if the customization perspective should be opened
*/
public static boolean openCustomizationPerspective() {
@@ -111,7 +112,7 @@ public class CustomizationPreferencePage extends FieldEditorPreferencePage imple
/**
* Indicates if a dialog should ask the user for a confirmation before opening
* the customization perspective
- *
+ *
* @return true if a user confirmation is needed
*/
public static boolean askForConfirmation() {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencesInitializer.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencesInitializer.java
index b0a9d0dc03c..93b7fa24549 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencesInitializer.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/preferences/CustomizationPreferencesInitializer.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@ import org.eclipse.papyrus.customization.properties.Activator;
/**
* The initializer for @see {@link CustomizationPreferencePage}
- *
+ *
* @author Camille Letavernier
*/
public class CustomizationPreferencesInitializer extends AbstractPreferenceInitializer {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java
index 77c9a109c7c..d4e2a00be41 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/AbstractContextualContentProvider.java
@@ -43,21 +43,21 @@ public abstract class AbstractContextualContentProvider extends SemanticEMFConte
* Constructor.
*
* @param source
- * The EObject used to retrieve the available contexts
+ * The EObject used to retrieve the available contexts
*/
protected AbstractContextualContentProvider(EObject source) {
super(findContexts(source).toArray(new Context[0]), org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager());
- contexts = ListHelper.asList((Context[])roots);
+ contexts = ListHelper.asList((Context[]) roots);
}
private static List<Context> findContexts(EObject source) {
List<Context> contexts = new LinkedList<Context>();
Context rootContext = null;
- if(source.eResource() != null) {
- for(Resource resource : source.eResource().getResourceSet().getResources()) {
- if(!resource.getContents().isEmpty() && resource.getContents().get(0) instanceof Context) {
- rootContext = (Context)resource.getContents().get(0);
+ if (source.eResource() != null) {
+ for (Resource resource : source.eResource().getResourceSet().getResources()) {
+ if (!resource.getContents().isEmpty() && resource.getContents().get(0) instanceof Context) {
+ rootContext = (Context) resource.getContents().get(0);
contexts.add(rootContext);
break;
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ConstraintDescriptorContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ConstraintDescriptorContentProvider.java
index 7bc2139cb37..ee10f5ba4ec 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ConstraintDescriptorContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ConstraintDescriptorContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,8 +25,8 @@ import org.eclipse.papyrus.views.properties.contexts.View;
/**
* A ContentProvider for retrieving the available ConstraintDescriptors
- *
- *
+ *
+ *
* @author Camille Letavernier
*/
public class ConstraintDescriptorContentProvider extends AbstractContextualContentProvider {
@@ -34,25 +34,26 @@ public class ConstraintDescriptorContentProvider extends AbstractContextualConte
private EClass type;
/**
- *
+ *
* Constructor.
- *
+ *
* @param source
- * The source Object used to retrieve the available ConstraintDescriptors
+ * The source Object used to retrieve the available ConstraintDescriptors
*/
public ConstraintDescriptorContentProvider(EObject source, EClass type) {
super(source);
this.type = type;
}
+ @Override
public Object[] getElements() {
List<ConstraintDescriptor> result = new LinkedList<ConstraintDescriptor>();
- for(Context context : contexts) {
- for(View view : context.getViews()) {
+ for (Context context : contexts) {
+ for (View view : context.getViews()) {
result.addAll(getFilteredConstraintsFromDisplayUnit(view));
}
- for(Tab tab : context.getTabs()) {
- for(Section section : tab.getSections()) {
+ for (Tab tab : context.getTabs()) {
+ for (Section section : tab.getSections()) {
result.addAll(getFilteredConstraintsFromDisplayUnit(section));
}
}
@@ -62,14 +63,15 @@ public class ConstraintDescriptorContentProvider extends AbstractContextualConte
private List<ConstraintDescriptor> getFilteredConstraintsFromDisplayUnit(DisplayUnit unit) {
List<ConstraintDescriptor> result = new LinkedList<ConstraintDescriptor>();
- for(ConstraintDescriptor constraint : unit.getConstraints()) {
- if(type.isInstance(constraint)) {
+ for (ConstraintDescriptor constraint : unit.getConstraints()) {
+ if (type.isInstance(constraint)) {
result.add(constraint);
}
}
return result;
}
+ @Override
public Object[] getElements(Object inputElement) {
return getElements();
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextContentProvider.java
index 914372b7988..c7c5f0e1e67 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextContentProvider.java
@@ -37,15 +37,15 @@ public class ContextContentProvider extends CustomizedTreeContentProvider {
/**
* @param inputElement
- * : A ResourceSet
+ * : A ResourceSet
* @return The root EObjects from the input ResourceSet
*/
@Override
public EObject[] getRootElements(Object inputElement) {
- if(inputElement instanceof ResourceSet) {
- ResourceSet resourceSet = (ResourceSet)inputElement;
+ if (inputElement instanceof ResourceSet) {
+ ResourceSet resourceSet = (ResourceSet) inputElement;
- if(resourceSet.getResources().isEmpty()) {
+ if (resourceSet.getResources().isEmpty()) {
return null;
}
@@ -53,9 +53,9 @@ public class ContextContentProvider extends CustomizedTreeContentProvider {
elements.addAll(resourceSet.getResources().get(0).getContents());
Set<Context> allContexts = new LinkedHashSet<Context>();
- for(EObject element : elements) {
- if(element instanceof Context) {
- allContexts.addAll(PropertiesUtil.getDependencies((Context)element));
+ for (EObject element : elements) {
+ if (element instanceof Context) {
+ allContexts.addAll(PropertiesUtil.getDependencies((Context) element));
}
}
elements.addAll(allContexts);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextLabelProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextLabelProvider.java
index ca32d6071bd..cfb09185180 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextLabelProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/ContextLabelProvider.java
@@ -35,30 +35,30 @@ public class ContextLabelProvider extends ResolvingCustomizedLabelProvider {
@Override
public String getText(Object element) {
- if(!(element instanceof EObjectTreeElement) && element instanceof EObject) {
+ if (!(element instanceof EObjectTreeElement) && element instanceof EObject) {
try {
// Method method = CustomizationManager.class.getDeclaredMethod("getAppearanceConfiguration");//$NON-NLS-1$
- // method.setAccessible(true);
- // AppearanceConfiguration result = (AppearanceConfiguration)method.invoke(Activator.getDefault().getCustomizationManager());
- // ITreeElement treeElement = new ModelElementItem((EObject)element, null, result);
+ // method.setAccessible(true);
+ // AppearanceConfiguration result = (AppearanceConfiguration)method.invoke(Activator.getDefault().getCustomizationManager());
+ // ITreeElement treeElement = new ModelElementItem((EObject)element, null, result);
- //Customized label provider can be applied directly on element non useful to create a EObjectTreeElement
+ // Customized label provider can be applied directly on element non useful to create a EObjectTreeElement
String text = super.getText(element);
return text;
} catch (SecurityException ex) {
Activator.log.error(ex);
}
- // catch (NoSuchMethodException ex) {
- // Activator.log.error(ex);
- // } catch (IllegalArgumentException ex) {
- // Activator.log.error(ex);
- // } catch (IllegalAccessException ex) {
- // Activator.log.error(ex);
- // } catch (InvocationTargetException ex) {
- // Activator.log.error(ex);
- // }
+ // catch (NoSuchMethodException ex) {
+ // Activator.log.error(ex);
+ // } catch (IllegalArgumentException ex) {
+ // Activator.log.error(ex);
+ // } catch (IllegalAccessException ex) {
+ // Activator.log.error(ex);
+ // } catch (InvocationTargetException ex) {
+ // Activator.log.error(ex);
+ // }
}
- if(element != null) {
+ if (element != null) {
return super.getText(element);
} else {
return "";
@@ -67,28 +67,28 @@ public class ContextLabelProvider extends ResolvingCustomizedLabelProvider {
@Override
public Image getImage(Object element) {
- if(!(element instanceof EObjectTreeElement) && element instanceof EObject) {
+ if (!(element instanceof EObjectTreeElement) && element instanceof EObject) {
try {
// Method method = CustomizationManager.class.getDeclaredMethod("getAppearanceConfiguration");//$NON-NLS-1$
- // method.setAccessible(true);
- // AppearanceConfiguration result = (AppearanceConfiguration)method.invoke(Activator.getDefault().getCustomizationManager());
- // ITreeElement treeElement = new ModelElementItem((EObject)element, null, result);
+ // method.setAccessible(true);
+ // AppearanceConfiguration result = (AppearanceConfiguration)method.invoke(Activator.getDefault().getCustomizationManager());
+ // ITreeElement treeElement = new ModelElementItem((EObject)element, null, result);
- //Customized label provider can be applied directly on element non useful to create a EObjectTreeElement
+ // Customized label provider can be applied directly on element non useful to create a EObjectTreeElement
Image image = super.getImage(element);
return image;
} catch (SecurityException ex) {
Activator.log.error(ex);
}
- // catch (NoSuchMethodException ex) {
- // Activator.log.error(ex);
- // } catch (IllegalArgumentException ex) {
- // Activator.log.error(ex);
- // } catch (IllegalAccessException ex) {
- // Activator.log.error(ex);
- // } catch (InvocationTargetException ex) {
- // Activator.log.error(ex);
- // }
+ // catch (NoSuchMethodException ex) {
+ // Activator.log.error(ex);
+ // } catch (IllegalArgumentException ex) {
+ // Activator.log.error(ex);
+ // } catch (IllegalAccessException ex) {
+ // Activator.log.error(ex);
+ // } catch (InvocationTargetException ex) {
+ // Activator.log.error(ex);
+ // }
}
return super.getImage(element);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DataContextElementContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DataContextElementContentProvider.java
index c48fa4efd1e..509aa095dcc 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DataContextElementContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DataContextElementContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,7 +30,7 @@ import org.eclipse.papyrus.views.properties.contexts.DataContextRoot;
/**
* A ContentProvider for retrieving the available DataContextElements
- *
+ *
* @author Camille Letavernier
*/
public class DataContextElementContentProvider extends AbstractFilteredContentProvider implements IStaticContentProvider {
@@ -38,9 +38,9 @@ public class DataContextElementContentProvider extends AbstractFilteredContentPr
private List<DataContextElement> elements;
/**
- *
+ *
* Constructor.
- *
+ *
* @param element
*/
public DataContextElementContentProvider(DataContextElement element) {
@@ -48,13 +48,13 @@ public class DataContextElementContentProvider extends AbstractFilteredContentPr
Set<Context> allContexts = new HashSet<Context>();
- if(context != null) {
+ if (context != null) {
getAllContexts(context, allContexts);
}
Set<DataContextElement> allElements = new HashSet<DataContextElement>();
- for(Context ctx : allContexts) {
- for(DataContextRoot root : ctx.getDataContexts()) {
+ for (Context ctx : allContexts) {
+ for (DataContextRoot root : ctx.getDataContexts()) {
getAllElements(root, allElements);
}
}
@@ -64,16 +64,17 @@ public class DataContextElementContentProvider extends AbstractFilteredContentPr
private Collator collator = RuleBasedCollator.getInstance();
+ @Override
public int compare(DataContextElement element1, DataContextElement element2) {
String name1 = element1.getName();
String name2 = element2.getName();
- if(name1 == null && name2 == null) {
+ if (name1 == null && name2 == null) {
return 0;
}
- if(name1 == null) {
+ if (name1 == null) {
return -1;
}
- if(name2 == null) {
+ if (name2 == null) {
return 1;
}
return collator.compare(name1, name2);
@@ -85,41 +86,43 @@ public class DataContextElementContentProvider extends AbstractFilteredContentPr
}
private void getAllElements(DataContextElement fromElement, Collection<DataContextElement> result) {
- if(result.contains(fromElement)) {
+ if (result.contains(fromElement)) {
return;
}
result.add(fromElement);
- if(fromElement instanceof DataContextPackage) {
- DataContextPackage fromPackage = (DataContextPackage)fromElement;
- for(DataContextElement element : fromPackage.getElements()) {
+ if (fromElement instanceof DataContextPackage) {
+ DataContextPackage fromPackage = (DataContextPackage) fromElement;
+ for (DataContextElement element : fromPackage.getElements()) {
getAllElements(element, result);
}
}
}
private void getAllContexts(Context fromContext, Collection<Context> result) {
- if(result.contains(fromContext)) {
+ if (result.contains(fromContext)) {
return;
}
result.add(fromContext);
- for(Context context : fromContext.getDependencies()) {
+ for (Context context : fromContext.getDependencies()) {
getAllContexts(context, result);
}
}
private Context findContext(DataContextElement element) {
- if(element.getPackage() == null) {
- return (Context)element.eContainer();
+ if (element.getPackage() == null) {
+ return (Context) element.eContainer();
}
return findContext(element.getPackage());
}
+ @Override
public Object[] getElements() {
return elements.toArray(new DataContextElement[elements.size()]);
}
+ @Override
public Object[] getElements(Object inputElement) {
return getElements();
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DependencyContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DependencyContentProvider.java
index b18156e3179..d520e5c5067 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DependencyContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/DependencyContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
/**
* A Content provider returning the list of registered contexts
- *
+ *
* @author Camille Letavernier
*/
public class DependencyContentProvider extends AbstractStaticContentProvider {
@@ -37,10 +37,10 @@ public class DependencyContentProvider extends AbstractStaticContentProvider {
public Object[] getElements() {
List<Context> registeredContexts = new LinkedList<Context>(ConfigurationManager.getInstance().getContexts());
List<Context> localContexts = new LinkedList<Context>();
- for(Resource resource : source.eResource().getResourceSet().getResources()) {
- for(EObject element : resource.getContents()) {
- if(element instanceof Context && !registeredContexts.contains(element)) {
- localContexts.add((Context)element);
+ for (Resource resource : source.eResource().getResourceSet().getResources()) {
+ for (EObject element : resource.getContents()) {
+ if (element instanceof Context && !registeredContexts.contains(element)) {
+ localContexts.add((Context) element);
}
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java
index 35dd8b15b43..9dbbfe7eccb 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/EnvironmentContentProvider.java
@@ -34,22 +34,22 @@ public class EnvironmentContentProvider extends SemanticEMFContentProvider imple
* Constructor.
*
* @param feature
- * The EStructuralFeature used to retrieve the elements from the
- * different environments.
+ * The EStructuralFeature used to retrieve the elements from the
+ * different environments.
*/
public EnvironmentContentProvider(EStructuralFeature feature) {
super(null, feature, getRoots(feature), org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager());
}
private static EObject[] getRoots(EStructuralFeature feature) {
- if(!(feature.getEType() instanceof EClass)) {
+ if (!(feature.getEType() instanceof EClass)) {
Activator.log.warn("The feature " + feature + " cannot be handled by this content provider");
return new EObject[0];
}
List<Object> allObjects = new LinkedList<Object>();
- for(Environment environment : ConfigurationManager.getInstance().getPropertiesRoot().getEnvironments()) {
- allObjects.addAll((List<?>)environment.eGet(feature));
+ for (Environment environment : ConfigurationManager.getInstance().getPropertiesRoot().getEnvironments()) {
+ allObjects.addAll((List<?>) environment.eGet(feature));
}
return allObjects.toArray(new EObject[0]);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyContentProvider.java
index 50541fdfb33..dd6e71a942d 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,47 +25,50 @@ import org.eclipse.papyrus.views.properties.contexts.Property;
/**
* A Content provider to retrieve all available properties in the current
* contexts
- *
+ *
* @author Camille Letavernier
*/
public class PropertyContentProvider extends AbstractContextualContentProvider implements IHierarchicContentProvider {
/**
* Constructor.
- *
+ *
* @param source
- * The source from which the contexts will be retrieved
+ * The source from which the contexts will be retrieved
*/
public PropertyContentProvider(EObject source) {
super(source);
}
+ @Override
public Object[] getElements() {
return contexts.toArray();
}
+ @Override
public Object[] getElements(Object inputElement) {
return getElements();
}
+ @Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object[] getChildren(Object parentElement) {
- if(parentElement instanceof Context) {
- Context parent = (Context)parentElement;
+ if (parentElement instanceof Context) {
+ Context parent = (Context) parentElement;
return parent.getDataContexts().toArray();
- } else if(parentElement instanceof DataContextElement) {
+ } else if (parentElement instanceof DataContextElement) {
List result = new LinkedList();
- if(parentElement instanceof DataContextPackage) {
- DataContextPackage contextPackage = (DataContextPackage)parentElement;
+ if (parentElement instanceof DataContextPackage) {
+ DataContextPackage contextPackage = (DataContextPackage) parentElement;
result.addAll(contextPackage.getElements());
}
- DataContextElement element = (DataContextElement)parentElement;
+ DataContextElement element = (DataContextElement) parentElement;
result.addAll(element.getProperties());
Iterator<?> it = result.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Object value = it.next();
- if(isEmpty(value)) {
+ if (isEmpty(value)) {
it.remove();
}
}
@@ -76,32 +79,35 @@ public class PropertyContentProvider extends AbstractContextualContentProvider i
}
protected boolean isEmpty(Object element) {
- if(element instanceof DataContextPackage) {
- DataContextPackage dcPackage = (DataContextPackage)element;
+ if (element instanceof DataContextPackage) {
+ DataContextPackage dcPackage = (DataContextPackage) element;
return dcPackage.getElements().isEmpty() && dcPackage.getProperties().isEmpty();
- } else if(element instanceof DataContextElement) {
- return ((DataContextElement)element).getProperties().isEmpty();
- } else if(element instanceof Context) {
- return ((Context)element).getDataContexts().isEmpty();
+ } else if (element instanceof DataContextElement) {
+ return ((DataContextElement) element).getProperties().isEmpty();
+ } else if (element instanceof Context) {
+ return ((Context) element).getDataContexts().isEmpty();
}
return false;
}
+ @Override
public Object getParent(Object element) {
- if(element instanceof Property) {
- return ((Property)element).getContextElement();
- } else if(element instanceof DataContextElement) {
- return ((DataContextElement)element).getPackage();
+ if (element instanceof Property) {
+ return ((Property) element).getContextElement();
+ } else if (element instanceof DataContextElement) {
+ return ((DataContextElement) element).getPackage();
} else {
return null;
}
}
+ @Override
public boolean hasChildren(Object element) {
return getChildren(element).length > 0;
}
+ @Override
public boolean isValidValue(Object element) {
return element instanceof Property;
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java
index 43be423db05..43d55dfa0fb 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/PropertyEditorTypeContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2012 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
@@ -57,7 +57,7 @@ public class PropertyEditorTypeContentProvider extends EMFGraphicalContentProvid
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if(super.viewer != null) {
+ if (super.viewer != null) {
super.viewer.removeFilter(currentFilter);
}
super.inputChanged(viewer, oldInput, newInput);
@@ -67,7 +67,7 @@ public class PropertyEditorTypeContentProvider extends EMFGraphicalContentProvid
@Override
public void commit(AbstractEditor editor) {
currentFilter.setFilter(filterButton.getValue());
- if(super.viewer != null) {
+ if (super.viewer != null) {
super.viewer.refresh();
}
}
@@ -78,14 +78,14 @@ public class PropertyEditorTypeContentProvider extends EMFGraphicalContentProvid
@Override
public boolean isVisible(Viewer viewer, Object parentElement, Object element) {
- if(!filter) {
+ if (!filter) {
return true;
}
Object adaptedValue = getAdaptedValue(element);
- if(adaptedValue instanceof PropertyEditorType) {
- PropertyEditorType editorType = (PropertyEditorType)adaptedValue;
- if(source.getProperty() == null) {
+ if (adaptedValue instanceof PropertyEditorType) {
+ PropertyEditorType editorType = (PropertyEditorType) adaptedValue;
+ if (source.getProperty() == null) {
return true;
}
return editorType.getType() == source.getProperty().getType() && isMultiplicityEquivalent(editorType.getMultiplicity(), source.getProperty().getMultiplicity());
@@ -95,7 +95,7 @@ public class PropertyEditorTypeContentProvider extends EMFGraphicalContentProvid
}
private boolean isMultiplicityEquivalent(int multiplicity, int multiplicity2) {
- if(multiplicity < 0 || multiplicity > 1) {
+ if (multiplicity < 0 || multiplicity > 1) {
return multiplicity2 < 0 || multiplicity2 > 1;
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/TabContentProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/TabContentProvider.java
index a76ac374974..1891a643a85 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/TabContentProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/providers/TabContentProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,9 +21,9 @@ import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
/**
* A Content provider used to retrieve all tabs from the available contexts
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class TabContentProvider extends AbstractContextualContentProvider {
@@ -31,12 +31,12 @@ public class TabContentProvider extends AbstractContextualContentProvider {
/**
* Constructor.
- *
+ *
* @param source
- * The EObject used to retrieve the current context
+ * The EObject used to retrieve the current context
* @param editableTabsOnly
- * If true, only the tabs from editable contexts will be returned,
- * i.e. the plug-in contexts will be ignored
+ * If true, only the tabs from editable contexts will be returned,
+ * i.e. the plug-in contexts will be ignored
*/
public TabContentProvider(EObject source, boolean editableTabsOnly) {
super(source);
@@ -45,8 +45,8 @@ public class TabContentProvider extends AbstractContextualContentProvider {
@Override
public Object[] getElements() {
List<Tab> tabs = new LinkedList<Tab>();
- for(Context context : contexts) {
- if(isValidContext(context)) {
+ for (Context context : contexts) {
+ if (isValidContext(context)) {
tabs.addAll(context.getTabs());
}
}
@@ -54,7 +54,7 @@ public class TabContentProvider extends AbstractContextualContentProvider {
}
private boolean isValidContext(Context context) {
- if(editableTabsOnly) {
+ if (editableTabsOnly) {
return !ConfigurationManager.getInstance().isPlugin(context);
}
return true;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/DataContextsImageQuery.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/DataContextsImageQuery.java
index 81a9e78f4e4..ce7615e3921 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/DataContextsImageQuery.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/DataContextsImageQuery.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -20,7 +20,8 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
public class DataContextsImageQuery implements IJavaQuery2<Context, IImage> {
- public IImage evaluate(final Context context,
+ @Override
+ public IImage evaluate(final Context context,
final IParameterValueList2 parameterValues,
final IFacetManager facetManager)
throws DerivedTypedElementException {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ShowContextQuery.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ShowContextQuery.java
index af53248b091..ff72174a788 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ShowContextQuery.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ShowContextQuery.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,7 +20,7 @@ import org.eclipse.papyrus.views.properties.contexts.Context;
/**
* A Query to test if the DataContextElements should be displayed in the UIEditor
- *
+ *
* @author Camille Letavernier
*/
public class ShowContextQuery implements IJavaQuery2<Context, Boolean> {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ViewsImageQuery.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ViewsImageQuery.java
index 1d7f7557f87..c53e45ad5ef 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ViewsImageQuery.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/query/ViewsImageQuery.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* 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
@@ -20,7 +20,8 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2;
import org.eclipse.papyrus.views.properties.contexts.Context;
public class ViewsImageQuery implements IJavaQuery2<Context, IImage> {
- public IImage evaluate(final Context context,
+ @Override
+ public IImage evaluate(final Context context,
final IParameterValueList2 parameterValues,
final IFacetManager facetManager)
throws DerivedTypedElementException {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/AbstractContextStorageActionProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/AbstractContextStorageActionProvider.java
index deb6f5468d8..4292164659c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/AbstractContextStorageActionProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/AbstractContextStorageActionProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -27,8 +27,9 @@ public abstract class AbstractContextStorageActionProvider implements IContextSt
super();
}
+ @Override
public IContextCopyAction getContextCopyAction() {
- if(copyAction == null) {
+ if (copyAction == null) {
copyAction = createContextCopyAction();
}
@@ -37,8 +38,9 @@ public abstract class AbstractContextStorageActionProvider implements IContextSt
protected abstract IContextCopyAction createContextCopyAction();
+ @Override
public IContextEditAction getContextEditAction() {
- if(editAction == null) {
+ if (editAction == null) {
editAction = createContextEditAction();
}
@@ -47,8 +49,9 @@ public abstract class AbstractContextStorageActionProvider implements IContextSt
protected abstract IContextEditAction createContextEditAction();
+ @Override
public IContextDeleteAction getContextDeleteAction() {
- if(deleteAction == null) {
+ if (deleteAction == null) {
deleteAction = createContextDeleteAction();
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionRegistry.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionRegistry.java
index e2bd6d93d68..98782eea406 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionRegistry.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionRegistry.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013, 2014 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
@@ -9,7 +9,7 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 422257
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.storage.actions;
@@ -46,8 +46,8 @@ public class ContextStorageActionRegistry {
public IContextStorageActionProvider getStorageActionProvider(Context context) {
IContextStorageActionProvider result = IContextStorageActionProvider.READ_ONLY;
- for(IContextStorageActionProvider next : providers) {
- if(next.providesFor(context)) {
+ for (IContextStorageActionProvider next : providers) {
+ if (next.providesFor(context)) {
result = next;
break;
}
@@ -91,12 +91,13 @@ public class ContextStorageActionRegistry {
// sort any providers contributed by this plug-in to the front
Collections.sort(providers, new Comparator<IContextStorageActionProvider>() {
+ @Override
public int compare(IContextStorageActionProvider o1, IContextStorageActionProvider o2) {
int result = 0;
- if(isOurs(o1)) {
+ if (isOurs(o1)) {
result = isOurs(o2) ? 0 : -1;
- } else if(isOurs(o2)) {
+ } else if (isOurs(o2)) {
result = +1;
}
@@ -109,7 +110,7 @@ public class ContextStorageActionRegistry {
boolean result = false;
IConfigurationElement config = providerElements.get(provider);
- if(config != null) {
+ if (config != null) {
Activator.PLUGIN_ID.equals(config.getContributor().getName());
}
@@ -120,9 +121,9 @@ public class ContextStorageActionRegistry {
protected boolean readElement(IConfigurationElement element) {
boolean result = true;
- if(E_ACTION_PROVIDER.equals(element.getName())) {
+ if (E_ACTION_PROVIDER.equals(element.getName())) {
try {
- providers.add((IContextStorageActionProvider)element.createExecutableExtension(A_CLASS));
+ providers.add((IContextStorageActionProvider) element.createExecutableExtension(A_CLASS));
} catch (Exception e) {
result = false;
Activator.log.error("Failed to instantiate context storage action provider extension.", e); //$NON-NLS-1$
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionUtil.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionUtil.java
index 7c032734ccf..bbdc58340e5 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionUtil.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/ContextStorageActionUtil.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -38,8 +38,8 @@ public class ContextStorageActionUtil {
public static void initializeCopy(Context source, IProgressMonitor monitor) {
monitor.beginTask(Messages.CopyContextAction_InitializingTheCopyOf + source.getName() + Messages.CopyContextAction_ThisMayTakeSomeTime, IProgressMonitor.UNKNOWN);
- //EcoreUtil.resolveAll(source); //This method is too expensive
- resolveAllResources(source); //Ignores the *.xwt files. We will copy them manually.
+ // EcoreUtil.resolveAll(source); //This method is too expensive
+ resolveAllResources(source); // Ignores the *.xwt files. We will copy them manually.
monitor.done();
}
@@ -60,26 +60,26 @@ public class ContextStorageActionUtil {
* really expensive to load.
*/
private static void resolveAllResources(EObject source, Set<EObject> visitedEObjects) {
- if(!visitedEObjects.add(source)) {
+ if (!visitedEObjects.add(source)) {
return;
}
- for(EReference reference : source.eClass().getEAllReferences()) {
- //Do not load *.xwt resources
- //These files do not contain any useful cross-reference, and are really expensive to load
- if(reference == ContextsPackage.eINSTANCE.getSection_Widget()) {
+ for (EReference reference : source.eClass().getEAllReferences()) {
+ // Do not load *.xwt resources
+ // These files do not contain any useful cross-reference, and are really expensive to load
+ if (reference == ContextsPackage.eINSTANCE.getSection_Widget()) {
continue;
}
Object value = source.eGet(reference);
- if(value instanceof EList) {
- for(Object object : (EList<?>)value) {
- if(object instanceof EObject) {
- resolveAllResources((EObject)object, visitedEObjects);
+ if (value instanceof EList) {
+ for (Object object : (EList<?>) value) {
+ if (object instanceof EObject) {
+ resolveAllResources((EObject) object, visitedEObjects);
}
}
- } else if(value instanceof EObject) {
- resolveAllResources((EObject)value, visitedEObjects);
+ } else if (value instanceof EObject) {
+ resolveAllResources((EObject) value, visitedEObjects);
}
}
}
@@ -88,8 +88,8 @@ public class ContextStorageActionUtil {
URI baseURI = base.getURI();
URI resourceURI = resource.getURI();
URI uri = resourceURI.deresolve(baseURI);
- if(uri.isRelative()) {
- if(!(uri.toString().startsWith("..") || uri.toString().startsWith("/"))) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (uri.isRelative()) {
+ if (!(uri.toString().startsWith("..") || uri.toString().startsWith("/"))) { //$NON-NLS-1$ //$NON-NLS-2$
return true;
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextCopyAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextCopyAction.java
index 6c8ad6b71aa..86f799d0028 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextCopyAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextCopyAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -18,22 +18,21 @@ import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
/**
- * An action that may be contributed to the Properties View customization dialog on the
- * <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point
+ * An action that may be contributed to the Properties View customization dialog on the <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point
* to implement copying a {@link Context} to the corresponding storage provider.
*/
public interface IContextCopyAction {
/**
* Queries the (translated) label to show in a copy button in the Properties customization dialog.
- *
+ *
* @return the label to show in the copy button in the customization dialog
*/
String getLabel();
/**
* Queries the (translated) tool tip to show on a copy button in the Properties customization dialog.
- *
+ *
* @return the optional tool tip to show on the copy button in the customization dialog.
* May be {@code null}
*/
@@ -42,19 +41,19 @@ public interface IContextCopyAction {
/**
* Copy an existing context to a new one with the given name.
* The new context is registered to the {@link ConfigurationManager}.
- *
+ *
* @param source
- * The source Context to copy
+ * The source Context to copy
* @param targetName
- * The name of the new context
+ * The name of the new context
* @param monitor
- * A monitor to track the progress of the copy operation. Will not be {@code null}
+ * A monitor to track the progress of the copy operation. Will not be {@code null}
* @return
* The new Context
- *
+ *
* @throws CoreException
- * If an error occurred : the previous context cannot be read, or
- * the new context cannot be created
+ * If an error occurred : the previous context cannot be read, or
+ * the new context cannot be created
*/
Context copy(Context source, String targetName, IProgressMonitor monitor) throws CoreException;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextDeleteAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextDeleteAction.java
index af0d2797fd0..74f4e9ec466 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextDeleteAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextDeleteAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -17,8 +17,7 @@ import org.eclipse.papyrus.views.properties.contexts.Context;
/**
- * An action that may be contributed to the Properties View customization dialog on the
- * <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point
+ * An action that may be contributed to the Properties View customization dialog on the <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point
* to support deletion of a {@link Context} from the associated storage.
*/
public interface IContextDeleteAction {
@@ -27,7 +26,7 @@ public interface IContextDeleteAction {
* Queries the (translated) tool tip to show on the "Remove" button in the Properties
* customization dialog for {@link Context}s in the storage providers supported by the
* extension.
- *
+ *
* @return the optional tool tip to show on the "Edit..." button in the customization dialog.
* May be {@code null}
*/
@@ -35,14 +34,14 @@ public interface IContextDeleteAction {
/**
* Delete a {@code context} from its persistent storage.
- *
+ *
* @param context
- * The {@link Context} to delete
+ * The {@link Context} to delete
* @param monitor
- * A monitor to track the progress of the delete operation. Will not be {@code null}
- *
+ * A monitor to track the progress of the delete operation. Will not be {@code null}
+ *
* @throws CoreException
- * On failure to delete the {@code context}
+ * On failure to delete the {@code context}
*/
void delete(Context context, IProgressMonitor monitor) throws CoreException;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextEditAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextEditAction.java
index ca67a3af078..e563bcb41c8 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextEditAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextEditAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -17,8 +17,7 @@ import org.eclipse.papyrus.views.properties.contexts.Context;
/**
- * An action that may be contributed to the Properties View customization dialog on the
- * <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point
+ * An action that may be contributed to the Properties View customization dialog on the <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point
* to support opening an editor on the {@link Context} in the associated storage.
*/
public interface IContextEditAction {
@@ -27,7 +26,7 @@ public interface IContextEditAction {
* Queries the (translated) tool tip to show on the "Edit..." button in the Properties
* customization dialog for {@link Context}s in the storage providers supported by the
* extension.
- *
+ *
* @return the optional tool tip to show on the "Edit..." button in the customization dialog.
* May be {@code null}
*/
@@ -35,14 +34,14 @@ public interface IContextEditAction {
/**
* Open an editor to edit an context.
- *
+ *
* @param context
- * The {@link Context} to edit
+ * The {@link Context} to edit
* @param monitor
- * A monitor to track the progress of the open-editor operation. Will not be {@code null}
- *
+ * A monitor to track the progress of the open-editor operation. Will not be {@code null}
+ *
* @throws CoreException
- * On failure to open an editor on the {@code context}
+ * On failure to open an editor on the {@code context}
*/
void openEditor(Context context, IProgressMonitor monitor) throws CoreException;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextStorageActionProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextStorageActionProvider.java
index b0c9487b788..bba3be0f593 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextStorageActionProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/IContextStorageActionProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -15,11 +15,10 @@ import org.eclipse.papyrus.views.properties.contexts.Context;
/**
- * A provider of actions to the Properties View customization dialog on the <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt>
- * extension point to implement {@linkplain IContextCopyAction copying}, {@linkplain IContextEditAction editing},
+ * A provider of actions to the Properties View customization dialog on the <tt>org.eclipse.papyrus.customization.properties.contextStorage</tt> extension point to implement {@linkplain IContextCopyAction copying}, {@linkplain IContextEditAction editing},
* and {@linkplain IContextDeleteAction deletion} of {@link Context} to the corresponding storage
* provider.
- *
+ *
* @see IContextCopyAction
* @see IContextEditAction
* @see IContextDeleteAction
@@ -30,10 +29,10 @@ public interface IContextStorageActionProvider {
/**
* Queries whether I provide edit and delete actions for the a {@code context}.
- *
+ *
* @param context
- * a context selected by the user to act on
- *
+ * a context selected by the user to act on
+ *
* @return whether I provide actions for it
*/
boolean providesFor(Context context);
@@ -50,21 +49,25 @@ public interface IContextStorageActionProvider {
class ReadOnlyContextStorageActionProvider implements IContextStorageActionProvider {
+ @Override
public boolean providesFor(Context context) {
// I am the final fall-back that provides no editing capability, so I always return false
return false;
}
+ @Override
public IContextCopyAction getContextCopyAction() {
// I am not actually provided on the extension point, so this isn't needed
return null;
}
+ @Override
public IContextEditAction getContextEditAction() {
// I can't edit anything, so this isn't needed
return null;
}
+ @Override
public IContextDeleteAction getContextDeleteAction() {
// I can't edit anything, so this isn't needed
return null;
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextCopyAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextCopyAction.java
index 38fe3edabd0..ecaa6134d4c 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextCopyAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextCopyAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2014 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
@@ -10,7 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - Factor out workspace storage for pluggable storage providers (CDO)
* Christian W. Damus (CEA) - bug 422257
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.customization.properties.storage.actions.workspace;
@@ -51,7 +51,7 @@ import org.eclipse.papyrus.views.properties.util.PropertiesUtil;
/**
* An action to build a new Property view context from an existing one.
- *
+ *
* @author Camille Letavernier
*/
public class WorkspaceContextCopyAction implements IContextCopyAction {
@@ -72,17 +72,17 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
* To enable the edition of the context, an invisible project is created
* in the workspace. The files are stored in the runtime plugin's preference
* folder.
- *
+ *
* @param source
- * The source Context to copy
+ * The source Context to copy
* @param targetName
- * The name of the new context
+ * The name of the new context
* @return
* The new Context
- *
+ *
* @throws CoreException
- * If an error occured : the previous context cannot be read, or
- * the new context cannot be created
+ * If an error occured : the previous context cannot be read, or
+ * the new context cannot be created
*/
@Override
public Context copy(Context source, String targetName, IProgressMonitor monitor) throws CoreException {
@@ -94,22 +94,22 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
try {
IPath targetDirectoryPath = org.eclipse.papyrus.views.properties.Activator.getDefault().getPreferencesPath().append("/" + targetName); //$NON-NLS-1$
final File targetDirectory = targetDirectoryPath.toFile();
- if(targetDirectory.exists()) {
+ if (targetDirectory.exists()) {
throw new IOException("A context with this name already exists"); //$NON-NLS-1$
}
URI targetModelUri = URI.createFileURI(targetDirectory.toString() + "/" + targetName + ".ctx"); //$NON-NLS-1$ //$NON-NLS-2$
- Context sourceContext = (Context)EMFHelper.loadEMFModel(resourceSet, source.eResource().getURI());
+ Context sourceContext = (Context) EMFHelper.loadEMFModel(resourceSet, source.eResource().getURI());
IStatus copyResult = copyAll(sourceContext, new File(targetDirectory, targetName + ".ctx"), sub.newChild(1, SubMonitor.SUPPRESS_NONE)); //$NON-NLS-1$
- if(copyResult.isOK()) {
+ if (copyResult.isOK()) {
result = ConfigurationManager.getInstance().getContext(targetModelUri);
result.setName(targetName);
result.setPrototype(source);
result.eResource().save(Collections.EMPTY_MAP);
- } else if(copyResult.getSeverity() != IStatus.CANCEL) {
+ } else if (copyResult.getSeverity() != IStatus.CANCEL) {
throw new CoreException(copyResult);
}
} catch (IOException e) {
@@ -142,10 +142,10 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
int filesToCopy = sourceResource.getResourceSet().getResources().size();
List<Context> contexts = new LinkedList<Context>();
- for(Context context : PropertiesUtil.getDependencies(source)) {
- if(isRelative(sourceResource, context.eResource())) {
+ for (Context context : PropertiesUtil.getDependencies(source)) {
+ if (isRelative(sourceResource, context.eResource())) {
contexts.add(context);
- for(Tab tab : context.getTabs()) {
+ for (Tab tab : context.getTabs()) {
filesToCopy += tab.getSections().size();
}
}
@@ -153,27 +153,27 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
monitor.beginTask(Messages.CopyContextAction_Copying + source.getName() + Messages.CopyContextAction_To + targetName, filesToCopy);
- //Copy of the context
+ // Copy of the context
copy(sourceResource, target);
monitor.worked(1);
- //Copy of the dependent resources which are located in the same folder
- //(or subfolders)
- for(Resource resource : source.eResource().getResourceSet().getResources()) {
- if(monitor.isCanceled()) {
+ // Copy of the dependent resources which are located in the same folder
+ // (or subfolders)
+ for (Resource resource : source.eResource().getResourceSet().getResources()) {
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if((resource != sourceResource) && isRelative(sourceResource, resource)) {
+ if ((resource != sourceResource) && isRelative(sourceResource, resource)) {
copy(resource, targetDirectory, source, targetName);
}
monitor.worked(1);
}
- //Copy the XWT files (they haven't been loaded in the resource set)
- for(Context context : contexts) {
- for(Tab tab : context.getTabs()) {
- for(Section section : tab.getSections()) {
- if(monitor.isCanceled()) {
+ // Copy the XWT files (they haven't been loaded in the resource set)
+ for (Context context : contexts) {
+ for (Tab tab : context.getTabs()) {
+ for (Section section : tab.getSections()) {
+ if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
copy(section.getSectionFile(), targetDirectory, source);
@@ -196,7 +196,7 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
File target = new File(targetDirectory, xwtFileName);
URI sourceURI = URI.createURI(xwtFileName).resolve(source.eResource().getURI());
PropertiesURIHandler uriHandler = new PropertiesURIHandler();
- if(uriHandler.canHandle(sourceURI)) {
+ if (uriHandler.canHandle(sourceURI)) {
sourceURI = uriHandler.getConvertedURI(sourceURI);
}
@@ -216,7 +216,7 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
// TODO: Use resource set's URIConverter to get a stream
PropertiesURIHandler uriHandler = new PropertiesURIHandler();
URI uri = resource.getURI();
- if(uriHandler.canHandle(uri)) {
+ if (uriHandler.canHandle(uri)) {
uri = uriHandler.getConvertedURI(uri);
}
copy(new URL(uri.toString()).openStream(), target);
@@ -224,16 +224,16 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
private void copy(Resource resource, File directory, EObject source, String targetName) throws IOException {
URI relativeURI = resource.getURI().deresolve(source.eResource().getURI());
- if(relativeURI.toString().equals("")) { //$NON-NLS-1$
+ if (relativeURI.toString().equals("")) { //$NON-NLS-1$
relativeURI = URI.createURI(targetName + ".ctx"); //$NON-NLS-1$
}
File target = new File(directory, relativeURI.toString());
copy(resource, target);
}
- //Strict copy : we read directly the file, instead of interpreting it as a Model
+ // Strict copy : we read directly the file, instead of interpreting it as a Model
private void copy(InputStream source, File target) throws IOException {
- if(!target.getParentFile().exists()) {
+ if (!target.getParentFile().exists()) {
target.getParentFile().mkdirs();
}
@@ -241,7 +241,7 @@ public class WorkspaceContextCopyAction implements IContextCopyAction {
try {
int c;
- while((c = source.read()) != -1) {
+ while ((c = source.read()) != -1) {
out.write(c);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextDeleteAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextDeleteAction.java
index 7ba71fc5ff8..407d7dbeb78 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextDeleteAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextDeleteAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011, 2013 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
@@ -25,21 +25,23 @@ import org.eclipse.papyrus.views.properties.runtime.ConfigurationManager;
/**
* An action to delete an existing context. This action cannot be undone.
* If you simply want to disable an existing context, see {@link ConfigurationManager#disableContext(Context)}
- *
+ *
* @author Camille Letavernier
*/
public class WorkspaceContextDeleteAction implements IContextDeleteAction {
+ @Override
public String getToolTip() {
return Messages.WorkspaceContextDeleteAction_0;
}
/**
* Deletes the given context.
- *
+ *
* @param context
- * The context to delete
+ * The context to delete
*/
+ @Override
public void delete(final Context context, IProgressMonitor monitor) throws CoreException {
final File directory = new File(context.eResource().getURI().toFileString()).getParentFile();
@@ -53,13 +55,13 @@ public class WorkspaceContextDeleteAction implements IContextDeleteAction {
/**
* Recursively deletes a file or directory
- *
+ *
* @param file
- * The file or directory to delete recusively
+ * The file or directory to delete recusively
*/
private void delete(File file) {
- if(file.isDirectory()) {
- for(File subFile : file.listFiles()) {
+ if (file.isDirectory()) {
+ for (File subFile : file.listFiles()) {
delete(subFile);
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextEditAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextEditAction.java
index 41b967e5436..74c17c6a5bd 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextEditAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextEditAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -27,23 +27,25 @@ import org.eclipse.ui.part.FileEditorInput;
* An action to edit an existing context.
* The context must not be read-only, which means it should not have been
* registered via a plug-in extension
- *
+ *
* @author Camille Letavernier
*/
public class WorkspaceContextEditAction implements IContextEditAction {
+ @Override
public String getToolTip() {
return Messages.WorkspaceContextEditAction_0;
}
/**
* Opens an Eclipse Editor to edit the given context.
- *
+ *
* @param context
- * The context to edit
+ * The context to edit
* @throws Exception
- * If the context cannot be edited
+ * If the context cannot be edited
*/
+ @Override
public void openEditor(final Context context, IProgressMonitor monitor) throws CoreException {
SubMonitor sub = SubMonitor.convert(monitor, Messages.WorkspaceContextEditAction_1 + context.getName(), IProgressMonitor.UNKNOWN);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextStorageActionProvider.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextStorageActionProvider.java
index b7f9ae3dfbc..a4bb8006499 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextStorageActionProvider.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/storage/actions/workspace/WorkspaceContextStorageActionProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2013 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
@@ -28,19 +28,23 @@ public class WorkspaceContextStorageActionProvider extends AbstractContextStorag
super();
}
+ @Override
public boolean providesFor(Context context) {
Resource resource = context.eResource();
return (resource != null) && resource.getURI().isPlatformResource() || resource.getURI().isFile();
}
+ @Override
protected IContextCopyAction createContextCopyAction() {
return new WorkspaceContextCopyAction();
}
+ @Override
protected IContextEditAction createContextEditAction() {
return new WorkspaceContextEditAction();
}
+ @Override
protected IContextDeleteAction createContextDeleteAction() {
return new WorkspaceContextDeleteAction();
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CopyContextAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CopyContextAction.java
index 8825fdc5aca..068ad5066a0 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CopyContextAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CopyContextAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -27,7 +27,7 @@ import org.eclipse.ui.statushandlers.StatusManager;
/**
* An action to build a new Property view context from an existing one.
- *
+ *
* @author Camille Letavernier
*/
public class CopyContextAction {
@@ -46,14 +46,14 @@ public class CopyContextAction {
* To enable the edition of the context, an invisible project is created
* in the workspace. The files are stored in the runtime plugin's preference
* folder.
- *
+ *
* @param source
- * The source Context to copy
+ * The source Context to copy
* @param targetName
- * The name of the new context
+ * The name of the new context
* @param activate
- * If true, the new context will be activated and available immediately,
- * while the previous one will be disabled to avoid conflicts
+ * If true, the new context will be activated and available immediately,
+ * while the previous one will be disabled to avoid conflicts
* @return
* The new Context or {@code null} if it was not created (because of error or user cancellation
*/
@@ -69,9 +69,9 @@ public class CopyContextAction {
try {
result[0] = delegate.copy(source, targetName, monitor);
- if(result[0] != null) {
+ if (result[0] != null) {
ConfigurationManager.getInstance().addContext(result[0], activate);
- if(activate) {
+ if (activate) {
ConfigurationManager.getInstance().disableContext(source, true);
}
}
@@ -82,8 +82,8 @@ public class CopyContextAction {
});
} catch (InvocationTargetException ex) {
- if(ex.getTargetException() instanceof CoreException) {
- CoreException ce = (CoreException)ex.getTargetException();
+ if (ex.getTargetException() instanceof CoreException) {
+ CoreException ce = (CoreException) ex.getTargetException();
Activator.log.error(ce);
StatusManager.getManager().handle(ce.getStatus(), StatusManager.SHOW);
} else {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CustomizationDialog.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CustomizationDialog.java
index 55a51087db6..4178cdfed0f 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CustomizationDialog.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/CustomizationDialog.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -52,7 +52,7 @@ import org.eclipse.swt.widgets.Shell;
* A Dialog to display the operations available to customize
* the property view, such as "Copy", "Edit" or "Delete" an
* existing configuration.
- *
+ *
* @author Camille Letavernier
*/
public class CustomizationDialog extends TrayDialog implements SelectionListener {
@@ -70,11 +70,11 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
private Button removeContext;
/**
- *
+ *
* Constructor.
- *
+ *
* @param shell
- * The shell in which the dialog will be opened
+ * The shell in which the dialog will be opened
*/
public CustomizationDialog(final Shell shell) {
super(shell);
@@ -107,8 +107,8 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
@Override
public String getText(final Object element) {
- if(element != null && element instanceof Context) {
- Context context = (Context)element;
+ if (element != null && element instanceof Context) {
+ Context context = (Context) element;
return context.getName() + (ConfigurationManager.getInstance().isPlugin(context) ? Messages.CustomizationDialog_plugin : ""); //$NON-NLS-1$
}
return super.getText(element);
@@ -122,9 +122,9 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
Collection<IContextStorageActionProvider> providers = actionRegistry.getStorageActionProviders();
copyContextButtons = new java.util.ArrayList<Button>(providers.size());
- for(IContextStorageActionProvider next : providers) {
+ for (IContextStorageActionProvider next : providers) {
IContextCopyAction copyAction = next.getContextCopyAction();
- if(copyAction != null) {
+ if (copyAction != null) {
Button copyContext = new Button(controls, SWT.PUSH);
copyContext.setText(copyAction.getLabel());
copyContext.setToolTipText(copyAction.getToolTip());
@@ -135,8 +135,8 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
copyContextButtons.add(copyContext);
}
}
- if(copyContextButtons.size() == 1) {
- // special case: use a simpler label than "Copy to Workspace..."
+ if (copyContextButtons.size() == 1) {
+ // special case: use a simpler label than "Copy to Workspace..."
copyContextButtons.get(0).setText(Messages.CustomizationDialog_copy);
}
@@ -156,12 +156,12 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
@Override
public void selectionChanged(final SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
boolean activate = false;
IContextStorageActionProvider provider = null;
- if(!selection.isEmpty()) {
- Context context = (Context)selection.getFirstElement();
+ if (!selection.isEmpty()) {
+ Context context = (Context) selection.getFirstElement();
activate = !ConfigurationManager.getInstance().isPlugin(context);
provider = actionRegistry.getStorageActionProvider(context);
}
@@ -169,7 +169,7 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
editContext.setEnabled(activate);
IContextEditAction editAction = provider.getContextEditAction();
editContext.setToolTipText((editAction == null) ? null : editAction.getToolTip());
- for(Button next : copyContextButtons) {
+ for (Button next : copyContextButtons) {
next.setEnabled(!selection.isEmpty());
}
removeContext.setEnabled(activate);
@@ -179,26 +179,26 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
});
- // generateContext = new Button(controls, SWT.PUSH);
- // generateContext.setText("Generate");
- // generateContext.setToolTipText("Generates a new Context from a Metamodel");
- // generateContext.setEnabled(false);
+ // generateContext = new Button(controls, SWT.PUSH);
+ // generateContext.setText("Generate");
+ // generateContext.setToolTipText("Generates a new Context from a Metamodel");
+ // generateContext.setEnabled(false);
getShell().pack();
}
protected void editAction() {
- IStructuredSelection selection = (IStructuredSelection)availableContextsViewer.getSelection();
- if(selection.isEmpty()) {
+ IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection();
+ if (selection.isEmpty()) {
return;
}
Object element = selection.getFirstElement();
- if(element instanceof Context) {
- Context sourceContext = (Context)element;
+ if (element instanceof Context) {
+ Context sourceContext = (Context) element;
IContextEditAction editAction = actionRegistry.getContextEditAction(sourceContext);
- if(editAction == null) {
+ if (editAction == null) {
MessageDialog.openError(getShell(), Messages.CustomizationDialog_0, Messages.CustomizationDialog_1);
return;
}
@@ -215,14 +215,14 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
}
protected void copyAction(IContextCopyAction copyAction) {
- IStructuredSelection selection = (IStructuredSelection)availableContextsViewer.getSelection();
- if(selection.isEmpty()) {
+ IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection();
+ if (selection.isEmpty()) {
return;
}
Object element = selection.getFirstElement();
- if(element instanceof Context) {
- Context sourceContext = (Context)element;
+ if (element instanceof Context) {
+ Context sourceContext = (Context) element;
CopyContextAction action = new CopyContextAction(copyAction);
try {
@@ -230,10 +230,10 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
@Override
public String isValid(final String newText) {
- if(newText.trim().equals("")) { //$NON-NLS-1$
+ if (newText.trim().equals("")) { //$NON-NLS-1$
return Messages.CustomizationDialog_configurationNameNotEmpty;
}
- if(ConfigurationManager.getInstance().getContext(newText) != null) {
+ if (ConfigurationManager.getInstance().getContext(newText) != null) {
return Messages.CustomizationDialog_configurationWithSameNameExists;
}
return null;
@@ -242,10 +242,10 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
});
dialog.setTitle(Messages.CustomizationDialog_configurationName);
int result = dialog.open();
- if(result == Window.OK) {
+ if (result == Window.OK) {
String targetName = dialog.getText();
Context newContext = action.copy(sourceContext, targetName, false);
- if(newContext != null) {
+ if (newContext != null) {
availableContextsViewer.setInput(ConfigurationManager.getInstance().getContexts());
availableContextsViewer.setSelection(new StructuredSelection(newContext), true);
}
@@ -257,29 +257,30 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
}
protected void deleteAction() {
- IStructuredSelection selection = (IStructuredSelection)availableContextsViewer.getSelection();
- if(selection.isEmpty()) {
+ IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection();
+ if (selection.isEmpty()) {
return;
}
Object element = selection.getFirstElement();
- if(element instanceof Context) {
- Context sourceContext = (Context)element;
- if(ConfigurationManager.getInstance().isPlugin(sourceContext)) {
+ if (element instanceof Context) {
+ Context sourceContext = (Context) element;
+ if (ConfigurationManager.getInstance().isPlugin(sourceContext)) {
Activator.log.warn(Messages.CustomizationDialog_cannotDeletePluginContext);
- //Plugin context cannot be deleted
+ // Plugin context cannot be deleted
return;
}
IContextDeleteAction deleteAction = actionRegistry.getContextDeleteAction(sourceContext);
- if(deleteAction == null) {
+ if (deleteAction == null) {
MessageDialog.openError(getShell(), Messages.CustomizationDialog_deleteContext, Messages.CustomizationDialog_2);
return;
}
- MessageDialog dialog = new MessageDialog(getShell(), Messages.CustomizationDialog_deleteContext, null, Messages.CustomizationDialog_deleteContextConfirmation1 + sourceContext.getName() + Messages.CustomizationDialog_deleteContextConfirmation2, MessageDialog.CONFIRM, new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2);
+ MessageDialog dialog = new MessageDialog(getShell(), Messages.CustomizationDialog_deleteContext, null, Messages.CustomizationDialog_deleteContextConfirmation1 + sourceContext.getName() + Messages.CustomizationDialog_deleteContextConfirmation2,
+ MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 2);
int result = dialog.open();
- if(result == 0) { //0 is "Yes" (It is *not* the same 0 as Window.OK)
+ if (result == 0) { // 0 is "Yes" (It is *not* the same 0 as Window.OK)
RemoveContextAction action = new RemoveContextAction(deleteAction);
action.removeContext(sourceContext);
availableContextsViewer.setInput(ConfigurationManager.getInstance().getContexts());
@@ -294,30 +295,30 @@ public class CustomizationDialog extends TrayDialog implements SelectionListener
@Override
protected Composite getDialogArea() {
- return (Composite)super.getDialogArea();
+ return (Composite) super.getDialogArea();
}
@Override
public void widgetSelected(final SelectionEvent e) {
- if(e.widget == editContext) {
+ if (e.widget == editContext) {
editAction();
- } else if(e.widget == removeContext) {
+ } else if (e.widget == removeContext) {
deleteAction();
- } else if(e.widget.getData() instanceof IContextCopyAction) {
- copyAction((IContextCopyAction)e.widget.getData());
+ } else if (e.widget.getData() instanceof IContextCopyAction) {
+ copyAction((IContextCopyAction) e.widget.getData());
}
}
@Override
public void widgetDefaultSelected(final SelectionEvent e) {
- if(e.widget == availableContexts) {
- IStructuredSelection selection = (IStructuredSelection)availableContextsViewer.getSelection();
- if(!selection.isEmpty()) {
- Context context = (Context)selection.getFirstElement();
- if(ConfigurationManager.getInstance().isPlugin(context)) {
- if(copyContextButtons.size() == 1) {
- copyAction((IContextCopyAction)copyContextButtons.get(0).getData());
+ if (e.widget == availableContexts) {
+ IStructuredSelection selection = (IStructuredSelection) availableContextsViewer.getSelection();
+ if (!selection.isEmpty()) {
+ Context context = (Context) selection.getFirstElement();
+ if (ConfigurationManager.getInstance().isPlugin(context)) {
+ if (copyContextButtons.size() == 1) {
+ copyAction((IContextCopyAction) copyContextButtons.get(0).getData());
}
} else {
editAction();
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java
index eb33d08322d..1fa19cb9a17 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/EditContextAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Display;
* An action to edit an existing context.
* The context must not be read-only, which means it should not have been
* registered via a plug-in extension
- *
+ *
* @author Camille Letavernier
*/
public class EditContextAction {
@@ -42,11 +42,11 @@ public class EditContextAction {
/**
* Opens an Eclipse Editor to edit the given context.
- *
+ *
* @param context
- * The context to edit
+ * The context to edit
* @throws Exception
- * If the context cannot be edited
+ * If the context cannot be edited
*/
public void openEditor(final Context context) {
@@ -54,6 +54,7 @@ public class EditContextAction {
try {
dialog.run(false, false, new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
delegate.openEditor(context, monitor);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/OpenCustomization.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/OpenCustomization.java
index c6dc5cce847..cef934f39e8 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/OpenCustomization.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/OpenCustomization.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,20 +27,22 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* A Handler for the "OpenCustomization" Action.
* Opens the {@link CustomizationDialog}
- *
+ *
* @author Camille Letavernier
*/
public class OpenCustomization extends AbstractHandler {
+ @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final Shell shell = HandlerUtil.getActiveShellChecked(event);
- //The first opening might take some time, as the Property view ConfigurationManager may not be initialized yet
+ // The first opening might take some time, as the Property view ConfigurationManager may not be initialized yet
ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
try {
dialog.run(false, false, new IRunnableWithProgress() {
+ @Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Opening the property view customization page", IProgressMonitor.UNKNOWN);
runOpenCustomizationDialog(shell);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java
index 3a34fe1a383..d245d848d73 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/ui/RemoveContextAction.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011, 2013 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
@@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Display;
/**
* An action to delete an existing context. This action cannot be undone.
* If you simply want to disable an existing context, see {@link ConfigurationManager#disableContext(Context)}
- *
+ *
* @author Camille Letavernier
*/
public class RemoveContextAction {
@@ -42,12 +42,12 @@ public class RemoveContextAction {
/**
* Deletes the given context.
- *
+ *
* @param sourceContext
- * The context to delete
+ * The context to delete
*/
public void removeContext(final Context sourceContext) {
- //TODO : Close editors for the context being deleted
+ // TODO : Close editors for the context being deleted
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getCurrent().getActiveShell());
try {
dialog.run(false, false, new IRunnableWithProgress() {
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
index 0f607c96240..bd4e57b0241 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ActionUtil.java
@@ -38,13 +38,13 @@ public class ActionUtil {
* Objects that cannot be adapted remain as-is in the collection.
*
* @param selection
- * The collection to adapt
+ * The collection to adapt
* @return
* The adapted selection
*/
public static Collection<Object> getAdaptedSelection(Collection<? extends Object> selection) {
Collection<Object> newSelection = new LinkedList<Object>();
- for(Object o : selection) {
+ for (Object o : selection) {
EObject semantic = EMFHelper.getEObject(o);
newSelection.add(semantic == null ? o : semantic);
}
@@ -60,17 +60,17 @@ public class ActionUtil {
* Objects that cannot be adapted remain as-is in the selection.
*
* @param sourceSelection
- * The selection to adapt
+ * The selection to adapt
* @return
* The adapted selection
*/
public static ISelection getAdaptedSelection(ISelection sourceSelection) {
- if(sourceSelection instanceof StructuredSelection) {
- StructuredSelection currentSelection = (StructuredSelection)sourceSelection;
+ if (sourceSelection instanceof StructuredSelection) {
+ StructuredSelection currentSelection = (StructuredSelection) sourceSelection;
List<Object> newSelection = new LinkedList<Object>();
Iterator<?> it = currentSelection.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Object object = it.next();
EObject eObject = EMFHelper.getEObject(object);
newSelection.add(eObject == null ? object : eObject);
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ProjectUtil.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ProjectUtil.java
index 25b7d85ca44..0d027aee324 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ProjectUtil.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/util/ProjectUtil.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2010, 2013 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
@@ -36,9 +36,9 @@ import org.eclipse.papyrus.views.properties.contexts.Section;
* These methods cannot be applied on contexts registered via plugin extensions,
* as they are read-only. For such contexts, you need to first copy them,
* and edit the copy.
- *
+ *
* @see WorkspaceContextCopyAction
- *
+ *
* @author Camille Letavernier
*/
public class ProjectUtil {
@@ -49,14 +49,14 @@ public class ProjectUtil {
public static final String CUSTOM_PROJECT_NAME = "org.eclipse.papyrus.customization.properties.internal"; //$NON-NLS-1$
/**
- *
+ *
* @param context
- * The context we want to edit
+ * The context we want to edit
* @return
* The IFile containing the given context. This IFile can be passed
* to an Eclipse editor
* @throws CoreException
- * If an error occured
+ * If an error occured
*/
public static IFile getContextFile(Context context) throws CoreException {
IFolder projectFolder = getContextFolder(context);
@@ -69,12 +69,12 @@ public class ProjectUtil {
/**
* @return the hidden IProject used by the customization plugin
* @throws CoreException
- * If an error occured
+ * If an error occured
*/
public static IProject getContextProject() throws CoreException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject custom = workspace.getRoot().getProject(CUSTOM_PROJECT_NAME);
- if(!custom.exists()) {
+ if (!custom.exists()) {
IProjectDescription description = workspace.newProjectDescription(CUSTOM_PROJECT_NAME);
IPath customProjectPath = Activator.getDefault().getPreferencesPath().append("/" + CUSTOM_PROJECT_NAME); //$NON-NLS-1$
description.setLocation(customProjectPath);
@@ -82,7 +82,7 @@ public class ProjectUtil {
custom.open(null);
}
- if(!custom.isOpen()) {
+ if (!custom.isOpen()) {
custom.open(null);
}
@@ -94,20 +94,20 @@ public class ProjectUtil {
/**
* Return the IFolder containing the given context
- *
+ *
* @param context
- * The context for which we want to get its IFolder
+ * The context for which we want to get its IFolder
* @return
* The IFolder containing the given context
* @throws CoreException
- * If an error occured
+ * If an error occured
*/
public static IFolder getContextFolder(Context context) throws CoreException {
IProject project = getContextProject();
IFolder projectFolder = project.getFolder(context.getName());
- if(!projectFolder.exists()) {
+ if (!projectFolder.exists()) {
String referencedFolderPath = new File(context.eResource().getURI().toFileString()).getParent();
projectFolder.createLink(new Path(referencedFolderPath), IResource.REPLACE, null);
}
@@ -117,16 +117,16 @@ public class ProjectUtil {
/**
* Return the IFile containing the section's XWT Resource
- *
+ *
* @param section
- * The section we want to edit
+ * The section we want to edit
* @return
* The IFile containing the section's XWT Resource
* @throws CoreException
- * If an error occured
+ * If an error occured
*/
public static IFile getSectionFile(Section section) throws CoreException {
- IFolder projectFolder = getContextFolder((Context)(section.eContainer()).eContainer());
+ IFolder projectFolder = getContextFolder((Context) (section.eContainer()).eContainer());
IFile sectionFile = projectFolder.getFile(section.getSectionFile());
return sectionFile;
}

Back to the top