Creating a plugin

Questions about XML that are not covered by the other forums should go here.
PhillyNJ
Posts: 3
Joined: Thu Aug 07, 2014 3:17 pm

Creating a plugin

Post 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) {

}

}
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: Creating a plugin

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
PhillyNJ
Posts: 3
Joined: Thu Aug 07, 2014 3:17 pm

Re: Creating a plugin

Post by PhillyNJ »

Thanks. Worked Perfect. :) :) :)
Post Reply