Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2013-07-30 04:57:26 -0400
committerFlorian Noyrit2013-07-30 04:57:26 -0400
commit2b8765d82cbb57fc898c2022cec9726139300c5b (patch)
tree24d52b043c0dc697616fb7a2f25dc0d0c8068041 /plugins/views/org.eclipse.papyrus.views.search
parent0cf8e396f1c70664a78562f7a07bffd7479bacd0 (diff)
downloadorg.eclipse.papyrus-2b8765d82cbb57fc898c2022cec9726139300c5b.tar.gz
org.eclipse.papyrus-2b8765d82cbb57fc898c2022cec9726139300c5b.tar.xz
org.eclipse.papyrus-2b8765d82cbb57fc898c2022cec9726139300c5b.zip
Search model element by types (UML metaclass or stereotype). No pointer
to matching element in results. Update results when models are modified. Update OCL search.
Diffstat (limited to 'plugins/views/org.eclipse.papyrus.views.search')
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF1
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java64
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java79
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java33
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java43
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java32
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java38
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/utils/MatchUtils.java29
8 files changed, 258 insertions, 61 deletions
diff --git a/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF b/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF
index 97d89a96591..a2d393046bf 100644
--- a/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF
+++ b/plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF
@@ -26,4 +26,5 @@ Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.views.search.Activator
Bundle-SymbolicName: org.eclipse.papyrus.views.search;singleton:=true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.uml2.uml
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 0f15437900a..17f561a69ca 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
@@ -13,7 +13,15 @@
*****************************************************************************/
package org.eclipse.papyrus.views.search.results;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService;
import org.eclipse.papyrus.views.search.scope.ScopeEntry;
@@ -39,6 +47,10 @@ public abstract class AbstractResultEntry extends Match {
*/
protected Object parent;
+ protected URI uriSource;
+
+ protected java.net.URI uriResource;
+
/**
* Used to specify offset and length of {@link Match} when these attributes are not meaningful
*/
@@ -76,16 +88,16 @@ public abstract class AbstractResultEntry extends Match {
* @param scopeEntry
* the {@link ScopeEntry} corresponding to the resource that contains the element that matches
*/
- protected void recursiveHierarchy(AbstractResultEntry child, ScopeEntry scopeEntry) {
+ public void recursiveHierarchy(AbstractResultEntry child) {
if(child.getSource() instanceof EObject) {
EObject potentialParent = ((EObject)child.getSource()).eContainer();
if(potentialParent != null) {
- ResultEntry theParent = new ResultEntry(potentialParent, scopeEntry);
+ ResultEntry theParent = new ResultEntry(potentialParent, (ScopeEntry)this.getElement());
child.setParent(theParent);
- recursiveHierarchy(theParent, scopeEntry);
+ recursiveHierarchy(theParent);
} else {
- ResultEntry theParent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
+ ResultEntry theParent = new ResultEntry(((ScopeEntry)this.getElement()).getResource(), (ScopeEntry)this.getElement());
child.setParent(theParent);
}
}
@@ -130,10 +142,23 @@ public abstract class AbstractResultEntry extends Match {
@Override
public boolean equals(Object obj) {
if(obj instanceof AbstractResultEntry) {
- if(((AbstractResultEntry)obj).getSource().equals(this.source)) {
- if(((AbstractResultEntry)obj).getOffset() == this.getOffset()) {
- if(((AbstractResultEntry)obj).getLength() == this.getLength()) {
- return true;
+ 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;
+ }
+ }
+ }
+ } else {
+ if(((AbstractResultEntry)obj).getSource() != null) {
+ if(((AbstractResultEntry)obj).getSource().equals(this.getSource())) {
+ if(((AbstractResultEntry)obj).getOffset() == this.getOffset()) {
+ if(((AbstractResultEntry)obj).getLength() == this.getLength()) {
+ return true;
+ }
+ }
+
}
}
}
@@ -157,11 +182,29 @@ public abstract class AbstractResultEntry extends Match {
*/
public AbstractResultEntry(int offset, int lenght, Object source, ScopeEntry scopeEntry) {
super(scopeEntry, offset, lenght);
- this.source = source;
+ // this.source = source;
+ if(source instanceof EObject) {
+
+ this.uriSource = EcoreUtil.getURI((EObject)source);
+ } else if(source instanceof IResource) {
+ this.uriResource = ((IResource)source).getLocationURI();
+ }
}
public Object getSource() {
- return source;
+ 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();
+
+
+ IPath path = new Path(this.uriResource.getPath());
+ return root.getFile(path);
+ }
+
+ return null;
}
public void setSource(Object source) {
@@ -182,5 +225,4 @@ public abstract class AbstractResultEntry extends Match {
}
-
}
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 e2825b6ade9..4932a486b14 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
@@ -13,11 +13,14 @@
*****************************************************************************/
package org.eclipse.papyrus.views.search.results;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService;
import org.eclipse.papyrus.views.search.scope.ScopeEntry;
import org.eclipse.ui.PartInitException;
+import org.eclipse.uml2.uml.Stereotype;
/**
*
@@ -29,7 +32,14 @@ public class AttributeMatch extends ModelMatch {
/**
* The element containing the value of the attribute that matches
*/
- protected Object target;
+
+ protected URI uriSource;
+
+ protected Object attribute;
+
+ private Stereotype stereotype;
+
+
/**
* Similar to {@link AbstractResultEntry} but adds an information about which attribute raised the match and which element contains the value of
@@ -43,11 +53,16 @@ public class AttributeMatch extends ModelMatch {
* @param attribute
* the attribute that raised the match
*/
- public AttributeMatch(int offset, int lenght, Object target, ScopeEntry scopeEntry, Object attribute) {
- super(offset, lenght, attribute, scopeEntry);
- this.target = target;
+ 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);
+ // }
this.parent = new ResultEntry(target, scopeEntry);
- recursiveHierarchy((AbstractResultEntry)parent, scopeEntry);
+ recursiveHierarchy((AbstractResultEntry)parent);
}
/**
@@ -62,8 +77,14 @@ public class AttributeMatch extends ModelMatch {
public boolean equals(Object obj) {
if(obj instanceof AttributeMatch) {
if(super.equals(obj)) {
- if(((AttributeMatch)obj).getTarget().equals(this.target)) {
- return true;
+ 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())) {
+ return true;
+ }
}
}
return false;
@@ -73,13 +94,22 @@ public class AttributeMatch extends ModelMatch {
}
}
- public Object getTarget() {
- return target;
- }
-
- public void setTarget(Object target) {
- this.target = target;
- }
+ // 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);
+ // }
+ //
+ // }
/**
*
@@ -101,7 +131,7 @@ public class AttributeMatch extends ModelMatch {
*/
@Override
public Object elementToCheckFilterFor() {
- return target;
+ return this.getSource();
}
/**
@@ -112,9 +142,24 @@ public class AttributeMatch extends ModelMatch {
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(target instanceof EObject) {
- return service.openSemanticElement((EObject)target);
+ if(this.getSource() instanceof EObject) {
+ return service.openSemanticElement((EObject)this.getSource());
}
return null;
}
+
+ public Object getMetaAttribute() {
+ // TODO Auto-generated method stub
+ return this.attribute;
+ }
+
+ public Stereotype getStereotype() {
+ return stereotype;
+ }
+
+
+ public void setStereotype(Stereotype stereotype) {
+ this.stereotype = stereotype;
+ }
+
}
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 61b7bfa94e4..122f40dd1a0 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
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.views.search.results;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService;
import org.eclipse.papyrus.views.search.scope.ScopeEntry;
@@ -26,9 +27,13 @@ import org.eclipse.ui.PartInitException;
*/
public class ModelElementMatch extends ModelMatch {
+
+
public ModelElementMatch(Object source, ScopeEntry scopeEntry) {
super(UNSPECIFIED, UNSPECIFIED, source, scopeEntry);
- recursiveHierarchy(this, scopeEntry);
+ recursiveHierarchy(this);
+
+
// this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
}
@@ -56,7 +61,12 @@ public class ModelElementMatch extends ModelMatch {
*/
@Override
public Object elementToDisplay() {
- return source;
+ // return this.getSource();
+ if(this.uriSource != null) {
+ ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ return resSet.getEObject(this.uriSource, true);
+ }
+ return null;
}
/**
@@ -67,9 +77,21 @@ public class ModelElementMatch extends ModelMatch {
*/
@Override
public Object elementToCheckFilterFor() {
- return source;
+ return this.getSource();
}
+ // @Override
+ // public Object 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#openElement()
@@ -78,8 +100,9 @@ public class ModelElementMatch extends ModelMatch {
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(source instanceof EObject) {
- return service.openSemanticElement((EObject)source);
+ 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/ResultEntry.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ResultEntry.java
index cd93a65c61d..9c917f531f9 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
@@ -13,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.views.search.results;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService;
@@ -26,8 +27,12 @@ import org.eclipse.ui.PartInitException;
*/
public class ResultEntry extends AbstractResultEntry {
+
+
public ResultEntry(Object source, ScopeEntry scopeEntry) {
super(UNSPECIFIED, UNSPECIFIED, source, scopeEntry);
+
+
}
/**
@@ -38,9 +43,30 @@ public class ResultEntry extends AbstractResultEntry {
*/
@Override
public Object elementToDisplay() {
- return source;
+ return this.getSource();
+
+
+
}
+ // @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();
+ //
+ //
+ // IPath path = new Path(this.uriResource.getPath());
+ // return root.getFile(path);
+ // }
+ // return null;
+ //
+ //
+ // }
+
/**
*
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToCheckFilterFor()
@@ -49,9 +75,14 @@ public class ResultEntry extends AbstractResultEntry {
*/
@Override
public Object elementToCheckFilterFor() {
- return source;
+ // 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()
@@ -60,9 +91,13 @@ public class ResultEntry extends AbstractResultEntry {
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(source instanceof EObject) {
- return service.openElement((EObject)source);
+ 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/ViewerMatch.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ViewerMatch.java
index 06c152c236d..b552426b712 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
@@ -13,7 +13,10 @@
*****************************************************************************/
package org.eclipse.papyrus.views.search.results;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.services.openelement.service.OpenElementService;
import org.eclipse.papyrus.views.search.scope.ScopeEntry;
@@ -29,11 +32,14 @@ public class ViewerMatch extends AbstractResultEntry {
/**
* The model element that is represented by the viewer
*/
- protected Object semanticElement;
+ protected URI URIsemanticElement;
public ViewerMatch(Object source, ScopeEntry scopeEntry, Object semanticElement) {
super(UNSPECIFIED, UNSPECIFIED, source, scopeEntry);
- this.semanticElement = semanticElement;
+ if(semanticElement instanceof EObject) {
+ this.URIsemanticElement = EcoreUtil.getURI((EObject)semanticElement);
+ }
+
this.parent = getLastParent(this, scopeEntry);
// this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
@@ -41,11 +47,17 @@ public class ViewerMatch extends AbstractResultEntry {
}
public Object getSemanticElement() {
- return semanticElement;
+ if(this.URIsemanticElement != null) {
+ ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ return resSet.getEObject(this.URIsemanticElement, true);
+ }
+ return null;
}
public void setSemanticElement(Object semanticElement) {
- this.semanticElement = semanticElement;
+ if(semanticElement instanceof EObject) {
+ this.URIsemanticElement = EcoreUtil.getURI((EObject)semanticElement);
+ }
}
/**
@@ -56,7 +68,7 @@ public class ViewerMatch extends AbstractResultEntry {
*/
@Override
public Object elementToDisplay() {
- return source;
+ return this.getSource();
}
/**
@@ -67,7 +79,11 @@ public class ViewerMatch extends AbstractResultEntry {
*/
@Override
public Object elementToCheckFilterFor() {
- return semanticElement;
+ if(this.URIsemanticElement != null) {
+ ResourceSet resSet = ((ScopeEntry)this.getElement()).getModelSet();
+ return resSet.getEObject(this.URIsemanticElement, true);
+ }
+ return null;
}
/**
@@ -78,8 +94,8 @@ public class ViewerMatch extends AbstractResultEntry {
*/
@Override
public Object openElement(OpenElementService service) throws ServiceException, PartInitException {
- if(source instanceof EObject) {
- return service.openElement((EObject)source);
+ 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/ScopeEntry.java b/plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeEntry.java
index b1a76dd602b..6c81f513b19 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
@@ -16,7 +16,11 @@ package org.eclipse.papyrus.views.search.scope;
import java.util.Collection;
import java.util.HashSet;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.services.ServiceException;
@@ -59,12 +63,16 @@ public class ScopeEntry {
/**
* The resource that contains the element that raised a match
*/
- private IResource resource;
+ // private IResource resource;
+
+ private IPath pathResource;
public ScopeEntry(IResource resource) {
super();
- this.resource = resource;
+ // this.resource = resource;
+
+ this.pathResource = resource.getFullPath();
this.modelSet = getModelSet();
this.servicesRegistry = getServicesRegistry();
}
@@ -122,12 +130,13 @@ public class ScopeEntry {
} catch (ServiceException e) {
//Create one
try {
- modelSet = ModelUtils.openFile(resource);
+
+ modelSet = ModelUtils.openFile(this.getResource());
getServicesRegistry().add(ModelSet.class, 10, modelSet);
getServicesRegistry().add(ServiceUtilsForResourceInitializerService.class, 10, new ServiceUtilsForResourceInitializerService());
getServicesRegistry().startServicesByClassKeys(ModelSet.class, ServiceUtilsForResourceInitializerService.class);
} catch (ModelMultiException modelMultiException) {
- Activator.log.error(Messages.ScopeEntry_1 + resource, modelMultiException);
+ Activator.log.error(Messages.ScopeEntry_1 + this.getResource(), modelMultiException);
} catch (ServiceMultiException e1) {
Activator.log.error(e1);
} catch (ServiceNotFoundException e1) {
@@ -148,7 +157,7 @@ public class ScopeEntry {
for(IEditorPart editor : editors) {
if(editor != null) {
- if(ResourceUtil.getResource(editor.getEditorInput()).equals(resource)) {
+ if(ResourceUtil.getResource(editor.getEditorInput()).equals(this.getResource())) {
return editor;
}
}
@@ -200,11 +209,26 @@ public class ScopeEntry {
}
public IResource getResource() {
- return resource;
+
+
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IFile file = root.getFile(pathResource);
+
+ return (IResource)file;
+ // if(this.uriResource != null) {
+ //
+ // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ //
+ //
+ // IPath path = new Path(this.uriResource.getPath());
+ // return root.getFile(path);
+ // } else {
+ // return null;
+ // }
}
public void setResource(IResource resource) {
- this.resource = resource;
+ this.pathResource = resource.getFullPath();
}
}
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 5a52dfaab2e..2c3081ee678 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
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Set;
import org.eclipse.papyrus.views.search.results.AbstractResultEntry;
+import org.eclipse.papyrus.views.search.scope.ScopeEntry;
import org.eclipse.search.ui.text.AbstractTextSearchResult;
import org.eclipse.search.ui.text.Match;
@@ -46,21 +47,31 @@ public class MatchUtils {
for(Object element : elementList) {
for(Match match : searchResult.getMatches(element)) {
+
if(match instanceof AbstractResultEntry) {
- boolean toAdd = false;
- if(checkFiltered) {
- if(!match.isFiltered()) {
+
+ if(match.getElement() instanceof ScopeEntry) {
+ // ScopeEntry scope = (ScopeEntry)match.getElement();
+ // ((AbstractResultEntry)element).recursiveHierarchy((AbstractResultEntry)element, scope);
+
+ boolean toAdd = false;
+ if(checkFiltered) {
+ if(!match.isFiltered()) {
+ toAdd = true;
+ }
+ } else {
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);
+ }
}
}
+
+
+
}
}
}

Back to the top