Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How do I disable the File menu item - Save?
How do I disable the File menu item - Save? [message #329719] Tue, 01 July 2008 21:12 Go to next message
Ray Hurst is currently offline Ray HurstFriend
Messages: 121
Registered: July 2009
Senior Member
I implemented an object editor that performs the open-save-close
operation on a specific file extension. However, I allow files with a
different extension to be opened (Open With/Other../MyEditor) and the
file contents are converted to the file format of the object file.

When I open a file with the non-default extension the file is marked
dirty to force a "SaveAs" operation. However, the "Save" operation is
also enabled. This should be disabled as the file is not the default
file type extension. So how do I disable the "Save" operation in the
File menu?

Also, when I do perform a "SaveAs" operation the filename does not
change to the new filename. Do I have to do this programmatically? If
so, what is the preferred method?
Ray
Re: How do I disable the File menu item - Save? [message #329721 is a reply to message #329719] Tue, 01 July 2008 22:15 Go to previous messageGo to next message
Ray Hurst is currently offline Ray HurstFriend
Messages: 121
Registered: July 2009
Senior Member
It looks like the "Save" and "Save As" operations cannot be disabled (
always enabled).
Is this correct?
If so, then I must detect in the "Save" operation that the filename is
incorrect and divert it to the "Save As" operation. Correct?

Do I need to use the IReuseableEditor part for this?
Does the IReuseableEditor part fix the filename issue on the "Save As"
command?
Ray


Ray Hurst wrote:
> I implemented an object editor that performs the open-save-close
> operation on a specific file extension. However, I allow files with a
> different extension to be opened (Open With/Other../MyEditor) and the
> file contents are converted to the file format of the object file.
>
> When I open a file with the non-default extension the file is marked
> dirty to force a "SaveAs" operation. However, the "Save" operation is
> also enabled. This should be disabled as the file is not the default
> file type extension. So how do I disable the "Save" operation in the
> File menu?
>
> Also, when I do perform a "SaveAs" operation the filename does not
> change to the new filename. Do I have to do this programmatically? If
> so, what is the preferred method?
> Ray
Re: How do I disable the File menu item - Save? [message #329748 is a reply to message #329721] Wed, 02 July 2008 14:48 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Ray Hurst wrote:
> It looks like the "Save" and "Save As" operations cannot be disabled (
> always enabled).
> Is this correct?
> If so, then I must detect in the "Save" operation that the filename is
> incorrect and divert it to the "Save As" operation. Correct?

You should be able to do this in your EditorPart's doSave(*) method ...
maybe examining your IEditorInput and diverting to your doSaveAs(*) method.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:efs usage in team/cvs plugin
Next Topic:What happened to the feature concept in Ganymede
Goto Forum:
  


Current Time: Sun Jun 30 09:04:37 GMT 2024

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

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

Back to the top