Asterisk in the editor's title [message #461028] |
Wed, 03 January 2007 22:37 |
Eclipse User |
|
|
|
Originally posted by: sbonatesta.alice.it
Hi all, I hope someone can help me... I have an editor in my RCP application and it is working well. Now I want to keep track of modification. When I run the app and modify the editor's content, the dirty flag is effectively turned to "true" and when I close the editor it asks me if I want to save changes. But seems that eclipse does not refresh the title of the editor, adding the asterisk. The asterisk in the title of the editor appears only when I move manually the editor from its place, even if I call firePropertyChange(PROP_DIRTY). Any idea?
|
|
|
Re: Asterisk in the editor's title [message #461048 is a reply to message #461028] |
Thu, 04 January 2007 13:26 |
Eclipse User |
|
|
|
Originally posted by: sbonatesta.alice.it
The problem is that firePropertyChange(PROP_DIRTY) takes no effect. I call it in an EditorPart, so PROP_DIRTY is EditorPart.PROP_DIRTY. But now my problem is still unresolved, why it takes no effect? The dirty flag is true... Thanks in advance!
|
|
|
|
Re: Asterisk in the editor's title [message #461065 is a reply to message #461048] |
Thu, 04 January 2007 16:35 |
Eclipse User |
|
|
|
Originally posted by: sbonatesta.alice.it
Ok, I solved the problem and now I write you the solution, in case it is useful.
I get an InvalidThreadAccess Exception in WorkbenchPart class when I call the firePropertyChange mathod. The problem was that I didn't use a separate thread. The right way to call the method is something like this
public void setDirty(boolean modified){
isDirty = modified;
Runnable r= new Runnable() {
public void run() {
firePropertyChange(PROP_DIRTY);
}
};
execute(r, false);
}
private void execute(Runnable runnable, boolean postAsync) {
if (postAsync || Display.getCurrent() == null) {
if (fDisplay == null)
fDisplay= getSite().getShell().getDisplay();
fDisplay.asyncExec(runnable);
}
else
runnable.run();
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.02136 seconds