Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Parts from a perspective that is not active are not closed
Parts from a perspective that is not active are not closed [message #1716092] Tue, 01 December 2015 09:30 Go to next message
Xavipen Mising name is currently offline Xavipen Mising nameFriend
Messages: 59
Registered: March 2011
Member
I have an e4 application that has two perspective:
1) Operations
2) Configuration -> Contains (among other things) a part stack where the configurations are opened.( Each configuration in a part)

When a new model is loaded all configuration parts are to be closed. This works fine if I load the new model when the configuration perspective is active.

However, if I open some configurations in the Configuration Perspective. Switch to the Operations perspective and load a new model. I can see in the logs that the code to close the parts is called and everything seems to be alright. However, when i switch back to the configuration perspective the parts are still visible an open.

Could somebody tell me how to make sure that the parts are close, regardless of the active perspective?

Cheers,
Re: Parts from a perspective that is not active are not closed [message #1716681 is a reply to message #1716092] Mon, 07 December 2015 13:48 Go to previous messageGo to next message
Xavipen Mising name is currently offline Xavipen Mising nameFriend
Messages: 59
Registered: March 2011
Member


I found a "workaround" to solve my issue.

I had an event thrown to detect the model load as follows and use it to "close"/hide the parts:

@Inject @Optional
void modelLoadedHandler(@UIEventTopic(STUConstants.UI_TOPIC_CONFIG_LOADED) Object nothing) {        
    

    //Close open config parts
    MPartStack stack = (MPartStack) modelService
            .find(STUConstants.PART_STACK_ID_CONFIG_VIEW,
                    application);
    List<MStackElement> parts = new ArrayList<>(stack.getChildren());

    MPart mpart;
    for (MStackElement element : parts) {
        mpart = (MPart) element;

        log.error("Removing part {} visible {}", mpart.getElementId(), mpart.isVisible());
        partService.hidePart(mpart, true);
    }

    // Adding this make it work regardless of which perspective is 
    // active. Otherwise parts are only gone is the active perspective is 
   // Configuration
    stack.getChildren().clear();
}


Adding the stack.getChildren().clear(); did the trick. I am not hundred percent wether that would be the right way to deal with this, as i would have though that the PartStack should be emptied automatically when i remove a part.

Cheers,
Re: Parts from a perspective that is not active are not closed [message #1717138 is a reply to message #1716681] Thu, 10 December 2015 09:17 Go to previous messageGo to next message
Sascha Hanke is currently offline Sascha HankeFriend
Messages: 21
Registered: April 2014
Location: Germany
Junior Member
Did you try to add the "removeOnHide" tag to the parts you're removing in the Application.e4xmi?

index.php/fa/24268/0/
Re: Parts from a perspective that is not active are not closed [message #1717152 is a reply to message #1716092] Thu, 10 December 2015 10:16 Go to previous message
Sascha Hanke is currently offline Sascha HankeFriend
Messages: 21
Registered: April 2014
Location: Germany
Junior Member
Did you try to add the "removeOnHide" tag to the parts you're removing in the Application.e4xmi?

index.php/fa/24268/0/
Previous Topic:sub menu in a popup menu are displayed only once
Next Topic:Dependencies of same plugin with different versions
Goto Forum:
  


Current Time: Fri Apr 19 01:33:15 GMT 2024

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

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

Back to the top