|
|
Re: How to change the color of elements programmatically [message #692924 is a reply to message #692762] |
Tue, 05 July 2011 13:19 |
|
Le 05/07/2011 09:35, Neslepaks a écrit :
> I can get the color of ShapeImpl of the elements with a code like
> si.getFillColor() but setting the color with si.setFillColor(10000000)
> throws an exception:
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
>
> How should I do the write transaction?
Not tested, but probably something like:
TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(shape);
ted.getCommandStack().execute(new RecordingCommand(ted) {
protected void doExecute() {
shape.setFillColor(myColor);
}
});
Pierre-Charles David - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03884 seconds