kernel
Class PluginText

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by kernel.Plugin
                      extended by kernel.PluginText
All Implemented Interfaces:
MouseListener, ImageObserver, MenuContainer, Serializable, Comparable<Plugin>, EventListener, Accessible

public abstract class PluginText
extends Plugin

All text plugins have to extend this abstract class and to redefine the execute method from Plugin.

Author:
Michel Deriaz
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
 int getFlags()
          Returns an integer in which each bit codes a flag.
 String getFlagsAsLiteral()
          Returns the literal form of the flags like (?
 String getFlagsAsString()
          Returns a String containing the names of all the ticked flags.
 String getReplace()
          Returns the content of the Replace by field.
 String getSearch()
          Returns the content of the Search field.
 String getSelectedText()
          Returns the selected text.
 int getSelectionEnd()
          Returns the selected text's end position.
 int getSelectionStart()
          Returns the selected text's start position.
 String getText()
          Returns the current text to process.
 boolean isCANON_EQ()
          Indicates whether the CANON_EQ flag is ticked off.
 boolean isCASE_INSENSITIVE()
          Indicates whether the CASE_INSENSITIVE flag is ticked off.
 boolean isCOMMENTS()
          Indicates whether the COMMENTS flag is ticked off.
 boolean isDOTALL()
          Indicates whether the DOTALL flag is ticked off.
 boolean isMULTILINE()
          Indicates whether the MULTILINE flag is ticked off.
 boolean isUNICODE_CASE()
          Indicates whether the UNICODE_CASE flag is ticked off.
 boolean isUNIX_LINES()
          Indicates whether the UNIX_LINES flag is ticked off.
 void replace(int start, int end, String replacement)
          Replaces the text that is between the start and the end positions by the specified one.
 void replaceAll(String search, String replace)
          Replaces, in the current text, all the strings that matches the search regex by the replacement string.
 void replaceAllSel(String search, String replace)
          Replaces, in the current selected text, all the strings that matches the search regex by the replacement string.
 void setCANON_EQ(boolean b)
          Ticks or unticks the CANON_EQ flag.
 void setCASE_INSENSITIVE(boolean b)
          Ticks or unticks the CASE_INSENSITIVE flag.
 void setCOMMENTS(boolean b)
          Ticks or unticks the COMMENTS flag.
 void setDOTALL(boolean b)
          Ticks or unticks the DOTALL flag.
 void setMULTILINE(boolean b)
          Ticks or unticks the MULTILINE flag.
 void setReplace(String text)
          Sets the content of the Replace by field.
 void setSearch(String text)
          Sets the content of the Search field.
 void setText(String text)
          Sets the text to process.
 void setUNICODE_CASE(boolean b)
          Ticks or unticks the UNICODE_CASE flag.
 void setUNIX_LINES(boolean b)
          Ticks or unticks the UNIX_LINES flag.
 
Methods inherited from class kernel.Plugin
compareTo, execute, getAppLanguage, getDescription, getOwner, getPluginsDir, getSummary, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, readFile, setDescription, setSummary
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getSearch

public String getSearch()
Returns the content of the Search field.

Returns:
the content of the Search field

getReplace

public String getReplace()
Returns the content of the Replace by field.

Returns:
the content of the Replace by field

getText

public String getText()
Returns the current text to process.

Returns:
the current text

getSelectedText

public String getSelectedText()
Returns the selected text.

Returns:
the selected text

getSelectionStart

public int getSelectionStart()
Returns the selected text's start position.

Returns:
the start position

getSelectionEnd

public int getSelectionEnd()
Returns the selected text's end position.

Returns:
the end position

getFlags

public int getFlags()
Returns an integer in which each bit codes a flag. To know what flags are ticked off, use the AND function. For example, ((getFlags() & Pattern.CANON_EQ) > 0) returns true if the CANON_EQ flag is ticked off.

Returns:
an integer in which each bit codes a flag

getFlagsAsLiteral

public String getFlagsAsLiteral()
Returns the literal form of the flags like (?ixsmud), or "" if no flags is ticked off. Note that there is not literal form for the CANON_EQ flag.

Returns:
the literal form of the flags

getFlagsAsString

public String getFlagsAsString()
Returns a String containing the names of all the ticked flags. For example, (getFlagsAsString().indexOf("CANON_EQ") > -1) returns true if the CANON_EQ flag is ticked off.

Returns:
a String containing the names of all the ticked flags

isCANON_EQ

public boolean isCANON_EQ()
Indicates whether the CANON_EQ flag is ticked off.

Returns:
true if CANON_EQ is ticked off; false otherwise

isCASE_INSENSITIVE

public boolean isCASE_INSENSITIVE()
Indicates whether the CASE_INSENSITIVE flag is ticked off.

Returns:
true if CASE_INSENSITIVE is ticked off; false otherwise

isCOMMENTS

public boolean isCOMMENTS()
Indicates whether the COMMENTS flag is ticked off.

Returns:
true if COMMENTS is ticked off; false otherwise

isDOTALL

public boolean isDOTALL()
Indicates whether the DOTALL flag is ticked off.

Returns:
true if DOTALL is ticked off; false otherwise

isMULTILINE

public boolean isMULTILINE()
Indicates whether the MULTILINE flag is ticked off.

Returns:
true if MULTILINE is ticked off; false otherwise

isUNICODE_CASE

public boolean isUNICODE_CASE()
Indicates whether the UNICODE_CASE flag is ticked off.

Returns:
true if UNICODE_CASE is ticked off; false otherwise

isUNIX_LINES

public boolean isUNIX_LINES()
Indicates whether the UNIX_LINES flag is ticked off.

Returns:
true if UNIX_LINES is ticked off; false otherwise

setSearch

public void setSearch(String text)
Sets the content of the Search field.

Parameters:
text - the content of the Search field

setReplace

public void setReplace(String text)
Sets the content of the Replace by field.

Parameters:
text - the content of the Replace by field

setText

public void setText(String text)
Sets the text to process.

Parameters:
text - the text

setCANON_EQ

public void setCANON_EQ(boolean b)
Ticks or unticks the CANON_EQ flag.

Parameters:
b - true to tick the flag; false to untick the flag

setCASE_INSENSITIVE

public void setCASE_INSENSITIVE(boolean b)
Ticks or unticks the CASE_INSENSITIVE flag.

Parameters:
b - true to tick the flag; false to untick the flag

setCOMMENTS

public void setCOMMENTS(boolean b)
Ticks or unticks the COMMENTS flag.

Parameters:
b - true to tick the flag; false to untick the flag

setDOTALL

public void setDOTALL(boolean b)
Ticks or unticks the DOTALL flag.

Parameters:
b - true to tick the flag; false to untick the flag

setMULTILINE

public void setMULTILINE(boolean b)
Ticks or unticks the MULTILINE flag.

Parameters:
b - true to tick the flag; false to untick the flag

setUNICODE_CASE

public void setUNICODE_CASE(boolean b)
Ticks or unticks the UNICODE_CASE flag.

Parameters:
b - true to tick the flag; false to untick the flag

setUNIX_LINES

public void setUNIX_LINES(boolean b)
Ticks or unticks the UNIX_LINES flag.

Parameters:
b - true to tick the flag; false to untick the flag

replace

public void replace(int start,
                    int end,
                    String replacement)
Replaces the text that is between the start and the end positions by the specified one.

Parameters:
start - the start position of the text that will be replaced
end - the end position of the text that will be replaced
replacement - the replacement text

replaceAll

public void replaceAll(String search,
                       String replace)
Replaces, in the current text, all the strings that matches the search regex by the replacement string. Note that the regular expressions must be coded in java, for instance the newline character \n will be written \\n.

Parameters:
search - the pattern to find
replace - the replacement string

replaceAllSel

public void replaceAllSel(String search,
                          String replace)
Replaces, in the current selected text, all the strings that matches the search regex by the replacement string. Note that the regular expressions must be coded in java, for instance the newline character \n will be written \\n.
Warning: This method clears the current selection; therefore it cannot be called successively twice.

Parameters:
search - the pattern to find
replace - the replacement string