|
|
Re: XML Editor [message #143505 is a reply to message #143357] |
Thu, 13 October 2005 18:12 |
Eclipse User |
|
|
|
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 #143879 is a reply to message #143582] |
Fri, 14 October 2005 15:28 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.04710 seconds