Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » FormattedText widget in RCP editor
FormattedText widget in RCP editor [message #583500] Tue, 17 July 2007 22:42
Eclipse UserFriend
Originally posted by: tim.mehrens.fiserv.com

I am trying to use the FormattedText widget in a RCP editor. To test it I
created a new project and a new class and pasted the following snippet
code in the new class:

import org.eclipse.nebula.widgets.formattedtext.DateFormatter;
import org.eclipse.nebula.widgets.formattedtext.FormattedText;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
/**
* Snippet 2 for DateFormatter : fixed mask yyyy/MM/dd, no default value.
*/
public class DateFormatterSnippet2 {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());

FormattedText text = new FormattedText(shell, SWT.BORDER);
text.setFormatter(new DateFormatter("yyyy/MM/dd"));
GridData data = new GridData();
data.widthHint = 70;
text.getControl().setLayoutData(data);

shell.open();
while ( ! shell.isDisposed() ) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}


To make the formattedtext jar available I placed the
org.eclipse.nebula.widget.formattedtext_1.0.0.jar in my eclipse plugin
directory and configured my project build path to use it. The widget
works as expected.

My problem is when I try to use it in an RCP editor that is in the same
project.

I have place the following import statements in the class:

import org.eclipse.nebula.widgets.formattedtext.DateFormatter;
import org.eclipse.nebula.widgets.formattedtext.FormattedText;

Added the same lines of code that were in the snippet example for the
Formatted Text widget, (other than changing it to a composite layout from
a shell):
FormattedText text = new FormattedText(composite, SWT.BORDER);
text.setFormatter(new DateFormatter("yyyy/MM/dd"));

The code compiles fine but when I run the application and select the
editor - the editor comes up blank without the formattedtext widget or any
other SWT Text and/or Label widgets that are in the class. If I remove
the FormattedText lines the editor displays the other widgets fine.

Am I missing something to use this widget in a RCP editor or does this
widget only work in a SWT Application?

Thanks In Advance!
Previous Topic:Gallery Widget
Next Topic:How can PShelfItem be dynamically added and removed from PShelf
Goto Forum:
  


Current Time: Thu Apr 25 07:33:19 GMT 2024

Powered by FUDForum. Page generated in 0.03145 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top