Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Menu Save and SaveAs
Menu Save and SaveAs [message #492256] Mon, 19 October 2009 15:40 Go to next message
kai guo is currently offline kai guoFriend
Messages: 6
Registered: July 2009
Junior Member
Hello Everyone,

I want to add save menu to my RCP product.
in ApplicationActionBarAdvisor I add folling code:

@Override
protected void makeActions(IWorkbenchWindow window) {
file_saveFileAction= ActionFactory.SAVE.create(window);
register(file_saveFileAction);
}

@Override
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("&File", Menus.File.name());
menuBar.add(fileMenu);
fileMenu.add(file_saveFileAction);
}

but the save menu is always unenabled. could someone please help me?

kind regard
kai
Re: Menu Save and SaveAs [message #492266 is a reply to message #492256] Mon, 19 October 2009 17:09 Go to previous messageGo to next message
Millard Ellingsworth is currently offline Millard EllingsworthFriend
Messages: 14
Registered: July 2009
Junior Member
Hi, Kai.

I think the Save action is wired into the Editor framework and will be automatically enabled if you have an open Editor with unsaved changes. You didn't indicate in what context you expected the Save to be enabled.

At least in the applications I've done, what you have done should work correctly when you have Editor support and a "dirty" Editor.

Millard
Re: Menu Save and SaveAs [message #492268 is a reply to message #492256] Mon, 19 October 2009 16:49 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
kai guo wrote:
> but the save menu is always unenabled. could someone please help me?

Check whether IEditorPart.isDirty() returns true.

- Prakash

Platform UI Team, IBM
http://blog.eclipse-tips.com
Re: Menu Save and SaveAs [message #492373 is a reply to message #492268] Tue, 20 October 2009 09:35 Go to previous messageGo to next message
kai guo is currently offline kai guoFriend
Messages: 6
Registered: July 2009
Junior Member
Hi Millard and Prakash

thanks for your replay, now my isDirty() returns always true. the save menu works. I also add a saveAs menu and I want to save a file at a new position. but when I click the saveAs menu, it did nothing. what should I do now?
Re: Menu Save and SaveAs [message #492480 is a reply to message #492268] Tue, 20 October 2009 15:05 Go to previous message
Millard Ellingsworth is currently offline Millard EllingsworthFriend
Messages: 14
Registered: July 2009
Junior Member
Did you implement doSaveAs() in your EditorPart? Does a breakpoint in that code _not_ get hit when you invoke Save As...? Just like you have to implement doSave() in order for Save to work, you have to implement doSaveAs() if you want Save As... to work.
Previous Topic:Debug perspective
Next Topic:Licensing / Simple popup window - [SOLVED]
Goto Forum:
  


Current Time: Thu Apr 25 06:21:45 GMT 2024

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

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

Back to the top