Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Porting XML Editor Challenge [SOLVED](Trying to port a selection of the WebTools into my application)
Porting XML Editor Challenge [SOLVED] [message #1064940] Fri, 21 June 2013 14:20 Go to next message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
Good afternoon!

I currently work on an application where the product is built in Eclipse with RCP and on the Equinox Framework. My current task is to develop or port a fully functional XML editor into our application.

Although this may sound cannibalistic, I would like to figure out a way to port the XML editor and XSD to XML generation pieces from the Webtools and use it within my application. I was wondering if anyone had ever attempted this before or if there was some kind of custom "sub-product" that has been attempted. The XML editor and designer is a very friendly and easy to use interface that I would like to see in our product.

I understand this is probably an off the wall question, but if anyone has a place on where I can start would be more than appreciated.

Thanks,

Scott


Update 1:

I was able to explore the webtools quite substantially large package and I believe I have located a root class that extends the AbstractUIPlugin called XMLUIPlugin.java. With the help of a new RCP project and some configuration, I am able to load the root plugin and the perspective. I am now, however, having issues setting up the workbench. I am unable to find the ROOT UI class that extends the ActionBarAdvisor. I believe the ActionBarAdvisor will be the ticket to start the "xml editor" editor part in order to create an XML file from a schema. Any help with that will be more than appreciated.

Update 2: Solved (see second post).

[Updated on: Mon, 24 June 2013 15:52]

Report message to a moderator

Re: Porting XML Editor Challenge [UPDATED] [message #1065212 is a reply to message #1064940] Mon, 24 June 2013 15:50 Go to previous messageGo to next message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
SOLUTION!!!:

If you are using the Equinox Framework within a normal RCP application, I have figured it out!

Grab the action for creating the xml file and add it to the toolbar.

org.eclipse.wst.xsl.ui.internal.actions.NewXMLFileWizardDelegate.

Add the init operation to your coolbar, add to manifest, and then make adjustments accordingly to your run config.

*Party*
Re: Porting XML Editor Challenge [UPDATED] [message #1065767 is a reply to message #1065212] Thu, 27 June 2013 08:40 Go to previous message
Scott Hull is currently offline Scott Hull
Messages: 32
Registered: July 2012
Member
Extra Info: For those of you whose product is an RCP application, utilizes Eclipse Forms, and can open editors generically with the editor's registry (see PlatformUI).

I was able to achieve the required XML Editor utility by not adding the wizard into my application for EXISTING xml files. Within my run configuration (and feature) I added the org.eclipse.wst.xml.ui and org.eclipse.wst.xml.core plus others (validate plugins), and the editor will automatically loaded the xml file in the XML editor built within the WTP (WST specifically). Please note if you need to only use the xml or xsd editors, use the p2 repository for the WST (Eclipse Web Standard Tools aka Eclipse Web Developer Tools) instead of the entire WTP.

Granted, if a person needs to open the editor under the hood, they can use the ID for the XML editor provided in the WTP package (start looking in NewXMLFileWizardDelegate) or call the openEditor operation with the specified file type (depending on your ui editor's registry settings).


I hope this helps save someone some time. The entire WTP package can be a bit cumbersome to traverse to look for a specific utility to use for your application.

Here is some code to use the PlatformUI to open up editors:

String editorId = "org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart";
IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
try {
    if (dw != null) {
        IWorkbenchPage page = dw.getActivePage();
        if (page != null) {
            page.openEditor(new FileEditorInput(file), editorId, true);
        }
    }
} 



[Updated on: Thu, 27 June 2013 08:50]

Report message to a moderator

Previous Topic:Keeping in sync : StructuredTextEditor and GrapicalEditor in MultipageEditorPart
Next Topic:Eclipse fails to deploy ear on Jboss
Goto Forum:
  


Current Time: Wed Aug 20 16:40:43 EDT 2014

Powered by FUDForum. Page generated in 0.01553 seconds