Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to refresh/ redraw MPart(How to refresh/ redraw MPart)
How to refresh/ redraw MPart [message #1122124] Tue, 01 October 2013 08:54 Go to next message
sumit singh is currently offline sumit singhFriend
Messages: 135
Registered: October 2012
Location: Bangalore
Senior Member

Is there is any way to redraw or refresh the MPart so that following method will call again.

@PostConstruct
    public void createPartControl(Composite parent) {
 }


Because i want to show one SWT control in this view on some conditions.

[Updated on: Tue, 01 October 2013 08:54]

Report message to a moderator

Re: How to refresh/ redraw MPart [message #1122137 is a reply to message #1122124] Tue, 01 October 2013 09:01 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
Open and close ;-) - but more seriously no, you need to e.g. send an
event to the view so that it disposes its current content and recreates it.

Tom

On 01.10.13 10:54, sumit singh wrote:
> Is there is any way to redraw the MPart so that following method will
> call again.
>
>
> @PostConstruct
> public void createPartControl(Composite parent) {
> }
>
>
> Because i want to show one SWT control in this view on some conditions.
Re: How to refresh/ redraw MPart [message #1122141 is a reply to message #1122137] Tue, 01 October 2013 09:09 Go to previous messageGo to next message
sumit singh is currently offline sumit singhFriend
Messages: 135
Registered: October 2012
Location: Bangalore
Senior Member

Hi Thomas,

Can you please give me one example. Means how to send an
event to the view so that it disposes its current content and recreates it.
Re: How to refresh/ redraw MPart [message #1143706 is a reply to message #1122141] Fri, 18 October 2013 11:16 Go to previous messageGo to next message
Dmitriy Shishkin is currently offline Dmitriy ShishkinFriend
Messages: 20
Registered: May 2012
Junior Member
Just invoke createPartControl on refresh event
@PostConstruct
public void createPartControl(Composite parent) {
   ...
}
@Inject
@Optional 
public void refresh(@UIEventTopic("Refresh-Part") String event, Composite parent) {
   createPartControl(parent)
}


or annotate createPartControl with @Inject and @Optional

@PostConstruct
@Inject
@Optional
public void createPartControl(Composite parent, @Optionsl @UIEventTopic("Refresh-Part") String event) {
   ...
}


I hope it will be useful for you
Dmitriy.
Re: How to refresh/ redraw MPart [message #1143712 is a reply to message #1143706] Fri, 18 October 2013 11:20 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5470
Registered: July 2009
Senior Member
On 18.10.13 13:16, Dmitriy Shishkin wrote:
> Just invoke createPartControl on refresh event
> @PostConstruct
> public void createPartControl(Composite parent) {
> ...
> }
> @Inject
> @Optional public void refresh(@UIEventTopic("Refresh-Part") String
> event, Composite parent) {
> createPartControl(parent)
> }
>

This is correct!

> or annotate createPartControl with @Inject and @Optional
>
> @PostConstruct
> @Inject
> @Optional
> public void createPartControl(Composite parent, @Optionsl
> @UIEventTopic("Refresh-Part") String event) {
> ...
> }
>
>

This is a very bad advice!

Tom
Re: How to refresh/ redraw MPart [message #1173546 is a reply to message #1143712] Wed, 06 November 2013 15:47 Go to previous message
Dmitriy Shishkin is currently offline Dmitriy ShishkinFriend
Messages: 20
Registered: May 2012
Junior Member
Quote:

> @PostConstruct
> @Inject
> @Optional
> public void createPartControl(Composite parent, @Optionsl
> @UIEventTopic("Refresh-Part") String event) {
> ...
> }
>
>

This is a very bad advice!

Tom

Why that approach is so bad?

Dmitriy.
Previous Topic:How to set start perspective
Next Topic:InjectionException when attempting to send a map on event bus
Goto Forum:
  


Current Time: Sat Nov 29 04:02:19 GMT 2014

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

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