Doc updates and builder changes. Halved the time it takes for a sketch to build and open.

This commit is contained in:
lonnen
2010-09-16 16:25:06 +00:00
parent 545098e54c
commit 85ae458a00
11 changed files with 104 additions and 96 deletions

View File

@@ -91,9 +91,7 @@ public class ProcessingPlugin extends AbstractUIPlugin {
* @return a scanner for creating Processing partitions
*/
public ProcessingPartitionScanner getProcessingPartitionScanner() {
if (fPartitionScanner == null)
fPartitionScanner= new ProcessingPartitionScanner();
return fPartitionScanner;
return (fPartitionScanner == null) ? new ProcessingPartitionScanner() : fPartitionScanner;
}
/**
@@ -102,9 +100,7 @@ public class ProcessingPlugin extends AbstractUIPlugin {
* @return the singleton Processing code scanner
*/
public RuleBasedScanner getProcessingCodeScanner() {
if (fCodeScanner == null)
fCodeScanner= new ProcessingCodeScanner(getProcessingColorProvider());
return fCodeScanner;
return (fCodeScanner == null) ? new ProcessingCodeScanner(getProcessingColorProvider()) : fCodeScanner;
}
/**
@@ -113,9 +109,7 @@ public class ProcessingPlugin extends AbstractUIPlugin {
* @return the singleton Processing color provider
*/
public ProcessingColorProvider getProcessingColorProvider() {
if (fColorProvider == null)
fColorProvider= new ProcessingColorProvider();
return fColorProvider;
return (fColorProvider == null) ? new ProcessingColorProvider() : fColorProvider;
}
}

View File

@@ -169,7 +169,7 @@ public class ProcessingCodeScanner extends RuleBasedScanner {
wordRule.addWord(fgOperators[i], operator);
for (int i= 0; i < fgInvalids.length; i++)
wordRule.addWord(fgInvalids[i], invalid);
// Set these as the colorizing rules for the document
// Set these as the coloring rules for the document
rules.add(wordRule);
IRule[] result= new IRule[rules.size()];
@@ -179,8 +179,6 @@ public class ProcessingCodeScanner extends RuleBasedScanner {
/**
* 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];

View File

@@ -24,10 +24,7 @@ import org.eclipse.jface.text.contentassist.IContextInformationValidator;
/**
* Naive auto completion provider.
* <p>
* None of this is particularly useful, but may be extended in the future.
*
*
* @author lonnen
* None of this is particularly useful without a language model.
*/
public class ProcessingCompletionProcessor implements IContentAssistProcessor {

View File

@@ -16,15 +16,12 @@ import org.eclipse.jface.text.ITextDoubleClickStrategy;
import org.eclipse.jface.text.ITextViewer;
/**
* On a double click, try to automatically highlight a logical section of the source code.
* On a double click, try to automatically highlight a sensible section of the source code.
* <p>
* If the double click is near an opening or closing bracket type, this should highlight to
* the other bracket in the set.
* </p>
* <p>
* If the user didn't double click a bracket, assume they wanted the word
*
* @author lonnen
*/
public class ProcessingDoubleClickSelector implements ITextDoubleClickStrategy {
@@ -42,20 +39,17 @@ public class ProcessingDoubleClickSelector implements ITextDoubleClickStrategy {
/* Method declared on ITextDoubleClickStrategy */
public void doubleClicked(ITextViewer text) {
fPos = text.getSelectedRange().x;
if (fPos < 0)
return;
fText= text;
// If a matching bracket wasn't found, assume the user wants the word
if (!selectBracketBlock())
if (fPos < 0) return;
fText = text;
if (!selectBracketBlock()) // if you can't match brackets, try to grab the word
selectWord();
}
/**
* Match the brackets at the current selection.
* Return <code>true</code> if successful, <code>false</code> otherwise.
* Tries to find a matching bracket. the brackets at the current selection.
*
* @return <code>true</code> if brackets match, <code>false</code> otherwise
*/
@@ -106,7 +100,6 @@ public class ProcessingDoubleClickSelector implements ITextDoubleClickStrategy {
} catch (BadLocationException x) {
// assume everything is cool
}
return false;
}

View File

@@ -18,7 +18,7 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
/** Manages the colors used in the Java Editor */
/** Manages the colors used in the Processing Editor */
public class ProcessingColorProvider {
public static final RGB COMMENT1= new RGB(126, 126, 126); //comment 1
@@ -34,9 +34,9 @@ public class ProcessingColorProvider {
public static final RGB STRING= new RGB(0, 102, 153);
public static final RGB DEFAULT= new RGB(0, 0, 0);
protected Map fColorTable= new HashMap(17);
protected Map fColorTable= new HashMap(12); // number of color categories
/** Release all of the color resources held onto by the receiver. */
/** Release all of the color resources held onto by the receiver. */
public void dispose() {
Iterator e= fColorTable.values().iterator();
while (e.hasNext())
@@ -44,10 +44,9 @@ public class ProcessingColorProvider {
}
/**
* convert an RGB value to a Color using the resource table
*
* @param rgb the RGB value
* @return the color stored in the color table for the given RGB value
* Convert an RGB value to a Color using the resource table.
* <p>
* Please note that this is an SWT color, not a Processing color.
*/
public Color getColor(RGB rgb) {
Color color= (Color) fColorTable.get(rgb);

View File

@@ -12,6 +12,14 @@ package processing.plugin.ui.processingeditor.util;
import org.eclipse.jface.text.rules.IWhitespaceDetector;
/**
* Detects Processing whitespace.
* <p>
* Processing whitespace is the same as Java whitespace, so this is all
* a big wrapper for <code>Characer.isWhitespace()</code>. The method
* itself is not static because it has to implement the IWhitespaceDetector
* interface.
*/
public class ProcessingWhitespaceDetector implements IWhitespaceDetector {
public boolean isWhitespace(char character){

View File

@@ -13,9 +13,12 @@ package processing.plugin.ui.processingeditor.util;
import org.eclipse.jface.text.rules.IWordDetector;
/**
* Processing Words are Java words, so this class wraps Character methods to detect
* Java words. JavaDoc for the methods can be found in the IWordDetector interface.
* */
* Detects Processing words
* <p>
* Processing Words are Java words, so this class wraps Character
* methods to detect Java words. The interface prevents these
* from being made static.
*/
public class ProcessingWordDetector implements IWordDetector {
public boolean isWordPart(char character) {

View File

@@ -10,20 +10,15 @@
*/
package processing.plugin.ui.wizards;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
import processing.plugin.core.builder.SketchProject;
import processing.plugin.ui.ProcessingPlugin;
/**
* A wizard to export a Processing sketch project as an applet