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 #37323] Tue, 17 July 2007 22:42 Go to next message
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!
Re: FormattedText widget in RCP editor [message #37357 is a reply to message #37323] Wed, 18 July 2007 20:35 Go to previous messageGo to next message
Eric Wuillai is currently offline Eric WuillaiFriend
Messages: 27
Registered: July 2009
Junior Member
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!
>
>
>
Re: FormattedText widget in RCP editor [message #37527 is a reply to message #37357] Mon, 23 July 2007 22:44 Go to previous message
Eclipse UserFriend
Originally posted by: tim.mehrens.fiserv.com

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.

Help Please!
Re: FormattedText widget in RCP editor [message #583520 is a reply to message #37323] Wed, 18 July 2007 20:35 Go to previous message
Eric Wuillai is currently offline Eric WuillaiFriend
Messages: 27
Registered: July 2009
Junior Member
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!
>
>
>
Re: FormattedText widget in RCP editor [message #583583 is a reply to message #37357] Mon, 23 July 2007 22:44 Go to previous message
Eclipse UserFriend
Originally posted by: tim.mehrens.fiserv.com

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.

Help Please!
Previous Topic:test
Next Topic:Right click context menu on Gallery
Goto Forum:
  


Current Time: Thu Dec 18 11:45:48 GMT 2014

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

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