Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » XML Editor
XML Editor [message #143305] Wed, 12 October 2005 13:30 Go to next message
Eclipse UserFriend
I'm new in plugins development, simple question - how can i run wtp xml
editor with selected file form my plugin, i must extend them?
Robert
Re: XML Editor [message #143357 is a reply to message #143305] Thu, 13 October 2005 00:52 Go to previous messageGo to next message
Eclipse UserFriend
On Wed, 12 Oct 2005 13:30:16 -0400, robert w=C4=85s <rwas8@gazeta.pl> wr=
ote:

> I'm new in plugins development, simple question - how can i run wtp xm=
l
> editor with selected file form my plugin, i must extend them?
> Robert
>

Do you mean you have special extension, such as filename.was :)
..... you need to tell Eclipse that you want ".was" considered
as "XML Content Type" ... where's a way under user prefrences.
If you wanted to do in plugin, you can use the contentType
extension point to "add" your extension to the 'org.eclipse.core.runtime=
..xml'
content type.
Re: XML Editor [message #143505 is a reply to message #143357] Thu, 13 October 2005 14:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: amywu.us.DELETETHISPART.ibm.com

FYI, the User preference is in Preferences:
General --> Content Types


"David Williams" <david_williams@us.ibm.com> wrote in message
news:op.sykihftjac05ss@dmw2t23.mshome.net...
On Wed, 12 Oct 2005 13:30:16 -0400, robert was <rwas8@gazeta.pl> wrote:

> I'm new in plugins development, simple question - how can i run wtp xml
> editor with selected file form my plugin, i must extend them?
> Robert
>

Do you mean you have special extension, such as filename.was :)
..... you need to tell Eclipse that you want ".was" considered
as "XML Content Type" ... where's a way under user prefrences.
If you wanted to do in plugin, you can use the contentType
extension point to "add" your extension to the
'org.eclipse.core.runtime.xml'
content type.
Re: XML Editor [message #143582 is a reply to message #143505] Fri, 14 October 2005 03:20 Go to previous messageGo to next message
Eclipse UserFriend
Amy Wu wrote:
> FYI, the User preference is in Preferences:
> General --> Content Types
I know how asociate xml content by user interface or in plugin.

Generally i have problem how run any editor with file *.xml.
I have File (java.io.File) which path is decodedd from page browsed in
swt browser and i want open it with xml editor programatically of
course. I thing that have elementary problem.

>
> "David Williams" <david_williams@us.ibm.com> wrote in message
> news:op.sykihftjac05ss@dmw2t23.mshome.net...
> On Wed, 12 Oct 2005 13:30:16 -0400, robert was <rwas8@gazeta.pl> wrote:
>
>
>>I'm new in plugins development, simple question - how can i run wtp xml
>>editor with selected file form my plugin, i must extend them?
>>Robert
>>
>
>
> Do you mean you have special extension, such as filename.was :)
> .... you need to tell Eclipse that you want ".was" considered
> as "XML Content Type" ... where's a way under user prefrences.
> If you wanted to do in plugin, you can use the contentType
> extension point to "add" your extension to the
> 'org.eclipse.core.runtime.xml'
> content type.
>
>
Re: XML Editor [message #143879 is a reply to message #143582] Fri, 14 October 2005 11:28 Go to previous message
Eclipse UserFriend
Originally posted by: amywu.us.DELETETHISPART.ibm.com

To programatically open a java.io.File in the xml editor, you could use one
of the IDE.openEditor methods. The problem is you need an IFile as input,
not java.io.File.
If your file is in your eclipse workspace, you can try something like the
following to get the IFile:
IFile file = null;
IFile[] files =
ResourcesPlugin.getWorkspace().getRoot().findFilesForLocatio n(new
Path(javaFile.getSystemPath()));
for (int i = 0; i < files.length && file == null; i++)
if (files[i].exists())
file = files[i];

Once you have the IFile, you can do something like the following:
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
IEditorPart editor = IDE.openEditor(page, file, true);

This will open the editor in the default editor registered for the file's
content type.

If your file is not in your workspace, you should check out
org.eclipse.wst.html.ui.internal.hyperlink.ExternalFileHyper link
That class wraps a file in an IEditorInput and then calls openEditor.

Hope that helps!

"robert w
Previous Topic:SDO/EMF -> WS
Next Topic:Flakiness of web services tools
Goto Forum:
  


Current Time: Sat Apr 19 12:02:07 EDT 2025

Powered by FUDForum. Page generated in 0.02848 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top