Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Problem creating VE/SWT class
Problem creating VE/SWT class [message #103267] Wed, 24 August 2005 13:12 Go to next message
Eclipse UserFriend
Originally posted by: none.nowhere.com

I am fairly new to Eclipse/VE but can manage VE/Swing OK. Works fine -
great product. But I am having a problem with SWT. When I create a
visual class, it compiles OK but shows nothing in the Design view. Any
components added give an error because they are generated with a no-arg
constructor. The generated code doesn't seem right to me - I include it
below. It doesn't have a constructor to add code too. Also there is no
@jve tag

package p1;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;

public class Example1 {

private Shell sShell = null;
/**
*
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

/* Before this is run, be sure to set up the launch
configuration (Arguments->VM Arguments)
* for the correct SWT library path in order to run with the SWT
dlls.
* The dlls are located in the SWT plugin jar.
* For example, on Windows the Eclipse SWT 3.1 plugin jar is:
* installation_directory\plugins\org.eclipse.swt.win32_
3.1.0.jar
*/
Display display = Display.getDefault();
Example1 thisClass = new Example1();
thisClass.createSShell();
thisClass.sShell.open();
while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}

/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new Shell();
sShell.setText("Shell");
sShell.setSize(new Point(300, 200));
}

}


Also all the VE examples/tutorials I can find are for RCP or plugins,
which appear to me to be addons to Eclipse itself. Is VE/SWT not
intended to be used for stand alone programs?
Re: Problem creating VE/SWT class [message #103297 is a reply to message #103267] Wed, 24 August 2005 13:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: myersj.gmail.com

Ray,

VE development for SWT requires the use of a JRE version 1.4.2 or
greater. Please install a newer JRE and then clean your SWT project.
That should fix the problems you're seeing.

And yes, VE is meant to help you design stand alone SWT applications as
well as RCP apps.

Hope this helps,
- Jeff
Re: Problem creating VE/SWT class [message #103470 is a reply to message #103297] Thu, 25 August 2005 02:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.nowhere.com

Jeff Myers <myersj@gmail.com> wrote in
news:dehu0v$ijt$1@news.eclipse.org:

> Ray,
>
> VE development for SWT requires the use of a JRE version 1.4.2 or
> greater. Please install a newer JRE and then clean your SWT project.
> That should fix the problems you're seeing.
>
> And yes, VE is meant to help you design stand alone SWT applications
> as well as RCP apps.
>
> Hope this helps,
> - Jeff

Thanks for the prompt reply. I might reiterate that I am very impressed
with eclipse and the VE (for swing). I think it is a brilliant product
for Java development.


I am using JRE 1.5.0_04. Is this a problem? (I have had another small
unrelated problem with 1.5 in my swing program - on some occasions it
doesn't repaint the screen correctly, running both within eclipse and
outside of it)


A manually written (not VE) SWT HelloWorld program runs OK in eclipse.

Thanks
Ray
Re: Problem creating VE/SWT class [message #103610 is a reply to message #103470] Thu, 25 August 2005 14:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Makre sure that there is a SWT Library container entry in your
classpath. There should not be a separate external jar entry for just
swt.jar. It should be a library.

When the editor comes up, are there SWT items on the pallete?

The example itself is fine. We don't use jvedoc tags that much anymore.
And for shell, you can create it with the default constructor. But for
any SWT entries selected from the palette should not use the default
constructor. Except if 1.4.1 is the java level. You said it was 1.5, but
are you sure that the project's jre is 1.5, and not just the Eclipse was
started with 1.5?
--
Thanks,
Rich Kulp
Re: Problem creating VE/SWT class [message #103700 is a reply to message #103610] Fri, 26 August 2005 03:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.nowhere.com

Rich Kulp <richkulp@us.NO_SPAM.ibm.com> wrote in news:dekjn8$u0k$1
@news.eclipse.org:

> Makre sure that there is a SWT Library container entry in your
> classpath. There should not be a separate external jar entry for just
> swt.jar. It should be a library.

I have "Standard Widget Toolkit(SWT)" library which includes
Access rules:No rules defined
org.eclipse.swt.win32.win32.x86_3.1.0.jar

There were some more when I ticked the include JFace button.

>
> When the editor comes up, are there SWT items on the pallete?
Yes
>
> The example itself is fine. We don't use jvedoc tags that much anymore.
> And for shell, you can create it with the default constructor.
> But for any SWT entries selected from the palette should not use the
> default constructor.
How do I do this?
I don't seem to have a container to add components too.

> Except if 1.4.1 is the java level. You said it was 1.5, but
> are you sure that the project's jre is 1.5, and not just the Eclipse was
> started with 1.5?
Installed JRE in preferences is 1.5.0_04.
I cannot find any reference in the project properties.
Re: Problem creating VE/SWT class [message #103853 is a reply to message #103267] Fri, 26 August 2005 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: xy.daham.com

Hi,

I've the same problem with SWT/JFace & the visual editor like ray.

I've installed:
- jdk 1.5
- eclipse sdk 3.1 (windows)

When I create a visual class with a swt shell I can see only a bean
symbol in the designerview.

import org.eclipse.swt.widgets.Shell;

public class TestShell extends Shell {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

}

}

I've imported the SWT-Library (Standard Widget Toolkit(SWT)) and it
works fine but I've no designer view...

could anybody help me/us

thanx
Thomas
Re: Problem creating VE/SWT class [message #103892 is a reply to message #103853] Fri, 26 August 2005 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

What you got there is invalid because Shell can't be extended. All I can
suggest is to make sure you a new configuration of

Eclipse SDK 3.1
GEF 3.1
EMF 2.1
VE 1.1

just by itself and a new workspace. If it still fails then there is
something strange about your system. If it doesn't fail, then there is
something strange about your previous configuration.


> When I create a visual class with a swt shell I can see only a bean
> symbol in the designerview.
>
> import org.eclipse.swt.widgets.Shell;
>
> public class TestShell extends Shell {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> // TODO Auto-generated method stub
>
> }
>
> }
>

I don't know what you mean by import. You don't import the SWT library.
I presume you mean you did "Add Library..." instead of import.

> I've imported the SWT-Library (Standard Widget Toolkit(SWT)) and it
> works fine but I've no designer view...
>
> could anybody help me/us
>
> thanx
> Thomas

--
Thanks,
Rich Kulp
Re: Problem creating VE/SWT class [message #103992 is a reply to message #103892] Sat, 27 August 2005 08:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: xy.daham.com

so I've update my system and now it's working.
I've install eclipse for some days and thought that I've the latest one,
but it seems it wasn't. I've to update EMF to the version 2.1 ...

many thanks for helping

bye
Tom
Re: Problem creating VE/SWT class [message #104023 is a reply to message #103267] Sun, 28 August 2005 01:50 Go to previous message
Eclipse UserFriend
Originally posted by: none.nowhere.com

I also downloaded and installed EMF 2.1 and it works now.
Thanks
Ray
Re: Problem creating VE/SWT class [message #610366 is a reply to message #103267] Wed, 24 August 2005 13:50 Go to previous message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 396
Registered: July 2009
Senior Member
Ray,

VE development for SWT requires the use of a JRE version 1.4.2 or
greater. Please install a newer JRE and then clean your SWT project.
That should fix the problems you're seeing.

And yes, VE is meant to help you design stand alone SWT applications as
well as RCP apps.

Hope this helps,
- Jeff
Re: Problem creating VE/SWT class [message #610380 is a reply to message #103297] Thu, 25 August 2005 02:11 Go to previous message
Ray Turnbull is currently offline Ray TurnbullFriend
Messages: 4
Registered: July 2009
Junior Member
Jeff Myers <myersj@gmail.com> wrote in
news:dehu0v$ijt$1@news.eclipse.org:

> Ray,
>
> VE development for SWT requires the use of a JRE version 1.4.2 or
> greater. Please install a newer JRE and then clean your SWT project.
> That should fix the problems you're seeing.
>
> And yes, VE is meant to help you design stand alone SWT applications
> as well as RCP apps.
>
> Hope this helps,
> - Jeff

Thanks for the prompt reply. I might reiterate that I am very impressed
with eclipse and the VE (for swing). I think it is a brilliant product
for Java development.


I am using JRE 1.5.0_04. Is this a problem? (I have had another small
unrelated problem with 1.5 in my swing program - on some occasions it
doesn't repaint the screen correctly, running both within eclipse and
outside of it)


A manually written (not VE) SWT HelloWorld program runs OK in eclipse.

Thanks
Ray
Re: Problem creating VE/SWT class [message #610389 is a reply to message #103470] Thu, 25 August 2005 14:14 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Makre sure that there is a SWT Library container entry in your
classpath. There should not be a separate external jar entry for just
swt.jar. It should be a library.

When the editor comes up, are there SWT items on the pallete?

The example itself is fine. We don't use jvedoc tags that much anymore.
And for shell, you can create it with the default constructor. But for
any SWT entries selected from the palette should not use the default
constructor. Except if 1.4.1 is the java level. You said it was 1.5, but
are you sure that the project's jre is 1.5, and not just the Eclipse was
started with 1.5?
--
Thanks,
Rich Kulp
Re: Problem creating VE/SWT class [message #610396 is a reply to message #103610] Fri, 26 August 2005 03:35 Go to previous message
Ray Turnbull is currently offline Ray TurnbullFriend
Messages: 4
Registered: July 2009
Junior Member
Rich Kulp <richkulp@us.NO_SPAM.ibm.com> wrote in news:dekjn8$u0k$1
@news.eclipse.org:

> Makre sure that there is a SWT Library container entry in your
> classpath. There should not be a separate external jar entry for just
> swt.jar. It should be a library.

I have "Standard Widget Toolkit(SWT)" library which includes
Access rules:No rules defined
org.eclipse.swt.win32.win32.x86_3.1.0.jar

There were some more when I ticked the include JFace button.

>
> When the editor comes up, are there SWT items on the pallete?
Yes
>
> The example itself is fine. We don't use jvedoc tags that much anymore.
> And for shell, you can create it with the default constructor.
> But for any SWT entries selected from the palette should not use the
> default constructor.
How do I do this?
I don't seem to have a container to add components too.

> Except if 1.4.1 is the java level. You said it was 1.5, but
> are you sure that the project's jre is 1.5, and not just the Eclipse was
> started with 1.5?
Installed JRE in preferences is 1.5.0_04.
I cannot find any reference in the project properties.
Re: Problem creating VE/SWT class [message #610407 is a reply to message #103267] Fri, 26 August 2005 10:21 Go to previous message
xy is currently offline xyFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

I've the same problem with SWT/JFace & the visual editor like ray.

I've installed:
- jdk 1.5
- eclipse sdk 3.1 (windows)

When I create a visual class with a swt shell I can see only a bean
symbol in the designerview.

import org.eclipse.swt.widgets.Shell;

public class TestShell extends Shell {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

}

}

I've imported the SWT-Library (Standard Widget Toolkit(SWT)) and it
works fine but I've no designer view...

could anybody help me/us

thanx
Thomas
Re: Problem creating VE/SWT class [message #610410 is a reply to message #103853] Fri, 26 August 2005 14:03 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

What you got there is invalid because Shell can't be extended. All I can
suggest is to make sure you a new configuration of

Eclipse SDK 3.1
GEF 3.1
EMF 2.1
VE 1.1

just by itself and a new workspace. If it still fails then there is
something strange about your system. If it doesn't fail, then there is
something strange about your previous configuration.


> When I create a visual class with a swt shell I can see only a bean
> symbol in the designerview.
>
> import org.eclipse.swt.widgets.Shell;
>
> public class TestShell extends Shell {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> // TODO Auto-generated method stub
>
> }
>
> }
>

I don't know what you mean by import. You don't import the SWT library.
I presume you mean you did "Add Library..." instead of import.

> I've imported the SWT-Library (Standard Widget Toolkit(SWT)) and it
> works fine but I've no designer view...
>
> could anybody help me/us
>
> thanx
> Thomas

--
Thanks,
Rich Kulp
Re: Problem creating VE/SWT class [message #610417 is a reply to message #103892] Sat, 27 August 2005 08:44 Go to previous message
xy is currently offline xyFriend
Messages: 29
Registered: July 2009
Junior Member
so I've update my system and now it's working.
I've install eclipse for some days and thought that I've the latest one,
but it seems it wasn't. I've to update EMF to the version 2.1 ...

many thanks for helping

bye
Tom
Re: Problem creating VE/SWT class [message #610419 is a reply to message #103267] Sun, 28 August 2005 01:50 Go to previous message
Ray Turnbull is currently offline Ray TurnbullFriend
Messages: 4
Registered: July 2009
Junior Member
I also downloaded and installed EMF 2.1 and it works now.
Thanks
Ray
Previous Topic:BeanInfo attributes
Next Topic:problem to debug VE into eclipse 3.1.0 ?
Goto Forum:
  


Current Time: Thu Apr 25 21:55:33 GMT 2024

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

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

Back to the top