apply changes to mutiple nodes [message #122596] |
Mon, 30 April 2007 11:38  |
Eclipse User |
|
|
|
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();
}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.04474 seconds