Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-21 07:43:07 -0400
committerCamille Letavernier2014-08-21 09:50:25 -0400
commitdbc038b44bcbb890ae256d15eb09eb285512f020 (patch)
tree757e736583eea3ae352ad9ac91a81df7e59b79ff /plugins/views/org.eclipse.papyrus.views.search
parentea48a20561464c3cbb7895d430583669a9f82fcc (diff)
downloadorg.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.tar.gz
org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.tar.xz
org.eclipse.papyrus-dbc038b44bcbb890ae256d15eb09eb285512f020.zip
[Code style] Apply clean-up and formatter on Main plug-ins
Diffstat (limited to 'plugins/views/org.eclipse.papyrus.views.search')
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Activator.java2
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/Messages.java2
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/regex/PatternHelper.java70
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java112
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java86
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java46
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelMatch.java6
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java54
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java40
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeCollector.java10
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/IScopeProvider.java15
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ResourceVisitor.java22
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeCollector.java151
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java54
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/WorkspaceScopeProvider.java32
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/DefaultServiceRegistryTracker.java28
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/IServiceRegistryTracker.java43
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/MatchUtils.java40
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/ModelUtils.java10
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/IParticipantValidator.java12
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/validator/ParticipantValidator.java22
21 files changed, 424 insertions, 433 deletions
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);
}
}

Back to the top