removing nb project since we're not going in this direction

This commit is contained in:
benfry
2010-06-28 12:00:12 +00:00
parent 6c3eb2b8c8
commit fc15be69f1
14 changed files with 0 additions and 870 deletions
-11
View File
@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java 5"/>
<classpathentry kind="lib" path="lib/org-netbeans-modules-editor-fold.jar"/>
<classpathentry kind="lib" path="lib/org-netbeans-modules-editor-lib.jar"/>
<classpathentry kind="lib" path="lib/org-netbeans-modules-editor-util.jar"/>
<classpathentry kind="lib" path="lib/org-openide-dialogs.jar"/>
<classpathentry kind="lib" path="lib/org-openide-util.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>processing-nbeditor</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,12 +0,0 @@
#Wed Mar 24 11:29:18 EDT 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
-1
View File
@@ -1 +0,0 @@
Experimental project to explore the user of NetBeans 5.5 editor componentry fro PDE.
@@ -1,135 +0,0 @@
package processing.editor.netbeans;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;
import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.KeyStroke;
import org.netbeans.editor.BaseSettingsInitializer;
import org.netbeans.editor.Settings;
import org.netbeans.editor.ext.ExtKit;
import org.netbeans.editor.ext.ExtSettingsInitializer;
import org.netbeans.editor.ext.ExtUtilities;
import org.openide.util.Utilities;
/**
* NBEditorFactory is
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class NBEditorFactory
{
private NBEditorFactory()
{
}
/**
* Flag indicating if default settings have been initialized.
*/
private static boolean initialized = false;
/**
* Initializes default settings.
*/
private static synchronized void initEditorSettings()
{
if (!initialized)
{
Settings.addInitializer(new BaseSettingsInitializer(), Settings.CORE_LEVEL);
Settings.addInitializer(new ExtSettingsInitializer(), Settings.CORE_LEVEL);
Settings.reset();
initialized = true;
}
}
/**
* Registers a given content type (from the ExtKit) and installs
* appropriate settings for it.
* @param anEditorKit an ExtKit to use.
* @param aSettingsInitializer an object that initializes editor settings
* for that ExtKit type.
*/
public static void addSyntax(final ExtKit anEditorKit,
final Settings.AbstractInitializer aSettingsInitializer)
{
// Initialize default settings in case of need
initEditorSettings();
// Register content-type
JEditorPane.registerEditorKitForContentType(anEditorKit.getContentType(),
anEditorKit.getClass().getName());
// Add the initializer to the hierarchy of initializers
Settings.addInitializer(aSettingsInitializer);
Settings.reset();
}
/**
* Updates key bindings for a JEditorPane
* @param anEditorPane the JEditorPane on which the key bindings are to
* be installed.
*/
private static void updateKeyBindings(final JEditorPane anEditorPane)
{
// Update key bindings for the editor pane
Properties keybindings = new Properties();
InputMap inputMap = anEditorPane.getInputMap();
try
{
InputStream inputStream = NBEditorFactory.class
.getResourceAsStream("keybindings.properties");
keybindings.load(inputStream);
inputStream.close();
Enumeration keynames = keybindings.keys();
while (keynames.hasMoreElements())
{
String keyName = (String) keynames.nextElement();
KeyStroke ks = Utilities.stringToKey(keyName);
String actionName = keybindings.getProperty(keyName);
inputMap.put(ks, actionName);
}
}
catch (Exception e)
{
// If there's any problem loading keybindings then log it ...
e.printStackTrace(System.err);
// ... and use a minimum of working bindings
// TODO: Update this list of default keys
inputMap.put(KeyStroke.getKeyStroke("DELETE"), ExtKit.deleteNextCharAction);
inputMap.put(KeyStroke.getKeyStroke("BACK_SPACE"),
ExtKit.deletePrevCharAction);
inputMap.put(KeyStroke.getKeyStroke("ENTER"), ExtKit.insertBreakAction);
inputMap.put(KeyStroke.getKeyStroke("UP"), ExtKit.upAction);
inputMap.put(KeyStroke.getKeyStroke("DOWN"), ExtKit.downAction);
inputMap.put(KeyStroke.getKeyStroke("LEFT"), ExtKit.backwardAction);
inputMap.put(KeyStroke.getKeyStroke("RIGHT"), ExtKit.forwardAction);
inputMap.put(KeyStroke.getKeyStroke("ctrl Z"), ExtKit.undoAction);
inputMap.put(KeyStroke.getKeyStroke("ctrl Y"), ExtKit.redoAction);
}
}
/**
* Obtains a JComponent responsible for visualization of the contents
* of a JEditorPane, and prepares the JEditorPane to accept the content-type
* of the given EditorKit.
* @param anEditorKit an ExtKit with an appropriate content-type.
* @param anEditorPane a JEditorPane whose UI will be replaced with the
* JComponent. This JEditorPane can be used to modify the text, but not
* for visualization.
* @return a JComponent responsible for visualizing text, rendering a status
* bar and a line number bar.
*/
public static JComponent newTextRenderer(final ExtKit anEditorKit,
final JEditorPane anEditorPane)
{
initEditorSettings();
updateKeyBindings(anEditorPane);
anEditorPane.setContentType(anEditorKit.getContentType());
return ExtUtilities.getExtEditorUI(anEditorPane).getExtComponent();
}
}
@@ -1,79 +0,0 @@
package processing.editor.netbeans.demo;
import java.awt.BorderLayout;
import javax.swing.JComponent;
import javax.swing.JEditorPane;
import processing.editor.netbeans.NBEditorFactory;
import processing.editor.netbeans.syntax.scheme.SchemeEditorKit;
import processing.editor.netbeans.syntax.scheme.SchemeSettingsInitializer;
/**
* This is a test frame with a standalone NetBeans Editor.
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class NBEditorLibDemoFrame extends javax.swing.JFrame
{
/** Creates new form NBEditorLibDemoFrame */
public NBEditorLibDemoFrame()
{
initComponents();
// Create an editor kit for scheme
SchemeEditorKit editorKit = new SchemeEditorKit();
// Initialize Scheme language support
NBEditorFactory.addSyntax(editorKit, new SchemeSettingsInitializer());
// Create a plain editor pane
JEditorPane editorPane = new JEditorPane();
// Create a renderer to replace the editor pane *visually*
JComponent renderer = NBEditorFactory.newTextRenderer(editorKit, editorPane);
// Set the text *in the editor pane*
editorPane.setText("; A scheme definition\n(define i (sqrt -1 ))\n");
// Visualize the *renderer*
getContentPane().add(renderer, BorderLayout.CENTER);
// Visualize the frame
setSize(450, 200);
setLocationRelativeTo(null);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
private void initComponents()
{
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Standalone NetBeans Editor");
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(final String args[])
{
java.awt.EventQueue.invokeLater(new Runnable() {
public void run()
{
new NBEditorLibDemoFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
// End of variables declaration//GEN-END:variables
}
@@ -1,109 +0,0 @@
A-P=tooltip-show
A-U$T=adjust-window-top
BACK_SPACE=delete-previous
C-DOWN=scroll-up
C-G=goto
C-H=replace
C-LEFT=caret-previous-word
COPY=copy-to-clipboard
C-SPACE=completion-show
CS-SPACE=documentation-show
C-UP=scroll-down
CUT=cut-to-clipboard
D-ADD=expand-fold
D-A=select-all
D-BACK_SLASH=completion-show
D-BACK_SPACE=remove-word-previous
D-C=copy-to-clipboard
D-DELETE=remove-word-next
D-D=shift-line-left
DELETE=delete-next
D-END=caret-end
D-ENTER=split-line
D-EQUALS=expand-fold
D-E=remove-line
D-F3=find-selection
D-F=find
D-HOME=caret-begin
D-INSERT=copy-to-clipboard
D-J$E=stop-macro-recording
D-J$S=start-macro-recording
D-K=word-match-prev
D-L=word-match-next
D-MINUS=collapse-fold
D-M=select-next-parameter
D-OPEN_BRACKET=match-brace
DOWN=caret-down
D-PLUS=expand-fold
D-RIGHT=caret-next-word
DS-ADD=expand-all-folds
DS-C=annotations-cycling
DS-END=selection-end
DS-EQUALS=expand-all-folds
DS-F=format
DS-HOME=selection-begin
DS-LEFT=selection-previous-word
DS-MINUS=collapse-all-folds
DS-OPEN_BRACKET=selection-match-brace
DS-PLUS=expand-all-folds
DS-RIGHT=selection-next-word
DS-SUBTRACT=collapse-all-folds
D-SUBTRACT=collapse-fold
DS-V=paste-formated
D-T=shift-line-right
D-U=remove-line-begin
D-V=paste-from-clipboard
D-W -->=remove-word
D-X=cut-to-clipboard
D-Y=redo
D-Z=undo
END=caret-end-line
ENTER=insert-break
F3=find-next
FIND=find
HOME=caret-begin-line
INSERT=toggle-typing-mode
KP_DOWN=caret-down
KP_LEFT=caret-backward
KP_RIGHT=caret-forward
KP_UP=caret-up
LEFT=caret-backward
O-J=select-identifier
O-K=jump-list-prev
O-L=jump-list-next
OS-B=adjust-caret-bottom
OS-H=toggle-highlight-search
OS-K=jump-list-prev-component
OS-L=jump-list-next-component
OS-M=adjust-caret-center
OS-T=adjust-caret-top
O-U$B=adjust-window-bottom
O-U$E=caret-end-word
O-U$L=to-lower-case
O-U$M=adjust-window-center
O-U$R=switch-case
O-U$U=to-upper-case
PAGE_DOWN=page-down
PAGE_UP=page-up
PASTE=paste-from-clipboard
RIGHT=caret-forward
S-BACK_SPACE=delete-previous
S-DELETE=cut-to-clipboard
S-DOWN=selection-down
S-END=selection-end-line
S-ENTER=shift-insert-break
S-ENTER=start-new-line
S-F10=show-popup-menu
S-F3=find-previous
S-HOME=selection-begin-line
S-INSERT=paste-from-clipboard
S-LEFT=selection-backward
S-PAGE_DOWN=selection-page-down
S-PAGE_UP=selection-page-up
S-RIGHT=selection-forward
S-SPACE=abbrev-expand
S-TAB=remove-tab
S-UP=selection-up
TAB=insert-tab
UNDO=undo
UP=caret-up
@@ -1,32 +0,0 @@
package processing.editor.netbeans.syntax.scheme;
import javax.swing.text.Document;
import org.netbeans.editor.Syntax;
import org.netbeans.editor.ext.ExtKit;
/**
* SchemeEditorKit is a custom EditorKit for Scheme files.
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.1.1.1 $
*/
public class SchemeEditorKit
extends ExtKit
{
public SchemeEditorKit()
{
super();
}
public String getContentType()
{
return "text/x-scheme"; // NOI18N
}
public Syntax createSyntax(Document document)
{
return new SchemeSyntax();
}
}
@@ -1,57 +0,0 @@
package processing.editor.netbeans.syntax.scheme;
import java.awt.RenderingHints;
import java.util.HashMap;
import java.util.Map;
import org.netbeans.editor.BaseKit;
import org.netbeans.editor.Settings;
import org.netbeans.editor.SettingsNames;
import org.netbeans.editor.SettingsUtil;
import org.netbeans.editor.TokenContext;
/**
* SchemeSettingsInitializer is responsible for setting some editor properties
* for rendering Scheme text.
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class SchemeSettingsInitializer
extends Settings.AbstractInitializer
{
private static String SCHEME_PREFIX="scheme-settings-initializer"; // NOI18N
public SchemeSettingsInitializer()
{
super( SCHEME_PREFIX );
}
public void updateSettingsMap(Class kitClass, Map settingsMap)
{
if ( kitClass == BaseKit.class )
{
SchemeTokenColoringInitializer colorInitializer =
new SchemeTokenColoringInitializer();
colorInitializer.updateSettingsMap( kitClass, settingsMap );
}
if ( kitClass == SchemeEditorKit.class )
{
// SettingsNames contains *LOTS* of settings!
// Enable line numbers
settingsMap.put( SettingsNames.LINE_NUMBER_VISIBLE, Boolean.TRUE );
// Antialiased text
HashMap hints = new HashMap();
// TODO: Detect if JDK6.0 and, if so, update VALUE_TEXT_ANTIALIAS_ON with other settings
hints.put( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
settingsMap.put( SettingsNames.RENDERING_HINTS, hints );
SettingsUtil.updateListSetting(
settingsMap,
SettingsNames.TOKEN_CONTEXT_LIST,
new TokenContext[]
{ SchemeTokenContext.context }
);
}
}
}
@@ -1,239 +0,0 @@
package processing.editor.netbeans.syntax.scheme;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import org.netbeans.editor.Syntax;
import org.netbeans.editor.TokenID;
/**
* SchemeSyntax is a Syntax responsible for parsing Scheme language source
* code and transforming it into appropriate TokenID tokens.
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class SchemeSyntax
extends Syntax
{
public SchemeSyntax()
{
tokenContextPath = SchemeTokenContext.contextPath;
}
protected TokenID parseToken()
{
TokenID retValue;
retValue = doParseToken();
return retValue;
}
private static final int ISI_WHITESPACE = 2;
private static final int ISI_LINE_COMMENT = 3;
private static final int ISI_STRING = 4;
private static final int ISI_STRING_AFTER_SLASH = 5;
private static final int ISA_TEXT = 6;
private static final int ISA_HASH = 7;
private TokenID doParseToken()
{
while( offset < stopOffset )
{
char curChar = buffer[offset];
switch( state )
{
case ISA_HASH:
if ( isDelimiter( curChar ) )
{
state = INIT;
if ( curChar == '(' )
return SchemeTokenContext.SCHEME_OPEN_PAREN;
return categorizeHash();
}
offset++;
break;
case ISA_TEXT:
if ( isDelimiter( curChar ) )
{
state = INIT;
return categorizeText();
}
offset++;
break;
case ISI_LINE_COMMENT:
offset++;
if ( curChar == '\n' )
{
state = INIT;
return SchemeTokenContext.SCHEME_COMMENT;
}
break;
case ISI_WHITESPACE:
if ( ! isWhitespace( curChar ) )
{
state = INIT;
return SchemeTokenContext.SCHEME_WHITESPACE;
}
offset ++;
break;
case ISI_STRING:
if ( curChar == '\\' )
{
state = ISI_STRING_AFTER_SLASH;
}
else if ( curChar == '"' )
{
state = INIT;
offset++;
return SchemeTokenContext.SCHEME_CONSTANT;
}
offset++;
break;
case ISI_STRING_AFTER_SLASH:
state = ISI_STRING;
offset++;
break;
case INIT:
switch( curChar )
{
case '#':
state = ISA_HASH;
offset ++;
break;
case ';':
state = ISI_LINE_COMMENT;
offset ++;
break;
case '(':
offset ++;
return SchemeTokenContext.SCHEME_OPEN_PAREN;
case ')':
offset ++;
return SchemeTokenContext.SCHEME_CLOSE_PAREN;
case '"':
state = ISI_STRING;
offset ++;
break;
default:
if ( isWhitespace( curChar ) )
{
state = ISI_WHITESPACE;
offset ++;
break;
}
else
{
state = ISA_TEXT;
offset ++;
break;
}
}
}
}
if ( lastBuffer )
{
if ( state == ISI_STRING || state == ISI_STRING_AFTER_SLASH || state == ISA_HASH )
return SchemeTokenContext.SCHEME_CONSTANT;
if ( state == ISA_TEXT )
{
return categorizeText();
}
if ( state == ISI_LINE_COMMENT )
return SchemeTokenContext.SCHEME_COMMENT;
if ( state == ISI_WHITESPACE )
return SchemeTokenContext.SCHEME_WHITESPACE;
Logger.getLogger( getClass().getName() ).log( Level.WARNING,
"SchemeSyntax: Unknown token type for state: '" + state + "'");
}
return null;
}
private boolean isWhitespace( char aChar )
{
switch( aChar )
{
case ' ':
case '\t':
case '\r':
case '\n':
case '\f':
return true;
default:
return false;
}
}
private boolean isDelimiter( char aChar )
{
switch( aChar )
{
case '#':
case ';':
case '(':
case ')':
return true;
default:
return isWhitespace( aChar );
}
}
private TokenID categorizeText()
{
if ( isStandardProcedure() )
return SchemeTokenContext.SCHEME_STDPROC;
else if ( isConstruct() )
return SchemeTokenContext.SCHEME_CONSTRUCT;
else
return SchemeTokenContext.SCHEME_VARIABLE;
}
private static Pattern CONSTRUCT = Pattern.compile("and|begin|case|cond" +
"|define|define-syntax|delay|do|else|if|lambda|let|let\\*|letrec" +
"|letrec-syntax|let-syntax|or|quasiquote|set!|syntax-rules" );
public boolean isConstruct()
{
SegmentCharSequence chars = new SegmentCharSequence( buffer, tokenOffset, offset - tokenOffset );
return CONSTRUCT.matcher( chars ).matches();
}
private static Pattern STDPROC = Pattern.compile(
"-|/|\\*|\\+|acos|angle|apply|asin|atan|" +
"call-with-current-continuation|call-with-values|car|cdr|ceiling" +
"|char<=\\?|char<\\?|char=\\?|char>=\\?|char>\\?|char\\?|char->integer" +
"|char-ready\\?|close-input-port|close-output-port|complex\\?|cons" +
"|cos|current-input-port|current-output-port|denominator" +
"|dynamic-wind|eof-object\\?|eq\\?|eqv\\?|eval|exact\\?" +
"|exact->inexact|exp|expt|floor|imag-part|inexact\\?" +
"|inexact->exact|input-port\\?|integer\\?|integer->char" +
"|interaction-environment|load|log|magnitude|make-polar|make-rectangular" +
"|make-string|make-vector|modulo|null-environment|number\\?" +
"|number->string|numerator|open-input-file|open-output-file" +
"|output-port\\?|pair\\?|peek-char|procedure\\?|quotient|rational\\?" +
"|read-char|real\\?|real-part|remainder|round|scheme-report-environment" +
"|set-car!|set-cdr!|sin|sqrt|string\\?|string-length|string->number" +
"|string-ref|string-set!|string->symbol|symbol\\?|symbol->string|tan" +
"|transcript-off|transcript-on|truncate|values|vector\\?|vector-length" +
"|vector-ref|vector-set!|with-input-from-file|with-output-to-file" +
"|write-char|<=|>=" );
private static Pattern STDPROC_SHORTER = Pattern.compile(
"(<|>|=)", Pattern.DOTALL );
private boolean isStandardProcedure()
{
SegmentCharSequence chars = new SegmentCharSequence( buffer, tokenOffset, offset - tokenOffset );
return STDPROC.matcher( chars ).matches() || STDPROC_SHORTER.matcher( chars ).matches();
}
private static Pattern HASH = Pattern.compile(
"#t|#f|#space|#newline|#x[0-9|a-f|A-F]+|#\\[a-z|A-Z]" );
private TokenID categorizeHash()
{
SegmentCharSequence chars = new SegmentCharSequence( buffer, tokenOffset, offset - tokenOffset );
return HASH.matcher( chars ).matches() ? SchemeTokenContext.SCHEME_CONSTANT : SchemeTokenContext.SCHEME_ERROR;
}
}
@@ -1,80 +0,0 @@
package processing.editor.netbeans.syntax.scheme;
import java.awt.Color;
import java.awt.Font;
import org.netbeans.editor.Coloring;
import org.netbeans.editor.SettingsDefaults;
import org.netbeans.editor.SettingsUtil;
import org.netbeans.editor.TokenCategory;
import org.netbeans.editor.TokenContextPath;
/**
* SchemeTokenColoringInitializer is responsible for assigning Colorings
* to TokenIDs (assigning colors to tokens).
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class SchemeTokenColoringInitializer
extends SettingsUtil.TokenColoringInitializer
{
/**
* Creates a new instance of SchemeTokenColoringInitializer
*/
public SchemeTokenColoringInitializer()
{
super( SchemeTokenContext.context );
}
public static final Font BOLD_FONT = SettingsDefaults.defaultFont.deriveFont( Font.BOLD );
public static final Coloring COLOR_CONSTRUCT =
new Coloring( BOLD_FONT, Color.BLACK, null );
public static final Coloring COLOR_STD_PROC =
new Coloring( BOLD_FONT, Color.BLUE.darker(), null );
public static final Coloring COLOR_PARENTHESIS =
new Coloring( BOLD_FONT, Color.GREEN.darker(), null );
public static final Coloring COLOR_DEFAULT =
new Coloring( null, Color.BLACK, null );
public static final Coloring COLOR_COMMENT =
new Coloring( null, Color.GREEN.darker(), null );
public static final Coloring COLOR_ERROR =
new Coloring( BOLD_FONT, Color.RED, null );
public static final Coloring COLOR_CONSTANT =
new Coloring( null, Color.RED.darker(), null );
public Object getTokenColoring(TokenContextPath tokenContextPath, TokenCategory tokenIDOrCategory, boolean printingSet)
{
if ( printingSet )
{
return SettingsUtil.defaultPrintColoringEvaluator;
}
else
{
int tokenid = tokenIDOrCategory.getNumericID();
switch( tokenid )
{
case SchemeTokenContext.ID_SCHEME_OPEN_PAREN:
case SchemeTokenContext.ID_SCHEME_CLOSE_PAREN:
return COLOR_PARENTHESIS;
case SchemeTokenContext.ID_SCHEME_CONSTRUCT:
return COLOR_CONSTRUCT;
case SchemeTokenContext.ID_SCHEME_STDPROC:
return COLOR_STD_PROC;
case SchemeTokenContext.ID_SCHEME_CONSTANT:
return COLOR_CONSTANT;
case SchemeTokenContext.ID_SCHEME_COMMENT:
return COLOR_COMMENT;
case SchemeTokenContext.ID_SCHEME_ERROR:
return COLOR_ERROR;
default:
return COLOR_DEFAULT;
}
}
}
}
@@ -1,55 +0,0 @@
package processing.editor.netbeans.syntax.scheme;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.netbeans.editor.BaseTokenID;
import org.netbeans.editor.TokenContext;
import org.netbeans.editor.TokenContextPath;
/**
* SchemeTokenContext is responsible for defining the tokens needed to
* represent the Scheme language.
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class SchemeTokenContext
extends TokenContext
{
private SchemeTokenContext()
{
super("scheme-");
try
{
addDeclaredTokenIDs();
}
catch (Exception e)
{
Logger.getLogger("SchemeTokenContext").log( Level.SEVERE, "Unexpected exception", e );
}
}
public static final int ID_SCHEME_OPEN_PAREN = 1;
public static final int ID_SCHEME_CLOSE_PAREN = 2;
public static final int ID_SCHEME_WHITESPACE = 3;
public static final int ID_SCHEME_CONSTRUCT = 4;
public static final int ID_SCHEME_STDPROC = 5;
public static final int ID_SCHEME_CONSTANT = 6;
public static final int ID_SCHEME_COMMENT = 7;
public static final int ID_SCHEME_VARIABLE = 8;
public static final int ID_SCHEME_ERROR = 9;
public static final BaseTokenID SCHEME_OPEN_PAREN = new BaseTokenID("openparen", ID_SCHEME_OPEN_PAREN );
public static final BaseTokenID SCHEME_CLOSE_PAREN = new BaseTokenID("closeparen", ID_SCHEME_CLOSE_PAREN );
public static final BaseTokenID SCHEME_WHITESPACE = new BaseTokenID("whitespace", ID_SCHEME_WHITESPACE );
public static final BaseTokenID SCHEME_CONSTRUCT = new BaseTokenID("construct", ID_SCHEME_CONSTRUCT );
public static final BaseTokenID SCHEME_STDPROC = new BaseTokenID("stdproc", ID_SCHEME_STDPROC );
public static final BaseTokenID SCHEME_CONSTANT = new BaseTokenID("constant", ID_SCHEME_CONSTANT );
public static final BaseTokenID SCHEME_COMMENT = new BaseTokenID("comment", ID_SCHEME_COMMENT );
public static final BaseTokenID SCHEME_VARIABLE = new BaseTokenID("variable", ID_SCHEME_VARIABLE );
public static final BaseTokenID SCHEME_ERROR = new BaseTokenID("error", ID_SCHEME_ERROR );
public static final SchemeTokenContext context = new SchemeTokenContext();
public static final TokenContextPath contextPath = context.getContextPath();
}
@@ -1,43 +0,0 @@
package processing.editor.netbeans.syntax.scheme;
import javax.swing.text.Segment;
/**
* SegmentCharSequence is a Segment and a CharSequence.
* This object is used to avoid creating Strings from char arrays, so that
* char arrays can be used in Pattern and Matcher.
* @author $Author: antonio $ Antonio Vieiro (antonio@antonioshome.net)
* @version $Revision: 1.2 $
*/
public class SegmentCharSequence
extends Segment
implements CharSequence
{
/**
* Creates a new instance of SegmentCharSequence
*/
public SegmentCharSequence( char[] buffer, int startOffset, int length )
{
super( buffer, startOffset, length );
}
public char charAt(int index)
{
if ( index < 0 || index > count )
throw new StringIndexOutOfBoundsException( index );
return array[ offset + index ];
}
public CharSequence subSequence(int start, int end)
{
if ( start < 0 || end > count || start > end )
throw new StringIndexOutOfBoundsException( " start " + start + " end " + end );
return new SegmentCharSequence( array, offset + start, end-start );
}
public int length()
{
return count;
}
}