Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-21 11:43:07 +0000
committerCamille Letavernier2014-08-21 13:50:25 +0000
commitdbc038b44bcbb890ae256d15eb09eb285512f020 (patch)
tree757e736583eea3ae352ad9ac91a81df7e59b79ff /plugins/facet/editor
parentea48a20561464c3cbb7895d430583669a9f82fcc (diff)
downloadorg.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.tar.gz
org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.tar.xz
org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.zip
[Code style] Apply clean-up and formatter on Main plug-ins
Diffstat (limited to 'plugins/facet/editor')
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/Activator.java2
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ColorProvider.java2
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomActionBarContributor.java149
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditor.java730
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditorPlugin.java27
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomModelWizard.java164
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomViewer.java164
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/EMFUtil.java227
-rw-r--r--plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ImageProvider.java58
9 files changed, 798 insertions, 725 deletions
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/Activator.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/Activator.java
index 17b82a09d3f..587a2858988 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/Activator.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/Activator.java
@@ -43,7 +43,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ColorProvider.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ColorProvider.java
index f19f3ff5ea3..11636c7a787 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ColorProvider.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ColorProvider.java
@@ -7,7 +7,7 @@
*
* Contributors:
* Nicolas Bros (Mia-Software) - initial API and implementation
- *
+ *
*******************************************************************************/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentation;
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomActionBarContributor.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomActionBarContributor.java
index 9179e92431e..7c332e91344 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomActionBarContributor.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomActionBarContributor.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2011 Mia-Software.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
* Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
- * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentation;
@@ -54,15 +54,17 @@ import org.eclipse.ui.PartInitException;
* This is the action bar contributor for the Custom model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class CustomActionBarContributor
- extends EditingDomainActionBarContributor
- implements ISelectionChangedListener {
+ extends EditingDomainActionBarContributor
+ implements ISelectionChangedListener {
/**
* This keeps track of the active editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IEditorPart activeEditorPart;
@@ -71,6 +73,7 @@ public class CustomActionBarContributor
* This keeps track of the current selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ISelectionProvider selectionProvider;
@@ -79,51 +82,54 @@ public class CustomActionBarContributor
* This action opens the Properties view.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IAction showPropertiesViewAction =
- new Action(CustomEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
- @Override
- public void run() {
- try {
- getPage().showView("org.eclipse.ui.views.PropertySheet");
- }
- catch (PartInitException exception) {
- CustomEditorPlugin.INSTANCE.log(exception);
+ new Action(CustomEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception) {
+ CustomEditorPlugin.INSTANCE.log(exception);
+ }
}
- }
- };
+ };
/**
* This action refreshes the viewer of the current editor if the editor
* implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IAction refreshViewerAction =
- new Action(CustomEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
- @Override
- public boolean isEnabled() {
- return activeEditorPart instanceof IViewerProvider;
- }
+ new Action(CustomEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
+ @Override
+ public boolean isEnabled() {
+ return activeEditorPart instanceof IViewerProvider;
+ }
- @Override
- public void run() {
- if (activeEditorPart instanceof IViewerProvider) {
- Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
- if (viewer != null) {
- viewer.refresh();
+ @Override
+ public void run() {
+ if (activeEditorPart instanceof IViewerProvider) {
+ Viewer viewer = ((IViewerProvider) activeEditorPart).getViewer();
+ if (viewer != null) {
+ viewer.refresh();
+ }
}
}
- }
- };
+ };
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
* generated for the current selection by the item provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<IAction> createChildActions;
@@ -132,6 +138,7 @@ public class CustomActionBarContributor
* This is the menu manager into which menu contribution items should be added for CreateChild actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IMenuManager createChildMenuManager;
@@ -141,6 +148,7 @@ public class CustomActionBarContributor
* generated for the current selection by the item provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<IAction> createSiblingActions;
@@ -149,6 +157,7 @@ public class CustomActionBarContributor
* This is the menu manager into which menu contribution items should be added for CreateSibling actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IMenuManager createSiblingMenuManager;
@@ -157,6 +166,7 @@ public class CustomActionBarContributor
* This creates an instance of the contributor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public CustomActionBarContributor() {
@@ -170,6 +180,7 @@ public class CustomActionBarContributor
* This adds Separators for editor additions to the tool bar.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -183,6 +194,7 @@ public class CustomActionBarContributor
* as well as the sub-menus for object creation items.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -209,11 +221,11 @@ public class CustomActionBarContributor
// Force an update because Eclipse hides empty menus now.
//
submenuManager.addMenuListener
- (new IMenuListener() {
- public void menuAboutToShow(IMenuManager menuManager) {
- menuManager.updateAll(true);
- }
- });
+ (new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menuManager) {
+ menuManager.updateAll(true);
+ }
+ });
addGlobalActions(submenuManager);
}
@@ -222,32 +234,33 @@ public class CustomActionBarContributor
* When the active editor changes, this remembers the change and registers with it as a selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
-// @Override
-// public void setActiveEditor(IEditorPart part) {
-// super.setActiveEditor(part);
-// activeEditorPart = part;
-//
-// // Switch to the new selection provider.
-// //
-// if (selectionProvider != null) {
-// selectionProvider.removeSelectionChangedListener(this);
-// }
-// if (part == null) {
-// selectionProvider = null;
-// }
-// else {
-// selectionProvider = part.getSite().getSelectionProvider();
-// selectionProvider.addSelectionChangedListener(this);
-//
-// // Fake a selection changed event to update the menus.
-// //
-// if (selectionProvider.getSelection() != null) {
-// selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
-// }
-// }
-// }
+ // @Override
+ // public void setActiveEditor(IEditorPart part) {
+ // super.setActiveEditor(part);
+ // activeEditorPart = part;
+ //
+ // // Switch to the new selection provider.
+ // //
+ // if (selectionProvider != null) {
+ // selectionProvider.removeSelectionChangedListener(this);
+ // }
+ // if (part == null) {
+ // selectionProvider = null;
+ // }
+ // else {
+ // selectionProvider = part.getSite().getSelectionProvider();
+ // selectionProvider.addSelectionChangedListener(this);
+ //
+ // // Fake a selection changed event to update the menus.
+ // //
+ // if (selectionProvider.getSelection() != null) {
+ // selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ // }
+ // }
+ // }
/**
* This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
@@ -255,6 +268,7 @@ public class CustomActionBarContributor
* that can be added to the selected object and updating the menus accordingly.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void selectionChanged(SelectionChangedEvent event) {
@@ -273,10 +287,10 @@ public class CustomActionBarContributor
Collection<?> newSiblingDescriptors = null;
ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
- Object object = ((IStructuredSelection)selection).getFirstElement();
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() == 1) {
+ Object object = ((IStructuredSelection) selection).getFirstElement();
- EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+ EditingDomain domain = ((IEditingDomainProvider) activeEditorPart).getEditingDomain();
newChildDescriptors = domain.getNewChildDescriptors(object, null);
newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
@@ -302,6 +316,7 @@ public class CustomActionBarContributor
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
@@ -319,6 +334,7 @@ public class CustomActionBarContributor
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
@@ -338,6 +354,7 @@ public class CustomActionBarContributor
* If <code>contributionID</code> is <code>null</code>, they are simply added.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
@@ -352,12 +369,13 @@ public class CustomActionBarContributor
}
}
}
-
+
/**
* This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
@@ -368,13 +386,13 @@ public class CustomActionBarContributor
//
IContributionItem contributionItem = items[i];
while (contributionItem instanceof SubContributionItem) {
- contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ contributionItem = ((SubContributionItem) contributionItem).getInnerItem();
}
// Delete the ActionContributionItems with matching action.
//
if (contributionItem instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem)contributionItem).getAction();
+ IAction action = ((ActionContributionItem) contributionItem).getAction();
if (actions.contains(action)) {
manager.remove(contributionItem);
}
@@ -387,6 +405,7 @@ public class CustomActionBarContributor
* This populates the pop-up menu before it appears.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -407,6 +426,7 @@ public class CustomActionBarContributor
* This inserts global actions before the "additions-end" separator.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -414,7 +434,7 @@ public class CustomActionBarContributor
menuManager.insertAfter("additions-end", new Separator("ui-actions"));
menuManager.insertAfter("ui-actions", showPropertiesViewAction);
- refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
menuManager.insertAfter("ui-actions", refreshViewerAction);
super.addGlobalActions(menuManager);
@@ -424,6 +444,7 @@ public class CustomActionBarContributor
* This ensures that a delete action will clean up all references to deleted objects.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditor.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditor.java
index 6bff3822125..a47f4a40de7 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditor.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditor.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2011 Mia-Software.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
* Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
- * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentation;
@@ -22,13 +22,10 @@ import java.util.Collection;
import java.util.Collections;
import java.util.EventObject;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.logging.Logger;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -57,7 +54,6 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EParameter;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.EValidator;
@@ -164,11 +160,12 @@ import org.eclipse.ui.views.properties.PropertySheetPage;
* This is an example of a Custom model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class CustomEditor
-extends EditorPart
-implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvider, IViewerProvider {
+ extends EditorPart
+ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvider, IViewerProvider {
protected Customization mainCustomization;
@@ -180,6 +177,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Resources that have been changed since last activation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<Resource> changedResources = new ArrayList<Resource>();
@@ -188,6 +186,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Resources that have been saved.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<Resource> savedResources = new ArrayList<Resource>();
@@ -196,6 +195,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Resources that have been removed since last activation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<Resource> removedResources = new ArrayList<Resource>();
@@ -204,6 +204,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This keeps track of the selection of the editor as a whole.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ISelection editorSelection = StructuredSelection.EMPTY;
@@ -212,6 +213,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This listens to which ever viewer is active.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ISelectionChangedListener selectionChangedListener;
@@ -220,6 +222,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
@@ -228,6 +231,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Controls whether the problem indication should be updated.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected boolean updateProblemIndication = true;
@@ -236,6 +240,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This is the content outline page's viewer.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected TreeViewer contentOutlineViewer;
@@ -244,6 +249,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This is a kludge...
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IStatusLineManager contentOutlineStatusLineManager;
@@ -252,6 +258,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Map to store the diagnostic associated with a resource.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
@@ -261,6 +268,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* in Eclipse's Problems View.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected MarkerHelper markerHelper = new EditUIMarkerHelper();
@@ -269,6 +277,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This is the property sheet page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected PropertySheetPage propertySheetPage;
@@ -277,6 +286,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This is the content outline page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IContentOutlinePage contentOutlinePage;
@@ -314,6 +324,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This sets up the editing domain for the model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void initializeEditingDomain() {
@@ -337,26 +348,26 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
// Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
//
commandStack.addCommandStackListener
- (new CommandStackListener() {
- public void commandStackChanged(final EventObject event) {
- getSite().getShell().getDisplay().asyncExec
- (new Runnable() {
- public void run() {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- //setDirty(commandStack.isSaveNeeded());
- // Try to select the affected objects.
- //
- Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
- if (mostRecentCommand != null) {
- setSelectionToViewer(mostRecentCommand.getAffectedObjects());
- }
- if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
- propertySheetPage.refresh();
- }
+ (new CommandStackListener() {
+ public void commandStackChanged(final EventObject event) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ // setDirty(commandStack.isSaveNeeded());
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack) event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
+ propertySheetPage.refresh();
+ }
+ }
+ });
}
});
- }
- });
// Create the editing domain with a special command stack.
//
@@ -377,6 +388,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This sets the selection into whichever viewer is active.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void setSelectionToViewer(Collection<?> collection) {
@@ -386,14 +398,14 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
if (theSelection != null && !theSelection.isEmpty()) {
Runnable runnable =
new Runnable() {
- public void run() {
- // Try to select the items in the current content viewer of the editor.
- //
- if (selectionViewer != null) {
- selectionViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
- }
- }
- };
+ public void run() {
+ // Try to select the items in the current content viewer of the editor.
+ //
+ if (selectionViewer != null) {
+ selectionViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
+ }
+ }
+ };
getSite().getShell().getDisplay().asyncExec(runnable);
}
}
@@ -436,7 +448,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
this.selectionViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
- if(listenerCounter == 0){
+ if (listenerCounter == 0) {
ISelection eventSelection = event.getSelection();
setSelection(eventSelection);
final ITreeSelection selection = (ITreeSelection) CustomEditor.this.selectionViewer
@@ -445,11 +457,11 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
CustomEditor.this.handleSelectionViewerSelectionChanged(selection.getFirstElement());
listenerCounter = 0;
CustomEditor.this.customizationViewer.getViewer().getControl()
- .setRedraw(false);
+ .setRedraw(false);
CustomEditor.this.customizationViewer.getViewer().expandAll();
CustomEditor.this.customizationViewer.getViewer().getControl()
- .setRedraw(true);
- }else {
+ .setRedraw(true);
+ } else {
listenerCounter = 0;
}
}
@@ -465,8 +477,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
- }
- catch (Exception e) {
+ } catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
@@ -488,74 +499,74 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
protected IResourceChangeListener resourceChangeListener =
new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- try {
- class ResourceDeltaVisitor implements IResourceDeltaVisitor {
- protected ResourceSet resourceSet = editingDomain.getResourceSet();
- protected Collection<Resource> changedResources = new ArrayList<Resource>();
- protected Collection<Resource> removedResources = new ArrayList<Resource>();
-
- public boolean visit(IResourceDelta delta) {
- if (delta.getResource().getType() == IResource.FILE) {
- if (delta.getKind() == IResourceDelta.REMOVED ||
- delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) {
- Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
- if (resource != null) {
- if (delta.getKind() == IResourceDelta.REMOVED) {
- removedResources.add(resource);
- }
- else if (!savedResources.remove(resource)) {
- changedResources.add(resource);
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ protected ResourceSet resourceSet = editingDomain.getResourceSet();
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ public boolean visit(IResourceDelta delta) {
+ if (delta.getResource().getType() == IResource.FILE) {
+ if (delta.getKind() == IResourceDelta.REMOVED ||
+ delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) {
+ Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
+ if (resource != null) {
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ removedResources.add(resource);
+ }
+ else if (!savedResources.remove(resource)) {
+ changedResources.add(resource);
+ }
+ }
}
}
- }
- }
- return true;
- }
-
- public Collection<Resource> getChangedResources() {
- return changedResources;
- }
-
- public Collection<Resource> getRemovedResources() {
- return removedResources;
- }
- }
+ return true;
+ }
- final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
- delta.accept(visitor);
+ public Collection<Resource> getChangedResources() {
+ return changedResources;
+ }
- if (!visitor.getRemovedResources().isEmpty()) {
- getSite().getShell().getDisplay().asyncExec
- (new Runnable() {
- public void run() {
- removedResources.addAll(visitor.getRemovedResources());
- if (!isDirty()) {
- getSite().getPage().closeEditor(CustomEditor.this, false);
+ public Collection<Resource> getRemovedResources() {
+ return removedResources;
}
}
- });
- }
- if (!visitor.getChangedResources().isEmpty()) {
- getSite().getShell().getDisplay().asyncExec
- (new Runnable() {
- public void run() {
- changedResources.addAll(visitor.getChangedResources());
- if (getSite().getPage().getActiveEditor() == CustomEditor.this) {
- handleActivate();
- }
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ removedResources.addAll(visitor.getRemovedResources());
+ if (!isDirty()) {
+ getSite().getPage().closeEditor(CustomEditor.this, false);
+ }
+ }
+ });
}
- });
+
+ if (!visitor.getChangedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ changedResources.addAll(visitor.getChangedResources());
+ if (getSite().getPage().getActiveEditor() == CustomEditor.this) {
+ handleActivate();
+ }
+ }
+ });
+ }
+ }
+ catch (CoreException exception) {
+ CustomEditorPlugin.INSTANCE.log(exception);
+ }
}
- }
- catch (CoreException exception) {
- CustomEditorPlugin.INSTANCE.log(exception);
- }
- }
- };
+ };
private Composite rightPaneComposite;
@@ -569,7 +580,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
};
sashForm.setWeights(new int[] { CustomEditor.LEFT_PANE_SASH_WEIGHT,
- CustomEditor.RIGHT_PANE_SASH_WEIGHT
+ CustomEditor.RIGHT_PANE_SASH_WEIGHT
});
sashForm.setSashWidth(5);
@@ -577,19 +588,19 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
}
private void createLeftPane(final Composite parent) {
-
+
ViewerPane viewerPane =
new ViewerPane(getSite().getPage(), CustomEditor.this) {
- @Override
- public Viewer createViewer(Composite composite) {
- Tree tree = new Tree(composite, SWT.MULTI);
- TreeViewer newTreeViewer = new TreeViewer(tree);
- return newTreeViewer;
- }
- };
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ };
viewerPane.createControl(parent);
- selectionViewer = (TreeViewer)viewerPane.getViewer();
+ selectionViewer = (TreeViewer) viewerPane.getViewer();
selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
@@ -625,23 +636,23 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
middle.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
this.customizationViewer = new CustomViewer(middle);
this.customizationViewer.getViewer().getControl()
- .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
final Composite optionsPane = this.toolkit.createComposite(middle);
optionsPane.setLayout(new GridLayout());
optionsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
+
this.customizationViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
- if(listenerCounter == 0){
- ISelection eventSelection = event.getSelection();
- setSelection(eventSelection);
- final ITreeSelection selection = (ITreeSelection) CustomEditor.this.customizationViewer
- .getSelection();
- CustomEditor.this.handleCustomzizationViewerSelectionChanged(selection.getFirstElement());
- listenerCounter++;
- }else{
- listenerCounter = 0;
- }
+ if (listenerCounter == 0) {
+ ISelection eventSelection = event.getSelection();
+ setSelection(eventSelection);
+ final ITreeSelection selection = (ITreeSelection) CustomEditor.this.customizationViewer
+ .getSelection();
+ CustomEditor.this.handleCustomzizationViewerSelectionChanged(selection.getFirstElement());
+ listenerCounter++;
+ } else {
+ listenerCounter = 0;
+ }
}
});
@@ -655,7 +666,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
customizationViewerGridData.horizontalAlignment = SWT.FILL;
customizationViewerGridData.verticalAlignment = SWT.FILL;
this.customizationViewer.getViewer().getControl()
- .setLayoutData(customizationViewerGridData);
+ .setLayoutData(customizationViewerGridData);
if (!this.readOnly) {
createButtonsPane(rightPaneComposite);
@@ -664,19 +675,19 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return rightPaneComposite;
}
-
- private void setInputInCustomizationTreeviewer(Facet facet){
+
+ private void setInputInCustomizationTreeviewer(Facet facet) {
List<DerivedTypedElement> inputs = new ArrayList<DerivedTypedElement>();
inputs.addAll(facet.getFacetOperations());
EList<EStructuralFeature> facetElements = facet.getFacetElements();
for (EStructuralFeature eStructuralFeature : facetElements) {
- if(eStructuralFeature instanceof DerivedTypedElement){
+ if (eStructuralFeature instanceof DerivedTypedElement) {
inputs.add((DerivedTypedElement) eStructuralFeature);
}
}
this.customizationViewer.setInput(inputs);
}
-
+
private void handleSelectionViewerSelectionChanged(final Object selectedElement) {
if (selectedElement instanceof EClassCustomization || selectedElement instanceof FacetCustomization) {
final Facet facet = (Facet) selectedElement;
@@ -686,70 +697,70 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
buttonsPaneComposite.dispose();
createButtonsPaneWhenFacetIsSelected(rightPaneComposite);
rightPaneComposite.layout();
- }else if(selectedElement instanceof Customization){
+ } else if (selectedElement instanceof Customization) {
buttonsPaneComposite.dispose();
createButtonsPaneWhenCustomizationIsSelected(rightPaneComposite);
rightPaneComposite.layout();
}
- else if(selectedElement instanceof DerivedTypedElement){
+ else if (selectedElement instanceof DerivedTypedElement) {
buttonsPaneComposite.dispose();
createButtonsPaneWhenDerivedIsSelected(rightPaneComposite);
rightPaneComposite.layout();
-
- //Update customViewer input
- DerivedTypedElement derivedTypeElement = (DerivedTypedElement)selectedElement;
- Facet facet = (Facet)derivedTypeElement.eContainer();
+
+ // Update customViewer input
+ DerivedTypedElement derivedTypeElement = (DerivedTypedElement) selectedElement;
+ Facet facet = (Facet) derivedTypeElement.eContainer();
List<DerivedTypedElement> inputs = new ArrayList<DerivedTypedElement>();
inputs.addAll(facet.getFacetOperations());
EList<EStructuralFeature> facetElements = facet.getFacetElements();
for (EStructuralFeature eStructuralFeature : facetElements) {
- if(eStructuralFeature instanceof DerivedTypedElement){
+ if (eStructuralFeature instanceof DerivedTypedElement) {
inputs.add((DerivedTypedElement) eStructuralFeature);
}
}
this.customizationViewer.setInput(inputs);
this.customizationViewer.getViewer().setSelection(getSelection(), true);
-
-
+
+
}
}
-
+
private void handleCustomzizationViewerSelectionChanged(final Object selectedElement) {
setSelection(this.customizationViewer.getViewer().getSelection());
-
- if (selectedElement instanceof FacetOperation|| selectedElement instanceof FacetElement) {
+
+ if (selectedElement instanceof FacetOperation || selectedElement instanceof FacetElement) {
buttonsPaneComposite.dispose();
createButtonsPaneWhenDerivedIsSelected(rightPaneComposite);
rightPaneComposite.layout();
}
}
-
+
private void btnEditClicked() {
if (this.readOnly) {
return;
}
final Object selectedElement = getSelection();
- if(selectedElement instanceof TreeSelection){
- final Object selectedObject = ((TreeSelection)selectedElement).getFirstElement();
- if(selectedObject != null){
+ if (selectedElement instanceof TreeSelection) {
+ final Object selectedObject = ((TreeSelection) selectedElement).getFirstElement();
+ if (selectedObject != null) {
if (selectedObject instanceof Facet) {
IFacetDialogFactory.INSTANCE.openEditFacetDialog();
- }else if(selectedObject instanceof FacetAttribute){
+ } else if (selectedObject instanceof FacetAttribute) {
IFacetDialogFactory.INSTANCE.openEditFacetAttributeDialog();
- }else if(selectedObject instanceof FacetOperation){
+ } else if (selectedObject instanceof FacetOperation) {
IFacetDialogFactory.INSTANCE.openEditFacetOperationDialog();
- }else if(selectedObject instanceof FacetReference){
+ } else if (selectedObject instanceof FacetReference) {
IFacetDialogFactory.INSTANCE.openEditFacetReferenceDialog();
- }else if(selectedObject instanceof DerivedTypedElement){
+ } else if (selectedObject instanceof DerivedTypedElement) {
IFacetDialogFactory.INSTANCE.openEditFacetOperationParameterDialog();
- }else if(selectedObject instanceof Customization){
+ } else if (selectedObject instanceof Customization) {
ICustomizationDialogFactory.DEFAULT.openAddCustomizationPropertyDialog(getSite().getShell().getDisplay(), editingDomain);
}
}
}
}
-
+
@Override
public void doSave(final IProgressMonitor monitor) {
// Save only resources that have actually changed.
@@ -761,30 +772,30 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
//
WorkspaceModifyOperation operation =
new WorkspaceModifyOperation() {
- // This is the method that gets invoked when the operation runs.
- //
- @Override
- public void execute(IProgressMonitor monitor) {
- // Save the resources to the file system.
- //
- boolean first = true;
- for (Resource resource : editingDomain.getResourceSet().getResources()) {
- if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
- try {
- long timeStamp = resource.getTimeStamp();
- resource.save(saveOptions);
- if (resource.getTimeStamp() != timeStamp) {
- savedResources.add(resource);
+ // This is the method that gets invoked when the operation runs.
+ //
+ @Override
+ public void execute(IProgressMonitor monitor) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for (Resource resource : editingDomain.getResourceSet().getResources()) {
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ try {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
+ }
+ catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
}
}
- catch (Exception exception) {
- resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
- }
- first = false;
}
- }
- }
- };
+ };
updateProblemIndication = false;
try {
@@ -794,10 +805,9 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
// Refresh the necessary state.
//
- ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- catch (Exception exception) {
+ } catch (Exception exception) {
// Something went wrong that shouldn't.
//
CustomEditorPlugin.INSTANCE.log(exception);
@@ -808,9 +818,10 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
/**
* This returns whether something has been persisted to the URI of the specified resource.
- * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
+ * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected boolean isPersisted(Resource resource) {
@@ -821,8 +832,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
result = true;
stream.close();
}
- }
- catch (IOException e) {
+ } catch (IOException e) {
// Ignore
}
return result;
@@ -832,6 +842,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This accesses a cached version of the content outliner.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public IContentOutlinePage getContentOutlinePage() {
@@ -880,13 +891,13 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
// Listen to selection so that we can handle it is a special way.
//
contentOutlinePage.addSelectionChangedListener
- (new ISelectionChangedListener() {
- // This ensures that we handle selections correctly.
- //
- public void selectionChanged(SelectionChangedEvent event) {
- handleContentOutlineSelection(event.getSelection());
- }
- });
+ (new ISelectionChangedListener() {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
}
return contentOutlinePage;
@@ -896,24 +907,25 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This accesses a cached version of the property sheet.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public IPropertySheetPage getPropertySheetPage() {
if (propertySheetPage == null) {
propertySheetPage =
new ExtendedPropertySheetPage(editingDomain) {
- @Override
- public void setSelectionToViewer(List<?> selection) {
- CustomEditor.this.setSelectionToViewer(selection);
- CustomEditor.this.setFocus();
- }
+ @Override
+ public void setSelectionToViewer(List<?> selection) {
+ CustomEditor.this.setSelectionToViewer(selection);
+ CustomEditor.this.setFocus();
+ }
- @Override
- public void setActionBars(IActionBars actionBars) {
- super.setActionBars(actionBars);
- getActionBarContributor().shareGlobalActions(this, actionBars);
- }
- };
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
}
@@ -924,6 +936,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This is how the framework determines which interfaces we implement.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@SuppressWarnings("rawtypes")
@@ -947,6 +960,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Returns whether the outline view should be presented to the user.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected boolean showOutlineView() {
@@ -957,11 +971,12 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This deals with how we want selection in the outliner to affect the other views.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void handleContentOutlineSelection(ISelection selection) {
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
- Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
+ Iterator<?> selectedElements = ((IStructuredSelection) selection).iterator();
if (selectedElements.hasNext()) {
// Get the first selected element.
//
@@ -986,6 +1001,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void doSaveAs(URI uri, IEditorInput editorInput) {
@@ -995,25 +1011,28 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
IProgressMonitor progressMonitor =
getActionBars().getStatusLineManager() != null ?
getActionBars().getStatusLineManager().getProgressMonitor() :
- new NullProgressMonitor();
- doSave(progressMonitor);
+ new NullProgressMonitor();
+ doSave(progressMonitor);
}
+
//
/**
* This is for implementing {@link IEditorPart} and simply tests the command stack.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
public boolean isDirty() {
- return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
+ return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded();
}
@Override
public boolean isSaveAsAllowed() {
return false;
}
+
//
@Override
public void setFocus() {
@@ -1044,10 +1063,11 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
super.dispose();
}
-
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void gotoMarker(IMarker marker) {
@@ -1062,71 +1082,75 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
}
}
}
- }
- catch (CoreException exception) {
+ } catch (CoreException exception) {
CustomEditorPlugin.INSTANCE.log(exception);
}
}
+
//
- private final IPartListener partListener =
+ private final IPartListener partListener =
new IPartListener() {
- public void partActivated(IWorkbenchPart p) {
- if (p instanceof ContentOutline) {
- if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
- getActionBarContributor().setActiveEditor(CustomEditor.this);
-
- if (selectionChangedListener == null) {
- // Create the listener on demand.
- //
- selectionChangedListener =
- new ISelectionChangedListener() {
- // This just notifies those things that are affected by the section.
- //
- public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
- setSelection(selectionChangedEvent.getSelection());
+ public void partActivated(IWorkbenchPart p) {
+ if (p instanceof ContentOutline) {
+ if (((ContentOutline) p).getCurrentPage() == contentOutlinePage) {
+ getActionBarContributor().setActiveEditor(CustomEditor.this);
+
+ if (selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ selectionChangedListener =
+ new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
}
- };
+ setSelection(selectionViewer == null ? StructuredSelection.EMPTY : selectionViewer.getSelection());
+ }
+ }
+ else if (p instanceof PropertySheet) {
+ if (((PropertySheet) p).getCurrentPage() == propertySheetPage) {
+ getActionBarContributor().setActiveEditor(CustomEditor.this);
+ handleActivate();
+ }
+ }
+ else if (p == CustomEditor.this) {
+ handleActivate();
+ if (selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ selectionChangedListener =
+ new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+ selectionViewer.addSelectionChangedListener(selectionChangedListener);
+ setSelection(selectionViewer.getSelection());
}
- setSelection(selectionViewer == null ? StructuredSelection.EMPTY : selectionViewer.getSelection());
}
- }
- else if (p instanceof PropertySheet) {
- if (((PropertySheet)p).getCurrentPage() == propertySheetPage) {
- getActionBarContributor().setActiveEditor(CustomEditor.this);
- handleActivate();
+
+ public void partBroughtToTop(IWorkbenchPart p) {
+ // Ignore.
}
- }
- else if (p == CustomEditor.this) {
- handleActivate();
- if (selectionChangedListener == null) {
- // Create the listener on demand.
- //
- selectionChangedListener =
- new ISelectionChangedListener() {
- // This just notifies those things that are affected by the section.
- //
- public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
- setSelection(selectionChangedEvent.getSelection());
- }
- };
+
+ public void partClosed(IWorkbenchPart p) {
+ // Ignore.
}
- selectionViewer.addSelectionChangedListener(selectionChangedListener);
- setSelection(selectionViewer.getSelection());
- }
- }
- public void partBroughtToTop(IWorkbenchPart p) {
- // Ignore.
- }
- public void partClosed(IWorkbenchPart p) {
- // Ignore.
- }
- public void partDeactivated(IWorkbenchPart p) {
- // Ignore.
- }
- public void partOpened(IWorkbenchPart p) {
- // Ignore.
- }
- };
+
+ public void partDeactivated(IWorkbenchPart p) {
+ // Ignore.
+ }
+
+ public void partOpened(IWorkbenchPart p) {
+ // Ignore.
+ }
+ };
private Button btnAddFacetSet;
@@ -1148,6 +1172,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public ISelection getSelection() {
@@ -1157,15 +1182,17 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public EditingDomainActionBarContributor getActionBarContributor() {
- return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
+ return (EditingDomainActionBarContributor) getEditorSite().getActionBarContributor();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public IActionBars getActionBars() {
@@ -1175,6 +1202,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void setStatusLineManager(ISelection selection) {
@@ -1183,7 +1211,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
if (statusLineManager != null) {
if (selection instanceof IStructuredSelection) {
- Collection<?> collection = ((IStructuredSelection)selection).toList();
+ Collection<?> collection = ((IStructuredSelection) selection).toList();
switch (collection.size()) {
case 0: {
statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
@@ -1211,6 +1239,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Calling this result will notify the listeners.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void setSelection(ISelection selection) {
@@ -1227,6 +1256,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* and the specified exception (if any).
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
@@ -1237,18 +1267,16 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
"org.eclipse.papyrus.emf.facet.custom.metamodel.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
- new Object [] { exception == null ? (Object)resource : exception });
+ new Object[] { exception == null ? (Object) resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
}
else if (exception != null) {
- return
- new BasicDiagnostic
- (Diagnostic.ERROR,
- "org.eclipse.papyrus.emf.facet.custom.metamodel.editor",
- 0,
- getString("_UI_CreateModelError_message", resource.getURI()),
- new Object[] { exception });
+ return new BasicDiagnostic(Diagnostic.ERROR,
+ "org.eclipse.papyrus.emf.facet.custom.metamodel.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object[] { exception });
}
else {
return Diagnostic.OK_INSTANCE;
@@ -1298,6 +1326,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* Updates the problems indication with the information described in the specified diagnostic.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void updateProblemIndication() {
@@ -1308,7 +1337,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
"org.eclipse.papyrus.emf.facet.custom.metamodel.editor",
0,
null,
- new Object [] { editingDomain.getResourceSet() });
+ new Object[] { editingDomain.getResourceSet() });
for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
if (childDiagnostic.getSeverity() != Diagnostic.OK) {
diagnostic.add(childDiagnostic);
@@ -1326,8 +1355,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
if (diagnostic.getSeverity() != Diagnostic.OK) {
try {
markerHelper.createMarkers(diagnostic);
- }
- catch (CoreException exception) {
+ } catch (CoreException exception) {
CustomEditorPlugin.INSTANCE.log(exception);
}
}
@@ -1349,8 +1377,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
resource.unload();
try {
resource.load(Collections.EMPTY_MAP);
- }
- catch (IOException exception) {
+ } catch (IOException exception) {
if (!resourceToDiagnosticMap.containsKey(resource)) {
resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
}
@@ -1371,6 +1398,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void addSelectionChangedListener(ISelectionChangedListener listener) {
@@ -1381,6 +1409,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
@@ -1391,6 +1420,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This looks up a string in the plugin's plugin.properties file.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
private static String getString(String key) {
@@ -1401,16 +1431,18 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This looks up a string in plugin.properties, making a substitution.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
private static String getString(String key, Object s1) {
- return CustomEditorPlugin.INSTANCE.getString(key, new Object [] { s1 });
+ return CustomEditorPlugin.INSTANCE.getString(key, new Object[] { s1 });
}
/**
* This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void createContextMenuFor(StructuredViewer viewer) {
@@ -1418,7 +1450,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
contextMenu.add(new Separator("additions"));
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(this);
- Menu menu= contextMenu.createContextMenu(viewer.getControl());
+ Menu menu = contextMenu.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
@@ -1432,10 +1464,11 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void menuAboutToShow(IMenuManager menuManager) {
- ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ ((IMenuListener) getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
}
private Object buttonsGridData() {
@@ -1447,7 +1480,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return buttonsGridData;
}
- private Composite createButtonsPane(final Composite parent){
+ private Composite createButtonsPane(final Composite parent) {
return createButtonsPaneWhenCustomizationIsSelected(parent);
}
@@ -1522,53 +1555,53 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
if (this.readOnly) {
return;
}
- final TreeSelection selectedElement = (TreeSelection)getSelection();
+ final TreeSelection selectedElement = (TreeSelection) getSelection();
final Object selectedObject = selectedElement.getFirstElement();
if (selectedObject instanceof EObject) {
final EObject eObject = (EObject) selectedObject;
final EObject eContainer = eObject.eContainer();
-
- if(eContainer instanceof Customization){
-
+
+ if (eContainer instanceof Customization) {
+
+ Command command = RemoveCommand.create(this.editingDomain,
+ eContainer,
+ EcorePackage.eINSTANCE.getEPackage_EClassifiers(),
+ eObject);
+ this.editingDomain.getCommandStack().execute(command);
+ // refresh();
+ } else if (eContainer instanceof Facet) {
+ if (selectedObject instanceof FacetOperation) {
Command command = RemoveCommand.create(this.editingDomain,
eContainer,
- EcorePackage.eINSTANCE.getEPackage_EClassifiers(),
+ EFacetPackage.eINSTANCE.getFacet_FacetOperations(),
eObject);
this.editingDomain.getCommandStack().execute(command);
- //refresh();
- }else if(eContainer instanceof Facet){
- if(selectedObject instanceof FacetOperation){
- Command command = RemoveCommand.create(this.editingDomain,
- eContainer,
- EFacetPackage.eINSTANCE.getFacet_FacetOperations(),
- eObject);
- this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
- this.customizationViewer.getViewer().refresh();
-
- }else if(selectedObject instanceof FacetAttribute || selectedObject instanceof FacetReference){
- Command command = RemoveCommand.create(this.editingDomain,
- eContainer,
- EFacetPackage.eINSTANCE.getFacet_FacetElements(),
- eObject);
- this.editingDomain.getCommandStack().execute(command);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
+ this.customizationViewer.getViewer().refresh();
- setInputInCustomizationTreeviewer((Facet)eContainer);
- this.customizationViewer.getViewer().refresh();
- }
- }else if(eContainer instanceof FacetOperation){
- Command command = RemoveCommand.create(this.editingDomain,
+ } else if (selectedObject instanceof FacetAttribute || selectedObject instanceof FacetReference) {
+ Command command = RemoveCommand.create(this.editingDomain,
eContainer,
- EcorePackage.eINSTANCE.getEOperation_EParameters(),
+ EFacetPackage.eINSTANCE.getFacet_FacetElements(),
eObject);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
-
+ }
+ } else if (eContainer instanceof FacetOperation) {
+ Command command = RemoveCommand.create(this.editingDomain,
+ eContainer,
+ EcorePackage.eINSTANCE.getEOperation_EParameters(),
+ eObject);
+ this.editingDomain.getCommandStack().execute(command);
+
+ setInputInCustomizationTreeviewer((Facet) eContainer);
+ this.customizationViewer.getViewer().refresh();
+
}
-
+
}
}
@@ -1576,14 +1609,14 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
if (this.readOnly) {
return;
}
- final TreeSelection selectedElement = (TreeSelection)getSelection();
+ final TreeSelection selectedElement = (TreeSelection) getSelection();
final Object selectedObject = selectedElement.getFirstElement();
if (selectedObject instanceof EObject) {
final EObject eObject = (EObject) selectedObject;
final EObject eContainer = eObject.eContainer();
-
- if(eContainer instanceof Customization){
- EList<EClassifier>list = ((Customization)eContainer).getEClassifiers();
+
+ if (eContainer instanceof Customization) {
+ EList<EClassifier> list = ((Customization) eContainer).getEClassifiers();
final int index = list.indexOf(eObject);
if (index + 1 < list.size()) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1592,10 +1625,10 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index + 1);
this.editingDomain.getCommandStack().execute(command);
}
- //refresh();
- }else if(eContainer instanceof Facet){
- if(selectedObject instanceof FacetOperation){
- EList<FacetOperation>list = ((Facet)eContainer).getFacetOperations();
+ // refresh();
+ } else if (eContainer instanceof Facet) {
+ if (selectedObject instanceof FacetOperation) {
+ EList<FacetOperation> list = ((Facet) eContainer).getFacetOperations();
final int index = list.indexOf(eObject);
if (index + 1 < list.size()) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1604,11 +1637,11 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index + 1);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
}
- }else if(selectedObject instanceof FacetAttribute || selectedObject instanceof FacetReference){
- EList<EStructuralFeature>list = ((Facet)eContainer).getFacetElements();
+ } else if (selectedObject instanceof FacetAttribute || selectedObject instanceof FacetReference) {
+ EList<EStructuralFeature> list = ((Facet) eContainer).getFacetElements();
final int index = list.indexOf(eObject);
if (index + 1 < list.size()) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1617,12 +1650,12 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index + 1);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
}
}
- }else if(eContainer instanceof FacetOperation){
- EList<EParameter>list = ((FacetOperation)eContainer).getEParameters();
+ } else if (eContainer instanceof FacetOperation) {
+ EList<EParameter> list = ((FacetOperation) eContainer).getEParameters();
final int index = list.indexOf(eObject);
if (index + 1 < list.size()) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1631,11 +1664,11 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index + 1);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
}
}
-
+
}
}
@@ -1643,14 +1676,14 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
if (this.readOnly) {
return;
}
- final TreeSelection selectedElement = (TreeSelection)getSelection();
+ final TreeSelection selectedElement = (TreeSelection) getSelection();
final Object selectedObject = selectedElement.getFirstElement();
if (selectedObject instanceof EObject) {
final EObject eObject = (EObject) selectedObject;
final EObject eContainer = eObject.eContainer();
-
- if(eContainer instanceof Customization){
- EList<EClassifier>list = ((Customization)eContainer).getEClassifiers();
+
+ if (eContainer instanceof Customization) {
+ EList<EClassifier> list = ((Customization) eContainer).getEClassifiers();
final int index = list.indexOf(eObject);
if (index - 1 >= 0) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1659,10 +1692,10 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index - 1);
this.editingDomain.getCommandStack().execute(command);
}
- //refresh();
- }else if(eContainer instanceof Facet){
- if(selectedObject instanceof FacetOperation){
- EList<FacetOperation>list = ((Facet)eContainer).getFacetOperations();
+ // refresh();
+ } else if (eContainer instanceof Facet) {
+ if (selectedObject instanceof FacetOperation) {
+ EList<FacetOperation> list = ((Facet) eContainer).getFacetOperations();
final int index = list.indexOf(eObject);
if (index - 1 >= 0) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1671,11 +1704,11 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index - 1);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
}
- }else if(selectedObject instanceof FacetAttribute || selectedObject instanceof FacetReference){
- EList<EStructuralFeature>list = ((Facet)eContainer).getFacetElements();
+ } else if (selectedObject instanceof FacetAttribute || selectedObject instanceof FacetReference) {
+ EList<EStructuralFeature> list = ((Facet) eContainer).getFacetElements();
final int index = list.indexOf(eObject);
if (index - 1 >= 0) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1684,12 +1717,12 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index - 1);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
}
}
- }else if(eContainer instanceof FacetOperation){
- EList<EParameter>list = ((FacetOperation)eContainer).getEParameters();
+ } else if (eContainer instanceof FacetOperation) {
+ EList<EParameter> list = ((FacetOperation) eContainer).getEParameters();
final int index = list.indexOf(eObject);
if (index - 1 >= 0) {
Command command = MoveCommand.create(this.editingDomain,
@@ -1698,13 +1731,13 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
list.get(index), index - 1);
this.editingDomain.getCommandStack().execute(command);
- setInputInCustomizationTreeviewer((Facet)eContainer);
+ setInputInCustomizationTreeviewer((Facet) eContainer);
this.customizationViewer.getViewer().refresh();
}
}
-
+
}
-
+
}
protected void btnAddFacetCustomClicked() {
@@ -1712,7 +1745,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Customization) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Customization) {
ICustomizationDialogFactory.DEFAULT.openCreateFacetCustomizationDialog(getSite().getShell().getDisplay(), editingDomain);
}
@@ -1723,7 +1756,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Customization) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Customization) {
ICustomizationDialogFactory.DEFAULT.openCreateEClassCustomizationDialog(getSite().getShell().getDisplay(), editingDomain);
}
@@ -1734,7 +1767,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Customization) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Customization) {
IFacetDialogFactory.INSTANCE.openCreateFacetInFacetSetDialog();
}
}
@@ -1744,7 +1777,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Customization) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Customization) {
IFacetDialogFactory.INSTANCE.openCreateFacetSetInFacetSetDialog();
}
}
@@ -1859,7 +1892,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Facet) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Facet) {
IFacetDialogFactory.INSTANCE.openAddOperationInFacetDialog();
}
@@ -1870,7 +1903,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Facet) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Facet) {
IFacetDialogFactory.INSTANCE.openAddReferenceInFacetDialog();
}
}
@@ -1880,7 +1913,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if (((TreeSelection)selectedElement).getFirstElement() instanceof Facet) {
+ if (((TreeSelection) selectedElement).getFirstElement() instanceof Facet) {
IFacetDialogFactory.INSTANCE.openAddAttributeInFacetDialog();
}
}
@@ -1918,10 +1951,10 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
btnAddParameterClicked();
}
});
-
- if(!(((TreeSelection)getSelection()).getFirstElement() instanceof FacetOperation)){
+
+ if (!(((TreeSelection) getSelection()).getFirstElement() instanceof FacetOperation)) {
this.btnAddFacetParam.setEnabled(false);
- }else{
+ } else {
this.btnAddFacetParam.setEnabled(true);
}
@@ -1981,8 +2014,8 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
return;
}
final Object selectedElement = getSelection();
- if(selectedElement instanceof TreeSelection){
- final Object selectedObject = ((TreeSelection)selectedElement).getFirstElement();
+ if (selectedElement instanceof TreeSelection) {
+ final Object selectedObject = ((TreeSelection) selectedElement).getFirstElement();
if (selectedObject instanceof FacetOperation) {
IFacetDialogFactory.INSTANCE.openAddParameterInOperationDialog();
}
@@ -2001,6 +2034,7 @@ implements IGotoMarker, ISelectionProvider, IMenuListener, IEditingDomainProvide
* This also changes the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditorPlugin.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditorPlugin.java
index ad66befd711..a78943b6241 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditorPlugin.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomEditorPlugin.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2011 Mia-Software.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
* Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
- * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentation;
@@ -22,6 +22,7 @@ import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.provider.Efa
* This is the central singleton for the Custom editor plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public final class CustomEditorPlugin extends EMFPlugin {
@@ -29,14 +30,16 @@ public final class CustomEditorPlugin extends EMFPlugin {
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public static final CustomEditorPlugin INSTANCE = new CustomEditorPlugin();
-
+
/**
* Keep track of the singleton.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
private static Implementation plugin;
@@ -45,19 +48,20 @@ public final class CustomEditorPlugin extends EMFPlugin {
* Create the instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public CustomEditorPlugin() {
- super
- (new ResourceLocator [] {
+ super(new ResourceLocator[] {
Efacet2EditPlugin.INSTANCE,
- });
+ });
}
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @return the singleton instance.
* @generated
*/
@@ -65,22 +69,24 @@ public final class CustomEditorPlugin extends EMFPlugin {
public ResourceLocator getPluginResourceLocator() {
return plugin;
}
-
+
/**
* Returns the singleton instance of the Eclipse plugin.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @return the singleton instance.
* @generated
*/
public static Implementation getPlugin() {
return plugin;
}
-
+
/**
* The actual implementation of the Eclipse <b>Plugin</b>.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public static class Implementation extends EclipseUIPlugin {
@@ -88,11 +94,12 @@ public final class CustomEditorPlugin extends EMFPlugin {
* Creates an instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public Implementation() {
super();
-
+
// Remember the static instance.
//
plugin = this;
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomModelWizard.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomModelWizard.java
index 09df346019f..34aa08581a0 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomModelWizard.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomModelWizard.java
@@ -1,15 +1,15 @@
/**
* Copyright (c) 2011 Mia-Software.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
* Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
- * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentation;
@@ -63,7 +63,6 @@ import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.part.ISetSelectionTarget;
-
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -77,6 +76,7 @@ import org.eclipse.ui.PartInitException;
* This is a simple wizard for creating a new model file.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class CustomModelWizard extends Wizard implements INewWizard {
@@ -84,24 +84,27 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* The supported extensions for created files.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public static final List<String> FILE_EXTENSIONS =
- Collections.unmodifiableList(Arrays.asList(CustomEditorPlugin.INSTANCE.getString("_UI_CustomEditorFilenameExtensions").split("\\s*,\\s*")));
+ Collections.unmodifiableList(Arrays.asList(CustomEditorPlugin.INSTANCE.getString("_UI_CustomEditorFilenameExtensions").split("\\s*,\\s*")));
/**
* A formatted list of supported file extensions, suitable for display.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public static final String FORMATTED_FILE_EXTENSIONS =
- CustomEditorPlugin.INSTANCE.getString("_UI_CustomEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+ CustomEditorPlugin.INSTANCE.getString("_UI_CustomEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
/**
* This caches an instance of the model package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected CustomPackage customPackage = CustomPackage.eINSTANCE;
@@ -110,6 +113,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* This caches an instance of the model factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected CustomFactory customFactory = customPackage.getCustomFactory();
@@ -118,6 +122,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* This is the file creation page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected CustomModelWizardNewFileCreationPage newFileCreationPage;
@@ -126,6 +131,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* This is the initial object creation page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected CustomModelWizardInitialObjectCreationPage initialObjectCreationPage;
@@ -134,6 +140,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Remember the selection during initialization for populating the default container.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IStructuredSelection selection;
@@ -142,6 +149,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Remember the workbench during initialization.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IWorkbench workbench;
@@ -150,6 +158,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Caches the names of the types that can be created as the root object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected List<String> initialObjectNames;
@@ -158,6 +167,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* This just records the information.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
@@ -171,6 +181,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Returns the names of the types that can be created as the root object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<String> getInitialObjectNames() {
@@ -178,7 +189,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
initialObjectNames = new ArrayList<String>();
for (EClassifier eClassifier : customPackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
- EClass eClass = (EClass)eClassifier;
+ EClass eClass = (EClass) eClassifier;
if (!eClass.isAbstract()) {
initialObjectNames.add(eClass.getName());
}
@@ -193,10 +204,11 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Create a new model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected EObject createInitialModel() {
- EClass eClass = (EClass)customPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
+ EClass eClass = (EClass) customPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
EObject rootObject = customFactory.create(eClass);
return rootObject;
}
@@ -205,6 +217,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Do the work after everything is specified.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -217,43 +230,43 @@ public class CustomModelWizard extends Wizard implements INewWizard {
// Do the work within an operation.
//
WorkspaceModifyOperation operation =
- new WorkspaceModifyOperation() {
- @Override
- protected void execute(IProgressMonitor progressMonitor) {
- try {
- // Create a resource set
- //
- ResourceSet resourceSet = new ResourceSetImpl();
-
- // Get the URI of the model file.
- //
- URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
-
- // Create a resource for this file.
- //
- Resource resource = resourceSet.createResource(fileURI);
-
- // Add the initial model object to the contents.
- //
- EObject rootObject = createInitialModel();
- if (rootObject != null) {
- resource.getContents().add(rootObject);
+ new WorkspaceModifyOperation() {
+ @Override
+ protected void execute(IProgressMonitor progressMonitor) {
+ try {
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ //
+ URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if (rootObject != null) {
+ resource.getContents().add(rootObject);
+ }
+
+ // Save the contents of the resource to the file system.
+ //
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
+ resource.save(options);
+ }
+ catch (Exception exception) {
+ CustomEditorPlugin.INSTANCE.log(exception);
+ }
+ finally {
+ progressMonitor.done();
}
-
- // Save the contents of the resource to the file system.
- //
- Map<Object, Object> options = new HashMap<Object, Object>();
- options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding());
- resource.save(options);
- }
- catch (Exception exception) {
- CustomEditorPlugin.INSTANCE.log(exception);
- }
- finally {
- progressMonitor.done();
}
- }
- };
+ };
getContainer().run(false, false, operation);
@@ -265,28 +278,26 @@ public class CustomModelWizard extends Wizard implements INewWizard {
if (activePart instanceof ISetSelectionTarget) {
final ISelection targetSelection = new StructuredSelection(modelFile);
getShell().getDisplay().asyncExec
- (new Runnable() {
- public void run() {
- ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
- }
- });
+ (new Runnable() {
+ public void run() {
+ ((ISetSelectionTarget) activePart).selectReveal(targetSelection);
+ }
+ });
}
// Open an editor on the new file.
//
try {
page.openEditor
- (new FileEditorInput(modelFile),
- workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
- }
- catch (PartInitException exception) {
+ (new FileEditorInput(modelFile),
+ workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
+ } catch (PartInitException exception) {
MessageDialog.openError(workbenchWindow.getShell(), CustomEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
return false;
}
return true;
- }
- catch (Exception exception) {
+ } catch (Exception exception) {
CustomEditorPlugin.INSTANCE.log(exception);
return false;
}
@@ -296,6 +307,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* This is the one page of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class CustomModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
@@ -303,6 +315,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Pass in the selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public CustomModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
@@ -313,6 +326,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -321,7 +335,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
String extension = new Path(getFileName()).getFileExtension();
if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
- setErrorMessage(CustomEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
+ setErrorMessage(CustomEditorPlugin.INSTANCE.getString(key, new Object[] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
@@ -332,6 +346,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public IFile getModelFile() {
@@ -343,26 +358,29 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* This is the page where the type of object to create is selected.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class CustomModelWizardInitialObjectCreationPage extends WizardPage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Combo initialObjectField;
/**
* @generated
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
*/
protected List<String> encodings;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Combo encodingField;
@@ -371,6 +389,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Pass in the selection.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public CustomModelWizardInitialObjectCreationPage(String pageId) {
@@ -380,6 +399,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public void createControl(Composite parent) {
@@ -453,18 +473,20 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ModifyListener validator =
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- setPageComplete(validatePage());
- }
- };
+ new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected boolean validatePage() {
@@ -474,6 +496,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -494,6 +517,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public String getInitialObjectName() {
@@ -510,6 +534,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public String getEncoding() {
@@ -520,13 +545,13 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Returns the label for the specified type name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected String getLabel(String typeName) {
try {
return CustomEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
- }
- catch(MissingResourceException mre) {
+ } catch (MissingResourceException mre) {
CustomEditorPlugin.INSTANCE.log(mre);
}
return typeName;
@@ -535,12 +560,13 @@ public class CustomModelWizard extends Wizard implements INewWizard {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<String> getEncodings() {
if (encodings == null) {
encodings = new ArrayList<String>();
- for (StringTokenizer stringTokenizer = new StringTokenizer(CustomEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) {
+ for (StringTokenizer stringTokenizer = new StringTokenizer(CustomEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) {
encodings.add(stringTokenizer.nextToken());
}
}
@@ -552,9 +578,10 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
- @Override
+ @Override
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
@@ -573,7 +600,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
- IResource selectedResource = (IResource)selectedElement;
+ IResource selectedResource = (IResource) selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
@@ -590,7 +617,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
String defaultModelBaseFilename = CustomEditorPlugin.INSTANCE.getString("_UI_CustomEditorFilenameDefaultBase");
String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
- for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
+ for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
@@ -607,6 +634,7 @@ public class CustomModelWizard extends Wizard implements INewWizard {
* Get the file from the page.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public IFile getModelFile() {
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomViewer.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomViewer.java
index f44dfd99d52..5dcbc5ce430 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomViewer.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/CustomViewer.java
@@ -14,19 +14,14 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import javax.naming.event.ObjectChangeListener;
-
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EParameter;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StyledCellLabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
@@ -35,7 +30,6 @@ import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery;
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
-import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.Facet;
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetAttribute;
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetElement;
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
@@ -52,18 +46,12 @@ import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.query.NullLi
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.query.OperationCallQuery;
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.query.StringLiteralQuery;
import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.query.TrueLiteralQuery;
-import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2;
import org.eclipse.papyrus.emf.facet.query.java.metamodel.v0_2_0.javaquery.JavaQuery;
import org.eclipse.papyrus.emf.facet.query.ocl.metamodel.oclquery.OclQuery;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TreeItem;
/**
* Displays the current customizations for a given {@link CustomView}, which is
@@ -75,8 +63,8 @@ public class CustomViewer {
private static final int TYPE_COLUMN_WIDTH = 200;
private static final int FEATURE_COLUMN_WIDTH = 200;
private final TreeViewer treeViewer;
-
- //Customization
+
+ // Customization
private static final String TOP_LEFT_OVERLAY_ICON_PATH = "topLeftOverlay";
private static final String TOP_MIDDLE_OVERLAY_ICON_PATH = "topMiddleOverlay";
private static final String TOP_RIGHT_OVERLAY_ICON_PATH = "topRightOverlay";
@@ -149,13 +137,13 @@ public class CustomViewer {
final FacetOperation facetOperation = (FacetOperation) inputElement;
facetOperations.add(facetOperation);
}
- if(inputElement instanceof FacetElement){
- final FacetElement facetElement = (FacetElement)inputElement;
+ if (inputElement instanceof FacetElement) {
+ final FacetElement facetElement = (FacetElement) inputElement;
facetOperations.add(facetElement);
}
- if(inputElement instanceof List){
- for (Object object : (List)inputElement) {
- if(object instanceof DerivedTypedElement){
+ if (inputElement instanceof List) {
+ for (Object object : (List) inputElement) {
+ if (object instanceof DerivedTypedElement) {
facetOperations.add(object);
}
}
@@ -206,11 +194,11 @@ public class CustomViewer {
public String getText(final Object element) {
if (element instanceof DerivedTypedElement) {
final DerivedTypedElement facetElement = (DerivedTypedElement) element;
- return facetElement.getName() ;
- }else if (element instanceof ParameterValue){
+ return facetElement.getName();
+ } else if (element instanceof ParameterValue) {
final ParameterValue parameterValue = (ParameterValue) element;
return parameterValue.getParameter().getName();
- }else if (element instanceof EParameter){
+ } else if (element instanceof EParameter) {
final EParameter parameterValue = (EParameter) element;
return parameterValue.getName();
}
@@ -233,67 +221,69 @@ public class CustomViewer {
super();
}
+ @Override
public String getText(final Object element) {
-
- if(element instanceof DerivedTypedElement){
- DerivedTypedElement derivedTypedElement = (DerivedTypedElement)element;
+
+ if (element instanceof DerivedTypedElement) {
+ DerivedTypedElement derivedTypedElement = (DerivedTypedElement) element;
Query query = derivedTypedElement.getQuery();
- if(query != null){
- if(query instanceof StringLiteralQuery){
- StringLiteralQuery stringQuery = (StringLiteralQuery)query;
+ if (query != null) {
+ if (query instanceof StringLiteralQuery) {
+ StringLiteralQuery stringQuery = (StringLiteralQuery) query;
return stringQuery.getValue();
- }else if(query instanceof TrueLiteralQuery){
+ } else if (query instanceof TrueLiteralQuery) {
return "true";
- }else if(query instanceof FalseLiteralQuery){
+ } else if (query instanceof FalseLiteralQuery) {
return "false";
- }else if(query instanceof NullLiteralQuery){
+ } else if (query instanceof NullLiteralQuery) {
return "null";
- }else if(query instanceof OperationCallQuery){
- OperationCallQuery operationCallQuery = (OperationCallQuery)query;
+ } else if (query instanceof OperationCallQuery) {
+ OperationCallQuery operationCallQuery = (OperationCallQuery) query;
return operationCallQuery.toString();
- }else if(query instanceof JavaQuery){
- JavaQuery javaQuery = (JavaQuery)query;
+ } else if (query instanceof JavaQuery) {
+ JavaQuery javaQuery = (JavaQuery) query;
String qualifiedName = javaQuery.getImplementationClassName();
String[] path = qualifiedName.split("\\.");
- return path[path.length -1];
- }else if (query instanceof OclQuery){
- OclQuery oclQuery = (OclQuery)query;
+ return path[path.length - 1];
+ } else if (query instanceof OclQuery) {
+ OclQuery oclQuery = (OclQuery) query;
return oclQuery.getOclExpression();
- }else if (query instanceof NavigationQuery){
- NavigationQuery navigationQuery = (NavigationQuery)query;
+ } else if (query instanceof NavigationQuery) {
+ NavigationQuery navigationQuery = (NavigationQuery) query;
return navigationQuery.getPath().toString();
- }else if (query instanceof IsOneOfQuery){
- IsOneOfQuery isOneOfQuery = (IsOneOfQuery)query;
+ } else if (query instanceof IsOneOfQuery) {
+ IsOneOfQuery isOneOfQuery = (IsOneOfQuery) query;
return isOneOfQuery.getExpectedEObjects().toString();
- }else if (query instanceof IntegerLiteralQuery){
- IntegerLiteralQuery integerQuery = (IntegerLiteralQuery)query;
+ } else if (query instanceof IntegerLiteralQuery) {
+ IntegerLiteralQuery integerQuery = (IntegerLiteralQuery) query;
return String.valueOf(integerQuery.getValue());
- }else if (query instanceof FloatLiteralQuery){
- FloatLiteralQuery floatQuery = (FloatLiteralQuery)query;
+ } else if (query instanceof FloatLiteralQuery) {
+ FloatLiteralQuery floatQuery = (FloatLiteralQuery) query;
return String.valueOf(floatQuery.getValue());
- }else if (query instanceof EObjectLiteralQuery){
- EObjectLiteralQuery eObjectQuery = (EObjectLiteralQuery)query;
+ } else if (query instanceof EObjectLiteralQuery) {
+ EObjectLiteralQuery eObjectQuery = (EObjectLiteralQuery) query;
return eObjectQuery.getElement().eClass().getName();
- }else if(query instanceof ETypedElementSwitchQuery){
- ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery)query;
+ } else if (query instanceof ETypedElementSwitchQuery) {
+ ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) query;
EList<ETypedElementCase> list = switchQuery.getCases();
List listResult = new ArrayList<String>();
for (ETypedElementCase object : list) {
- if(object.getCase() != null){
+ if (object.getCase() != null) {
listResult.add(object.getCase().getName());
}
}
return listResult.toString();
}
}
- }else if(element instanceof EParameter){
- EParameter parameterValue = (EParameter)element;
+ } else if (element instanceof EParameter) {
+ EParameter parameterValue = (EParameter) element;
return "";
- //return parameterValue.getName();
+ // return parameterValue.getName();
}
return "N/A";
}
+ @Override
public Image getImage(final Object element) {
return null;
}
@@ -315,9 +305,9 @@ public class CustomViewer {
boolean gray = false;
if (element instanceof FacetOperation) {
final FacetOperation customViewFeature = (FacetOperation) element;
- //if (customViewFeature.getDefaultValue() == null) {
- // gray = true;
- //}
+ // if (customViewFeature.getDefaultValue() == null) {
+ // gray = true;
+ // }
}
// red if unresolved query
@@ -341,76 +331,76 @@ public class CustomViewer {
}
}
}
-
- protected class TypeLabelProvider extends ColumnLabelProvider{
-
+
+ protected class TypeLabelProvider extends ColumnLabelProvider {
+
@Override
public String getText(final Object element) {
if (element instanceof DerivedTypedElement) {
final DerivedTypedElement facetElement = (DerivedTypedElement) element;
- if(facetElement instanceof FacetAttribute || facetElement instanceof FacetReference){
+ if (facetElement instanceof FacetAttribute || facetElement instanceof FacetReference) {
return facetElement.getEType().getName();
- }else{
+ } else {
DerivedTypedElement override = facetElement.getOverride();
- if( override != null){
+ if (override != null) {
return override.getName();
- }else{
+ } else {
return ("N/A");
}
}
- } else if( element instanceof EParameter){
+ } else if (element instanceof EParameter) {
final EParameter eParameter = (EParameter) element;
return eParameter.getEType().getName();
}
return element.toString();
}
-
+
@Override
public Image getImage(Object element) {
if (element instanceof DerivedTypedElement) {
final DerivedTypedElement facetElement = (DerivedTypedElement) element;
- if(facetElement instanceof FacetAttribute || facetElement instanceof FacetReference){
+ if (facetElement instanceof FacetAttribute || facetElement instanceof FacetReference) {
return ImageProvider.getInstance().getAttributeIcon();
- }else{
+ } else {
DerivedTypedElement override = facetElement.getOverride();
- if( override != null){
+ if (override != null) {
String overrideName = override.getName();
- if(CustomViewer.TOP_LEFT_OVERLAY_ICON_PATH.equals(overrideName)){
+ if (CustomViewer.TOP_LEFT_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getTopLeftOverlayIcon();
- }else if(CustomViewer.TOP_MIDDLE_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.TOP_MIDDLE_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getTopMiddleOverlayIcon();
- }else if(CustomViewer.TOP_RIGHT_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.TOP_RIGHT_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getTopRightOverlayIcon();
- }else if(CustomViewer.MIDDLE_LEFT_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.MIDDLE_LEFT_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getMiddleLeftOverlayIcon();
- }else if(CustomViewer.MIDDLE_RIGHT_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.MIDDLE_RIGHT_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getMiddleRightOverlayIcon();
- }else if(CustomViewer.BOTTOM_LEFT_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.BOTTOM_LEFT_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getBottomLeftOverlayIcon();
- }else if(CustomViewer.BOTTOM_MIDDLE_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.BOTTOM_MIDDLE_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getBottomMiddleOverlayIcon();
- }else if(CustomViewer.BOTTOM_RIGHT_OVERLAY_ICON_PATH.equals(overrideName)){
+ } else if (CustomViewer.BOTTOM_RIGHT_OVERLAY_ICON_PATH.equals(overrideName)) {
return ImageProvider.getInstance().getBottomRightOverlayIcon();
- }else if(CustomViewer.CUSTOMIZATION_LABEL.equals(overrideName)){
+ } else if (CustomViewer.CUSTOMIZATION_LABEL.equals(overrideName)) {
return ImageProvider.getInstance().getCustomizationLabelIcon();
- }else if(CustomViewer.CUSTOMIZATION_IMAGE.equals(overrideName)){
+ } else if (CustomViewer.CUSTOMIZATION_IMAGE.equals(overrideName)) {
return ImageProvider.getInstance().getCustomizationImageIcon();
- }else if(CustomViewer.CUSTOMIZATION_FOREGROUND.equals(overrideName)){
+ } else if (CustomViewer.CUSTOMIZATION_FOREGROUND.equals(overrideName)) {
return ImageProvider.getInstance().getCustomizationColorIcon();
- }else if(CustomViewer.CUSTOMIZATION_BACKGROUND.equals(overrideName)){
+ } else if (CustomViewer.CUSTOMIZATION_BACKGROUND.equals(overrideName)) {
return ImageProvider.getInstance().getCustomizationColorIcon();
- }else if(CustomViewer.FONT_NAME.equals(overrideName)){
+ } else if (CustomViewer.FONT_NAME.equals(overrideName)) {
return ImageProvider.getInstance().getFontNameIcon();
- }else if(CustomViewer.FONT_SIZE.equals(overrideName)){
+ } else if (CustomViewer.FONT_SIZE.equals(overrideName)) {
return ImageProvider.getInstance().getFontSizeIcon();
- }else if(CustomViewer.FONT_BOLD.equals(overrideName)){
+ } else if (CustomViewer.FONT_BOLD.equals(overrideName)) {
return ImageProvider.getInstance().getIsBoldIcon();
- }else if(CustomViewer.FONT_ITALIC.equals(overrideName)){
+ } else if (CustomViewer.FONT_ITALIC.equals(overrideName)) {
return ImageProvider.getInstance().getIsItalicIcon();
- }else if(CustomViewer.FONT_UNDERLINE.equals(overrideName)){
+ } else if (CustomViewer.FONT_UNDERLINE.equals(overrideName)) {
return ImageProvider.getInstance().getIsUnderlinedIcon();
- }else if(CustomViewer.FONT_STRUKETHROUGH.equals(overrideName)){
+ } else if (CustomViewer.FONT_STRUKETHROUGH.equals(overrideName)) {
return ImageProvider.getInstance().getIsStrukethroughIcon();
}
}
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/EMFUtil.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/EMFUtil.java
index 2ad162408dc..e117798a1e3 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/EMFUtil.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/EMFUtil.java
@@ -12,13 +12,9 @@ package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.presentatio
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-import java.util.TreeSet;
-
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
@@ -58,7 +54,7 @@ public class EMFUtil {
/**
* Search for instances of the given EClass
- *
+ *
* @param eClass
* the EClass of the elements that are looked for
* @param resource
@@ -79,108 +75,107 @@ public class EMFUtil {
/**
* Find and return all the metaclasses of the given resource set.
- *
+ *
* @return a list of all the metaclasses of elements contained in the
* resource set, and metaclasses in resources in which metaclasses
* of elements in the resource set have been found
*/
-// public static Set<EClass> findAllClasses(final Set<Resource> browsedResources) {
-// // TODO: try to read from PackageRegistry?
-// // resourceSet.getPackageRegistry().keySet()
-//
-// // TODO: find EClasses in EPackages
-//
-// /*
-// * the list of metaclasses is a tree set so that it is always sorted and
-// * each class is guaranteed to appear at most once.
-// */
-// final TreeSet<EClass> classes = new TreeSet<EClass>(new Comparator<EClass>() {
-// public int compare(final EClass c1, final EClass c2) {
-// return ModelUtils.getMetaclassQualifiedName(c1).compareTo(
-// ModelUtils.getMetaclassQualifiedName(c2));
-// }
-// });
-//
-// /** The resources, in a HashSet to get constant time access */
-// final HashSet<Resource> resources = new HashSet<Resource>();
-// /**
-// * Resources that were discovered outside of the resource set, and which
-// * contain metaclasses used in the model
-// */
-// final ArrayList<Resource> newResources = new ArrayList<Resource>();
-//
-// resources.addAll(browsedResources);
-//
-// for (final Resource resource : browsedResources) {
-// final TreeIterator<EObject> allContents = resource.getAllContents();
-// while (allContents.hasNext()) {
-// final EObject eObject = allContents.next();
-// if (eObject instanceof EClass) {
-// final EClass eClass = (EClass) eObject;
-// classes.add(eClass);
-// } else {
-// // EPackage ePackage = eObject.eClass().getEPackage();
-// // System.out.println("package : " + ePackage.getNsURI());
-//
-// final EClass eClass = eObject.eClass();
-// if (eClass != null) {
-// // make sure all model elements have their metaclass in
-// // the list
-// classes.add(eClass);
-//
-// // if we discovered a new resource, then memorize it
-// final Resource res = eClass.eResource();
-// if (res != null && !resources.contains(res)) {
-// resources.add(res);
-// newResources.add(res);
-// }
-// }
-// }
-// }
-// }
-//
-// /*
-// * Now, add the classes that reside in resources that we discovered and
-// * are not part of the resource set. For example, the UML models have
-// * metaclasses in 'http://www.eclipse.org/uml2/2.1.0/UML', which is not
-// * in the resource set.
-// */
-// addAll(classes, newResources);
-// newResources.clear();
-//
-// final ArrayList<EClass> newClasses = new ArrayList<EClass>();
-//
-// for (final EClass eClass : classes) {
-// final EList<EClass> allSuperTypes = eClass.getEAllSuperTypes();
-// for (final EClass superclass : allSuperTypes) {
-// newClasses.add(superclass);
-//
-// // if we discovered a new resource, then memorize it
-// final Resource resource = superclass.eResource();
-// if (resource != null && !resources.contains(resource)) {
-// resources.add(resource);
-// newResources.add(resource);
-// }
-// }
-// }
-//
-// for (final EClass eClass : newClasses) {
-// classes.add(eClass);
-// }
-//
-// // add classes in newly discovered resources (again)
-// addAll(classes, newResources);
-//
-// // for (Resource resource : resources) {
-// // System.out.println(resource.getURI().toString());
-// // }
-//
-// return classes;
-// }
+ // public static Set<EClass> findAllClasses(final Set<Resource> browsedResources) {
+ // // TODO: try to read from PackageRegistry?
+ // // resourceSet.getPackageRegistry().keySet()
+ //
+ // // TODO: find EClasses in EPackages
+ //
+ // /*
+ // * the list of metaclasses is a tree set so that it is always sorted and
+ // * each class is guaranteed to appear at most once.
+ // */
+ // final TreeSet<EClass> classes = new TreeSet<EClass>(new Comparator<EClass>() {
+ // public int compare(final EClass c1, final EClass c2) {
+ // return ModelUtils.getMetaclassQualifiedName(c1).compareTo(
+ // ModelUtils.getMetaclassQualifiedName(c2));
+ // }
+ // });
+ //
+ // /** The resources, in a HashSet to get constant time access */
+ // final HashSet<Resource> resources = new HashSet<Resource>();
+ // /**
+ // * Resources that were discovered outside of the resource set, and which
+ // * contain metaclasses used in the model
+ // */
+ // final ArrayList<Resource> newResources = new ArrayList<Resource>();
+ //
+ // resources.addAll(browsedResources);
+ //
+ // for (final Resource resource : browsedResources) {
+ // final TreeIterator<EObject> allContents = resource.getAllContents();
+ // while (allContents.hasNext()) {
+ // final EObject eObject = allContents.next();
+ // if (eObject instanceof EClass) {
+ // final EClass eClass = (EClass) eObject;
+ // classes.add(eClass);
+ // } else {
+ // // EPackage ePackage = eObject.eClass().getEPackage();
+ // // System.out.println("package : " + ePackage.getNsURI());
+ //
+ // final EClass eClass = eObject.eClass();
+ // if (eClass != null) {
+ // // make sure all model elements have their metaclass in
+ // // the list
+ // classes.add(eClass);
+ //
+ // // if we discovered a new resource, then memorize it
+ // final Resource res = eClass.eResource();
+ // if (res != null && !resources.contains(res)) {
+ // resources.add(res);
+ // newResources.add(res);
+ // }
+ // }
+ // }
+ // }
+ // }
+ //
+ // /*
+ // * Now, add the classes that reside in resources that we discovered and
+ // * are not part of the resource set. For example, the UML models have
+ // * metaclasses in 'http://www.eclipse.org/uml2/2.1.0/UML', which is not
+ // * in the resource set.
+ // */
+ // addAll(classes, newResources);
+ // newResources.clear();
+ //
+ // final ArrayList<EClass> newClasses = new ArrayList<EClass>();
+ //
+ // for (final EClass eClass : classes) {
+ // final EList<EClass> allSuperTypes = eClass.getEAllSuperTypes();
+ // for (final EClass superclass : allSuperTypes) {
+ // newClasses.add(superclass);
+ //
+ // // if we discovered a new resource, then memorize it
+ // final Resource resource = superclass.eResource();
+ // if (resource != null && !resources.contains(resource)) {
+ // resources.add(resource);
+ // newResources.add(resource);
+ // }
+ // }
+ // }
+ //
+ // for (final EClass eClass : newClasses) {
+ // classes.add(eClass);
+ // }
+ //
+ // // add classes in newly discovered resources (again)
+ // addAll(classes, newResources);
+ //
+ // // for (Resource resource : resources) {
+ // // System.out.println(resource.getURI().toString());
+ // // }
+ //
+ // return classes;
+ // }
/**
- * Add all the classes in <code>resources</code> to the <code>classes</code>
- * set
+ * Add all the classes in <code>resources</code> to the <code>classes</code> set
*/
private static void addAll(final Set<EClass> classes, final List<Resource> resources) {
for (final Resource resource : resources) {
@@ -198,7 +193,7 @@ public class EMFUtil {
/**
* Find the most specific metaclass that is common to all of the given
* elements.
- *
+ *
* @return the common metaclass or <code>null</code> if none was found
*/
public static EClass findCommonClass(final List<EObject> elements) {
@@ -229,8 +224,7 @@ public class EMFUtil {
}
/**
- * Find the first superclass of <code>eClass</code> that is a superclass of
- * <code>element</code>
+ * Find the first superclass of <code>eClass</code> that is a superclass of <code>element</code>
*/
private static EClass findSuperType(final EClass eClass, final EClass element) {
// do a breadth-first search (with a bottom-up tree)
@@ -255,7 +249,7 @@ public class EMFUtil {
/**
* Try to resolve the given proxy.
- *
+ *
* @return whether the proxy could be resolved
*/
public static boolean tryResolve(final EObject eObject) {
@@ -282,15 +276,15 @@ public class EMFUtil {
return null;
}
-// public static EClass findMetaclassWithName(final String metaclassFullyQualifiedName,
-// final List<EClass> metaclasses) {
-// for (EClass eClass : metaclasses) {
-// if (metaclassFullyQualifiedName.equals(ModelUtils.getMetaclassQualifiedName(eClass))) {
-// return eClass;
-// }
-// }
-// return null;
-// }
+ // public static EClass findMetaclassWithName(final String metaclassFullyQualifiedName,
+ // final List<EClass> metaclasses) {
+ // for (EClass eClass : metaclasses) {
+ // if (metaclassFullyQualifiedName.equals(ModelUtils.getMetaclassQualifiedName(eClass))) {
+ // return eClass;
+ // }
+ // }
+ // return null;
+ // }
/**
* @return the name of the package in the package registry with this nsURI,
@@ -330,9 +324,8 @@ public class EMFUtil {
}
/**
- * Find the {@link EObject} with the given URI in the given
- * {@link ResourceSet}
- *
+ * Find the {@link EObject} with the given URI in the given {@link ResourceSet}
+ *
* @return the element or <code>null</code> if no element was found with
* this URI in the given {@link ResourceSet}
*/
diff --git a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ImageProvider.java b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ImageProvider.java
index 7086e6914ca..50d766a0928 100644
--- a/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ImageProvider.java
+++ b/plugins/facet/editor/org.eclipse.papyrus.emf.facet.custom.metamodel.editor/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/custom/presentation/ImageProvider.java
@@ -83,11 +83,11 @@ public final class ImageProvider {
private Image errorIcon = null;
private Image queryIcon = null;
private Image uiCustomIcon = null;
- private Image grayedUiCustomIcon=null;
+ private Image grayedUiCustomIcon = null;
private Image uriIcon = null;
-
+
private Image shortcutIcon = null;
-
+
private Image topLeftOverlay = null;
private Image topMiddleOverlay = null;
private Image topRightOverlay = null;
@@ -105,7 +105,7 @@ public final class ImageProvider {
private Image isItalic = null;
private Image isUnderlined = null;
private Image isStruckthrough = null;
-
+
private static final String LINK_ICON_PATH = "/icons/full/ctool16/link.gif"; //$NON-NLS-1$
private static final String LINK_UNIDIR_ICON_PATH = "/icons/full/ctool16/link_unidir.gif"; //$NON-NLS-1$
@@ -153,7 +153,7 @@ public final class ImageProvider {
private static final String COLLAPSE_ALL_ICON_PATH = "/icons/full/ctool16/collapseall.gif"; //$NON-NLS-1$
private static final String SHORTCUT_ICON_PATH = "/icons/shortcut.png"; //$NON-NLS-1$
- //Customization
+ // Customization
private static final String TOP_LEFT_OVERLAY_ICON_PATH = "/icons/full/ctool16/topLeftOverlay.png";
private static final String TOP_MIDDLE_OVERLAY_ICON_PATH = "/icons/full/ctool16/topMiddleOverlay.png";
private static final String TOP_RIGHT_OVERLAY_ICON_PATH = "/icons/full/ctool16/topRightOverlay.png";
@@ -174,7 +174,7 @@ public final class ImageProvider {
/**
* Create an image descriptor from a resource
- *
+ *
* @param resourcePath
* the path of the resource (in the bundle)
* @return the image descriptor
@@ -574,15 +574,15 @@ public final class ImageProvider {
}
return this.uiCustomIcon;
}
-
- /**Return the grayed image for "uiCustom*/
- public Image getGrayedUiCustomIcon(){
- if(this.grayedUiCustomIcon==null){
+
+ /** Return the grayed image for "uiCustom */
+ public Image getGrayedUiCustomIcon() {
+ if (this.grayedUiCustomIcon == null) {
this.grayedUiCustomIcon = new Image(Display.getCurrent(), getUiCustomIcon(), SWT.IMAGE_GRAY);
}
return this.grayedUiCustomIcon;
}
-
+
/** Return the "error" icon */
public Image getErrorIcon() {
if (this.errorIcon == null) {
@@ -641,126 +641,126 @@ public final class ImageProvider {
public ImageDescriptor getCollapseAllDescriptor() {
return createImageDescriptor(ImageProvider.COLLAPSE_ALL_ICON_PATH);
}
-
+
public Image getShortcutIcon() {
if (this.shortcutIcon == null) {
this.shortcutIcon = createImageDescriptor(ImageProvider.SHORTCUT_ICON_PATH).createImage();
}
return this.shortcutIcon;
}
-
+
public Image getTopLeftOverlayIcon() {
if (this.topLeftOverlay == null) {
this.topLeftOverlay = createImageDescriptor(ImageProvider.TOP_LEFT_OVERLAY_ICON_PATH).createImage();
}
return this.topLeftOverlay;
}
-
+
public Image getTopMiddleOverlayIcon() {
if (this.topMiddleOverlay == null) {
this.topMiddleOverlay = createImageDescriptor(ImageProvider.TOP_MIDDLE_OVERLAY_ICON_PATH).createImage();
}
return this.topMiddleOverlay;
}
-
+
public Image getTopRightOverlayIcon() {
if (this.topRightOverlay == null) {
this.topRightOverlay = createImageDescriptor(ImageProvider.TOP_RIGHT_OVERLAY_ICON_PATH).createImage();
}
return this.topRightOverlay;
}
-
+
public Image getMiddleLeftOverlayIcon() {
if (this.middleLeftOverlay == null) {
this.middleLeftOverlay = createImageDescriptor(ImageProvider.MIDDLE_LEFT_OVERLAY_ICON_PATH).createImage();
}
return this.middleLeftOverlay;
}
-
+
public Image getMiddleRightOverlayIcon() {
if (this.middleRightOverlay == null) {
this.middleRightOverlay = createImageDescriptor(ImageProvider.MIDDLE_RIGHT_OVERLAY_ICON_PATH).createImage();
}
return this.middleRightOverlay;
}
-
+
public Image getBottomLeftOverlayIcon() {
if (this.bottomLeftOverlay == null) {
this.bottomLeftOverlay = createImageDescriptor(ImageProvider.BOTTOM_LEFT_OVERLAY_ICON_PATH).createImage();
}
return this.bottomLeftOverlay;
}
-
+
public Image getBottomMiddleOverlayIcon() {
if (this.bottomMiddleOverlay == null) {
this.bottomMiddleOverlay = createImageDescriptor(ImageProvider.BOTTOM_MIDDLE_OVERLAY_ICON_PATH).createImage();
}
return this.bottomMiddleOverlay;
}
-
+
public Image getBottomRightOverlayIcon() {
if (this.bottomRightOverlay == null) {
this.bottomRightOverlay = createImageDescriptor(ImageProvider.BOTTOM_RIGHT_OVERLAY_ICON_PATH).createImage();
}
return this.bottomRightOverlay;
}
-
+
public Image getCustomizationLabelIcon() {
if (this.customizationLabel == null) {
this.customizationLabel = createImageDescriptor(ImageProvider.LABEL_CUSTOMIZATION).createImage();
}
return this.customizationLabel;
}
-
+
public Image getCustomizationImageIcon() {
if (this.customizationImage == null) {
this.customizationImage = createImageDescriptor(ImageProvider.IMAGE_CUSTOMIZATION).createImage();
}
return this.customizationImage;
}
-
+
public Image getCustomizationColorIcon() {
if (this.rgb == null) {
this.rgb = createImageDescriptor(ImageProvider.RGB_CUSTOMIZATION).createImage();
}
return this.rgb;
}
-
+
public Image getFontNameIcon() {
if (this.fontName == null) {
this.fontName = createImageDescriptor(ImageProvider.FONT_NAME).createImage();
}
return this.fontName;
}
-
+
public Image getFontSizeIcon() {
if (this.fontSize == null) {
this.fontSize = createImageDescriptor(ImageProvider.FONT_SIZE).createImage();
}
return this.fontSize;
}
-
+
public Image getIsBoldIcon() {
if (this.isBold == null) {
this.isBold = createImageDescriptor(ImageProvider.IS_BOLD).createImage();
}
return this.isBold;
}
-
+
public Image getIsItalicIcon() {
if (this.isItalic == null) {
this.isItalic = createImageDescriptor(ImageProvider.IS_ITALIC).createImage();
}
return this.isItalic;
}
-
+
public Image getIsUnderlinedIcon() {
if (this.isUnderlined == null) {
this.isUnderlined = createImageDescriptor(ImageProvider.IS_UNDERLINED).createImage();
}
return this.isUnderlined;
}
-
+
public Image getIsStrukethroughIcon() {
if (this.isStruckthrough == null) {
this.isStruckthrough = createImageDescriptor(ImageProvider.IS_STRUCKTHROUGH).createImage();

Back to the top