- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Frame
-
- ij.plugin.frame.PlugInFrame
-
- ij.plugin.frame.Editor
-
- All Implemented Interfaces:
Debugger
,MacroConstants
,PlugIn
,java.awt.datatransfer.ClipboardOwner
,java.awt.event.ActionListener
,java.awt.event.FocusListener
,java.awt.event.ItemListener
,java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.TextListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.lang.Runnable
,java.util.EventListener
,javax.accessibility.Accessible
public class Editor extends PlugInFrame implements java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.TextListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.datatransfer.ClipboardOwner, MacroConstants, java.lang.Runnable, Debugger
This is a simple TextArea based editor for editing and compiling plugins.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
changes
static Editor
currentMacroEditor
static int
INSTALL_BUTTON
static java.lang.String
INTERACTIVE_NAME
static java.lang.String
JavaScriptIncludes
ImportPackage statements added in front of scripts.static int
MACROS_MENU_ITEMS
static int
MAX_SIZE
static int
MENU_BAR
static int
MONOSPACED
static int
RUN_BAR
static int
XINC
static int
YINC
-
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface ij.macro.Debugger
FAST_TRACE, NOT_DEBUGGING, RUN_TO_CARET, RUN_TO_COMPLETION, STEP, TRACE
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface ij.macro.MacroConstants
ABS, ACOS, ARRAY, ARRAY_FUNC, ARRAY_FUNCTION, arrayFunctionIDs, arrayFunctions, ASIN, ATAN, ATAN2, AUTO_UPDATE, BEEP, BIT_DEPTH, BREAK, CALCULATOR, CALIBRATE, CALL, CHANGE_VALUES, CHAR_CODE_AT, CLOSE, COLOR, CONTINUE, COS, D2S, DEBUG, DIALOG, DIV_EQUAL, DO, DO_COMMAND, DO_WAND, DRAW_LINE, DRAW_OVAL, DRAW_RECT, DRAW_STRING, DUMP, ELSE, ENDS_WITH, EOF, EQ, EVAL, EXEC, EXIT, EXP, EXT, FALSE, FILE, FILL, FILL_OVAL, FILL_RECT, FIT, FLOOD_FILL, FLOOR, FOR, FROM_CHAR_CODE, FUNCTION, functionIDs, functions, GET_ARGUMENT, GET_BOOLEAN, GET_BOUNDING_RECT, GET_BOUNDS, GET_COORDINATES, GET_COUNT, GET_CURSOR_LOC, GET_DATE_AND_TIME, GET_DIMENSIONS, GET_DIR, GET_DIRECTORY, GET_DISPLAYED_AREA, GET_FILE_LIST, GET_FONT_LIST, GET_HEIGHT, GET_HISTOGRAM, GET_ID, GET_IMAGE_INFO, GET_INFO, GET_LINE, GET_LIST, GET_LOCATION_AND_SIZE, GET_LUT, GET_METADATA, GET_MIN_AND_MAX, GET_NUMBER, GET_PIXEL, GET_PIXEL_SIZE, GET_PROFILE, GET_RAW_STATISTICS, GET_RESULT, GET_RESULT_LABEL, GET_RESULT_STRING, GET_SLICE_NUMBER, GET_STATISTICS, GET_STRING, GET_STRING_WIDTH, GET_THRESHOLD, GET_TIME, GET_TITLE, GET_VALUE, GET_VERSION, GET_VOXEL_SIZE, GET_WIDTH, GET_ZOOM, GT, GTE, IF, IJ_CALL, IMAGE, INDEX_OF, INVERT, IS, IS_ACTIVE, IS_KEY_DOWN, IS_NAN, IS_OPEN, keywordIDs, keywords, LAST_INDEX_OF, LENGTH_OF, LINE_TO, LIST, LOG, LOGICAL_AND, LOGICAL_OR, LT, LTE, MAKE_ARROW, MAKE_ELLIPSE, MAKE_LINE, MAKE_OVAL, MAKE_POINT, MAKE_POLYGON, MAKE_RECTANGLE, MAKE_ROTATED_RECT, MAKE_SELECTION, MAKE_TEXT, MATCHES, MATH, MAX_OF, MIN_OF, MINUS_EQUAL, MINUS_MINUS, MOVE_TO, MUL_EQUAL, NaN, NEQ, NEW_ARRAY, NEW_IMAGE, NEW_MENU, NIMAGES, NOP, NRESULTS, NSLICES, NUMBER, NUMERIC_FUNCTION, numericFunctionIDs, numericFunctions, OPEN, OVERLAY, PARSE_FLOAT, PARSE_INT, PI, PLOT, PLUS_EQUAL, PLUS_PLUS, POW, PREDEFINED_FUNCTION, PRINT, PROPERTY, PUT_PIXEL, RANDOM, RENAME, REPLACE, REQUIRES, RESET, RESET_MIN_MAX, RESET_THRESHOLD, RESTORE_PREVIOUS_TOOL, RESTORE_SETTINGS, RETURN, ROI, ROI_MANAGER, ROI_MANAGER2, ROUND, RUN, RUN_MACRO, SAVE, SAVE_AS, SAVE_SETTINGS, SCREEN_HEIGHT, SCREEN_WIDTH, SELECT, SELECT_IMAGE, SELECTION_CONTAINS, SELECTION_NAME, SELECTION_TYPE, SET_AUTO_THRESHOLD, SET_BACKGROUND, SET_BATCH_MODE, SET_COLOR, SET_FONT, SET_FOREGROUND, SET_JUSTIFICATION, SET_KEY_DOWN, SET_LINE_WIDTH, SET_LOCATION, SET_LUT, SET_METADATA, SET_MIN_MAX, SET_OPTION, SET_PASTE_MODE, SET_PIXEL, SET_RESULT, SET_RGB_WEIGHTS, SET_SELECTION_LOC, SET_SELECTION_NAME, SET_SLICE, SET_THRESHOLD, SET_TOOL, SET_VOXEL_SIZE, SET_Z_COORDINATE, SETUP_UNDO, SHIFT_LEFT, SHIFT_RIGHT, SHOW_MESSAGE, SHOW_MESSAGE_WITH_CANCEL, SHOW_PROGRESS, SHOW_STATUS, SHOW_TEXT, SIN, SNAPSHOT, SPLIT, SQRT, STACK, STARTS_WITH, STRING, STRING_CONSTANT, STRING_FUNCTION, stringFunctionIDs, stringFunctions, SUBSTRING, TABLE, TAN, TO_BINARY, TO_HEX, TO_LOWER_CASE, TO_SCALED, TO_STRING, TO_UNSCALED, TO_UPPER_CASE, TOK_MASK, TOK_SHIFT, TOOL_ID, TRIM, TRUE, UPDATE_DISPLAY, UPDATE_RESULTS, USER_FUNCTION, VAR, VARIABLE_FUNCTION, variableFunctionIDs, variableFunctions, WAIT, WAIT_FOR_USER, WHILE, WORD, WRITE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
void
append(java.lang.String s)
void
close()
Overrides close() in PlugInFrame.void
create(java.lang.String name, java.lang.String text)
void
createMacro(java.lang.String name, java.lang.String text)
int
debug(Interpreter interp, int mode)
void
display(java.lang.String title, java.lang.String text)
void
evaluateScript(java.lang.String ext)
boolean
fileChanged()
void
fixLineEndings()
Changes Windows (CRLF) line separators to line feeds (LF).int
getFontSize()
static Editor
getInstance()
static java.lang.String
getJSPrefix(java.lang.String arg)
java.lang.String
getRejectMacrosMsg()
java.lang.String
getText()
java.awt.TextArea
getTextArea()
void
insertText(java.lang.String text)
void
itemStateChanged(java.awt.event.ItemEvent e)
void
keyPressed(java.awt.event.KeyEvent e)
void
keyReleased(java.awt.event.KeyEvent e)
void
keyTyped(java.awt.event.KeyEvent e)
void
lostOwnership(java.awt.datatransfer.Clipboard clip, java.awt.datatransfer.Transferable cont)
void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
void
mouseReleased(java.awt.event.MouseEvent e)
void
open(java.lang.String dir, java.lang.String name)
Opens a file and replaces the text (if any) by the contents of the file.static boolean
openExample(java.lang.String name)
Opens an example from the Help/Examples menu and runs if "Autorun Exampes" is checked.void
positionWindow()
protected void
revert()
void
run()
Downloads BeanShell or Jython interpreter using a separate thread.void
saveAs()
static void
setDefaultDirectory(java.lang.String dir)
void
setFont(java.awt.Font font)
void
setIsMacroWindow(boolean mw)
void
setRejectMacrosMsg(java.lang.String msg)
void
showLogWindow()
protected void
showMacroFunctions()
void
textValueChanged(java.awt.event.TextEvent e)
void
updateClassName(java.lang.String oldName, java.lang.String newName)
Changes a plugins class name to reflect a new file name.void
windowActivated(java.awt.event.WindowEvent e)
Override windowActivated in PlugInFrame to prevent Mac menu bar from being installed.-
Methods inherited from class ij.plugin.frame.PlugInFrame
focusGained, focusLost, run, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class java.awt.Frame
addNotify, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setBackground, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, show, toBack, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, update, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
JavaScriptIncludes
public static java.lang.String JavaScriptIncludes
ImportPackage statements added in front of scripts. Contains no newlines so that lines numbers in error messages are not changed.
-
MAX_SIZE
public static final int MAX_SIZE
- See Also:
- Constant Field Values
-
XINC
public static final int XINC
- See Also:
- Constant Field Values
-
YINC
public static final int YINC
- See Also:
- Constant Field Values
-
MONOSPACED
public static final int MONOSPACED
- See Also:
- Constant Field Values
-
MENU_BAR
public static final int MENU_BAR
- See Also:
- Constant Field Values
-
RUN_BAR
public static final int RUN_BAR
- See Also:
- Constant Field Values
-
INSTALL_BUTTON
public static final int INSTALL_BUTTON
- See Also:
- Constant Field Values
-
MACROS_MENU_ITEMS
public static final int MACROS_MENU_ITEMS
- See Also:
- Constant Field Values
-
INTERACTIVE_NAME
public static final java.lang.String INTERACTIVE_NAME
- See Also:
- Constant Field Values
-
currentMacroEditor
public static Editor currentMacroEditor
-
changes
protected boolean changes
-
-
Method Detail
-
positionWindow
public void positionWindow()
-
create
public void create(java.lang.String name, java.lang.String text)
-
createMacro
public void createMacro(java.lang.String name, java.lang.String text)
-
setRejectMacrosMsg
public void setRejectMacrosMsg(java.lang.String msg)
-
getRejectMacrosMsg
public java.lang.String getRejectMacrosMsg()
-
open
public void open(java.lang.String dir, java.lang.String name)
Opens a file and replaces the text (if any) by the contents of the file.
-
getText
public java.lang.String getText()
-
getTextArea
public java.awt.TextArea getTextArea()
-
display
public void display(java.lang.String title, java.lang.String text)
-
evaluateScript
public void evaluateScript(java.lang.String ext)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
-
openExample
public static boolean openExample(java.lang.String name)
Opens an example from the Help/Examples menu and runs if "Autorun Exampes" is checked.
-
showMacroFunctions
protected void showMacroFunctions()
-
textValueChanged
public void textValueChanged(java.awt.event.TextEvent e)
- Specified by:
textValueChanged
in interfacejava.awt.event.TextListener
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent e)
- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent e)
- Specified by:
keyReleased
in interfacejava.awt.event.KeyListener
-
insertText
public void insertText(java.lang.String text)
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent e)
- Specified by:
keyTyped
in interfacejava.awt.event.KeyListener
-
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent e)
- Specified by:
itemStateChanged
in interfacejava.awt.event.ItemListener
-
windowActivated
public void windowActivated(java.awt.event.WindowEvent e)
Override windowActivated in PlugInFrame to prevent Mac menu bar from being installed.- Specified by:
windowActivated
in interfacejava.awt.event.WindowListener
- Overrides:
windowActivated
in classPlugInFrame
-
close
public void close()
Overrides close() in PlugInFrame.- Overrides:
close
in classPlugInFrame
-
saveAs
public void saveAs()
-
revert
protected void revert()
-
updateClassName
public void updateClassName(java.lang.String oldName, java.lang.String newName)
Changes a plugins class name to reflect a new file name.
-
setFont
public void setFont(java.awt.Font font)
- Overrides:
setFont
in classjava.awt.Container
-
getFontSize
public int getFontSize()
-
append
public void append(java.lang.String s)
-
setIsMacroWindow
public void setIsMacroWindow(boolean mw)
-
setDefaultDirectory
public static void setDefaultDirectory(java.lang.String dir)
-
lostOwnership
public void lostOwnership(java.awt.datatransfer.Clipboard clip, java.awt.datatransfer.Transferable cont)
- Specified by:
lostOwnership
in interfacejava.awt.datatransfer.ClipboardOwner
-
debug
public int debug(Interpreter interp, int mode)
-
getInstance
public static Editor getInstance()
-
getJSPrefix
public static java.lang.String getJSPrefix(java.lang.String arg)
-
fixLineEndings
public void fixLineEndings()
Changes Windows (CRLF) line separators to line feeds (LF).
-
showLogWindow
public void showLogWindow()
-
fileChanged
public boolean fileChanged()
-
run
public void run()
Downloads BeanShell or Jython interpreter using a separate thread.- Specified by:
run
in interfacejava.lang.Runnable
-
-