StyledText contents [message #661439] |
Thu, 24 March 2011 16:40 |
Uhlersoth 872325412 Messages: 8 Registered: July 2009 |
Junior Member |
|
|
I have a Swing app that I'm trying to convert to an Eclipse plug-in. In the app, I have a tabbed document editor with two tabs - one with rendered HTML text (a JEditorPane), and the other with the plain source (a JTextArea).
I'd like to use a similar approach as a plug-in, but I can't seem to figure out the appropriate way to create and populate the styled editor. So far my code looks like this:
@Override
protected void addPages() {
// Editor title
setPartName(getEditorInput().getName());
// Page 1
Composite composite = new Composite(getContainer(), SWT.NONE);
compose = new StyledText(composite, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
// Page 2
text = new TextEditor();
try {
int index = addPage(composite);
setPageText(index, "Compose");
index = addPage(text, getEditorInput());
setPageText(index, "Source");
}
catch (PartInitException e) {
Utility.showThrowable(e);
}
}
Page 2 shows up just fine. Page 1 of course is empty, but for the life of me I can't figure out how to convert the IEditorInput to a StyledTextContent, or even to a string.
Any suggestions? Although I live and breathe Java, I'm a complete n00b with regard to Eclipse plug-in development, so thanks for your patience!
|
|
|
Powered by
FUDForum. Page generated in 0.02867 seconds