Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Mackamul2018-08-15 05:25:09 +0000
committerHarald Mackamul2018-08-15 05:25:09 +0000
commita0c021290327a255ddcb22ca236dc379b4ed5828 (patch)
tree7355a975090d4d66244bdfa77209041f83e6b3e6
parent3550c612035f80381ab21e0a65d7cb60901ee654 (diff)
downloadorg.eclipse.app4mc-a0c021290327a255ddcb22ca236dc379b4ed5828.tar.gz
org.eclipse.app4mc-a0c021290327a255ddcb22ca236dc379b4ed5828.tar.xz
org.eclipse.app4mc-a0c021290327a255ddcb22ca236dc379b4ed5828.zip
Disabled custom editing domain (to avoid conflict with ARTOP - see Sphinx Bug 537193)
-rw-r--r--plugins/org.eclipse.app4mc.amalthea.sphinx.ui.editors/src/org/eclipse/app4mc/amalthea/sphinx/ui/editors/search/ModelHitCollector.java17
-rw-r--r--plugins/org.eclipse.app4mc.amalthea.sphinx/plugin.xml6
2 files changed, 16 insertions, 7 deletions
diff --git a/plugins/org.eclipse.app4mc.amalthea.sphinx.ui.editors/src/org/eclipse/app4mc/amalthea/sphinx/ui/editors/search/ModelHitCollector.java b/plugins/org.eclipse.app4mc.amalthea.sphinx.ui.editors/src/org/eclipse/app4mc/amalthea/sphinx/ui/editors/search/ModelHitCollector.java
index f338d0b54..b15adaa7a 100644
--- a/plugins/org.eclipse.app4mc.amalthea.sphinx.ui.editors/src/org/eclipse/app4mc/amalthea/sphinx/ui/editors/search/ModelHitCollector.java
+++ b/plugins/org.eclipse.app4mc.amalthea.sphinx.ui.editors/src/org/eclipse/app4mc/amalthea/sphinx/ui/editors/search/ModelHitCollector.java
@@ -25,12 +25,16 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.emf.common.ui.URIEditorInput;
import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.search.ui.ISearchQuery;
import org.eclipse.search.ui.ISearchResult;
+import org.eclipse.sphinx.emf.ui.util.EcoreUIUtil;
import org.eclipse.ui.IEditorInput;
public class ModelHitCollector implements ISearchQuery {
@@ -64,6 +68,7 @@ public class ModelHitCollector implements ISearchQuery {
if (query != null) {
if(query.startsWith("i:")) {
// New (experimental) search based on Amalthea index (activate with i: as prefix)
+
String modQuery = query.substring(2);
// ***** Search with Amalthea index
@@ -75,8 +80,18 @@ public class ModelHitCollector implements ISearchQuery {
Set<? extends INamed> resultSet = AmaltheaIndex.getElements(model, pattern, INamed.class);
+ // Intermediate solution: filter potential results (folder scope)
+ URI folderUri = model.eResource().getURI().trimSegments(1);
for (INamed element : resultSet) {
- this.searchResult.addMatch(new SearchMatch(element, 0, 0, this.editorInput));
+ // same folder
+ if (element.eResource().getURI().trimSegments(1).equals(folderUri)) {
+ IEditorInput input = this.editorInput;
+ // different file
+ if (model.eResource() != element.eResource()) {
+ input = EcoreUIUtil.createURIEditorInput(element.eResource());
+ }
+ this.searchResult.addMatch(new SearchMatch(element, 0, 0, input));
+ }
}
} else {
// ***** Previously used element search mechanism (default)
diff --git a/plugins/org.eclipse.app4mc.amalthea.sphinx/plugin.xml b/plugins/org.eclipse.app4mc.amalthea.sphinx/plugin.xml
index ac781d734..73631fc08 100644
--- a/plugins/org.eclipse.app4mc.amalthea.sphinx/plugin.xml
+++ b/plugins/org.eclipse.app4mc.amalthea.sphinx/plugin.xml
@@ -36,10 +36,4 @@
</applicableFor>
</provider>
</extension>
- <extension
- point="org.eclipse.sphinx.emf.workspace.editingDomains">
- <mapping
- class="org.eclipse.app4mc.amalthea.sphinx.AmaltheaWorkspaceEditingDomainMapping">
- </mapping>
- </extension>
</plugin>

Back to the top