public final class ProjectViewer
extends javax.swing.JPanel
implements org.gjt.sp.jedit.gui.DefaultFocusComponent, java.awt.event.HierarchyListener
Up to 3.4.2 two states of ProjectViewer for a given view were possible:
ViewerEntry.pv
member
null
. This state is good when no pv functionality
is used, but it was also used for some actions, which
actually didn't work well, because most of
pv activity requires ProjectViewer
instance.
In this state getViewer
returns null
.ViewerEntry.pv
is not null
, but isDocked
is false
.
After the dockable is created, isDocked
becomes true
which makes it the first
state mentioned above.
In this state getViewer
returns
an object, not null
.
getViewer(View, int)
should be called specifying
FORCE
flag. It triggers active without dockable state.Modifier and Type | Class and Description |
---|---|
class |
ProjectViewer.Helper
Class to hold methods that require classes that may not be available,
so that PV behaves well when called from a BeanShell script.
|
javax.swing.JPanel.AccessibleJPanel
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
static int |
FORCE
For methods returning results: if no result is available,
try to force the result by additional actions.
|
static int |
LATER
Accept doing the call later, in idle state.
|
static int |
METHOD_FORCE
Deprecated.
Remove
METHOD_ prefix. |
static int |
METHOD_LATER
Deprecated.
Remove
METHOD_ prefix. |
static int |
METHOD_NO_FLAGS
Deprecated.
Remove
METHOD_ prefix . |
static int |
METHOD_ONCE
Deprecated.
Remove
METHOD_ prefix. |
static int |
METHOD_WARN
Deprecated.
Remove
METHOD_ prefix. |
static int |
NO_FLAGS
Plain invocation, without additional flags.
|
static int |
ONCE
Perform only once per session.
|
static int |
WARN
For methods returning results: if no result is available,
show a warning message to the user.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
ProjectViewer(org.gjt.sp.jedit.View aView,
boolean bDocked)
Create a new
ProjectViewer . |
Modifier and Type | Method and Description |
---|---|
protected static void |
cleanViewEntry(org.gjt.sp.jedit.View aView)
Removes the "viewer entry" related to the given view.
|
static java.lang.String |
compressPath(java.lang.String origPath) |
static ProjectViewer |
createDockable(org.gjt.sp.jedit.View view)
Creates a new instance of
ProjectViewer to wrap it in the
dockable. |
void |
focusOnDefaultComponent() |
static VPTNode |
getActiveNode(org.gjt.sp.jedit.View aView)
Return the current "active" node (opened project/group)
for the view.
|
static VPTNode |
getActiveNode(org.gjt.sp.jedit.View aView,
int methodFlags)
Return the current "active" node (opened project/group)
for the view.
|
static VPTProject |
getActiveProject(org.gjt.sp.jedit.View aView)
Return the current active project for the view.
|
static VPTProject |
getActiveProject(org.gjt.sp.jedit.View aView,
int methodFlags)
Return the current active project for the view.
|
static org.gjt.sp.jedit.Buffer[] |
getBuffers(org.gjt.sp.jedit.View view)
Gets an array of Buffers respecting current scope.
|
javax.swing.JTree |
getCurrentTree()
Returns the currently active tree.
|
VPTNode |
getRoot()
Returns the root node of the current tree.
|
java.util.List |
getSelectedFilePaths()
Returns a list of Strings containing the file paths of the selected
file and folder nodes.
|
VPTNode |
getSelectedNode()
Returns the currently selected node in the tree.
|
ProjectTreePanel |
getTreePanel()
Returns the component that manages the trees shown in the UI.
|
org.gjt.sp.jedit.View |
getView()
Returns the View associated with this instance.
|
static ProjectViewer |
getViewer(org.gjt.sp.jedit.View view)
Returns the viewer associated with the given view, or null if none
exists.
|
static ProjectViewer |
getViewer(org.gjt.sp.jedit.View view,
int methodFlags)
Returns the viewer associated with the given view, or null if none
exists.
|
void |
handleBufferUpdate(org.gjt.sp.jedit.msg.BufferUpdate msg) |
void |
handleDockableWindowUpdate(org.gjt.sp.jedit.msg.DockableWindowUpdate msg) |
void |
handleDynamicMenuChanged(org.gjt.sp.jedit.msg.DynamicMenuChanged dmg) |
void |
handleEditorExitRequested(org.gjt.sp.jedit.msg.EditorExitRequested msg) |
void |
handleEditPaneUpdate(org.gjt.sp.jedit.msg.EditPaneUpdate msg) |
void |
handleProjectUpdate(ProjectUpdate msg)
Resets the auto-reimporter task.
|
void |
handleViewUpdate(org.gjt.sp.jedit.msg.ViewUpdate vu)
Handles a ViewUpdate EditBus message.
|
void |
hierarchyChanged(java.awt.event.HierarchyEvent e) |
static void |
insertNodeInto(VPTNode child,
VPTNode parent)
Inserts a node in the given parent node (in a sorted position according
to
VPTNode.findIndexForChild(VPTNode) and
notifies folder trees in all instances of ProjectViewer. |
static void |
nodeChanged(VPTNode node)
Notify all project viewer instances of a change in a node.
|
static void |
nodeStructureChanged(VPTNode node)
Notify all project viewer instances of a change in a node's structure.
|
static void |
nodeStructureChangedFlat(VPTNode node)
Notify all "flat trees" in any project viewer instances of a change in
a node's structure.
|
static void |
projectRemoved(VPTProject p)
Notify all "flat trees" in any project viewer instances of a change in
a node's structure.
|
static void |
removeNodeFromParent(VPTNode child)
Removes a node from its parent, and notifies all folder trees in all
instances of ProjectViewer.
|
void |
sendUpdate(VPTNode n,
ViewerUpdate.Type type)
Sends a project viewer update message with the given data.
|
static void |
setActiveNode(org.gjt.sp.jedit.View aView,
VPTNode n)
Sets the current active node for the view.
|
void |
setChangingBuffers(boolean flag)
Method intended for use by classes that manage clicks on the
project trees to open buffers in jEdit; by setting this flag
to true, the auto-selecting of the new active buffer in jEdit
is temporarily disabled, preventing the tree from shifting
around when the user is interacting with it.
|
void |
setEnabled(boolean flag)
Enables or disables the viewer GUI.
|
void |
setRootNode(VPTNode n)
Sets the root node of the trees shown by this viewer.
|
void |
setStatus(java.lang.String message)
Changes jEdit's status bar message for the current view.
|
static void |
showMessage(java.awt.Component parent,
java.lang.String message)
Same as
showMessage(int, Component, String, String, int) ,
but with no flags, with a default title and default
messageType . |
static void |
showMessage(java.awt.Component parent,
java.lang.String message,
int messageType)
Same as
showMessage(int, Component, String, String, int) ,
but with no flags and with a default title. |
static void |
showMessage(java.awt.Component parent,
java.lang.String message,
java.lang.String title,
int messageType)
Same as
showMessage(int, Component, String, String, int) ,
but with no flags. |
static void |
showMessage(int flags,
java.awt.Component parent,
java.lang.String message)
Same as
showMessage(int, Component, String, String, int) ,
but with a default title and default messageType . |
static void |
showMessage(int flags,
java.awt.Component parent,
java.lang.String message,
java.lang.String title,
int messageType)
Shows a message dialog through
JOptionPane.showMessageDialog . |
static void |
showMessage(int flags,
java.lang.String message)
Same as
showMessage(int, Component, String, String, int) ,
but with a default title and default messageType . |
static void |
showMessage(java.lang.String message)
Same as
showMessage(int, Component, String, String, int) ,
but with a default title and default messageType . |
protected void |
unload()
Cleans up the current open project, and also clean up the
loaded project list when unloading PV from the current view.
|
void |
updateVCSState(VPTProject p,
VPTNode f) |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusBackward, transferFocusUpCycle
public static final int NO_FLAGS
public static final int FORCE
getActiveProject
invoked with this parameter
will force a project to be loaded.public static final int WARN
public static final int LATER
public static final int ONCE
@Deprecated public static final int METHOD_NO_FLAGS
METHOD_ prefix
.@Deprecated public static final int METHOD_FORCE
METHOD_
prefix.@Deprecated public static final int METHOD_WARN
METHOD_
prefix.@Deprecated public static final int METHOD_LATER
METHOD_
prefix.@Deprecated public static final int METHOD_ONCE
METHOD_
prefix.public ProjectViewer(org.gjt.sp.jedit.View aView, boolean bDocked)
ProjectViewer
. Only one instance is allowed
per view.
This constructor should not be called from outside ProjectViewer.
If an instance of this object is required, obtain it through
getViewer(org.gjt.sp.jedit.View)
.
Up to 3.4.2 version this constructor was taking only
the View
argument.
aView
- The jEdit view where the viewer is to be created.bDocked
- Whether pv is being created for the dockable window.java.lang.UnsupportedOperationException
- If a viewer is already
instantiated for the given view.public static ProjectViewer getViewer(org.gjt.sp.jedit.View view)
public static java.lang.String compressPath(java.lang.String origPath)
public static ProjectViewer getViewer(org.gjt.sp.jedit.View view, int methodFlags)
methodFlags
- WARN
is supplied.
FORCE
is specified. This is the way to achieve full pv functionality
if there is no dockable active. See ProjectViewer
,
active without dockable state. This flag is supported
since 3.4.3.
public static void nodeStructureChanged(VPTNode node)
public static void nodeChanged(VPTNode node)
public static void insertNodeInto(VPTNode child, VPTNode parent)
VPTNode.findIndexForChild(VPTNode)
and
notifies folder trees in all instances of ProjectViewer.public static void nodeStructureChangedFlat(VPTNode node)
public static void removeNodeFromParent(VPTNode child)
public static void projectRemoved(VPTProject p)
public static void setActiveNode(org.gjt.sp.jedit.View aView, VPTNode n)
java.lang.IllegalArgumentException
- If node is not a project or group.public static VPTNode getActiveNode(org.gjt.sp.jedit.View aView)
public static VPTNode getActiveNode(org.gjt.sp.jedit.View aView, int methodFlags)
Should not be called from outside ProjectViewer. For public
usage getActiveNode(View)
is suitable.
methodFlags
- NO_FLAGS or FORCE
.public static VPTProject getActiveProject(org.gjt.sp.jedit.View aView)
public static VPTProject getActiveProject(org.gjt.sp.jedit.View aView, int methodFlags)
Should not be called from outside ProjectViewer. For public usage
getActiveProject(View)
is suitable.
protected static void cleanViewEntry(org.gjt.sp.jedit.View aView)
protected void unload()
public static ProjectViewer createDockable(org.gjt.sp.jedit.View view)
ProjectViewer
to wrap it in the
dockable. If ProjectViewer
is already instantiated
for the given view (but the dockable was not yet created),
that instance is returned.public void setStatus(java.lang.String message)
public VPTNode getSelectedNode()
public java.util.List getSelectedFilePaths()
public javax.swing.JTree getCurrentTree()
public org.gjt.sp.jedit.View getView()
public static org.gjt.sp.jedit.Buffer[] getBuffers(org.gjt.sp.jedit.View view)
view
- Can be null, which defaults to jEdit.getActiveView()
public void setRootNode(VPTNode n)
java.lang.IllegalArgumentException
- If node is not a project or group.public VPTNode getRoot()
public void setEnabled(boolean flag)
setEnabled
in class javax.swing.JComponent
public void setChangingBuffers(boolean flag)
public void hierarchyChanged(java.awt.event.HierarchyEvent e)
hierarchyChanged
in interface java.awt.event.HierarchyListener
public ProjectTreePanel getTreePanel()
public void sendUpdate(VPTNode n, ViewerUpdate.Type type)
public void handleDockableWindowUpdate(org.gjt.sp.jedit.msg.DockableWindowUpdate msg)
public void handleDynamicMenuChanged(org.gjt.sp.jedit.msg.DynamicMenuChanged dmg)
public void handleEditorExitRequested(org.gjt.sp.jedit.msg.EditorExitRequested msg)
public void handleViewUpdate(org.gjt.sp.jedit.msg.ViewUpdate vu)
public void handleBufferUpdate(org.gjt.sp.jedit.msg.BufferUpdate msg)
public void handleEditPaneUpdate(org.gjt.sp.jedit.msg.EditPaneUpdate msg)
public void handleProjectUpdate(ProjectUpdate msg)
public static void showMessage(int flags, java.awt.Component parent, java.lang.String message, java.lang.String title, int messageType)
JOptionPane.showMessageDialog
.
It can be called either from AWT Event Thread or from other thread.
If current thread is awt event thread, then this method blocks.
If current thread is not awt, does it through invokeLater
.
This is a default behaviour which can be changed through
flags
.flags
- NO_FLAGS
: default behaviour.FORCE
: blocks always, even if current thread
is not awt. May cause deadlocks.ONCE
: do not repeat this message until
jEdit restart.
public static void showMessage(int flags, java.awt.Component parent, java.lang.String message)
showMessage(int, Component, String, String, int)
,
but with a default title and default messageType
.public static void showMessage(int flags, java.lang.String message)
showMessage(int, Component, String, String, int)
,
but with a default title and default messageType
.
Current view is used as a parent component.public static void showMessage(java.lang.String message)
showMessage(int, Component, String, String, int)
,
but with a default title and default messageType
.
Current view is used as a parent component.public static void showMessage(java.awt.Component parent, java.lang.String message, java.lang.String title, int messageType)
showMessage(int, Component, String, String, int)
,
but with no flags.public static void showMessage(java.awt.Component parent, java.lang.String message, int messageType)
showMessage(int, Component, String, String, int)
,
but with no flags and with a default title.public static void showMessage(java.awt.Component parent, java.lang.String message)
showMessage(int, Component, String, String, int)
,
but with no flags, with a default title and default
messageType
.public void focusOnDefaultComponent()
focusOnDefaultComponent
in interface org.gjt.sp.jedit.gui.DefaultFocusComponent
public void updateVCSState(VPTProject p, VPTNode f)