|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
AppLauncher | Holds information on what applications to use to open certain types of files, based on user-configured file name globs. |
ContextOptionPane | Right-click context menu editor. |
ProjectAppConfigPane | Option pane for the external applications configuration. |
ProjectFilterPane | Option pane for the filter configuration. |
ProjectOptions | A dialog for configuring the properties of a project. |
ProjectPropertiesPane | A dialog for configuring the properties of a project. |
ProjectViewerConfig | Class to hold configuration information for the plugin. |
ProjectViewerOptionsPane | Option pane to configure the ProjectViewer plugin. |
ProjectViewer allows other plugins to add custom panes to the project's option panes, allowing for per-project configuration options. To use this facility, the API is very similar to the API used to create option panes for jEdit's Plugin Options dialog.
For each option pane, set the following properties:
Here is an example from the CSideKick plugin:
plugin.projectviewer.csidekick.Plugin.option-pane=csidekick options.csidekick.label=C/C++ options.csidekick.code=new csidekick.CSideKickOptionPane();
Plugins may add properties directly to the project, without the need to keep their own configuration file for the projects. The project gives access to its internal java.util.Properties instance, for compatibility with jEdit's properties so that as little work as possible is needed to convert an existing AbstractOptionPane implementation to work with ProjectViewer. As a bonus, it's also possible to set "object" properties, i.e., properties that are not necessarily an instance of String. These properties are serialized an encoded using base64 so that it's possible to save them in the XML config file.
To use project-specific options, it is easier if the plugin uses a "property" based configuration style, just like jEdit provides by jEdit.getProperty(), or in the same style of the java.util.Properties class.
By having your option pane query a method for properties (instead of hardcoding jEdit.getProperty() calls inside your methods), you need only to extend the option pane class and make the getProperty() method query the project instead. For example:
class MyOptionPane extends AbstractOptionPane {
// implementation...
void myMethod() {
//...
String s = getProperty("property");
}
String getColor(String s) {
return jEdit.getProperty(s);
}
}
class MyProjectOptionPane extends MyOptionPane {
VPTProject p;
public MyProjectOptionPane() {
p = ProjectOptions.getProject();
config = (MyConfig) p.getObjectProperty(
"optionPaneName.config");
}
String getColor(String s) {
return p.getProperty("color").toString();
}
}
So, virtually all the code is reused, just by creating a method for the actual getting and setting of properties.
A second option is to use a java.util.Properties object to get/set properties
in the option pane. If called when the jEdit options dialog is shown, the method
jEdit.getProperties() return such an object. If called from the ProjectViewer's
project option dialog, the VPTProject instance also provides a
getProperties()
method.
From other locations of the code, you will want to get or set the values that are associated with the current project.
public static P4Config getProjectConfig(View v) { VPTProject proj = ProjectViewer.getActiveProject(v); try { return (proj != null) ? (P4Config) proj.getObjectProperty(P4Config.KEY) : null;
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |