Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java13
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/GlobalNonPlatformURIEditorOpener.java (renamed from plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/GlobalNonPlatformURIEditorOpener.java)2
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/ImportAwareHyperlinkHelper.java (renamed from plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/ImportAwareHyperlinkHelper.java)5
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe22
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java1
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/PlatformRelativeUriResolver.java17
7 files changed, 31 insertions, 10 deletions
diff --git a/plugins/org.eclipse.etrice.core.room.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.room.ui/META-INF/MANIFEST.MF
index f2faa5d91..0b8c3a446 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.room.ui/META-INF/MANIFEST.MF
@@ -22,5 +22,6 @@ Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.etrice.core.ui,
org.eclipse.etrice.core.ui.contentassist.antlr,
+ org.eclipse.etrice.core.ui.linking,
org.eclipse.etrice.core.ui.newwizard
Bundle-Activator: org.eclipse.etrice.core.ui.internal.RoomActivator
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java
index 2dfd25990..b05a628b8 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java
@@ -12,8 +12,9 @@
package org.eclipse.etrice.core.ui;
-import org.eclipse.etrice.core.ui.contentassist.ImportAwareHyperlinkHelper;
import org.eclipse.etrice.core.ui.internal.RoomActivator;
+import org.eclipse.etrice.core.ui.linking.GlobalNonPlatformURIEditorOpener;
+import org.eclipse.etrice.core.ui.linking.ImportAwareHyperlinkHelper;
import org.eclipse.etrice.core.ui.outline.RoomOutlinePage;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -39,14 +40,16 @@ public class RoomUiModule extends org.eclipse.etrice.core.ui.AbstractRoomUiModul
return RoomOutlinePage.class;
}
- public Class<? extends org.eclipse.xtext.ui.editor.IURIEditorOpener> bindIURIEditorOpener() {
- return GlobalNonPlatformURIEditorOpener.class;
- }
-
public static Injector getInjector() {
return RoomActivator.getInstance().getInjector("org.eclipse.etrice.core.Room");
}
+ // HOWTO: use URI imports - need special editor opener
+ public Class<? extends org.eclipse.xtext.ui.editor.IURIEditorOpener> bindIURIEditorOpener() {
+ return GlobalNonPlatformURIEditorOpener.class;
+ }
+
+ // HOWTO: use URI imports - need special class for creating hyper links for imports
public Class<? extends IHyperlinkHelper> bindIHyperlinkHelper() {
return ImportAwareHyperlinkHelper.class;
}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/GlobalNonPlatformURIEditorOpener.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/GlobalNonPlatformURIEditorOpener.java
index 029f5ce2f..86092cb8f 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/GlobalNonPlatformURIEditorOpener.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/GlobalNonPlatformURIEditorOpener.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.core.ui;
+package org.eclipse.etrice.core.ui.linking;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRoot;
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/ImportAwareHyperlinkHelper.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/ImportAwareHyperlinkHelper.java
index f8ebf963c..956c27571 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/contentassist/ImportAwareHyperlinkHelper.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/linking/ImportAwareHyperlinkHelper.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.core.ui.contentassist;
+package org.eclipse.etrice.core.ui.linking;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -41,6 +41,9 @@ public class ImportAwareHyperlinkHelper extends HyperlinkHelper {
@Inject
private PlatformRelativeUriResolver uriResolver;
+ public ImportAwareHyperlinkHelper() {
+ super();
+ }
/* (non-Javadoc)
* @see org.eclipse.xtext.ui.editor.hyperlinking.HyperlinkHelper#createHyperlinksByOffset(org.eclipse.xtext.resource.XtextResource, int, org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkAcceptor)
*/
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2 b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2
index 13eced728..cd3716b33 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/GenerateRoom.mwe2
@@ -83,7 +83,9 @@ Workflow {
// java-based API for validation
fragment = validation.JavaValidatorFragment {
+ // HOWTO: use URI imports - configure validator
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
+
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java
index 9d84ef638..93e549f5d 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/RoomRuntimeModule.java
@@ -49,6 +49,7 @@ public class RoomRuntimeModule extends org.eclipse.etrice.core.AbstractRoomRunti
org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.class);
}
+ // HOWTO: use URI imports - need special URI resolver
public Class<? extends ImportUriResolver> bindImportUriResolver() {
return PlatformRelativeUriResolver.class;
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/PlatformRelativeUriResolver.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/PlatformRelativeUriResolver.java
index 6fdec2854..662bc6ef6 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/PlatformRelativeUriResolver.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/scoping/PlatformRelativeUriResolver.java
@@ -18,6 +18,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
@@ -87,9 +88,19 @@ public class PlatformRelativeUriResolver extends ImportUriResolver {
if (uri.isRelative()) {
URI base = baseUri.trimSegments(1);
if (base.isPlatformResource()) {
- IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(base.toPlatformString(true)));
- String abs = folder.getRawLocationURI().toString();
- base = URI.createURI(abs);
+ Path basePath = new Path(base.toPlatformString(true));
+ if (basePath.segmentCount()<2) {
+ // it's a project
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.lastSegment());
+ String abs = project.getRawLocationURI().toString();
+ base = URI.createURI(abs);
+ }
+ else {
+ // it's a folder
+ IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(basePath);
+ String abs = folder.getRawLocationURI().toString();
+ base = URI.createURI(abs);
+ }
}
else if (base.isRelative()) {
base = URI.createFileURI(new File(base.toString()).getAbsolutePath());

Back to the top