|
Re: XML Editor problem [message #460578 is a reply to message #460574] |
Fri, 22 December 2006 12:05 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
Hi,
Yes the WST project which is part of WTP contains sophisticated editors.
You need the following plugins:
org.eclipse.wst.sse.core,
org.eclipse.wst.sse.ui,
org.eclipse.wst.xml.core,
org.eclipse.wst.xml.ui,
org.eclipse.wst.common.ui,
Afterwards create your own editor the interesting methods look like this:
> public class EXSWTPageEditor extends MultiPageEditorPart implements IResourceChangeListener{
> protected IEditorSite createSite(IEditorPart page) {
> IEditorSite site = null;
> if (page == editor) {
> site = new MultiPageEditorSite(this, page) {
> public String getId() {
> // Sets this ID so nested editor is configured for XML source
> return ContentTypeIdForXML.ContentTypeID_XML + ".source"; //$NON-NLS-1$;
> }
> };
> }
> else {
> site = super.createSite(page);
> }
> return site;
> }
> /**
> * Creates page 0 of the multi-page editor,
> * which contains a text editor.
> */
> void createPage0() {
> try {
> editor = new StructuredTextEditor();
> int index = addPage(editor, getEditorInput());
> setPageText(index, editor.getTitle());
> } catch (PartInitException e) {
> ErrorDialog.openError(
> getSite().getShell(),
> "Error creating nested text editor",
> null,
> e.getStatus());
> }
> }
Tom
Mario schrieb:
> Hi,
> I need to implement a XML editor in my RCP Application. That's why I
> used the Extension wizard to create a XML Editor.
>
> Two questions: 1. Is there another XML edtior with more features?
> 2. Does anybody see a problem in the following code? The editor does
> open, but instead of showing the file content, there is a horizontal
> blue line and a text bellow which contains "ERROR" (nothing else).
>
> The code:
> ..
> File file = new File(thePathAndFile);
> IPath location = new Path(file.getAbsolutePath());
> PathEditorInput editorInput = new PathEditorInput(location);
> IEditorPart editor = page.openEditor(editorInput, editorId);
>
> Thanks in advance!
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.04017 seconds