From 0e5c3216d0b44e81b57121d1030b705e5d68622b Mon Sep 17 00:00:00 2001 From: Michael Uhl Date: Wed, 19 Dec 2018 10:38:18 +0100 Subject: [PATCH 1/3] Stand 19.12.2018 --- .../JavaCompilerPlugin.Plugin/.classpath | 2 +- .../META-INF/MANIFEST.MF | 29 +++++++++--------- .../build.properties | 22 +++++--------- .../JavaCompilerPlugin.Plugin/plugin.xml | 30 +++++++++---------- .../JavaCompilerPlugin.Feature/feature.xml | 16 +++++----- JavaCompilerPlugin/pom.xml | 5 ++-- 6 files changed, 48 insertions(+), 56 deletions(-) diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath index 6c39188..d9f32c1 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath @@ -3,6 +3,6 @@ - + diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF index 48e308c..2a2fc38 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF @@ -1,22 +1,23 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: JavaCompilerPlugin.Plugin -Bundle-SymbolicName: JavaCompilerPlugin.Plugin;singleton:=true +Bundle-Name: TypinferenzPlugin +Bundle-SymbolicName: TypinferenzPlugin;singleton:=true Bundle-Version: 0.1.0.qualifier Bundle-Vendor: de.dhbwstuttgart +Bundle-Activator: typinferenzplugin.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.jface.text, + org.eclipse.ui.editors, + org.eclipse.ui.workbench, + org.eclipse.core.resources, + org.eclipse.ui.ide, + org.eclipse.ui.views, + org.eclipse.equinox.ds; visibility:=reexport, + de.dhbwstuttgart.JavaCompilerCoreOsgi +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-ClassPath: ., bin -Automatic-Module-Name: JavaCompilerPlugin.Plugin;singleton:=true -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - org.eclipse.jface.text, - org.eclipse.ui.editors, - org.eclipse.ui.workbench, - org.eclipse.core.resources, - org.eclipse.ui.ide, - org.eclipse.ui.views, - de.dhbwstuttgart.JavaCompilerCoreOsgi -Bundle-RequiredExecutionEnvironment: JavaSE-9 Provide-Capability: osgi.ee;osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8" -Bundle-Activator: typinferenzplugin.Activator +Automatic-Module-Name: TypinferenzPlugin diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties index 5fb442f..db1d5c7 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties @@ -1,17 +1,9 @@ -source.. = src/ -output.. = bin/ -bin.includes = src/,\ - plugin.xml,\ - icons/,\ - build.properties,\ +bin.includes = plugin.xml,\ META-INF/,\ - .classpath,\ - .project,\ - bin/ -src.includes = src/,\ + .,\ icons/,\ - build.properties,\ - META-INF/,\ - .classpath,\ - .project,\ - bin/ + src/,\ + bin/,\ + build.properties +src.includes = src/ + diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/plugin.xml b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/plugin.xml index 19c83ed..1b55516 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/plugin.xml +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/plugin.xml @@ -2,7 +2,7 @@ - + - - - - - + + + + + - - + - - + + diff --git a/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml b/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml index 20df408..92e34a7 100644 --- a/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml +++ b/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml @@ -16,18 +16,18 @@ [Enter License Description here.] - - + unpack="false"/> + + diff --git a/JavaCompilerPlugin/pom.xml b/JavaCompilerPlugin/pom.xml index a682f60..dd1a42f 100644 --- a/JavaCompilerPlugin/pom.xml +++ b/JavaCompilerPlugin/pom.xml @@ -1,8 +1,7 @@ - + 4.0.0 - de.dhbwstuttgart JavaCompilerPlugin - 0.1.0-SNAPSHOT pom de.dhbwstuttgart From 80bd438b5f16a3fc6367fd097f843b094d8416a2 Mon Sep 17 00:00:00 2001 From: Michael Uhl Date: Wed, 19 Dec 2018 13:31:11 +0100 Subject: [PATCH 2/3] Works now. --- .../JavaCompilerPlugin.Plugin/.classpath | 21 +++++++++ .../META-INF/MANIFEST.MF | 45 +++++++++++++++++-- .../build.properties | 3 +- .../JavaCompilerPlugin.Feature/feature.xml | 7 --- 4 files changed, 64 insertions(+), 12 deletions(-) diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath index d9f32c1..310159c 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/.classpath @@ -4,5 +4,26 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF index 2a2fc38..59d0a4c 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/META-INF/MANIFEST.MF @@ -6,18 +6,55 @@ Bundle-Version: 0.1.0.qualifier Bundle-Vendor: de.dhbwstuttgart Bundle-Activator: typinferenzplugin.Activator Require-Bundle: org.eclipse.ui, + javax.inject, org.eclipse.core.runtime, org.eclipse.jface.text, + org.eclipse.jdt.ui, org.eclipse.ui.editors, org.eclipse.ui.workbench, org.eclipse.core.resources, + org.eclipse.swt, + org.eclipse.osgi, + org.eclipse.jface, + org.eclipse.e4.ui.services, + org.eclipse.e4.ui.workbench, + org.eclipse.e4.ui.di, + org.eclipse.e4.core.di.annotations, + org.eclipse.equinox.p2.core, + org.eclipse.equinox.p2.operations, + org.eclipse.equinox.p2.engine, + org.eclipse.equinox.ds, + org.eclipse.equinox.event, + org.eclipse.equinox.p2.repository;bundle-version="2.3.200", + org.eclipse.equinox.p2.metadata;bundle-version="2.3.100", org.eclipse.ui.ide, org.eclipse.ui.views, - org.eclipse.equinox.ds; visibility:=reexport, - de.dhbwstuttgart.JavaCompilerCoreOsgi + org.eclipse.equinox.ds; visibility:=reexport Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Bundle-ClassPath: ., - bin -Provide-Capability: osgi.ee;osgi.ee="JavaSE";version:List="1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8" + lib/animal-sniffer-annotations.jar, + lib/antlr4.jar, + lib/antlr4-runtime.jar, + lib/antlr-runtime.jar, + lib/asm.jar, + lib/bcel.jar, + lib/checker-qual.jar, + lib/commons-io.jar, + lib/error_prone_annotations.jar, + lib/failureaccess.jar, + lib/guava.jar, + lib/icu4j.jar, + lib/j2objc-annotations.jar, + lib/javassist.jar, + lib/JavaTXcompiler.jar, + lib/javax.json.jar, + lib/jsr305.jar, + lib/listenablefuture.jar, + lib/org.abego.treelayout.core.jar, + lib/reflections.jar, + lib/ST4.jar, + bin, + typinferenzplugin +Import-Package: javax.annotation;version="1.2.0" Automatic-Module-Name: TypinferenzPlugin diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties index db1d5c7..20449d1 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/build.properties @@ -4,6 +4,7 @@ bin.includes = plugin.xml,\ icons/,\ src/,\ bin/,\ - build.properties + build.properties,\ + lib/ src.includes = src/ diff --git a/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml b/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml index 92e34a7..d498041 100644 --- a/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml +++ b/JavaCompilerPlugin/features/JavaCompilerPlugin.Feature/feature.xml @@ -16,13 +16,6 @@ [Enter License Description here.] - - Date: Wed, 19 Dec 2018 19:48:44 +0100 Subject: [PATCH 3/3] First Autocomplete! --- .../src/typinferenzplugin/editor/JavEditor.java | 12 ++++++------ .../editor/JavViewerConfiguration.java | 14 +++++++++++++- .../JavaCompilerPlugin.Configuration/pom.xml | 16 +++++----------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java index 890222c..a475b53 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavEditor.java @@ -38,7 +38,7 @@ import typinferenzplugin.error.ErrorOutput; //Example from: http://help.eclipse.org/indigo/index.jsp /** * Editor für .jav-Dateien - * Anmerkung: Für jede geöffnete Datei wird eine Instanz des Editors erstellt + * Anmerkung: Für jede geöffntete Datei wird eine Instanz des Editors erstellt * @author janulrich * */ @@ -115,7 +115,7 @@ public class JavEditor extends TextEditor{ }catch(TypeinferenceException texc){ markers.add(new ErrorMarker(texc.getMessage(),new CodePoint(texc.getOffset()))); } - //Anschließend die TypeReplaceMarker im Quellcode anzeigen: https://stackoverflow.com/questions/8945371/how-to-implement-quick-fix-quick-assist-for-custom-eclipse-editor + //Anschließend die TypeReplaceMarker im Quellcode anzeigen: https://stackoverflow.com/questions/8945371/how-to-implement-quick-fix-quick-assist-for-custom-eclipse-editor System.out.println("Typinferez durchgeführt. Berechnete Marker:\n"+markers); IResource activeDocument = extractResource(); @@ -182,7 +182,7 @@ public class JavEditor extends TextEditor{ } /** - * Löscht die zu marker gehörende Annotation + * Löscht die zu marker gehörende Annotation * @param marker */ private void deleteAnnotation(JavMarker marker){ @@ -211,7 +211,7 @@ public class JavEditor extends TextEditor{ /** - * Diese Funktion führt einen ReplaceMarker aus. + * Diese Funktion führt einen ReplaceMarker aus. * @param typeReplaceMarker */ public void runReplaceMarker(TypeReplaceMarker typeReplaceMarker) { @@ -239,7 +239,7 @@ public class JavEditor extends TextEditor{ /** * Aktualisiert die OutlinePage, falls vorhanden. - * Muss nach Änderungen an markers aufgerufen werden. + * Muss nach Änderungen an markers aufgerufen werden. */ private void updateOutlinePage() { if(this.outlinePage!= null && this.sourceFile != null && this.errorMarkers != null) @@ -255,7 +255,7 @@ public class JavEditor extends TextEditor{ } /** - * Ermittelt die momentan an dem Dokument, für welches dieser Editor zuständig ist, angebrachten TypeReplaceMarker. + * Ermittelt die momentan an dem Dokument, für welches dieser Editor zuständig ist, angebrachten TypeReplaceMarker. * Dabei werden die ReplaceMarker herausgefiltert, welche mindestens einen Typ an dem übergebenen offset einsetzen. * @param offset * @return diff --git a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavViewerConfiguration.java b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavViewerConfiguration.java index 322651c..a3a239d 100644 --- a/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavViewerConfiguration.java +++ b/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/src/typinferenzplugin/editor/JavViewerConfiguration.java @@ -14,6 +14,7 @@ import org.eclipse.jface.text.contentassist.CompletionProposal; import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.ContextInformation; import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.presentation.IPresentationReconciler; @@ -44,8 +45,9 @@ public class JavViewerConfiguration extends SourceViewerConfiguration { private JavEditor editor; - public JavViewerConfiguration(JavEditor parentEditor){ + public JavViewerConfiguration(JavEditor editor){ super(); + this.editor = editor; } @@ -125,6 +127,16 @@ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceVie ret.setInformationControlCreator(getInformationControlCreator(sourceViewer)); return ret; } + + @Override + public IContentAssistant getContentAssistant(ISourceViewer sv) { + ContentAssistant ca = new ContentAssistant(); + IContentAssistProcessor pr = new JafCompletionProcess(); + ca.setContentAssistProcessor(pr, IDocument.DEFAULT_CONTENT_TYPE); + ca.setInformationControlCreator(getInformationControlCreator(sv)); + return ca; + } + } diff --git a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml index 1964651..3767606 100644 --- a/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml +++ b/JavaCompilerPlugin/releng/JavaCompilerPlugin.Configuration/pom.xml @@ -7,8 +7,10 @@ 1.2.0 - UTF-8 http://download.eclipse.org/releases/oxygen + UTF-8 + true + true @@ -97,16 +99,8 @@ - + \ No newline at end of file