Plug-in Advice: Transform within Browser View
Oxygen general issues.
-
- Posts: 4
- Joined: Sat Dec 04, 2010 1:51 am
Plug-in Advice: Transform within Browser View
Post by java_the_hutt »
I'm running Oxygen 12 and would like to build an Oxygen plug-in with the following workflow:
1. User selects an XML file from menu drop-down list.
2. The selected XML file is transformed into HTML that calls external CSS and JavaScript, and the HTML has data contained within a table.
3. Results of XSL transformation are displayed in an Oxygen View. (In other words, I need a browser to run within an Oxygen View.)
4. XML tags (e.g., <xref>) resulting from the transform can be inserted into an open *.xml document by drag-and-drop or some other means.
As I am no Java guru by any means, I am wondering if there is a plug-in in existence that approximates the one I plan to build. I'm also concerned that my requirement of needing a browser within a view is outside the current API set. What is your take? Should I be developing an Eclipse plugin that works with Oxygen or can I develop within the Oxygen standalone, which is my preference?
Thank you!
1. User selects an XML file from menu drop-down list.
2. The selected XML file is transformed into HTML that calls external CSS and JavaScript, and the HTML has data contained within a table.
3. Results of XSL transformation are displayed in an Oxygen View. (In other words, I need a browser to run within an Oxygen View.)
4. XML tags (e.g., <xref>) resulting from the transform can be inserted into an open *.xml document by drag-and-drop or some other means.
As I am no Java guru by any means, I am wondering if there is a plug-in in existence that approximates the one I plan to build. I'm also concerned that my requirement of needing a browser within a view is outside the current API set. What is your take? Should I be developing an Eclipse plugin that works with Oxygen or can I develop within the Oxygen standalone, which is my preference?
Thank you!
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Plug-in Advice: Transform within Browser View
Hi,
The way to implement such behaviors are quite different depending on whether you want an integration with the standalone or the Eclipse Plugin Oxygen.
1) If you want to develop a plugin for the standalone version of Oxygen:
http://www.oxygenxml.com/developer.html#Plugins
My recommendation for you is to look at the Workspace Access plugin sample. You can contribute buttons to the toolbar, main menus, get access to the current opened editors + contribute to a custom view with your own content.
We do not have API to open content in an internal web browser.
The Java Swing libraries have a simple implementation which can render an HTML page:
javax.swing.text.html.HTMLEditorKit
It should know CSS but probably not JavaScript. So it's quite limited.
There are probably some other open source Java browser implementations but I cannot recommend you a specific one.
What you can also do is that instead of opening the result HTML in an internal view in Oxygen to open it in the associated system Web browser (in a separate application).
We have some API in ro.sync.exml.workspace.api.Workspace:
2) If you want to integrate with the Oxygen plugin running in the Eclipse platform you would have to create a new Eclipse plugin which communicates with the Oxygen plugin using the API we provide:
http://www.oxygenxml.com/developer.html ... pse_plugin
The other mechanisms for adding toolbar, main menu, or additional views are all Eclipse platform-specific.
Eclipse has the possibility of presenting the system preferred browser in an embedded view.
I do not understand exactly your step 4.
Do you want to drag and drop from the result HTML into the XML?
Or as a by-product of the transformation you show the user a list of links?
Regards,
Radu
The way to implement such behaviors are quite different depending on whether you want an integration with the standalone or the Eclipse Plugin Oxygen.
1) If you want to develop a plugin for the standalone version of Oxygen:
http://www.oxygenxml.com/developer.html#Plugins
My recommendation for you is to look at the Workspace Access plugin sample. You can contribute buttons to the toolbar, main menus, get access to the current opened editors + contribute to a custom view with your own content.
We do not have API to open content in an internal web browser.
The Java Swing libraries have a simple implementation which can render an HTML page:
javax.swing.text.html.HTMLEditorKit
It should know CSS but probably not JavaScript. So it's quite limited.
There are probably some other open source Java browser implementations but I cannot recommend you a specific one.
What you can also do is that instead of opening the result HTML in an internal view in Oxygen to open it in the associated system Web browser (in a separate application).
We have some API in ro.sync.exml.workspace.api.Workspace:
Code: Select all
void openInExternalApplication(URL url, boolean preferAssociatedApplication);
http://www.oxygenxml.com/developer.html ... pse_plugin
The other mechanisms for adding toolbar, main menu, or additional views are all Eclipse platform-specific.
Eclipse has the possibility of presenting the system preferred browser in an embedded view.
I do not understand exactly your step 4.
Do you want to drag and drop from the result HTML into the XML?
Or as a by-product of the transformation you show the user a list of links?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Sat Dec 04, 2010 1:51 am
Re: Plug-in Advice: Transform within Browser View
Post by java_the_hutt »
@Radu,
I appreciate your quick response and explanation of multiple options. After thinking about it, I like the idea of displaying the results of the transformation in the associated system Web browser (in a separate application) if no internal browser is available, assuming I can control position and size of the HTML page:
I think one difficulty of this method is that when the user selects/drag tags dynamically created in the transform from the result HTML such as <xref>, the browser will lose focus during the "drop" operation into the XML in Oxygen. It would seem that the external browser would fall behind Oxygen, making the integration less seamless than I would prefer. Is this your take on it?
If so, maybe my best course is to build a new Eclipse plugin as you have suggested in #2. Does Oxygen have any plans to add internal browser functionality in the near future?
Thank you!
I appreciate your quick response and explanation of multiple options. After thinking about it, I like the idea of displaying the results of the transformation in the associated system Web browser (in a separate application) if no internal browser is available, assuming I can control position and size of the HTML page:
Code: Select all
<script LANGUAGE=javascript>
<!--
function controlWindow(){
window.resizeTo(365,470);
window.moveTo(0,0);
}
//-->
</script>
If so, maybe my best course is to build a new Eclipse plugin as you have suggested in #2. Does Oxygen have any plans to add internal browser functionality in the near future?
Thank you!
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Plug-in Advice: Transform within Browser View
Hi,
So, as you said, there is no way to embed a full-fledged browser in a view in the standalone editor. If you are willing to accept this, then probably you will have a faster implementation time.
But you can embed it in an internal Eclipse workspace window (but maybe not on all Eclipse distributions, depending on the operating system). A sample code would be something like:
It depends, if you are not familiar with the Eclipse plugin architecture it will take you some time.
The link I gave you in a previous post:
http://www.oxygenxml.com/developer.html ... pse_plugin
contains the SDK + a sample plugin which interacts with the installed Oxygen plugin.
Regards,
Radu
So, as you said, there is no way to embed a full-fledged browser in a view in the standalone editor. If you are willing to accept this, then probably you will have a faster implementation time.
But you can embed it in an internal Eclipse workspace window (but maybe not on all Eclipse distributions, depending on the operating system). A sample code would be something like:
Code: Select all
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
if (WebBrowserPreference.getBrowserChoice() == WebBrowserPreference.INTERNAL) {
support.createBrowser(
IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR,
"org.eclipse.ui.browser",
null,
null).openURL(new URL(systemID));
} else {
support.createBrowser(
IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR,
"org.eclipse.ui.externalBrowser",
null,
null).openURL(new URL(systemID));
}
The link I gave you in a previous post:
http://www.oxygenxml.com/developer.html ... pse_plugin
contains the SDK + a sample plugin which interacts with the installed Oxygen plugin.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9446
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Plug-in Advice: Transform within Browser View
Updating the thread with one more detail:
As a coincidence I tried today to drag selected HTML content from a web browser into the Oxygen plugin. From what it seems there is no way in the drag destination to get to the HTML flavor. You can get to the equivalent text flavor (only the text content from the HTML) but the Eclipse implementation does not seem to allow DnD with HTML content (does not allow for a way to get the content from the browser).
Maybe you can study this more but I think DnD HTML from a browser to the Oxygen Eclipse plugin (or to any editor) cannot be accomplished.
Regards,
Radu
As a coincidence I tried today to drag selected HTML content from a web browser into the Oxygen plugin. From what it seems there is no way in the drag destination to get to the HTML flavor. You can get to the equivalent text flavor (only the text content from the HTML) but the Eclipse implementation does not seem to allow DnD with HTML content (does not allow for a way to get the content from the browser).
Maybe you can study this more but I think DnD HTML from a browser to the Oxygen Eclipse plugin (or to any editor) cannot be accomplished.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Sat Dec 04, 2010 1:51 am
Re: Plug-in Advice: Transform within Browser View
Post by java_the_hutt »
While I'm disappointed re: the DnD tack, I appreciate that you have saved me time otherwise spent down the DnD rabbit hole. I am somewhat familiar with the Eclipse plugin architecture, so that's my next stop. Thanks for the code block and other pointers.
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