Page 1 of 1

Creating a plugin

Posted: Thu Aug 07, 2014 3:24 pm
by PhillyNJ
Hi,

I am not sure if this is the best place to ask this question. I am creating a plugin by implementing the GeneralPluginExtension class. My question is, how do I access the file path of the current document? I dont see a property or method that will return the current document's path.

Code: Select all

public class GeneralExampleExtention implements GeneralPluginExtension{

@Override
public void process(GeneralPluginContext gpc) {

}

}

Re: Creating a plugin

Posted: Thu Aug 07, 2014 3:29 pm
by Radu
Hi,

You can use API like:

Code: Select all

    WSEditor currentOpenedDocument = gpc.getPluginWorkspace().getCurrentEditorAccess(PluginWorkspace.MAIN_EDITING_AREA);
URL editorLocation = currentOpenedDocument.getEditorLocation();
This general plugin type is useful only for modifying content in the Text editing mode (the plugin will appear as a new action when you right click in the text editing mode). If you also want to modify content in the Author visual editing mode you could create a plugin of type Workspace Access which is more flexible.

Regards,
Radu

Re: Creating a plugin

Posted: Thu Aug 07, 2014 3:51 pm
by PhillyNJ
Thanks. Worked Perfect. :) :) :)