Skip to main content


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: 141
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: 6651
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: 141
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: 6651
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: Fri Mar 29 02:35:06 GMT 2024

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

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

Back to the top