public abstract class Editor extends JFrame implements RunnerListener
Modifier and Type | Field and Description |
---|---|
static int |
GUTTER_MARGIN |
static int |
LEFT_GUTTER |
static int |
RIGHT_GUTTER |
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
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Modifier and Type | Method and Description |
---|---|
void |
addErrorTable(EditorFooter ef) |
abstract JMenu |
buildFileMenu() |
abstract JMenu |
buildHelpMenu() |
JMenu |
buildModeMenu()
Override this if you want a special menu for your particular 'mode'.
|
abstract JMenu |
buildSketchMenu() |
boolean |
checkModified()
Check if the sketch is modified and ask user to save changes.
|
static boolean |
checkParen(char[] array,
int index,
int stop) |
void |
clearNotice(String msg) |
void |
clearToolMenu()
Clears the Tool menu and runs the gc so that contributions can be updated
without classes still being in use.
|
void |
codeFolderChanged() |
EditorFooter |
createFooter() |
abstract Formatter |
createFormatter() |
EditorHeader |
createHeader() |
abstract EditorToolbar |
createToolbar() |
abstract void |
deactivateRun() |
void |
errorTableClick(Object item)
Called by ErrorTable when a row is selected.
|
void |
errorTableDoubleClick(Object item) |
List<Problem> |
findProblems(int line) |
Base |
getBase() |
int |
getCaretOffset()
Get the position (character offset) of the caret.
|
abstract String |
getCommentPrefix() |
EditorConsole |
getConsole() |
EditorState |
getEditorState() |
ErrorTable |
getErrorTable() |
int |
getLineCount()
Get the number of lines in the currently displayed buffer.
|
int |
getLineStartOffset(int line)
Get character offset for the start of a given line of text.
|
int |
getLineStopOffset(int line)
Get character offset for end of a given line of text.
|
String |
getLineText(int line)
Get text for a specified line.
|
Mode |
getMode() |
JPopupMenu |
getModePopup() |
PdeTextArea |
getPdeTextArea() |
List<Problem> |
getProblems() |
int |
getScrollPosition() |
String |
getSelectedText() |
int |
getSelectionStart()
Get the beginning point of the current selection.
|
int |
getSelectionStop()
Get the end point of the current selection.
|
Sketch |
getSketch()
Gets the current sketch object.
|
Point |
getSketchLocation()
Get the last location of the sketch's run window.
|
String |
getStatusMessage()
Returns the current notice message in the editor status bar.
|
int |
getStatusMode()
Returns the current notice message in the editor status bar.
|
String |
getText()
Get the contents of the current buffer.
|
String |
getText(int start,
int stop)
Get a range of text from the current buffer.
|
JEditTextArea |
getTextArea()
Get the JEditTextArea object for use (not recommended).
|
JMenu |
getToolMenu() |
void |
handleAutoFormat() |
void |
handleCopy()
Implements Edit → Copy.
|
void |
handleCopyAsHTML()
Implements Edit → Copy as HTML.
|
void |
handleCut()
Implements Edit → Cut.
|
abstract void |
handleImportLibrary(String name) |
void |
handleIndent() |
void |
handleIndentOutdent(boolean indent) |
void |
handleOutdent() |
void |
handlePageSetup()
Handler for File → Page Setup.
|
void |
handlePaste()
Implements Edit → Paste.
|
void |
handlePrint()
Handler for File → Print.
|
boolean |
handleSave(boolean immediately)
Actually handle the save command.
|
boolean |
handleSaveAs() |
void |
handleSelectAll()
Implements Edit → Select All.
|
void |
highlight(int tabIndex,
int startOffset,
int stopOffset) |
void |
highlight(Problem p) |
void |
insertText(String what) |
abstract void |
internalCloseRunner()
Halt the current runner for whatever reason.
|
boolean |
isDebuggerEnabled() |
boolean |
isHalted() |
boolean |
isSelectionActive()
True if some text is currently selected.
|
void |
librariesChanged() |
void |
prepareRun()
Grab current contents of the sketch window, advance the console,
stop any other running sketches...
|
void |
rebuildHeader() |
void |
rebuildModePopup() |
void |
rebuildToolbar() |
void |
removeNotify() |
void |
repaintErrorBar() |
void |
repaintHeader() |
void |
setCode(SketchCode code)
Switch between tabs, this swaps out the Document object
that's currently being manipulated.
|
void |
setLineText(int line,
String what)
Replace the text on a specified line.
|
void |
setProblemList(List<Problem> problems) |
void |
setSelectedText(String what) |
void |
setSelectedText(String what,
boolean ever) |
void |
setSelection(int start,
int stop) |
void |
setSketchLocation(Point p)
Set the location of the sketch run window.
|
void |
setText(String what)
Replace the entire contents of the front-most tab.
|
void |
setUpdatesAvailable(int count)
Updates update count in the UI.
|
static void |
showChanges() |
void |
showConsole() |
void |
showReference(String filename) |
void |
showReferenceFile(File file)
Given the .html file, displays it in the default browser.
|
void |
sketchChanged() |
void |
startCompoundEdit()
Use before a manipulating text to group editing operations together
as a single undo.
|
void |
startIndeterminate() |
void |
statusEmpty()
Clear the status area.
|
void |
statusError(Exception e)
Show an exception in the editor status bar.
|
void |
statusError(String what)
Show an error in the status bar.
|
void |
statusHalt() |
void |
statusMessage(String message,
int type) |
void |
statusNotice(String msg)
Show a notice message in the editor status bar.
|
void |
statusToolTip(JComponent comp,
String message,
boolean error) |
void |
stopCompoundEdit()
Use with startCompoundEdit() to group edit operations in a single undo.
|
void |
stopIndeterminate() |
void |
toggleBreakpoint(int lineIndex) |
void |
updateEditorStatus()
Updates editor status bar, depending on whether the caret is on an error
line or not
|
void |
updateErrorTable(List<Problem> problems)
Updates the error table in the Error Window.
|
void |
updateErrorToggle(boolean hasErrors)
Handle whether the tiny red error indicator is shown near
the error button at the bottom of the PDE
|
void |
updateTitle()
Set the title of the PDE window based on the current sketch, i.e.
|
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
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, 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
add, add, add, add, add, addContainerListener, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int LEFT_GUTTER
public static final int RIGHT_GUTTER
public static final int GUTTER_MARGIN
public EditorFooter createFooter()
public void addErrorTable(EditorFooter ef)
public EditorState getEditorState()
public Base getBase()
public Mode getMode()
public void repaintHeader()
public void rebuildHeader()
public void rebuildModePopup()
public JPopupMenu getModePopup()
public EditorConsole getConsole()
public EditorHeader createHeader()
public abstract EditorToolbar createToolbar()
public void rebuildToolbar()
public abstract Formatter createFormatter()
public abstract JMenu buildFileMenu()
public abstract JMenu buildSketchMenu()
public abstract void handleImportLibrary(String name)
public void librariesChanged()
public void codeFolderChanged()
public void sketchChanged()
public JMenu getToolMenu()
public void clearToolMenu()
public void setUpdatesAvailable(int count)
count
- number of available updatespublic JMenu buildModeMenu()
public abstract JMenu buildHelpMenu()
public void showReference(String filename)
public void showReferenceFile(File file)
file
- public static void showChanges()
public Sketch getSketch()
public JEditTextArea getTextArea()
public PdeTextArea getPdeTextArea()
public String getText()
public String getText(int start, int stop)
public void setText(String what)
public void insertText(String what)
public String getSelectedText()
public void setSelectedText(String what)
public void setSelectedText(String what, boolean ever)
public void setSelection(int start, int stop)
public int getCaretOffset()
public boolean isSelectionActive()
public int getSelectionStart()
public int getSelectionStop()
public String getLineText(int line)
public void setLineText(int line, String what)
public int getLineStartOffset(int line)
public int getLineStopOffset(int line)
public int getLineCount()
public void startCompoundEdit()
public void stopCompoundEdit()
public int getScrollPosition()
public void setCode(SketchCode code)
public void removeNotify()
removeNotify
in class Frame
public void handleCut()
public void handleCopy()
public void handleCopyAsHTML()
public void handlePaste()
public void handleSelectAll()
public void handleAutoFormat()
public abstract String getCommentPrefix()
public void handleIndent()
public void handleOutdent()
public void handleIndentOutdent(boolean indent)
public static boolean checkParen(char[] array, int index, int stop)
public void setSketchLocation(Point p)
public Point getSketchLocation()
public boolean isDebuggerEnabled()
public void toggleBreakpoint(int lineIndex)
public boolean checkModified()
public void updateTitle()
public boolean handleSave(boolean immediately)
public boolean handleSaveAs()
public void handlePageSetup()
public void handlePrint()
public void prepareRun()
public abstract void internalCloseRunner()
public abstract void deactivateRun()
public ErrorTable getErrorTable()
public void errorTableClick(Object item)
public void errorTableDoubleClick(Object item)
public void updateErrorToggle(boolean hasErrors)
public void statusError(String what)
statusError
in interface RunnerListener
public void statusError(Exception e)
statusError
in interface RunnerListener
public void statusNotice(String msg)
statusNotice
in interface RunnerListener
public void clearNotice(String msg)
public String getStatusMessage()
public int getStatusMode()
public void statusEmpty()
public void statusMessage(String message, int type)
public void startIndeterminate()
startIndeterminate
in interface RunnerListener
public void stopIndeterminate()
stopIndeterminate
in interface RunnerListener
public void statusHalt()
statusHalt
in interface RunnerListener
public boolean isHalted()
isHalted
in interface RunnerListener
public void setProblemList(List<Problem> problems)
public void updateErrorTable(List<Problem> problems)
public void highlight(Problem p)
public void highlight(int tabIndex, int startOffset, int stopOffset)
public List<Problem> getProblems()
public void updateEditorStatus()
public List<Problem> findProblems(int line)
public void repaintErrorBar()
public void showConsole()
public void statusToolTip(JComponent comp, String message, boolean error)