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.

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?

If you put the FormattedText jar in the project classpath, the project
will compile, but the editor will appear empty and you will find
exceptions in the workspace log file.

The jar must not be put in the project classpath, but in the plugin
classpath. For this, open the plugin.xml file, select the runtime tab
and add the FormattedText jar in the classpath list.

Regards,
Eric

Tim Mehrens a écrit :
> 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!
>
>
>

I am new to all this so please be patience with me. When I remove the
org.eclipse.nebula.widgets.formattedtext_1.0.0.jar from my eclipse plugin
library and remove it from my Java Build Path, (I assumed that is what you
meant by the project classpath), my code no longer compiles saying that
Formattedtext cannot be resolved to a type. I then open the plugin.xml
file, select the Runtime tab and try to add the FormattedText jar in the
classpath list. What is enabled under the ClassPath are New and Add
buttons. I have tried using the new button and a fully qualified name to
the formattedtext jar file and it does not work. If I select the new
button I see several project directories, (bin, icons, meta-inf, src) and
if I try to put the jar in the src folder and add this to the classpath it
still does not work and I am left with the compile errors.

If you put the FormattedText jar in the project classpath, the project
will compile, but the editor will appear empty and you will find
exceptions in the workspace log file.

The jar must not be put in the project classpath, but in the plugin
classpath. For this, open the plugin.xml file, select the runtime tab
and add the FormattedText jar in the classpath list.

Regards,
Eric

Tim Mehrens a écrit :
> 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!
>
>
>

I am new to all this so please be patience with me. When I remove the
org.eclipse.nebula.widgets.formattedtext_1.0.0.jar from my eclipse plugin
library and remove it from my Java Build Path, (I assumed that is what you
meant by the project classpath), my code no longer compiles saying that
Formattedtext cannot be resolved to a type. I then open the plugin.xml
file, select the Runtime tab and try to add the FormattedText jar in the
classpath list. What is enabled under the ClassPath are New and Add
buttons. I have tried using the new button and a fully qualified name to
the formattedtext jar file and it does not work. If I select the new
button I see several project directories, (bin, icons, meta-inf, src) and
if I try to put the jar in the src folder and add this to the classpath it
still does not work and I am left with the compile errors.