Creating a plugin

Questions about XML that are not covered by the other forums should go here.
PhillyNJ
Posts: 3

Creating a plugin

Thu Aug 07, 2014 3:24 pm

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: 5753

Re: Creating a plugin

Thu Aug 07, 2014 3:29 pm

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

Re: Creating a plugin

Thu Aug 07, 2014 3:51 pm

Thanks. Worked Perfect. :) :) :)

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests