PlugIn: Go to certain location within document
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 6
- Joined: Thu Sep 30, 2010 12:16 pm
PlugIn: Go to certain location within document
Hello,
I would like to write a PlugIn that does some tests on an xml document and reports errors. I would like to log the errors in a dialog window.
My question is: Would the following scenario be possible? The dialog lists the problems found in a list or a table (internally I might store a character position and a length). When the user clicks on an entry in the list/row in the table, the cursor jumps to the proper position in the document window and selects a certain amount of characters (Similar to what happens when you do a search).
I know that I can get the frame with context.getFrame() (when it is a DocumentPluginExtension). But is there any possibility to go from the frame to the window that contains the document, and then remotely control that window?
Best regards,
Christian Kirchhoff
I would like to write a PlugIn that does some tests on an xml document and reports errors. I would like to log the errors in a dialog window.
My question is: Would the following scenario be possible? The dialog lists the problems found in a list or a table (internally I might store a character position and a length). When the user clicks on an entry in the list/row in the table, the cursor jumps to the proper position in the document window and selects a certain amount of characters (Similar to what happens when you do a search).
I know that I can get the frame with context.getFrame() (when it is a DocumentPluginExtension). But is there any possibility to go from the frame to the window that contains the document, and then remotely control that window?
Best regards,
Christian Kirchhoff
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: PlugIn: Go to certain location within document
Dear Christian,
I assume you already know where to find our plugins development kit:
http://www.oxygenxml.com/developer.html#Plugins
The type of plugin that you should look into is the "Workspace Access" plugin. We have a sample in the plugins development kit for such a plugin implementation which should be useful to you.
This kind of plugin can register actions on the toolbar and main menu.
You can also access the current selected editor using the StandalonePluginWorkspace API, get access to methods which can be used to create a Reader over the selected WSEditor editor.
Then you can check in what page the editor is opened: Text, Grid or Author and using the WSTextBasedEditorPage API perform modifications to it or move the caret to certain positions.
If you want you can write us an email to our support email address with more details and I'll try to provide a sample implementation of a Workspace Access plugin.
Regards,
Radu
I assume you already know where to find our plugins development kit:
http://www.oxygenxml.com/developer.html#Plugins
The type of plugin that you should look into is the "Workspace Access" plugin. We have a sample in the plugins development kit for such a plugin implementation which should be useful to you.
This kind of plugin can register actions on the toolbar and main menu.
You can also access the current selected editor using the StandalonePluginWorkspace API, get access to methods which can be used to create a Reader over the selected WSEditor editor.
Then you can check in what page the editor is opened: Text, Grid or Author and using the WSTextBasedEditorPage API perform modifications to it or move the caret to certain positions.
If you want you can write us an email to our support email address with more details and I'll try to provide a sample implementation of a Workspace Access plugin.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 6
- Joined: Thu Sep 30, 2010 12:16 pm
Re: PlugIn: Go to certain location within document
Hello Radu,
thanks for the quick response. Yes I have the plugins development kit and I started with a document plugin. With that I was able to parse the document's contents and log problems. I will take a closer look at the Workspace Access plugin example. If I have further questions, I will get back to you.
Thanks again
Christian
thanks for the quick response. Yes I have the plugins development kit and I started with a document plugin. With that I was able to parse the document's contents and log problems. I will take a closer look at the Workspace Access plugin example. If I have further questions, I will get back to you.
Thanks again
Christian
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: PlugIn: Go to certain location within document
Hi Christian,
The Workspace Access plugin and API was added in Oxygen 11.2.
From Oxygen 11.0 or 11.1 the upgrade to 11.2 is free.
If you have Oxygen 10.x or older maybe we can find a workaround using the older API. In what page do you want to present the errors? In the Text page?
Regards,
Radu
The Workspace Access plugin and API was added in Oxygen 11.2.
From Oxygen 11.0 or 11.1 the upgrade to 11.2 is free.
If you have Oxygen 10.x or older maybe we can find a workaround using the older API. In what page do you want to present the errors? In the Text page?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 6
- Joined: Thu Sep 30, 2010 12:16 pm
Re: PlugIn: Go to certain location within document
The presentation of the errors should be in an external window (just as the Conversion example in the Development Kit opens in a new window).
That windows will either contain a list or a table. Clicking on an entry in that list or a row in that table should reult in the xml document being moved to a certain position (if possible).
That windows will either contain a list or a table. Clicking on an entry in that list or a row in that table should reult in the xml document being moved to a certain position (if possible).
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: PlugIn: Go to certain location within document
Hi,
The most that you can accomplish using the older plugins API is to try and get access to the JTextArea in which the XML is edited like:
You have to invoke later on the AWT the code so that the focus is transfered back to the JTextArea after the action is invoked.
Regards,
Radu
The most that you can accomplish using the older plugins API is to try and get access to the JTextArea in which the XML is edited like:
Code: Select all
/**
* Process context.
*
*@param context Selection context.
*@return Selection plugin result.
*/
public SelectionPluginResult process(SelectionPluginContext context) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
//This the JTextArea from the Oxygen Text page.
JTextArea currentEditor = (JTextArea) KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
//TODO perform your own code here.
}
});
return null;
}
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service