|
|
| Changed: |
< < |
PLUS library jar distributed with PLUS plugin. You can get it throught Plugin Manager in IDEA (Aurora, Pallada).
|
> > |
PLUS library jar distributed with PLUS plugin. You can get it throught Plugin Manager in IDEA (Pallada).
|
| Changed: |
< < |
PLUS plugin have follow directory structure:
|
> > |
PLUS library archive have follow directory structure:
|
| Changed: |
< < |
$IDEA_PLUGINS_HOME/plus
lib
redist
plus_rt.jar
src.zip
|
> > |
+ lib
+ src
src_plus_jdk1.5.zip
plus.jar
forms_rt.jar
CHANGES.txt
|
| Changed: |
< < |
- plus_rt.jar - it PLUS runtime API.
- src.zip - is API sources.
To setup plugin project with using PLUS API, you can get Wizard plugin, and setup it by "Plugin" wizard. Or copy and setup manualy plus_rt.jar to your plugin lib, and attach it to project as library (with src.zip as sources).
|
> > |
- plus.jar - it PLUS API jar, requered to user library.
- src_plus_jdk1.5.zip - is a sources for PLUS library writen in JDK 1.5
|
| Changed: |
< < |
PluginManager pluginManager = PluginManager.getInstance();
PluginDescriptor? descriptor = pluginManager.getDescriptor();
|
> > |
PluginDescriptorManager? descriptorManager = PluginDescriptorManager?.getInstance();
PluginDescriptor? descriptor = descriptorManager.getDescriptor();
|
| Deleted: |
< < |
For show quick "About Splash" of your plugin, you can use PLUS api, to generate automatical splash, like IDEA splash.
AboutManager aboutManager = AboutManager.getInstance();
JComponent component = aboutManager.getAboutComponent();
// ...
// Or just get AnAction to attach in toolbar
AnAction action = aboutManager.getAboutAction();
|
| Changed: |
< < |
|
> > |
|
| Changed: |
< < |
public class Plugin {
|
> > |
public interface Plugin {
|
| Changed: |
< < |
public static final Localizer localizer = LocalizerManager?.getInstance().getLocalizer("org.intellij.yourPlugin.resources.strings");
|
> > |
Localizer localizer = LocalizerManager?.getInstance().getLocalizer("org.intellij.yourPlugin.resources.strings");
|
| Changed: |
< < |
public static PluginDescriptor? descriptor = PluginManager.getInstance().getDescriptor();
|
> > |
PluginDescriptor? descriptor = PluginDescriptorManager?.getInstance().getDescriptor();
|
| Changed: |
< < |
public static final Logger logger = Logger.getInstance(descriptor.getPluginName());
|
> > |
Logger logger = Logger.getInstance(descriptor.getPluginName());
|
| Changed: |
< < |
Then you may just call to static fields of Plugin class. Such as:
|
> > |
Then you may just call to static fields of Plugin interface. Such as:
|
| Changed: |
< < |
-- AlexeyEfimov - 29 Mar 2004
|
> > |
-- AlexeyEfimov - 27 Oct 2004 |
|
|
| Changed: |
< < |
Writing PLUS services
|
> > |
Getting PLUS API
|
| Changed: |
< < |
PLUS have API to register and unregister services. But, better if you not write separate plugin with new services, and notify PLUS author to include services into it. So use services API only for testing and creating testing suite to post it to PLUS author. Services must be fully documented, must be light, must be minimal API and must be realy needed.
|
> > |
PLUS library jar distributed with PLUS plugin. You can get it throught Plugin Manager in IDEA (Aurora, Pallada).
|
| Changed: |
< < |
|
> > |
PLUS plugin have follow directory structure:
$IDEA_PLUGINS_HOME/plus
lib
redist
plus_rt.jar
src.zip
- plus_rt.jar - it PLUS runtime API.
- src.zip - is API sources.
To setup plugin project with using PLUS API, you can get Wizard plugin, and setup it by "Plugin" wizard. Or copy and setup manualy plus_rt.jar to your plugin lib, and attach it to project as library (with src.zip as sources).
|
| Changed: |
< < |
You must extend Service interface and define all methods of your service:
|
> > |
Using PLUS API
Then you need to get info from plugin.xml descriptor of your plugin, you may use follow PLUS API:
|
| Changed: |
< < |
public interface PluginDescriptorService? extends Service {
public PluginDescriptor? getDescriptor(Class type) throws IOException, JDOMException;
|
> > |
PluginManager pluginManager = PluginManager.getInstance();
PluginDescriptor? descriptor = pluginManager.getDescriptor();
|
| Changed: |
< < |
public void logInit(Class type);
|
> > |
String pluginName = descriptor.getPluginName();
String authorName = descriptor.getAuthorName();
|
| Changed: |
< < |
public void logDispose(Class type);
}
|
> > |
VirtualFile? pluginHome = descriptor.getPluginDirectory();
// ... etc
|
| Changed: |
< < |
Follow implement it by local package class and extending from AbstractService:
|
> > |
Then you need to get info from other components settings in IDEA config directory, such as "Browser Path" from IDE settings, you can use Options api:
|
| Changed: |
< < |
class PluginDescriptorServiceImpl? extends AbstractService? implements PluginDescriptorService? {
private static final String SERVICE_NAME = "PluginDescriptor";
|
> > |
OptionsManager? opm = OptionsManager?.getInstance();
OptionsDescriptor? options = opm.getOptions(OptionsManager?.IDE_GENERAL);
|
| Changed: |
< < |
public String getServiceName() {
return SERVICE_NAME;
}
|
> > |
// Read path to HTML browser
String browserPath = options.getComponentOption("GeneralSettings", "browserPath");
// Get whole XML element for component "GeneralSettings"
Element element = options.getComponentElement("GeneralSettings");
// ... etc
|
| Changed: |
< < |
public PluginDescriptor? getDescriptor(Class type) throws IOException, JDOMException {
|
> > |
For show quick "About Splash" of your plugin, you can use PLUS api, to generate automatical splash, like IDEA splash.
AboutManager aboutManager = AboutManager.getInstance();
JComponent component = aboutManager.getAboutComponent();
<nop>
|
| Deleted: |
< < |
}
|
| Changed: |
< < |
public void logInit(Class type) {
// ..
}
|
> > |
// Or just get AnAction? to attach in toolbar
AnAction? action = aboutManager.getAboutAction();
|
| Changed: |
< < |
public void logDispose(Class type) {
// ..
}
|
> > |
|
| Changed: |
< < |
}
|
> > |
If you like to support different languages, you need for localization. PLUS API support universal localizer, that concatenate two classes - ResourceBundle and MessageFormat:
LocalizerManager lm = LocalizerManager.getInstance();
Localizer localizer = lm.getLocalizer("my.bundle.name");
String myValue = localizer.getString("myKey");
String myFormatedValue = localizer.format("myFormatKey", new Object[] {"Hello!", new Date()});
<nop>
|
| Changed: |
< < |
Thats all, now just define it in plugins.xml as ApplicationComponent:
|
> > |
How you can use PLUS API for real. There are very simple way - just create follow utility class for every your plugin:
|
| Changed: |
< < |
org.intellij.plus.services.PluginDescriptorService
org.intellij.plus.services.impl.PluginDescriptorServiceImpl
|
> > |
/**
- Plugin utility class.
*/
public class Plugin {
/**
* Localizer
*/
public static final Localizer localizer = LocalizerManager?.getInstance().getLocalizer("org.intellij.yourPlugin.resources.strings");
/**
* Descriptor
*/
public static PluginDescriptor? descriptor = PluginManager.getInstance().getDescriptor();
/**
* Default logger
*/
public static final Logger logger = Logger.getInstance(descriptor.getPluginName());
}
|
| Changed: |
< < |
|
> > |
Then you may just call to static fields of Plugin class. Such as:
// ...
setTitle(Plugin.localizer.getString("wizard.panel.title"));
// ...
<nop>
|
| Changed: |
< < |
-- AlexeyEfimov - 10 Mar 2004
|
> > |
-- AlexeyEfimov - 28 Mar 2004 |