Class GetDocumentationAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- ptolemy.vergil.toolbox.FigureAction
-
- ptolemy.vergil.basic.GetDocumentationAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
public class GetDocumentationAction extends FigureAction
This is an action that accesses the documentation for a Ptolemy object associated with a figure. Note that this base class does not put this action in a menu, since some derived classes will not want it. But by having it here, it is available to all derived classes. This class provides an action for removing instance-specific documentation.- Since:
- Ptolemy II 5.2
- Version:
- $Id$
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Pt.AcceptedRating:
- Red (johnr)
- Pt.ProposedRating:
- Red (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.vergil.toolbox.FigureAction
FigureAction.SourceType
-
-
Field Summary
Fields Modifier and Type Field Description protected Configuration
_configuration
The configuration.-
Fields inherited from class ptolemy.vergil.toolbox.FigureAction
CANVAS_TYPE, CONTEXTMENU_TYPE, HOTKEY_TYPE, MENUBAR_TYPE, PASTE_OFFSET, TOOLBAR_TYPE
-
-
Constructor Summary
Constructors Constructor Description GetDocumentationAction()
Construct an instance of this action.GetDocumentationAction(int docPreference)
Construct an instance and give a preference for whether the KeplerDocumentationAttribute or the docAttribute should be displayed if both exist.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
Perform the action by opening documentation for the target.static void
getDocumentation(Configuration configuration, java.lang.String className, Effigy context)
Get the documentation for a particular class.void
setConfiguration(Configuration configuration)
Set the configuration.void
setEffigy(Effigy effigy)
Set the effigy to be used if the effigy is not evident from the model being edited.void
showDocumentation(NamedObj target)
Show the documentation for a NamedObj.-
Methods inherited from class ptolemy.vergil.toolbox.FigureAction
getFigure, getFrame, getSourceType, getTarget, getX, getY, offsetFigure
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
_configuration
protected Configuration _configuration
The configuration.
-
-
Constructor Detail
-
GetDocumentationAction
public GetDocumentationAction(int docPreference)
Construct an instance and give a preference for whether the KeplerDocumentationAttribute or the docAttribute should be displayed if both exist.- Parameters:
docPreference
- 0 for docAttribute, 1 for KeplerDocumentationAttribute
-
GetDocumentationAction
public GetDocumentationAction()
Construct an instance of this action.
-
-
Method Detail
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
Perform the action by opening documentation for the target. In the default situation, the documentation is in doc.codeDoc. However, if we have a custom application like HyVisual, VisualSense or Viptos, then we create the docs in doc.codeDocApplicationName.doc.codeDoc. However, this directory gets jar up and shipped with these apps when we ship windows installers and the docs are found at doc.codeDoc again. So, if _applicationName is set, we look in doc.codeDoc_applicationName.doc.codeDoc. If that is not found, we look in doc.codeDoc. If that is not found, we bring upDocBuilderGUI
.- Specified by:
actionPerformed
in interfacejava.awt.event.ActionListener
- Overrides:
actionPerformed
in classFigureAction
- Parameters:
e
- The event.
-
showDocumentation
public void showDocumentation(NamedObj target)
Show the documentation for a NamedObj. This does the same thing as the actionPerformed but without the action handler- Parameters:
target
- The NamedObj that will have its documentation shown.
-
getDocumentation
public static void getDocumentation(Configuration configuration, java.lang.String className, Effigy context)
Get the documentation for a particular class.If the configuration has a parameter _docApplicationSpecializer and that parameter names a class that that implements the DocApplicationSpecializer interface, then we call docClassNameToURL().
If the documentation is not found, pop up a dialog and ask the user if they would like to build the documentation, use the website documentation or cancel. The location of the website documentation is set by the _remoteDocumentationURLBase attribute in the configuration. That attribute, if present, should be a parameter that whose value is a string that represents the URL where the documentation may be found. If the _remoteDocumentationURLBase attribute is not set, then the location of the website documentation defaults to
http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII/Major.Version
, whereMajor.Version
is the value returned byVersionAttribute.majorCurrentVersion()
.- Parameters:
configuration
- The configuration.className
- The dot separated fully qualified name of the class.context
- The context.
-
setConfiguration
public void setConfiguration(Configuration configuration)
Set the configuration. This is used to open files (such as documentation). The configuration is is important because it keeps track of which files are already open and ensures that there is only one editor operating on the file at any one time.- Parameters:
configuration
- The configuration.
-
setEffigy
public void setEffigy(Effigy effigy)
Set the effigy to be used if the effigy is not evident from the model being edited. This is used if you are showing the documentation from code that is not in a model.- Parameters:
effigy
- the effigy to set.
-
-