Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Dynamically creating SWT components in e4 parts
Dynamically creating SWT components in e4 parts [message #1031883] Tue, 02 April 2013 06:25 Go to next message
Peeyush Deshpande is currently offline Peeyush Deshpande
Messages: 12
Registered: March 2013
Junior Member
Hi,

I am using SWT with eclipse 4. I have created two parts. I have a SWT button in first part and on its click event I want to add a new button on the second part.

I tried to implement a simple UI as in
http://www.vogella.com/articles/EclipseRCP/article.html#tutorial_maps

and I was able to load maps of different cities on the button clicks, but not able to do it for creating a new component on button click. Initially I want my second part to be blank.

Thanks,
Peeyush

Re: Dynamically creating SWT components in e4 parts [message #1031909 is a reply to message #1031883] Tue, 02 April 2013 07:08 Go to previous messageGo to next message
Peeyush Deshpande is currently offline Peeyush Deshpande
Messages: 12
Registered: March 2013
Junior Member
@PostConstruct
static void addButton()
{
but1 = new Button (parentTemp, SWT.BORDER);
but1.setText ("C-"+counter);
but1.setVisible(true);
}

Worked. But have to minimize or maximize the window to see the change. Working on how to refresh it through the code. Smile
ANybody knows about it ?
Re: Dynamically creating SWT components in e4 parts [message #1032785 is a reply to message #1031883] Wed, 03 April 2013 08:35 Go to previous message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

Peeyush Deshpande wrote on Tue, 02 April 2013 12:25
Hi,

I am using SWT with eclipse 4. I have created two parts. I have a SWT button in first part and on its click event I want to add a new button on the second part.


Use the IEventBroker to publish an event on the bus when the first button is called and have the second part register a listener method through DI (@UIEventTopic etc.) and add the second button in this method. This way you have no coupling whatsoever between parts and composites.
Previous Topic:exposing eclipse 3.x resources trough a e4.tools service
Next Topic:Setting ToolItem Alignment
Goto Forum:
  


Current Time: Wed Aug 20 20:35:50 EDT 2014

Powered by FUDForum. Page generated in 0.01766 seconds