Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/code')
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.e4/META-INF/MANIFEST.MF3
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.e4/OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2.xml9
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.e4/src/org/eclipse/fx/code/editor/e4/internal/NavigationProviderTypeProviderCF2.java29
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.fx.themes/css/dark-highlight.css5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.fx.themes/css/highlight.css9
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.fx/META-INF/MANIFEST.MF5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/SimpleSourceTextEditorBuilder.java8
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/TextEditor.java18
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/services/internal/DefaultSourceViewerConfiguration.java104
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.sdk/.project17
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.sdk/build.properties1
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.sdk/feature.xml17
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/.classpath9
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/.gitignore1
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/.project34
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/META-INF/MANIFEST.MF24
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/build.properties5
-rw-r--r--bundles/code/org.eclipse.fx.code.editor.ldef.tests/org.eclipse.fx.code.editor.ldef.tests.launch13
-rw-r--r--bundles/code/org.eclipse.fx.code.editor/META-INF/MANIFEST.MF1
-rw-r--r--bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/Constants.java2
-rw-r--r--bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/SourceSelection.java14
-rw-r--r--bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProvider.java12
-rw-r--r--bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProviderTypeProvider.java5
-rw-r--r--bundles/code/org.eclipse.fx.text.ui/META-INF/MANIFEST.MF1
-rw-r--r--bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewer.java15
-rw-r--r--bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewerConfiguration.java9
-rw-r--r--bundles/code/org.eclipse.fx.text/META-INF/MANIFEST.MF1
-rw-r--r--bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationRegion.java10
-rw-r--r--bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationTarget.java8
31 files changed, 260 insertions, 138 deletions
diff --git a/bundles/code/org.eclipse.fx.code.editor.e4/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor.e4/META-INF/MANIFEST.MF
index 8d58226fe..c22a2526e 100644
--- a/bundles/code/org.eclipse.fx.code.editor.e4/META-INF/MANIFEST.MF
+++ b/bundles/code/org.eclipse.fx.code.editor.e4/META-INF/MANIFEST.MF
@@ -31,5 +31,6 @@ Service-Component: OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.Docu
OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.ProposalComputerTypeProviderContextFunction.xml,
OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.HoverInformationProviderTypeProviderCF.xml,
OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.SearchProviderTypeProviderCF.xml,
- OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.InputContextContextFunction.xml
+ OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.InputContextContextFunction.xml,
+ OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2.xml
Bundle-ActivationPolicy: lazy
diff --git a/bundles/code/org.eclipse.fx.code.editor.e4/OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2.xml b/bundles/code/org.eclipse.fx.code.editor.e4/OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2.xml
new file mode 100644
index 000000000..f7387b6e4
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.e4/OSGI-INF/services/org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.2.0" name="org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2">
+ <property name="service.context.key" value="org.eclipse.fx.code.editor.services.NavigationProvider"/>
+ <service>
+ <provide interface="org.eclipse.e4.core.contexts.IContextFunction"/>
+ </service>
+ <reference bind="registerService" cardinality="0..n" interface="org.eclipse.fx.code.editor.services.NavigationProviderTypeProvider" name="registerService" policy="dynamic" policy-option="greedy" unbind="unregisterService"/>
+ <implementation class="org.eclipse.fx.code.editor.e4.internal.NavigationProviderTypeProviderCF2"/>
+</scr:component> \ No newline at end of file
diff --git a/bundles/code/org.eclipse.fx.code.editor.e4/src/org/eclipse/fx/code/editor/e4/internal/NavigationProviderTypeProviderCF2.java b/bundles/code/org.eclipse.fx.code.editor.e4/src/org/eclipse/fx/code/editor/e4/internal/NavigationProviderTypeProviderCF2.java
new file mode 100644
index 000000000..c69a67903
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor.e4/src/org/eclipse/fx/code/editor/e4/internal/NavigationProviderTypeProviderCF2.java
@@ -0,0 +1,29 @@
+package org.eclipse.fx.code.editor.e4.internal;
+
+import java.util.Map;
+
+import org.eclipse.e4.core.contexts.IContextFunction;
+import org.eclipse.fx.code.editor.e4.InputBasedContextFunction;
+import org.eclipse.fx.code.editor.services.NavigationProvider;
+import org.eclipse.fx.code.editor.services.NavigationProviderTypeProvider;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
+
+@SuppressWarnings("restriction")
+@Component(service=IContextFunction.class, property={"service.context.key=org.eclipse.fx.code.editor.services.NavigationProvider"})
+public class NavigationProviderTypeProviderCF2 extends InputBasedContextFunction<NavigationProvider, NavigationProviderTypeProvider> {
+
+ @Override
+ @Reference(cardinality=ReferenceCardinality.MULTIPLE, policy=ReferencePolicy.DYNAMIC, policyOption=ReferencePolicyOption.GREEDY)
+ public void registerService(NavigationProviderTypeProvider service, Map<String, Object> properties) {
+ super.registerService(service, properties);
+ }
+
+ @Override
+ public void unregisterService(NavigationProviderTypeProvider service) {
+ super.unregisterService(service);
+ }
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/dark-highlight.css b/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/dark-highlight.css
index 4e0fc4837..ee546bdbf 100644
--- a/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/dark-highlight.css
+++ b/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/dark-highlight.css
@@ -2,6 +2,11 @@
-type-info-color: lightgray;
}
+.styled-text-area .dart.quick_link {
+ -styled-text-color: lightblue !important;
+ -efx-decoration: "underline";
+}
+
.styled-text-area .list-view {
-source-editor-code: #b8c4d1;
-source-editor-operator: #b8c4d1;
diff --git a/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/highlight.css b/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/highlight.css
index b25c6418e..8dc69af8b 100644
--- a/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/highlight.css
+++ b/bundles/code/org.eclipse.fx.code.editor.fx.themes/css/highlight.css
@@ -2,6 +2,15 @@
-type-info-color: darkgray;
}
+.styled-text-area .dart.quick_link {
+ -styled-text-color: blue !important;
+ -efx-decoration: "underline";
+}
+
+.styled-text-area .dart.quick_link Text {
+ -fx-fill: red !important;
+}
+
.styled-text-area .list-view {
-fx-background-color: white;
diff --git a/bundles/code/org.eclipse.fx.code.editor.fx/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor.fx/META-INF/MANIFEST.MF
index ea1facf96..fb05ad63c 100644
--- a/bundles/code/org.eclipse.fx.code.editor.fx/META-INF/MANIFEST.MF
+++ b/bundles/code/org.eclipse.fx.code.editor.fx/META-INF/MANIFEST.MF
@@ -4,14 +4,17 @@ Bundle-Name: Basic editor APIs for JavaFX
Bundle-SymbolicName: org.eclipse.fx.code.editor.fx
Bundle-Version: 2.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: javax.inject,
+Import-Package: com.google.common.collect;version="15.0.0",
+ javax.inject,
org.eclipse.e4.ui.di,
org.eclipse.fx.code.editor;version="2.3.0",
org.eclipse.fx.code.editor.services;version="2.3.0",
org.eclipse.fx.core;version="2.3.0",
org.eclipse.fx.core.di;version="2.3.0",
+ org.eclipse.fx.core.event;version="2.3.0",
org.eclipse.fx.core.preferences;version="2.3.0",
org.eclipse.fx.text.hover,
+ org.eclipse.fx.text.navigation,
org.eclipse.fx.text.rules;version="2.3.0",
org.eclipse.fx.text.ui;version="2.3.0",
org.eclipse.fx.text.ui.contentassist;version="2.3.0",
diff --git a/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/SimpleSourceTextEditorBuilder.java b/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/SimpleSourceTextEditorBuilder.java
index 48003ceca..478645475 100644
--- a/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/SimpleSourceTextEditorBuilder.java
+++ b/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/SimpleSourceTextEditorBuilder.java
@@ -18,8 +18,11 @@ import org.eclipse.fx.code.editor.Input;
import org.eclipse.fx.code.editor.LocalSourceFileInput;
import org.eclipse.fx.code.editor.fx.services.CompletionProposalPresenter;
import org.eclipse.fx.code.editor.fx.services.internal.DefaultSourceViewerConfiguration;
+import org.eclipse.fx.code.editor.services.EditorOpener;
import org.eclipse.fx.code.editor.services.HoverInformationProvider;
+import org.eclipse.fx.code.editor.services.NavigationProvider;
import org.eclipse.fx.code.editor.services.ProposalComputer;
+import org.eclipse.fx.code.editor.services.SearchProvider;
import org.eclipse.fx.text.rules.CombinedWordRule;
import org.eclipse.fx.text.rules.JavaLikeWordDetector;
import org.eclipse.fx.text.ui.presentation.PresentationReconciler;
@@ -62,6 +65,9 @@ public class SimpleSourceTextEditorBuilder {
private final String languageName;
private CompletionProposalPresenter completionProposalPresenter;
private HoverInformationProvider hoverInformationProvider;
+ private SearchProvider searchProvider;
+ private NavigationProvider navigationProvider;
+ private EditorOpener editorOpener;
static class MultiLine {
private final String start;
@@ -164,7 +170,7 @@ public class SimpleSourceTextEditorBuilder {
}
editor.setPartitioner(new FastPartitioner(new PartitionerImpl(this), contentTypes.toArray(new String[0])));
- editor.setSourceViewerConfiguration(new DefaultSourceViewerConfiguration(input, new ReconcilerImpl(this), proposalComputer, annotationModel, annotationPresenter, hoverInformationProvider, completionProposalPresenter));
+ editor.setSourceViewerConfiguration(new DefaultSourceViewerConfiguration(input, new ReconcilerImpl(this), proposalComputer, annotationModel, annotationPresenter, hoverInformationProvider, completionProposalPresenter, searchProvider, navigationProvider, editorOpener));
return editor;
}
diff --git a/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/TextEditor.java b/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/TextEditor.java
index 42161be88..a4624bcb4 100644
--- a/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/TextEditor.java
+++ b/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/TextEditor.java
@@ -17,10 +17,15 @@ import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.Persist;
+import org.eclipse.fx.code.editor.Constants;
import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.SourceSelection;
+import org.eclipse.fx.code.editor.services.URIProvider;
import org.eclipse.fx.core.di.ContextValue;
+import org.eclipse.fx.core.event.EventBus;
import org.eclipse.fx.text.ui.source.SourceViewer;
import org.eclipse.fx.text.ui.source.SourceViewerConfiguration;
+import org.eclipse.fx.ui.controls.styledtext.TextSelection;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.IDocumentPartitioner;
@@ -46,6 +51,8 @@ public class TextEditor {
private SourceViewer viewer;
+
+
@Inject
public void setDocument(IDocument document) {
if( viewer != null ) {
@@ -87,7 +94,7 @@ public class TextEditor {
}
@PostConstruct
- public void initUI(BorderPane pane) {
+ public void initUI(BorderPane pane, EventBus eventBus) {
viewer = createSourceViewer();
if( document instanceof IDocumentExtension3 ) {
((IDocumentExtension3)document).setDocumentPartitioner(configuration.getConfiguredDocumentPartitioning(viewer),partitioner);
@@ -103,6 +110,15 @@ public class TextEditor {
if( activeInput != null ) {
activeInput.setValue(input);
}
+
+ eventBus.subscribe(Constants.TOPIC_SELECT_SOURCE, EventBus.data(this::onSourceSelect));
+ }
+
+ private void onSourceSelect(SourceSelection data) {
+ if (((URIProvider)input).getURI().equals(data.uri)) {
+ getSourceViewer().getTextWidget().setSelection(new TextSelection(data.selection.getOffset(), data.selection.getLength()));
+ getSourceViewer().getTextWidget().revealCaret();
+ }
}
protected SourceViewer createSourceViewer() {
diff --git a/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/services/internal/DefaultSourceViewerConfiguration.java b/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/services/internal/DefaultSourceViewerConfiguration.java
index 51240797f..d0b37b893 100644
--- a/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/services/internal/DefaultSourceViewerConfiguration.java
+++ b/bundles/code/org.eclipse.fx.code.editor.fx/src/org/eclipse/fx/code/editor/fx/services/internal/DefaultSourceViewerConfiguration.java
@@ -1,9 +1,14 @@
package org.eclipse.fx.code.editor.fx.services.internal;
+import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Function;
import java.util.stream.Collectors;
import javax.inject.Inject;
@@ -11,13 +16,21 @@ import javax.inject.Inject;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.fx.code.editor.Constants;
import org.eclipse.fx.code.editor.Input;
+import org.eclipse.fx.code.editor.SourceSelection;
import org.eclipse.fx.code.editor.fx.services.CompletionProposalPresenter;
import org.eclipse.fx.code.editor.services.CompletionProposal;
+import org.eclipse.fx.code.editor.services.EditorOpener;
import org.eclipse.fx.code.editor.services.HoverInformationProvider;
+import org.eclipse.fx.code.editor.services.NavigationProvider;
import org.eclipse.fx.code.editor.services.ProposalComputer;
import org.eclipse.fx.code.editor.services.ProposalComputer.ProposalContext;
+import org.eclipse.fx.code.editor.services.SearchProvider;
+import org.eclipse.fx.code.editor.services.URIProvider;
+import org.eclipse.fx.core.event.EventBus;
import org.eclipse.fx.core.preferences.Preference;
import org.eclipse.fx.text.hover.HoverInfo;
+import org.eclipse.fx.text.navigation.NavigationRegion;
+import org.eclipse.fx.text.navigation.NavigationTarget;
import org.eclipse.fx.text.ui.Feature;
import org.eclipse.fx.text.ui.ITextHover;
import org.eclipse.fx.text.ui.ITextViewer;
@@ -31,12 +44,18 @@ import org.eclipse.fx.text.ui.presentation.PresentationReconciler;
import org.eclipse.fx.text.ui.source.AnnotationPresenter;
import org.eclipse.fx.text.ui.source.ISourceViewer;
import org.eclipse.fx.text.ui.source.SourceViewerConfiguration;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.QuickLink;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.QuickLinkable;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.SimpleQuickLink;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.CustomQuickLink;
import org.eclipse.fx.ui.controls.styledtext.TextSelection;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
+import com.google.common.collect.Range;
+
import javafx.beans.property.SetProperty;
import javafx.beans.property.SimpleSetProperty;
import javafx.collections.FXCollections;
@@ -51,6 +70,12 @@ public class DefaultSourceViewerConfiguration extends SourceViewerConfiguration
private final AnnotationPresenter annotationPresenter;
private final HoverInformationProvider hoverInformationProvider;
private final CompletionProposalPresenter proposalPresenter;
+ private final SearchProvider searchProvider;
+ private final NavigationProvider navigationProvider;
+ private final EditorOpener editorOpener;
+
+ @Inject private EventBus eventBus;
+
private ContentAssistant contentAssistant;
private SetProperty<Feature> featureSet = new SimpleSetProperty<Feature>(this, "featureSet", FXCollections.observableSet());
@@ -62,7 +87,10 @@ public class DefaultSourceViewerConfiguration extends SourceViewerConfiguration
@Optional IAnnotationModel annotationModel,
@Optional AnnotationPresenter annotationPresenter,
@Optional HoverInformationProvider hoverInformationProvider,
- @Optional CompletionProposalPresenter proposalPresenter
+ @Optional CompletionProposalPresenter proposalPresenter,
+ @Optional SearchProvider searchProvider,
+ @Optional NavigationProvider navigationProvider,
+ @Optional EditorOpener editorOpener
) {
this.input = input;
this.hoverInformationProvider = hoverInformationProvider;
@@ -72,6 +100,9 @@ public class DefaultSourceViewerConfiguration extends SourceViewerConfiguration
this.proposalPresenter = proposalPresenter == null ? DefaultProposal::new : proposalPresenter;
this.annotationPresenter = annotationPresenter;
+ this.searchProvider = searchProvider;
+ this.navigationProvider = navigationProvider;
+ this.editorOpener = editorOpener;
}
@Inject
@@ -84,6 +115,77 @@ public class DefaultSourceViewerConfiguration extends SourceViewerConfiguration
}
}
+ private Range<Integer> convertRegion(IRegion region) {
+ return Range.closed(region.getOffset(), region.getOffset() + region.getLength());
+ }
+
+ private QuickLink convertNavigationTarget(NavigationTarget target) {
+ return new CustomQuickLink() {
+
+ @Override
+ public String getLabel() {
+ // TODO
+ return "need some label here!";
+ }
+
+ @Override
+ public Runnable getAction() {
+ return () -> {
+ editorOpener.openEditor(target.getFile().toString());
+ eventBus.publish(Constants.TOPIC_SELECT_SOURCE, new SourceSelection(target.getFile().toString(), target.getRegion()), true);
+ };
+ }
+
+ @Override
+ public String toString() {
+ return "CustombQuickLink in " + target.getFile() + " @ " + target.getRegion();
+ }
+
+ };
+ }
+
+ private QuickLinkable convertNavigationRegion(NavigationRegion region) {
+ return new QuickLinkable() {
+ @Override
+ public Range<Integer> getRegion() {
+ return convertRegion(region.getRegion());
+ }
+
+ @Override
+ public List<QuickLink> getLinks() {
+ return region.getTargets().stream().map(DefaultSourceViewerConfiguration.this::convertNavigationTarget).collect(Collectors.toList());
+ }
+ };
+ }
+
+ @Override
+ public Function<Integer, java.util.Optional<QuickLinkable>> getQuicklinkCallback() {
+
+ if (navigationProvider != null) {
+
+ return (offset) -> {
+ try {
+ Future<List<NavigationRegion>> navigationRegions = navigationProvider.getNavigationRegions();
+ List<NavigationRegion> list = navigationRegions.get(400, TimeUnit.MILLISECONDS);
+
+ for (NavigationRegion region : list) {
+ if (region.getRegion().getOffset() <= offset && region.getRegion().getOffset() + region.getRegion().getLength() > offset) {
+ return java.util.Optional.of(convertNavigationRegion(region));
+ }
+ }
+ }
+ catch (InterruptedException | TimeoutException | ExecutionException e) {
+ e.printStackTrace();
+ }
+
+ return java.util.Optional.empty();
+ };
+ }
+ else {
+ return super.getQuicklinkCallback();
+ }
+ }
+
@Override
public SetProperty<Feature> getFeatures() {
return this.featureSet;
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/.project b/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/.project
deleted file mode 100644
index abad96a33..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.fx.code.editor.ldef.sdk</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/build.properties b/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/build.properties
deleted file mode 100644
index 442bd78b6..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-bin.includes =feature.xml
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/feature.xml b/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/feature.xml
deleted file mode 100644
index ec7bf635f..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.sdk/feature.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature id="org.eclipse.fx.code.editor.ldef.sdk"
- label="LDef SDK Feature "
- version="1.0.0.qualifier">
- <plugin
- id="org.eclipse.fx.code.editor.ldef"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
- <plugin
- id="org.eclipse.fx.code.editor.ldef.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-</feature>
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.classpath b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.classpath
deleted file mode 100644
index 9081d4f70..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="src" path="xtend-gen"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.gitignore b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.gitignore
deleted file mode 100644
index ae3c17260..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.project b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.project
deleted file mode 100644
index 6838d43e4..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.fx.code.editor.ldef.tests</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.core.resources.prefs b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 99f26c020..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-encoding/<project>=UTF-8
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 0c68a61dc..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/META-INF/MANIFEST.MF
deleted file mode 100644
index e6e143415..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,24 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: org.eclipse.fx.code.editor.ldef.tests
-Bundle-Vendor: My Company
-Bundle-Version: 1.0.0.qualifier
-Bundle-SymbolicName: org.eclipse.fx.code.editor.ldef.tests; singleton:=true
-Bundle-ActivationPolicy: lazy
-Require-Bundle: org.eclipse.fx.code.editor.ldef,
- org.eclipse.fx.code.editor.ldef.ui,
- org.eclipse.core.runtime,
- org.eclipse.xtext.junit4,
- org.eclipse.xtext.xbase.lib,
- org.eclipse.ui.workbench;resolution:=optional,
- org.objectweb.asm;bundle-version="[5.0.1,6.0.0)";resolution:=optional
-Import-Package: org.apache.log4j,
- org.junit;version="4.5.0",
- org.junit.runner;version="4.5.0",
- org.junit.runner.manipulation;version="4.5.0",
- org.junit.runner.notification;version="4.5.0",
- org.junit.runners;version="4.5.0",
- org.junit.runners.model;version="4.5.0",
- org.hamcrest.core
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.fx.code.editor.ldef
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/build.properties b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/build.properties
deleted file mode 100644
index c22eebe28..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/,\
- src-gen/,\
- xtend-gen/
-bin.includes = META-INF/,\
- .
diff --git a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/org.eclipse.fx.code.editor.ldef.tests.launch b/bundles/code/org.eclipse.fx.code.editor.ldef.tests/org.eclipse.fx.code.editor.ldef.tests.launch
deleted file mode 100644
index 7c77f8c95..000000000
--- a/bundles/code/org.eclipse.fx.code.editor.ldef.tests/org.eclipse.fx.code.editor.ldef.tests.launch
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.eclipse.fx.code.editor.ldef.tests"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=org.eclipse.fx.code.editor.ldef.tests"/>
-<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
-<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.fx.code.editor.ldef.tests"/>
-</launchConfiguration>
diff --git a/bundles/code/org.eclipse.fx.code.editor/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.code.editor/META-INF/MANIFEST.MF
index 5ee6d1018..7a207d51e 100644
--- a/bundles/code/org.eclipse.fx.code.editor/META-INF/MANIFEST.MF
+++ b/bundles/code/org.eclipse.fx.code.editor/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Import-Package: javax.inject,
org.eclipse.fx.core.event;version="2.3.0",
org.eclipse.fx.core.function;version="2.3.0",
org.eclipse.fx.text.hover,
+ org.eclipse.fx.text.navigation,
org.eclipse.jface.text.rules,
org.osgi.service.component.annotations;version="1.2.0"
Require-Bundle: org.eclipse.text;bundle-version="3.5.400",
diff --git a/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/Constants.java b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/Constants.java
index 3bc0854c3..a22446b18 100644
--- a/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/Constants.java
+++ b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/Constants.java
@@ -12,6 +12,8 @@ public class Constants {
public static final Topic<SourceFileInput> TOPIC_SOURCE_FILE_INPUT_DISPOSED = new Topic<>("at/bestsolution/dart/editor/file-input/disposed");
public static final Topic<SourceFileInput> TOPIC_SOURCE_FILE_INPUT_SAVED = new Topic<>("at/bestsolution/dart/editor/file-input/saved");
+ public static final Topic<SourceSelection> TOPIC_SELECT_SOURCE = new Topic<>("at/bestsolution/dart/editor/select-source");
+
public static final String DOCUMENT_URL = "documentUrl";
public static final String VCS_URL = "vcsUrl";
diff --git a/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/SourceSelection.java b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/SourceSelection.java
new file mode 100644
index 000000000..832ee717c
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/SourceSelection.java
@@ -0,0 +1,14 @@
+package org.eclipse.fx.code.editor;
+
+import org.eclipse.jface.text.IRegion;
+
+public class SourceSelection {
+ public final String uri;
+ public final IRegion selection;
+
+ public SourceSelection(String uri, IRegion selection) {
+ this.uri = uri;
+ this.selection = selection;
+ }
+
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProvider.java b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProvider.java
new file mode 100644
index 000000000..bf1b6b5f6
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProvider.java
@@ -0,0 +1,12 @@
+package org.eclipse.fx.code.editor.services;
+
+import java.util.List;
+import java.util.concurrent.Future;
+
+import org.eclipse.fx.text.navigation.NavigationRegion;
+
+
+public interface NavigationProvider {
+
+ Future<List<NavigationRegion>> getNavigationRegions();
+}
diff --git a/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProviderTypeProvider.java b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProviderTypeProvider.java
new file mode 100644
index 000000000..51ba38a4a
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.code.editor/src/org/eclipse/fx/code/editor/services/NavigationProviderTypeProvider.java
@@ -0,0 +1,5 @@
+package org.eclipse.fx.code.editor.services;
+
+public interface NavigationProviderTypeProvider extends InputDependentTypeProviderService<NavigationProvider> {
+
+}
diff --git a/bundles/code/org.eclipse.fx.text.ui/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.text.ui/META-INF/MANIFEST.MF
index e4b5b683c..0cd243dd8 100644
--- a/bundles/code/org.eclipse.fx.text.ui/META-INF/MANIFEST.MF
+++ b/bundles/code/org.eclipse.fx.text.ui/META-INF/MANIFEST.MF
@@ -19,6 +19,7 @@ Bundle-Vendor: Eclipse.org
Import-Package: com.google.common.collect;version="15.0.0",
org.eclipse.fx.core;version="2.3.0",
org.eclipse.fx.text.hover,
+ org.eclipse.fx.text.navigation,
org.eclipse.fx.ui.controls.list;version="2.3.0",
org.eclipse.fx.ui.controls.styledtext;version="2.3.0",
org.eclipse.fx.ui.controls.styledtext.events;version="2.3.0",
diff --git a/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewer.java b/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewer.java
index 38055949e..8fef58f23 100644
--- a/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewer.java
+++ b/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewer.java
@@ -12,12 +12,17 @@
*******************************************************************************/
package org.eclipse.fx.text.ui.source;
+import java.net.URI;
+import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Function;
+import java.util.stream.Collectors;
import org.eclipse.fx.text.hover.HoverInfo;
-import org.eclipse.fx.text.ui.Feature;
+import org.eclipse.fx.text.navigation.NavigationRegion;
+import org.eclipse.fx.text.navigation.NavigationTarget;
import org.eclipse.fx.text.ui.ITextViewerExtension2;
import org.eclipse.fx.text.ui.TextViewer;
import org.eclipse.fx.text.ui.contentassist.ContentAssistant;
@@ -28,7 +33,9 @@ import org.eclipse.fx.text.ui.internal.WrappedLineRulerAnnotationPresenter;
import org.eclipse.fx.text.ui.internal.WrappedTextAnnotationPresenter;
import org.eclipse.fx.text.ui.presentation.IPresentationReconciler;
import org.eclipse.fx.text.ui.reconciler.IReconciler;
-import org.eclipse.fx.ui.controls.styledtext.VerifyEvent;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.QuickLink;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.QuickLinkable;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.SimpleQuickLink;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ISynchronizable;
@@ -39,6 +46,8 @@ import org.eclipse.jface.text.source.AnnotationModel;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import com.google.common.collect.Range;
+
public class SourceViewer extends TextViewer implements ISourceViewer, ISourceViewerExtension, ISourceViewerExtension2, ISourceViewerExtension3, ISourceViewerExtension4 {
private IPresentationReconciler fPresentationReconciler;
@@ -232,6 +241,8 @@ public class SourceViewer extends TextViewer implements ISourceViewer, ISourceVi
// });
}
+ getTextWidget().setQuickLinkCallback(configuration.getQuicklinkCallback());
+
new SimpleSmartIndent(this);
diff --git a/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewerConfiguration.java b/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewerConfiguration.java
index 144414baf..3d7772786 100644
--- a/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewerConfiguration.java
+++ b/bundles/code/org.eclipse.fx.text.ui/src/org/eclipse/fx/text/ui/source/SourceViewerConfiguration.java
@@ -11,10 +11,12 @@
package org.eclipse.fx.text.ui.source;
import java.util.Collections;
-import java.util.List;
+import java.util.Optional;
import java.util.Set;
+import java.util.function.Function;
import org.eclipse.fx.text.hover.HoverInfo;
+import org.eclipse.fx.text.navigation.NavigationRegion;
import org.eclipse.fx.text.ui.DefaultUndoManager;
import org.eclipse.fx.text.ui.Feature;
import org.eclipse.fx.text.ui.ITextHover;
@@ -23,6 +25,7 @@ import org.eclipse.fx.text.ui.contentassist.IContentAssistant;
import org.eclipse.fx.text.ui.presentation.IPresentationReconciler;
import org.eclipse.fx.text.ui.presentation.PresentationReconciler;
import org.eclipse.fx.text.ui.reconciler.IReconciler;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea.QuickLinkable;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentExtension3;
import org.eclipse.jface.text.source.Annotation;
@@ -91,4 +94,8 @@ public abstract class SourceViewerConfiguration {
return ".";
}
+ public Function<Integer, Optional<QuickLinkable>> getQuicklinkCallback() {
+ return (offset) -> Optional.empty();
+ }
+
}
diff --git a/bundles/code/org.eclipse.fx.text/META-INF/MANIFEST.MF b/bundles/code/org.eclipse.fx.text/META-INF/MANIFEST.MF
index 1985562d3..cd04a5414 100644
--- a/bundles/code/org.eclipse.fx.text/META-INF/MANIFEST.MF
+++ b/bundles/code/org.eclipse.fx.text/META-INF/MANIFEST.MF
@@ -5,6 +5,7 @@ Bundle-SymbolicName: org.eclipse.fx.text
Bundle-Version: 2.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.fx.text.hover,
+ org.eclipse.fx.text.navigation,
org.eclipse.fx.text.rules;version="2.3.0";x-internal:=true
Require-Bundle: org.eclipse.text;bundle-version="3.5.300",
org.eclipse.equinox.common;bundle-version="3.6.200"
diff --git a/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationRegion.java b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationRegion.java
new file mode 100644
index 000000000..14306c9d1
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationRegion.java
@@ -0,0 +1,10 @@
+package org.eclipse.fx.text.navigation;
+
+import java.util.List;
+
+import org.eclipse.jface.text.IRegion;
+
+public interface NavigationRegion {
+ IRegion getRegion();
+ List<NavigationTarget> getTargets();
+}
diff --git a/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationTarget.java b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationTarget.java
new file mode 100644
index 000000000..1262561bb
--- /dev/null
+++ b/bundles/code/org.eclipse.fx.text/src/org/eclipse/fx/text/navigation/NavigationTarget.java
@@ -0,0 +1,8 @@
+package org.eclipse.fx.text.navigation;
+
+import org.eclipse.jface.text.IRegion;
+
+public interface NavigationTarget {
+ String getFile();
+ IRegion getRegion();
+}

Back to the top