Wednesday, 15 September 2010

java - GMF - Compartment expand/collapse programmatically -



java - GMF - Compartment expand/collapse programmatically -

i have class called entitiescontainer holds multiple compartments.

what did basically, when right click on compartment or compartmentname hear event through double click listener applied both compartmentxeditpart , compartmentxnameeditpart.

now, accomplish expanding or collapsing compartment based on double click havent found way this. how can approach through editpart of compartment?

also possible close other compartments when 1 opens, , if has done addsemanticlisteners-listenerfilters ?

any clues appreciated.

to expand/collapse compartment you'd need create changepropertyvaluerequest, command request compartment editpart , execute command on command stack (expand boolean):

changepropertyvaluerequest request = new changepropertyvaluerequest( diagramuimessages.propertydescriptorfactory_collapsecompartment, properties.id_collapsed, expand); getdomain().getcommandstack().execute(command);

yes open/close other compartments purchase creating same request , creating commands (exactly shown above) sibling compartment editparts. complication you'd have find sibling compartment editoarts in editparts tree. 1 time have number of these commands wrap them in gef's compoundcommand or gmf's compositecommand such number of commands executed 1 command , undo/redo actions treat case correctly. (have @ org.eclipse.gmf.runtime.diagram.ui.internal.tools.compartmentcollapsetracker)

java eclipse-plugin modeling eclipse-gmf

No comments:

Post a Comment