Skip to main content


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 10:25 Go to next message
Peeyush Deshpande is currently offline Peeyush DeshpandeFriend
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 11:08 Go to previous messageGo to next message
Peeyush Deshpande is currently offline Peeyush DeshpandeFriend
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 12:35 Go to previous message
Eclipse UserFriend
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:Fixed delay when opening file in editor (and some other actions)
Goto Forum:
  


Current Time: Thu Mar 28 12:20:07 GMT 2024

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

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

Back to the top