How to force GraphicalEditor to be Dirty [message #247495] |
Mon, 23 February 2009 17:35  |
Eclipse User |
|
|
|
Hi All
Q: How to force GraphicalEditor to be Dirty
I am using GEF GraphicalEditor just to display my model, without any
palette. I have a GraphicalEditor actions contributed through
ActionBarContributor. When users click on this action button, the program
updates the model and visuals. As I am not using any commands to update
the model, the GraphicalEditor is always un-dirty.
In the action class [extends SelectionAction], am able to get model
editparts. At this class I wanted to set my GraphicalEditor to Dirty
after I update the model programmatically.
Can you please advice me, whether it is possible to do so?
My GraphicalEditor has:
public boolean isDirty() {
return dirty;
}
public void setDirty(boolean value) {
dirty = value;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
MyActionClass has:
private boolean canPerformAction() {
boolean canPerformActionStatus = false;
if (getSelectedObjects().isEmpty()){
canPerformActionStatus = false;
}else{
List selectedEditParts = getSelectedObjects();
for (int i=0; i<selectedEditParts.size(); i++){
Object selectedObject = selectedEditParts.get(i);
if (selectedObject instanceof EditPart)){
canPerformActionStatus = true;
}
}
}
return canPerformActionStatus;
Thanks for your Hellp
Cheers
DJ
|
|
|
Re: How to force GraphicalEditor to be Dirty [message #247515 is a reply to message #247495] |
Tue, 24 February 2009 19:38  |
Eclipse User |
|
|
|
The simplest option is probably to execute a dummy command on the command
stack.
"DJ" <dushidushy@yahoo.co.in> wrote in message
news:7b950dbf298f178621239d95e230671c$1@www.eclipse.org...
> Hi All
>
> Q: How to force GraphicalEditor to be Dirty
> I am using GEF GraphicalEditor just to display my model, without any
> palette. I have a GraphicalEditor actions contributed through
> ActionBarContributor. When users click on this action button, the program
> updates the model and visuals. As I am not using any commands to update
> the model, the GraphicalEditor is always un-dirty.
> In the action class [extends SelectionAction], am able to get model
> editparts. At this class I wanted to set my GraphicalEditor to Dirty
> after I update the model programmatically.
>
> Can you please advice me, whether it is possible to do so?
>
> My GraphicalEditor has:
> public boolean isDirty() { return dirty;
> }
> public void setDirty(boolean value) { dirty = value;
> firePropertyChange(IEditorPart.PROP_DIRTY); }
> MyActionClass has: private boolean canPerformAction() {
> boolean canPerformActionStatus = false;
> if (getSelectedObjects().isEmpty()){
> canPerformActionStatus = false;
> }else{
> List selectedEditParts = getSelectedObjects();
> for (int i=0; i<selectedEditParts.size(); i++){
> Object selectedObject = selectedEditParts.get(i);
> if (selectedObject instanceof EditPart)){
> canPerformActionStatus = true;
> }
> }
> }
> return canPerformActionStatus;
>
>
> Thanks for your Hellp
> Cheers
> DJ
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08183 seconds