Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Asterisk in the editor's title
Asterisk in the editor's title [message #461028] Wed, 03 January 2007 22:37 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #461050 is a reply to message #461028] Thu, 04 January 2007 13:39 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Steven Goodhead wrote:

>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?
>
>
Make sure yourEditor.isDirty() is correctly implemented.

Dani
Re: Asterisk in the editor's title [message #461065 is a reply to message #461048] Thu, 04 January 2007 16:35 Go to previous messageGo to next message
Eclipse UserFriend
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();
}
Re: Asterisk in the editor's title [message #461067 is a reply to message #461065] Thu, 04 January 2007 16:40 Go to previous message
Eclipse UserFriend
Originally posted by: sbonatesta.alice.it

Thank u Dani , I don't know if this is the right way to implement the editor, but it works :D
Previous Topic:Add icon association own file
Next Topic:My RCP app wont run witnout -ws gtk
Goto Forum:
  


Current Time: Thu Apr 18 13:08:46 GMT 2024

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

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

Back to the top