[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 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?
- The sourceViewer isn't editable. Can i change this? (2) doesn't work.
- 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.
protected Control createDialogArea(Composite parent)
{
initSomething(parent);
Composite comp = new Composite(parent, 0);
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
// comp.setBackground(ColorConstants.green);
GridLayout layout = new GridLayout(1, true);
comp.setLayout(layout);
Composite texteditcomp = comp;
// (om) Configure Syntax Highlighting
Document document = new Document();
int styles = SWT.V_SCROLL | SWT.H_SCROLL;
SourceViewer sourceViewer = new SourceViewer(texteditcomp, null, styles);
// Setting up the Java Syntax Highlighting
JavaTextTools tools = JavaPlugin.getDefault().getJavaTextTools();
tools.setupJavaDocumentPartitioner(document);
JavaSourceViewerConfiguration config = new JavaSourceViewerConfiguration(tools.getColorManager(), JavaPlugin
.getDefault().getCombinedPreferenceStore(), null, null);
sourceViewer.configure(config);//Takes infinite time!!! (1)
sourceViewer.setEditable(true);//No effect! (2)
//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;
}