Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Noyrit2013-07-16 11:50:45 -0400
committerFlorian Noyrit2013-07-16 11:50:45 -0400
commit69f6175633a55f6737e8e5734ec060d84726fafb (patch)
treee63de510c90e95ab89e1fbcd743ff723e77639b8 /plugins/views/org.eclipse.papyrus.views.search
parent75b5410d69a1df0e8e16a5aeacfea3cd5c1afdb2 (diff)
downloadorg.eclipse.papyrus-69f6175633a55f6737e8e5734ec060d84726fafb.tar.gz
org.eclipse.papyrus-69f6175633a55f6737e8e5734ec060d84726fafb.tar.xz
org.eclipse.papyrus-69f6175633a55f6737e8e5734ec060d84726fafb.zip
OCL-based search and type-based search
Diffstat (limited to 'plugins/views/org.eclipse.papyrus.views.search')
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/META-INF/MANIFEST.MF3
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AbstractResultEntry.java8
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/AttributeMatch.java3
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/results/ModelElementMatch.java16
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ResourceVisitor.java26
-rw-r--r--plugins/views/org.eclipse.papyrus.views.search/src/org/eclipse/papyrus/views/search/scope/ScopeCollector.java4
6 files changed, 40 insertions, 20 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 19886bf244b..97d89a96591 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
@@ -16,8 +16,7 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.105.0",
Export-Package: org.eclipse.papyrus.views.search.regex,
org.eclipse.papyrus.views.search.results,
org.eclipse.papyrus.views.search.scope,
- org.eclipse.papyrus.views.search.utils,
- org.eclipse.papyrus.views.search.validator
+ org.eclipse.papyrus.views.search.utils
Bundle-Vendor: %vendorName
Bundle-ActivationPolicy: lazy
Bundle-Version: 0.10.1.qualifier
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 f4cc60bec0f..0f15437900a 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
@@ -175,4 +175,12 @@ public abstract class AbstractResultEntry extends Match {
public void setParent(Object parent) {
this.parent = parent;
}
+
+ @Override
+ public String toString() {
+ return this.getClass().getSimpleName() + "(" + super.hashCode() + ") : source -> " + source; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+
+
}
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 a15e90b3706..e2825b6ade9 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
@@ -46,7 +46,8 @@ public class AttributeMatch extends ModelMatch {
public AttributeMatch(int offset, int lenght, Object target, ScopeEntry scopeEntry, Object attribute) {
super(offset, lenght, attribute, scopeEntry);
this.target = target;
- this.parent = new ModelElementMatch(target, scopeEntry);
+ this.parent = new ResultEntry(target, scopeEntry);
+ recursiveHierarchy((AbstractResultEntry)parent, scopeEntry);
}
/**
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 60ed57f2fcc..61b7bfa94e4 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
@@ -32,6 +32,22 @@ public class ModelElementMatch extends ModelMatch {
// this.parent = new ResultEntry(scopeEntry.getResource(), scopeEntry);
}
+ @Override
+ public boolean equals(Object obj) {
+ // if(obj instanceof ModelElementMatch) {
+ // if(super.equals(obj)) {
+ //
+ // return true;
+ //
+ // }
+ // return false;
+ //
+ // } else {
+ // return false;
+ // }
+ return super.equals(obj);
+ }
+
/**
*
* @see org.eclipse.papyrus.views.search.results.AbstractResultEntry#elementToDisplay()
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 61d396c9c37..5d68a942328 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
@@ -13,17 +13,14 @@
*****************************************************************************/
package org.eclipse.papyrus.views.search.scope;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
+import java.util.HashSet;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceProxy;
import org.eclipse.core.resources.IResourceProxyVisitor;
import org.eclipse.core.runtime.CoreException;
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.views.search.utils.ModelUtils;
/**
*
@@ -32,11 +29,11 @@ import org.eclipse.papyrus.views.search.utils.ModelUtils;
*/
public class ResourceVisitor implements IResourceProxyVisitor {
- private List<IResource> participants;
+ private Collection<IResource> participants;
public ResourceVisitor() {
super();
- this.participants = new ArrayList<IResource>();
+ this.participants = new HashSet<IResource>();
}
public boolean visit(IResourceProxy proxy) throws CoreException {
@@ -48,13 +45,12 @@ public class ResourceVisitor implements IResourceProxyVisitor {
if("di".equals(uri.fileExtension())) { //$NON-NLS-1$
//Verify that it is a true papyrus model
- try {
- ModelSet modelSet = ModelUtils.openFile(resource);
- modelSet.unload();
- participants.add(resource);
- } catch (ModelMultiException e) {
- }
-
+ // try {
+ // ModelSet modelSet = ModelUtils.openFile(resource);
+ // modelSet.unload();
+ participants.add(resource);
+ // } catch (ModelMultiException e) {
+ // }
}
break;
@@ -64,7 +60,7 @@ public class ResourceVisitor implements IResourceProxyVisitor {
return true;
}
- public List<IResource> getParticipants() {
+ public Collection<IResource> getParticipants() {
return participants;
}
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 ddfdf7f4431..ec2ddfd5975 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
@@ -231,7 +231,7 @@ public class ScopeCollector implements IScopeCollector {
* @return
* the found Papyrus models
*/
- protected List<IResource> findPapyrusModels(IResource res) {
+ protected Collection<IResource> findPapyrusModels(IResource res) {
ResourceVisitor visitor = new ResourceVisitor();
try {
res.accept(visitor, IResource.DEPTH_INFINITE);
@@ -248,7 +248,7 @@ public class ScopeCollector implements IScopeCollector {
* @return
* the scope
*/
- protected List<IResource> createWorkspaceScope() {
+ protected Collection<IResource> createWorkspaceScope() {
//Go through the workspace root
IResource root = ResourcesPlugin.getWorkspace().getRoot();

Back to the top