aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-28 12:19:25 (EDT)
committerChris Aniszczyk2011-04-28 17:14:33 (EDT)
commit73e5d2fd4fa868ab95dbffac567aa32746fa7b3a (patch)
treeb278f81f93636b60b481426709afb7a5168ed03c
parent2e4b940d2c6e0bbd7bb2b413aad8f7a82ec93126 (diff)
downloadegit-73e5d2fd4fa868ab95dbffac567aa32746fa7b3a.zip
egit-73e5d2fd4fa868ab95dbffac567aa32746fa7b3a.tar.gz
egit-73e5d2fd4fa868ab95dbffac567aa32746fa7b3a.tar.bz2
Support extensible hyperlink targets in source viewerrefs/changes/69/3169/5
Extending classes can now provide targets for hyperlink detection in the message area. Change-Id: I22412057e2427ceb3e72e4a2ad7deaa07632422e Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java
index e356fa7..b6b5a2e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/SpellcheckableMessageArea.java
@@ -11,10 +11,13 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.dialogs;
+import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.eclipse.egit.ui.UIText;
@@ -160,7 +163,13 @@ public class SpellcheckableMessageArea extends Composite {
Document document = new Document(initialText);
sourceViewer.configure(new TextSourceViewerConfiguration(EditorsUI
- .getPreferenceStore()));
+ .getPreferenceStore()) {
+
+ protected Map getHyperlinkDetectorTargets(ISourceViewer targetViewer) {
+ return getHyperlinkTargets();
+ }
+
+ });
sourceViewer.setDocument(document, annotationModel);
getTextWidget().addDisposeListener(new DisposeListener() {
@@ -440,6 +449,25 @@ public class SpellcheckableMessageArea extends Composite {
}
/**
+ * Get hyperlink targets
+ *
+ * @return map of targets
+ */
+ protected Map<String, IAdaptable> getHyperlinkTargets() {
+ return Collections.singletonMap("org.eclipse.ui.DefaultTextEditor", //$NON-NLS-1$
+ getDefaultTarget());
+ }
+
+ /**
+ * Get default target for hyperlink presenter
+ *
+ * @return target
+ */
+ protected IAdaptable getDefaultTarget() {
+ return null;
+ }
+
+ /**
* @return text
*/
public String getText() {