Skip to main content



      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 04:30 Go to next message
Eclipse UserFriend
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 08:48 Go to previous messageGo to next message
Eclipse UserFriend


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 04:17 Go to previous messageGo to next message
Eclipse UserFriend
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 05:16 Go to previous message
Eclipse UserFriend
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: Sun Nov 02 09:44:51 EST 2025

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

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

Back to the top