Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/build.properties4
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/eTriceKeywordHoverStyle.css (renamed from plugins/org.eclipse.etrice.core.room.ui/eTriceKeywordHoverStyle.css)0
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/IKeywordHoverContentProvider.java18
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/KeywordEObjectTextHover.java (renamed from plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/hover/KeywordEObjectTextHover.java)4
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/KeywordHoverProvider.java (renamed from plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/hover/KeywordHoverProvider.java)33
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/RoomUiModule.java20
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/RoomEditor.java1
-rw-r--r--plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/SelectedModelHelpProvider.java (renamed from plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SelectedModelHelpProvider.java)2
-rw-r--r--plugins/org.eclipse.etrice.doc/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/ETriceHelp.java10
-rw-r--r--plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/KeywordHoverContentProvider.java (renamed from plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/KeywordHoverProvider.java)10
13 files changed, 78 insertions, 36 deletions
diff --git a/plugins/org.eclipse.etrice.core.common.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.core.common.ui/META-INF/MANIFEST.MF
index 81258d720..cc6336c71 100644
--- a/plugins/org.eclipse.etrice.core.common.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.core.common.ui/META-INF/MANIFEST.MF
@@ -18,17 +18,17 @@ Require-Bundle: org.eclipse.etrice.core.common;visibility:=reexport,
org.eclipse.compare,
org.eclipse.core.filesystem;bundle-version="1.3.0",
org.eclipse.help,
- org.eclipse.etrice.doc,
org.eclipse.xtext.xbase.lib
Import-Package: org.apache.log4j,
org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.etrice.core.common.ui.contentassist,
org.eclipse.etrice.core.common.ui.contentassist.antlr,
+ org.eclipse.etrice.core.common.ui.contentassist.antlr.internal,
org.eclipse.etrice.core.common.ui.editor,
+ org.eclipse.etrice.core.common.ui.hover,
org.eclipse.etrice.core.common.ui.internal,
org.eclipse.etrice.core.common.ui.labeling,
org.eclipse.etrice.core.common.ui.linking,
- org.eclipse.etrice.core.common.ui.quickfix,
- org.eclipse.etrice.core.common.ui.contentassist.antlr.internal
+ org.eclipse.etrice.core.common.ui.quickfix
Bundle-Activator: org.eclipse.etrice.core.common.ui.ETriceCoreCommonActivator
diff --git a/plugins/org.eclipse.etrice.core.common.ui/build.properties b/plugins/org.eclipse.etrice.core.common.ui/build.properties
index 31255ed05..3d41031ce 100644
--- a/plugins/org.eclipse.etrice.core.common.ui/build.properties
+++ b/plugins/org.eclipse.etrice.core.common.ui/build.properties
@@ -3,4 +3,6 @@ source.. = src/,\
xtend-gen/
bin.includes = META-INF/,\
.,\
- plugin.xml \ No newline at end of file
+ plugin.xml,\
+ eTriceKeywordHoverStyle.css
+
diff --git a/plugins/org.eclipse.etrice.core.room.ui/eTriceKeywordHoverStyle.css b/plugins/org.eclipse.etrice.core.common.ui/eTriceKeywordHoverStyle.css
index 7e9a3d5ba..7e9a3d5ba 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/eTriceKeywordHoverStyle.css
+++ b/plugins/org.eclipse.etrice.core.common.ui/eTriceKeywordHoverStyle.css
diff --git a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/IKeywordHoverContentProvider.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/IKeywordHoverContentProvider.java
new file mode 100644
index 000000000..218c450c8
--- /dev/null
+++ b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/IKeywordHoverContentProvider.java
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.common.ui.hover;
+
+public interface IKeywordHoverContentProvider {
+
+ String getHTMLContent(String name);
+}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/hover/KeywordEObjectTextHover.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/KeywordEObjectTextHover.java
index df691d062..e99b62afc 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/hover/KeywordEObjectTextHover.java
+++ b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/KeywordEObjectTextHover.java
@@ -11,7 +11,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.core.ui.hover;
+package org.eclipse.etrice.core.common.ui.hover;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.text.IRegion;
@@ -30,7 +30,7 @@ import org.eclipse.xtext.util.Tuples;
import com.google.inject.Inject;
public class KeywordEObjectTextHover extends DispatchingEObjectTextHover {
-
+
@Inject
protected IEObjectHoverProvider hoverProvider;
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/hover/KeywordHoverProvider.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/KeywordHoverProvider.java
index 344f2c080..35704c7a8 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/hover/KeywordHoverProvider.java
+++ b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/hover/KeywordHoverProvider.java
@@ -11,30 +11,41 @@
*
*******************************************************************************/
-package org.eclipse.etrice.core.ui.hover;
+package org.eclipse.etrice.core.common.ui.hover;
import java.io.IOException;
+import java.net.URL;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.etrice.core.ui.RoomUiActivator;
-import org.eclipse.etrice.doc.ETriceHelp;
+import org.eclipse.etrice.core.common.ui.ETriceCoreCommonActivator;
import org.eclipse.jface.internal.text.html.HTMLPrinter;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ui.editor.hover.html.DefaultEObjectHoverProvider;
import org.eclipse.xtext.ui.editor.hover.html.XtextBrowserInformationControlInput;
import org.eclipse.xtext.util.Files;
import com.google.inject.Inject;
+import com.google.inject.name.Named;
@SuppressWarnings("restriction")
public class KeywordHoverProvider extends DefaultEObjectHoverProvider {
+
+ public final static String STYLE_SHEET_KEY = "keywordHoverStyleSheetFileName";
- private static final String styleSheetFileName = "/eTriceKeywordHoverStyle.css";
+ @Inject(optional=true) @Named(STYLE_SHEET_KEY)
+ private String styleSheetFileName;
@Inject
+ protected AbstractUIPlugin plugin;
+
+ @Inject
protected ILabelProvider labelProvider;
+
+ @Inject
+ protected IKeywordHoverContentProvider contentProvider;
private String styleSheet = null;
@@ -43,7 +54,7 @@ public class KeywordHoverProvider extends DefaultEObjectHoverProvider {
XtextBrowserInformationControlInput previous) {
if (element instanceof Keyword) {
Keyword keyword = (Keyword) element;
- String html = ETriceHelp.getKeywordHoverContentProvider().getHTMLContent(keyword.getValue());
+ String html = contentProvider.getHTMLContent(keyword.getValue());
if (html != null) {
StringBuffer buffer = new StringBuffer(html);
HTMLPrinter.insertPageProlog(buffer, 0, getKeywordStyleSheet());
@@ -56,11 +67,17 @@ public class KeywordHoverProvider extends DefaultEObjectHoverProvider {
protected String getKeywordStyleSheet() {
String superStyle = super.getStyleSheet();
- if (styleSheet == null || ETriceHelp.DEV_MODE) {
+ if (styleSheet == null) {
styleSheet = "";
try {
- styleSheet = Files.readStreamIntoString(RoomUiActivator.getDefault().getBundle()
- .getEntry(styleSheetFileName).openStream());
+ URL url = null;
+ if(plugin != null && styleSheetFileName != null) {
+ url = plugin.getBundle().getEntry(styleSheetFileName);
+ }
+ else {
+ url = ETriceCoreCommonActivator.getInstance().getBundle().getEntry("/eTriceKeywordHoverStyle.css");
+ }
+ styleSheet = Files.readStreamIntoString(url.openStream());
}
catch (IOException e) {
e.printStackTrace();
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 bb493f7fe..e7fcb83aa 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
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.etrice.core.fsm.ui;bundle-version="1.1.1",
org.eclipse.emf.codegen;bundle-version="2.6.0",
org.eclipse.compare,
org.eclipse.core.filesystem;bundle-version="1.3.0",
- org.eclipse.help
+ org.eclipse.help,
+ com.google.inject
Import-Package: org.apache.log4j
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.etrice.core.ui,
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 0456449a3..816e0b8d3 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,14 +12,16 @@
package org.eclipse.etrice.core.ui;
+import org.eclipse.etrice.core.common.ui.hover.IKeywordHoverContentProvider;
+import org.eclipse.etrice.core.common.ui.hover.KeywordEObjectTextHover;
+import org.eclipse.etrice.core.common.ui.hover.KeywordHoverProvider;
import org.eclipse.etrice.core.common.ui.linking.GlobalNonPlatformURIEditorOpener;
import org.eclipse.etrice.core.ui.highlight.RoomHighlightingConfiguration;
import org.eclipse.etrice.core.ui.highlight.RoomSemanticHighlightingCalculator;
-import org.eclipse.etrice.core.ui.hover.KeywordEObjectTextHover;
-import org.eclipse.etrice.core.ui.hover.KeywordHoverProvider;
import org.eclipse.etrice.core.ui.internal.RoomActivator;
import org.eclipse.etrice.core.ui.linking.RoomHyperlinkHelper;
import org.eclipse.etrice.core.ui.outline.RoomOutlinePage;
+import org.eclipse.etrice.doc.KeywordHoverContentProvider;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.eclipse.xtext.ui.editor.hover.IEObjectHover;
@@ -28,6 +30,7 @@ import org.eclipse.xtext.ui.editor.hyperlinking.IHyperlinkHelper;
import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightingConfiguration;
import org.eclipse.xtext.ui.editor.syntaxcoloring.ISemanticHighlightingCalculator;
+import com.google.inject.Binder;
import com.google.inject.Injector;
/**
@@ -37,6 +40,15 @@ public class RoomUiModule extends org.eclipse.etrice.core.ui.AbstractRoomUiModul
public RoomUiModule(AbstractUIPlugin plugin) {
super(plugin);
}
+
+ @Override
+ public void configure(Binder binder) {
+ super.configure(binder);
+
+ // keyword hover stuff
+ binder.bind(IKeywordHoverContentProvider.class).to(KeywordHoverContentProvider.class);
+ binder.bind(IEObjectHoverProvider.class).to(KeywordHoverProvider.class);
+ }
@Override
public Class<? extends IContentOutlinePage> bindIContentOutlinePage() {
@@ -72,8 +84,4 @@ public class RoomUiModule extends org.eclipse.etrice.core.ui.AbstractRoomUiModul
public Class<? extends IEObjectHover> bindIEObjectHover() {
return KeywordEObjectTextHover.class;
}
-
- public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
- return KeywordHoverProvider.class;
- }
}
diff --git a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/RoomEditor.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/RoomEditor.java
index 6d399eb07..dab0b11ed 100644
--- a/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/RoomEditor.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/RoomEditor.java
@@ -16,7 +16,6 @@ import java.util.List;
import org.eclipse.etrice.core.common.ui.editor.IValidatingEditor;
import org.eclipse.etrice.core.common.ui.editor.SaveOnFocusLostListener;
-import org.eclipse.etrice.core.common.ui.editor.SelectedModelHelpProvider;
import org.eclipse.etrice.core.ui.preferences.RoomPreferenceConstants;
import org.eclipse.help.IContextProvider;
import org.eclipse.swt.widgets.Composite;
diff --git a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SelectedModelHelpProvider.java b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/SelectedModelHelpProvider.java
index 34bbbdceb..d3bbc3f59 100644
--- a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/editor/SelectedModelHelpProvider.java
+++ b/plugins/org.eclipse.etrice.core.room.ui/src/org/eclipse/etrice/core/ui/editor/SelectedModelHelpProvider.java
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-package org.eclipse.etrice.core.common.ui.editor;
+package org.eclipse.etrice.core.ui.editor;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.etrice.doc.ContextHelpProvider;
diff --git a/plugins/org.eclipse.etrice.doc/META-INF/MANIFEST.MF b/plugins/org.eclipse.etrice.doc/META-INF/MANIFEST.MF
index 88b888c4c..397dfaee9 100644
--- a/plugins/org.eclipse.etrice.doc/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.etrice.doc/META-INF/MANIFEST.MF
@@ -6,7 +6,8 @@ Bundle-Version: 1.1.1.qualifier
Bundle-Vendor: Eclipse eTrice
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
- org.eclipse.help
+ org.eclipse.help,
+ org.eclipse.etrice.core.common.ui
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-Activator: org.eclipse.etrice.doc.ETriceHelp
Export-Package: org.eclipse.etrice.doc
diff --git a/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/ETriceHelp.java b/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/ETriceHelp.java
index d4f7c99ab..494bae4de 100644
--- a/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/ETriceHelp.java
+++ b/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/ETriceHelp.java
@@ -24,15 +24,7 @@ public class ETriceHelp extends AbstractUIPlugin {
public static final boolean DEV_MODE = false;
private static ETriceHelp plugin;
- private KeywordHoverProvider keywordHoverProvider;
- //private ContextHelpProvider contextHelp;
-
- public static KeywordHoverProvider getKeywordHoverContentProvider(){
- if(getDefault().keywordHoverProvider == null)
- getDefault().keywordHoverProvider = new KeywordHoverProvider();
-
- return getDefault().keywordHoverProvider;
- }
+ //private ContextHelpProvider contextHelp;
// public static ContextHelpProvider getContextHelpProvider(){
// if(getDefault().contextHelp == null)
diff --git a/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/KeywordHoverProvider.java b/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/KeywordHoverContentProvider.java
index 8229aad84..b02bc56ff 100644
--- a/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/KeywordHoverProvider.java
+++ b/plugins/org.eclipse.etrice.doc/src/org/eclipse/etrice/doc/KeywordHoverContentProvider.java
@@ -19,8 +19,10 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.etrice.core.common.ui.hover.IKeywordHoverContentProvider;
-public class KeywordHoverProvider {
+
+public class KeywordHoverContentProvider implements IKeywordHoverContentProvider {
private static final String CONTENT_DIR;
static {
@@ -32,10 +34,12 @@ public class KeywordHoverProvider {
private final Map<String, String> cache = new HashMap<String, String>();
+ @Override
public String getHTMLContent(String name) {
- if (!ETriceHelp.DEV_MODE && cache.containsKey(name))
+ if (!ETriceHelp.DEV_MODE && cache.containsKey(name)) {
return cache.get(name);
-
+ }
+
URL fileURL = ETriceHelp.getDefault().getBundle().getEntry(CONTENT_DIR + name + ".html");
String result = null;
if (fileURL != null) {

Back to the top