First Autocomplete!
This commit is contained in:
parent
80bd438b5f
commit
4c5b155427
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
<properties>
|
||||
<tycho.version>1.2.0</tycho.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<eclipse-repo.url>http://download.eclipse.org/releases/oxygen</eclipse-repo.url>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<downloadSources>true</downloadSources>
|
||||
<downloadJavadocs>true</downloadJavadocs>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@ -97,16 +99,8 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<!--
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>bundles/JavaCompilerPlugin.Plugin/icons</directory>
|
||||
<includes>
|
||||
<include>sample.gif</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
-->
|
||||
<!-- <resources> <resource> <directory>bundles/JavaCompilerPlugin.Plugin/icons</directory>
|
||||
<includes> <include>sample.gif</include> </includes> </resource> </resources> -->
|
||||
</build>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user