Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » apply changes to mutiple nodes
apply changes to mutiple nodes [message #122596] Mon, 30 April 2007 11:38 Go to next message
Eclipse UserFriend
Originally posted by: john.blutarsky.hotmail.com

Hello All,

I was wondering if it is possible to apply changes in the properties
across multiple nodes, all of the same type, within an editor. I can
access and change properties of single node but is it possible to do this
with a group of nodes that has been highlighted/selected? I would like to
group a number of nodes and change either their property value or their
appearance (a different colour). While I can access and alter the
properties of a single node, how could I do this with multiple nodes?

Thank you for your help.

John

I access node property values with an editpolicy along the lines of:

public class ChangePropEditPolicy extends OpenEditPolicy {


protected Command getOpenCommand(Request request) {
EditPart targetEditPart = getTargetEditPart(request);
if (targetEditPart instanceof IGraphicalEditPart == false)
return null;

IGraphicalEditPart editPart = (IGraphicalEditPart) targetEditPart;
EObject modelElement = editPart.resolveSemanticElement();


final TransactionalEditingDomain editingDomain =
TransactionUtil.getEditingDomain(modelElement);
….
AbstractTransactionalCommand setNewPropertyCommand…
…


I edit the properties with the command setNewPropertyCommand, goes like:



public class setNewPropertyCommand extends AbstractTransactionalCommand {
private static String label = "Change Prop Command";

NodeA nodea;

String newName;


public ChangePropCommand(TransactionalEditingDomain domain, NodeA nodea,
String newName) {

super(domain, label, getWorkspaceFiles(nodea));
this.nodea = nodea;
this.newName = newName;

}

@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
nodea.setName(newName);

return CommandResult.newOKCommandResult();
}

}
Re: apply changes to mutiple nodes [message #124824 is a reply to message #122596] Tue, 08 May 2007 09:20 Go to previous message
Eclipse UserFriend
Originally posted by: john.blutarsky.hotmail.com

Hello,

Would someone be able to help me out with this problem?

Regards,

John
Previous Topic:Strange behaviour of the GMF-RCP editor
Next Topic:GMF and SWT widgets
Goto Forum:
  


Current Time: Mon Jul 14 02:52:22 EDT 2025

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

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

Back to the top