Autocomplete.
This commit is contained in:
parent
744b9ac99d
commit
a0c6898344
@ -63,7 +63,7 @@ public class Typinferenz {
|
|||||||
if (!ret.contains(toAdd)) {
|
if (!ret.contains(toAdd)) {
|
||||||
ret.add(toAdd);
|
ret.add(toAdd);
|
||||||
} else {
|
} else {
|
||||||
LOG.log(new Status(ERROR, PLUGIN_ID, "Marker bereits vorhanden: " + toAdd.toString()));
|
//LOG.log(new Status(ERROR, PLUGIN_ID, "Marker bereits vorhanden: " + toAdd.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,17 +29,17 @@ import org.eclipse.swt.internal.C;
|
|||||||
|
|
||||||
import typinferenzplugin.Activator;
|
import typinferenzplugin.Activator;
|
||||||
|
|
||||||
public class JafCompletionProcess implements IContentAssistProcessor {
|
public class JafCompletionProcessor implements IContentAssistProcessor {
|
||||||
private static final char DOT_OPERATOR = '.';
|
private static final char DOT_OPERATOR = '.';
|
||||||
private static final ILog LOG = Activator.getDefault().getLog();
|
private static final ILog LOG = Activator.getDefault().getLog();
|
||||||
|
|
||||||
private JavEditor editor;
|
private JavEditor editor;
|
||||||
|
|
||||||
private final IContextInformation[] NO_CONTEXTS = {};
|
private final IContextInformation[] NO_CONTEXTS = {};
|
||||||
private final char[] PROPOSAL_ACTIVATION_CHARS = { 's', 'f', 'p', 'n', 'm', };
|
private final char[] PROPOSAL_ACTIVATION_CHARS = { '.' };
|
||||||
private ICompletionProposal[] NO_COMPLETIONS = {};
|
private ICompletionProposal[] NO_COMPLETIONS = {};
|
||||||
|
|
||||||
public JafCompletionProcess(JavEditor editor) {
|
public JafCompletionProcessor(JavEditor editor) {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ public class JafCompletionProcess implements IContentAssistProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getContextInformationAutoActivationCharacters() {
|
public char[] getContextInformationAutoActivationCharacters() {
|
||||||
return null;
|
return PROPOSAL_ACTIVATION_CHARS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -33,9 +33,12 @@ import org.eclipse.jface.text.source.DefaultAnnotationHover;
|
|||||||
import org.eclipse.jface.text.source.IAnnotationHover;
|
import org.eclipse.jface.text.source.IAnnotationHover;
|
||||||
import org.eclipse.jface.text.source.ISourceViewer;
|
import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import typinferenzplugin.TypeReplaceMarker;
|
import typinferenzplugin.TypeReplaceMarker;
|
||||||
|
|
||||||
@ -132,8 +135,12 @@ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceVie
|
|||||||
@Override
|
@Override
|
||||||
public IContentAssistant getContentAssistant(ISourceViewer sv) {
|
public IContentAssistant getContentAssistant(ISourceViewer sv) {
|
||||||
ContentAssistant ca = new ContentAssistant();
|
ContentAssistant ca = new ContentAssistant();
|
||||||
IContentAssistProcessor pr = new JafCompletionProcess(editor);
|
IContentAssistProcessor pr = new JafCompletionProcessor(editor);
|
||||||
|
ca.enableAutoActivation(true);
|
||||||
|
ca.enableAutoInsert(true);
|
||||||
ca.setContentAssistProcessor(pr, IDocument.DEFAULT_CONTENT_TYPE);
|
ca.setContentAssistProcessor(pr, IDocument.DEFAULT_CONTENT_TYPE);
|
||||||
|
//ca.setContextInformationPopupBackground(JavaEditorEnvironment.getJavaColorProvider().getColor(new RGB(255, 170, 170)));
|
||||||
|
ca.setContextInformationPopupBackground(new Color(Display.getCurrent(), 255,170,170));
|
||||||
ca.setInformationControlCreator(getInformationControlCreator(sv));
|
ca.setInformationControlCreator(getInformationControlCreator(sv));
|
||||||
return ca;
|
return ca;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user