diff options
author | Camille Letavernier | 2014-08-21 11:43:07 +0000 |
---|---|---|
committer | Camille Letavernier | 2014-08-21 13:50:25 +0000 |
commit | dbc038b44bcbb890ae256d15eb09eb285512f020 (patch) | |
tree | 757e736583eea3ae352ad9ac91a81df7e59b79ff /plugins/views | |
parent | ea48a20561464c3cbb7895d430583669a9f82fcc (diff) | |
download | org.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/views')
361 files changed, 11944 insertions, 8926 deletions
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/Activator.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/Activator.java index de509f173b0..097fc26768b 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/Activator.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/Activator.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -22,14 +22,14 @@ import org.osgi.framework.BundleContext; */
public class Activator extends AbstractUIPlugin {
- /** The plug-in ID**/
+ /** The plug-in ID **/
public static final String PLUGIN_ID = "org.eclipse.papyrus.views.modelexplorer.newchild"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
/** The log service */
public static LogHelper log;
-
+
/**
* The constructor
*/
@@ -38,8 +38,10 @@ public class Activator extends AbstractUIPlugin { /*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -48,8 +50,10 @@ public class Activator extends AbstractUIPlugin { /*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java index e50b6f5c982..b64bbfb2986 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java @@ -80,14 +80,14 @@ public class DynamicNewChild extends ContributionItem { @Override public void fill(Menu menu, int index) { EObject eObject = getSelection(); - if(eObject != null) { + if (eObject != null) { CreationMenuFactory creationMenuFactory = new CreationMenuFactory(editingDomain); ArrayList<Folder> folders = creationMenuRegistry.getRootFolder(); Iterator<Folder> iterFolder = folders.iterator(); - while(iterFolder.hasNext()) { + while (iterFolder.hasNext()) { Folder currentFolder = iterFolder.next(); boolean hasbeenBuild = creationMenuFactory.populateMenu(menu, currentFolder, eObject, index); - if(hasbeenBuild) { + if (hasbeenBuild) { index++; } } @@ -108,16 +108,16 @@ public class DynamicNewChild extends ContributionItem { ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); ISelection selection = selectionService.getSelection(); - if(selection instanceof IStructuredSelection) { - Object selectedobject = ((IStructuredSelection)selection).getFirstElement(); + if (selection instanceof IStructuredSelection) { + Object selectedobject = ((IStructuredSelection) selection).getFirstElement(); EObject selectedEObject = EMFHelper.getEObject(selectedobject); EObject editingDomainCitizen = selectedEObject; - if((editingDomainCitizen instanceof EReference) && (selection instanceof ITreeSelection)) { + if ((editingDomainCitizen instanceof EReference) && (selection instanceof ITreeSelection)) { // The user selected a reference in the Advanced presentation. Infer the editing domain from the parent node, which is the reference owner - ITreeSelection treeSel = (ITreeSelection)selection; + ITreeSelection treeSel = (ITreeSelection) selection; TreePath[] paths = treeSel.getPathsFor(selectedobject); - if((paths != null) && (paths.length > 0) && (paths[0].getSegmentCount() > 1)) { + if ((paths != null) && (paths.length > 0) && (paths[0].getSegmentCount() > 1)) { editingDomainCitizen = EMFHelper.getEObject(paths[0].getSegment(paths[0].getSegmentCount() - 2)); } } @@ -125,7 +125,7 @@ public class DynamicNewChild extends ContributionItem { try { editingDomain = ServiceUtilsForEObject.getInstance().getService(org.eclipse.emf.transaction.TransactionalEditingDomain.class, editingDomainCitizen); } catch (Exception ex) { - //Nothing to do. We can't handle this case + // Nothing to do. We can't handle this case } return selectedEObject; } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/Activator.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/Activator.java index 67b80675cf6..329408cdcc7 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/Activator.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/Activator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 Atos.
*
- *
+ *
* 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
@@ -60,16 +60,16 @@ public class Activator extends AbstractUIPlugin implements org.eclipse.ui.IStart /**
* get the image descriptor from a string path
- *
+ *
* @param pathString
- * path of the image
+ * path of the image
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String pathString) {
IPath path = new Path(pathString);
URL uri = FileLocator.find(Activator.plugin.getBundle(), path, null);
- if(uri == null) {
+ if (uri == null) {
return null;
}
return ImageDescriptor.createFromURL(uri);
@@ -90,7 +90,7 @@ public class Activator extends AbstractUIPlugin implements org.eclipse.ui.IStart /**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
@@ -98,9 +98,9 @@ public class Activator extends AbstractUIPlugin implements org.eclipse.ui.IStart }
/**
- *
+ *
* @see org.eclipse.ui.IStartup#earlyStartup()
- *
+ *
*/
public void earlyStartup() {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/LoadResourceHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/LoadResourceHandler.java index edf1120a072..f85a0c60d6f 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/LoadResourceHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/LoadResourceHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011, 2014 Atos, CEA, and others.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,7 +39,7 @@ public class LoadResourceHandler extends AbstractCommandHandler { /**
* Get the command to load resource of selected model object
- *
+ *
* @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
* @return the command
*/
@@ -47,19 +47,19 @@ public class LoadResourceHandler extends AbstractCommandHandler { protected Command getCommand() {
TransactionalEditingDomain editingDomain = getEditingDomain();
List<EObject> selection = getSelectedElements();
- if(editingDomain != null && editingDomain.getResourceSet() instanceof ModelSet && selection.size() > 0) {
- final ModelSet set = (ModelSet)editingDomain.getResourceSet();
+ if (editingDomain != null && editingDomain.getResourceSet() instanceof ModelSet && selection.size() > 0) {
+ final ModelSet set = (ModelSet) editingDomain.getResourceSet();
class NonDirtyingCompound extends CompoundCommand implements NonDirtying {
// Empty
}
CompoundCommand command = new NonDirtyingCompound();
List<URI> handledURI = new ArrayList<URI>();
- for(EObject sel : selection) {
- if(sel.eIsProxy()) {
- InternalEObject internal = (InternalEObject)sel;
+ for (EObject sel : selection) {
+ if (sel.eIsProxy()) {
+ InternalEObject internal = (InternalEObject) sel;
URI uriProxy = internal.eProxyURI();
final URI uriTrim = uriProxy.trimFragment().trimFileExtension();
- if(!handledURI.contains(uriTrim)) {
+ if (!handledURI.contains(uriTrim)) {
handledURI.add(uriTrim);
class LoadCommand extends AbstractCommand implements NonDirtying {
@@ -75,7 +75,8 @@ public class LoadResourceHandler extends AbstractCommandHandler { public boolean canExecute() {
return true;
}
- };
+ }
+ ;
command.append(new LoadCommand());
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/Messages.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/Messages.java index 200c2052859..cc07c3db729 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/Messages.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/Messages.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2014 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * + * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.resourceloading.handler; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/UnloadResourceHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/UnloadResourceHandler.java index 4711a7427e8..7c6bcd5e49e 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/UnloadResourceHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.resourceloading/src/org/eclipse/papyrus/views/modelexplorer/resourceloading/handler/UnloadResourceHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011, 2014 Atos, CEA, and others.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -65,8 +65,8 @@ public class UnloadResourceHandler extends AbstractCommandHandler { protected Command getCommand() {
TransactionalEditingDomain editingDomain = getEditingDomain();
List<EObject> selection = getSelectedElements();
- if(editingDomain != null && editingDomain.getResourceSet() instanceof ModelSet && selection.size() > 0) {
- final ModelSet set = (ModelSet)editingDomain.getResourceSet();
+ if (editingDomain != null && editingDomain.getResourceSet() instanceof ModelSet && selection.size() > 0) {
+ final ModelSet set = (ModelSet) editingDomain.getResourceSet();
class NonDirtyingCompound extends CompoundCommand implements NonDirtying {
// Empty
@@ -75,7 +75,7 @@ public class UnloadResourceHandler extends AbstractCommandHandler { final IEditorPart editor = getEditor();
SaveIfNecessaryCommand save = null;
- if(editor.isDirty()) {
+ if (editor.isDirty()) {
// First, a command to save if necessary
save = new SaveIfNecessaryCommand(editor);
command.append(save);
@@ -85,14 +85,14 @@ public class UnloadResourceHandler extends AbstractCommandHandler { // ensure main URI is never unloaded
URI mainURI = SashModelUtils.getSashModel(set).getResourceURI().trimFileExtension();
handledURI.add(mainURI);
- for(EObject sel : selection) {
- if(!sel.eIsProxy()) {
+ for (EObject sel : selection) {
+ if (!sel.eIsProxy()) {
final Resource resource = sel.eResource();
final URI uriTrim = resource.getURI().trimFileExtension();
- if(!handledURI.contains(uriTrim)) {
+ if (!handledURI.contains(uriTrim)) {
handledURI.add(uriTrim);
- if((save != null) && set.shouldSave(resource)) {
+ if ((save != null) && set.shouldSave(resource)) {
save.setNeedsSave(true);
}
@@ -110,7 +110,8 @@ public class UnloadResourceHandler extends AbstractCommandHandler { public boolean canExecute() {
return true;
}
- };
+ }
+ ;
command.append(new UnloadCommand());
}
}
@@ -122,15 +123,15 @@ public class UnloadResourceHandler extends AbstractCommandHandler { /**
* Get currently opened editor
- *
+ *
* @return editor
*/
protected IEditorPart getEditor() {
IEditorPart editor = null;
IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow();
- if(activeWorkbenchWindow != null) {
+ if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if(activePage != null) {
+ if (activePage != null) {
editor = activePage.getActiveEditor();
}
}
@@ -139,12 +140,12 @@ public class UnloadResourceHandler extends AbstractCommandHandler { /**
* Get the active workbench window
- *
+ *
* @return window
*/
protected IWorkbenchWindow getActiveWorkbenchWindow() {
IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null) {
+ if (workbench != null) {
return workbench.getActiveWorkbenchWindow();
}
return null;
@@ -176,8 +177,8 @@ public class UnloadResourceHandler extends AbstractCommandHandler { }
public void execute() {
- if(needsSave()) {
- if(promptToSave()) {
+ if (needsSave()) {
+ if (promptToSave()) {
save();
} else {
// Safely cancel the entire composite
@@ -198,12 +199,12 @@ public class UnloadResourceHandler extends AbstractCommandHandler { boolean promptToSave() {
final Shell parent = editor.getEditorSite().getShell();
final int yesIndex = 0;
- MessageDialog dlg = new MessageDialog(parent, Messages.UnloadResourceHandler_0, null, Messages.UnloadResourceHandler_1, MessageDialog.WARNING, new String[]{ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, yesIndex);
+ MessageDialog dlg = new MessageDialog(parent, Messages.UnloadResourceHandler_0, null, Messages.UnloadResourceHandler_1, MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, yesIndex);
return dlg.open() == yesIndex;
}
void save() {
- IProgressService progress = (IProgressService)editor.getSite().getService(IProgressService.class);
+ IProgressService progress = (IProgressService) editor.getSite().getService(IProgressService.class);
try {
progress.busyCursorWhile(new IRunnableWithProgress() {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/Activator.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/Activator.java index aaf9320bee2..95981479f92 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/Activator.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/Activator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,6 +38,7 @@ public class Activator extends AbstractUIPlugin { /*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
@@ -49,6 +50,7 @@ public class Activator extends AbstractUIPlugin { /*
* (non-Javadoc)
+ *
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/EclassComparator.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/EclassComparator.java index 9d0eb52e520..224b177f105 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/EclassComparator.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/EclassComparator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,25 +18,27 @@ import java.util.Comparator; import org.eclipse.emf.ecore.EClass;
/**
- * comparator EClass by taking in account their names
+ * comparator EClass by taking in account their names
*
*/
-public class EclassComparator implements Comparator<Object>{
+public class EclassComparator implements Comparator<Object> {
/**
- *
+ *
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*
*/
public int compare(Object eclass0, Object eclass1) {
- //it verify if this isan Eclass
- if(eclass0 instanceof EClass && eclass1 instanceof EClass){
- String emp1Name = ((EClass)eclass0).getName();
- String emp2Name = ((EClass)eclass1).getName();
- //uses compareTo method of String class to compare names of the Eclasses
+ // it verify if this isan Eclass
+ if (eclass0 instanceof EClass && eclass1 instanceof EClass) {
+ String emp1Name = ((EClass) eclass0).getName();
+ String emp2Name = ((EClass) eclass1).getName();
+ // uses compareTo method of String class to compare names of the Eclasses
return emp1Name.compareTo(emp2Name);
}
- else{return 0;}
+ else {
+ return 0;
+ }
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassContentProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassContentProvider.java index 6d8f737719d..3dd65341aa6 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassContentProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassContentProvider.java @@ -1,6 +1,6 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,11 +24,11 @@ import org.eclipse.jface.viewers.Viewer; /**
* A Content Provider returning all subclasses of the given
* class, contained in the input EPackage.
- *
+ *
* The metaclassNotWanted are removed from the result.
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class MetaclassContentProvider implements IStructuredContentProvider {
@@ -55,25 +55,25 @@ public class MetaclassContentProvider implements IStructuredContentProvider { }
public Object[] getElements(Object inputElement) {
- if(type == null || !(type instanceof EClass)) {
+ if (type == null || !(type instanceof EClass)) {
return new Object[0];
}
- EClass wantedEClass = (EClass)type;
+ EClass wantedEClass = (EClass) type;
EPackage ePackage;
- if(inputElement instanceof EPackage) {
- ePackage = (EPackage)inputElement;
+ if (inputElement instanceof EPackage) {
+ ePackage = (EPackage) inputElement;
} else {
return new Object[0];
}
List<EClass> result = new LinkedList<EClass>();
- for(EClassifier eClassifier : ePackage.getEClassifiers()) {
- if(eClassifier instanceof EClass) {
- EClass eClass = (EClass)eClassifier;
- if(wantedEClass.isSuperTypeOf(eClass)) {
+ for (EClassifier eClassifier : ePackage.getEClassifiers()) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass) eClassifier;
+ if (wantedEClass.isSuperTypeOf(eClass)) {
result.add(eClass);
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassLabelProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassLabelProvider.java index 573ad5533eb..fa3f7a92bf1 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassLabelProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassLabelProvider.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,20 +17,21 @@ import org.eclipse.emf.ecore.EClass; import org.eclipse.jface.viewers.LabelProvider;
/**
- *this is label provider to display the name of an Eclass
+ * this is label provider to display the name of an Eclass
*
*/
public class MetaclassLabelProvider extends LabelProvider {
/**
- *
+ *
* @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
*
*/
+ @Override
public String getText(Object element) {
- if(element instanceof EClass){
- return ((EClass)element).getName();
+ if (element instanceof EClass) {
+ return ((EClass) element).getName();
}
else {
return super.getText(element);
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassViewerFilter.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassViewerFilter.java index 602e5c8dbde..280752d785b 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassViewerFilter.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetaclassViewerFilter.java @@ -1,6 +1,6 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,11 +20,11 @@ import org.eclipse.papyrus.infra.widgets.providers.AbstractTreeFilter; /**
* A class to retain all elements that are instance of the
* given metaclass.
- *
+ *
* The parent elements of retained elements are also retained.
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class MetaclassViewerFilter extends AbstractTreeFilter {
@@ -37,20 +37,20 @@ public class MetaclassViewerFilter extends AbstractTreeFilter { @Override
public boolean isVisible(Viewer viewer, Object parentElement, Object element) {
- if(metaclass == null || !(metaclass instanceof EClass)) {
+ if (metaclass == null || !(metaclass instanceof EClass)) {
return false;
}
- EClass eClass = (EClass)metaclass;
+ EClass eClass = (EClass) metaclass;
- if(element instanceof IAdaptable) {
- EObject eObject = (EObject)((IAdaptable)element).getAdapter(EObject.class);
- if(eObject != null) {
+ if (element instanceof IAdaptable) {
+ EObject eObject = (EObject) ((IAdaptable) element).getAdapter(EObject.class);
+ if (eObject != null) {
element = eObject;
}
}
- if(element instanceof EObject) {
+ if (element instanceof EObject) {
return eClass.isInstance(element);
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentFilter.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentFilter.java index e8abd3caf4b..aa249a8e32c 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentFilter.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentFilter.java @@ -1,6 +1,6 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@ import org.eclipse.jface.viewers.ViewerFilter; /**
* A class to filter the empty elements, based on the given content provider
- *
+ *
* @author Camille Letavernier
*/
public class MetamodelContentFilter extends ViewerFilter {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentProvider.java index 636761ad771..e4d7a2070b5 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.widgets/src/org/eclipse/papyrus/views/modelexplorer/widgets/MetamodelContentProvider.java @@ -1,6 +1,6 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,26 +26,26 @@ import org.eclipse.jface.viewers.Viewer; /**
* A content provider returning all metamodels used by
* the input element's resourceSet.
- *
+ *
* May be expensive on big models.
- *
+ *
* @author Camille Letavernier
*/
public class MetamodelContentProvider implements IStructuredContentProvider {
public void dispose() {
- //Nothing
+ // Nothing
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- //Nothing
+ // Nothing
}
public Object[] getElements(Object inputElement) {
EObject input;
- if(inputElement instanceof EObject) {
- input = (EObject)inputElement;
+ if (inputElement instanceof EObject) {
+ input = (EObject) inputElement;
} else {
return new Object[0];
}
@@ -55,9 +55,9 @@ public class MetamodelContentProvider implements IStructuredContentProvider { Set<EPackage> reachablePackages = new HashSet<EPackage>();
- for(Resource resource : resourceSet.getResources()) {
+ for (Resource resource : resourceSet.getResources()) {
Iterator<EObject> iterator = resource.getAllContents();
- while(iterator.hasNext()) {
+ while (iterator.hasNext()) {
EObject eObject = iterator.next();
reachablePackages.add(eObject.eClass().getEPackage());
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java index 7f115e62678..d7dc1cb0c83 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Activator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -67,16 +67,16 @@ public class Activator extends AbstractUIPlugin { /**
* get the image descriptor from a string path
- *
+ *
* @param pathString
- * path of the image
+ * path of the image
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String pathString) {
IPath path = new Path(pathString);
URL uri = FileLocator.find(Activator.plugin.getBundle(), path, null);
- if(uri == null) {
+ if (uri == null) {
return null;
}
return ImageDescriptor.createFromURL(uri);
@@ -97,7 +97,7 @@ public class Activator extends AbstractUIPlugin { /**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
@@ -105,7 +105,7 @@ public class Activator extends AbstractUIPlugin { }
/**
- *
+ *
* @return the customization manager in charge to adapt element in modisco
*/
public ICustomizationManager getCustomizationManager() {
@@ -115,93 +115,93 @@ public class Activator extends AbstractUIPlugin { private void init(final ICustomizationManager customizationManager) {
// the appearance can be customized here:
-// customizationManager.setShowDerivedLinks(true);
-//
-// try {
-//
-// // load customizations defined as default through the customization
-// // extension
-// List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
-// for(MetamodelView metamodelView : registryDefaultCustomizations) {
-// customizationManager.registerCustomization(metamodelView);
-// }
-// customizationManager.loadCustomizations();
-// loadFacetsForCustomizations(registryDefaultCustomizations, customizationManager);
-//
-// } catch (Throwable e) {
-// Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
-// }
+ // customizationManager.setShowDerivedLinks(true);
+ //
+ // try {
+ //
+ // // load customizations defined as default through the customization
+ // // extension
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ // for(MetamodelView metamodelView : registryDefaultCustomizations) {
+ // customizationManager.registerCustomization(metamodelView);
+ // }
+ // customizationManager.loadCustomizations();
+ // loadFacetsForCustomizations(registryDefaultCustomizations, customizationManager);
+ //
+ // } catch (Throwable e) {
+ // Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ // }
}
-// /**
-// * load the facets
-// *
-// * @param customizations
-// * list of customization
-// * @param customizationManager
-// * the Customization Manager
-// */
-// protected void loadFacetsForCustomizations(final List<MetamodelView> customizations, final CustomizationManager customizationManager) {
-// final Set<Facet> referencedFacets = new HashSet<Facet>();
-// final Collection<FacetSet> facetSets = FacetSetCatalog.getSingleton().getAllFacetSets();
-//
-// for(MetamodelView customization : customizations) {
-// String metamodelURI = customization.getMetamodelURI();
-// // find customized FacetSet
-// FacetSet customizedFacetSet = null;
-// if(metamodelURI != null) {
-// for(FacetSet facetSet : facetSets) {
-// if(metamodelURI.equals(facetSet.getNsURI())) {
-// customizedFacetSet = facetSet;
-// break;
-// }
-// }
-// }
-// if(customizedFacetSet == null) {
-// continue;
-// }
-//
-// // find customized Facets
-// EList<TypeView> types = customization.getTypes();
-// for(TypeView typeView : types) {
-// String metaclassName = typeView.getMetaclassName();
-// Facet facet = findFacetWithFullyQualifiedName(metaclassName, customizedFacetSet);
-// if(facet != null) {
-// referencedFacets.add(facet);
-// } else {
-// Activator.log.warn(NLS.bind(Messages.BrowserActionBarContributor_missingRequiredFacet, new Object[]{ metaclassName, customizedFacetSet.getName(), customization.getName() }));
-// }
-// }
-//
-// for(Facet referencedFacet : referencedFacets) {
-// customizationManager.loadFacet(referencedFacet);
-// }
-// }
-//
-// //
-// // for modified facets
-// // customizationManager.getInstancesForMetaclasses().buildDerivationTree();
-// // customizationManager.getAppearanceConfiguration().touch();
-// // customizationManager.refreshDelayed(true);
-// }
-
-// /**
-// * fin a facet from
-// *
-// * @param metaclassName
-// * @param customizedFacetSet
-// * @return
-// */
-// private Facet findFacetWithFullyQualifiedName(final String metaclassName, final FacetSet customizedFacetSet) {
-// EList<Facet> facets = customizedFacetSet.getFacets();
-// for(Facet facet : facets) {
-// String facetName = getMetaclassQualifiedName(facet);
-// if(metaclassName.equals(facetName)) {
-// return facet;
-// }
-// }
-// return null;
-// }
+ // /**
+ // * load the facets
+ // *
+ // * @param customizations
+ // * list of customization
+ // * @param customizationManager
+ // * the Customization Manager
+ // */
+ // protected void loadFacetsForCustomizations(final List<MetamodelView> customizations, final CustomizationManager customizationManager) {
+ // final Set<Facet> referencedFacets = new HashSet<Facet>();
+ // final Collection<FacetSet> facetSets = FacetSetCatalog.getSingleton().getAllFacetSets();
+ //
+ // for(MetamodelView customization : customizations) {
+ // String metamodelURI = customization.getMetamodelURI();
+ // // find customized FacetSet
+ // FacetSet customizedFacetSet = null;
+ // if(metamodelURI != null) {
+ // for(FacetSet facetSet : facetSets) {
+ // if(metamodelURI.equals(facetSet.getNsURI())) {
+ // customizedFacetSet = facetSet;
+ // break;
+ // }
+ // }
+ // }
+ // if(customizedFacetSet == null) {
+ // continue;
+ // }
+ //
+ // // find customized Facets
+ // EList<TypeView> types = customization.getTypes();
+ // for(TypeView typeView : types) {
+ // String metaclassName = typeView.getMetaclassName();
+ // Facet facet = findFacetWithFullyQualifiedName(metaclassName, customizedFacetSet);
+ // if(facet != null) {
+ // referencedFacets.add(facet);
+ // } else {
+ // Activator.log.warn(NLS.bind(Messages.BrowserActionBarContributor_missingRequiredFacet, new Object[]{ metaclassName, customizedFacetSet.getName(), customization.getName() }));
+ // }
+ // }
+ //
+ // for(Facet referencedFacet : referencedFacets) {
+ // customizationManager.loadFacet(referencedFacet);
+ // }
+ // }
+ //
+ // //
+ // // for modified facets
+ // // customizationManager.getInstancesForMetaclasses().buildDerivationTree();
+ // // customizationManager.getAppearanceConfiguration().touch();
+ // // customizationManager.refreshDelayed(true);
+ // }
+
+ // /**
+ // * fin a facet from
+ // *
+ // * @param metaclassName
+ // * @param customizedFacetSet
+ // * @return
+ // */
+ // private Facet findFacetWithFullyQualifiedName(final String metaclassName, final FacetSet customizedFacetSet) {
+ // EList<Facet> facets = customizedFacetSet.getFacets();
+ // for(Facet facet : facets) {
+ // String facetName = getMetaclassQualifiedName(facet);
+ // if(metaclassName.equals(facetName)) {
+ // return facet;
+ // }
+ // }
+ // return null;
+ // }
/** @return the qualified name of the given metaclass */
public static String getMetaclassQualifiedName(final EClassifier eClass) {
@@ -209,12 +209,12 @@ public class Activator extends AbstractUIPlugin { final StringBuilder builder = new StringBuilder();
EPackage ePackage = eClass.getEPackage();
- while(ePackage != null) {
+ while (ePackage != null) {
qualifiedNameParts.add(ePackage.getName());
ePackage = ePackage.getESuperPackage();
}
- for(int i = qualifiedNameParts.size() - 1; i >= 0; i--) {
+ for (int i = qualifiedNameParts.size() - 1; i >= 0; i--) {
builder.append(qualifiedNameParts.get(i) + "."); //$NON-NLS-1$
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CommandContext.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CommandContext.java index 862a6e2758a..bec68f800d2 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CommandContext.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CommandContext.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CustomCommonViewer.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CustomCommonViewer.java index bc498882a6c..ab3ae281bed 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CustomCommonViewer.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/CustomCommonViewer.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,47 +34,48 @@ import org.eclipse.ui.internal.navigator.dnd.NavigatorDnDService; import org.eclipse.ui.navigator.CommonDragAdapter;
import org.eclipse.ui.navigator.CommonDropAdapter;
import org.eclipse.ui.navigator.CommonViewer;
+
/**
- * this class was created in order to access to the drop adapter
+ * this class was created in order to access to the drop adapter
*
*/
@SuppressWarnings("restriction")
public class CustomCommonViewer extends CommonViewer {
- protected CommonDropAdapter dropAdapter;
-
+ protected CommonDropAdapter dropAdapter;
+
public CustomCommonViewer(String aViewerId, Composite aParent, int aStyle) {
super(aViewerId, aParent, aStyle);
// TODO Auto-generated constructor stub
setComparer(new IElementComparer() {
public int hashCode(Object element) {
- if(element instanceof EObjectTreeElement) {
- EObject eObject = ((EObjectTreeElement)element).getEObject();
+ if (element instanceof EObjectTreeElement) {
+ EObject eObject = ((EObjectTreeElement) element).getEObject();
return HashCodeCalculus.getHashCode(eObject);
}
-
- if(element instanceof EReferenceTreeElement) {
- EObject eParent=((EReferenceTreeElement) element).getParent().getEObject();
- EReference eref=((EReferenceTreeElement) element).getEReference();
+
+ if (element instanceof EReferenceTreeElement) {
+ EObject eParent = ((EReferenceTreeElement) element).getParent().getEObject();
+ EReference eref = ((EReferenceTreeElement) element).getEReference();
return HashCodeCalculus.getHashCode(eParent, eref);
}
- if(element instanceof IReferencable) {
- IReferencable ref = (IReferencable)element;
+ if (element instanceof IReferencable) {
+ IReferencable ref = (IReferencable) element;
return ref.getElementBehind().hashCode();
}
- if(element instanceof IMatchingItem) {
- IMatchingItem matchItem = (IMatchingItem)element;
+ if (element instanceof IMatchingItem) {
+ IMatchingItem matchItem = (IMatchingItem) element;
return matchItem.matchingItemHashcode();
}
return element.hashCode();
}
public boolean equals(Object a, Object b) {
- if(a instanceof IMatchingItem) {
- return ((IMatchingItem)a).matchingItemEquals(b);
+ if (a instanceof IMatchingItem) {
+ return ((IMatchingItem) a).matchingItemEquals(b);
}
- if(b != null) {
+ if (b != null) {
return b.equals(a);
}
return false;
@@ -85,6 +86,7 @@ public class CustomCommonViewer extends CommonViewer { /**
* {@inheritDoc}
*/
+ @Override
protected void initDragAndDrop() {
dropAdapter = null;
int operations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
@@ -94,13 +96,13 @@ public class CustomCommonViewer extends CommonViewer { dropAdapter = createDropAdapter();
addDropSupport(operations, dropAdapter.getSupportedDropTransfers(), dropAdapter);
- NavigatorDnDService dnd = (NavigatorDnDService)getNavigatorContentService().getDnDService();
+ NavigatorDnDService dnd = (NavigatorDnDService) getNavigatorContentService().getDnDService();
dnd.setDropAdaptor(dropAdapter);
}
/**
* get the listener in order to parameterize during the runtime the drop
- *
+ *
* @return the dropadapter
*/
public CommonDropAdapter getDropAdapter() {
@@ -115,13 +117,13 @@ public class CustomCommonViewer extends CommonViewer { // instantiate abstract focus cell high-lighter as dummy object for focus manager. The sub class
// FocusCellOwnerDrawHighlighter would break multi-selections in Papyrus, see bug 419591.
// (but we need to create a high-lighter, since the focus cell manager does not accept null pointer. The
- // TreeViewerEditor could work without focusCellManager, but would ignore keyboard events in this case.)
+ // TreeViewerEditor could work without focusCellManager, but would ignore keyboard events in this case.)
FocusCellHighlighter fch = new FocusCellHighlighter(this) {
};
TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(
- this, fch);
-
- TreeViewerEditor.create(this, focusCellManager, new ColumnViewerEditorActivationStrategy(this){
+ this, fch);
+
+ TreeViewerEditor.create(this, focusCellManager, new ColumnViewerEditorActivationStrategy(this) {
@Override
protected boolean isEditorActivationEvent(
ColumnViewerEditorActivationEvent event) {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java index 86137eb1abe..abaa4f18aea 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DecoratingLabelProviderWTooltips.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010, 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@ * Contributors:
* Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - don't rely on IMarker changes to refresh Model Explorer labels (CDO)
- *
+ *
* History:
* Renamed from MoDiscoLabelProviderWTooltips - fix for bug 371905
*
@@ -57,7 +57,7 @@ public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelPr @Override
public void dispose() {
try {
- if(decorationService != null) {
+ if (decorationService != null) {
decorationService.deleteListener(this);
}
} finally {
@@ -66,16 +66,16 @@ public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelPr }
public void update(Observable o, Object arg) {
- if((decorationService != null) && (o == decorationService)) {
-
+ if ((decorationService != null) && (o == decorationService)) {
+
// fix for bug 409381 - [Validation] Performance issues. Make updates asynchronously so that
// most updates are ignored.
// TODO: check whether the decoration service should offer a service for listeners that want to
- // be notified in this lazy way.
+ // be notified in this lazy way.
if (!asyncUpdateRunning) {
asyncUpdateRunning = true;
- Display.getDefault().asyncExec(new Runnable () {
+ Display.getDefault().asyncExec(new Runnable() {
public void run() {
fireLabelProviderChanged(new LabelProviderChangedEvent(DecoratingLabelProviderWTooltips.this));
while (updatePending) {
@@ -83,7 +83,7 @@ public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelPr fireLabelProviderChanged(new LabelProviderChangedEvent(DecoratingLabelProviderWTooltips.this));
}
asyncUpdateRunning = false;
-
+
}
});
}
@@ -91,12 +91,12 @@ public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelPr updatePending = true;
}
}
-
+
}
@Override
public String getToolTipText(Object element) {
- if(decorationService == null) {
+ if (decorationService == null) {
return null;
}
@@ -107,25 +107,25 @@ public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelPr public Image getImage(Object element) {
Image baseImage = super.getImage(element);
- if(decorationService == null) {
+ if (decorationService == null) {
return baseImage;
}
// Get the Model Explorer Adapter
ModelExplorerDecorationAdapter adapter = new ModelExplorerDecorationAdapter(baseImage);
- //Set the adapter decoration with position as indicated by decoration (from decoration service)
- if(element != null) {
- if(element instanceof EObject || element instanceof EReferenceTreeElement // fix for bug 391676
- || (EMFHelper.getEObject(element) != null)) {
+ // Set the adapter decoration with position as indicated by decoration (from decoration service)
+ if (element != null) {
+ if (element instanceof EObject || element instanceof EReferenceTreeElement // fix for bug 391676
+ || (EMFHelper.getEObject(element) != null)) {
List<IPapyrusDecoration> decorations = decorationService.getDecorations(EMFHelper.getEObject(element), true);
- if(decorations != null) {
+ if (decorations != null) {
adapter.setDecorations(decorations);
}
}
}
- //return the target decorated
+ // return the target decorated
return adapter.getDecoratedImage();
}
@@ -143,9 +143,9 @@ public class DecoratingLabelProviderWTooltips extends NavigatorDecoratingLabelPr public int getToolTipTimeDisplayed(Object object) {
return 10000;
}
-
+
protected boolean asyncUpdateRunning;
-
+
protected boolean updatePending;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java index 61581ca5d52..2e696e21b86 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/DirectEditorEditingSupport.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * Andreas Muelder - Initial contribution and API * *****************************************************************************/ @@ -81,21 +81,25 @@ public class DirectEditorEditingSupport extends EditingSupport { /** * Obtain direct editor configuration for an element that can be adapted to * an EObject - * @param element an adaptable element + * + * @param element + * an adaptable element * @return The direct editor configuration, if it exists. */ public static ICustomDirectEditorConfiguration getConfigurationAE(Object element) { - EObject semanticObject = EMFHelper.getEObject(element); - return getConfiguration(semanticObject); + EObject semanticObject = EMFHelper.getEObject(element); + return getConfiguration(semanticObject); } - + /** * Obtain direct editor configuration for a semantic element - * @param element a sementic element + * + * @param element + * a sementic element * @return The direct editor configuration, if it exists. */ public static ICustomDirectEditorConfiguration getConfiguration(EObject semanticElement) { - + IPreferenceStore store = Activator.getDefault() .getPreferenceStore(); String semanticClassName = semanticElement.eClass() @@ -106,7 +110,7 @@ public class DirectEditorEditingSupport extends EditingSupport { if (languagePreferred != null && !languagePreferred.equals("")) { //$NON-NLS-1$ IDirectEditorConfiguration configuration = DirectEditorsUtil - .findEditorConfiguration(languagePreferred, semanticClassName); + .findEditorConfiguration(languagePreferred, semanticClassName); if (configuration instanceof ICustomDirectEditorConfiguration) { return (ICustomDirectEditorConfiguration) configuration; } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandContext.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandContext.java index 11608f8fa08..782ac48adf6 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandContext.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandContext.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -23,14 +23,14 @@ public interface ICommandContext { /**
* Get the container of the created element.
- *
+ *
* @return the container.
*/
public EObject getContainer();
/**
* Get the reference the created element relates.
- *
+ *
* @return the EReference.
*/
public EReference getReference();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandFilter.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandFilter.java index f7994db1986..38bb620d88d 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandFilter.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ICommandFilter.java @@ -7,7 +7,7 @@ * http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
@@ -24,7 +24,7 @@ public interface ICommandFilter { /**
* Get the list of element type for which the creation command is visible.
- *
+ *
* @return the list of allowed element types.
*/
public List<IElementType> getVisibleCommands();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ITooltip.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ITooltip.java index 3dde4d492b9..87e7e23d7b3 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ITooltip.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ITooltip.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2014 CEA LIST. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,16 +16,15 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; /** - * Interface containing operations from {@Link org.eclipse.jface.viewers.CellLabelProvider} - * It's a design fault that no interface has been defined by jface in the first place. - * + * Interface containing operations from {@Link org.eclipse.jface.viewers.CellLabelProvider} It's a design fault that no interface has been defined by jface in the first place. + * * @author ansgar * */ public interface ITooltip { /** * @see CellLabelProvider - * + * * @param object * the element for which the tool tip is shown * @return {@link Image} or <code>null</code> if there is not image. @@ -35,8 +34,8 @@ public interface ITooltip { /** * @see CellLabelProvider - * - * + * + * * @param element * the element for which the tool tip is shown * @return the {@link String} or <code>null</code> if there is not text to @@ -50,17 +49,17 @@ public interface ITooltip { * below your mouse cursor. Be aware of the fact that you should at least * position the tool tip 1px right to your mouse cursor else click events * may not get propagated properly. - * + * * @param object * the element for which the tool tip is shown * @return {@link Point} to shift of the tool tip or <code>null</code> if the * default shift should be used. */ public Point getToolTipShift(Object object); - + /** * The time in milliseconds the tool tip is shown for. - * + * * @param object * the {@link Object} for which the tool tip is shown * @return time in milliseconds the tool tip is shown for @@ -69,7 +68,7 @@ public interface ITooltip { /** * The time in milliseconds until the tool tip is displayed. - * + * * @param object * the {@link Object} for which the tool tip is shown * @return time in milliseconds until the tool tip is displayed diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java index 5d08aa44c3e..7725e29c554 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkHelper.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2010 CEA LIST. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -34,77 +34,77 @@ import org.eclipse.ui.navigator.ILinkHelper; /** * This class is to link form the model explorer to diagram * This code was to not put in the model explorer in order to avoid dependences with gmf in the more abstract explorer - * + * */ public class LinkHelper implements ILinkHelper { /** - * + * * @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput) - * + * */ public IStructuredSelection findSelection(IEditorInput anInput) { return null; } /** - * + * * @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection) - * + * */ public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) { - //no selection - if(aSelection == null || aSelection.isEmpty()) { + // no selection + if (aSelection == null || aSelection.isEmpty()) { return; } ISelectionService selectService = aPage.getWorkbenchWindow().getSelectionService(); ISelection selection = selectService.getSelection(); - //test if the selection come the tree viewer in order to avoid cycle: Diagram -> tree-> diagram + // test if the selection come the tree viewer in order to avoid cycle: Diagram -> tree-> diagram // if the diagram has been selected the selection is not a TreeSelection - if(selection instanceof ITreeSelection) { + if (selection instanceof ITreeSelection) { try { ISashWindowsContainer windowsContainer = ServiceUtilsForWorkbenchPage.getInstance().getISashWindowsContainer(aPage); Iterator<IEditorPart> iterPart = windowsContainer.getVisibleIEditorParts().iterator(); - while(iterPart.hasNext()) { + while (iterPart.hasNext()) { IEditorPart diagramEditor = iterPart.next(); - if(diagramEditor instanceof IRevealSemanticElement) { - if(aSelection instanceof IStructuredSelection) { + if (diagramEditor instanceof IRevealSemanticElement) { + if (aSelection instanceof IStructuredSelection) { Iterator<?> selectionIterator = aSelection.iterator(); ArrayList<Object> semanticElementList = new ArrayList<Object>(); - while(selectionIterator.hasNext()) { + while (selectionIterator.hasNext()) { Object currentSelection = selectionIterator.next(); Object semanticElement = EMFHelper.getEObject(currentSelection); - if(semanticElement != null) { + if (semanticElement != null) { semanticElementList.add(semanticElement); } } - ((IRevealSemanticElement)diagramEditor).revealSemanticElement(semanticElementList); + ((IRevealSemanticElement) diagramEditor).revealSemanticElement(semanticElementList); } } - if(diagramEditor instanceof NavigationTarget) { - if(aSelection instanceof IStructuredSelection) { + if (diagramEditor instanceof NavigationTarget) { + if (aSelection instanceof IStructuredSelection) { Iterator<?> selectionIterator = aSelection.iterator(); ArrayList<Object> semanticElementList = new ArrayList<Object>(); - while(selectionIterator.hasNext()) { + while (selectionIterator.hasNext()) { Object currentSelection = selectionIterator.next(); Object semanticElement = EMFHelper.getEObject(currentSelection); - if(semanticElement != null) { + if (semanticElement != null) { semanticElementList.add(semanticElement); } } - ((NavigationTarget)diagramEditor).revealElement(semanticElementList); + ((NavigationTarget) diagramEditor).revealElement(semanticElementList); } } } } catch (ServiceException ex) { - //We cannot access the service registry. The PapyrusEditor is probably closed. + // We cannot access the service registry. The PapyrusEditor is probably closed. } catch (Exception ex) { Activator.log.error("Impossible to acces to windows Container", ex); //$NON-NLS-1$ } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNode.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNode.java index 8359c1c5263..bff6f3a17c6 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNode.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNode.java @@ -1,18 +1,18 @@ /***********************************************************************************************************************
* Copyright (c) 2011 Atos.
- *
+ *
* 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: Philippe ROLAND (Atos) - initial API and implementation
- *
+ *
**********************************************************************************************************************/
package org.eclipse.papyrus.views.modelexplorer;
/**
* Empty Interface. Used by ModelExplorer to refer to any object referencing TreeItems
- *
+ *
* @author proland
*/
public interface LinkNode {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNodeAdapterFactory.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNodeAdapterFactory.java index 61adfe4c3db..c0edaa5fc2d 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNodeAdapterFactory.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/LinkNodeAdapterFactory.java @@ -1,12 +1,12 @@ /***********************************************************************************************************************
* Copyright (c) 2011 Atos.
- *
+ *
* 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: Philippe ROLAND (Atos) - initial API and implementation
- *
+ *
**********************************************************************************************************************/
package org.eclipse.papyrus.views.modelexplorer;
@@ -16,15 +16,15 @@ import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy. /**
* This factory returns a LinkNode instance for any adapter instancing LinkItem or EReference
- *
+ *
* @author proland
- *
+ *
*/
public class LinkNodeAdapterFactory implements IAdapterFactory {
public Object getAdapter(Object adaptableObject, Class adapterType) {
- if(adapterType == LinkNode.class) {
- if(adaptableObject instanceof EReferenceTreeElement || adaptableObject instanceof EReference) {
+ if (adapterType == LinkNode.class) {
+ if (adaptableObject instanceof EReferenceTreeElement || adaptableObject instanceof EReference) {
return LinkNode.LinkNodeInstance;
}
}
@@ -32,7 +32,7 @@ public class LinkNodeAdapterFactory implements IAdapterFactory { }
public Class[] getAdapterList() {
- return new Class[]{};
+ return new Class[] {};
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java index fa1672ca6c1..a43ad3f6266 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/Messages.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2014 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java index 1b4818fbcbd..d1498dd1e64 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPage.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010, 2014 LIFL, CEA LIST, and others.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,17 +25,17 @@ import org.eclipse.ui.IWorkbenchPart; /**
* Page handling the {@link ModelExplorerView} for the {@link ModelExplorerPageBookView}
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class ModelExplorerPage extends ViewPartPage {
private SharedModelExplorerState state;
-
+
/**
* Constructor.
- *
+ *
* @param part
*/
public ModelExplorerPage() {
@@ -43,24 +43,24 @@ public class ModelExplorerPage extends ViewPartPage { /**
* Create the Viewer for the requested part
- *
+ *
* @param part
- * The part to associate to the Viewer.
+ * The part to associate to the Viewer.
* @return
*/
@Override
protected IViewPart createViewer(IWorkbenchPart part) {
// Part is of the right type because of call to isImportant()
- ModelExplorerView result = new ModelExplorerView((IMultiDiagramEditor)part);
+ ModelExplorerView result = new ModelExplorerView((IMultiDiagramEditor) part);
result.setSharedState(state);
return result;
}
/**
* Create control of the inner view
- *
+ *
* @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
- *
+ *
* @param parent
*/
@Override
@@ -70,14 +70,14 @@ public class ModelExplorerPage extends ViewPartPage { /**
* Return the control
- *
+ *
* @see org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.ViewPartPage#getControl()
- *
+ *
* @return
*/
@Override
public Control getControl() {
- return ((ModelExplorerView)getViewer()).getControl();
+ return ((ModelExplorerView) getViewer()).getControl();
}
void setSharedState(SharedModelExplorerState state) {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPageBookView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPageBookView.java index dc0aed2e5bd..a38698ecded 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPageBookView.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerPageBookView.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010, 2014 LIFL, CEA LIST, and others.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,9 +40,9 @@ import com.google.common.collect.Lists; /**
* A Page Book containing one {@link ModelExplorerView} for each opened Papyrus Editor.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class ModelExplorerPageBookView extends MultiViewPageBookView implements IGotoMarker, ITabbedPropertySheetPageContributor {
@@ -55,7 +55,7 @@ public class ModelExplorerPageBookView extends MultiViewPageBookView implements public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
- if(memento != null) {
+ if (memento != null) {
state.load(memento);
}
}
@@ -84,19 +84,19 @@ public class ModelExplorerPageBookView extends MultiViewPageBookView implements @Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- if(IPropertySheetPage.class == adapter) {
+ if (IPropertySheetPage.class == adapter) {
// Do not test if tabbedPropertySheetPage is null before calling new
// this is managed by Eclipse which only call current method when necessary
return new TabbedPropertySheetPage(this);
}
- if(adapter == ITreeViewerSorting.class) {
+ if (adapter == ITreeViewerSorting.class) {
return new DefaultTreeViewerSorting() {
@Override
public void setSorted(boolean sorted) {
// Update the shared state
- if(state != null) {
+ if (state != null) {
state.setAlphaSorted(sorted);
}
}
@@ -124,15 +124,15 @@ public class ModelExplorerPageBookView extends MultiViewPageBookView implements */
public void gotoMarker(IMarker marker) {
String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
- if(uriAttribute != null) {
+ if (uriAttribute != null) {
URI uri = URI.createURI(uriAttribute);
IViewPart viewPart = getActiveView();
- if(viewPart instanceof ModelExplorerView) {
- ModelExplorerView modelExplorerView = (ModelExplorerView)viewPart;
+ if (viewPart instanceof ModelExplorerView) {
+ ModelExplorerView modelExplorerView = (ModelExplorerView) viewPart;
EditingDomain domain = modelExplorerView.getEditingDomain();
EObject eObject = domain.getResourceSet().getEObject(uri, false);
- if(eObject != null) {
- CommonViewer treeViewer = ((ModelExplorerView)viewPart).getCommonViewer();
+ if (eObject != null) {
+ CommonViewer treeViewer = ((ModelExplorerView) viewPart).getCommonViewer();
// The common viewer is in fact a tree viewer
// bug enhancement: use function in ModelExplorerView instead of findElementForEObject
ModelExplorerView.reveal(Lists.newArrayList(eObject), treeViewer);
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java index e81398f494a..bc79306e06c 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerTreeViewerContext.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2010, 2014 CEA and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - adapted from ModelExplorerView::reveal(...) API - * + * */ package org.eclipse.papyrus.views.modelexplorer; @@ -43,26 +43,28 @@ class ModelExplorerTreeViewerContext extends EMFTreeViewerContext { super(viewer); } + @Override public Object deresolveSelectableElement(Object selectableElement) { return EMFHelper.getEObject(selectableElement); } + @Override public Object resolveSelectableElement(Object object) { - return new ModelElementItemMatchingItemWithElement((EObject)object); + return new ModelElementItemMatchingItemWithElement((EObject) object); } @Override protected void setExpandedElements(AbstractTreeViewer viewer, Collection<?> toExpand) { // EMF Facet makes expanding tree elements very complicated - if(viewer.getContentProvider() != null) { - for(ModelElementItemMatchingItemWithElement next : Iterables.filter(toExpand, ModelElementItemMatchingItemWithElement.class)) { + if (viewer.getContentProvider() != null) { + for (ModelElementItemMatchingItemWithElement next : Iterables.filter(toExpand, ModelElementItemMatchingItemWithElement.class)) { // retrieve the ancestors to reveal them // and allow the selection of the object EObject currentEObject = next.element(); ArrayList<EObject> parents = new ArrayList<EObject>(); EObject tmp = currentEObject.eContainer(); - while(tmp != null) { + while (tmp != null) { parents.add(tmp); tmp = tmp.eContainer(); } @@ -71,16 +73,16 @@ class ModelExplorerTreeViewerContext extends EMFTreeViewerContext { // reveal the resource if necessary Resource r = null; - if(!parents.isEmpty()) { + if (!parents.isEmpty()) { r = parents.get(parents.size() - 1).eResource(); } else { r = currentEObject.eResource(); } - if(r != null) { + if (r != null) { final ResourceSet rs = r.getResourceSet(); final Resource resource = r; - if(rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet)rs, r.getURI())) { + if (rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet) rs, r.getURI())) { viewer.expandToLevel(new ReferencableMatchingItem(rs), 1); viewer.expandToLevel(new ReferencableMatchingItem(resource), 1); } @@ -99,8 +101,8 @@ class ModelExplorerTreeViewerContext extends EMFTreeViewerContext { * Please refer to MatchingItem for more infos. */ EObject previousParent = null; - for(EObject parent : reverseParents) { - if(parent.eContainingFeature() != null && previousParent != null) { + for (EObject parent : reverseParents) { + if (parent.eContainingFeature() != null && previousParent != null) { viewer.expandToLevel(new LinkItemMatchingItem(previousParent, parent.eContainmentFeature()), 1); } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java index 2fc9fd248e0..29cc38799bd 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/ModelExplorerView.java @@ -210,11 +210,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * Constructor.
*
* @param part
- * The part associated to this ModelExplorer
+ * The part associated to this ModelExplorer
*/
public ModelExplorerView(IMultiDiagramEditor part) {
- if(part == null) {
+ if (part == null) {
throw new IllegalArgumentException("A part should be provided.");
}
@@ -239,7 +239,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti initCommonViewer(getCommonViewer());
// Restore expansion and selection state of the common viewer
- ((TreeViewerContext<?>)event.getContext()).restore(getCommonViewer());
+ ((TreeViewerContext<?>) event.getContext()).restore(getCommonViewer());
}
});
}
@@ -247,7 +247,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private void init(IMultiDiagramEditor editor) {
// Try to get the ServicesRegistry
serviceRegistry = editor.getServicesRegistry();
- if(serviceRegistry == null) {
+ if (serviceRegistry == null) {
throw new IllegalArgumentException("The editor should have a ServiceRegistry.");
}
@@ -268,15 +268,15 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti */
private void handleSelectionChangedFromDiagramEditor(IWorkbenchPart part, ISelection selection) {
// Handle selection from diagram editor
- if(isLinkingEnabled()) {
- if(part instanceof IEditorPart) {
- if(selection instanceof IStructuredSelection) {
- Iterator<?> selectionIterator = ((IStructuredSelection)selection).iterator();
+ if (isLinkingEnabled()) {
+ if (part instanceof IEditorPart) {
+ if (selection instanceof IStructuredSelection) {
+ Iterator<?> selectionIterator = ((IStructuredSelection) selection).iterator();
ArrayList<Object> semanticElementList = new ArrayList<Object>();
- while(selectionIterator.hasNext()) {
+ while (selectionIterator.hasNext()) {
Object currentSelection = selectionIterator.next();
Object semanticElement = EMFHelper.getEObject(currentSelection);
- if(semanticElement != null) {
+ if (semanticElement != null) {
semanticElementList.add(semanticElement);
}
@@ -288,14 +288,14 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
// Selections from the Model Explorer result in a part from the ModelExplorerPageBookView instance which is not an IEditorPart
- if(part instanceof ModelExplorerPageBookView && !selection.isEmpty()) {
- if(selection instanceof IStructuredSelection) {
+ if (part instanceof ModelExplorerPageBookView && !selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection) {
// Extracted from org.eclipse.ui.internal.navigator.actions.LinkEditorAction activateEditorJob
- // the problem was that multi-element selections were disabled as only selections of 1 could clear the condition size()==1
- IStructuredSelection sSelection = (IStructuredSelection)selection;
+ // the problem was that multi-element selections were disabled as only selections of 1 could clear the condition size()==1
+ IStructuredSelection sSelection = (IStructuredSelection) selection;
LinkHelperService linkService = getLinkHelperService();
ILinkHelper[] helpers = linkService.getLinkHelpersFor(sSelection.getFirstElement()); // LinkHelper in org.eclipse.papyrus.views.modelexplorer
- if(helpers.length > 0) {
+ if (helpers.length > 0) {
helpers[0].activateEditor(part.getSite().getPage(), sSelection);
}
}
@@ -307,16 +307,16 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * look for the path the list of element (comes from the content provider) to go the eObject
*
* @param eobject
- * that we look for.
+ * that we look for.
* @param objects
- * a list of elements where eobject can be wrapped.
+ * a list of elements where eobject can be wrapped.
* @return the list of modelElementItem ( from the root to the element that wrap the eobject)
*/
protected List<Object> searchPath(EObject eobject, List<Object> objects) {
SemanticFromModelExplorer semanticGetter = new SemanticFromModelExplorer();
List<Object> path = new ArrayList<Object>();
- ITreeContentProvider contentProvider = (ITreeContentProvider)getCommonViewer().getContentProvider();
- // IPageMngr iPageMngr = EditorUtils.getIPageMngr();
+ ITreeContentProvider contentProvider = (ITreeContentProvider) getCommonViewer().getContentProvider();
+ // IPageMngr iPageMngr = EditorUtils.getIPageMngr();
IPageManager iPageMngr;
try {
iPageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
@@ -328,24 +328,24 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti List<Object> editors = Arrays.asList(result);
- for(Object o : objects) {
+ for (Object o : objects) {
// Search matches in this level
- if(!editors.contains(o)) {
- if(eobject.equals(EMFHelper.getEObject(o))) {
+ if (!editors.contains(o)) {
+ if (eobject.equals(EMFHelper.getEObject(o))) {
path.add(o);
return path;
}
}
// Find childs only for feature container
- for(int i = 0; i < contentProvider.getChildren(o).length; i++) {
+ for (int i = 0; i < contentProvider.getChildren(o).length; i++) {
Object treeItem = contentProvider.getChildren(o)[i];
List<Object> tmppath = new ArrayList<Object>();
Object element = semanticGetter.getSemanticElement(treeItem);
- if(element != null) {
- if(element instanceof EReference) {
- if(((EReference)element).isContainment() && (!((EReference)element).isDerived())) {
+ if (element != null) {
+ if (element instanceof EReference) {
+ if (((EReference) element).isContainment() && (!((EReference) element).isDerived())) {
List<Object> childs = new ArrayList<Object>();
childs.add(treeItem);
tmppath = searchPath(eobject, childs);
@@ -353,7 +353,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
else {
- if(element instanceof EObject) {
+ if (element instanceof EObject) {
List<Object> childs = new ArrayList<Object>();
childs.add(treeItem);
tmppath = searchPath(eobject, childs);
@@ -362,8 +362,8 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
// if tmppath contains the wrapped eobject we have find the good path
- if(tmppath.size() > 0) {
- if(eobject.equals((EMFHelper.getEObject((tmppath.get(tmppath.size() - 1)))))) {
+ if (tmppath.size() > 0) {
+ if (eobject.equals((EMFHelper.getEObject((tmppath.get(tmppath.size() - 1)))))) {
path.add(o);
path.addAll(tmppath);
return path;
@@ -400,19 +400,19 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private void installEMFFacetTreePainter(Tree tree) {
// Install the EMFFacet Custom Tree Painter
- //org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager().installCustomPainter(tree);
+ // org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager().installCustomPainter(tree);
// The EMF Facet MeasureItem Listener is incompatible with the NavigatorDecoratingLabelProvider. Remove it.
// Symptoms: ModelElementItems with an EMF Facet Overlay have a small selection size
// Removal also fixes bug 400012: no scrollbar although tree is larger than visible area
Collection<Listener> listenersToRemove = new LinkedList<Listener>();
- for(Listener listener : tree.getListeners(SWT.MeasureItem)) {
- if(listener.getClass().getName().contains("org.eclipse.papyrus.emf.facet.infra.browser.uicore.internal.CustomTreePainter")) {
+ for (Listener listener : tree.getListeners(SWT.MeasureItem)) {
+ if (listener.getClass().getName().contains("org.eclipse.papyrus.emf.facet.infra.browser.uicore.internal.CustomTreePainter")) {
listenersToRemove.add(listener);
}
}
- for(Listener listener : listenersToRemove) {
+ for (Listener listener : listenersToRemove) {
tree.removeListener(SWT.MeasureItem, listener);
}
}
@@ -428,22 +428,22 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti // function of the input)
Object input = getInitialInput();
Set<Object> descriptors = contentService.findDescriptorsByTriggerPoint(input, false);
- for(Object descriptor : descriptors) {
- if(descriptor instanceof NavigatorContentDescriptor) {
+ for (Object descriptor : descriptors) {
+ if (descriptor instanceof NavigatorContentDescriptor) {
ILabelProvider labelProvider = null;
- if(input instanceof ServicesRegistry) {
- ServicesRegistry registry = (ServicesRegistry)input;
+ if (input instanceof ServicesRegistry) {
+ ServicesRegistry registry = (ServicesRegistry) input;
try {
labelProvider = registry.getService(LabelProviderService.class).getLabelProvider(LABEL_PROVIDER_SERVICE_CONTEXT);
} catch (ServiceException ex) {
Activator.log.error(ex);
}
- labelProvider = new DecoratingLabelProviderWTooltips(labelProvider, (ServicesRegistry)input);
+ labelProvider = new DecoratingLabelProviderWTooltips(labelProvider, (ServicesRegistry) input);
}
- if(labelProvider == null) {
+ if (labelProvider == null) {
labelProvider = new LabelProvider();
}
@@ -459,7 +459,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti super.createPartControl(aParent);
getCommonViewer().setSorter(null);
- ((CustomCommonViewer)getCommonViewer()).getDropAdapter().setFeedbackEnabled(true);
+ ((CustomCommonViewer) getCommonViewer()).getDropAdapter().setFeedbackEnabled(true);
getCommonViewer().addDoubleClickListener(new DoubleClickListener(serviceRegistry));
Tree tree = getCommonViewer().getTree();
@@ -467,19 +467,19 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti tree.addKeyListener(new KeyListener() {
public void keyReleased(KeyEvent e) {
- if(e.keyCode == SWT.ALT) {
+ if (e.keyCode == SWT.ALT) {
exitItem();
}
}
public void keyPressed(KeyEvent e) {
- if(e.keyCode != SWT.ALT) {
+ if (e.keyCode != SWT.ALT) {
return;
}
Tree tree = getCommonViewer().getTree();
- //Generate a basic mouse event
+ // Generate a basic mouse event
Event event = new Event();
event.widget = tree;
event.stateMask = SWT.ALT;
@@ -490,7 +490,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti event.y = tree.getDisplay().getCursorLocation().y - absoluteTreeLocation.y;
MouseEvent mouseEvent = new MouseEvent(event);
- if(isEnterState(mouseEvent)) {
+ if (isEnterState(mouseEvent)) {
enterItem(currentItem);
}
}
@@ -500,20 +500,20 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti @Override
public void mouseUp(MouseEvent e) {
- if((e.stateMask & SWT.ALT) == 0) {
+ if ((e.stateMask & SWT.ALT) == 0) {
return;
}
TreeItem currentItem = getTreeItem(e);
- if(currentItem != null) {
+ if (currentItem != null) {
Object data = currentItem.getData();
try {
NavigationService service = serviceRegistry.getService(NavigationService.class);
List<NavigableElement> navigableElements = service.getNavigableElements(data);
- //TODO: Implement a priority on NavigableElements and navigate the element with the highest priority
- for(NavigableElement navigableElement : navigableElements) {
- if(navigableElement.isEnabled()) {
+ // TODO: Implement a priority on NavigableElements and navigate the element with the highest priority
+ for (NavigableElement navigableElement : navigableElements) {
+ if (navigableElement.isEnabled()) {
service.navigate(navigableElement);
}
}
@@ -528,11 +528,11 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti public void mouseMove(MouseEvent e) {
- if(isExitState(e)) {
+ if (isExitState(e)) {
exitItem();
}
- if(isEnterState(e)) {
+ if (isEnterState(e)) {
enterItem(currentItem);
}
@@ -545,10 +545,10 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti ISashWindowsContainer sashWindowsContainer = serviceRegistry.getService(ISashWindowsContainer.class);
sashWindowsContainer.addPageLifeCycleListener(this);
} catch (ServiceException ex) {
- //Ignore
+ // Ignore
}
- if(sharedState != null) {
+ if (sharedState != null) {
initSharedState(sharedState);
}
}
@@ -556,7 +556,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti @Override
protected CommonViewer createCommonViewer(Composite aParent) {
CommonViewer viewer = super.createCommonViewer(aParent);
- ViewerColumn column = (ViewerColumn)viewer.getTree().getData(Policy.JFACE + ".columnViewer");
+ ViewerColumn column = (ViewerColumn) viewer.getTree().getData(Policy.JFACE + ".columnViewer");
column.setEditingSupport(new DirectEditorEditingSupport(viewer));
return viewer;
}
@@ -567,20 +567,20 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti SelectionMenu selectionMenu;
private boolean isExitState(MouseEvent e) {
- if(currentItem == null) {
+ if (currentItem == null) {
return false;
}
TreeItem item = getTreeItem(e);
- if(item == null) {
+ if (item == null) {
return true;
}
- if(item != currentItem) {
+ if (item != currentItem) {
return true;
}
- if((e.stateMask & SWT.ALT) == 0) {
+ if ((e.stateMask & SWT.ALT) == 0) {
return true;
}
@@ -589,15 +589,15 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private boolean isEnterState(MouseEvent e) {
TreeItem item = getTreeItem(e);
- if(item == currentItem) {
+ if (item == currentItem) {
return false;
}
- if(item == null) {
+ if (item == null) {
return false;
}
- if((e.stateMask & SWT.ALT) == 0) {
+ if ((e.stateMask & SWT.ALT) == 0) {
return false;
}
@@ -607,7 +607,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
private void disposeCurrentMenu() {
- if(selectionMenu != null) {
+ if (selectionMenu != null) {
selectionMenu.dispose();
selectionMenu = null;
}
@@ -623,21 +623,21 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti final NavigationService navigation = serviceRegistry.getService(NavigationService.class);
disposeCurrentMenu();
selectionMenu = navigation.createNavigationList(item.getData(), item.getParent());
- if(selectionMenu == null) {
+ if (selectionMenu == null) {
return;
}
selectionMenu.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- if(event.getSelection().isEmpty()) {
+ if (event.getSelection().isEmpty()) {
return;
}
- Object selectedElement = ((IStructuredSelection)event.getSelection()).getFirstElement();
- if(selectedElement instanceof NavigableElement) {
- NavigableElement navigableElement = (NavigableElement)selectedElement;
- if(navigableElement.isEnabled()) {
- navigation.navigate((NavigableElement)selectedElement);
+ Object selectedElement = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (selectedElement instanceof NavigableElement) {
+ NavigableElement navigableElement = (NavigableElement) selectedElement;
+ if (navigableElement.isEnabled()) {
+ navigation.navigate((NavigableElement) selectedElement);
exitItem();
}
}
@@ -649,7 +649,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
private TreeItem getTreeItem(MouseEvent e) {
- return ((Tree)e.widget).getItem(new Point(e.x, e.y));
+ return ((Tree) e.widget).getItem(new Point(e.x, e.y));
}
@@ -677,7 +677,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propId) {
- switch(propId) {
+ switch (propId) {
case IS_LINKING_ENABLED_PROPERTY:
// Propagate to other instances
sharedState.setLinkingEnabled(isLinkingEnabled());
@@ -726,7 +726,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti private void handleResourceSetChanged(ResourceSetChangeEvent event) {
// avoid refreshing N times for the same transaction (called for each object in resource)
Transaction curTrans = event.getTransaction();
- if(lastTrans != null && lastTrans.equals(curTrans)) {
+ if (lastTrans != null && lastTrans.equals(curTrans)) {
return;
}
lastTrans = curTrans;
@@ -741,7 +741,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * Schedule a runnable which will refresh the view if necessary
*/
protected void scheduleRefresh() {
- synchronized(this) {
+ synchronized (this) {
needsRefresh = true;
}
@@ -751,8 +751,8 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * {@inheritDoc}
*/
public void run() {
- synchronized(ModelExplorerView.this) {
- if(!needsRefresh) {
+ synchronized (ModelExplorerView.this) {
+ if (!needsRefresh) {
return;
}
needsRefresh = false;
@@ -780,14 +780,14 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti protected void refreshInUIThread() {
// Need to refresh, even if (temporarily) invisible
// (Better alternative?: store refresh event and execute once visible again)
- if(getControl().isDisposed()) {
+ if (getControl().isDisposed()) {
return;
}
// avoid reentrant call
// Refresh only of we are not already refreshing.
- if(isRefreshing.compareAndSet(false, true)) {
- if(!getCommonViewer().isBusy()) {
+ if (isRefreshing.compareAndSet(false, true)) {
+ if (!getCommonViewer().isBusy()) {
getCommonViewer().refresh();
}
@@ -801,7 +801,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti @Override
protected Object getInitialInput() {
- if(serviceRegistry != null) {
+ if (serviceRegistry != null) {
return serviceRegistry;
} else {
return super.getInitialInput();
@@ -817,12 +817,12 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti this.editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
// Set Viewer input if it already exist
- if(getCommonViewer() != null) {
+ if (getCommonViewer() != null) {
getCommonViewer().setInput(serviceRegistry);
}
editingDomain.addResourceSetListener(resourceSetListener);
IReadOnlyHandler2 readOnlyHandler = AdapterUtils.adapt(editingDomain, IReadOnlyHandler2.class, null);
- if(readOnlyHandler != null) {
+ if (readOnlyHandler != null) {
readOnlyHandler.addReadOnlyListener(createReadOnlyListener());
}
} catch (ServiceException e) {
@@ -832,7 +832,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti // Listen to isDirty flag
saveAndDirtyService.addInputChangedListener(editorInputChangedListener);
- if(this.getCommonViewer() != null) {
+ if (this.getCommonViewer() != null) {
syncRefresh();
}
}
@@ -842,17 +842,17 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti */
private void deactivate() {
// deactivate global handler
- if(Activator.log.isDebugEnabled()) {
+ if (Activator.log.isDebugEnabled()) {
Activator.log.debug("deactivate ModelExplorerView"); //$NON-NLS-1$
}
try {
ISashWindowsContainer sashWindowsContainer = serviceRegistry.getService(ISashWindowsContainer.class);
- if(sashWindowsContainer != null) {
+ if (sashWindowsContainer != null) {
sashWindowsContainer.removePageLifeCycleListener(this);
}
} catch (ServiceException ex) {
- //Ignore
+ // Ignore
}
// Stop listening on change events
@@ -860,7 +860,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti // Stop Listening to isDirty flag
saveAndDirtyService.removeInputChangedListener(editorInputChangedListener);
- if(editingDomain != null) {
+ if (editingDomain != null) {
editingDomain.removeResourceSetListener(resourceSetListener);
editingDomain = null;
}
@@ -879,21 +879,21 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti public void dispose() {
// Stop if we are already disposed
- if(isDisposed()) {
+ if (isDisposed()) {
return;
}
- if((sharedStateListener != null) && (sharedState != null)) {
+ if ((sharedStateListener != null) && (sharedState != null)) {
sharedState.removeListener(sharedStateListener);
}
- if(getSite() != null) {
+ if (getSite() != null) {
getSite().getPage().removeSelectionListener(pageSelectionListener);
}
deactivate();
- for(IPropertySheetPage propertySheetPage : this.propertySheetPages) {
+ for (IPropertySheetPage propertySheetPage : this.propertySheetPages) {
propertySheetPage.dispose();
}
@@ -926,9 +926,9 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti try {
final IMultiDiagramEditor multiDiagramEditor = ServiceUtils.getInstance().getService(IMultiDiagramEditor.class, serviceRegistry);
- if(multiDiagramEditor != null) {
- if(multiDiagramEditor instanceof ITabbedPropertySheetPageContributor) {
- ITabbedPropertySheetPageContributor contributor = (ITabbedPropertySheetPageContributor)multiDiagramEditor;
+ if (multiDiagramEditor != null) {
+ if (multiDiagramEditor instanceof ITabbedPropertySheetPageContributor) {
+ ITabbedPropertySheetPageContributor contributor = (ITabbedPropertySheetPageContributor) multiDiagramEditor;
IPropertySheetPage propertySheetPage = new TabbedPropertySheetPage(contributor);
this.propertySheetPages.add(propertySheetPage);
return propertySheetPage;
@@ -946,16 +946,16 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti @Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
- if(IPropertySheetPage.class.equals(adapter)) {
+ if (IPropertySheetPage.class.equals(adapter)) {
return getPropertySheetPage();
}
- if(IUndoContext.class == adapter) {
+ if (IUndoContext.class == adapter) {
// Return the IUndoContext of associated model.
return undoContext;
}
- if(ISaveablePart.class.equals(adapter)) {
+ if (ISaveablePart.class.equals(adapter)) {
try {
return serviceRegistry.getService(IMultiDiagramEditor.class);
} catch (ServiceException ex) {
@@ -964,7 +964,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti return saveAndDirtyService;
}
- if(ServicesRegistry.class == adapter) {
+ if (ServicesRegistry.class == adapter) {
return serviceRegistry;
}
@@ -986,15 +986,15 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti @Override
public void selectReveal(ISelection selection) {
syncRefresh();
- if(getCommonViewer() != null) {
+ if (getCommonViewer() != null) {
getCommonViewer().setSelection(selection, true);
}
}
public void revealSemanticElement(List<?> elementList) {
- //Ensure that the ModelExplorer is refreshed before
- //trying to display an element. Useful if the element has just been created,
- //and the model explorer has not yet been refreshed
+ // Ensure that the ModelExplorer is refreshed before
+ // trying to display an element. Useful if the element has just been created,
+ // and the model explorer has not yet been refreshed
syncRefresh();
reveal(elementList, getCommonViewer());
}
@@ -1003,25 +1003,25 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * Expands the given CommonViewer to reveal the given elements
*
* @param elementList
- * The elements to reveal
+ * The elements to reveal
* @param commonViewer
- * The CommonViewer they are to be revealed in
+ * The CommonViewer they are to be revealed in
*/
public static void reveal(Iterable<?> elementList, final CommonViewer commonViewer) {
ArrayList<IMatchingItem> matchingItemsToSelect = new ArrayList<IMatchingItem>();
// filter out non EMF objects
Iterable<EObject> list = Iterables.filter(elementList, EObject.class);
- for(EObject currentEObject : list) {
+ for (EObject currentEObject : list) {
matchingItemsToSelect.add(new ModelElementItemMatchingItem(currentEObject));
// the content provider exist?
- if(commonViewer.getContentProvider() != null) {
+ if (commonViewer.getContentProvider() != null) {
// retrieve the ancestors to reveal them
// and allow the selection of the object
ArrayList<EObject> parents = new ArrayList<EObject>();
EObject tmp = currentEObject.eContainer();
- while(tmp != null) {
+ while (tmp != null) {
parents.add(tmp);
tmp = tmp.eContainer();
}
@@ -1030,16 +1030,16 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti // reveal the resource if necessary
Resource r = null;
- if(!parents.isEmpty()) {
+ if (!parents.isEmpty()) {
r = parents.get(parents.size() - 1).eResource();
} else {
r = currentEObject.eResource();
}
- if(r != null) {
+ if (r != null) {
final ResourceSet rs = r.getResourceSet();
final Resource resource = r;
- if(rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet)rs, r.getURI())) {
+ if (rs instanceof ModelSet && AdditionalResourcesModel.isAdditionalResource((ModelSet) rs, r.getURI())) {
commonViewer.getControl().getDisplay().syncExec(new Runnable() {
public void run() {
@@ -1064,8 +1064,8 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * Please refer to MatchingItem for more infos.
*/
EObject previousParent = null;
- for(EObject parent : reverseParents) {
- if(parent.eContainingFeature() != null && previousParent != null) {
+ for (EObject parent : reverseParents) {
+ if (parent.eContainingFeature() != null && previousParent != null) {
commonViewer.expandToLevel(new LinkItemMatchingItem(previousParent, parent.eContainmentFeature()), 1);
}
@@ -1099,9 +1099,9 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * Selects the given ISelection in the given CommonViwer
*
* @param structuredSelection
- * The ISelection to select
+ * The ISelection to select
* @param commonViewer
- * The ComonViewer to select it in
+ * The ComonViewer to select it in
*/
public static void selectReveal(final ISelection structuredSelection, final Viewer commonViewer) {
Display.getDefault().syncExec(new Runnable() {
@@ -1116,13 +1116,13 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti * Selects and, if possible, reveals the given ISelection in the given CommonViwer
*
* @param selection
- * The ISelection to select
+ * The ISelection to select
* @param viewer
- * The ComonViewer to select it in
+ * The ComonViewer to select it in
*/
public static void reveal(final ISelection selection, final CommonViewer viewer) {
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection)selection;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structured = (IStructuredSelection) selection;
reveal(Lists.newArrayList(structured.iterator()), viewer);
} else {
viewer.getControl().getDisplay().syncExec(new Runnable() {
@@ -1147,43 +1147,43 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti public void run() {
getCommonViewer().refresh(true);
- //Force redraw to refresh facet overlay
+ // Force redraw to refresh facet overlay
getCommonViewer().getTree().redraw();
}
});
}
public void pageChanged(IPage newPage) {
- //Nothing
+ // Nothing
}
public void pageActivated(IPage page) {
- //Nothing
+ // Nothing
}
public void pageDeactivated(IPage page) {
- //Nothing
+ // Nothing
}
public void pageAboutToBeOpened(IPage page) {
- //Nothing
+ // Nothing
}
public void pageAboutToBeClosed(IPage page) {
- //Nothing
+ // Nothing
}
private IReadOnlyListener createReadOnlyListener() {
return new IReadOnlyListener() {
public void readOnlyStateChanged(ReadOnlyEvent event) {
- switch(event.getEventType()) {
+ switch (event.getEventType()) {
case ReadOnlyEvent.RESOURCE_READ_ONLY_STATE_CHANGED:
scheduleRefresh();
break;
case ReadOnlyEvent.OBJECT_READ_ONLY_STATE_CHANGED:
CommonViewer viewer = getCommonViewer();
- if((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
+ if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
viewer.refresh(event.getObject());
}
break;
@@ -1196,13 +1196,13 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
void setSharedState(SharedModelExplorerState state) {
- if(this.sharedState != null) {
+ if (this.sharedState != null) {
this.sharedState.removeListener(getSharedStateListener());
}
this.sharedState = state;
- if(state != null) {
+ if (state != null) {
state.addListener(getSharedStateListener());
initSharedState(state);
}
@@ -1215,29 +1215,29 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti void setAlphaSorted(boolean sorted) {
CommonViewer viewer = getCommonViewer();
- if((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
- if(sorted) {
+ if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
+ if (sorted) {
viewer.setSorter(new CommonViewerSorter());
- if(viewer instanceof CustomCommonViewer) {
- ((CustomCommonViewer)viewer).getDropAdapter().setFeedbackEnabled(false);
+ if (viewer instanceof CustomCommonViewer) {
+ ((CustomCommonViewer) viewer).getDropAdapter().setFeedbackEnabled(false);
}
} else {
viewer.setSorter(null);
- if(viewer instanceof CustomCommonViewer) {
- ((CustomCommonViewer)viewer).getDropAdapter().setFeedbackEnabled(true);
+ if (viewer instanceof CustomCommonViewer) {
+ ((CustomCommonViewer) viewer).getDropAdapter().setFeedbackEnabled(true);
}
}
}
}
SharedModelExplorerState.StateChangedListener getSharedStateListener() {
- if(sharedStateListener == null) {
+ if (sharedStateListener == null) {
sharedStateListener = new SharedModelExplorerState.StateChangedListener() {
private volatile Runnable contentUpdate;
public void sharedStateChanged(StateChangedEvent event) {
- switch(event.getEventType()) {
+ switch (event.getEventType()) {
case StateChangedEvent.LINKING_ENABLED:
setLinkingEnabled(event.getSource().isLinkingEnabled());
break;
@@ -1245,7 +1245,7 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti setAlphaSorted(event.getSource().isAlphaSorted());
break;
case StateChangedEvent.CONTENT_EXTENSIONS:
- if(contentUpdate == null) {
+ if (contentUpdate == null) {
getCommonViewer().getControl().getDisplay().asyncExec(getContentUpdate());
}
break;
@@ -1253,12 +1253,12 @@ public class ModelExplorerView extends CommonNavigator implements IRevealSemanti }
private Runnable getContentUpdate() {
- if(contentUpdate == null) {
+ if (contentUpdate == null) {
contentUpdate = new Runnable() {
public void run() {
CommonViewer viewer = getCommonViewer();
- if((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
+ if ((viewer != null) && (viewer.getControl() != null) && !viewer.getControl().isDisposed()) {
viewer.getNavigatorContentService().getActivationService().activateExtensions(sharedState.getNavigatorContentExtensions(), true);
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/NavigatorUtils.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/NavigatorUtils.java index 5684871cdbb..b63b4abf38b 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/NavigatorUtils.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/NavigatorUtils.java @@ -68,12 +68,12 @@ public class NavigatorUtils { * Gets the roots of the notations resources related to the given object * * @param element - * The object from which to retrieve the notation resources + * The object from which to retrieve the notation resources * @return An iterator of notation resources' roots, or <code>null</code> if none cannot be resolved */ public static Iterator<EObject> getNotationRoots(EObject element) { Iterator<Resource> notations = getResources(element, NotationModel.NOTATION_FILE_EXTENSION); - if(notations == null) { + if (notations == null) { return null; } return new RootsIterator(notations); @@ -81,7 +81,7 @@ public class NavigatorUtils { public static Iterator<EObject> getDiRoots(EObject element) { Iterator<Resource> diResources = getResources(element, DiModel.DI_FILE_EXTENSION); - if(diResources == null) { + if (diResources == null) { return null; } return new RootsIterator(diResources); @@ -100,23 +100,23 @@ public class NavigatorUtils { public RootsIterator(Iterator<Resource> resources) { this.resources = resources; - if(resources.hasNext()) { + if (resources.hasNext()) { inner = resources.next().getContents().iterator(); } } public boolean hasNext() { - if(inner == null) { + if (inner == null) { return false; } - if(inner.hasNext()) { + if (inner.hasNext()) { return true; } - while(resources.hasNext()) { + while (resources.hasNext()) { inner = resources.next().getContents().iterator(); - if(inner.hasNext()) { + if (inner.hasNext()) { return true; } } @@ -126,17 +126,17 @@ public class NavigatorUtils { } public EObject next() { - if(inner == null) { + if (inner == null) { return null; } - if(inner.hasNext()) { + if (inner.hasNext()) { return inner.next(); } - while(resources.hasNext()) { + while (resources.hasNext()) { inner = resources.next().getContents().iterator(); - if(inner.hasNext()) { + if (inner.hasNext()) { return inner.next(); } } @@ -155,17 +155,17 @@ public class NavigatorUtils { * Gets the notation resources related to the given object * * @param element - * The object from which to retrieve the notation resources + * The object from which to retrieve the notation resources * @return An iterator of notation resources, or <code>null</code> if none cannot be resolved */ public static Iterator<Resource> getResources(EObject element, String fileExtension) { Iterator<Resource> result = tryGetResources(element, fileExtension); - if(result != null) { + if (result != null) { return result; } IAdaptable input = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getInput(); - if(input != null) { + if (input != null) { EObject obj = EMFHelper.getEObject(input); return tryGetResources(obj, fileExtension); } @@ -178,17 +178,17 @@ public class NavigatorUtils { * Tries to get the notation resources related to the given object * * @param element - * The object from which to retrieve the notation resources + * The object from which to retrieve the notation resources * @return An iterator of notation resources, or <code>null</code> if none cannot be resolved */ private static Iterator<Resource> tryGetResources(EObject element, String fileExtension) { - if(element == null) { + if (element == null) { return null; } - if(element.eResource() == null) { + if (element.eResource() == null) { return null; } - if(element.eResource().getResourceSet() == null) { + if (element.eResource().getResourceSet() == null) { return null; } return new ResourcesIterator(element.eResource().getResourceSet(), fileExtension); @@ -214,10 +214,10 @@ public class NavigatorUtils { } private Resource getNextResource() { - while(inner.hasNext()) { + while (inner.hasNext()) { Resource resource = inner.next(); - if(fileExtension.equalsIgnoreCase(resource.getURI().fileExtension())) { + if (fileExtension.equalsIgnoreCase(resource.getURI().fileExtension())) { return resource; } @@ -245,7 +245,7 @@ public class NavigatorUtils { * Find a <IViewPart> by it's id string. * * @param viewID - * the view id + * the view id * * @return the i view part */ @@ -255,18 +255,18 @@ public class NavigatorUtils { public void run() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - if(page == null) { + if (page == null) { setResult(null); return; } IViewReference reference = page.findViewReference(viewID); - if(reference == null) { + if (reference == null) { setResult(null); return; } IWorkbenchPart part = reference.getPart(false); - if(part instanceof IViewPart) { - setResult((IViewPart)part); + if (part instanceof IViewPart) { + setResult((IViewPart) part); return; } else { setResult(null); @@ -283,35 +283,35 @@ public class NavigatorUtils { * <EObject>s * * @param selection - * the selection + * the selection * * @return the i selection */ public static ISelection unwrapSelection(ISelection selection) { - if(selection instanceof StructuredSelection && !selection.isEmpty()) { + if (selection instanceof StructuredSelection && !selection.isEmpty()) { List<EObject> selectionList = new ArrayList<EObject>(); - StructuredSelection structuredSelection = (StructuredSelection)selection; - for(Iterator<?> iterator = structuredSelection.iterator(); iterator.hasNext();) { + StructuredSelection structuredSelection = (StructuredSelection) selection; + for (Iterator<?> iterator = structuredSelection.iterator(); iterator.hasNext();) { Object next = iterator.next(); - if(next instanceof EditPart) { - Object model = ((EditPart)next).getModel(); + if (next instanceof EditPart) { + Object model = ((EditPart) next).getModel(); EObject element = null; - if(model instanceof View) { - element = ((View)model).getElement(); - } else if(model instanceof EObject) { - element = (EObject)model; + if (model instanceof View) { + element = ((View) model).getElement(); + } else if (model instanceof EObject) { + element = (EObject) model; } - if(element != null) { + if (element != null) { selectionList.add(element); } - } else if(next instanceof View) { - EObject element = ((View)next).getElement(); - if(element != null) { + } else if (next instanceof View) { + EObject element = ((View) next).getElement(); + if (element != null) { selectionList.add(element); } } EObject eObject = EMFHelper.getEObject(next); - if(eObject != null) { + if (eObject != null) { selectionList.add(eObject); } } @@ -325,36 +325,36 @@ public class NavigatorUtils { * Finds the <EditPart>s for the <EObject>s in the selection. * * @param selection - * the selection + * the selection * @param viewer - * the viewer + * the viewer * * @return the edits the parts from selection */ public static List<EditPart> getEditPartsFromSelection(ISelection selection, IDiagramGraphicalViewer viewer) { - if(selection instanceof StructuredSelection && !selection.isEmpty()) { - StructuredSelection structuredSelection = (StructuredSelection)selection; + if (selection instanceof StructuredSelection && !selection.isEmpty()) { + StructuredSelection structuredSelection = (StructuredSelection) selection; // look for Views of the EObjects in the selection List<View> views = new ArrayList<View>(); - for(Object o : structuredSelection.toList()) { - if(o instanceof EObject) { - List<Object> referencerViews = getEObjectViews((EObject)o); - for(Object ro : referencerViews) { - if(ro instanceof View) { - views.add((View)ro); + for (Object o : structuredSelection.toList()) { + if (o instanceof EObject) { + List<Object> referencerViews = getEObjectViews((EObject) o); + for (Object ro : referencerViews) { + if (ro instanceof View) { + views.add((View) ro); } } } } - if(!views.isEmpty()) { + if (!views.isEmpty()) { List<EditPart> editParts = new ArrayList<EditPart>(); - for(View view : views) { + for (View view : views) { Object ep = viewer.getEditPartRegistry().get(view); - if(ep instanceof EditPart) { - editParts.add((EditPart)ep); + if (ep instanceof EditPart) { + editParts.add((EditPart) ep); } } - if(!editParts.isEmpty()) { + if (!editParts.isEmpty()) { return editParts; } } @@ -366,14 +366,14 @@ public class NavigatorUtils { * Gets the given <EObject> views. * * @param element - * the element + * the element * * @return the e object views */ // @unused public static List<Object> getEObjectViews(EObject element) { List<Object> views = new ArrayList<Object>(); - if(element != null) { + if (element != null) { EReference[] features = { NotationPackage.eINSTANCE.getView_Element() }; Collection<?> referencers = EMFCoreUtil.getReferencers(element, features); views.addAll(referencers); @@ -381,67 +381,67 @@ public class NavigatorUtils { return views; } - // // // - // // get an object name - // // // + // // // + // // get an object name + // // // // - // /** - // * Gets the object name or empty string. - // * - // * @param object - // * the object - // * - // * @return the object name or empty string - // */ - // // @unused - // public static String getObjectNameOrEmptyString(Object object) { - // String name = getObjectName(object); - // return name == null ? "" : name; - // } + // /** + // * Gets the object name or empty string. + // * + // * @param object + // * the object + // * + // * @return the object name or empty string + // */ + // // @unused + // public static String getObjectNameOrEmptyString(Object object) { + // String name = getObjectName(object); + // return name == null ? "" : name; + // } // - // /** The Constant getNameNames. */ - // private static final String[] getNameNames = { "getName", "getname" }; + // /** The Constant getNameNames. */ + // private static final String[] getNameNames = { "getName", "getname" }; // - // /** - // * Gets the object name. - // * - // * @param object - // * the object - // * - // * @return the object name - // */ - // // @unused - // public static String getObjectName(Object object) { - // if (object == null) { - // return null; - // } - // Method method = null; - // Object o = null; - // for (String methodName : getNameNames) { - // try { - // method = object.getClass() - // .getMethod(methodName, (Class[]) null); - // } catch (NoSuchMethodException e) { - // method = null; - // } - // if (method != null) { - // break; - // } - // } - // if (method != null) { - // try { - // o = method.invoke(object, (Object[]) null); - // } catch (IllegalAccessException ex) { - // return null; - // } catch (InvocationTargetException ex) { - // return null; - // } - // if (o instanceof String) { - // return (String) o; - // } - // } - // return null; - // } + // /** + // * Gets the object name. + // * + // * @param object + // * the object + // * + // * @return the object name + // */ + // // @unused + // public static String getObjectName(Object object) { + // if (object == null) { + // return null; + // } + // Method method = null; + // Object o = null; + // for (String methodName : getNameNames) { + // try { + // method = object.getClass() + // .getMethod(methodName, (Class[]) null); + // } catch (NoSuchMethodException e) { + // method = null; + // } + // if (method != null) { + // break; + // } + // } + // if (method != null) { + // try { + // o = method.invoke(object, (Object[]) null); + // } catch (IllegalAccessException ex) { + // return null; + // } catch (InvocationTargetException ex) { + // return null; + // } + // if (o instanceof String) { + // return (String) o; + // } + // } + // return null; + // } /** @@ -451,7 +451,7 @@ public class NavigatorUtils { */ // @unused public static void openViewPart(String viewPartID) { - if(viewPartID == null) { + if (viewPartID == null) { return; } try { @@ -484,15 +484,15 @@ public class NavigatorUtils { @SuppressWarnings("unchecked") public static <T> T getElement(Object o, Class<T> theClass) { T result = null; - if(o instanceof IAdaptable) { - IAdaptable adaptable = (IAdaptable)o; - result = (T)adaptable.getAdapter(theClass); + if (o instanceof IAdaptable) { + IAdaptable adaptable = (IAdaptable) o; + result = (T) adaptable.getAdapter(theClass); } - if(result == null) { - result = (T)Platform.getAdapterManager().getAdapter(o, theClass); + if (result == null) { + result = (T) Platform.getAdapterManager().getAdapter(o, theClass); } - if(result == null && theClass.isInstance(o)) { - result = (T)o; + if (result == null && theClass.isInstance(o)) { + result = (T) o; } return result; } @@ -509,20 +509,20 @@ public class NavigatorUtils { * from the Notation metamodel (Excluding the underlying semantic model. * * @param referencedElement - * The referenced element + * The referenced element * @param type - * The type of the element which may contain references to the "referencedElement" + * The type of the element which may contain references to the "referencedElement" * @param searchAllContents - * If false, the research will be restricted to the root elements of the same EPackage as "type" + * If false, the research will be restricted to the root elements of the same EPackage as "type" * @param predicate - * The predicate used to determine whether an object of type "type" has a reference to the "referencedElement" + * The predicate used to determine whether an object of type "type" has a reference to the "referencedElement" * * * @return * True if at least one object matches the predicate and targets the referencedElement */ public static boolean any(EObject referencedElement, final EClass type, final boolean searchAllContents, Predicate<EObject> predicate) { - if(referencedElement == null || referencedElement.eResource() == null || referencedElement.eResource().getResourceSet() == null) { + if (referencedElement == null || referencedElement.eResource() == null || referencedElement.eResource().getResourceSet() == null) { return false; } @@ -535,20 +535,20 @@ public class NavigatorUtils { } }, predicate); - for(final Resource resource : resourceSet.getResources()) { + for (final Resource resource : resourceSet.getResources()) { Iterable<EObject> iterable = new Iterable<EObject>() { public Iterator<EObject> iterator() { Iterator<EObject> allContentsIterator; - if(searchAllContents) { + if (searchAllContents) { allContentsIterator = resource.getAllContents(); } else { Collection<EObject> contentsToBrowse = new LinkedList<EObject>(); - for(EObject rootElement : resource.getContents()) { - if(rootElement.eClass().getEPackage() == type.getEPackage()) { + for (EObject rootElement : resource.getContents()) { + if (rootElement.eClass().getEPackage() == type.getEPackage()) { contentsToBrowse.add(rootElement); } } @@ -560,7 +560,7 @@ public class NavigatorUtils { } }; - if(Iterables.any(iterable, composedPredicate)) { + if (Iterables.any(iterable, composedPredicate)) { return true; } } @@ -574,14 +574,14 @@ public class NavigatorUtils { * * @return */ - //@unused for efficiency issues + // @unused for efficiency issues public static boolean find(EObject toFind, Predicate<Setting> predicate) { - if(toFind == null || toFind.eResource() == null || toFind.eResource().getResourceSet() == null) { + if (toFind == null || toFind.eResource() == null || toFind.eResource().getResourceSet() == null) { return false; } ResourceSet resourceSet = toFind.eResource().getResourceSet(); ECrossReferenceAdapter adapter = ECrossReferenceAdapter.getCrossReferenceAdapter(resourceSet); - if(adapter == null) { + if (adapter == null) { adapter = new ECrossReferenceAdapter(); resourceSet.eAdapters().add(adapter); } @@ -596,12 +596,12 @@ public class NavigatorUtils { * @return */ public static <T> Collection<T> findFilterAndApply(EObject toFind, Predicate<Setting> predicate, Function<Setting, T> function) { - if(toFind == null || toFind.eResource() == null || toFind.eResource().getResourceSet() == null) { + if (toFind == null || toFind.eResource() == null || toFind.eResource().getResourceSet() == null) { return Collections.emptyList(); } ResourceSet resourceSet = toFind.eResource().getResourceSet(); ECrossReferenceAdapter adapter = ECrossReferenceAdapter.getCrossReferenceAdapter(resourceSet); - if(adapter == null) { + if (adapter == null) { adapter = new ECrossReferenceAdapter(); resourceSet.eAdapters().add(adapter); } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/SharedModelExplorerState.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/SharedModelExplorerState.java index 9fc03832116..8aa03948bfb 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/SharedModelExplorerState.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/SharedModelExplorerState.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2014 CEA and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -53,7 +53,7 @@ class SharedModelExplorerState extends EventManager { boolean oldValue = this.linkingEnabled; this.linkingEnabled = linkingEnabled; - if(oldValue != linkingEnabled) { + if (oldValue != linkingEnabled) { fireStateChanged(StateChangedEvent.LINKING_ENABLED); } } @@ -66,7 +66,7 @@ class SharedModelExplorerState extends EventManager { boolean oldValue = this.alphaSorted; this.alphaSorted = alphaSorted; - if(oldValue != alphaSorted) { + if (oldValue != alphaSorted) { fireStateChanged(StateChangedEvent.ALPHA_SORTED); } } @@ -78,13 +78,13 @@ class SharedModelExplorerState extends EventManager { public void updateNavigatorContentExtensions(String[] contentExtensionIDs, boolean activate) { Set<String> oldValue = ImmutableSet.copyOf(this.navigatorContentExtensions); - if(activate) { + if (activate) { this.navigatorContentExtensions.addAll(Arrays.asList(contentExtensionIDs)); } else { this.navigatorContentExtensions.removeAll(Arrays.asList(contentExtensionIDs)); } - if(!oldValue.equals(this.navigatorContentExtensions)) { + if (!oldValue.equals(this.navigatorContentExtensions)) { fireStateChanged(StateChangedEvent.CONTENT_EXTENSIONS); } } @@ -107,7 +107,7 @@ class SharedModelExplorerState extends EventManager { private void readLinking(IMemento memento) { IMemento linking = memento.getChild(LINKING_MEMENTO); - if(linking != null) { + if (linking != null) { Boolean enabled = linking.getBoolean(ENABLED_ATTR); this.linkingEnabled = (enabled != null) && enabled.booleanValue(); } @@ -115,7 +115,7 @@ class SharedModelExplorerState extends EventManager { private void writeLinking(IMemento memento) { IMemento linking = memento.getChild(LINKING_MEMENTO); - if(linking == null) { + if (linking == null) { linking = memento.createChild(LINKING_MEMENTO); } linking.putBoolean(ENABLED_ATTR, isLinkingEnabled()); @@ -123,7 +123,7 @@ class SharedModelExplorerState extends EventManager { private void readSorting(IMemento memento) { IMemento sorting = memento.getChild(SORTING_MEMENTO); - if(sorting != null) { + if (sorting != null) { Boolean sorted = sorting.getBoolean(ALPHA_SORTED_ATTR); this.alphaSorted = (sorted != null) && sorted.booleanValue(); } @@ -131,7 +131,7 @@ class SharedModelExplorerState extends EventManager { private void writeSorting(IMemento memento) { IMemento sorting = memento.getChild(SORTING_MEMENTO); - if(sorting == null) { + if (sorting == null) { sorting = memento.createChild(SORTING_MEMENTO); } sorting.putBoolean(ALPHA_SORTED_ATTR, isAlphaSorted()); @@ -146,12 +146,12 @@ class SharedModelExplorerState extends EventManager { } void fireStateChanged(int eventType) { - if(isListenerAttached()) { + if (isListenerAttached()) { StateChangedEvent event = new StateChangedEvent(this, eventType); Object[] listeners = getListeners(); - for(int i = 0; i < listeners.length; i++) { + for (int i = 0; i < listeners.length; i++) { try { - ((StateChangedListener)listeners[i]).sharedStateChanged(event); + ((StateChangedListener) listeners[i]).sharedStateChanged(event); } catch (Exception e) { Activator.log.error("Uncaught exception in shared state listener.", e); } @@ -182,7 +182,7 @@ class SharedModelExplorerState extends EventManager { @Override public SharedModelExplorerState getSource() { - return (SharedModelExplorerState)super.getSource(); + return (SharedModelExplorerState) super.getSource(); } public int getEventType() { diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractCommonActionProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractCommonActionProvider.java index 6cdbe5ba6f4..a8298900f01 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractCommonActionProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractCommonActionProvider.java @@ -1,11 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008 Conselleria de Infraestructuras y Transporte, Generalitat + * Copyright (c) 2008 Conselleria de Infraestructuras y Transporte, Generalitat * de la Comunitat Valenciana, Obeo . 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: + * + * Contributors: * Francisco Javier Cano Muñoz (Prodevelop) – Initial API implementation. * Obeo * @@ -24,7 +24,7 @@ import org.eclipse.ui.navigator.CommonViewer; /** * Specialization of <CommonActionProvider> to be used as Papyrus action * provider. - * + * * @author fjcano * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> */ @@ -33,7 +33,7 @@ public abstract class AbstractCommonActionProvider extends CommonActionProvider /** * Gets the ID of the <CommonViewer> this <MOSKittCommonActionProvider> is * associated to. - * + * * @return the viewer id */ // @unused @@ -44,23 +44,23 @@ public abstract class AbstractCommonActionProvider extends CommonActionProvider /** * Gets the <MOSKittCommonNavigator> this <MOSKittCommonActionProvider> is * associated with, via the viewerID. - * + * * @return the common navigator */ protected CommonNavigator getCommonNavigator() { - - return ((CommonViewer)getActionSite().getStructuredViewer()).getCommonNavigator(); -// IViewPart part = org.eclipse.papyrus.views.modelexplorer.NavigatorUtils -// .findViewPart(getViewerID()); -// if (part instanceof CommonNavigator) { -// return ((CommonNavigator) part); -// } -// return null; + + return ((CommonViewer) getActionSite().getStructuredViewer()).getCommonNavigator(); + // IViewPart part = org.eclipse.papyrus.views.modelexplorer.NavigatorUtils + // .findViewPart(getViewerID()); + // if (part instanceof CommonNavigator) { + // return ((CommonNavigator) part); + // } + // return null; } /** * Gets the current context's selection. - * + * * @return the selection */ // @unused @@ -71,7 +71,7 @@ public abstract class AbstractCommonActionProvider extends CommonActionProvider /** * Gets the first element of the current context's selection. - * + * * @return the first selected element */ protected Object getFirstSelectedElement() { @@ -84,13 +84,13 @@ public abstract class AbstractCommonActionProvider extends CommonActionProvider /** * Resolve semantic element - * + * * @param object * the object to resolve * @return <code>null</code> or the semantic element associated to the * specified object */ protected EObject resolveSemanticObject(Object object) { - return EMFHelper.getEObject(object); + return EMFHelper.getEObject(object); } } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractSubmenuActionProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractSubmenuActionProvider.java index 5e8afcf4141..edd1151ecc1 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractSubmenuActionProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/AbstractSubmenuActionProvider.java @@ -1,11 +1,11 @@ /******************************************************************************* - * Copyright (c) 2008 Conselleria de Infraestructuras y Transporte, Generalitat + * Copyright (c) 2008 Conselleria de Infraestructuras y Transporte, Generalitat * de la Comunitat Valenciana, Obeo. 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: + * + * Contributors: * Francisco Javier Cano Muñoz (Prodevelop) – Initial API implementation. * Obeo * @@ -26,7 +26,7 @@ import org.eclipse.jface.action.MenuManager; /** * Specialization of <AbstractCommonActionProvider> to be used in menu and * submenu contributions. - * + * * @author fjcano * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> */ @@ -35,13 +35,13 @@ public abstract class AbstractSubmenuActionProvider extends /** * Organizes the given <Collection> of <IActions>. - * + * * @param createActions * <Collection> of <IActions> to organize * @param token * <String> that the <StringTokenizer> will use to trim each * <IAction>'s text. - * + * * @return a <Map> associating <String>s to <Collection>s of <IAction>s. */ protected Map<String, Collection<IAction>> extractSubmenuActions( @@ -72,7 +72,7 @@ public abstract class AbstractSubmenuActionProvider extends /** * Fills a <IContributionManager> with the given <Collection> of <IActions>. - * + * * @param manager * the manager * @param actions @@ -96,7 +96,7 @@ public abstract class AbstractSubmenuActionProvider extends /** * Fills a <IContributionManager> with two levels of menus, as specified by * the <Map> of <String>s to <Collection>s of <IAction>s. - * + * * @param manager * the manager * @param submenuActions diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java index ae596f57c85..748a08b4436 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/EditingDomainActionProvider.java @@ -4,7 +4,7 @@ * 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: * Obeo - initial API and implementation * Emilien Perico - use extension point to define dynamically registered actions @@ -37,7 +37,7 @@ import org.osgi.framework.Bundle; /** * Provider used to create actions applicable on semantic elements - * + * * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> * @author Emilien Perico - see extension point * org.eclipse.papyrus.navigator.actionHandler to add specific action @@ -62,14 +62,14 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { TransactionalEditingDomain editingDomain = EditorUtils.getTransactionalEditingDomain(); IConfigurationElement[] registry = Platform.getExtensionRegistry().getConfigurationElementsFor(ACTION_HANDLER_EXTENSION_POINT_ID); - for(IConfigurationElement elt : registry) { + for (IConfigurationElement elt : registry) { try { final String actionId = elt.getAttribute("actionId"); final String afterAction = elt.getAttribute("afterAction"); boolean needSeparator = Boolean.valueOf(elt.getAttribute("needSeparator")); ActionProperties properties = new ActionProperties(actionId, afterAction, needSeparator); - IActionHandlerFactory factory = (IActionHandlerFactory)createExtension(elt, elt.getAttribute("actionHandler")); + IActionHandlerFactory factory = (IActionHandlerFactory) createExtension(elt, elt.getAttribute("actionHandler")); // create registered actions factory.createActions(editingDomain); @@ -86,21 +86,21 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { @Override public void fillActionBars(IActionBars actionBars) { super.fillActionBars(actionBars); - for(IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { + for (IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { factory.fillActionBars(actionBars); } } /** * Load an instance of a class - * + * * @param element - * the extension point + * the extension point * @param classAttribute - * the name of the class to load + * the name of the class to load * @return the loaded Class * @throws Exception - * if the class is not loaded + * if the class is not loaded */ @SuppressWarnings("rawtypes") private static Object createExtension(final IConfigurationElement element, final String classAttribute) throws Exception { @@ -125,12 +125,12 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { List<IActionHandlerFactory> sortedFactories = sortFactories(actionsFactoriesMap); // Add the edit menu actions - for(IActionHandlerFactory factory : sortedFactories) { + for (IActionHandlerFactory factory : sortedFactories) { ActionProperties actionProperties = actionsFactoriesMap.get(factory); - if(actionProperties != null && actionProperties.isNeedSeparator()) { + if (actionProperties != null && actionProperties.isNeedSeparator()) { menu.add(new Separator()); } - for(Action action : factory.getActions()) { + for (Action action : factory.getActions()) { menu.add(new ActionContributionItem(action)); } } @@ -143,11 +143,11 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { public void update() { ISelection selection = getCommonNavigator().getCommonViewer().getSelection(); IStructuredSelection structuredSelection = StructuredSelection.EMPTY; - if(selection instanceof IStructuredSelection) { - structuredSelection = (IStructuredSelection)selection; + if (selection instanceof IStructuredSelection) { + structuredSelection = (IStructuredSelection) selection; } - for(IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { + for (IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { factory.update(structuredSelection); } } @@ -156,7 +156,7 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { * Activate actions */ public void activate() { - for(IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { + for (IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { factory.activate(activeViewPart); } update(); @@ -167,7 +167,7 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { */ // @unused public void deactivate() { - for(IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { + for (IActionHandlerFactory factory : actionsFactoriesMap.keySet()) { factory.deactivate(activeViewPart); } } @@ -184,10 +184,10 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { /** * Sort factories. - * + * * @param actionsFactoriesMap - * the actions factories map - * + * the actions factories map + * * @return the sorted list of factories */ private List<IActionHandlerFactory> sortFactories(final Map<IActionHandlerFactory, ActionProperties> actionsFactoriesMap) { @@ -203,22 +203,22 @@ public class EditingDomainActionProvider extends AbstractSubmenuActionProvider { String after1 = properties1.getAfterAction(); String after2 = properties2.getAfterAction(); - if(properties1.getActionId().equals(properties2.getActionId())) { + if (properties1.getActionId().equals(properties2.getActionId())) { return 0; - } else if(properties1.getActionId().equals(after2)) { + } else if (properties1.getActionId().equals(after2)) { return -1; - } else if(properties2.getActionId().equals(after1)) { + } else if (properties2.getActionId().equals(after1)) { return 1; - } else if(after1 == null) { + } else if (after1 == null) { return -1; - } else if(after2 == null) { + } else if (after2 == null) { return 1; } return 0; } private ActionProperties getDefaultForNull(ActionProperties actionProperties) { - if(actionProperties == null) { + if (actionProperties == null) { actionProperties = new ActionProperties("", "", false); } return actionProperties; diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/GenericTransformActionProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/GenericTransformActionProvider.java index 07258b2ec80..6d77f6f56c8 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/GenericTransformActionProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actionprovider/GenericTransformActionProvider.java @@ -1,7 +1,7 @@ /*************************************************** * Copyright (c) 2010 Atos Origin. - * + * * 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 @@ -85,7 +85,7 @@ public class GenericTransformActionProvider extends /** * From an EObject we get the epackage corresponding to the resource * extension of the file and get the imported epackage correspondant - * + * * @param selectionEObject */ private void fillEClassifiers(EObject selectionEObject) { @@ -117,7 +117,7 @@ public class GenericTransformActionProvider extends /** * Register all classifiers contained in the package - * + * * @param pack * the package * @param result @@ -131,12 +131,12 @@ public class GenericTransformActionProvider extends /** * Generate the sorted list of transformation actions. - * + * * @param descriptors * the descriptors * @param selection * the selection - * + * * @return the collection< i action> */ protected Collection<IAction> generateTransformActions(ISelection selection) { @@ -154,12 +154,12 @@ public class GenericTransformActionProvider extends /** * Generate transformation actions. - * + * * @param descriptors * the descriptors * @param selection * the selection - * + * * @return the collection< i action> */ protected Collection<IAction> generateTransformActionsCore( diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformAction.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformAction.java index 832f0e2d1d2..3e8bc5aefed 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformAction.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformAction.java @@ -1,7 +1,7 @@ /***************************************************
* Copyright (c) 2010 Atos Origin.
- *
+ *
* 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
@@ -60,7 +60,7 @@ public class GenericTransformAction extends Action { /**
* Constructor for a new action.
- *
+ *
* @param transformationEClass
* the eclass element must be transformed into
* @param adapterFactory
@@ -86,7 +86,7 @@ public class GenericTransformAction extends Action { /**
* Transform the element and update referencing diagrams.
- *
+ *
* @see org.eclipse.jface.action.Action#run()
*/
@Override
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformer.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformer.java index a438b915af8..a775c46ebae 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformer.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/GenericTransformer.java @@ -1,7 +1,7 @@ /***************************************************
* Copyright (c) 2010 Atos Origin.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@@ -113,9 +114,9 @@ public class GenericTransformer { /**
* Instantiates a new generic transformer.
- *
+ *
* @param currentNode
- * the current node
+ * the current node
*/
public GenericTransformer(AbstractGraphicalEditPart currentNode) {
this(currentNode, true);
@@ -124,27 +125,27 @@ public class GenericTransformer { /**
* Instantiates a new generic transformer. and specify if we have to perform
* graphical copy
- *
+ *
* @param currentNode
- * the current node
+ * the current node
* @param graphCopy
- * the graph copy
+ * the graph copy
*/
public GenericTransformer(AbstractGraphicalEditPart currentNode, boolean graphCopy) {
this.graphCopy = graphCopy;
- if(currentNode != null) {
+ if (currentNode != null) {
Object model = currentNode.getModel();
- if(model instanceof View) {
- this.element = ((View)model).getElement();
+ if (model instanceof View) {
+ this.element = ((View) model).getElement();
}
}
}
/**
* Instantiates a new generic transformer.
- *
+ *
* @param currentEobject
- * the current eobject
+ * the current eobject
*/
public GenericTransformer(EObject currentEobject) {
this.element = currentEobject;
@@ -152,47 +153,47 @@ public class GenericTransformer { /**
* Transform the element to the given eclass.
- *
+ *
* @param eclass
- * the targeted eclass
+ * the targeted eclass
*/
public void transform(EClass eclass) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart editor = page.getActiveEditor();
- CommandStack stack = (CommandStack)editor.getAdapter(CommandStack.class);
+ CommandStack stack = (CommandStack) editor.getAdapter(CommandStack.class);
globalCommand = new CompositeCommand("Generic Transformation");
- if(graphCopy) {
- if(element != null) {
+ if (graphCopy) {
+ if (element != null) {
EReference[] features = { NotationPackage.eINSTANCE.getView_Element() };
Collection<?> views = EMFCoreUtil.getReferencers(element, features);
- for(Object view : views) {
- if(view instanceof View) {
- referencingViews.add((View)view);
+ for (Object view : views) {
+ if (view instanceof View) {
+ referencingViews.add((View) view);
}
}
}
}
- if(stack != null) {
+ if (stack != null) {
// maybe extension point for stereotypes
- EObject model = (EObject)AdapterFactoryEditingDomain.unwrap(element);
+ EObject model = (EObject) AdapterFactoryEditingDomain.unwrap(element);
// get mixed editing domain to do transaction
- TransactionalEditingDomain domain = (TransactionalEditingDomain)EMFHelper.resolveEditingDomain(model);
+ TransactionalEditingDomain domain = (TransactionalEditingDomain) EMFHelper.resolveEditingDomain(model);
commandModel = new EObjectInheritanceCopyCommand(model, eclass, domain);
globalCommand.add(commandModel);
- if(graphCopy) {
+ if (graphCopy) {
importerCommand = new ImporterCommand(domain);
- if(importerCommand.canExecute()) {
+ if (importerCommand.canExecute()) {
globalCommand.add(importerCommand);
}
}
- if(globalCommand.canExecute()) {
+ if (globalCommand.canExecute()) {
try {
// drop caches about input element
ECrossReferenceAdapter cross = ECrossReferenceAdapter.getCrossReferenceAdapter(element);
- if(cross != null) {
+ if (cross != null) {
cross.unsetTarget(element);
}
stack.execute(new ICommandProxy(globalCommand));
@@ -214,9 +215,9 @@ public class GenericTransformer { /**
* Constructor.
- *
+ *
* @param domain
- * transactional editing domain
+ * transactional editing domain
*/
public ImporterCommand(TransactionalEditingDomain domain) {
super(domain, "Import graphical nodes", null);
@@ -224,11 +225,11 @@ public class GenericTransformer { /**
* Execute the command
- *
+ *
* @param monitor
- * progress monitor
+ * progress monitor
* @param info
- * the info
+ * the info
* @return the command result
* @throws ExecutionException
*/
@@ -240,23 +241,23 @@ public class GenericTransformer { /**
* Graph copy, make a drag and drop of the new object on all diagrams
- *
+ *
* @param diagramDomain
- * the mixed domain
+ * the mixed domain
* @param target
- * the target
+ * the target
* @param globalCommand2
* @param graphElement
- * the graph element
+ * the graph element
* @param oldLocation
- * the old location
+ * the old location
* @param editpart
- * the editpart
+ * the editpart
*/
private void graphCopy(IDiagramEditDomain domain, EObject target) {
- for(View graphElement : referencingViews) {
+ for (View graphElement : referencingViews) {
View parent = ViewUtil.getContainerView(graphElement);
- if(parent == null || graphElement.getDiagram() == null) {
+ if (parent == null || graphElement.getDiagram() == null) {
// this is an orphaned view. Skip it
continue;
}
@@ -264,63 +265,63 @@ public class GenericTransformer { // Get the edit part of the diagram containing the view.
DiagramEditPart diagramEditPart = null;
IEditorPart activeEditorPart = page.getActiveEditor();
- if(activeEditorPart instanceof IDiagramWorkbenchPart) {
- if(graphElement.getDiagram().equals(((IDiagramWorkbenchPart)activeEditorPart).getDiagram())) {
- diagramEditPart = ((IDiagramWorkbenchPart)activeEditorPart).getDiagramEditPart();
+ if (activeEditorPart instanceof IDiagramWorkbenchPart) {
+ if (graphElement.getDiagram().equals(((IDiagramWorkbenchPart) activeEditorPart).getDiagram())) {
+ diagramEditPart = ((IDiagramWorkbenchPart) activeEditorPart).getDiagramEditPart();
}
}
- if(diagramEditPart == null) {
+ if (diagramEditPart == null) {
// search in other editor parts than the active one
List<?> editorParts = EditorService.getInstance().getRegisteredEditorParts();
- for(Object editorPart : editorParts) {
- if(editorPart instanceof IDiagramWorkbenchPart) {
- if(graphElement.getDiagram().equals(((IDiagramWorkbenchPart)editorPart).getDiagram())) {
- diagramEditPart = ((IDiagramWorkbenchPart)editorPart).getDiagramEditPart();
+ for (Object editorPart : editorParts) {
+ if (editorPart instanceof IDiagramWorkbenchPart) {
+ if (graphElement.getDiagram().equals(((IDiagramWorkbenchPart) editorPart).getDiagram())) {
+ diagramEditPart = ((IDiagramWorkbenchPart) editorPart).getDiagramEditPart();
}
}
}
}
- if(diagramEditPart != null) {
- EditPart containerPart = (EditPart)diagramEditPart.getViewer().getEditPartRegistry().get(parent);
+ if (diagramEditPart != null) {
+ EditPart containerPart = (EditPart) diagramEditPart.getViewer().getEditPartRegistry().get(parent);
// create the new transformed view
DropObjectsRequest req = new DropObjectsRequest();
req.setObjects(Collections.singletonList(target));
- if(graphElement instanceof Node) {
- LayoutConstraint constraint = ((Node)graphElement).getLayoutConstraint();
- if(constraint instanceof Location) {
- Location location = (Location)constraint;
+ if (graphElement instanceof Node) {
+ LayoutConstraint constraint = ((Node) graphElement).getLayoutConstraint();
+ if (constraint instanceof Location) {
+ Location location = (Location) constraint;
req.setLocation(new Point(location.getX(), location.getY()));
}
}
- if(req.getLocation() == null) {
+ if (req.getLocation() == null) {
req.setLocation(new Point());
}
Command partCreationCmd = containerPart.getCommand(req);
partCreationCmd.execute();
View newView = null;
- if(partCreationCmd instanceof ICommandProxy) {
- CommandResult res = ((ICommandProxy)partCreationCmd).getICommand().getCommandResult();
+ if (partCreationCmd instanceof ICommandProxy) {
+ CommandResult res = ((ICommandProxy) partCreationCmd).getICommand().getCommandResult();
Object newValue = res.getReturnValue();
- if(newValue instanceof Collection<?>) {
- for(Object value : (Collection<?>)newValue) {
- if(value instanceof ViewDescriptor) {
- newView = (View)((ViewDescriptor)value).getAdapter(View.class);
+ if (newValue instanceof Collection<?>) {
+ for (Object value : (Collection<?>) newValue) {
+ if (value instanceof ViewDescriptor) {
+ newView = (View) ((ViewDescriptor) value).getAdapter(View.class);
}
}
- } else if(newValue instanceof ViewDescriptor) {
- newView = (View)((ViewDescriptor)newValue).getAdapter(View.class);
+ } else if (newValue instanceof ViewDescriptor) {
+ newView = (View) ((ViewDescriptor) newValue).getAdapter(View.class);
}
}
// with ViewRefactorHelper, copy view properties on the old
// one
- if(newView != null) {
+ if (newView != null) {
ViewTransformerHelper helper = new ViewTransformerHelper(diagramEditPart.getDiagramPreferencesHint());
helper.copyMixedViewFeatures(graphElement, newView);
}
// delete the old view
- GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
- EditPart oldPart = (EditPart)diagramEditPart.getViewer().getEditPartRegistry().get(graphElement);
+ GroupRequest deleteReq = new GroupRequest(org.eclipse.gef.RequestConstants.REQ_DELETE);
+ EditPart oldPart = (EditPart) diagramEditPart.getViewer().getEditPartRegistry().get(graphElement);
Command partDeletionCmd = oldPart.getCommand(deleteReq);
partDeletionCmd.execute();
}
@@ -338,9 +339,9 @@ public class GenericTransformer { /**
* Constructor.
- *
+ *
* @param preferencesHint
- * the diagram preferences hint
+ * the diagram preferences hint
*/
public ViewTransformerHelper(PreferencesHint preferencesHint) {
super(preferencesHint);
@@ -348,19 +349,19 @@ public class GenericTransformer { /**
* Copy common features from a view to another
- *
+ *
* @param oldView
- * the old view to copy from
+ * the old view to copy from
* @param newView
- * the new view to copy to
+ * the new view to copy to
*/
public void copyMixedViewFeatures(View oldView, View newView) {
- if(oldView instanceof Diagram && newView instanceof Diagram) {
- copyDiagramFeatures((Diagram)oldView, (Diagram)newView);
- } else if(oldView instanceof Node && newView instanceof Node) {
- copyNodeFeatures((Node)oldView, (Node)newView);
- } else if(oldView instanceof Edge && newView instanceof Edge) {
- copyEdgeFeatures((Edge)oldView, (Edge)newView);
+ if (oldView instanceof Diagram && newView instanceof Diagram) {
+ copyDiagramFeatures((Diagram) oldView, (Diagram) newView);
+ } else if (oldView instanceof Node && newView instanceof Node) {
+ copyNodeFeatures((Node) oldView, (Node) newView);
+ } else if (oldView instanceof Edge && newView instanceof Edge) {
+ copyEdgeFeatures((Edge) oldView, (Edge) newView);
} else {
copyViewFeatures(oldView, newView);
}
@@ -370,10 +371,10 @@ public class GenericTransformer { /**
* Gets all the super types.
- *
+ *
* @param class1
- * the class
- *
+ * the class
+ *
* @return super types
*/
public static HashSet<EClass> getAllSuperTypes(EClass class1) {
@@ -384,21 +385,21 @@ public class GenericTransformer { /**
* Gets the factory from uri.
- *
+ *
* @param uri
- * the uri
- *
+ * the uri
+ *
* @return the factory
*/
public static AdapterFactory getFactory(String uri) {
AdapterFactory factory = factories.get(uri);
- if(factory == null) {
+ if (factory == null) {
IConfigurationElement[] extensions = Platform.getExtensionRegistry().getConfigurationElementsFor(EXT_FACTORIES);
- for(IConfigurationElement e : extensions) {
- if(uri.equals(e.getAttribute("uri"))) {
+ for (IConfigurationElement e : extensions) {
+ if (uri.equals(e.getAttribute("uri"))) {
try {
- factory = (AdapterFactory)e.createExecutableExtension("class");
- if(factory != null) {
+ factory = (AdapterFactory) e.createExecutableExtension("class");
+ if (factory != null) {
factories.put(uri, factory);
}
} catch (CoreException e1) {
@@ -412,24 +413,25 @@ public class GenericTransformer { /**
* Checks if a transformation is possible.
- *
+ *
* @param eclass
- * the eclass
- *
+ * the eclass
+ *
* @return the multi status
*/
public MultiStatus isTransformationPossible(EClass eclass) {
MultiStatus result = new MultiStatus(Activator.PLUGIN_ID, 0, "Type incompatibility", null);
- if(element != null) {
+ if (element != null) {
Collection<Setting> usages = EMFHelper.getUsages(element);
- if(usages != null) {
- for(EStructuralFeature.Setting nonNavigableInverseReference : usages) {
+ if (usages != null) {
+ for (EStructuralFeature.Setting nonNavigableInverseReference : usages) {
EStructuralFeature structuralFeature = nonNavigableInverseReference.getEStructuralFeature();
- if(!(nonNavigableInverseReference.getEObject() instanceof View)) {
+ if (!(nonNavigableInverseReference.getEObject() instanceof View)) {
boolean compatible = EObjectInheritanceCopyCommand.isCompatible(structuralFeature.getEType(), eclass);
- if(!compatible) {
- String econtainer = structuralFeature.eContainer() instanceof EClassifier ? ((EClassifier)structuralFeature.eContainer()).getName() + " ( " + nonNavigableInverseReference.getEObject().toString() + " )" : structuralFeature.eContainer().toString();
- Status s = new Status(Status.WARNING, Activator.PLUGIN_ID, String.format("an element typed %s references your selection, we can not assign instead of your selection an object typed %s", econtainer, eclass.getName()));
+ if (!compatible) {
+ String econtainer = structuralFeature.eContainer() instanceof EClassifier ? ((EClassifier) structuralFeature.eContainer()).getName() + " ( " + nonNavigableInverseReference.getEObject().toString() + " )" : structuralFeature
+ .eContainer().toString();
+ Status s = new Status(IStatus.WARNING, Activator.PLUGIN_ID, String.format("an element typed %s references your selection, we can not assign instead of your selection an object typed %s", econtainer, eclass.getName()));
result.add(s);
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/PasteShapeOrElementAction.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/PasteShapeOrElementAction.java index 362df99726f..2dfc0d2728a 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/PasteShapeOrElementAction.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/actions/PasteShapeOrElementAction.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2009 CEA LIST. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,25 +24,25 @@ import org.eclipse.gmf.runtime.notation.View; /** * Action used for pasting either a model element or a shape (i.e. the model element reprented * by the shape). Delegates to PasteShapeOrElementCommand - * + * * @author Ansgar Radermacher (CEA LIST) */ public class PasteShapeOrElementAction extends PasteAction -{ - public PasteShapeOrElementAction (EditingDomain domain) { - super (domain); +{ + public PasteShapeOrElementAction(EditingDomain domain) { + super(domain); } @Override public Command createCommand(Collection<?> selection) { - if ((selection.size () == 1) && (domain != null)) { - Object owner = selection.iterator().next (); - + if ((selection.size() == 1) && (domain != null)) { + Object owner = selection.iterator().next(); + boolean onlyViewsInClipboard = true; boolean foundView = false; - if (domain.getClipboard () != null) { - for (Object clipObject : domain.getClipboard ()) { + if (domain.getClipboard() != null) { + for (Object clipObject : domain.getClipboard()) { if (clipObject instanceof View) { foundView = true; } @@ -51,12 +51,12 @@ public class PasteShapeOrElementAction extends PasteAction } } } - // TODO: currently only works for a single element to be copied. + // TODO: currently only works for a single element to be copied. if (onlyViewsInClipboard && foundView) { - View shape = (View) domain.getClipboard ().iterator ().next (); - return AddCommand.create (domain, owner, null, shape.getElement ()); + View shape = (View) domain.getClipboard().iterator().next(); + return AddCommand.create(domain, owner, null, shape.getElement()); } } - return super.createCommand (selection); + return super.createCommand(selection); } } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/EObjectInheritanceCopyCommand.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/EObjectInheritanceCopyCommand.java index 7d73e8ef81b..c5ecf753b27 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/EObjectInheritanceCopyCommand.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/EObjectInheritanceCopyCommand.java @@ -1,7 +1,7 @@ /*************************************************** * Copyright (c) 2010 Atos Origin. - * + * * 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 @@ -58,11 +58,11 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { this.sourceEObject = source; this.targetEObject = target.getEPackage().getEFactoryInstance().create(target); this.editingDomain = adapterFactoryEditingDomain; - if(sourceEObject == null || targetEObject == null || editingDomain == null) { + if (sourceEObject == null || targetEObject == null || editingDomain == null) { throw new IllegalArgumentException("Please provide non null arguments"); //$NON-NLS-1$ } init(); - if(sourceEObject.eContainingFeature().isMany()) { + if (sourceEObject.eContainingFeature().isMany()) { replace(sourceEObject.eContainer(), sourceEObject, targetEObject, sourceEObject.eContainingFeature()); } else { add(new CustomSetCommand(editingDomain, sourceEObject.eContainer(), sourceEObject.eContainingFeature(), targetEObject, sourceEObject, sourceEObject.eContainingFeature())); @@ -77,20 +77,20 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Model copy, copy the eobject source attributes to target's - * + * * @param mixedDomain - * the mixed domain + * the mixed domain * @param source - * the source + * the source * @param target - * the target + * the target */ private void modelCopy(EObject source, EObject target) { EClass eclass = source.eClass(); - if(eclass != null) { + if (eclass != null) { EList<EStructuralFeature> eAllStructuralFeatures = eclass.getEAllStructuralFeatures(); - for(EStructuralFeature e : eAllStructuralFeatures) { - if(contains(target.eClass(), e) && isCompatible(e.getEType(), target.eClass().getEStructuralFeature(e.getName()).getEType())) { + for (EStructuralFeature e : eAllStructuralFeatures) { + if (contains(target.eClass(), e) && isCompatible(e.getEType(), target.eClass().getEStructuralFeature(e.getName()).getEType())) { manageFeature(source, target, e); } } @@ -100,18 +100,18 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Contains. check if the target eclass contains a estructuralfeature with * the same name less rigorous can work for many cases - * + * * @param target - * the target + * the target * @param e - * the e - * + * the e + * * @return true, if successful */ private boolean contains(EClass target, EStructuralFeature e) { EList<EStructuralFeature> features = target.getEAllStructuralFeatures(); - for(EStructuralFeature f : features) { - if(f.getName().equals(e.getName())) { + for (EStructuralFeature f : features) { + if (f.getName().equals(e.getName())) { return true; } } @@ -120,29 +120,29 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Manage feature for cross. - * + * * @param mixedDomain - * the mixed domain + * the mixed domain * @param theObjectWithCross - * the the object with cross + * the the object with cross * @param source - * the source + * the source * @param target - * the target + * the target * @param structuralFeature - * the structural feature + * the structural feature */ private void manageFeatureForCross(EObject theObjectWithCross, EObject source, EObject target, EStructuralFeature structuralFeature) { boolean compatible = isCompatible(structuralFeature.getEType(), target.eClass()); - if(compatible && structuralFeature.isChangeable() && !structuralFeature.isDerived()) { - if(structuralFeature.isMany()) { + if (compatible && structuralFeature.isChangeable() && !structuralFeature.isDerived()) { + if (structuralFeature.isMany()) { replace(theObjectWithCross, source, target, structuralFeature); } else { add(new SetValueCommand(new SetRequest(editingDomain, theObjectWithCross, structuralFeature, target))); } - } else if(!compatible) { - if(structuralFeature.isMany()) { + } else if (!compatible) { + if (structuralFeature.isMany()) { remove(theObjectWithCross, source, structuralFeature); } else { add(new SetValueCommand(new SetRequest(editingDomain, theObjectWithCross, structuralFeature, null))); @@ -152,19 +152,19 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { } private void remove(EObject owner, Object source, EStructuralFeature structuralFeature) { - if(!alreadyManaged.contains(source)) { + if (!alreadyManaged.contains(source)) { - if(owner == null && structuralFeature == null) { - if(source instanceof EObject) { - add(new DestroyElementPapyrusCommand(new DestroyElementRequest(editingDomain, (EObject)source, false))); + if (owner == null && structuralFeature == null) { + if (source instanceof EObject) { + add(new DestroyElementPapyrusCommand(new DestroyElementRequest(editingDomain, (EObject) source, false))); } } else { Object value = owner.eGet(structuralFeature); - if(value instanceof Collection<?>) { - List<Object> newList = new ArrayList<Object>((Collection<?>)value); + if (value instanceof Collection<?>) { + List<Object> newList = new ArrayList<Object>((Collection<?>) value); newList.remove(source); add(new SetValueCommand(new SetRequest(editingDomain, owner, structuralFeature, newList))); - } else if(source.equals(value)) { + } else if (source.equals(value)) { add(new SetValueCommand(new SetRequest(editingDomain, owner, structuralFeature, null))); } else { add(new SetValueCommand(new SetRequest(editingDomain, owner, structuralFeature, null))); @@ -175,23 +175,23 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { } private void replace(EObject owner, Object source, Object target, EStructuralFeature structuralFeature) { - if(!alreadyManaged.contains(source)) { + if (!alreadyManaged.contains(source)) { - if(owner == null && structuralFeature == null) { - if(source instanceof EObject) { - add(new DestroyElementPapyrusCommand(new DestroyElementRequest(editingDomain, (EObject)source, false))); + if (owner == null && structuralFeature == null) { + if (source instanceof EObject) { + add(new DestroyElementPapyrusCommand(new DestroyElementRequest(editingDomain, (EObject) source, false))); } } else { Object value = owner.eGet(structuralFeature); - if(value instanceof Collection<?>) { - List<Object> newList = new ArrayList<Object>((Collection<?>)value); + if (value instanceof Collection<?>) { + List<Object> newList = new ArrayList<Object>((Collection<?>) value); int index = newList.indexOf(source); - if(index >= 0) { + if (index >= 0) { newList.remove(index); newList.add(index, target); add(new SetValueCommand(new SetRequest(editingDomain, owner, structuralFeature, newList))); } - } else if(source.equals(value)) { + } else if (source.equals(value)) { add(new SetValueCommand(new SetRequest(editingDomain, owner, structuralFeature, target))); } else { add(new SetValueCommand(new SetRequest(editingDomain, owner, structuralFeature, target))); @@ -208,23 +208,23 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Cross reference. Manage eobjects referencing the source eobject - * + * * @param mixedDomain - * the mixed domain + * the mixed domain * @param source - * the source eobject + * the source eobject * @param target - * the target eobject + * the target eobject */ private void crossReference(EObject source, EObject target) { Collection<EStructuralFeature.Setting> collection = EMFHelper.getUsages(source); - if(collection != null) { - for(EStructuralFeature.Setting nonNavigableInverseReference : collection) { + if (collection != null) { + for (EStructuralFeature.Setting nonNavigableInverseReference : collection) { EStructuralFeature structuralFeature = nonNavigableInverseReference.getEStructuralFeature(); - if(!(nonNavigableInverseReference.getEObject() instanceof View)) { + if (!(nonNavigableInverseReference.getEObject() instanceof View)) { manageFeatureForCross(nonNavigableInverseReference.getEObject(), source, target, structuralFeature); - } else if(nonNavigableInverseReference.getEObject() instanceof Diagram) { - Diagram di = (Diagram)nonNavigableInverseReference.getEObject(); + } else if (nonNavigableInverseReference.getEObject() instanceof Diagram) { + Diagram di = (Diagram) nonNavigableInverseReference.getEObject(); remove(null, di, null); } } @@ -233,21 +233,21 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Checks if a type is compatible to another. - * + * * @param type - * the type + * the type * @param target - * the target - * + * the target + * * @return true, if is compatible */ public static boolean isCompatible(EClassifier type, EClassifier target) { Collection<EClassifier> types = new LinkedList<EClassifier>(); - if(target instanceof EClass) { - EClass eclass = (EClass)target; + if (target instanceof EClass) { + EClass eclass = (EClass) target; types.addAll(eclass.getEAllSuperTypes()); } - if(!types.contains(target)) { + if (!types.contains(target)) { types.add(target); } return types.contains(type); @@ -255,34 +255,34 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Manage a feature for the attribute's copy. - * + * * @param mixedDomain - * the mixed domain + * the mixed domain * @param source - * the source + * the source * @param target - * the target + * the target * @param feature - * the e + * the e */ @SuppressWarnings("unchecked") private void manageFeature(EObject source, EObject target, EStructuralFeature feature) { EStructuralFeature targetFeature = getFeature(target, feature.getName()); - if(feature.getUpperBound() <= targetFeature.getUpperBound() && feature.getLowerBound() >= targetFeature.getLowerBound()) { - if(feature.isChangeable() && !feature.isDerived()) { + if (feature.getUpperBound() <= targetFeature.getUpperBound() && feature.getLowerBound() >= targetFeature.getLowerBound()) { + if (feature.isChangeable() && !feature.isDerived()) { Object value = source.eGet(feature); - if(feature.isMany() && targetFeature.isMany()) { - Collection<EObject> list = (Collection<EObject>)value; - if(list != null && !list.isEmpty()) { + if (feature.isMany() && targetFeature.isMany()) { + Collection<EObject> list = (Collection<EObject>) value; + if (list != null && !list.isEmpty()) { Collection<EObject> newList = new LinkedList<EObject>(); newList.addAll(list); - if(feature instanceof EReference && !((EReference)feature).isContainment()) { + if (feature instanceof EReference && !((EReference) feature).isContainment()) { add(new SetValueCommand(new SetRequest(editingDomain, target, targetFeature, newList))); - } else if(feature instanceof EReference && ((EReference)feature).isContainment()) { + } else if (feature instanceof EReference && ((EReference) feature).isContainment()) { Collection<Object> toTreat = new LinkedList<Object>(); - for(Object o : newList) { - if(!alreadyManaged.contains(o)) { + for (Object o : newList) { + if (!alreadyManaged.contains(o)) { toTreat.add(o); alreadyManaged.add(o); } @@ -290,9 +290,9 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { add(new CustomAddCommand(editingDomain, target, targetFeature, newList, source, feature)); } } - } else if(!feature.isMany() && !targetFeature.isMany()) { - if(value != null) { - if(!alreadyManaged.contains(value)) { + } else if (!feature.isMany() && !targetFeature.isMany()) { + if (value != null) { + if (!alreadyManaged.contains(value)) { alreadyManaged.add(value); add(new CustomSetCommand(editingDomain, target, targetFeature, value, source, feature)); } @@ -305,12 +305,12 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Gets a feature from a name - * + * * @param eobject - * the eobject + * the eobject * @param name - * the name - * + * the name + * * @return the feature */ private EStructuralFeature getFeature(EObject eobject, String name) { @@ -319,7 +319,7 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { /** * Gets the result eobject. - * + * * @return the result eobject */ public EObject getResultEobject() { @@ -380,11 +380,11 @@ public class EObjectInheritanceCopyCommand extends CompositeCommand { IStatus result = super.doUndo(monitor, info); // this test permit to avoid modification from other command // if getOwner list is empty it will perform error we avoid it - if(values instanceof Collection<?> && !((Collection<?>)values).isEmpty()) { - Collection<?> collection = (Collection<?>)values; - Collection<Object> collecOldObject = (Collection)oldObject.eGet(oldFeature); - for(Object o : collection) { - if(!collecOldObject.contains(o)) { + if (values instanceof Collection<?> && !((Collection<?>) values).isEmpty()) { + Collection<?> collection = (Collection<?>) values; + Collection<Object> collecOldObject = (Collection) oldObject.eGet(oldFeature); + for (Object o : collection) { + if (!collecOldObject.contains(o)) { collecOldObject.add(o); } } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/MoveOpenableCommand.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/MoveOpenableCommand.java index 7d439bff336..61f229b8b9f 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/MoveOpenableCommand.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/commands/MoveOpenableCommand.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2012 Atos .
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,6 +27,7 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCo /**
* Command to move a diagram from a resource to another
+ *
* @author arthur daussy
*
*/
@@ -41,7 +42,7 @@ public class MoveOpenableCommand extends AbstractTransactionalCommand { private EObject diagram;
public MoveOpenableCommand(TransactionalEditingDomain domain, String label, EObject diagram, Resource newContainingRessource) {
- super(domain, label,null);
+ super(domain, label, null);
this.diagram = diagram;
this.newContainingRessource = newContainingRessource;
/*
@@ -54,11 +55,11 @@ public class MoveOpenableCommand extends AbstractTransactionalCommand { @Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
+
if (newContainingRessource != null) {
newContainingRessource.getContents().add(diagram);
return CommandResult.newOKCommandResult();
- }else {
+ } else {
return CommandResult.newErrorCommandResult("The new resource to add the diagram is null");////$NON-NLS-1$
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/exception/ModelExplorerException.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/exception/ModelExplorerException.java index 231a6e80334..7fca32a24ce 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/exception/ModelExplorerException.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/exception/ModelExplorerException.java @@ -1,27 +1,27 @@ /**
* Copyright (c) 2011 Atos.
- *
+ *
* 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:
* Atos - Initial API and implementation
- *
+ *
*/
package org.eclipse.papyrus.views.modelexplorer.core.ui.exception;
/**
* Exception thrown by the model explorer plugin
- *
+ *
* @author "Arthur Daussy <a href="mailto:arthur.daussy@atos.net">arthur.daussy@atos.net</a>"
- *
+ *
*/
public class ModelExplorerException extends Exception {
/**
- *
+ *
*/
private static final long serialVersionUID = -1197723371777623860L;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/CorePage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/CorePage.java index 49e742c15fd..608c5c98add 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/CorePage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/CorePage.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 LIFL & CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,10 +32,10 @@ public class CorePage extends Page { * The default ui
*/
private Text text;
-
+
private IWorkbenchPart part;
-
-
+
+
/**
* Constructor.
*
@@ -43,7 +43,7 @@ public class CorePage extends Page { public CorePage(IWorkbenchPart part) {
this.part = part;
}
-
+
/**
* @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
*
@@ -65,6 +65,7 @@ public class CorePage extends Page { public Control getControl() {
return text;
}
+
/**
* @see org.eclipse.ui.part.Page#setFocus()
*
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/DefaultPage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/DefaultPage.java index 4b9974be693..cf56d60c0b5 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/DefaultPage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/DefaultPage.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 LIFL & CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,9 @@ import org.eclipse.ui.part.Page; /**
* A default page to show when the active part can't be rendered by {@link MultiViewPageBookView}.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public class DefaultPage extends Page {
@@ -39,7 +39,7 @@ public class DefaultPage extends Page { /**
* @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
- *
+ *
* @param parent
*/
@Override
@@ -50,7 +50,7 @@ public class DefaultPage extends Page { /**
* @see org.eclipse.ui.part.Page#getControl()
- *
+ *
* @return
*/
@Override
@@ -60,7 +60,7 @@ public class DefaultPage extends Page { /**
* @see org.eclipse.ui.part.Page#setFocus()
- *
+ *
*/
@Override
public void setFocus() {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java index 4fb2228d7ab..2b7d083dee3 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ModelExplorerDecorationAdapter.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,9 +43,9 @@ public class ModelExplorerDecorationAdapter { /**
* Instantiates a new model explorer decoration adapter.
- *
+ *
* @param baseImage
- * the base image
+ * the base image
*/
public ModelExplorerDecorationAdapter(Image baseImage) {
this.decoratorTarget = baseImage;
@@ -53,7 +53,7 @@ public class ModelExplorerDecorationAdapter { /**
* Gets the decorator target.
- *
+ *
* @return the decorator target
*/
public Image getDecoratorTarget() {
@@ -62,11 +62,11 @@ public class ModelExplorerDecorationAdapter { /**
* Sets the decoration.
- *
+ *
* @param decoration
- * the decoration
+ * the decoration
* @param decorationPosition
- * the decoration position
+ * the decoration position
*/
public void setDecorations(List<IPapyrusDecoration> decorations) {
this.decorations = decorations;
@@ -74,9 +74,9 @@ public class ModelExplorerDecorationAdapter { /**
* Sets the decorator target.
- *
+ *
* @param decoratorTarget
- * the new decorator target
+ * the new decorator target
*/
public void setDecoratorTarget(Image decoratorTarget) {
this.decoratorTarget = decoratorTarget;
@@ -85,9 +85,9 @@ public class ModelExplorerDecorationAdapter { /**
* Sets the decoration position.
- *
+ *
* @param decorationPosition
- * the new decoration position
+ * the new decoration position
*/
public void setDecorationPosition(int decorationPosition) {
this.decorationPosition = decorationPosition;
@@ -95,20 +95,20 @@ public class ModelExplorerDecorationAdapter { /**
* Sets the decorated image.
- *
+ *
* @param baseImage
- * the base image
+ * the base image
* @param decoration
- * the decoration
+ * the decoration
* @param decorationPosition
- * the decoration position
+ * the decoration position
*/
public Image getDecoratedImage() {
- if(decoratorTarget == null) {
+ if (decoratorTarget == null) {
return null;
}
- if(decorations == null) {
+ if (decorations == null) {
return decoratorTarget;
}
@@ -119,13 +119,13 @@ public class ModelExplorerDecorationAdapter { decoratedImage = Activator.getDefault().getImageRegistry().get(decoratedImageId);
// Return the stored image if we have one
- if(decoratedImage == null) {
+ if (decoratedImage == null) {
// Otherwise create a new image and store it
ImageDescriptor[] decorationImages = new ImageDescriptor[5];
- // Store the decoration by position
+ // Store the decoration by position
IPapyrusDecoration[] decorationByPosition = new IPapyrusDecoration[5];
- for(IPapyrusDecoration decoration : decorations) {
+ for (IPapyrusDecoration decoration : decorations) {
IPapyrusDecoration existingDecoration = decorationByPosition[decoration.getPositionForJFace()];
if (existingDecoration == null || existingDecoration.getPriority() < decoration.getPriority()) {
// if no decoration exists for the current position
@@ -144,7 +144,7 @@ public class ModelExplorerDecorationAdapter { public String calcId() {
String decoratedImageId = decoratorTarget.toString();
- for(IPapyrusDecoration decoration : decorations) {
+ for (IPapyrusDecoration decoration : decorations) {
decoratedImageId += decoration.getDecorationImageForME().toString() + decoration.getPosition();
}
return decoratedImageId;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java index c74c7a09268..e628c202ebd 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/MultiViewPageBookView.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 LIFL & CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,9 +34,9 @@ import org.eclipse.ui.part.PageBookView; /**
* Base class for PageBookView in Papyrus.
* The PageBook mechanism can be moved in the core, as it can be reused by other Views.
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public abstract class MultiViewPageBookView extends PageBookView {
@@ -47,7 +47,7 @@ public abstract class MultiViewPageBookView extends PageBookView { /**
* @see org.eclipse.ui.part.PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
- *
+ *
* @param book
* @return
*/
@@ -70,7 +70,7 @@ public abstract class MultiViewPageBookView extends PageBookView { * <li>call page.createControl(getPageBook());</li>
* <li>return new PageRec(part, page);</li>
* </ul>
- *
+ *
* @param part
* @return
*/
@@ -79,13 +79,13 @@ public abstract class MultiViewPageBookView extends PageBookView { /**
* @see org.eclipse.ui.part.PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec)
- *
+ *
* @param part
* @param pageRecord
*/
@Override
protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
-
+
// Dispose the associated page.
pageRecord.page.dispose();
@@ -94,9 +94,9 @@ public abstract class MultiViewPageBookView extends PageBookView { /**
* Check if the currently active part is a {@link IMultiDiagramEditor}.
* If true, return it.
- *
+ *
* @see org.eclipse.ui.part.PageBookView#getBootstrapPart()
- *
+ *
* @return The currently active editor if it is a IMultiDiagramEditor, null otherwise.
*/
@Override
@@ -106,9 +106,9 @@ public abstract class MultiViewPageBookView extends PageBookView { IWorkbenchPart part = null;
try {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if(activeWorkbenchWindow != null) {
+ if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
- if(activePage != null) {
+ if (activePage != null) {
part = activePage.getActiveEditor();
}
}
@@ -116,7 +116,7 @@ public abstract class MultiViewPageBookView extends PageBookView { // An element is not active yet
return null;
}
- if(isImportant(part)) {
+ if (isImportant(part)) {
return part;
}
// The current active part is not for us.
@@ -125,9 +125,9 @@ public abstract class MultiViewPageBookView extends PageBookView { /**
* return true if the activated part is a {@link IMultiDiagramEditor}.
- *
+ *
* @see org.eclipse.ui.part.PageBookView#isImportant(org.eclipse.ui.IWorkbenchPart)
- *
+ *
* @param part
* @return
*/
@@ -135,17 +135,18 @@ public abstract class MultiViewPageBookView extends PageBookView { protected boolean isImportant(IWorkbenchPart part) {
- if(part instanceof IMultiDiagramEditor)
+ if (part instanceof IMultiDiagramEditor) {
return true;
+ }
return false;
}
/**
* Record the IMemento to use it when pages are created
- *
+ *
* @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- *
+ *
* @param site
* @param memento
* @throws PartInitException
@@ -158,9 +159,9 @@ public abstract class MultiViewPageBookView extends PageBookView { /**
* Create a Site that is also a {@link IViewSite}.
- *
+ *
* @see org.eclipse.ui.part.PageBookView#initPage(org.eclipse.ui.part.IPageBookViewPage)
- *
+ *
* @param page
*/
protected void initPage(ViewPartPage page, IWorkbenchPart part) {
@@ -177,13 +178,14 @@ public abstract class MultiViewPageBookView extends PageBookView { /**
* Get the currently nested active view.
- *
+ *
* @return The active Viewer, or null if none.
*/
public IViewPart getActiveView() {
IPage page = getCurrentPage();
- if(page instanceof ViewPartPage)
- return ((ViewPartPage)page).getViewer();
+ if (page instanceof ViewPartPage) {
+ return ((ViewPartPage) page).getViewer();
+ }
// not found
return null;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPageSite.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPageSite.java index e10c5c103ec..b64b4e16a35 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPageSite.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPageSite.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 LIFL & CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,9 +24,8 @@ import org.eclipse.ui.part.PageSite; /**
* A Site implementing {@link IViewSite} and {@link IPageSite}.
- * This site is used by the {@link MultiViewPageBookView} to provide suitable Site to a
- * {@link ViewPartPage} and its Viewer.
- *
+ * This site is used by the {@link MultiViewPageBookView} to provide suitable Site to a {@link ViewPartPage} and its Viewer.
+ *
* @author cedric dumoulin
*
*/
@@ -92,6 +91,7 @@ public class ViewPageSite extends PageSite implements IViewSite { * @return
* @deprecated
*/
+ @Deprecated
public IKeyBindingService getKeyBindingService() {
// TODO Auto-generated method stub
return parentViewSite.getKeyBindingService();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPartPage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPartPage.java index 92b2ab2d6e0..62c3379652d 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPartPage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/core/ui/pagebookview/ViewPartPage.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 LIFL & CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,9 +31,9 @@ import org.eclipse.ui.part.Page; * Subclass must create the viewer in their constructor. The constructor take the part as argument.
* The constructor is called from a subclass of {@link MultiViewPageBookView}.
* Subclass should also implements the method getControl().
- *
+ *
* @author cedric dumoulin
- *
+ *
*/
public abstract class ViewPartPage extends Page implements IAdaptable {
@@ -45,21 +45,21 @@ public abstract class ViewPartPage extends Page implements IAdaptable { /**
* Constructor.
- *
+ *
*/
public ViewPartPage() {
}
/**
* Init the inner View
- *
+ *
* @see org.eclipse.ui.part.Page#init(org.eclipse.ui.part.IPageSite)
- *
+ *
* @param pageSite
*/
@Override
public void init(IPageSite pageSite) {
- // Not used.
+ // Not used.
super.init(pageSite);
}
@@ -77,8 +77,8 @@ public abstract class ViewPartPage extends Page implements IAdaptable { modelExplorer = createViewer(part);
// Add the extension config if requested by the Viewer
- if(modelExplorer instanceof IExecutableExtension) {
- ((IExecutableExtension)modelExplorer).setInitializationData(cfig, null, null);
+ if (modelExplorer instanceof IExecutableExtension) {
+ ((IExecutableExtension) modelExplorer).setInitializationData(cfig, null, null);
}
// Init the part
modelExplorer.init(viewPageSite, memento);
@@ -86,19 +86,19 @@ public abstract class ViewPartPage extends Page implements IAdaptable { /**
* Create the viewer for this page. The Viewer is associated to the specified part.
- *
+ *
* @param part
- * The part associated to the Viewer.
- *
+ * The part associated to the Viewer.
+ *
* @return The Viewer to render in the page.
*/
abstract protected IViewPart createViewer(IWorkbenchPart part);
/**
* Subclass must implement this method.
- *
+ *
* @see org.eclipse.ui.part.Page#getControl()
- *
+ *
* @return
*/
@Override
@@ -106,7 +106,7 @@ public abstract class ViewPartPage extends Page implements IAdaptable { /**
* @see org.eclipse.ui.part.Page#setFocus()
- *
+ *
*/
@Override
public void setFocus() {
@@ -115,7 +115,7 @@ public abstract class ViewPartPage extends Page implements IAdaptable { /**
* Return the associated viewer
- *
+ *
* @return
*/
public IViewPart getViewer() {
@@ -124,17 +124,18 @@ public abstract class ViewPartPage extends Page implements IAdaptable { /**
* Forward to the
- *
+ *
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
- *
+ *
* @param adapter
* @return
*/
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
- if(modelExplorer instanceof IAdaptable)
- return ((IAdaptable)modelExplorer).getAdapter(adapter);
+ if (modelExplorer instanceof IAdaptable) {
+ return ((IAdaptable) modelExplorer).getAdapter(adapter);
+ }
// do nothing
return null;
@@ -142,6 +143,7 @@ public abstract class ViewPartPage extends Page implements IAdaptable { /**
* Dispose the page, and its associated viewer.
+ *
* @see org.eclipse.ui.part.Page#dispose()
*
*/
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/NavigatorSearchDialog.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/NavigatorSearchDialog.java index 0afeb7de15d..03e25e04278 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/NavigatorSearchDialog.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/NavigatorSearchDialog.java @@ -1,14 +1,14 @@ /*******************************************************************************
- * Copyright (c) 2009 Conselleria de Infraestructuras y Transporte, Generalitat
+ * Copyright (c) 2009 Conselleria de Infraestructuras y Transporte, Generalitat
* de la Comunitat Valenciana . 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:
+ *
+ * Contributors:
* Francisco Javier Cano Muñoz (Prodevelop) - initial api contribution
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Improve the searchText widget
- *
+ *
*
******************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.dialog;
@@ -63,13 +63,13 @@ import com.google.common.collect.Lists; /**
* A dialog that allows searching elements in the Model navigator by name.
- *
+ *
* @author <a href="mailto:fjcano@prodevelop.es">Francisco Javier Cano Munoz</a>
- *
+ *
* @author cedric dumoulin
*/
-//@Unused
-//The QuickSearch feature is disabled since the new Search feature is available (0.10)
+// @Unused
+// The QuickSearch feature is disabled since the new Search feature is available (0.10)
public class NavigatorSearchDialog extends TrayDialog {
private ITreeContentProvider contentProvider = null;
@@ -95,9 +95,9 @@ public class NavigatorSearchDialog extends TrayDialog { private Button caseButton;
/**
- *
+ *
* Constructor.
- *
+ *
* @param shell
* @param modelNavigator
* @deprecated Use {@link #NavigatorSearchDialog(Shell, TreeViewer)}
@@ -106,20 +106,20 @@ public class NavigatorSearchDialog extends TrayDialog { public NavigatorSearchDialog(Shell shell, CommonNavigator modelNavigator) {
super(shell);
IContentProvider cprovider = modelNavigator.getCommonViewer().getContentProvider();
- if(cprovider instanceof ITreeContentProvider) {
- contentProvider = (ITreeContentProvider)cprovider;
+ if (cprovider instanceof ITreeContentProvider) {
+ contentProvider = (ITreeContentProvider) cprovider;
}
root = modelNavigator.getCommonViewer().getInput();
viewer = modelNavigator.getCommonViewer();
- labelProvider = (ILabelProvider)modelNavigator.getCommonViewer().getLabelProvider();
+ labelProvider = (ILabelProvider) modelNavigator.getCommonViewer().getLabelProvider();
}
/**
* Constructor.
- *
+ *
* @param shell
- * Shell used to show this Dialog
+ * Shell used to show this Dialog
* @param viewer
* @param contentProvider
* @param labelProvider
@@ -129,8 +129,8 @@ public class NavigatorSearchDialog extends TrayDialog { super(shell);
this.viewer = viewer;
try {
- this.labelProvider = (ILabelProvider)viewer.getLabelProvider();
- this.contentProvider = (ITreeContentProvider)viewer.getContentProvider();
+ this.labelProvider = (ILabelProvider) viewer.getLabelProvider();
+ this.contentProvider = (ITreeContentProvider) viewer.getContentProvider();
} catch (ClassCastException e) {
// Content or label provider are not of appropriate type.
// let them null
@@ -141,9 +141,9 @@ public class NavigatorSearchDialog extends TrayDialog { /**
* Constructor.
- *
+ *
* @param shell
- * Shell used to show this Dialog
+ * Shell used to show this Dialog
* @param viewer
* @param contentProvider
* @param labelProvider
@@ -162,29 +162,29 @@ public class NavigatorSearchDialog extends TrayDialog { * <p>
* Subclasses must implement this method.
* </p>
- *
+ *
* @param selection
- * the new selection
+ * the new selection
* @param reveal
- * <code>true</code> if the selection is to be made
- * visible, and <code>false</code> otherwise
+ * <code>true</code> if the selection is to be made
+ * visible, and <code>false</code> otherwise
*/
private void fireSetSelection(ISelection selection, boolean reveal) {
- // Note : if we want to force reveal, it is possible to check if
+ // Note : if we want to force reveal, it is possible to check if
// selectionProvider instanceof Viewer, and then call selectionProvider.setSelection(selection, true).
// By default a TreeViewer reveal the selection.
- if(viewer instanceof CommonViewer) {
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection)selection;
+ if (viewer instanceof CommonViewer) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structured = (IStructuredSelection) selection;
ModelExplorerView.reveal(Iterables.transform(Lists.newArrayList(structured.iterator()), new Function<Object, EObject>() {
public EObject apply(Object arg0) {
return EMFHelper.getEObject(arg0);
}
- }), (CommonViewer)viewer);
+ }), (CommonViewer) viewer);
}
- } else if(viewer instanceof Viewer) {
- Viewer view = (Viewer)viewer;
+ } else if (viewer instanceof Viewer) {
+ Viewer view = (Viewer) viewer;
view.setSelection(selection, true);
}
}
@@ -235,7 +235,7 @@ public class NavigatorSearchDialog extends TrayDialog { }
public void widgetSelected(SelectionEvent e) {
- if(currentIndex >= matchedObjects.size() - 1) {
+ if (currentIndex >= matchedObjects.size() - 1) {
currentIndex = 0;
} else {
currentIndex++;
@@ -251,7 +251,7 @@ public class NavigatorSearchDialog extends TrayDialog { }
public void widgetSelected(SelectionEvent e) {
- if(currentIndex <= 0) {
+ if (currentIndex <= 0) {
currentIndex = matchedObjects.size() - 1;
} else {
currentIndex--;
@@ -312,17 +312,17 @@ public class NavigatorSearchDialog extends TrayDialog { }
private void updateMatches() {
- if(contentProvider == null && labelProvider == null) {
+ if (contentProvider == null && labelProvider == null) {
return;
}
- String pattern = (String)searchText.getValue();
- if(pattern.length() == 0) {
+ String pattern = (String) searchText.getValue();
+ if (pattern.length() == 0) {
clearMatches();
return;
}
- if(!caseButton.getSelection()) {
+ if (!caseButton.getSelection()) {
pattern = pattern.toUpperCase();
}
@@ -332,7 +332,7 @@ public class NavigatorSearchDialog extends TrayDialog { matchesLabel.setText(matchedObjects.size() + " matches found");
// Select first match and update buttons
- if(!matchedObjects.isEmpty()) {
+ if (!matchedObjects.isEmpty()) {
fireSetSelection(new StructuredSelection(matchedObjects.get(0)), true);
nextButton.setEnabled(true);
backButton.setEnabled(true);
@@ -363,7 +363,7 @@ public class NavigatorSearchDialog extends TrayDialog { }
private List<Object> searchPattern(String pattern, boolean caseSensitive, List<Object> objects, IProgressMonitor monitor) {
- if(monitor.isCanceled()) {
+ if (monitor.isCanceled()) {
return Collections.emptyList();
}
@@ -372,38 +372,38 @@ public class NavigatorSearchDialog extends TrayDialog { List<Object> children = new ArrayList<Object>();
String objectLabel;
- for(Object o : objects) {
+ for (Object o : objects) {
// Search matches in this level
- if(!(o instanceof Diagram)) {
+ if (!(o instanceof Diagram)) {
objectLabel = caseSensitive ? labelProvider.getText(o) : labelProvider.getText(o).toUpperCase();
- if(objectLabel.contains(pattern)) {
+ if (objectLabel.contains(pattern)) {
matches.add(o);
}
EObject parentEObj = getAdapter(o, EObject.class);
- for(int i = 0; i < contentProvider.getChildren(o).length; i++) {
+ for (int i = 0; i < contentProvider.getChildren(o).length; i++) {
Object child = contentProvider.getChildren(o)[i];
- //If child can be adapted into a LinkNode, find its referenced EObjects
- if(getAdapter(child, LinkNode.class) != null) {
- for(Object referencedObject : contentProvider.getChildren(child)) {
+ // If child can be adapted into a LinkNode, find its referenced EObjects
+ if (getAdapter(child, LinkNode.class) != null) {
+ for (Object referencedObject : contentProvider.getChildren(child)) {
EObject referencedEObject = EMFHelper.getEObject(referencedObject);
- if(referencedEObject != null && (parentEObj == null || parentEObj.equals(referencedEObject.eContainer()))) {
+ if (referencedEObject != null && (parentEObj == null || parentEObj.equals(referencedEObject.eContainer()))) {
children.add(referencedObject);
}
}
}
- //If it is an EObject, add it to the list
+ // If it is an EObject, add it to the list
else {
EObject eObject = EMFHelper.getEObject(child);
- if(eObject != null && eObject.eContainer() != null && (parentEObj == null || eObject.eContainer().equals(parentEObj))) {
+ if (eObject != null && eObject.eContainer() != null && (parentEObj == null || eObject.eContainer().equals(parentEObj))) {
children.add(child);
}
}
}
}
}
- if(!children.isEmpty()) {
+ if (!children.isEmpty()) {
matches.addAll(searchPattern(pattern, caseSensitive, children, monitor));
}
@@ -413,12 +413,12 @@ public class NavigatorSearchDialog extends TrayDialog { @SuppressWarnings("unchecked")
public <T> T getAdapter(Object object, Class<? extends T> toAdapt) {
T result = null;
- if(object instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable)object;
- result = (T)adaptable.getAdapter(toAdapt);
+ if (object instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) object;
+ result = (T) adaptable.getAdapter(toAdapt);
}
- if(result == null) {
- result = (T)Platform.getAdapterManager().getAdapter(object, toAdapt);
+ if (result == null) {
+ result = (T) Platform.getAdapterManager().getAdapter(object, toAdapt);
}
return result;
}
@@ -429,8 +429,8 @@ public class NavigatorSearchDialog extends TrayDialog { private String lastValue = "";
public void commit(AbstractEditor editor) {
- String newValue = (String)searchText.getValue();
- if(!lastValue.equals(newValue)) {
+ String newValue = (String) searchText.getValue();
+ if (!lastValue.equals(newValue)) {
lastValue = newValue;
updateMatches();
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/PapyrusLoadBrowserCustomizationDialog.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/PapyrusLoadBrowserCustomizationDialog.java index a708955687e..e56200e96ea 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/PapyrusLoadBrowserCustomizationDialog.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dialog/PapyrusLoadBrowserCustomizationDialog.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,44 +13,19 @@ *****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.dialog;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EPackage;
-//import org.eclipse.papyrus.emf.facet.infra.browser.custom.MetamodelView;
-//import org.eclipse.papyrus.emf.facet.infra.browser.custom.core.CustomizationsCatalog;
-//import org.eclipse.papyrus.emf.facet.infra.browser.uicore.internal.util.ImageProvider;
-//import org.eclipse.papyrus.emf.facet.infra.common.core.internal.utils.ModelUtils;
-//import org.eclipse.papyrus.emf.facet.infra.facet.FacetSet;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.papyrus.infra.tools.util.ListHelper;
import org.eclipse.papyrus.infra.widgets.editors.IElementSelector;
import org.eclipse.papyrus.infra.widgets.editors.MultipleValueSelectorDialog;
-import org.eclipse.papyrus.infra.widgets.providers.FilteredContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
-import org.eclipse.papyrus.infra.widgets.providers.StaticContentProvider;
-import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
/**
* Papyrus implementation of the EMF Facet LoadBrowserCustomization
- *
+ *
* Adds a "restore default configuration" button
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
-//We still rely on EMF Facet 0.1 API, which is restricted and deprecated
+// We still rely on EMF Facet 0.1 API, which is restricted and deprecated
@SuppressWarnings({ "deprecation", "restriction" })
public class PapyrusLoadBrowserCustomizationDialog extends MultipleValueSelectorDialog {
@@ -59,237 +34,237 @@ public class PapyrusLoadBrowserCustomizationDialog extends MultipleValueSelector // TODO Auto-generated constructor stub
}
-///** protected final Collection<EPackage> ePackages;
-//
-// /**
-// * Creates a new dialog to select the EMF Facet uiCustom (Browser customizations) to apply
-// *
-// * @param parentShell
-// * The parent shell for this dialog
-// * @param initialSelection
-// * The list of browser customization currently applied
-// * @param ePackages
-// * The list of EPackages used to filter the Browser Customizations to display. Only compatible browser customizations will be displayed to
-// * the user.
-// * This filter is only graphical (i.e. customizations which do not match these EPackages might still be returned by this dialog)
-// * @param manager
-// * The Customization
-// */
-// public PapyrusLoadBrowserCustomizationDialog(Shell parentShell, List<MetamodelView> initialSelection, Collection<EPackage> ePackages) {
-// this(parentShell, getElementSelector(ePackages), initialSelection, ePackages);
-// }
-//
-// protected PapyrusLoadBrowserCustomizationDialog(Shell parentShell, IElementSelector selector, List<MetamodelView> initialSelection, Collection<EPackage> ePackages) {
-// super(parentShell, selector);
-//
-// this.ePackages = ePackages;
-//
-// setInitialElementSelections(initialSelection);
-//
-// setOrdered(true);
-// setLabelProvider(createLabelProvider());
-// setTitle("Select browser customizations");
-// }
-//
-// /**
-// * {@inheritDoc}
-// *
-// * Adds the EMF Facet UICustom icon to the dialog
-// */
-// @Override
-// protected void configureShell(Shell shell) {
-// super.configureShell(shell);
-// shell.setImage(ImageProvider.getInstance().getUiCustomIcon());
-// }
-//
-// /**
-// * The IElementSelector used for the left panel of this dialog. This is a simple ReferenceSelector for available UICustoms
-// *
-// * @param ePackages
-// * The EPackages used to filter the compatible UICustom to display to the user
-// * @return
-// */
-// protected static IElementSelector getElementSelector(final Collection<EPackage> ePackages) {
-// ReferenceSelector selector = new ReferenceSelector(true) {
-//
-// @Override
-// public void createControls(Composite parent) {
-// super.createControls(parent);
-// installCompatibleCustomizationViewerFilter(treeViewer, ePackages);
-// }
-// };
-//
-// List<MetamodelView> registryAllCustomizations = CustomizationsCatalog.getInstance().getRegistryCustomizations();
-//
-// IStaticContentProvider semanticProvider = new StaticContentProvider(registryAllCustomizations.toArray());
-// IStaticContentProvider filteredProvider = new FilteredContentProvider(semanticProvider);
-//
-// selector.setContentProvider(filteredProvider);
-// selector.setLabelProvider(createLabelProvider());
-//
-// return selector;
-// }
-//
-// /**
-// * The ID of the "Restore defaults" button
-// */
-// public static final int RESTORE_ID = IDialogConstants.CLIENT_ID + 1;
-//
-// /**
-// * {@inheritDoc}
-// *
-// * Adds a "restore defaults" button
-// */
-// @Override
-// protected void createButtonsForButtonBar(Composite parent) {
-// createButton(parent, RESTORE_ID, "Restore defaults", false);
-// super.createButtonsForButtonBar(parent);
-// }
-//
-// /**
-// * {@inheritDoc}
-// *
-// * Adds support for the Restore Default button/action
-// */
-// @Override
-// protected void buttonPressed(int buttonId) {
-// if(buttonId == RESTORE_ID) {
-// restorePressed();
-// } else {
-// super.buttonPressed(buttonId);
-// }
-// }
-//
-// /**
-// * {@inheritDoc}
-// *
-// * Installs a filter for the compatible UICustom models to display to the user
-// */
-// @Override
-// public void create() {
-// super.create();
-// installCompatibleCustomizationViewerFilter(selectedElementsViewer, ePackages);
-// getShell().pack();
-// }
-//
-// /**
-// * Install the compatible UICustom filter to the given viewer
-// *
-// * @param viewer
-// * The viewer to filter
-// * @param ePackages
-// * The UICustom models will be displayed if they are compatible with one of these EPackages
-// */
-// protected static void installCompatibleCustomizationViewerFilter(StructuredViewer viewer, Collection<EPackage> ePackages) {
-// List<ViewerFilter> currentFilters = ListHelper.asList(viewer.getFilters());
-// currentFilters.add(createCompatibleCustomizationViewerFilter(ePackages));
-// viewer.setFilters(currentFilters.toArray(new ViewerFilter[currentFilters.size()]));
-// }
-//
-// /**
-// * Creates a filter for the compatible UICustom
-// *
-// * @param ePackages
-// * The UICustom models will be displayed if they are compatible with one of these EPackages
-// */
-// protected static ViewerFilter createCompatibleCustomizationViewerFilter(Collection<EPackage> ePackages) {
-// final Set<String> ePackageURIs = new HashSet<String>();
-//
-// for(EPackage ePackage : ePackages) {
-// ePackageURIs.add(ePackage.getNsURI());
-// final Set<EPackage> referencedPackages = ModelUtils.computeReferencedPackages(ePackage);
-// for(EPackage referencedEPackage : referencedPackages) {
-// ePackageURIs.add(referencedEPackage.getNsURI());
-// }
-// }
-//
-// return new ViewerFilter() {
-//
-// @Override
-// public boolean select(Viewer viewer, Object parentElement, Object element) {
-// if(element instanceof MetamodelView) {
-// MetamodelView customization = (MetamodelView)element;
-//
-// String nsURI = customization.getMetamodelURI();
-//
-// if(ePackageURIs.contains(nsURI)) {
-// return true;
-// }
-//
-// EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI);
-// while(ePackage != null) {
-// if(ePackageURIs.contains(ePackage.getNsURI())) {
-// return true;
-// }
-//
-// // allow customizations on Facets
-// if(ePackage instanceof FacetSet) {
-// FacetSet facetSet = (FacetSet)ePackage;
-// ePackage = facetSet.getExtendedPackage();
-// } else {
-// // allow customizations on sub-packages
-// ePackage = ePackage.getESuperPackage();
-// }
-// }
-//
-// return false;
-// }
-//
-// return true;
-// }
-//
-// };
-// }
-//
-// /**
-// * The "restore defaults" action
-// */
-// protected void restorePressed() {
-// List<MetamodelView> defaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
-// Object[] filteredCustomizations = defaultCustomizations.toArray();
-//
-// removeAllAction();
-// addElements(filteredCustomizations);
-// selector.setSelectedElements(allElements.toArray());
-// }
-//
-// /**
-// * Returns the list of selected customizations (including the ones hidden by the compatible EPackage filter)
-// *
-// * @return
-// */
-// public List<MetamodelView> getSelectedCustomizations() {
-// Object[] result = super.getResult();
-// List<MetamodelView> customizations = new ArrayList<MetamodelView>();
-// for(Object element : result) {
-// if(element instanceof MetamodelView) {
-// customizations.add((MetamodelView)element);
-// }
-// }
-//
-// return customizations;
-// }
-//
-// //Copied from {@link org.eclipse.papyrus.emf.facet.infra.browser.custom.ui.dialogs.LoadCustomizationsDialog#createLabelProvider()}
-// /**
-// * Creates a LabelProvider for EMF Facet MetamodelView elements
-// *
-// * @return the label provider for the Dialog
-// */
-// protected static ILabelProvider createLabelProvider() {
-// return new LabelProvider() {
-//
-// @Override
-// public String getText(final Object element) {
-// final MetamodelView metamodelView = (MetamodelView)element;
-// return metamodelView.getName();
-// }
-//
-// @Override
-// public Image getImage(final Object element) {
-// return ImageProvider.getInstance().getUiCustomIcon();
-// }
-// };
-// }
+ // /** protected final Collection<EPackage> ePackages;
+ //
+ // /**
+ // * Creates a new dialog to select the EMF Facet uiCustom (Browser customizations) to apply
+ // *
+ // * @param parentShell
+ // * The parent shell for this dialog
+ // * @param initialSelection
+ // * The list of browser customization currently applied
+ // * @param ePackages
+ // * The list of EPackages used to filter the Browser Customizations to display. Only compatible browser customizations will be displayed to
+ // * the user.
+ // * This filter is only graphical (i.e. customizations which do not match these EPackages might still be returned by this dialog)
+ // * @param manager
+ // * The Customization
+ // */
+ // public PapyrusLoadBrowserCustomizationDialog(Shell parentShell, List<MetamodelView> initialSelection, Collection<EPackage> ePackages) {
+ // this(parentShell, getElementSelector(ePackages), initialSelection, ePackages);
+ // }
+ //
+ // protected PapyrusLoadBrowserCustomizationDialog(Shell parentShell, IElementSelector selector, List<MetamodelView> initialSelection, Collection<EPackage> ePackages) {
+ // super(parentShell, selector);
+ //
+ // this.ePackages = ePackages;
+ //
+ // setInitialElementSelections(initialSelection);
+ //
+ // setOrdered(true);
+ // setLabelProvider(createLabelProvider());
+ // setTitle("Select browser customizations");
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * Adds the EMF Facet UICustom icon to the dialog
+ // */
+ // @Override
+ // protected void configureShell(Shell shell) {
+ // super.configureShell(shell);
+ // shell.setImage(ImageProvider.getInstance().getUiCustomIcon());
+ // }
+ //
+ // /**
+ // * The IElementSelector used for the left panel of this dialog. This is a simple ReferenceSelector for available UICustoms
+ // *
+ // * @param ePackages
+ // * The EPackages used to filter the compatible UICustom to display to the user
+ // * @return
+ // */
+ // protected static IElementSelector getElementSelector(final Collection<EPackage> ePackages) {
+ // ReferenceSelector selector = new ReferenceSelector(true) {
+ //
+ // @Override
+ // public void createControls(Composite parent) {
+ // super.createControls(parent);
+ // installCompatibleCustomizationViewerFilter(treeViewer, ePackages);
+ // }
+ // };
+ //
+ // List<MetamodelView> registryAllCustomizations = CustomizationsCatalog.getInstance().getRegistryCustomizations();
+ //
+ // IStaticContentProvider semanticProvider = new StaticContentProvider(registryAllCustomizations.toArray());
+ // IStaticContentProvider filteredProvider = new FilteredContentProvider(semanticProvider);
+ //
+ // selector.setContentProvider(filteredProvider);
+ // selector.setLabelProvider(createLabelProvider());
+ //
+ // return selector;
+ // }
+ //
+ // /**
+ // * The ID of the "Restore defaults" button
+ // */
+ // public static final int RESTORE_ID = IDialogConstants.CLIENT_ID + 1;
+ //
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * Adds a "restore defaults" button
+ // */
+ // @Override
+ // protected void createButtonsForButtonBar(Composite parent) {
+ // createButton(parent, RESTORE_ID, "Restore defaults", false);
+ // super.createButtonsForButtonBar(parent);
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * Adds support for the Restore Default button/action
+ // */
+ // @Override
+ // protected void buttonPressed(int buttonId) {
+ // if(buttonId == RESTORE_ID) {
+ // restorePressed();
+ // } else {
+ // super.buttonPressed(buttonId);
+ // }
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * Installs a filter for the compatible UICustom models to display to the user
+ // */
+ // @Override
+ // public void create() {
+ // super.create();
+ // installCompatibleCustomizationViewerFilter(selectedElementsViewer, ePackages);
+ // getShell().pack();
+ // }
+ //
+ // /**
+ // * Install the compatible UICustom filter to the given viewer
+ // *
+ // * @param viewer
+ // * The viewer to filter
+ // * @param ePackages
+ // * The UICustom models will be displayed if they are compatible with one of these EPackages
+ // */
+ // protected static void installCompatibleCustomizationViewerFilter(StructuredViewer viewer, Collection<EPackage> ePackages) {
+ // List<ViewerFilter> currentFilters = ListHelper.asList(viewer.getFilters());
+ // currentFilters.add(createCompatibleCustomizationViewerFilter(ePackages));
+ // viewer.setFilters(currentFilters.toArray(new ViewerFilter[currentFilters.size()]));
+ // }
+ //
+ // /**
+ // * Creates a filter for the compatible UICustom
+ // *
+ // * @param ePackages
+ // * The UICustom models will be displayed if they are compatible with one of these EPackages
+ // */
+ // protected static ViewerFilter createCompatibleCustomizationViewerFilter(Collection<EPackage> ePackages) {
+ // final Set<String> ePackageURIs = new HashSet<String>();
+ //
+ // for(EPackage ePackage : ePackages) {
+ // ePackageURIs.add(ePackage.getNsURI());
+ // final Set<EPackage> referencedPackages = ModelUtils.computeReferencedPackages(ePackage);
+ // for(EPackage referencedEPackage : referencedPackages) {
+ // ePackageURIs.add(referencedEPackage.getNsURI());
+ // }
+ // }
+ //
+ // return new ViewerFilter() {
+ //
+ // @Override
+ // public boolean select(Viewer viewer, Object parentElement, Object element) {
+ // if(element instanceof MetamodelView) {
+ // MetamodelView customization = (MetamodelView)element;
+ //
+ // String nsURI = customization.getMetamodelURI();
+ //
+ // if(ePackageURIs.contains(nsURI)) {
+ // return true;
+ // }
+ //
+ // EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI);
+ // while(ePackage != null) {
+ // if(ePackageURIs.contains(ePackage.getNsURI())) {
+ // return true;
+ // }
+ //
+ // // allow customizations on Facets
+ // if(ePackage instanceof FacetSet) {
+ // FacetSet facetSet = (FacetSet)ePackage;
+ // ePackage = facetSet.getExtendedPackage();
+ // } else {
+ // // allow customizations on sub-packages
+ // ePackage = ePackage.getESuperPackage();
+ // }
+ // }
+ //
+ // return false;
+ // }
+ //
+ // return true;
+ // }
+ //
+ // };
+ // }
+ //
+ // /**
+ // * The "restore defaults" action
+ // */
+ // protected void restorePressed() {
+ // List<MetamodelView> defaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ // Object[] filteredCustomizations = defaultCustomizations.toArray();
+ //
+ // removeAllAction();
+ // addElements(filteredCustomizations);
+ // selector.setSelectedElements(allElements.toArray());
+ // }
+ //
+ // /**
+ // * Returns the list of selected customizations (including the ones hidden by the compatible EPackage filter)
+ // *
+ // * @return
+ // */
+ // public List<MetamodelView> getSelectedCustomizations() {
+ // Object[] result = super.getResult();
+ // List<MetamodelView> customizations = new ArrayList<MetamodelView>();
+ // for(Object element : result) {
+ // if(element instanceof MetamodelView) {
+ // customizations.add((MetamodelView)element);
+ // }
+ // }
+ //
+ // return customizations;
+ // }
+ //
+ // //Copied from {@link org.eclipse.papyrus.emf.facet.infra.browser.custom.ui.dialogs.LoadCustomizationsDialog#createLabelProvider()}
+ // /**
+ // * Creates a LabelProvider for EMF Facet MetamodelView elements
+ // *
+ // * @return the label provider for the Dialog
+ // */
+ // protected static ILabelProvider createLabelProvider() {
+ // return new LabelProvider() {
+ //
+ // @Override
+ // public String getText(final Object element) {
+ // final MetamodelView metamodelView = (MetamodelView)element;
+ // return metamodelView.getName();
+ // }
+ //
+ // @Override
+ // public Image getImage(final Object element) {
+ // return ImageProvider.getInstance().getUiCustomIcon();
+ // }
+ // };
+ // }
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java index 8e7cbb4a10e..7c5a684346c 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/CommonDropAdapterAssistant.java @@ -84,24 +84,24 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * if the parameter eref is null,It will look for the good role of the child eobject * * @param domain - * the Transactional Domain , cannot be null + * the Transactional Domain , cannot be null * @param targetOwner - * the eobject that will contain the drop object, cannot be null + * the eobject that will contain the drop object, cannot be null * @param childElement - * that we want to move, cannot be null + * that we want to move, cannot be null * @param the - * EREFERENCE for the role of the child element, can be null + * EREFERENCE for the role of the child element, can be null * @return the list of commands to to the drop */ protected List<Command> getDropIntoCommand(TransactionalEditingDomain domain, EObject targetOwner, EObject childElement, EReference eref) { ArrayList<Command> commandList = new ArrayList<Command>(); MoveRequest moveRequest = new MoveRequest(targetOwner, childElement); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetOwner); - if(provider != null) { + if (provider != null) { // Retrieve delete command from the Element Edit service ICommand command = provider.getEditCommand(moveRequest); - if(command != null) { + if (command != null) { commandList.add(new GMFtoEMFCommandWrapper(command)); } @@ -122,11 +122,11 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * get a list that contains command to move a view into a new element * * @param domain - * the transactionnal edit domain, cannot be null + * the transactionnal edit domain, cannot be null * @param target - * the target of the drop, cannot be null + * the target of the drop, cannot be null * @param view - * the diagram that will move, cannot be null + * the diagram that will move, cannot be null * @return a list that contains one command to move the diagram */ protected Command getDropViewCommands(TransactionalEditingDomain domain, EObject target, EObject view) { @@ -143,10 +143,10 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD // Retrieve reassignment command from the Element Edit service Command command = proto.getCommandChangeOwner(view, target); - if(command != null) { + if (command != null) { Resource targetNotationResource = getTargetNotationResource(target); - if(targetNotationResource != null) { - if(!targetNotationResource.equals(view.eResource())) { + if (targetNotationResource != null) { + if (!targetNotationResource.equals(view.eResource())) { List<Command> list = new ArrayList<Command>(); list.add(command); list.add(new GMFtoEMFCommandWrapper(new MoveOpenableCommand(domain, "", view, targetNotationResource))); @@ -162,8 +162,8 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD } protected Resource getTargetNotationResource(EObject targetOwner) { - if(targetOwner.eResource() != null && targetOwner.eResource().getResourceSet() instanceof ModelSet) { - ModelSet modelSet = (ModelSet)targetOwner.eResource().getResourceSet(); + if (targetOwner.eResource() != null && targetOwner.eResource().getResourceSet() instanceof ModelSet) { + ModelSet modelSet = (ModelSet) targetOwner.eResource().getResourceSet(); return modelSet.getAssociatedResource(targetOwner, NotationModel.NOTATION_FILE_EXTENSION); } return null; @@ -174,13 +174,13 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * It will look for the good role of the child eobject * * @param domain - * the Transactional Domain, cannot be null + * the Transactional Domain, cannot be null * @param targetOwner - * the eobject that will contain the drop object , cannot be null + * the eobject that will contain the drop object , cannot be null * @param objectLocation - * the object where we want to drop the object + * the object where we want to drop the object * @param newElement - * that we want to move, cannot be null + * that we want to move, cannot be null * @return the list of commands to to the drop */ protected List<Command> getOrderChangeCommand(TransactionalEditingDomain domain, EObject targetOwner, EObject objectLocation, EObject newElement, boolean before) { @@ -189,21 +189,21 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD EList<EStructuralFeature> featureList = targetOwner.eClass().getEAllStructuralFeatures(); // Abort when trying to change order moving the element in one of its children - if(EcoreUtil.isAncestor(newElement, targetOwner)) { + if (EcoreUtil.isAncestor(newElement, targetOwner)) { return Collections.emptyList(); } - //find the feature between childreen and owner + // find the feature between childreen and owner Iterator<EStructuralFeature> iterator = featureList.iterator(); - while(iterator.hasNext()) { + while (iterator.hasNext()) { EStructuralFeature eStructuralFeature = iterator.next(); - if(eStructuralFeature instanceof EReference) { - EReference ref = (EReference)eStructuralFeature; + if (eStructuralFeature instanceof EReference) { + EReference ref = (EReference) eStructuralFeature; - if(ref.isContainment()) { + if (ref.isContainment()) { - if(isSubClass(ref.getEType(), newElement.eClass())) { + if (isSubClass(ref.getEType(), newElement.eClass())) { possibleEFeatures.add(eStructuralFeature); } @@ -211,24 +211,24 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD } } - //create the command + // create the command Iterator<EStructuralFeature> iteratorFeature = possibleEFeatures.iterator(); - while(iteratorFeature.hasNext()) { + while (iteratorFeature.hasNext()) { EStructuralFeature eStructuralFeature = iteratorFeature.next(); ArrayList<EObject> tmp = new ArrayList<EObject>(); - if(targetOwner.eGet(eStructuralFeature) instanceof Collection<?>) { - //get all element of this efeature - tmp.addAll((Collection<EObject>)targetOwner.eGet(eStructuralFeature)); + if (targetOwner.eGet(eStructuralFeature) instanceof Collection<?>) { + // get all element of this efeature + tmp.addAll((Collection<EObject>) targetOwner.eGet(eStructuralFeature)); - if(!newElement.equals(objectLocation)) { + if (!newElement.equals(objectLocation)) { tmp.remove(newElement); - //normally tmp.indexOf(objectLocation)!= -1 - //if this the case objectlocation=new element and - //it has been removed + // normally tmp.indexOf(objectLocation)!= -1 + // if this the case objectlocation=new element and + // it has been removed int indexObject = tmp.indexOf(objectLocation); - if(before && indexObject != -1) { + if (before && indexObject != -1) { tmp.add(tmp.indexOf(objectLocation), newElement); - } else if(!before && indexObject != -1) { + } else if (!before && indexObject != -1) { tmp.add(tmp.indexOf(objectLocation) + 1, newElement); } } @@ -238,11 +238,11 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD SetRequest setRequest = new SetRequest(targetOwner, eStructuralFeature, tmp); IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetOwner); - if(provider != null) { + if (provider != null) { // Retrieve delete command from the Element Edit service ICommand command = provider.getEditCommand(setRequest); - if(command != null) { + if (command != null) { commandList.add(new GMFtoEMFCommandWrapper(command)); } } @@ -258,32 +258,32 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * get the list of good command by taking in account if this is a change order or a drop into * * @param target - * the target object of the drop + * the target object of the drop * @return the list of command */ public CompoundCommand getDrop(Object target) { CommonDropAdapter dropAdapter = getCommonDropAdapter(); List<Command> commandList = new ArrayList<Command>(); - switch(dropAdapter.getCurrentOperation()) { + switch (dropAdapter.getCurrentOperation()) { case DND.DROP_MOVE: - if(dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_BEFORE) { - if(target instanceof EObjectTreeElement) { + if (dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_BEFORE) { + if (target instanceof EObjectTreeElement) { commandList = getOrderChangeCommand(target, true); } - } else if(dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_AFTER) { - if(target instanceof EObjectTreeElement) { + } else if (dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_AFTER) { + if (target instanceof EObjectTreeElement) { commandList = getOrderChangeCommand(target, false); } - } else if(dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_ON) { - if(target instanceof EObjectTreeElement) { + } else if (dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_ON) { + if (target instanceof EObjectTreeElement) { commandList = getDropIntoCommand(target, null); } - if(target instanceof EReferenceTreeElement) { - commandList = getDropIntoCommand(((EReferenceTreeElement)target).getParent(), ((EReferenceTreeElement)target).getEReference()); + if (target instanceof EReferenceTreeElement) { + commandList = getDropIntoCommand(((EReferenceTreeElement) target).getParent(), ((EReferenceTreeElement) target).getEReference()); } } - else if(dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_NONE) { + else if (dropAdapter.getCurrentLocation() == ViewerDropAdapter.LOCATION_NONE) { } break; } @@ -294,17 +294,17 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * Test if a possibleSub eclass is a sub eclass * * @param aclass - * , cannot be null + * , cannot be null * @param possibleSubClasse - * , cannot be null + * , cannot be null * @return true if possible eclass is a subtype of a eclass or false */ public boolean isSubClass(EClassifier aclass, EClass possibleSubClasse) { - if(aclass.equals(possibleSubClasse)) { + if (aclass.equals(possibleSubClasse)) { return true; } EList<EClass> superTypeList = possibleSubClasse.getEAllSuperTypes(); - if(superTypeList.contains(aclass)) { + if (superTypeList.contains(aclass)) { return true; } return false; @@ -313,7 +313,7 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD @Override public IStatus validateDrop(Object target, int operation, TransferData transferType) { Command dropCommand = getDrop(target); - if(dropCommand.canExecute()) { + if (dropCommand.canExecute()) { return Status.OK_STATUS; } return Status.CANCEL_STATUS; @@ -323,36 +323,36 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * get the list of commands to drop an element * * @param target - * , can be null but do nothing + * , can be null but do nothing * @param the - * role where there is a drop ( can be null) + * role where there is a drop ( can be null) * @return the list of the commands */ protected List<Command> getDropIntoCommand(final Object target, EReference eref) { - //init + // init ArrayList<Command> result = new ArrayList<Command>(); EObject targetEObject = null; targetEObject = EMFHelper.getEObject(target); - if(targetEObject == null) { + if (targetEObject == null) { return result; } - //get Command from the selection + // get Command from the selection ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); - if(selection instanceof IStructuredSelection) { - List<?> selectedElements = ((IStructuredSelection)selection).toList(); + if (selection instanceof IStructuredSelection) { + List<?> selectedElements = ((IStructuredSelection) selection).toList(); Iterator<?> it = selectedElements.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Object object = it.next(); EObject eObjectchild = EMFHelper.getEObject(object); - if(ViewPrototype.isViewObject(eObjectchild) && getEditors(targetEObject).contains(eObjectchild)) { + if (ViewPrototype.isViewObject(eObjectchild) && getEditors(targetEObject).contains(eObjectchild)) { result.add(getDropViewCommands(getEditingDomain(targetEObject), targetEObject, eObjectchild)); } - //test if object is an eobject - else if(eObjectchild != null) { + // test if object is an eobject + else if (eObjectchild != null) { result.addAll(getDropIntoCommand(getEditingDomain(targetEObject), targetEObject, eObjectchild, eref)); } @@ -379,33 +379,33 @@ public class CommonDropAdapterAssistant extends org.eclipse.ui.navigator.CommonD * get the list of commands to drop an element * * @param target - * , can be null but do nothing + * , can be null but do nothing * @return the list of the commands */ protected List<Command> getOrderChangeCommand(final Object target, boolean before) { - //init + // init ArrayList<Command> result = new ArrayList<Command>(); EObject objectLocation = null; EObject objectOwner = null; objectLocation = EMFHelper.getEObject(target); - if(objectLocation == null) { + if (objectLocation == null) { return result; } objectOwner = objectLocation.eContainer(); - //get Command from the selection + // get Command from the selection ISelection selection = LocalSelectionTransfer.getTransfer().getSelection(); - if(selection instanceof IStructuredSelection) { - List<?> selectedElements = ((IStructuredSelection)selection).toList(); + if (selection instanceof IStructuredSelection) { + List<?> selectedElements = ((IStructuredSelection) selection).toList(); Iterator<?> it = selectedElements.iterator(); - while(it.hasNext()) { + while (it.hasNext()) { Object object = it.next(); EObject eObjectchild = EMFHelper.getEObject(object); - //test if object is an eobject - if(eObjectchild != null && objectOwner != null) { + // test if object is an eobject + if (eObjectchild != null && objectOwner != null) { result.addAll(getOrderChangeCommand(getEditingDomain(eObjectchild), objectOwner, objectLocation, eObjectchild, before)); } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/EObjectDragAdapterAssistant.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/EObjectDragAdapterAssistant.java index ff0c2ac8d35..b1eb452f496 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/EObjectDragAdapterAssistant.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/dnd/EObjectDragAdapterAssistant.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,28 +28,27 @@ import org.eclipse.ui.navigator.CommonDragAdapterAssistant; /**
* This class allows to provides Drag&Drop between the Model Explorer and the Tables (or others View/Editors)
- *
- *
- *
+ *
+ *
+ *
*/
public class EObjectDragAdapterAssistant extends CommonDragAdapterAssistant {
/**
- *
+ *
* @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#getSupportedTransferTypes()
- *
+ *
* @return
*/
@Override
public Transfer[] getSupportedTransferTypes() {
- return new Transfer[]{ LocalTransfer.getInstance() };
+ return new Transfer[] { LocalTransfer.getInstance() };
}
/**
- *
- * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#setDragData(org.eclipse.swt.dnd.DragSourceEvent,
- * org.eclipse.jface.viewers.IStructuredSelection)
- *
+ *
+ * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#setDragData(org.eclipse.swt.dnd.DragSourceEvent, org.eclipse.jface.viewers.IStructuredSelection)
+ *
* @param anEvent
* @param aSelection
* @return
@@ -59,15 +58,15 @@ public class EObjectDragAdapterAssistant extends CommonDragAdapterAssistant { Iterator<?> iter = aSelection.iterator();
List<Object> selectedElements = new ArrayList<Object>();
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
Object current = iter.next();
- EObject eobject =EMFHelper.getEObject(current);
- if(eobject != null) {
- selectedElements.add(eobject);
- }
+ EObject eobject = EMFHelper.getEObject(current);
+ if (eobject != null) {
+ selectedElements.add(eobject);
+ }
}
- if(!selectedElements.isEmpty()) {
+ if (!selectedElements.isEmpty()) {
anEvent.data = new StructuredSelection(selectedElements);
}
return anEvent.data != null;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/factory/IActionHandlerFactory.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/factory/IActionHandlerFactory.java index 4594dad6c12..f7b62b54277 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/factory/IActionHandlerFactory.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/factory/IActionHandlerFactory.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2009 Atos Origin.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import org.eclipse.ui.navigator.CommonNavigator; /**
* A factory for creating Action objects from org.eclipse.jface.action
- *
+ *
* @deprecated The actions should be written using the Eclipse Framework (org.eclipse.ui.menu, org.eclipse.ui.handler, org.eclipse.ui.command)
*/
@Deprecated
@@ -31,42 +31,42 @@ public interface IActionHandlerFactory { /**
* Creates a new IActionHandler object.
- *
+ *
* @param editingDomain
- * the editing domain
- *
+ * the editing domain
+ *
* @return the list of created actions
*/
List<Action> createActions(EditingDomain editingDomain);
/**
* Gets the actions.
- *
+ *
* @return the actions list
*/
List<Action> getActions();
/**
* Activate the action.
- *
+ *
* @param activeViewPart
- * the active view part
+ * the active view part
*/
void activate(CommonNavigator activeViewPart);
/**
* Deactivate the action.
- *
+ *
* @param activeViewPart
- * the active view part
+ * the active view part
*/
void deactivate(CommonNavigator activeViewPart);
/**
* Update action from the selection
- *
+ *
* @param structuredSelection
- * the structured selection
+ * the structured selection
*/
void update(IStructuredSelection structuredSelection);
@@ -76,9 +76,9 @@ public interface IActionHandlerFactory { * <p>
* The default implementation does nothing.
* </p>
- *
+ *
* @param actionBars
- * the part's action bars
+ * the part's action bars
*/
void fillActionBars(IActionBars actionBars);
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java index a28069085ec..bf7c84411d9 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractCommandHandler.java @@ -55,7 +55,7 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle *
* Returns the command to execute (to be implemented
* in children implementing this class)
- *
+ *
* @return the command to execute
*
* </pre>
@@ -70,7 +70,7 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle * <pre>
* Get the selected element, the first selected element if several are selected or null
* if no selection or the selection is not an {@link EObject}.
- *
+ *
* @return selected {@link EObject} or null
* </pre>
*
@@ -82,13 +82,13 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle List<?> selection = getSelection();
// Treat non-null selected object (try to adapt and return EObject)
- if(!selection.isEmpty()) {
+ if (!selection.isEmpty()) {
// Get first element if the selection is an IStructuredSelection
- Object first = selection.get(0); + Object first = selection.get(0);
EObject businessObject = EMFHelper.getEObject(first);
- if(businessObject != null) {
+ if (businessObject != null) {
eObject = businessObject;
}
}
@@ -100,10 +100,10 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle * <pre>
* Parse current selection and extract the list of {@link EObject} from
* this selection.
- *
+ *
* This also tries to adapt selected element into {@link EObject}
* (for example to get the {@link EObject} from a selection in the ModelExplorer).
- *
+ *
* @return a list of currently selected {@link EObject}
* </pre>
*
@@ -116,14 +116,14 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle Collection<?> selection = getSelection();
// Treat non-null selected object (try to adapt and return EObject)
- if(!selection.isEmpty()) {
+ if (!selection.isEmpty()) {
// Parse current selection
- for(Object current : selection) {
+ for (Object current : selection) {
// Adapt current selection to EObject
EObject selectedEObject = EMFHelper.getEObject(current);
- if(selectedEObject != null) {
- //we avoid to add null element in the list!
+ if (selectedEObject != null) {
+ // we avoid to add null element in the list!
selectedEObjects.add(selectedEObject);
}
}
@@ -143,7 +143,7 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle public Object execute(ExecutionEvent event) throws ExecutionException {
try {
ISelection selection = HandlerUtil.getCurrentSelection(event);
- this.selection = (selection instanceof IStructuredSelection) ? ((IStructuredSelection)selection).toList() : Collections.EMPTY_LIST;
+ this.selection = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).toList() : Collections.EMPTY_LIST;
ServiceUtilsForHandlers.getInstance().getTransactionalEditingDomain(event).getCommandStack().execute(getCommand());
} catch (ServiceException e) {
@@ -160,7 +160,7 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle boolean result = false;
Command command = getCommand();
- if(command != null) {
+ if (command != null) {
result = getCommand().canExecute();
command.dispose();
}
@@ -170,10 +170,10 @@ public abstract class AbstractCommandHandler extends AbstractModelExplorerHandle @Override
public void setEnabled(Object evaluationContext) {
- if(evaluationContext instanceof IEvaluationContext) {
- Object selection = ((IEvaluationContext)evaluationContext).getDefaultVariable();
- if(selection instanceof Collection<?>) {
- this.selection = (selection instanceof List<?>) ? (List<?>)selection : new java.util.ArrayList<Object>((Collection<?>)selection);
+ if (evaluationContext instanceof IEvaluationContext) {
+ Object selection = ((IEvaluationContext) evaluationContext).getDefaultVariable();
+ if (selection instanceof Collection<?>) {
+ this.selection = (selection instanceof List<?>) ? (List<?>) selection : new java.util.ArrayList<Object>((Collection<?>) selection);
setBaseEnabled(computeEnabled());
this.selection = Collections.EMPTY_LIST;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java index 1978a0b1930..e58fd269246 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/AbstractModelExplorerHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,7 +19,6 @@ import java.util.List; import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -34,15 +33,15 @@ import org.eclipse.ui.handlers.HandlerUtil; /**
* This provides facilities to get the TransactionEditingDomain and the PageManager from the Model Explorer
- *
- *
- *
+ *
+ *
+ *
*/
public abstract class AbstractModelExplorerHandler extends AbstractHandler {
/**
* Returns the
- *
+ *
* @return
* the current editing domain
*/
@@ -51,15 +50,15 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { try {
editingDomain = org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers.getInstance().getTransactionalEditingDomain();
} catch (ServiceException e) {
- //we are closing the editor, so the model explorer has nothing to display
- // e.printStackTrace();
+ // we are closing the editor, so the model explorer has nothing to display
+ // e.printStackTrace();
}
return editingDomain;
}
/**
* Returns the page manager
- *
+ *
* @return
* the page manager
*/
@@ -68,8 +67,8 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { try {
pageManager = ServiceUtilsForActionHandlers.getInstance().getIPageManager();
} catch (ServiceException e) {
- //we are closing the editor, so the model explorer has nothing to display
- // e.printStackTrace();
+ // we are closing the editor, so the model explorer has nothing to display
+ // e.printStackTrace();
}
return pageManager;
}
@@ -77,7 +76,7 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { /**
* Adapt the specified object to the requested type, if possible.
* Return null if the object can't be adapted.
- *
+ *
* @param object
* @param expectedClassType
* @return The adapted object, or null.
@@ -88,26 +87,26 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { EObject eobject = EMFHelper.getEObject(object);
- if(eobject != null && expectedClassType.isInstance(eobject)) {
- return (T)eobject;
+ if (eobject != null && expectedClassType.isInstance(eobject)) {
+ return (T) eobject;
}
// Try global mechanism
{
- T ele = (T)Platform.getAdapterManager().getAdapter(object, expectedClassType);
- if(ele != null) {
+ T ele = (T) Platform.getAdapterManager().getAdapter(object, expectedClassType);
+ if (ele != null) {
return ele;
}
// Try as EObject if the expectedClasType is sub-type of EObject.
- if(EObject.class.isAssignableFrom(expectedClassType)) {
+ if (EObject.class.isAssignableFrom(expectedClassType)) {
// to EObject
- eobject = (EObject)Platform.getAdapterManager().getAdapter(object, EObject.class);
+ eobject = (EObject) Platform.getAdapterManager().getAdapter(object, EObject.class);
- if(eobject != null && expectedClassType.isInstance(eobject)) {
+ if (eobject != null && expectedClassType.isInstance(eobject)) {
- return (T)eobject;
+ return (T) eobject;
}
}
}
@@ -118,7 +117,7 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { /**
* Filter the list, and only retain objects that can be adapted to the specified type
- *
+ *
* @param objects
* @param class1
* @return
@@ -127,10 +126,10 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { List<T> res = new ArrayList<T>();
- for(Object cur : list) {
+ for (Object cur : list) {
T adapted = adapt(cur, expectedClassType);
- if(adapted != null) {
+ if (adapted != null) {
res.add(adapted);
}
}
@@ -139,7 +138,7 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { /**
* Get all selected element of the specified type.
- *
+ *
* @param expectedType
* @return
* @throws ExecutionException
@@ -151,11 +150,11 @@ public abstract class AbstractModelExplorerHandler extends AbstractHandler { ISelection selection = HandlerUtil.getCurrentSelectionChecked(event);
// Get the selected objects according to the type of the selected
- if(selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
return getAllElementAdaptedToType(structuredSelection.toList(), expectedType);
- } else if(selection instanceof TreeSelection) {
- TreeSelection treeSelection = (TreeSelection)selection;
+ } else if (selection instanceof TreeSelection) {
+ TreeSelection treeSelection = (TreeSelection) selection;
return getAllElementAdaptedToType(treeSelection.toList(), expectedType);
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java index 204b8312b33..396afa0cc23 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CloseHandler.java @@ -72,7 +72,7 @@ public class CloseHandler extends AbstractModelExplorerHandler implements IExecu }
// What kind of command ?
- if(PARAMETER_ALL.equals(parameter)) {
+ if (PARAMETER_ALL.equals(parameter)) {
pageMngr.closeAllOpenedPages();
return null;
@@ -82,14 +82,14 @@ public class CloseHandler extends AbstractModelExplorerHandler implements IExecu // There is no common type for object representing an editor. So,
// We try to get the EObject, and try to close it as an Editor.
List<EObject> selectedProperties = getCurrentSelectionAdaptedToType(event, EObject.class);
- if(selectedProperties == null) {
+ if (selectedProperties == null) {
// nothing to do
return null;
}
// Check each selected object
- for(EObject selected : selectedProperties) {
- if(pageMngr.isOpen(selected)) {
+ for (EObject selected : selectedProperties) {
+ if (pageMngr.isOpen(selected)) {
pageMngr.closePage(selected);
}
}
@@ -99,8 +99,7 @@ public class CloseHandler extends AbstractModelExplorerHandler implements IExecu /**
*
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String,
- * java.lang.Object)
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
*
* @param config
* @param propertyName
@@ -108,8 +107,8 @@ public class CloseHandler extends AbstractModelExplorerHandler implements IExecu * @throws CoreException
*/
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- if(data instanceof Hashtable && this.parameterID != null) {
- this.parameter = (String)((Hashtable)data).get(this.parameterID);
+ if (data instanceof Hashtable && this.parameterID != null) {
+ this.parameter = (String) ((Hashtable) data).get(this.parameterID);
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java index 7fd2a8382c8..3f290618e37 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CopyHandler.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2011, 2014 CEA LIST and others. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -32,51 +32,57 @@ public class CopyHandler extends AbstractCommandHandler { /** * Check if the selection allow copy + * * @param selectedElements * @return */ public static boolean isCopyEnabled(Collection<EObject> selectedElements) { return !selectedElements.isEmpty(); - } + } /** * Construct copy command from the selection + * * @param editingDomain * @param selectedElements * @return */ public static Command buildCopyCommand(TransactionalEditingDomain editingDomain, Collection<EObject> selectedElements) { PapyrusClipboard<Object> papyrusClipboard = PapyrusClipboard.getNewInstance(); - DefaultCopyCommand defaultCopyCommand = new DefaultCopyCommand(editingDomain, papyrusClipboard, selectedElements); + DefaultCopyCommand defaultCopyCommand = new DefaultCopyCommand(editingDomain, papyrusClipboard, selectedElements); List<IStrategy> allStrategies = PasteStrategyManager.getInstance().getAllStrategies(); - for(IStrategy iStrategy : allStrategies) { - IPasteStrategy iPasteStrategy = (IPasteStrategy)iStrategy; + for (IStrategy iStrategy : allStrategies) { + IPasteStrategy iPasteStrategy = (IPasteStrategy) iStrategy; iPasteStrategy.prepare(papyrusClipboard, selectedElements); } - return defaultCopyCommand; + return defaultCopyCommand; } - + /** - * + * * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand() - * + * * @return */ @Override protected Command getCommand() { - return buildCopyCommand(getEditingDomain(),getSelectedElements()); + return buildCopyCommand(getEditingDomain(), getSelectedElements()); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#computeEnabled() */ @Override protected boolean computeEnabled() { // copy is enable as long as there is an EObject to put in the Clipboard return isCopyEnabled(getSelectedElements()); } - - /* (non-Javadoc) + + /* + * (non-Javadoc) + * * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#setEnabled(java.lang.Object) */ @Override @@ -85,5 +91,5 @@ public class CopyHandler extends AbstractCommandHandler { super.setEnabled(evaluationContext); // setenabled should'nt clear/modify the clipboard PapyrusClipboard.setInstance(instance); } - + } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CutHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CutHandler.java index 4567e2afa28..470696acc4b 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CutHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/CutHandler.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2011 CEA LIST. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,14 +22,14 @@ import org.eclipse.papyrus.infra.core.clipboard.PapyrusClipboard; /** * Handler for the Cut Action in Model Explorer : it's a copy followed by a delete - * + * */ public class CutHandler extends AbstractCommandHandler { /** - * + * * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand() - * + * * @return */ @Override @@ -51,7 +51,7 @@ public class CutHandler extends AbstractCommandHandler { return CopyHandler.isCopyEnabled(selectedElements) && DeleteCommandHandler.isDeleteEnabled(selectedElements); } - + /* * (non-Javadoc) * diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java index 12692ac5fa1..4dc3bf4e7b8 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/DeleteCommandHandler.java @@ -1,14 +1,14 @@ /***************************************************************************** * Copyright (c) 2010, 2014 CEA LIST and others. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation * *****************************************************************************/ @@ -35,35 +35,36 @@ import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; /** * Default handler for Delete command used in the ModelExplorer contextual menu. - * + * */ public class DeleteCommandHandler extends AbstractCommandHandler implements IHandler { - + /** * Check if the selection allow delete + * * @param selectedElements * @return */ public static boolean isDeleteEnabled(Collection<EObject> selectedElements) { - if(selectedElements.size() == 0) { + if (selectedElements.size() == 0) { return false; } - - for(EObject current : selectedElements) { - if(EMFHelper.isReadOnly(current)) { + + for (EObject current : selectedElements) { + if (EMFHelper.isReadOnly(current)) { return false; } - //the root of the model can't be deleted! - if(current.eContainer() == null) { + // the root of the model can't be deleted! + if (current.eContainer() == null) { try { - //Pages can be deleted even when they are root elements + // Pages can be deleted even when they are root elements IPageManager pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(current); - if(pageManager.allPages().contains(current)) { + if (pageManager.allPages().contains(current)) { return true; } } catch (ServiceException ex) { - //Cannot retrieve the ServicesRegistry: ignore + // Cannot retrieve the ServicesRegistry: ignore } return false; } @@ -73,18 +74,18 @@ public class DeleteCommandHandler extends AbstractCommandHandler implements IHan // it can be WAY too slow... return true; } - + /** * <pre> - * + * * Build the delete command for a set of EObject selected in the ModelExplorer. - * The delete command is given by the {@link IElementEditService} of selected + * The delete command is given by the {@link IElementEditService} of selected * elements. * @param selectedElements elements to delete * @return the composite deletion command for current selection * * @TODO : Manage possible Diagrams listed in the selection - * + * * </pre> */ public static Command buildDeleteCommand(Collection<EObject> selectedElements) { @@ -95,14 +96,14 @@ public class DeleteCommandHandler extends AbstractCommandHandler implements IHan // if multiple elements are selected for deletion. Map parameters = new HashMap(); - for(EObject selectedEObject : selectedElements) { + for (EObject selectedEObject : selectedElements) { - if(selectedEObject == null) { + if (selectedEObject == null) { continue; } IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); - if(provider == null) { + if (provider == null) { continue; } @@ -122,24 +123,24 @@ public class DeleteCommandHandler extends AbstractCommandHandler implements IHan parameters.putAll(request.getParameters()); } - if(gmfCommand == null) { + if (gmfCommand == null) { return UnexecutableCommand.INSTANCE; } return GMFtoEMFCommandWrapper.wrap(gmfCommand.reduce()); } - - + + /** - * + * * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand() - * + * * @return current command (only built here when the stored command is null) */ @Override protected Command getCommand() { // Don't cache the command, as it is no more refreshed by isEnabled(). - return buildDeleteCommand( getSelectedElements()); + return buildDeleteCommand(getSelectedElements()); } /** diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java index 639ad3136e2..8e801b061ad 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/LoadBrowserCustomization.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,21 +14,14 @@ package org.eclipse.papyrus.views.modelexplorer.handler;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
//import org.eclipse.papyrus.emf.facet.infra.browser.Messages;
//import org.eclipse.papyrus.emf.facet.infra.browser.custom.MetamodelView;
//import org.eclipse.papyrus.emf.facet.infra.browser.custom.TypeView;
@@ -37,8 +30,6 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; //import org.eclipse.papyrus.emf.facet.infra.facet.FacetSet;
//import org.eclipse.papyrus.emf.facet.infra.facet.core.FacetSetCatalog;
import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManager;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
@@ -52,14 +43,12 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager; import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.services.semantic.service.SemanticService;
import org.eclipse.papyrus.views.modelexplorer.Activator;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.papyrus.views.modelexplorer.dialog.PapyrusLoadBrowserCustomizationDialog;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.navigator.CommonNavigator;
@@ -71,17 +60,17 @@ import org.eclipse.ui.navigator.CommonNavigator; public class LoadBrowserCustomization extends AbstractHandler {
/**
- *
- *
+ *
+ *
* @return the common navigator
*/
protected CommonNavigator getCommonNavigator() {
IViewPart part = org.eclipse.papyrus.views.modelexplorer.NavigatorUtils.findViewPart(ModelExplorerPageBookView.VIEW_ID);
// the part is only a book, retrieving correct page
- if(part instanceof ModelExplorerPageBookView) {
- IViewPart page = ((ModelExplorerPageBookView)part).getActiveView();
- if(page instanceof CommonNavigator) {
- return ((CommonNavigator)page);
+ if (part instanceof ModelExplorerPageBookView) {
+ IViewPart page = ((ModelExplorerPageBookView) part).getActiveView();
+ if (page instanceof CommonNavigator) {
+ return ((CommonNavigator) page);
}
}
return null;
@@ -92,7 +81,7 @@ public class LoadBrowserCustomization extends AbstractHandler { */
public Object execute(ExecutionEvent event) throws ExecutionException {
- if(Activator.getDefault().getCustomizationManager() != null) {
+ if (Activator.getDefault().getCustomizationManager() != null) {
ICustomizationManager customizationManager = Activator.getDefault().getCustomizationManager();
final List<Customization> registeredCustomizations = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(customizationManager.getResourceSet()).getRegisteredCustomizations();
@@ -100,7 +89,7 @@ public class LoadBrowserCustomization extends AbstractHandler { Shell shell = HandlerUtil.getActiveShell(event);
- IDialogCallbackWithPreCommit<List<Customization>, Boolean, Dialog> dialogCallBack= new IDialogCallbackWithPreCommit<List<Customization>, Boolean, Dialog>() {
+ IDialogCallbackWithPreCommit<List<Customization>, Boolean, Dialog> dialogCallBack = new IDialogCallbackWithPreCommit<List<Customization>, Boolean, Dialog>() {
public void committed(List<Customization> result, Boolean precommitResult) {
// TODO Auto-generated method stub
@@ -112,20 +101,20 @@ public class LoadBrowserCustomization extends AbstractHandler { return null;
}
};
- ILoadCustomizationsDialog dialog=ILoadCustomizationsDialogFactory.DEFAULT.createLoadCustomizationDialog(shell, registeredCustomizations, customizationManager.getManagedCustomizations(), dialogCallBack);
+ ILoadCustomizationsDialog dialog = ILoadCustomizationsDialogFactory.DEFAULT.createLoadCustomizationDialog(shell, registeredCustomizations, customizationManager.getManagedCustomizations(), dialogCallBack);
- if(Window.OK == dialog.open()) {
+ if (Window.OK == dialog.open()) {
customizationManager.getManagedCustomizations().clear();
- customizationManager.getManagedCustomizations().addAll( dialog.getSelectedCustomizations());
+ customizationManager.getManagedCustomizations().addAll(dialog.getSelectedCustomizations());
- //Save the current state of the customizations
+ // Save the current state of the customizations
org.eclipse.papyrus.infra.emf.Activator.getDefault().saveCustomizationManagerState();
}
- // // load customizations defined as default through the customization
- // // extension
- if(getCommonNavigator() != null) {
+ // // load customizations defined as default through the customization
+ // // extension
+ if (getCommonNavigator() != null) {
getCommonNavigator().getCommonViewer().refresh();
}
}
@@ -134,82 +123,82 @@ public class LoadBrowserCustomization extends AbstractHandler { }
/**
- *
+ *
* @return the RessourceSet
*/
private ModelSet getModelSet() {
return ModelUtils.getModelSet();
}
- // /**
- // * load the facets
- // *
- // * @param customizations
- // * list of customization
- // * @param customizationManager
- // * the Customization Manager
- // */
- // protected void loadFacetsForCustomizations(final List<MetamodelView> customizations, final CustomizationManager customizationManager) {
- // final Set<Facet> referencedFacets = new HashSet<Facet>();
- // final Collection<FacetSet> facetSets = FacetSetCatalog.getSingleton().getAllFacetSets();
+ // /**
+ // * load the facets
+ // *
+ // * @param customizations
+ // * list of customization
+ // * @param customizationManager
+ // * the Customization Manager
+ // */
+ // protected void loadFacetsForCustomizations(final List<MetamodelView> customizations, final CustomizationManager customizationManager) {
+ // final Set<Facet> referencedFacets = new HashSet<Facet>();
+ // final Collection<FacetSet> facetSets = FacetSetCatalog.getSingleton().getAllFacetSets();
//
- // for(MetamodelView customization : customizations) {
- // String metamodelURI = customization.getMetamodelURI();
- // // find customized FacetSet
- // FacetSet customizedFacetSet = null;
- // if(metamodelURI != null) {
- // for(FacetSet facetSet : facetSets) {
- // if(metamodelURI.equals(facetSet.getNsURI())) {
- // customizedFacetSet = facetSet;
- // break;
- // }
- // }
- // }
- // if(customizedFacetSet == null) {
- // continue;
- // }
+ // for(MetamodelView customization : customizations) {
+ // String metamodelURI = customization.getMetamodelURI();
+ // // find customized FacetSet
+ // FacetSet customizedFacetSet = null;
+ // if(metamodelURI != null) {
+ // for(FacetSet facetSet : facetSets) {
+ // if(metamodelURI.equals(facetSet.getNsURI())) {
+ // customizedFacetSet = facetSet;
+ // break;
+ // }
+ // }
+ // }
+ // if(customizedFacetSet == null) {
+ // continue;
+ // }
//
- // // find customized Facets
- // EList<TypeView> types = customization.getTypes();
- // for(TypeView typeView : types) {
- // String metaclassName = typeView.getMetaclassName();
- // Facet facet = findFacetWithFullyQualifiedName(metaclassName, customizedFacetSet);
- // if(facet != null) {
- // referencedFacets.add(facet);
- // } else {
- // Activator.log.warn(NLS.bind(Messages.BrowserActionBarContributor_missingRequiredFacet, new Object[]{ metaclassName, customizedFacetSet.getName(), customization.getName() }));
- // }
- // }
+ // // find customized Facets
+ // EList<TypeView> types = customization.getTypes();
+ // for(TypeView typeView : types) {
+ // String metaclassName = typeView.getMetaclassName();
+ // Facet facet = findFacetWithFullyQualifiedName(metaclassName, customizedFacetSet);
+ // if(facet != null) {
+ // referencedFacets.add(facet);
+ // } else {
+ // Activator.log.warn(NLS.bind(Messages.BrowserActionBarContributor_missingRequiredFacet, new Object[]{ metaclassName, customizedFacetSet.getName(), customization.getName() }));
+ // }
+ // }
//
- // for(Facet referencedFacet : referencedFacets) {
- // customizationManager.loadFacet(referencedFacet);
- // }
- // }
+ // for(Facet referencedFacet : referencedFacets) {
+ // customizationManager.loadFacet(referencedFacet);
+ // }
+ // }
//
// for modified facets
// customizationManager.getInstancesForMetaclasses().buildDerivationTree();
// customizationManager.getAppearanceConfiguration().touch();
// customizationManager.refreshDelayed(true);
- //}
+ // }
- // /**
- // * fin a facet from
- // *
- // * @param metaclassName
- // * @param customizedFacetSet
- // * @return
- // */
- // private Facet findFacetWithFullyQualifiedName(final String metaclassName, final FacetSet customizedFacetSet) {
- // EList<Facet> facets = customizedFacetSet.getFacets();
- // for(Facet facet : facets) {
- // String facetName = getMetaclassQualifiedName(facet);
- // if(metaclassName.equals(facetName)) {
- // return facet;
- // }
- // }
- // return null;
- // }
+ // /**
+ // * fin a facet from
+ // *
+ // * @param metaclassName
+ // * @param customizedFacetSet
+ // * @return
+ // */
+ // private Facet findFacetWithFullyQualifiedName(final String metaclassName, final FacetSet customizedFacetSet) {
+ // EList<Facet> facets = customizedFacetSet.getFacets();
+ // for(Facet facet : facets) {
+ // String facetName = getMetaclassQualifiedName(facet);
+ // if(metaclassName.equals(facetName)) {
+ // return facet;
+ // }
+ // }
+ // return null;
+ // }
/** @return the qualified name of the given metaclass */
public static String getMetaclassQualifiedName(final EClassifier eClass) {
@@ -217,12 +206,12 @@ public class LoadBrowserCustomization extends AbstractHandler { final StringBuilder builder = new StringBuilder();
EPackage ePackage = eClass.getEPackage();
- while(ePackage != null) {
+ while (ePackage != null) {
qualifiedNameParts.add(ePackage.getName());
ePackage = ePackage.getESuperPackage();
}
- for(int i = qualifiedNameParts.size() - 1; i >= 0; i--) {
+ for (int i = qualifiedNameParts.size() - 1; i >= 0; i--) {
builder.append(qualifiedNameParts.get(i) + "."); //$NON-NLS-1$
}
@@ -231,26 +220,26 @@ public class LoadBrowserCustomization extends AbstractHandler { return builder.toString();
}
- // /**
- // * Get the metmodel URI
- // * **/
- //@Unused
- // private String getMetamodelURI() {
+ // /**
+ // * Get the metmodel URI
+ // * **/
+ // @Unused
+ // private String getMetamodelURI() {
//
- // try {
- // EList<EObject> contents = UmlUtils.getUmlResource(getModelSet()).getContents();
- // if(contents.size() > 0) {
- // EObject eObject = contents.get(0);
- // EClass eClass = eObject.eClass();
- // if(eClass != null) {
- // return eClass.getEPackage().getNsURI();
- // }
- // }
- // } catch (Exception e) {
- // Activator.log.error(e);
- // }
+ // try {
+ // EList<EObject> contents = UmlUtils.getUmlResource(getModelSet()).getContents();
+ // if(contents.size() > 0) {
+ // EObject eObject = contents.get(0);
+ // EClass eClass = eObject.eClass();
+ // if(eClass != null) {
+ // return eClass.getEPackage().getNsURI();
+ // }
+ // }
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
// return ""; //$NON-NLS-1$
- // }
+ // }
/**
* Get the metmodel URI
@@ -266,10 +255,10 @@ public class LoadBrowserCustomization extends AbstractHandler { try {
pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
List<Object> pages = pageMngr.allPages();
- for(int i = 0; i < pages.size(); i++) {
- if(pages.get(i) instanceof EObject) {
- EPackage ePackage = ((EObject)pages.get(i)).eClass().getEPackage();
- if(!ePackages.contains(ePackage)) {
+ for (int i = 0; i < pages.size(); i++) {
+ if (pages.get(i) instanceof EObject) {
+ EPackage ePackage = ((EObject) pages.get(i)).eClass().getEPackage();
+ if (!ePackages.contains(ePackage)) {
ePackages.add(ePackage);
}
}
@@ -280,11 +269,11 @@ public class LoadBrowserCustomization extends AbstractHandler { try {
SemanticService semantic = serviceRegistry.getService(SemanticService.class);
- for(EObject rootElement : semantic.getSemanticRoots()) {
+ for (EObject rootElement : semantic.getSemanticRoots()) {
EClass eClass = rootElement.eClass();
- if(eClass != null) {
+ if (eClass != null) {
EPackage ePackage = eClass.getEPackage();
- if(!ePackages.contains(ePackage)) {
+ if (!ePackages.contains(ePackage)) {
ePackages.add(eClass.getEPackage());
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java index b10fd991f07..3d388d13aeb 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/OpenHandler.java @@ -62,7 +62,7 @@ public class OpenHandler extends AbstractModelExplorerHandler implements IExecut */
public Object execute(ExecutionEvent event) throws ExecutionException {
final IPageManager pageManager = getPageManager();
- if(pageManager == null) {
+ if (pageManager == null) {
return null;
}
@@ -70,7 +70,7 @@ public class OpenHandler extends AbstractModelExplorerHandler implements IExecut // There is no common type for object representing an editor. So,
// We try to get the EObject, and try to close it as an Editor.
List<EObject> selectedProperties = getCurrentSelectionAdaptedToType(event, EObject.class);
- if(selectedProperties == null) {
+ if (selectedProperties == null) {
// nothing to do
return null;
}
@@ -78,9 +78,10 @@ public class OpenHandler extends AbstractModelExplorerHandler implements IExecut // Check each selected object
final List<EObject> pagesToOpen = new LinkedList<EObject>();
List<EObject> pagesToSelect = new LinkedList<EObject>();
- for(EObject selected : selectedProperties) {
- if (!canOpenByPolicy(selected))
+ for (EObject selected : selectedProperties) {
+ if (!canOpenByPolicy(selected)) {
continue;
+ }
if (!pageManager.isOpen(selected) || isDuplicateDiagramAllowed) {
pagesToOpen.add(selected);
} else {
@@ -88,13 +89,13 @@ public class OpenHandler extends AbstractModelExplorerHandler implements IExecut }
}
- if(!pagesToOpen.isEmpty()) {
- for(EObject page : pagesToOpen) {
+ if (!pagesToOpen.isEmpty()) {
+ for (EObject page : pagesToOpen) {
pageManager.openPage(page);
}
}
- for(EObject page : pagesToSelect) {
+ for (EObject page : pagesToSelect) {
pageManager.selectPage(page);
}
@@ -103,22 +104,23 @@ public class OpenHandler extends AbstractModelExplorerHandler implements IExecut /**
* Determines whether the current policy allows this object to be opened
- * @param selection The object to open
+ *
+ * @param selection
+ * The object to open
* @return <code>true</code> if the object can be opened
*/
private boolean canOpenByPolicy(EObject selection) {
if (selection instanceof Diagram) {
- Diagram diagram = (Diagram)selection;
+ Diagram diagram = (Diagram) selection;
ViewPrototype proto = DiagramUtils.getPrototype(diagram);
return (proto != ViewPrototype.UNAVAILABLE_VIEW && proto != ViewPrototype.UNAVAILABLE_DIAGRAM);
}
return true;
}
-
+
/**
- *
- * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String,
- * java.lang.Object)
+ *
+ * @see org.eclipse.core.runtime.IExecutableExtension#setInitializationData(org.eclipse.core.runtime.IConfigurationElement, java.lang.String, java.lang.Object)
*
* @param config
* @param propertyName
@@ -126,15 +128,15 @@ public class OpenHandler extends AbstractModelExplorerHandler implements IExecut * @throws CoreException
*/
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- if(!(data instanceof Hashtable)) {
+ if (!(data instanceof Hashtable)) {
return;
}
@SuppressWarnings("rawtypes")
- Hashtable map = (Hashtable)data;
+ Hashtable map = (Hashtable) data;
try {
- isDuplicateDiagramAllowed = Boolean.parseBoolean((String)map.get(IS_DUPLICATE_EDITOR_ALLOWED_PARAMETER));
+ isDuplicateDiagramAllowed = Boolean.parseBoolean((String) map.get(IS_DUPLICATE_EDITOR_ALLOWED_PARAMETER));
} catch (Exception e) {
// silently fail;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java index 43c4d7263b6..2cfb8d82c86 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/PasteHandler.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2011 CEA LIST. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,7 @@ * * Contributors: * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation - * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Use paste strategy + * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Use paste strategy *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.handler; @@ -27,7 +27,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.strategy.paste.PasteStrategyMana /** * Handler for the Paste Action - * + * */ public class PasteHandler extends AbstractCommandHandler { @@ -42,12 +42,12 @@ public class PasteHandler extends AbstractCommandHandler { List<IStrategy> allStrategies = PasteStrategyManager.getInstance() .getAllActiveStrategies(); - if (selection.size() == 1) { //Paste is only available on a simple selection + if (selection.size() == 1) { // Paste is only available on a simple selection CompoundCommand compoundCommand = new CompoundCommand(); for (IStrategy iStrategy : allStrategies) { Command emfCommand = ((IPasteStrategy) iStrategy) .getSemanticCommand(getEditingDomain(), selection.get(0), PapyrusClipboard.getInstance()); - if (emfCommand!=null) { + if (emfCommand != null) { compoundCommand.append(emfCommand); } } @@ -56,15 +56,17 @@ public class PasteHandler extends AbstractCommandHandler { return UnexecutableCommand.INSTANCE; } - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#computeEnabled() */ @Override protected boolean computeEnabled() { // paste is only available on a simple selection and with a non empty Clipboard - if (!PapyrusClipboard.getInstance().isEmptyWithNoAdditionalData() && getSelectedElements().size() == 1){ + if (!PapyrusClipboard.getInstance().isEmptyWithNoAdditionalData() && getSelectedElements().size() == 1) { return !EMFHelper.isReadOnly(getSelectedElements().get(0)); } else { return super.computeEnabled(); - } + } } } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/RedoHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/RedoHandler.java index 18e00ac5a38..226a0058ab3 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/RedoHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/RedoHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,17 +18,17 @@ import org.eclipse.core.commands.ExecutionException; /**
* Handler for the Redo Action
- *
- *
- *
+ *
+ *
+ *
*/
public class RedoHandler extends AbstractModelExplorerHandler {
/**
- *
+ *
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
+ *
* @param event
* @return
* @throws ExecutionException
@@ -39,9 +39,9 @@ public class RedoHandler extends AbstractModelExplorerHandler { }
/**
- *
+ *
* @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
+ *
* @return
*/
@Override
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SearchElementHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SearchElementHandler.java index 4d06d128dc2..77ff0ba8bb5 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SearchElementHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SearchElementHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,15 +30,15 @@ import org.eclipse.ui.navigator.CommonNavigator; /**
* this handler is used to look for element
- *
+ *
*/
-//@Unused
-//The QuickSearch feature is disabled since the new Search feature is available (0.10)
+// @Unused
+// The QuickSearch feature is disabled since the new Search feature is available (0.10)
public class SearchElementHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = HandlerUtil.getActiveShell(event);
- if(shell == null) {
+ if (shell == null) {
return null;
}
NavigatorSearchDialog dialog = new NavigatorSearchDialog(shell, getSelectedTreeViewer(event));
@@ -52,24 +52,24 @@ public class SearchElementHandler extends AbstractHandler { // Try to get the active part
// Try to get the TreeViewer from the evaluation context
- if(event.getApplicationContext() instanceof EvaluationContext) {
- EvaluationContext context = (EvaluationContext)event.getApplicationContext();
+ if (event.getApplicationContext() instanceof EvaluationContext) {
+ EvaluationContext context = (EvaluationContext) event.getApplicationContext();
// activeEditor, activeSite, selection, activeShell, activePart
Object site = context.getVariable("activeSite");
- activePart = (IWorkbenchPart)context.getVariable("activePart");
+ activePart = (IWorkbenchPart) context.getVariable("activePart");
} else {
activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
}
- if(activePart instanceof TreeViewer) {
- return (TreeViewer)activePart;
+ if (activePart instanceof TreeViewer) {
+ return (TreeViewer) activePart;
}
- if(activePart instanceof MultiViewPageBookView) {
- MultiViewPageBookView pageBookView = (MultiViewPageBookView)activePart;
+ if (activePart instanceof MultiViewPageBookView) {
+ MultiViewPageBookView pageBookView = (MultiViewPageBookView) activePart;
IViewPart viewPart = pageBookView.getActiveView();
- if(viewPart instanceof ModelExplorerView) {
- return ((ModelExplorerView)viewPart).getCommonViewer();
+ if (viewPart instanceof ModelExplorerView) {
+ return ((ModelExplorerView) viewPart).getCommonViewer();
}
}
@@ -79,8 +79,8 @@ public class SearchElementHandler extends AbstractHandler { protected CommonNavigator getCommonNavigator() {
IViewPart part = org.eclipse.papyrus.views.modelexplorer.NavigatorUtils.findViewPart("org.eclipse.papyrus.views.modelexplorer.modelexplorer");
- if(part instanceof CommonNavigator) {
- return ((CommonNavigator)part);
+ if (part instanceof CommonNavigator) {
+ return ((CommonNavigator) part);
}
return null;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementHandler.java index a20ad573ad3..dad8af09cad 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010, 2014 CEA LIST and others.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -35,8 +35,8 @@ public class SortElementHandler extends AbstractHandler { * {@inheritDoc}
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
- if(Activator.getDefault().getCustomizationManager() != null) {
- final boolean isSorted = ((ToolItem)((Event)event.getTrigger()).widget).getSelection();
+ if (Activator.getDefault().getCustomizationManager() != null) {
+ final boolean isSorted = ((ToolItem) ((Event) event.getTrigger()).widget).getSelection();
getTreeViewerSorting(event).setSorted(isSorted);
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementState.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementState.java index f833919d477..4dff066ec6e 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementState.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/SortElementState.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2014 CEA and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -44,9 +44,9 @@ public class SortElementState extends State implements IExecutableExtension { public Object getValue() { IWorkbench bench = PlatformUI.getWorkbench(); IWorkbenchWindow window = bench.getActiveWorkbenchWindow(); - if(window == null) { + if (window == null) { // Not actually active? - if(bench.getWorkbenchWindowCount() > 0) { + if (bench.getWorkbenchWindowCount() > 0) { window = bench.getWorkbenchWindows()[0]; } } @@ -60,7 +60,7 @@ public class SortElementState extends State implements IExecutableExtension { public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { viewID = getViewID(config, propertyName, data); - if(viewID == null) { + if (viewID == null) { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "No viewID specified in SortElementState extension.")); //$NON-NLS-1$ } } @@ -68,15 +68,15 @@ public class SortElementState extends State implements IExecutableExtension { static String getViewID(IConfigurationElement config, String propertyName, Object data) { String result = null; - if(data instanceof String) { + if (data instanceof String) { // It's the view ID - result = (String)data; + result = (String) data; } else { // It's a parameter map - Map<?, ?> parameters = (Map<?, ?>)data; + Map<?, ?> parameters = (Map<?, ?>) data; Object value = parameters.get("viewID"); - if(value instanceof String) { - result = (String)value; + if (value instanceof String) { + result = (String) value; } } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/UndoHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/UndoHandler.java index 2b4b95a523e..ae2d0154d26 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/UndoHandler.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/handler/UndoHandler.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,16 +18,16 @@ import org.eclipse.core.commands.ExecutionException; /**
* Handler for the Undo Action
- *
- *
- *
+ *
+ *
+ *
*/
public class UndoHandler extends AbstractModelExplorerHandler {
/**
- *
+ *
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
+ *
* @param event
* @return
* @throws ExecutionException
@@ -38,9 +38,9 @@ public class UndoHandler extends AbstractModelExplorerHandler { }
/**
- *
+ *
* @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
+ *
* @return
*/
@Override
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java index 4c966806402..94fffe5d831 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/listener/DoubleClickListener.java @@ -51,7 +51,7 @@ public class DoubleClickListener implements IDoubleClickListener { public void doubleClick(DoubleClickEvent event) {
ISelection selection = event.getSelection();
final IPageManager pageManager;
- //get the page Manager
+ // get the page Manager
try {
pageManager = ServiceUtils.getInstance().getIPageManager(servicesRegistry);
} catch (Exception e) {
@@ -59,19 +59,19 @@ public class DoubleClickListener implements IDoubleClickListener { return;
}
- if(pageManager != null) {
- if(selection instanceof IStructuredSelection) {
- Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ if (pageManager != null) {
+ if (selection instanceof IStructuredSelection) {
+ Iterator<?> iter = ((IStructuredSelection) selection).iterator();
final List<EObject> pagesToOpen = new LinkedList<EObject>();
EObject pageToSelect = null;
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
Object currentObject = iter.next();
EObject diag = EMFHelper.getEObject(currentObject);
- if(isPage(diag, pageManager)) {
- //Note that Diagram migration is triggered by the Diagram Editor.
- //Try to open the diagram, even if it is currently invalid. The editor might be able to repair it
- if(pageManager.isOpen(diag)) {
+ if (isPage(diag, pageManager)) {
+ // Note that Diagram migration is triggered by the Diagram Editor.
+ // Try to open the diagram, even if it is currently invalid. The editor might be able to repair it
+ if (pageManager.isOpen(diag)) {
pageToSelect = diag;
} else {
pagesToOpen.add(diag);
@@ -79,11 +79,11 @@ public class DoubleClickListener implements IDoubleClickListener { }
}
- if(!pagesToOpen.isEmpty()) {
- for(EObject page : pagesToOpen) {
+ if (!pagesToOpen.isEmpty()) {
+ for (EObject page : pagesToOpen) {
pageManager.openPage(page);
}
- } else if(pageToSelect != null) {
+ } else if (pageToSelect != null) {
pageManager.selectPage(pageToSelect);
}
}
@@ -92,7 +92,7 @@ public class DoubleClickListener implements IDoubleClickListener { }
protected boolean isPage(EObject element, IPageManager pageManager) {
- if(pageManager.allPages().contains(element)) {
+ if (pageManager.allPages().contains(element)) {
return true;
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/HashCodeCalculus.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/HashCodeCalculus.java index 08f9c81351b..0485633ac1a 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/HashCodeCalculus.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/HashCodeCalculus.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2014 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,19 +17,21 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference;
/**
- * This code is used to ensure the same way to calculate hashcode
+ * This code is used to ensure the same way to calculate hashcode
+ *
* @author PT202707
*
*/
public class HashCodeCalculus {
-
- public static int getHashCode(EObject eObject){
+
+ public static int getHashCode(EObject eObject) {
return eObject.hashCode();
}
- public static int getHashCode(EObject eObject , EReference eref){
+
+ public static int getHashCode(EObject eObject, EReference eref) {
final int hashPrime1 = 47;
final int hashPrime2 = 13;
return eref.hashCode() * hashPrime1 + eObject.hashCode() + hashPrime2;
-
+
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IMatchingItem.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IMatchingItem.java index 81fb5d13965..5b90c3afa8d 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IMatchingItem.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IMatchingItem.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 Atos
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,25 +19,25 @@ package org.eclipse.papyrus.views.modelexplorer.matching; * to match an existing facet item in a facet viewer.
* To do that each implementation mimics the behavior of the equals and hashCode methods
* of the corresponding items.
- *
+ *
* @author mvelten
* @author proland
- *
+ *
*/
public interface IMatchingItem {
/**
* Mimics the corresponding class's equals method
- *
+ *
* @param obj
- * the object to match
+ * the object to match
* @return true if the match is successful
*/
public boolean matchingItemEquals(Object obj);
/**
* Mimics the corresponding class's hashcode method
- *
+ *
* @return the hashcode
*/
public int matchingItemHashcode();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IReferencable.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IReferencable.java index e0fd28a4075..dddb0916ea0 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IReferencable.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/IReferencable.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 Atos
*
- *
+ *
* 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
@@ -16,11 +16,11 @@ package org.eclipse.papyrus.views.modelexplorer.matching; /**
* This interface can be implemented by facet objects to offer access to
- * an underlying object. This referenced object will be used in the matching algo
- * when using the synchronize feature for example.
- *
+ * an underlying object. This referenced object will be used in the matching algo
+ * when using the synchronize feature for example.
+ *
* @author proland
- *
+ *
*/
public interface IReferencable {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/LinkItemMatchingItem.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/LinkItemMatchingItem.java index 77608a3586c..0698f2791b0 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/LinkItemMatchingItem.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/LinkItemMatchingItem.java @@ -35,9 +35,9 @@ public class LinkItemMatchingItem implements IMatchingItem { }
public boolean matchingItemEquals(Object obj) {
- if(obj instanceof EReferenceTreeElement) {
- if(ref != null && parent != null) {
- EReferenceTreeElement other = (EReferenceTreeElement)obj;
+ if (obj instanceof EReferenceTreeElement) {
+ if (ref != null && parent != null) {
+ EReferenceTreeElement other = (EReferenceTreeElement) obj;
EObject semanticParent = other.getParent().getEObject();
EReference otherReference = other.getEReference();
return parent == semanticParent && ref == otherReference;
@@ -47,7 +47,7 @@ public class LinkItemMatchingItem implements IMatchingItem { }
public int matchingItemHashcode() {
- if(ref != null && parent != null) {
+ if (ref != null && parent != null) {
return HashCodeCalculus.getHashCode(parent, ref);
}
return 0;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ModelElementItemMatchingItem.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ModelElementItemMatchingItem.java index ad12db3a7e1..63db563cbe1 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ModelElementItemMatchingItem.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ModelElementItemMatchingItem.java @@ -31,14 +31,14 @@ public class ModelElementItemMatchingItem implements IMatchingItem { }
public boolean matchingItemEquals(Object obj) {
- if(element != null && obj instanceof EObjectTreeElement) {
- return element == ((EObjectTreeElement)obj).getEObject();
+ if (element != null && obj instanceof EObjectTreeElement) {
+ return element == ((EObjectTreeElement) obj).getEObject();
}
return super.equals(obj);
}
public int matchingItemHashcode() {
- if(element != null) {
+ if (element != null) {
return HashCodeCalculus.getHashCode(element);
}
return 0;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ReferencableMatchingItem.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ReferencableMatchingItem.java index ddff5d1e718..011f9f9664c 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ReferencableMatchingItem.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/matching/ReferencableMatchingItem.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 Atos
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@ package org.eclipse.papyrus.views.modelexplorer.matching; /***
* An IMatchingItem implementation that matches for IReferencables
- *
+ *
* @author proland
*/
public class ReferencableMatchingItem implements IMatchingItem {
@@ -29,15 +29,15 @@ public class ReferencableMatchingItem implements IMatchingItem { }
public boolean matchingItemEquals(Object obj) {
- if(obj instanceof IReferencable) {
- IReferencable referencable = (IReferencable)obj;
+ if (obj instanceof IReferencable) {
+ IReferencable referencable = (IReferencable) obj;
return referencable.getElementBehind().equals(object);
}
return super.equals(obj);
}
public int matchingItemHashcode() {
- if(object != null) {
+ if (object != null) {
return object.hashCode();
}
return 0;
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/navigation/ModelExplorerNavigationTargetProvider.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/navigation/ModelExplorerNavigationTargetProvider.java index 049046eedfc..1b1707e1788 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/navigation/ModelExplorerNavigationTargetProvider.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/navigation/ModelExplorerNavigationTargetProvider.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,28 +25,28 @@ import org.eclipse.ui.PlatformUI; /**
* A NavigationTargetProvider for the ModelExplorer view
- *
+ *
* @author Camille Letavernier
- *
+ *
*/
public class ModelExplorerNavigationTargetProvider implements NavigationTargetProvider {
/**
* {@inheritDoc}
- *
+ *
* Returns a NavigationTarget based on the active ModelExplorerView (or null if the ModelExplorer is closed)
*/
public NavigationTarget getNavigationTarget(ServicesRegistry registry) {
IViewPart modelExplorerView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ModelExplorerPageBookView.VIEW_ID);
- if(modelExplorerView instanceof MultiViewPageBookView) {
- MultiViewPageBookView pageBook = (MultiViewPageBookView)modelExplorerView;
+ if (modelExplorerView instanceof MultiViewPageBookView) {
+ MultiViewPageBookView pageBook = (MultiViewPageBookView) modelExplorerView;
IViewPart activeView = pageBook.getActiveView();
- if(activeView instanceof NavigationTarget) {
- return (NavigationTarget)activeView;
- } else if(activeView instanceof IRevealSemanticElement) {
- return new RevealSemanticElementWrapper((IRevealSemanticElement)activeView);
+ if (activeView instanceof NavigationTarget) {
+ return (NavigationTarget) activeView;
+ } else if (activeView instanceof IRevealSemanticElement) {
+ return new RevealSemanticElementWrapper((IRevealSemanticElement) activeView);
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/INavigatorPreferenceConstants.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/INavigatorPreferenceConstants.java index 7c74cd2fbcf..2a2b86fda94 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/INavigatorPreferenceConstants.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/INavigatorPreferenceConstants.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 Atos Origin.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,7 @@ package org.eclipse.papyrus.views.modelexplorer.preferences; /**
* Defines specific preference constants for papyrus navigator.
- *
+ *
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface INavigatorPreferenceConstants {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferenceInitializer.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferenceInitializer.java index 2724eaa33f4..2d415f0ed8a 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferenceInitializer.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferenceInitializer.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 Atos Origin.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,6 +27,7 @@ public class NavigatorPreferenceInitializer extends /**
* Initialize default preferences specific to the activity diagram
*/
+ @Override
public void initializeDefaultPreferences() {
IPreferenceStore store = getPreferenceStore();
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java index 5d9d306c0ef..251fd6796af 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/NavigatorPreferencePage.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 Atos Origin.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java index 812aaffa598..af219f4ea5d 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/preferences/TransformCommandShowPopupDialogGroup.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2010 Atos Origin.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,7 +32,7 @@ public class TransformCommandShowPopupDialogGroup extends AbstractGroup { /**
* Creation of an ActivityEdgeLabelVisibilityGroup Composite.
- *
+ *
* @param parent
* the parent of the composite
* @param dialogPage
@@ -48,7 +48,7 @@ public class TransformCommandShowPopupDialogGroup extends AbstractGroup { /**
* Creates the content.
- *
+ *
* @param parent
* the parent
*/
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java index ce767c05c13..d83150b6375 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/provider/PropertyTester.java @@ -53,7 +53,7 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester /** Queries whether the element is an instance of the specified EClass */
public static final String ECLASS = "eClass";//$NON-NLS-1$
-
+
private static final Pattern QNAME_SEPARATOR = Pattern.compile("\\.|::"); //$NON-NLS-1$
/**
@@ -67,17 +67,17 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester * @return
*/
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if(IS_EOBJECT.equals(property) && receiver instanceof IStructuredSelection) {
- boolean answer = isObject((IStructuredSelection)receiver);
+ if (IS_EOBJECT.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean answer = isObject((IStructuredSelection) receiver);
return Boolean.valueOf(answer).equals(expectedValue);
- } else if(IS_MODEL_EXPLORER.equals(property) && receiver instanceof IWorkbenchPart) {
- boolean answer = isModelExplorer((IWorkbenchPart)receiver);
+ } else if (IS_MODEL_EXPLORER.equals(property) && receiver instanceof IWorkbenchPart) {
+ boolean answer = isModelExplorer((IWorkbenchPart) receiver);
return Boolean.valueOf(answer).equals(expectedValue);
- } else if(IS_PAGE.equals(property) && receiver instanceof IStructuredSelection) {
- boolean answer = isPage((IStructuredSelection)receiver);
+ } else if (IS_PAGE.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean answer = isPage((IStructuredSelection) receiver);
return Boolean.valueOf(answer).equals(expectedValue);
- } else if(ECLASS.equals(property) && (receiver instanceof IStructuredSelection) && (expectedValue instanceof String)) {
- return hasEClass((IStructuredSelection)receiver, (String)expectedValue);
+ } else if (ECLASS.equals(property) && (receiver instanceof IStructuredSelection) && (expectedValue instanceof String)) {
+ return hasEClass((IStructuredSelection) receiver, (String) expectedValue);
}
return false;
}
@@ -85,18 +85,18 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester /**
*
* @param selection
- * the current selection
+ * the current selection
* @return
* <code>true</code> if all selected elements are pages
*/
private boolean isPage(IStructuredSelection selection) {
IPageManager pageManager = getPageManager(selection);
- if(pageManager != null) {
- if(!selection.isEmpty()) {
+ if (pageManager != null) {
+ if (!selection.isEmpty()) {
Iterator<?> iter = selection.iterator();
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
EObject current = EMFHelper.getEObject(iter.next());
- if(!isPage(current, pageManager)) {
+ if (!isPage(current, pageManager)) {
return false;
}
}
@@ -108,11 +108,11 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester }
protected boolean isPage(EObject element, IPageManager pageManager) {
- if(element == null) {
+ if (element == null) {
return false;
}
- if(pageManager.allPages().contains(element)) {
+ if (pageManager.allPages().contains(element)) {
return true;
}
@@ -130,13 +130,13 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester IPageManager pageMngr = null;
try {
ServiceUtilsForSelection instance = ServiceUtilsForSelection.getInstance();
- if(instance != null) {
+ if (instance != null) {
pageMngr = instance.getIPageManager(selection);
}
} catch (NullPointerException npe) {
- //We cannot find the page manager. Just return null.
+ // We cannot find the page manager. Just return null.
} catch (ServiceException e) {
- //We cannot find the page manager. Just return null.
+ // We cannot find the page manager. Just return null.
}
return pageMngr;
}
@@ -158,9 +158,9 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester * @return
*/
private boolean isObject(IStructuredSelection selection) {
- if(!selection.isEmpty()) {
+ if (!selection.isEmpty()) {
Iterator<?> iter = selection.iterator();
- while(iter.hasNext()) {
+ while (iter.hasNext()) {
EObject current = EMFHelper.getEObject(iter.next());
return current != null;
}
@@ -169,42 +169,42 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester }
protected boolean hasEClass(IStructuredSelection selection, String eClassQName) {
- if(!selection.isEmpty()) {
+ if (!selection.isEmpty()) {
// Resolve the EClass in the context of the first element. If we can't resolve it
// in this context, then that element necessarily isn't an instance of that EClass,
- // so not all of the selection is an instance of that class. Thus, it doesn't
+ // so not all of the selection is an instance of that class. Thus, it doesn't
// matter that we choose the first element to resolve the EClass
EClassifier eClassifier = resolveEClass(EMFHelper.getEObject(selection.getFirstElement()), eClassQName);
- if(eClassifier != null) {
+ if (eClassifier != null) {
boolean result = true;
- for(Iterator<?> iter = selection.iterator(); result && iter.hasNext();) {
+ for (Iterator<?> iter = selection.iterator(); result && iter.hasNext();) {
EObject next = EMFHelper.getEObject(iter.next());
result = (next != null) && eClassifier.isInstance(next);
}
-
+
return result;
}
}
return false;
}
-
+
protected EClassifier resolveEClass(Object context, String eClassQName) {
EClassifier result = null;
- if(context instanceof EObject) {
- EClass contextClass = ((EObject)context).eClass();
+ if (context instanceof EObject) {
+ EClass contextClass = ((EObject) context).eClass();
String[] segments = QNAME_SEPARATOR.split(eClassQName);
- if(segments.length > 1) { // must have at least epackage and eclass names
+ if (segments.length > 1) { // must have at least epackage and eclass names
String basePackageName = segments[0];
EPackage basePackage = resolvePackage(contextClass, basePackageName);
- if(basePackage != null) {
+ if (basePackage != null) {
EPackage ePackage = basePackage;
int lastPackage = segments.length - 1;
- for(int i = 1; (ePackage != null) && (i < lastPackage); i++) {
+ for (int i = 1; (ePackage != null) && (i < lastPackage); i++) {
ePackage = getSubPackage(ePackage, segments[i]);
}
- if(ePackage != null) {
+ if (ePackage != null) {
result = ePackage.getEClassifier(segments[segments.length - 1]);
}
}
@@ -213,17 +213,17 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester return result;
}
-
+
static EPackage resolvePackage(EClass contextEClass, String name) {
EPackage result = null;
- if(name.equals(contextEClass.getEPackage().getName())) {
+ if (name.equals(contextEClass.getEPackage().getName())) {
// the easy case
result = contextEClass.getEPackage();
} else {
// search the superclass hierarchy for a matching package
- for(EClass next : contextEClass.getEAllSuperTypes()) {
- if(name.equals(next.getEPackage().getName())) {
+ for (EClass next : contextEClass.getEAllSuperTypes()) {
+ if (name.equals(next.getEPackage().getName())) {
result = next.getEPackage();
break;
}
@@ -232,12 +232,12 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester return result;
}
-
+
static EPackage getSubPackage(EPackage superPackage, String name) {
EPackage result = null;
- for(EPackage next : superPackage.getESubpackages()) {
- if(name.equals(next.getName())) {
+ for (EPackage next : superPackage.getESubpackages()) {
+ if (name.equals(next.getName())) {
result = next;
break;
}
@@ -245,5 +245,5 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester return result;
}
-
+
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java index d835c942cdc..ceddf0e8782 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractEditorContainerQuery.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,26 +16,26 @@ package org.eclipse.papyrus.views.modelexplorer.queries; /**
- *
+ *
* An abstract class to get the pageMngr
- *
+ *
*/
-public abstract class AbstractEditorContainerQuery {//we don't need to implements IJavaModelQuery here
+public abstract class AbstractEditorContainerQuery {// we don't need to implements IJavaModelQuery here
- // /**
- // *
- // * @return
- // * @throws ServiceException
- // */
- // @Deprecated
- // //@unused
- // protected IPageMngr getPageMngr() throws ServiceException {
- // // pageMngr can't be static, because there is a new IPageMngr each time we open a Papyrus Editor
- // IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
- // if (papyrusEditor != null) {
- // ServicesRegistry serviceRegistry = papyrusEditor.getServicesRegistry();
- // return ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
- // }
- // throw new ServiceException("Can't retrieve the IPageMngr");
- // }
+ // /**
+ // *
+ // * @return
+ // * @throws ServiceException
+ // */
+ // @Deprecated
+ // //@unused
+ // protected IPageMngr getPageMngr() throws ServiceException {
+ // // pageMngr can't be static, because there is a new IPageMngr each time we open a Papyrus Editor
+ // IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ // if (papyrusEditor != null) {
+ // ServicesRegistry serviceRegistry = papyrusEditor.getServicesRegistry();
+ // return ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
+ // }
+ // throw new ServiceException("Can't retrieve the IPageMngr");
+ // }
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java index 38dceee2bd5..5170de1cdbd 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/AbstractGetEditorIconQuery.java @@ -26,7 +26,7 @@ import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject; * An abstract class to get the iconRegistery
*
*/
-public abstract class AbstractGetEditorIconQuery {//we don't need to implements IJavaModelQuery here
+public abstract class AbstractGetEditorIconQuery {// we don't need to implements IJavaModelQuery here
/**
* the icon registry
@@ -42,17 +42,17 @@ public abstract class AbstractGetEditorIconQuery {//we don't need to implements */
protected IPageIconsRegistryExtended getEditorRegistry(EObject context) {
try {
- return (IPageIconsRegistryExtended)ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, context);
+ return (IPageIconsRegistryExtended) ServiceUtilsForEObject.getInstance().getService(IPageIconsRegistry.class, context);
} catch (Exception ex) {
- //Skip
+ // Skip
}
- if(editorRegistry == null) {
+ if (editorRegistry == null) {
editorRegistry = createEditorRegistry(context);
}
- if(!(editorRegistry instanceof IPageIconsRegistryExtended)) {
+ if (!(editorRegistry instanceof IPageIconsRegistryExtended)) {
throw new RuntimeException("The editor registry do not implement IPageIconsRegistryExtended");////$NON-NLS-1$
}
- return (IPageIconsRegistryExtended)editorRegistry;
+ return (IPageIconsRegistryExtended) editorRegistry;
}
/**
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsContainmentStructuralFeature.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsContainmentStructuralFeature.java index a719398d178..e96fa3a6ec9 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsContainmentStructuralFeature.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsContainmentStructuralFeature.java @@ -23,43 +23,44 @@ import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReferen import org.eclipse.papyrus.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue; import org.eclipse.papyrus.emf.facet.query.java.core.IJavaQuery2; import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; + /** - * this query is used to return false, if the given object is a references that is not containment or if it is a attribute. + * this query is used to return false, if the given object is a references that is not containment or if it is a attribute. * it return true if the the feature is also a facetReferences * */ public class IsContainmentStructuralFeature implements IJavaQuery2<EObject, Boolean> { - public Boolean evaluate(final EObject context, - final IParameterValueList2 parameterValues, - final IFacetManager facetManager) + public Boolean evaluate(final EObject context, + final IParameterValueList2 parameterValues, + final IFacetManager facetManager) throws DerivedTypedElementException { - ParameterValue parameterValue= (ParameterValue)parameterValues.getParameterValueByName("eStructuralFeature"); - EStructuralFeature eStructuralFeature=(EStructuralFeature)parameterValue.getValue(); - //if eStructural feature ==null this is root model explorer. - //border effect of this kind of queries - if (eStructuralFeature==null){ + ParameterValue parameterValue = parameterValues.getParameterValueByName("eStructuralFeature"); + EStructuralFeature eStructuralFeature = (EStructuralFeature) parameterValue.getValue(); + // if eStructural feature ==null this is root model explorer. + // border effect of this kind of queries + if (eStructuralFeature == null) { return true; } // This is an UML element? - if(context instanceof EObject){ - //the eStructure is a containmentReference or Facet Reference? - if(eStructuralFeature instanceof EReference){ - if( ((EReference)eStructuralFeature).equals(EcorePackage.eINSTANCE.getEModelElement_EAnnotations())){ + if (context instanceof EObject) { + // the eStructure is a containmentReference or Facet Reference? + if (eStructuralFeature instanceof EReference) { + if (((EReference) eStructuralFeature).equals(EcorePackage.eINSTANCE.getEModelElement_EAnnotations())) { return false; } - if(((EReference)(eStructuralFeature)).isContainment()||(eStructuralFeature instanceof FacetReference)){ + if (((EReference) (eStructuralFeature)).isContainment() || (eStructuralFeature instanceof FacetReference)) { return true; } - else{ + else { return false; } } - //this is not a ref like EAttribute - else{ + // this is not a ref like EAttribute + else { return false; } } - //this is not a UML element + // this is not a UML element return false; } } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java index 7dfee904aaa..285eab5d568 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsOpenedPage.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,7 +29,7 @@ public class IsOpenedPage implements IJavaQuery2<EObject, Boolean> { IPageManager pageManager = ServiceUtilsForEObject.getInstance().getIPageManager(source); return pageManager.isOpen(source); } catch (ServiceException ex) { - //Ignore + // Ignore } return false; } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnly.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnly.java index 71d666b98cb..99b52922474 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnly.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnly.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2011 Atos.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,7 +23,7 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; /**
* Create a query which will return true if the ressource is in read only mode.
- *
+ *
*/
@Deprecated
public class IsReadOnly implements IJavaQuery2<EObject, Boolean> {
@@ -31,8 +31,8 @@ public class IsReadOnly implements IJavaQuery2<EObject, Boolean> { public Boolean evaluate(EObject source, IParameterValueList2 parameterValues, IFacetManager facetManager) throws DerivedTypedElementException {
EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(source);
- if(editingDomain != null) {
- if(editingDomain.isReadOnly(source.eResource())) {
+ if (editingDomain != null) {
+ if (editingDomain.isReadOnly(source.eResource())) {
return true;
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnlyColorQuery.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnlyColorQuery.java index a8b1c441144..01245e6b074 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnlyColorQuery.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/queries/IsReadOnlyColorQuery.java @@ -22,7 +22,7 @@ import org.eclipse.papyrus.emf.facet.query.java.core.IParameterValueList2; import org.eclipse.papyrus.emf.facet.custom.ui.internal.custompt.Color;
/**
- * The purpose of this request is the return the color for read only elements
+ * The purpose of this request is the return the color for read only elements
*
*/
public class IsReadOnlyColorQuery implements IJavaQuery2<EObject, IColor> {
@@ -31,7 +31,7 @@ public class IsReadOnlyColorQuery implements IJavaQuery2<EObject, IColor> { final IParameterValueList2 parameterValues,
final IFacetManager facetManager)
throws DerivedTypedElementException {
- return new Color(100,100,100);
+ return new Color(100, 100, 100);
}
}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/DefaultTreeViewerSorting.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/DefaultTreeViewerSorting.java index 7800d99d0c8..163c6e6e6f2 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/DefaultTreeViewerSorting.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/DefaultTreeViewerSorting.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2014 CEA and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -27,20 +27,20 @@ public class DefaultTreeViewerSorting implements ITreeViewerSorting { /** * Obtains the tree-viewer sorting adapter for a workbench part, or a no-op default if the part provides none. - * + * * @param part - * a workbench part (may be {@code null} - * + * a workbench part (may be {@code null} + * * @return the sorting adapter (never {@code null}) */ public static ITreeViewerSorting getSorting(IWorkbenchPart part) { ITreeViewerSorting result = null; - if(part != null) { - result = (ITreeViewerSorting)part.getAdapter(ITreeViewerSorting.class); + if (part != null) { + result = (ITreeViewerSorting) part.getAdapter(ITreeViewerSorting.class); } - if(result == null) { + if (result == null) { result = new DefaultTreeViewerSorting(); } diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/ITreeViewerSorting.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/ITreeViewerSorting.java index 2e278baa115..8fdde58ede2 100644 --- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/ITreeViewerSorting.java +++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer/src/org/eclipse/papyrus/views/modelexplorer/sorting/ITreeViewerSorting.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2014 CEA and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Activator.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Activator.java index 235d04812f0..1638a5bf322 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Activator.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Activator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Messages.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Messages.java index 8d38f665efb..1798fde96bb 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Messages.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Messages.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/regex/PatternHelper.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/regex/PatternHelper.java index 96495a60fed..4a2bbfd5a07 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/regex/PatternHelper.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/regex/PatternHelper.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,9 +17,9 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException;
/**
- *
+ *
* Singleton helper class used to find pattern queries in strings
- *
+ *
*/
public class PatternHelper {
@@ -31,29 +31,29 @@ public class PatternHelper { /**
* Singleton
- *
+ *
* @return the helper
*/
public final static PatternHelper getInstance() {
-
- synchronized(PatternHelper.class) {
- if(PatternHelper.instance == null) {
- PatternHelper.instance = new PatternHelper();
- }
+
+ synchronized (PatternHelper.class) {
+ if (PatternHelper.instance == null) {
+ PatternHelper.instance = new PatternHelper();
}
-
+ }
+
return PatternHelper.instance;
}
/**
* Create a pattern
- *
+ *
* @param query
- * the query text
+ * the query text
* @param isCaseSensitive
- * if it is a case sensitive pattern
+ * if it is a case sensitive pattern
* @param isRegularExpression
- * if it i a regular expression pattern
+ * if it i a regular expression pattern
* @return
* the pattern corresponding to the query text and the parameters
* @throws PatternSyntaxException
@@ -61,12 +61,12 @@ public class PatternHelper { public Pattern createPattern(String query, boolean isCaseSensitive, boolean isRegularExpression) throws PatternSyntaxException {
int options = Pattern.MULTILINE;
- if(!isRegularExpression) {
+ if (!isRegularExpression) {
// query = ".*" + Pattern.quote(query); //$NON-NLS-1$
- query = Pattern.quote(query); //$NON-NLS-1$
+ query = Pattern.quote(query);
}
- if(!isCaseSensitive) {
+ if (!isCaseSensitive) {
options |= Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;
}
@@ -74,25 +74,25 @@ public class PatternHelper { return pattern;
}
- - // /**
- // * Check whether a string matches a certain pattern in a matcher
- // *
- // * @param m
- // * the matcher
- // * @param isRegularExpression
- // * specify if it is a regular expression pattern
- // * @return
- // * true if the text matches the pattern, else false
- // */
- // public boolean evaluate(Matcher m, boolean isRegularExpression) {
+
+ // /**
+ // * Check whether a string matches a certain pattern in a matcher
+ // *
+ // * @param m
+ // * the matcher
+ // * @param isRegularExpression
+ // * specify if it is a regular expression pattern
+ // * @return
+ // * true if the text matches the pattern, else false
+ // */
+ // public boolean evaluate(Matcher m, boolean isRegularExpression) {
//
//
- // if(isRegularExpression) {
- // return m.matches();
- // } else {
- // return m.lookingAt();
- // }
- // }
+ // if(isRegularExpression) {
+ // return m.matches();
+ // } else {
+ // return m.lookingAt();
+ // }
+ // }
}
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java index 5fdc926872d..248c8f3e77f 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java @@ -1,7 +1,7 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST and others. * - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,8 +9,8 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Christian W. Damus (CEA LIST) - Replace workspace IResource dependency with URI for CDO compatibility - * Christian W. Damus (CEA LIST) - Fix equals() to avoid resolving source objects and add missing hashCode() + * Christian W. Damus (CEA LIST) - Replace workspace IResource dependency with URI for CDO compatibility + * Christian W. Damus (CEA LIST) - Fix equals() to avoid resolving source objects and add missing hashCode() * *****************************************************************************/ package org.eclipse.papyrus.views.search.results; @@ -32,10 +32,10 @@ import org.eclipse.search.ui.text.MatchFilter; import org.eclipse.ui.PartInitException; /** - * + * * Abstract implementation of Result entry. A ResultEntry is an entry that will appear in the result of a search. It provides a tree structure. * It is abstract because entries can be real matches i.e. {@see ModelMatch} or entries shown for hierarchical reasons i.e. {@see ResultEntry}. - * + * */ public abstract class AbstractResultEntry extends Match { @@ -52,7 +52,7 @@ public abstract class AbstractResultEntry extends Match { protected URI uriSource; protected java.net.URI uriResource; - + protected URI uriEResource; /** @@ -62,7 +62,7 @@ public abstract class AbstractResultEntry extends Match { /** * Every implementation of {@link AbstractResultEntry} must implement this to define what should be displayed in labelproviders - * + * * @return * the element to display in labelproviders */ @@ -70,7 +70,7 @@ public abstract class AbstractResultEntry extends Match { /** * Every implementation of {@link AbstractResultEntry} must implement this to define what element is to give to the {@link OpenElementService} - * + * * @return * the element to open with {@link OpenElementService} */ @@ -78,7 +78,7 @@ public abstract class AbstractResultEntry extends Match { /** * Every implementation of {@link AbstractResultEntry} must implement this to define what element is to be analyzed by {@link MatchFilter}(s) - * + * * @return * the element to analyze to filter matches */ @@ -86,42 +86,42 @@ public abstract class AbstractResultEntry extends Match { /** * Compute the parent hierarchy of parents of a element in a model - * + * * @param child - * the element to search parents for + * the element to search parents for * @param scopeEntry - * the {@link ScopeEntry} corresponding to the resource that contains the element that matches + * the {@link ScopeEntry} corresponding to the resource that contains the element that matches */ public void recursiveHierarchy(AbstractResultEntry child) { - if(child.getSource() instanceof EObject) { - EObject potentialParent = ((EObject)child.getSource()).eContainer(); + if (child.getSource() instanceof EObject) { + EObject potentialParent = ((EObject) child.getSource()).eContainer(); - if(potentialParent != null) { - ResultEntry theParent = new ResultEntry(potentialParent, (ScopeEntry)this.getElement()); + if (potentialParent != null) { + ResultEntry theParent = new ResultEntry(potentialParent, (ScopeEntry) this.getElement()); child.setParent(theParent); recursiveHierarchy(theParent); } else { - ResultEntry theParent = new ResultEntry(((ScopeEntry)this.getElement()).getResourceURI(), (ScopeEntry)this.getElement()); + ResultEntry theParent = new ResultEntry(((ScopeEntry) this.getElement()).getResourceURI(), (ScopeEntry) this.getElement()); child.setParent(theParent); } } } protected AbstractResultEntry getLastParent(AbstractResultEntry child, ScopeEntry scopeEntry) { - if(child.getSource() instanceof EObject) { + if (child.getSource() instanceof EObject) { - EObject potentialParent = ((EObject)child.getSource()).eContainer(); + EObject potentialParent = ((EObject) child.getSource()).eContainer(); ResultEntry theParent = null; - while(potentialParent != null) { + while (potentialParent != null) { theParent = new ResultEntry(potentialParent, scopeEntry); theParent.setParent(new ResultEntry(scopeEntry.getResourceURI(), scopeEntry)); potentialParent = potentialParent.eContainer(); } - if(theParent == null) { + if (theParent == null) { theParent = new ResultEntry(scopeEntry.getResourceURI(), scopeEntry); @@ -137,27 +137,27 @@ public abstract class AbstractResultEntry extends Match { /** * It is a really important override that used to not duplicate elements in the result hierarchy. Extensions of {@link AbstractResultEntry} may * specialize this method - * + * * @see java.lang.Object#equals(java.lang.Object) - * + * * @param obj * @return */ @Override public boolean equals(Object obj) { - if(obj == this) { + if (obj == this) { return true; } - if(obj == null) { + if (obj == null) { return false; } - if(!(obj instanceof AbstractResultEntry)) { + if (!(obj instanceof AbstractResultEntry)) { // support comparison against EObjects // FIXME: This violates the symmetry contract of Object::equals! - if(obj instanceof EObject && this.getSource() instanceof EObject) { - if(EcoreUtil.equals((EObject)this.getSource(), (EObject)obj)) { - if(((AbstractResultEntry)obj).getOffset() == this.getOffset()) { - if(((AbstractResultEntry)obj).getLength() == this.getLength()) { + if (obj instanceof EObject && this.getSource() instanceof EObject) { + if (EcoreUtil.equals((EObject) this.getSource(), (EObject) obj)) { + if (((AbstractResultEntry) obj).getOffset() == this.getOffset()) { + if (((AbstractResultEntry) obj).getLength() == this.getLength()) { return true; } } @@ -166,14 +166,14 @@ public abstract class AbstractResultEntry extends Match { return false; } - AbstractResultEntry other = (AbstractResultEntry)obj; + AbstractResultEntry other = (AbstractResultEntry) obj; // don't attempt to resolve the source object by URI in case it is no longer available. // Note that, in the degenerate (and invalid) case in which all of the uri variants of // both result entries are null, they are not considered equal boolean sameSource = ((uriSource != null) && uriSource.equals(other.uriSource)) // - || ((uriResource != null) && uriResource.equals(other.uriResource)) // - || ((uriEResource != null) && uriEResource.equals(other.uriEResource)); + || ((uriResource != null) && uriResource.equals(other.uriResource)) // + || ((uriEResource != null) && uriEResource.equals(other.uriEResource)); return sameSource && (getOffset() == other.getOffset()) && (getLength() == other.getLength()); } @@ -181,17 +181,17 @@ public abstract class AbstractResultEntry extends Match { @Override public int hashCode() { int result = 0; - + if (uriSource != null) { result = result ^ uriSource.hashCode(); - } + } if (uriResource != null) { result = result ^ uriResource.hashCode(); - } + } if (uriEResource != null) { result = result ^ uriEResource.hashCode(); - } - + } + result = result ^ (getOffset() * 17); result = result ^ (getLength() * 37); @@ -200,27 +200,27 @@ public abstract class AbstractResultEntry extends Match { /** * @see Match#Match(Object, int, int) - * + * * @param offset - * + * * @param lenght - * + * * @param source - * the element that raised the match + * the element that raised the match * @param scopeEntry - * the {@link ScopeEntry} that correspond to the resource that contains the element that raised the match + * the {@link ScopeEntry} that correspond to the resource that contains the element that raised the match */ public AbstractResultEntry(int offset, int lenght, Object source, ScopeEntry scopeEntry) { super(scopeEntry, offset, lenght); - // this.source = source; - if(source instanceof EObject) { + // this.source = source; + if (source instanceof EObject) { - this.uriSource = EcoreUtil.getURI((EObject)source); - } else if(source instanceof IResource) { - this.uriResource = ((IResource)source).getLocationURI(); + this.uriSource = EcoreUtil.getURI((EObject) source); + } else if (source instanceof IResource) { + this.uriResource = ((IResource) source).getLocationURI(); } else if (source instanceof URI) { URI uri = (URI) source; - + if (uri.isPlatformResource()) { // we use this as a proxy for IResources this.uriResource = java.net.URI.create(((URI) source).toString()); @@ -231,10 +231,10 @@ public abstract class AbstractResultEntry extends Match { } public Object getSource() { - if(this.uriSource != null) { - ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet(); + if (this.uriSource != null) { + ResourceSet resSet = ((ScopeEntry) this.getElement()).getModelSet(); return resSet.getEObject(this.uriSource, true); - } else if(this.uriResource != null) { + } else if (this.uriResource != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); @@ -242,7 +242,7 @@ public abstract class AbstractResultEntry extends Match { IPath path = new Path(this.uriResource.getPath()); return root.getFile(path); } else if (this.uriEResource != null) { - ResourceSet rset = ((ScopeEntry)this.getElement()).getModelSet(); + ResourceSet rset = ((ScopeEntry) this.getElement()).getModelSet(); return rset.getResource(this.uriEResource, true); } @@ -266,8 +266,8 @@ public abstract class AbstractResultEntry extends Match { return this.getClass().getSimpleName() + "(" + super.hashCode() + ") : source -> " + source; //$NON-NLS-1$ //$NON-NLS-2$ } - public URI getURI() {
+ public URI getURI() { - return uriSource;
- }
+ return uriSource; + } } diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java index 6434bc83e45..95b5b9c0b8e 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,9 @@ import org.eclipse.ui.PartInitException; import org.eclipse.uml2.uml.Stereotype;
/**
- *
+ *
* A match raised by the value of an attribute
- *
+ *
*/
public class AttributeMatch extends ModelMatch {
@@ -44,41 +44,41 @@ public class AttributeMatch extends ModelMatch { /**
* Similar to {@link AbstractResultEntry} but adds an information about which attribute raised the match and which element contains the value of
* the attribute that matches
- *
+ *
* @param offset
* @param lenght
* @param target
- * the element containing the value of the attribute that matches
+ * the element containing the value of the attribute that matches
* @param scopeEntry
* @param attribute
- * the attribute that raised the match
+ * the attribute that raised the match
*/
public AttributeMatch(int offset, int lenght, Object target, ScopeEntry scopeEntry, Object attribute, Stereotype stereotype) {
super(offset, lenght, target, scopeEntry);
this.attribute = attribute;
this.stereotype = stereotype;
- // if(target instanceof EObject) {
- // this.uriSource = EcoreUtil.getURI((EObject)target);
- // }
+ // if(target instanceof EObject) {
+ // this.uriSource = EcoreUtil.getURI((EObject)target);
+ // }
this.parent = new ResultEntry(target, scopeEntry);
- recursiveHierarchy((AbstractResultEntry)parent);
+ recursiveHierarchy((AbstractResultEntry) parent);
}
/**
* Create an attribute-match in a parent result entry that already exists.
- *
+ *
* @param parent
- * the parent result entry
+ * the parent result entry
* @param offset
* @param lengtt
* @param target
- * the element containing the value of the attribute that matches
+ * the element containing the value of the attribute that matches
* @param attribute
- * the attribute that raised the match
+ * the attribute that raised the match
*/
public AttributeMatch(AbstractResultEntry parent, int offset, int length, Object target, Object attribute, Stereotype stereotype) {
- super(offset, length, target, (ScopeEntry)parent.getElement());
+ super(offset, length, target, (ScopeEntry) parent.getElement());
this.attribute = attribute;
this.stereotype = stereotype;
@@ -86,23 +86,23 @@ public class AttributeMatch extends ModelMatch { }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#equals(java.lang.Object)
* In addition, it checks if target is the same as well.
- *
+ *
* @param obj
* @return
*/
@Override
public boolean equals(Object obj) {
- if(obj instanceof AttributeMatch) {
- if(super.equals(obj)) {
- if(((AttributeMatch)obj).getSource() instanceof EObject && this.getSource() instanceof EObject) {
- if(EcoreUtil.equals((EObject)((AttributeMatch)obj).getSource(), (EObject)this.getSource())) {
+ if (obj instanceof AttributeMatch) {
+ if (super.equals(obj)) {
+ if (((AttributeMatch) obj).getSource() instanceof EObject && this.getSource() instanceof EObject) {
+ if (EcoreUtil.equals((EObject) ((AttributeMatch) obj).getSource(), (EObject) this.getSource())) {
return true;
}
} else {
- if(((AttributeMatch)obj).getSource().equals(this.getSource())) {
+ if (((AttributeMatch) obj).getSource().equals(this.getSource())) {
return true;
}
}
@@ -114,27 +114,27 @@ public class AttributeMatch extends ModelMatch { }
}
- // public Object getTarget() {
- // // ResourceSet resSet = new ResourceSetImpl();
- // if(this.uriSource != null) {
- // ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
- // return resSet.getEObject(this.uriSource, true);
- // }
- // return null;
+ // public Object getTarget() {
+ // // ResourceSet resSet = new ResourceSetImpl();
+ // if(this.uriSource != null) {
+ // ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ // return resSet.getEObject(this.uriSource, true);
+ // }
+ // return null;
//
- // }
+ // }
//
- // public void setTarget(Object target) {
- // if(target instanceof EObject) {
- // this.uriSource = EcoreUtil.getURI((EObject)target);
- // }
+ // public void setTarget(Object target) {
+ // if(target instanceof EObject) {
+ // this.uriSource = EcoreUtil.getURI((EObject)target);
+ // }
//
- // }
+ // }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToDisplay()
- *
+ *
* @return
*/
@Override
@@ -144,9 +144,9 @@ public class AttributeMatch extends ModelMatch { }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToCheckFilterFor()
- *
+ *
* @return
*/
@Override
@@ -155,15 +155,15 @@ public class AttributeMatch extends ModelMatch { }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#openElement()
- *
+ *
* @return
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(this.getSource() instanceof EObject) {
- return service.openSemanticElement((EObject)this.getSource());
+ if (this.getSource() instanceof EObject) {
+ return service.openSemanticElement((EObject) this.getSource());
}
return null;
}
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java index c560deb82dc..d32ceed375e 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,9 +21,9 @@ import org.eclipse.papyrus.views.search.scope.ScopeEntry; import org.eclipse.ui.PartInitException;
/**
- *
+ *
* A match raised by an element in a model
- *
+ *
*/
public class ModelElementMatch extends ModelMatch {
@@ -34,7 +34,7 @@ public class ModelElementMatch extends ModelMatch { recursiveHierarchy(this);
- // this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
+ // this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
}
@Override
@@ -44,25 +44,25 @@ public class ModelElementMatch extends ModelMatch { }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToDisplay()
- *
+ *
* @return
*/
@Override
public Object elementToDisplay() {
- // return this.getSource();
- if(this.uriSource != null) {
- ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ // return this.getSource();
+ if (this.uriSource != null) {
+ ResourceSet resSet = ((ScopeEntry) this.getElement()).getModelSet();
return resSet.getEObject(this.uriSource, true);
}
return null;
}
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToCheckFilterFor()
- *
+ *
* @return
*/
@Override
@@ -70,29 +70,29 @@ public class ModelElementMatch extends ModelMatch { return this.getSource();
}
- // @Override
- // public Object getSource() {
+ // @Override
+ // public Object getSource() {
//
- // if(this.uriSource != null) {
- // ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
- // return resSet.getEObject(this.uriSource, true);
- // }
- // return null;
+ // if(this.uriSource != null) {
+ // ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ // return resSet.getEObject(this.uriSource, true);
+ // }
+ // return null;
//
//
- // }
+ // }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#openElement()
- *
+ *
* @return
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(this.getSource() instanceof EObject) {
+ if (this.getSource() instanceof EObject) {
- return service.openSemanticElement((EObject)this.getSource());
+ return service.openSemanticElement((EObject) this.getSource());
}
return null;
}
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelMatch.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelMatch.java index 538966607f8..233ce336597 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelMatch.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelMatch.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,9 +16,9 @@ package org.eclipse.papyrus.views.search.results; import org.eclipse.papyrus.views.search.scope.ScopeEntry;
/**
- *
+ *
* A real result entry in a model
- *
+ *
*/
public abstract class ModelMatch extends AbstractResultEntry {
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java index 9c917f531f9..36edf4e7e97 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,9 +21,9 @@ import org.eclipse.papyrus.views.search.scope.ScopeEntry; import org.eclipse.ui.PartInitException;
/**
- *
+ *
* Implements a result entry that doesn't correspond to a real match. it is used to create hierarchies
- *
+ *
*/
public class ResultEntry extends AbstractResultEntry {
@@ -36,9 +36,9 @@ public class ResultEntry extends AbstractResultEntry { }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToDisplay()
- *
+ *
* @return
*/
@Override
@@ -49,51 +49,51 @@ public class ResultEntry extends AbstractResultEntry { }
- // @Override
- // public Object getSource() {
- // if(this.uriSource != null) {
- // ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
- // return resSet.getEObject(this.uriSource, true);
- // } else if(this.uriResource != null) {
+ // @Override
+ // public Object getSource() {
+ // if(this.uriSource != null) {
+ // ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ // return resSet.getEObject(this.uriSource, true);
+ // } else if(this.uriResource != null) {
//
- // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
//
//
- // IPath path = new Path(this.uriResource.getPath());
- // return root.getFile(path);
- // }
- // return null;
+ // IPath path = new Path(this.uriResource.getPath());
+ // return root.getFile(path);
+ // }
+ // return null;
//
//
- // }
+ // }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToCheckFilterFor()
- *
+ *
* @return
*/
@Override
public Object elementToCheckFilterFor() {
- // ResourceSet resSet = new ResourceSetImpl();
- // if(this.uriSource != null) {
- // return resSet.getEObject(uriSource, true);
- // }
+ // ResourceSet resSet = new ResourceSetImpl();
+ // if(this.uriSource != null) {
+ // return resSet.getEObject(uriSource, true);
+ // }
return this.getSource();
}
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#openElement()
- *
+ *
* @return
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(this.getSource() instanceof EObject) {
+ if (this.getSource() instanceof EObject) {
- return service.openSemanticElement((EObject)this.getSource());
+ return service.openSemanticElement((EObject) this.getSource());
}
return null;
}
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java index b552426b712..126099d1252 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,9 +23,9 @@ import org.eclipse.papyrus.views.search.scope.ScopeEntry; import org.eclipse.ui.PartInitException;
/**
- *
+ *
* A match raised by a viewer (i.e. something that is a view of a real match) in a model
- *
+ *
*/
public class ViewerMatch extends AbstractResultEntry {
@@ -36,34 +36,34 @@ public class ViewerMatch extends AbstractResultEntry { public ViewerMatch(Object source, ScopeEntry scopeEntry, Object semanticElement) {
super(UNSPECIFIED, UNSPECIFIED, source, scopeEntry);
- if(semanticElement instanceof EObject) {
- this.URIsemanticElement = EcoreUtil.getURI((EObject)semanticElement);
+ if (semanticElement instanceof EObject) {
+ this.URIsemanticElement = EcoreUtil.getURI((EObject) semanticElement);
}
this.parent = getLastParent(this, scopeEntry);
- // this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
+ // this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
}
public Object getSemanticElement() {
- if(this.URIsemanticElement != null) {
- ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ if (this.URIsemanticElement != null) {
+ ResourceSet resSet = ((ScopeEntry) this.getElement()).getModelSet();
return resSet.getEObject(this.URIsemanticElement, true);
}
return null;
}
public void setSemanticElement(Object semanticElement) {
- if(semanticElement instanceof EObject) {
- this.URIsemanticElement = EcoreUtil.getURI((EObject)semanticElement);
+ if (semanticElement instanceof EObject) {
+ this.URIsemanticElement = EcoreUtil.getURI((EObject) semanticElement);
}
}
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToDisplay()
- *
+ *
* @return
*/
@Override
@@ -72,30 +72,30 @@ public class ViewerMatch extends AbstractResultEntry { }
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToCheckFilterFor()
- *
+ *
* @return
*/
@Override
public Object elementToCheckFilterFor() {
- if(this.URIsemanticElement != null) {
- ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ if (this.URIsemanticElement != null) {
+ ResourceSet resSet = ((ScopeEntry) this.getElement()).getModelSet();
return resSet.getEObject(this.URIsemanticElement, true);
}
return null;
}
/**
- *
+ *
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#openElement()
- *
+ *
* @return
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(this.getSource() instanceof EObject) {
- return service.openElement((EObject)this.getSource());
+ if (this.getSource() instanceof EObject) {
+ return service.openElement((EObject) this.getSource());
}
return null;
}
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeCollector.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeCollector.java index b05140843b3..a28f85b99ac 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeCollector.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeCollector.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,17 +21,17 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.search.ui.ISearchPageContainer;
/**
- *
+ *
* Interface that must be implemented to generate scope (i.e. list of {@link URI}s) from a {@link ISearchPageContainer}
- *
+ *
*/
public interface IScopeCollector {
/**
* Find a collection of {@link IResource} that can be processed from those available in the container
- *
+ *
* @param container
- * the container to search in
+ * the container to search in
* @return
* a collection of {@link IResource} that can be processed
*/
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeProvider.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeProvider.java index b3f0e914447..242c07e7dde 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeProvider.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,12 +26,11 @@ import org.eclipse.emf.common.util.URI; * <li>models discoverable on the Word-Wide Web</li> * </ul> * <p> - * For workspace-wide searches, all scope providers are queried for their {@linkplain #getScope() full scope} and the resulting search scope is the - * union of all provided URIs. + * For workspace-wide searches, all scope providers are queried for their {@linkplain #getScope() full scope} and the resulting search scope is the union of all provided URIs. * </p> * <p> - * For selection-scoped searches, providers are queried in priority order for scopes based on each object selected in the workbench. The first - * provider that returns some URIs for a selected object wins; lower-priority providers are not consulted for additional URIs. + * For selection-scoped searches, providers are queried in priority order for scopes based on each object selected in the workbench. The first provider that returns some URIs for a selected object wins; lower-priority providers are not consulted for additional + * URIs. * </p> */ public interface IScopeProvider { @@ -41,16 +40,16 @@ public interface IScopeProvider { * search all reasonably available resources in the provider's domain, whatever that means. For example, in a model * repository scope provider, it may be reasonable to expect a search to extend into all connected repositories but not * any that are currently disconnected (though it may be known where they are and how to connect). - * + * * @return all URIs */ Collection<URI> getScope(); /** * Gets URIs applicable to a search that is constrained to a given object {@code selected} by the user in the workbench. - * + * * @param selected - * an object selected in the workbench + * an object selected in the workbench * @return */ Collection<URI> getScope(Object selected); diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ResourceVisitor.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ResourceVisitor.java index 0a314036266..80bbb1c80d7 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ResourceVisitor.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ResourceVisitor.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,9 +24,9 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.emf.common.util.URI;
/**
- *
+ *
* Implements a visitor that goes through a hierarchy of Iresource from a root and collect only those that can be processed for search
- *
+ *
*/
public class ResourceVisitor implements IResourceProxyVisitor {
@@ -38,20 +38,20 @@ public class ResourceVisitor implements IResourceProxyVisitor { }
public boolean visit(IResourceProxy proxy) throws CoreException {
- switch(proxy.getType()) {
+ switch (proxy.getType()) {
case IResource.FILE:
IResource resource = proxy.requestResource();
URI uri = URI.createPlatformResourceURI(resource.getFullPath().toString(), true);
- if("di".equals(uri.fileExtension())) { //$NON-NLS-1$
- //Verify that it is a true papyrus model
- // try {
- // ModelSet modelSet = ModelUtils.openFile(resource);
- // modelSet.unload();
+ if ("di".equals(uri.fileExtension())) { //$NON-NLS-1$
+ // Verify that it is a true papyrus model
+ // try {
+ // ModelSet modelSet = ModelUtils.openFile(resource);
+ // modelSet.unload();
participantURIs.add(uri);
- // } catch (ModelMultiException e) {
- // }
+ // } catch (ModelMultiException e) {
+ // }
}
break;
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeCollector.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeCollector.java index 091fa55d35c..87f773b9d6e 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeCollector.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeCollector.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,19 +44,19 @@ public class ScopeCollector implements IScopeCollector { private static ScopeCollector instance = new ScopeCollector();
private final Iterable<? extends IScopeProvider> scopeProviders;
-
+
private ScopeCollector() {
super();
-
+
scopeProviders = loadScopeProviders();
}
public final static ScopeCollector getInstance() {
-
- synchronized(ScopeCollector.class) {
- if(ScopeCollector.instance == null) {
+
+ synchronized (ScopeCollector.class) {
+ if (ScopeCollector.instance == null) {
ScopeCollector.instance = new ScopeCollector();
}
@@ -66,7 +66,7 @@ public class ScopeCollector implements IScopeCollector { /**
* @see org.eclipse.papyrus.views.search.scope.IScopeCollector#computeSearchScope(org.eclipse.search.ui.ISearchPageContainer)
- *
+ *
* @param container
* @return
*/
@@ -74,47 +74,42 @@ public class ScopeCollector implements IScopeCollector { Set<URI> results = new HashSet<URI>();
- if(container == null) {
+ if (container == null) {
results.addAll(createWorkspaceScope());
} else {
- switch(container.getSelectedScope()) {
- case ISearchPageContainer.WORKSPACE_SCOPE:
- {
+ switch (container.getSelectedScope()) {
+ case ISearchPageContainer.WORKSPACE_SCOPE: {
results.addAll(createWorkspaceScope());
break;
}
- case ISearchPageContainer.SELECTION_SCOPE:
- {
+ case ISearchPageContainer.SELECTION_SCOPE: {
ISelection selection = container.getSelection();
- if(!selection.isEmpty()) {
- if(selection instanceof IStructuredSelection) {
- results.addAll(createSelectionScope((IStructuredSelection)selection));
+ if (!selection.isEmpty()) {
+ if (selection instanceof IStructuredSelection) {
+ results.addAll(createSelectionScope((IStructuredSelection) selection));
} else {
- //Do a workspace search instead
+ // Do a workspace search instead
results.addAll(createWorkspaceScope());
}
} else {
- //Do a workspace search instead
+ // Do a workspace search instead
results.addAll(createWorkspaceScope());
}
break;
}
- case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
- {
+ case ISearchPageContainer.SELECTED_PROJECTS_SCOPE: {
String[] projects = container.getSelectedProjectNames();
results.addAll(createProjectsScope(projects));
break;
}
- case ISearchPageContainer.WORKING_SET_SCOPE:
- {
+ case ISearchPageContainer.WORKING_SET_SCOPE: {
IWorkingSet[] workingSets = container.getSelectedWorkingSets();
results.addAll(createWorkingSetsScope(workingSets));
break;
}
- default:
- {
+ default: {
break;
}
}
@@ -126,9 +121,9 @@ public class ScopeCollector implements IScopeCollector { /**
* Create a scope when the container is ISearchPageContainer.SELECTION_SCOPE
- *
+ *
* @param selection
- * the selection of the container
+ * the selection of the container
* @return
* the scope
*/
@@ -136,42 +131,42 @@ public class ScopeCollector implements IScopeCollector { List<URI> results = new ArrayList<URI>();
Iterator<?> it = selection.iterator();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Object next = it.next();
-
+
for (IScopeProvider provider : getScopeProviders()) {
Collection<URI> scope = provider.getScope(next);
if (!scope.isEmpty()) {
results.addAll(scope);
-
+
// don't consult the next provider
break;
}
}
}
-
+
if (results.isEmpty()) {
// search the workspace instead, then
results.addAll(createWorkspaceScope());
}
-
+
return results;
}
/**
* Create a scope when the container is ISearchPageContainer.SELECTED_PROJECTS_SCOPE
- *
+ *
* @param projects
- * the selected scope
+ * the selected scope
* @return
* the scope
*/
protected List<URI> createProjectsScope(String[] projects) {
List<URI> results = new ArrayList<URI>();
- for(String projectName : projects) {
+ for (String projectName : projects) {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if(project.isOpen()) {
+ if (project.isOpen()) {
results.addAll(findPapyrusModels(project));
}
}
@@ -180,21 +175,21 @@ public class ScopeCollector implements IScopeCollector { /**
* Create a scope when the container is ISearchPageContainer.WORKING_SET_SCOPE
- *
+ *
* @param workingSets
- * the selected workingSets
+ * the selected workingSets
* @return
* the scope
*/
protected List<URI> createWorkingSetsScope(IWorkingSet[] workingSets) {
List<URI> results = new ArrayList<URI>();
- if(workingSets != null && workingSets.length > 0) {
- for(IWorkingSet iWorkingSet : workingSets) {
- for(IAdaptable element : iWorkingSet.getElements()) {
+ if (workingSets != null && workingSets.length > 0) {
+ for (IWorkingSet iWorkingSet : workingSets) {
+ for (IAdaptable element : iWorkingSet.getElements()) {
Object resource = element.getAdapter(IResource.class);
- if(resource instanceof IResource) {
- results.addAll(findPapyrusModels((IResource)resource));
+ if (resource instanceof IResource) {
+ results.addAll(findPapyrusModels((IResource) resource));
}
}
}
@@ -205,87 +200,87 @@ public class ScopeCollector implements IScopeCollector { /**
* Create a scope when the container is ISearchPageContainer.WORKSPACE_SCOPE
- *
+ *
* @return
* the scope
*/
protected Collection<URI> createWorkspaceScope() {
Collection<URI> result = new ArrayList<URI>();
-
+
for (IScopeProvider next : getScopeProviders()) {
result.addAll(next.getScope());
}
-
+
return result;
}
private Iterable<? extends IScopeProvider> loadScopeProviders() {
- return new ProvidersReader().load();
+ return new ProvidersReader().load();
}
-
+
final Iterable<? extends IScopeProvider> getScopeProviders() {
List<IScopeProvider> result = new ArrayList<IScopeProvider>();
-
- synchronized(scopeProviders) {
+
+ synchronized (scopeProviders) {
for (IScopeProvider next : scopeProviders) {
result.add(next);
}
}
-
+
return result;
}
-
+
//
// Nested types
//
-
+
private static class PriorityScopeProvider implements IScopeProvider, Comparable<PriorityScopeProvider> {
private final IScopeProvider delegate;
-
+
private final int priority;
-
+
public PriorityScopeProvider(IScopeProvider delegate, int priority) {
this.delegate = delegate;
this.priority = priority;
}
-
+
public int compareTo(PriorityScopeProvider o) {
// sort by descending priority
return o.priority - this.priority;
}
-
+
@Override
public int hashCode() {
return delegate.hashCode();
}
-
+
@Override
public boolean equals(Object obj) {
return (obj instanceof PriorityScopeProvider) && ((PriorityScopeProvider) obj).delegate.equals(delegate);
}
-
+
//
// API delegation
//
-
+
public Collection<URI> getScope() {
return delegate.getScope();
}
-
+
public Collection<URI> getScope(Object selected) {
return delegate.getScope(selected);
}
}
-
+
private class ProvidersReader extends RegistryReader {
private static final String EXT_PT = "scopeProviders"; //$NON-NLS-1$
-
+
private static final String TAG_PROVIDER = "scopeProvider"; //$NON-NLS-1$
-
+
private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
-
+
private static final String ATTR_PRIORITY = "priority"; //$NON-NLS-1$
-
+
private final SortedSet<PriorityScopeProvider> providers = new java.util.TreeSet<PriorityScopeProvider>();
ProvidersReader() {
@@ -293,25 +288,25 @@ public class ScopeCollector implements IScopeCollector { }
Iterable<? extends IScopeProvider> load() {
- synchronized(providers) {
+ synchronized (providers) {
providers.clear();
readRegistry();
}
-
+
return providers;
}
-
+
@Override
protected boolean readElement(IConfigurationElement element, boolean add) {
boolean result = false;
- if(TAG_PROVIDER.equals(element.getName())) {
+ if (TAG_PROVIDER.equals(element.getName())) {
result = true;
String className = element.getAttribute(ATTR_CLASS);
- if((className == null) || (className.length() == 0)) {
+ if ((className == null) || (className.length() == 0)) {
logMissingAttribute(element, ATTR_CLASS);
- } else if(add) {
+ } else if (add) {
addProvider(element, className);
} else {
removeProvider(element, className);
@@ -325,16 +320,16 @@ public class ScopeCollector implements IScopeCollector { try {
Object provider = element.createExecutableExtension(ATTR_CLASS);
- if(!(provider instanceof IScopeProvider)) {
+ if (!(provider instanceof IScopeProvider)) {
Activator.log.error("Scope provider extension does not implement IScopeProvider interface: " + className, null); //$NON-NLS-1$
} else {
String priorityString = element.getAttribute(ATTR_PRIORITY);
int priority = 0;
try {
- if((priorityString) != null && (priorityString.length() > 0)) {
+ if ((priorityString) != null && (priorityString.length() > 0)) {
priority = Integer.parseInt(priorityString);
- if(priority < 0) {
+ if (priority < 0) {
Activator.log.warn("Negative priority in scope provider " + className); //$NON-NLS-1$
priority = 0;
}
@@ -343,17 +338,17 @@ public class ScopeCollector implements IScopeCollector { Activator.log.warn("Not an integer priority in scope provider " + className); //$NON-NLS-1$
}
- synchronized(providers) {
- providers.add(new PriorityScopeProvider((IScopeProvider)provider, priority));
+ synchronized (providers) {
+ providers.add(new PriorityScopeProvider((IScopeProvider) provider, priority));
}
}
} catch (CoreException e) {
Activator.getDefault().getLog().log(e.getStatus());
}
}
-
+
private void removeProvider(IConfigurationElement element, String className) {
- synchronized(providers) {
+ synchronized (providers) {
for (Iterator<PriorityScopeProvider> iter = providers.iterator(); iter.hasNext();) {
if (iter.next().delegate.getClass().getName().equals(className)) {
iter.remove();
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java index 3a7c9ae311b..9ef2d4c0387 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013, 2014 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -42,9 +42,9 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; /** - * + * * This class is used to aggregate information about the resource that contains the element that raised a match - * + * */ public class ScopeEntry { /** @@ -75,7 +75,7 @@ public class ScopeEntry { public ScopeEntry(URI resourceURI, IServiceRegistryTracker serviceRegistryTracker) { super(); - + this.serviceRegistryTracker = serviceRegistryTracker; this.resourceURI = resourceURI; this.modelSet = getModelSet(); @@ -84,7 +84,7 @@ public class ScopeEntry { public ScopeEntry(URI resourceURI, ServicesRegistry servicesRegistry) { super(); - + this.serviceRegistryTracker = null; this.resourceURI = resourceURI; this.servicesRegistry = servicesRegistry; @@ -94,11 +94,11 @@ public class ScopeEntry { private Collection<IEditorPart> getEditors() { Collection<IEditorPart> results = new HashSet<IEditorPart>(); IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows(); - for(IWorkbenchWindow iWorkbenchWindow : windows) { + for (IWorkbenchWindow iWorkbenchWindow : windows) { IWorkbenchPage[] pages = iWorkbenchWindow.getPages(); - for(IWorkbenchPage iWorkbenchPage : pages) { + for (IWorkbenchPage iWorkbenchPage : pages) { IEditorReference[] references = iWorkbenchPage.getEditorReferences(); - for(IEditorReference ref : references) { + for (IEditorReference ref : references) { IEditorPart editor = ref.getEditor(true); results.add(editor); } @@ -114,17 +114,17 @@ public class ScopeEntry { ServicesRegistry serviceRegistry = new ServicesRegistry(); serviceRegistry.add(LabelProviderService.class, 10, new LabelProviderServiceImpl()); serviceRegistry.add(OpenElementService.class, 10, new OpenElementServiceImpl()); - // PageIconRegistryServiceFactory factory = new PageIconRegistryServiceFactory(); - // Object instance = factory.createServiceInstance(); - // serviceRegistry.add(IPageIconsRegistry.class, 10, instance); - // serviceRegistry.add(IPageIconsRegistry.class, 10, new PageIconRegistryServiceFactory()); + // PageIconRegistryServiceFactory factory = new PageIconRegistryServiceFactory(); + // Object instance = factory.createServiceInstance(); + // serviceRegistry.add(IPageIconsRegistry.class, 10, instance); + // serviceRegistry.add(IPageIconsRegistry.class, 10, new PageIconRegistryServiceFactory()); serviceRegistry.startRegistry(); - if(serviceRegistryTracker != null) { + if (serviceRegistryTracker != null) { // register this service registry for automatic shut-down when it is no longer needed serviceRegistryTracker.track(this, serviceRegistry); } - + return serviceRegistry; } catch (ServiceException e) { Activator.log.error(Messages.ScopeEntry_0, e); @@ -133,12 +133,12 @@ public class ScopeEntry { } public ModelSet getModelSet() { - //If null, try to find one or create one - if(modelSet == null) { + // If null, try to find one or create one + if (modelSet == null) { try { modelSet = ServiceUtils.getInstance().getModelSet(getServicesRegistry()); } catch (ServiceException e) { - //Create one + // Create one try { modelSet = ModelUtils.openResource(getResourceURI()); @@ -159,10 +159,10 @@ public class ScopeEntry { private IEditorPart editorOnResource() { Collection<IEditorPart> editors = getEditors(); - for(IEditorPart editor : editors) { + for (IEditorPart editor : editors) { - if(editor != null) { - if(getResourceURI().equals(EditorUtils.getResourceURI(editor))) { + if (editor != null) { + if (getResourceURI().equals(EditorUtils.getResourceURI(editor))) { return editor; } } @@ -173,9 +173,9 @@ public class ScopeEntry { private ServicesRegistry getUpdatedServiceRegistry() { IEditorPart editor = editorOnResource(); - if(editor != null) { + if (editor != null) { - ServicesRegistry registry = (ServicesRegistry)editor.getAdapter(ServicesRegistry.class); + ServicesRegistry registry = (ServicesRegistry) editor.getAdapter(ServicesRegistry.class); return registry; @@ -186,11 +186,11 @@ public class ScopeEntry { public ServicesRegistry getServicesRegistry() { - if(servicesRegistry == null) { - //Try to find existing + if (servicesRegistry == null) { + // Try to find existing ServicesRegistry registry = getUpdatedServiceRegistry(); - if(registry != null) { - //If the OpenElementService is no yet available, we must start it + if (registry != null) { + // If the OpenElementService is no yet available, we must start it try { registry.getService(OpenElementService.class); } catch (ServiceException e) { @@ -210,7 +210,7 @@ public class ScopeEntry { public URI getResourceURI() { return resourceURI; } - + public void setResourceURI(URI resourceURI) { this.resourceURI = resourceURI; } diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/WorkspaceScopeProvider.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/WorkspaceScopeProvider.java index 969d8ceca89..c740a2a69bd 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/WorkspaceScopeProvider.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/WorkspaceScopeProvider.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Christian W. Damus (CEA LIST) - Extracted some of the ScopeCollector implementation. - * + * *****************************************************************************/ package org.eclipse.papyrus.views.search.scope; @@ -43,7 +43,7 @@ public class WorkspaceScopeProvider implements IScopeProvider { } public Collection<URI> getScope() { - //Go through the workspace root + // Go through the workspace root IResource root = ResourcesPlugin.getWorkspace().getRoot(); return findPapyrusModels(root); @@ -52,21 +52,21 @@ public class WorkspaceScopeProvider implements IScopeProvider { public Collection<URI> getScope(Object object) { Collection<URI> results; - if(object instanceof IPapyrusFile) { - results = findPapyrusModels(((IPapyrusFile)object).getMainFile()); - } else if(object instanceof IResource) { - results = findPapyrusModels((IResource)object); + if (object instanceof IPapyrusFile) { + results = findPapyrusModels(((IPapyrusFile) object).getMainFile()); + } else if (object instanceof IResource) { + results = findPapyrusModels((IResource) object); } else { Object element = BusinessModelResolver.getInstance().getBusinessModel(object); - if(element instanceof EObject) { + if (element instanceof EObject) { // CDO resource *are* EObjects - Resource eResource = (element instanceof Resource) ? (Resource) element : ((EObject)element).eResource(); - if(eResource != null) { + Resource eResource = (element instanceof Resource) ? (Resource) element : ((EObject) element).eResource(); + if (eResource != null) { ModelSet modelSet = null; - + try { modelSet = ModelUtils.openResource(eResource.getURI()); - SashModel sashModel = (SashModel)modelSet.getModelChecked(SashModel.MODEL_ID); + SashModel sashModel = (SashModel) modelSet.getModelChecked(SashModel.MODEL_ID); Resource diResource = sashModel.getResource(); if (diResource != null) { results = Collections.singletonList(diResource.getURI()); @@ -86,7 +86,7 @@ public class WorkspaceScopeProvider implements IScopeProvider { } } } - + } else { results = Collections.emptyList(); } @@ -96,15 +96,15 @@ public class WorkspaceScopeProvider implements IScopeProvider { } } - + return results; } /** * Find all Papyrus models from a specific root - * + * * @param res - * the root + * the root * @return * the found Papyrus models */ diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/DefaultServiceRegistryTracker.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/DefaultServiceRegistryTracker.java index 2323b40b257..066eb68bc83 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/DefaultServiceRegistryTracker.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/DefaultServiceRegistryTracker.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -60,7 +60,7 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { // requires monitor private void checkActive() { - if(!active) { + if (!active) { throw new IllegalStateException("not active"); //$NON-NLS-1$ } } @@ -69,7 +69,7 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { checkActive(); TrackerReference existing = getReference(serviceRegistry); - if(existing == null) { + if (existing == null) { // only in this case would we ever track references.add(new TrackerReference(owner, serviceRegistry)); count++; @@ -79,7 +79,7 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { // the reference may have been cleared, in which case we assume the registry // was disposed and the reference did track this owner - if((actualOwner != null) && (actualOwner != owner)) { + if ((actualOwner != null) && (actualOwner != owner)) { throw new IllegalArgumentException("registry already tracked against a different owner"); //$NON-NLS-1$ } } @@ -89,7 +89,7 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { checkActive(); TrackerReference existing = getReference(serviceRegistry); - if((existing != null) && (existing.get() == owner)) { + if ((existing != null) && (existing.get() == owner)) { references.remove(existing); // it will still be enqueued later, but we will ignore it } @@ -99,8 +99,8 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { private TrackerReference getReference(ServicesRegistry serviceRegistry) { TrackerReference result = null; - for(TrackerReference next : references) { - if(next.matches(serviceRegistry)) { + for (TrackerReference next : references) { + if (next.matches(serviceRegistry)) { result = next; } } @@ -110,13 +110,13 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { // requires monitor private void reapLater() { - if(reaper == null) { + if (reaper == null) { reaper = new Runnable() { public void run() { - for(;;) { + for (;;) { try { - if(!dequeue()) { + if (!dequeue()) { // done! break; } @@ -134,15 +134,15 @@ public class DefaultServiceRegistryTracker implements IServiceRegistryTracker { private boolean dequeue() throws InterruptedException { boolean result = true; - TrackerReference ref = (TrackerReference)queue.remove(); + TrackerReference ref = (TrackerReference) queue.remove(); - synchronized(this) { - if(references.remove(ref)) { + synchronized (this) { + if (references.remove(ref)) { // only dispose the service registry if we didn't untrack it! ref.dispose(); } - if(--count <= 0) { + if (--count <= 0) { // nothing more to reap reaper = null; active = false; diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/IServiceRegistryTracker.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/IServiceRegistryTracker.java index fcc65372964..7ff341b80e5 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/IServiceRegistryTracker.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/IServiceRegistryTracker.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2013 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,52 +22,49 @@ import org.eclipse.papyrus.views.search.scope.ScopeEntry; public interface IServiceRegistryTracker { /** - * Queries whether I am still actively tracking service registries and able to handle requests to - * {@link IServiceRegistryTracker#track(Object, ServicesRegistry) track} or {@link #untrack(Object, ServicesRegistry) un-track} service + * Queries whether I am still actively tracking service registries and able to handle requests to {@link IServiceRegistryTracker#track(Object, ServicesRegistry) track} or {@link #untrack(Object, ServicesRegistry) un-track} service * registries. - * + * * @return whether I am currently active */ boolean isActive(); /** * <p> - * Adds a service registry for me to track. Multiple service registries may be tracked against one owner, but a service registry may only be - * tracked against at most one owner. + * Adds a service registry for me to track. Multiple service registries may be tracked against one owner, but a service registry may only be tracked against at most one owner. * </p> * <p> * Has no effect if this {@code serviceRegistry} is already tracked against this {@code owner}. * </p> - * + * * @param owner - * the owner of the {@code serviceRegistry}. I track references to this object; when it is no longer in use, the {@code serviceRegistry} is - * shut down. - * + * the owner of the {@code serviceRegistry}. I track references to this object; when it is no longer in use, the {@code serviceRegistry} is + * shut down. + * * @param serviceRegistry - * a service registry to shut down when its {@code owner} is no longer in use - * + * a service registry to shut down when its {@code owner} is no longer in use + * * @throws IllegalArgumentException - * if this {@code serviceRegistry} is already tracked against a different owner than the given {@code owner} - * + * if this {@code serviceRegistry} is already tracked against a different owner than the given {@code owner} + * * @throws IllegalStateException - * if I am not {@link #isActive() active} - * + * if I am not {@link #isActive() active} + * * @see #untrack(Object, ServicesRegistry) * @see #isActive() */ void track(Object owner, ServicesRegistry serviceRegistry); /** - * Stops tracking the given service registry. Has no effect if this {@code serviceRegistry} is not currently being - * {@linkplain #track(Object, ServicesRegistry) tracked} against this {@code owner}. - * + * Stops tracking the given service registry. Has no effect if this {@code serviceRegistry} is not currently being {@linkplain #track(Object, ServicesRegistry) tracked} against this {@code owner}. + * * @param owner - * the owner of the {@code serviceRegistry} + * the owner of the {@code serviceRegistry} * @param serviceRegistry - * a service registry that I may be tracking against its {@code owner} - * + * a service registry that I may be tracking against its {@code owner} + * * @throws IllegalStateException - * if I am not {@link #isActive() active} + * if I am not {@link #isActive() active} */ void untrack(Object owner, ServicesRegistry serviceRegistry); } diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/MatchUtils.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/MatchUtils.java index 2c3081ee678..4d2aaf0e2f4 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/MatchUtils.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/MatchUtils.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,20 +24,20 @@ import org.eclipse.search.ui.text.AbstractTextSearchResult; import org.eclipse.search.ui.text.Match;
/**
- *
+ *
* Util class to manipulate ModelMatches
- *
+ *
*/
public class MatchUtils {
/**
* Get all matches from a search result whose element as a specific type
- *
+ *
* @param searchResult
* @param type
- * the type of the element
+ * the type of the element
* @param checkFiltered
- * whether filtered matches must be considered are not
+ * whether filtered matches must be considered are not
* @return
*/
public static Set<AbstractResultEntry> getMatches(AbstractTextSearchResult searchResult, Class<?> type, boolean checkFiltered) {
@@ -45,27 +45,27 @@ public class MatchUtils { List<Object> elementList = Arrays.asList(searchResult.getElements());
- for(Object element : elementList) {
- for(Match match : searchResult.getMatches(element)) {
+ for (Object element : elementList) {
+ for (Match match : searchResult.getMatches(element)) {
- if(match instanceof AbstractResultEntry) {
+ if (match instanceof AbstractResultEntry) {
- if(match.getElement() instanceof ScopeEntry) {
- // ScopeEntry scope = (ScopeEntry)match.getElement();
- // ((AbstractResultEntry)element).recursiveHierarchy((AbstractResultEntry)element, scope);
+ if (match.getElement() instanceof ScopeEntry) {
+ // ScopeEntry scope = (ScopeEntry)match.getElement();
+ // ((AbstractResultEntry)element).recursiveHierarchy((AbstractResultEntry)element, scope);
boolean toAdd = false;
- if(checkFiltered) {
- if(!match.isFiltered()) {
+ if (checkFiltered) {
+ if (!match.isFiltered()) {
toAdd = true;
}
} else {
toAdd = true;
}
- if(toAdd) {
- if(type.isAssignableFrom(((AbstractResultEntry)match).elementToCheckFilterFor().getClass())) {
- results.add((AbstractResultEntry)match);
+ if (toAdd) {
+ if (type.isAssignableFrom(((AbstractResultEntry) match).elementToCheckFilterFor().getClass())) {
+ results.add((AbstractResultEntry) match);
}
}
}
@@ -81,11 +81,11 @@ public class MatchUtils { /**
* Get all matches from a search result whose element as a specific type
- *
+ *
* @param searchResult
* @param checkFiltered
- * whether filtered matches must be considered are not
- *
+ * whether filtered matches must be considered are not
+ *
* @return
*/
public static Set<AbstractResultEntry> getMatches(AbstractTextSearchResult searchResult, boolean checkFiltered) {
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/ModelUtils.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/ModelUtils.java index 625c3388ba2..5609520b01c 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/ModelUtils.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/ModelUtils.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,11 +18,11 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelsReader;
- +
public class ModelUtils {
- +
public final static ModelSet openResource(URI resourceURI) throws ModelMultiException {
- if(resourceURI != null) {
+ if (resourceURI != null) {
// TODO: Need to be able to create CDOAwareModelSet
ModelSet modelSet = new ModelSet();
ModelsReader reader = new ModelsReader();
@@ -33,5 +33,5 @@ public class ModelUtils { return null;
}
}
-
+
}
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/IParticipantValidator.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/IParticipantValidator.java index f4e3547728b..a17e8f2c91e 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/IParticipantValidator.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/IParticipantValidator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,19 +18,19 @@ import java.util.Collection; import org.eclipse.emf.ecore.EObject;
/**
- *
+ *
* Interface to implement to have a specific content validator. It is used to select only the elements that will be used to find patterns.
- *
+ *
*/
public interface IParticipantValidator {
/**
* Return the elements that will participate (i.e. the participants) in the search query based on a list of types
- *
+ *
* @param root
- * all the children and itself will be check against the list of types
+ * all the children and itself will be check against the list of types
* @param participantsTypes
- * the types of the wanted participants
+ * the types of the wanted participants
* @return
* the elements that are of wanted types
*/
diff --git a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/ParticipantValidator.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/ParticipantValidator.java index e592897ece8..f234bfcddb3 100644 --- a/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/ParticipantValidator.java +++ b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/ParticipantValidator.java @@ -1,7 +1,7 @@ /*****************************************************************************
* Copyright (c) 2013 CEA LIST.
*
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,9 +22,9 @@ import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject;
/**
- *
+ *
* A generic implementation of participant validator that works on EMF basis
- *
+ *
*/
public class ParticipantValidator implements IParticipantValidator {
@@ -36,9 +36,9 @@ public class ParticipantValidator implements IParticipantValidator { public final static ParticipantValidator getInstance() {
-
- synchronized(ParticipantValidator.class) {
- if(ParticipantValidator.instance == null) {
+
+ synchronized (ParticipantValidator.class) {
+ if (ParticipantValidator.instance == null) {
ParticipantValidator.instance = new ParticipantValidator();
}
@@ -52,16 +52,16 @@ public class ParticipantValidator implements IParticipantValidator { List<EObject> results = new ArrayList<EObject>();
// Evaluate root...
- if(participantsTypesList.contains(root.eClass())) {
+ if (participantsTypesList.contains(root.eClass())) {
results.add(root);
}
// ... and all its content
TreeIterator<EObject> it = root.eAllContents();
- while(it.hasNext()) {
- EObject modelElement = (EObject)it.next();
- //Check that metaclass of this element is a supported metaclass
- if(participantsTypesList.contains(modelElement.eClass())) {
+ while (it.hasNext()) {
+ EObject modelElement = it.next();
+ // Check that metaclass of this element is a supported metaclass
+ if (participantsTypesList.contains(modelElement.eClass())) {
results.add(modelElement);
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextItemProvider.java b/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextItemProvider.java index 85efdb9fdcc..45f6a50aeee 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextItemProvider.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextItemProvider.java @@ -33,11 +33,12 @@ import org.eclipse.papyrus.views.properties.environment.provider.PropertiesEditP * This is the item provider adapter for a {@link org.eclipse.papyrus.views.properties.contexts.Context} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class ContextItemProvider
- extends EModelElementItemProvider
- implements
+ extends EModelElementItemProvider
+ implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
@@ -47,6 +48,7 @@ public class ContextItemProvider * This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public ContextItemProvider(AdapterFactory adapterFactory) {
@@ -57,6 +59,7 @@ public class ContextItemProvider * This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -74,52 +77,54 @@ public class ContextItemProvider * This adds a property descriptor for the Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Context_name_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_Context_name_feature", "_UI_Context_type"),
- ContextsPackage.Literals.CONTEXT__NAME,
- true,
- false,
- false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null,
- null));
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Context_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Context_name_feature", "_UI_Context_type"),
+ ContextsPackage.Literals.CONTEXT__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
}
/**
* This adds a property descriptor for the Dependencies feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void addDependenciesPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_Context_dependencies_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_Context_dependencies_feature", "_UI_Context_type"),
- ContextsPackage.Literals.CONTEXT__DEPENDENCIES,
- true,
- false,
- true,
- null,
- null,
- null));
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Context_dependencies_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Context_dependencies_feature", "_UI_Context_type"),
+ ContextsPackage.Literals.CONTEXT__DEPENDENCIES,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
}
/**
- * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
- * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -136,6 +141,7 @@ public class ContextItemProvider /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -150,6 +156,7 @@ public class ContextItemProvider * This returns Context.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -161,14 +168,15 @@ public class ContextItemProvider * This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
public String getText(Object object) {
- String label = ((Context)object).getName();
+ String label = ((Context) object).getName();
return label == null || label.length() == 0 ?
- getString("_UI_Context_type") :
- getString("_UI_Context_type") + " " + label;
+ getString("_UI_Context_type") :
+ getString("_UI_Context_type") + " " + label;
}
/**
@@ -176,6 +184,7 @@ public class ContextItemProvider * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -183,14 +192,14 @@ public class ContextItemProvider updateChildren(notification);
switch (notification.getFeatureID(Context.class)) {
- case ContextsPackage.CONTEXT__NAME:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
- return;
- case ContextsPackage.CONTEXT__TABS:
- case ContextsPackage.CONTEXT__VIEWS:
- case ContextsPackage.CONTEXT__DATA_CONTEXTS:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
- return;
+ case ContextsPackage.CONTEXT__NAME:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case ContextsPackage.CONTEXT__TABS:
+ case ContextsPackage.CONTEXT__VIEWS:
+ case ContextsPackage.CONTEXT__DATA_CONTEXTS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
}
super.notifyChanged(notification);
}
@@ -200,6 +209,7 @@ public class ContextItemProvider * that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -207,25 +217,26 @@ public class ContextItemProvider super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
- (createChildParameter
+ (createChildParameter
(ContextsPackage.Literals.CONTEXT__TABS,
- ContextsFactory.eINSTANCE.createTab()));
+ ContextsFactory.eINSTANCE.createTab()));
newChildDescriptors.add
- (createChildParameter
+ (createChildParameter
(ContextsPackage.Literals.CONTEXT__VIEWS,
- ContextsFactory.eINSTANCE.createView()));
+ ContextsFactory.eINSTANCE.createView()));
newChildDescriptors.add
- (createChildParameter
+ (createChildParameter
(ContextsPackage.Literals.CONTEXT__DATA_CONTEXTS,
- ContextsFactory.eINSTANCE.createDataContextRoot()));
+ ContextsFactory.eINSTANCE.createDataContextRoot()));
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextsItemProviderAdapterFactory.java b/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextsItemProviderAdapterFactory.java index 2e0fb132d83..1fa28dfb6e4 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextsItemProviderAdapterFactory.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/ContextsItemProviderAdapterFactory.java @@ -32,6 +32,7 @@ import org.eclipse.papyrus.views.properties.contexts.util.ContextsAdapterFactory * Note that most of the adapters are shared among multiple instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
@@ -39,6 +40,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the root adapter factory that delegates to this adapter factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ComposedAdapterFactory parentAdapterFactory;
@@ -47,6 +49,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected IChangeNotifier changeNotifier = new ChangeNotifier();
@@ -55,6 +58,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected Collection<Object> supportedTypes = new ArrayList<Object>();
@@ -63,6 +67,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This constructs an instance.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public ContextsItemProviderAdapterFactory() {
@@ -77,6 +82,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.Context} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ContextItemProvider contextItemProvider;
@@ -85,6 +91,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.Context}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -100,6 +107,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.Tab} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected TabItemProvider tabItemProvider;
@@ -108,6 +116,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.Tab}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -123,6 +132,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.View} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected ViewItemProvider viewItemProvider;
@@ -131,6 +141,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.View}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -146,6 +157,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.Section} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected SectionItemProvider sectionItemProvider;
@@ -154,6 +166,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.Section}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -169,6 +182,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.DataContextElement} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected DataContextElementItemProvider dataContextElementItemProvider;
@@ -177,6 +191,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.DataContextElement}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -192,6 +207,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.Property} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected PropertyItemProvider propertyItemProvider;
@@ -200,6 +216,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.Property}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -215,6 +232,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.UnknownProperty} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected UnknownPropertyItemProvider unknownPropertyItemProvider;
@@ -223,6 +241,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.UnknownProperty}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -238,6 +257,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.DataContextPackage} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected DataContextPackageItemProvider dataContextPackageItemProvider;
@@ -246,6 +266,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.DataContextPackage}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -261,6 +282,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.views.properties.contexts.DataContextRoot} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected DataContextRootItemProvider dataContextRootItemProvider;
@@ -269,6 +291,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This creates an adapter for a {@link org.eclipse.papyrus.views.properties.contexts.DataContextRoot}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -284,8 +307,10 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
+ @Override
public ComposeableAdapterFactory getRootAdapterFactory() {
return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
}
@@ -294,8 +319,10 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This sets the composed adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
+ @Override
public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
this.parentAdapterFactory = parentAdapterFactory;
}
@@ -303,6 +330,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -314,6 +342,7 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This implementation substitutes the factory itself as the key for the adapter.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -324,13 +353,14 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
public Object adapt(Object object, Object type) {
if (isFactoryForType(type)) {
Object adapter = super.adapt(object, type);
- if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) {
return adapter;
}
}
@@ -342,8 +372,10 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This adds a listener.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
+ @Override
public void addListener(INotifyChangedListener notifyChangedListener) {
changeNotifier.addListener(notifyChangedListener);
}
@@ -352,8 +384,10 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This removes a listener.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
+ @Override
public void removeListener(INotifyChangedListener notifyChangedListener) {
changeNotifier.removeListener(notifyChangedListener);
}
@@ -362,8 +396,10 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
+ @Override
public void fireNotifyChanged(Notification notification) {
changeNotifier.fireNotifyChanged(notification);
@@ -373,21 +409,41 @@ public class ContextsItemProviderAdapterFactory extends ContextsAdapterFactory i }
/**
- * This disposes all of the item providers created by this factory.
+ * This disposes all of the item providers created by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
+ @Override
public void dispose() {
- if (contextItemProvider != null) contextItemProvider.dispose();
- if (tabItemProvider != null) tabItemProvider.dispose();
- if (viewItemProvider != null) viewItemProvider.dispose();
- if (sectionItemProvider != null) sectionItemProvider.dispose();
- if (dataContextElementItemProvider != null) dataContextElementItemProvider.dispose();
- if (propertyItemProvider != null) propertyItemProvider.dispose();
- if (unknownPropertyItemProvider != null) unknownPropertyItemProvider.dispose();
- if (dataContextPackageItemProvider != null) dataContextPackageItemProvider.dispose();
- if (dataContextRootItemProvider != null) dataContextRootItemProvider.dispose();
+ if (contextItemProvider != null) {
+ contextItemProvider.dispose();
+ }
+ if (tabItemProvider != null) {
+ tabItemProvider.dispose();
+ }
+ if (viewItemProvider != null) {
+ viewItemProvider.dispose();
+ }
+ if (sectionItemProvider != null) {
+ sectionItemProvider.dispose();
+ }
+ if (dataContextElementItemProvider != null) {
+ dataContextElementItemProvider.dispose();
+ }
+ if (propertyItemProvider != null) {
+ propertyItemProvider.dispose();
+ }
+ if (unknownPropertyItemProvider != null) {
+ unknownPropertyItemProvider.dispose();
+ }
+ if (dataContextPackageItemProvider != null) {
+ dataContextPackageItemProvider.dispose();
+ }
+ if (dataContextRootItemProvider != null) {
+ dataContextRootItemProvider.dispose();
+ }
}
}
diff --git a/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/DataContextElementItemProvider.java b/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/DataContextElementItemProvider.java index 507d5548cf3..11252dd3445 100644 --- a/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/DataContextElementItemProvider.java +++ b/plugins/views/properties/org.eclipse.papyrus.views.properties.model.edit/src-gen/org/eclipse/papyrus/views/properties/contexts/provider/DataContextElementItemProvider.java @@ -33,11 +33,12 @@ import org.eclipse.papyrus.views.properties.environment.provider.PropertiesEditP * This is the item provider adapter for a {@link org.eclipse.papyrus.views.properties.contexts.DataContextElement} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public class DataContextElementItemProvider
- extends ItemProviderAdapter
- implements
+ extends ItemProviderAdapter
+ implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
@@ -47,6 +48,7 @@ public class DataContextElementItemProvider * This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
public DataContextElementItemProvider(AdapterFactory adapterFactory) {
@@ -57,6 +59,7 @@ public class DataContextElementItemProvider * This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -74,52 +77,54 @@ public class DataContextElementItemProvider * This adds a property descriptor for the Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_DataContextElement_name_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_DataContextElement_name_feature", "_UI_DataContextElement_type"),
- ContextsPackage.Literals.DATA_CONTEXT_ELEMENT__NAME,
- true,
- false,
- false,
- ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
- null,
- null));
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DataContextElement_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DataContextElement_name_feature", "_UI_DataContextElement_type"),
+ ContextsPackage.Literals.DATA_CONTEXT_ELEMENT__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
}
/**
* This adds a property descriptor for the Supertypes feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
protected void addSupertypesPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
- (createItemPropertyDescriptor
- (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
- getResourceLocator(),
- getString("_UI_DataContextElement_supertypes_feature"),
- getString("_UI_PropertyDescriptor_description", "_UI_DataContextElement_supertypes_feature", "_UI_DataContextElement_type"),
- ContextsPackage.Literals.DATA_CONTEXT_ELEMENT__SUPERTYPES,
- true,
- false,
- true,
- null,
- null,
- null));
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DataContextElement_supertypes_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DataContextElement_supertypes_feature", "_UI_DataContextElement_type"),
+ ContextsPackage.Literals.DATA_CONTEXT_ELEMENT__SUPERTYPES,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
}
/**
- * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
- * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -134,6 +139,7 @@ public class DataContextElementItemProvider /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -148,6 +154,7 @@ public class DataContextElementItemProvider * This returns DataContextElement.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -159,14 +166,15 @@ public class DataContextElementItemProvider * This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
public String getText(Object object) {
- String label = ((DataContextElement)object).getName();
+ String label = ((DataContextElement) object).getName();
return label == null || label.length() == 0 ?
- getString("_UI_DataContextElement_type") :
- getString("_UI_DataContextElement_type") + " " + label;
+ getString("_UI_DataContextElement_type") :
+ getString("_UI_DataContextElement_type") + " " + label;
}
/**
@@ -174,6 +182,7 @@ public class DataContextElementItemProvider * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -181,12 +190,12 @@ public class DataContextElementItemProvider updateChildren(notification);
switch (notification.getFeatureID(DataContextElement.class)) {
- case ContextsPackage.DATA_CONTEXT_ELEMENT__NAME:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
- return;
- case ContextsPackage.DATA_CONTEXT_ELEMENT__PROPERTIES:
- fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
- return;
+ case ContextsPackage.DATA_CONTEXT_ELEMENT__NAME:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case ContextsPackage.DATA_CONTEXT_ELEMENT__PROPERTIES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
}
super.notifyChanged(notification);
}
@@ -196,6 +205,7 @@ public class DataContextElementItemProvider * that can be created under this object.
* <!-- begin-user-doc -->
|