[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Re: Use Java-Code-Editor in an Dialog
|
Hello, now I have solved one problem. There was a problem with the
plugin version. Now I can show the Dialog.
But the Dialog ist still uneditable! I have attached a screenshot and
some code.
Have you an idea what's wrong?
Thanks in advance,
Johann Rosner
Daniel Megert wrote:
Johann Rosner wrote:
Hello i have tried your solution. But I failed!
I have appended my code (code.txt).
My problems are:
- sourceViewer.configurer(...) takes infinite time. The method never
return. I don't know why. Any idea?
Nope. Works fine here. Simply debug or trace it to find out.
- The sourceViewer isn't editable. Can i change this? (2) doesn't work.
It is. You're probably doing something wrong.
Dani
- How can i (in code) insert Text into the sourceView?
Daniel Megert wrote:
Johann Rosner wrote:
Hello I have some problems, and i hope someone can help ;)
I am developing an RCP Application. And I need to integrate an
Java-Code-Editor.
I think the editor I need is the CompilationUnitEditor (but im not
sure).
So the problems are:
- The editor habe to be shown in (extra) Dialog.
This is not supported. You can use a source viewer and configure it
with a JavaSourceViewerConfiguration though.
Dani
- The editor should provide, syntax-highlighting & code completion.
(like in Eclipse IDE)
- I don't want to have the editor-Icons on the applications toolbar.
Any ideas how to manage this?
Thank you.

/**
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent)
{
Composite comp = new Composite(parent, 0);
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout(1, true);
comp.setLayout(layout);
// (om) Configure Syntax Highlighting
Document document = new Document();
document.set("//Some text, but not visible");
//How to set the text to show?
int styles = SWT.V_SCROLL | SWT.H_SCROLL;
SourceViewer sourceViewer = new SourceViewer(comp, null, styles);
//Something for layout...
GridData gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
gridData.verticalAlignment = SWT.FILL;
gridData.grabExcessVerticalSpace = true;
sourceViewer.getControl().setLayoutData(gridData);
return comp;
}