Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to force GraphicalEditor to be Dirty
How to force GraphicalEditor to be Dirty [message #247495] Mon, 23 February 2009 22:35 Go to next message
Dushyanth is currently offline DushyanthFriend
Messages: 13
Registered: July 2009
Junior Member
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] Wed, 25 February 2009 00:38 Go to previous message
Felix L J Mayer is currently offline Felix L J MayerFriend
Messages: 202
Registered: July 2009
Senior Member
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
>
>
>
Previous Topic:[Announce] GEF 3.5.0 I200902051436 is available
Next Topic:Problem with com.ibm.icu and Bidi in draw2d
Goto Forum:
  


Current Time: Tue Dec 23 04:32:27 GMT 2014

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

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