From f69011c955c2fb0e9328fd13ed4c409ef8faa591 Mon Sep 17 00:00:00 2001 From: lonnen Date: Thu, 17 Jun 2010 23:33:04 +0000 Subject: [PATCH] Disabled the naive content assist popup boxes --- .../META-INF/MANIFEST.MF | 2 +- .../language/ProcessingCodeScanner.java | 13 +++++++++ .../ProcessingCompletionProcessor.java | 27 ++++++++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/editor/org.processing.editor/META-INF/MANIFEST.MF b/editor/org.processing.editor/META-INF/MANIFEST.MF index 7f2a5bd36..ba885d11f 100644 --- a/editor/org.processing.editor/META-INF/MANIFEST.MF +++ b/editor/org.processing.editor/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: org.processing.editor Bundle-SymbolicName: org.processing.editor;singleton:=true -Bundle-Version: 0.0.1 +Bundle-Version: 0.0.2 Bundle-Activator: org.processing.editor.ProcessingEditorPlugin Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java index 81afef8ac..f9b1e0510 100644 --- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java +++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCodeScanner.java @@ -167,4 +167,17 @@ public class ProcessingCodeScanner extends RuleBasedScanner { setRules(result); } + /** + * Concatenates the keyword arrays into one array and returns it. + * + * @return A string array of all the keywords + */ + public final static String[] getKeywords(){ + String[] result = new String[fgKeywords1.length + fgKeywords2.length + fgKeywords3.length]; + System.arraycopy(fgKeywords1, 0, result, 0, fgKeywords1.length); + System.arraycopy(fgKeywords2, 0, result, fgKeywords1.length, fgKeywords2.length); + System.arraycopy(fgKeywords3, 0, result, fgKeywords1.length+fgKeywords2.length, fgKeywords3.length); + return result; + } + } diff --git a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java index 44d66352d..9cba52294 100644 --- a/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java +++ b/editor/org.processing.editor/src/org/processing/editor/language/ProcessingCompletionProcessor.java @@ -52,9 +52,30 @@ public class ProcessingCompletionProcessor implements IContentAssistProcessor { } } - protected final static String[] fgProposals= - { "abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "continue", "default", "do", "double", "else", "extends", "false", "final", "finally", "float", "for", "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", "volatile", "while" }; //$NON-NLS-48$ //$NON-NLS-47$ //$NON-NLS-46$ //$NON-NLS-45$ //$NON-NLS-44$ //$NON-NLS-43$ //$NON-NLS-42$ //$NON-NLS-41$ //$NON-NLS-40$ //$NON-NLS-39$ //$NON-NLS-38$ //$NON-NLS-37$ //$NON-NLS-36$ //$NON-NLS-35$ //$NON-NLS-34$ //$NON-NLS-33$ //$NON-NLS-32$ //$NON-NLS-31$ //$NON-NLS-30$ //$NON-NLS-29$ //$NON-NLS-28$ //$NON-NLS-27$ //$NON-NLS-26$ //$NON-NLS-25$ //$NON-NLS-24$ //$NON-NLS-23$ //$NON-NLS-22$ //$NON-NLS-21$ //$NON-NLS-20$ //$NON-NLS-19$ //$NON-NLS-18$ //$NON-NLS-17$ //$NON-NLS-16$ //$NON-NLS-15$ //$NON-NLS-14$ //$NON-NLS-13$ //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ - + /* + * The list of proposals that populates the content assistance dialog box. + * + * Dialog assistance is not context sensitive right now, so it will always provide the same suggestions + * anytime is provides suggestions. I find it more annoying than useful, so until it is done right I'm + * turning off the pop up box by leaving this empty. + * + * Auto-completion by hotkey will still work, but it will pick the closest keyword or variable that is + * already present in the sketch. This is actually useful, so I'm leaving that intact for now. + * + * [lonnen] June 17, 2010 + * + * @see http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/jface.htm + */ + protected final static String[] fgProposals= //ProcessingCodeScanner.getKeywords(); // naive solution? + //generated automatically for Java. Not useful, ignoring them for now. +// { "abstract", "boolean", "break", "byte", "case", "catch", "char", "class", "continue", +// "default", "do", "double", "else", "extends", "false", "final", "finally", "float", "for", +// "if", "implements", "import", "instanceof", "int", "interface", "long", "native", "new", +// "null", "package", "private", "protected", "public", "return", "short", "static", "super", +// "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "void", +// "volatile", "while" }; + {}; // turns off the content assist dialog box + protected IContextInformationValidator fValidator= new Validator(); /* (non-Javadoc)