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
|
//Example from: http://help.eclipse.org/indigo/index.jsp
|
||||||
/**
|
/**
|
||||||
* Editor für .jav-Dateien
|
* 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
|
* @author janulrich
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -115,7 +115,7 @@ public class JavEditor extends TextEditor{
|
|||||||
}catch(TypeinferenceException texc){
|
}catch(TypeinferenceException texc){
|
||||||
markers.add(new ErrorMarker(texc.getMessage(),new CodePoint(texc.getOffset())));
|
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);
|
System.out.println("Typinferez durchgeführt. Berechnete Marker:\n"+markers);
|
||||||
|
|
||||||
IResource activeDocument = extractResource();
|
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
|
* @param marker
|
||||||
*/
|
*/
|
||||||
private void deleteAnnotation(JavMarker 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
|
* @param typeReplaceMarker
|
||||||
*/
|
*/
|
||||||
public void runReplaceMarker(TypeReplaceMarker typeReplaceMarker) {
|
public void runReplaceMarker(TypeReplaceMarker typeReplaceMarker) {
|
||||||
@ -239,7 +239,7 @@ public class JavEditor extends TextEditor{
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Aktualisiert die OutlinePage, falls vorhanden.
|
* Aktualisiert die OutlinePage, falls vorhanden.
|
||||||
* Muss nach Änderungen an markers aufgerufen werden.
|
* Muss nach Änderungen an markers aufgerufen werden.
|
||||||
*/
|
*/
|
||||||
private void updateOutlinePage() {
|
private void updateOutlinePage() {
|
||||||
if(this.outlinePage!= null && this.sourceFile != null && this.errorMarkers != null)
|
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.
|
* Dabei werden die ReplaceMarker herausgefiltert, welche mindestens einen Typ an dem übergebenen offset einsetzen.
|
||||||
* @param offset
|
* @param offset
|
||||||
* @return
|
* @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.ContentAssistant;
|
||||||
import org.eclipse.jface.text.contentassist.ContextInformation;
|
import org.eclipse.jface.text.contentassist.ContextInformation;
|
||||||
import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
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.IContentAssistant;
|
||||||
import org.eclipse.jface.text.contentassist.IContextInformation;
|
import org.eclipse.jface.text.contentassist.IContextInformation;
|
||||||
import org.eclipse.jface.text.presentation.IPresentationReconciler;
|
import org.eclipse.jface.text.presentation.IPresentationReconciler;
|
||||||
@ -44,8 +45,9 @@ public class JavViewerConfiguration extends SourceViewerConfiguration {
|
|||||||
|
|
||||||
private JavEditor editor;
|
private JavEditor editor;
|
||||||
|
|
||||||
public JavViewerConfiguration(JavEditor parentEditor){
|
public JavViewerConfiguration(JavEditor editor){
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +128,16 @@ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceVie
|
|||||||
return ret;
|
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>
|
<properties>
|
||||||
<tycho.version>1.2.0</tycho.version>
|
<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>
|
<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>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
@ -97,16 +99,8 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
<!--
|
<!-- <resources> <resource> <directory>bundles/JavaCompilerPlugin.Plugin/icons</directory>
|
||||||
<resources>
|
<includes> <include>sample.gif</include> </includes> </resource> </resources> -->
|
||||||
<resource>
|
|
||||||
<directory>bundles/JavaCompilerPlugin.Plugin/icons</directory>
|
|
||||||
<includes>
|
|
||||||
<include>sample.gif</include>
|
|
||||||
</includes>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
-->
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
Loading…
Reference in New Issue
Block a user