Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » e4 opening parts
e4 opening parts [message #1008462] Tue, 12 February 2013 15:28 Go to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
I have created part in application model and unchecked "To be rendered" check for this part. Now i want to open and show this part. I have created OpenPartHandler :
public class OpenPartHandler {
	@Execute
	  public void execute(EPartService partService) {
		MPart part = partService.showPart("part",PartState.VISIBLE);
		part.setVisible(true);
	  }

	  // Technically not needed
	  // will default to true
	  @CanExecute
	  public boolean canExecute() {
	    return true;
	  }
}

Is this normal approach for creating parts?
Re: e4 opening parts [message #1008492 is a reply to message #1008462] Tue, 12 February 2013 17:38 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
I don't think you need to call setVisible(true) and yes tbr is the right
thing to mark things not to be visible.

Did you only ask to make sure you are doing the right thing or does it
not work?

Tom

Am 12.02.13 16:28, schrieb Alex Mising name:
> I have created part in application model and unchecked "To be rendered"
> check for this part. Now i want to open and show this part. I have
> created OpenPartHandler :
>
> public class OpenPartHandler {
> @Execute
> public void execute(EPartService partService) {
> MPart part = partService.showPart("part",PartState.VISIBLE);
> part.setVisible(true);
> }
>
> // Technically not needed
> // will default to true
> @CanExecute
> public boolean canExecute() {
> return true;
> }
> }
>
> Is this normal approach for creating parts?
Re: e4 opening parts [message #1008497 is a reply to message #1008492] Tue, 12 February 2013 18:03 Go to previous messageGo to next message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Tom, thank you for reply. This work but i have another problem. When i'm closing my parts i see in profiler that they disposed not immediately and i can open second instance of part. How can i make part singleton?

[Updated on: Tue, 12 February 2013 18:03]

Report message to a moderator

Re: e4 opening parts [message #1008533 is a reply to message #1008497] Tue, 12 February 2013 21:46 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 5487
Registered: July 2009
Senior Member
Can you clarify what you mean with disposed. The MPart instance is not
NOT removed from the model but tbr is set to false only. If it should be
removed from the model when closed you need to tag it with "removeOnHide".

Tom

Am 12.02.13 19:03, schrieb Alex Mising name:
> Tom, thank you for reply. This work but i have another problem. When i'm
> closing my parts i see in profiler that they disposed not immediately
> and i can open second instance of part. How can i make part singleton?
Re: e4 opening parts [message #1008571 is a reply to message #1008533] Wed, 13 February 2013 06:11 Go to previous message
Alex Mising name is currently offline Alex Mising nameFriend
Messages: 61
Registered: February 2011
Member
Ok, i don't want to remove part from model. But how can i setup model or part only to have one instance?
Previous Topic:Clearing model data without clearing preferences
Next Topic:Persisting the Eclipse Application?
Goto Forum:
  


Current Time: Sun Dec 21 14:27:19 GMT 2014

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

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