Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » WindowBuilder » Support for Eclipse 4 Parts planned?
Support for Eclipse 4 Parts planned? [message #786628] Mon, 30 January 2012 16:55 Go to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

I updated my Eclipse 4 Tutorial .

Using WindowBuilder for Eclipse 4 Parts is relatively simple, I just have to wrap the whole content of @PostConstruct into a composite and work with WindowBuilder on this composite.

Is it planned to have direct support for Parts in WindowBuilder? I have no idea about the internal structure of WindowBuilder but I think you could treat @PostConstruct similar to the createPartControl() method of ViewPart.
Re: Support for Eclipse 4 Parts planned? [message #787017 is a reply to message #786628] Tue, 31 January 2012 03:50 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
Do you have a suggested template(s) we should use for new, clean e4 parts?
Re: Support for Eclipse 4 Parts planned? [message #787165 is a reply to message #787017] Tue, 31 January 2012 08:29 Go to previous messageGo to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

The following would be a simple Part definition without any controls. The names of the methods are flexible with Eclipse 4, I like the existing ones, except that I added a "s" to the old createPartControl method.


package com.example.e4.rcp.todo.parts;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

import org.eclipse.swt.widgets.Composite;

public class TodoDetailsPart {

@PostConstruct
public void createControls(Composite parent) {
}

@PreDestroy
public void dispose() {

}

@Focus
public void setFocus() {
// TODO Set Focus to control
}


}

[EDIT: Focus is mandatory, got confirmation from Remy Suen via IRC, changed method name to createControls()]

[Updated on: Wed, 01 February 2012 21:13]

Report message to a moderator

Re: Support for Eclipse 4 Parts planned? [message #790106 is a reply to message #787165] Fri, 03 February 2012 20:40 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Hm...
I've downloaded Eclipse 4.2M5 SDK, but I don't see "e4 Application Project" wizard.


Konstantin Scheglov,
Google, Inc.
Re: Support for Eclipse 4 Parts planned? [message #791748 is a reply to message #790106] Mon, 06 February 2012 08:07 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Am 03.02.12 21:40, schrieb Konstantin Scheglov:
> Hm...
> I've downloaded Eclipse 4.2M5 SDK, but I don't see "e4 Application
> Project" wizard.

You need to install the e4 tools from the e4 update site [1].

Tom

[1]http://download.eclipse.org/e4/downloads/drops/S-0.12M5-201201271145/index.html
Re: Support for Eclipse 4 Parts planned? [message #794068 is a reply to message #791748] Wed, 08 February 2012 22:13 Go to previous messageGo to next message
Konstantin Scheglov is currently offline Konstantin ScheglovFriend
Messages: 555
Registered: July 2009
Senior Member
Ah...
Thank you, Tom.


Konstantin Scheglov,
Google, Inc.
Re: Support for Eclipse 4 Parts planned? [message #1230040 is a reply to message #794068] Fri, 10 January 2014 21:16 Go to previous messageGo to next message
kon f is currently offline kon fFriend
Messages: 152
Registered: March 2012
Senior Member
Hey,

I was able to builder a part with the WindowBuilder - pretty nice. I also tried to build a composite that conforms the e4 style since I usually compose my parts out of multiple composites. Unfortunately, it did not work as expected. This is my result:

public class MyComposite extends Composite {

	public MyComposite(Composite parent, int style) {
		super(parent, style);

		createContents();
	}

	private void createContents() {
		Button btnNewButton = new Button(this, SWT.NONE);
		btnNewButton.setBounds(0, 0, 91, 29);
		btnNewButton.setText("New Button");
	}

	@Override
	protected void checkSubclass() {
		// Disable the check that prevents subclassing of SWT components
	}
}


Am I doing it wrong? I would have expected a @PostConstruct annotation being able to use the eclipse context. Has anyone else tried to create a composite with die WindowBuilder so far? Thank you!

Kon
Re: Support for Eclipse 4 Parts planned? [message #1233095 is a reply to message #1230040] Sat, 18 January 2014 16:15 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
The current Composite creation support creates generic SWT Composite classes that can be used in any SWT/RCP app. It does not generate e4 specific code in that case as that would limit where the code could be used. It would not be very hard to add an e4 Composite wizard/template. That isn't something we plan to do, but we are very open to contributions.
Re: Support for Eclipse 4 Parts planned? [message #1233123 is a reply to message #1233095] Sat, 18 January 2014 18:03 Go to previous messageGo to next message
kon f is currently offline kon fFriend
Messages: 152
Registered: March 2012
Senior Member
Hey Eric,

the wizard would be the cherry on top Smile But for me it would be really nice being able to use WindowBuilder and Composites in the e4 specific way. For instance, the following example is not recognized by WindowBuilder in the Design tab.

public class MyComposite extends Composite {

	@Inject
	private IEclipseContext context;

	public MyComposite(Composite parent, int style) {
		super(parent, style);
	}

	@PostConstruct
	private void createContents() {
		Text text = new Text(this, SWT.BORDER);
		text.setText(".....");
                
		// here I'm able to use the context
	}
}


It would help a lot if this e4 specific code would be recognized by WindowBuilder.

Thank you.

Kon
Re: Support for Eclipse 4 Parts planned? [message #1233192 is a reply to message #1233123] Sat, 18 January 2014 22:41 Go to previous messageGo to next message
Eric Clayberg is currently offline Eric ClaybergFriend
Messages: 979
Registered: July 2009
Location: Boston, MA
Senior Member
Try adding the following line to the constructor...

if (java.beans.Beans.isDesignTime()) this.createContents();

Re: Support for Eclipse 4 Parts planned? [message #1243661 is a reply to message #786628] Tue, 11 February 2014 09:15 Go to previous message
kon f is currently offline kon fFriend
Messages: 152
Registered: March 2012
Senior Member
Hey Eric,

thank you for the workaround Smile

Kon
Previous Topic:Jbuilder
Next Topic:Elements appear disordered
Goto Forum:
  


Current Time: Fri Apr 19 14:31:49 GMT 2024

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

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

Back to the top