[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.rcp] Re: open file action ...
|
- From: Julian <juli@xxxxxxx>
- Date: Wed, 16 Apr 2008 12:09:02 -0300
- Newsgroups: eclipse.platform.rcp
- Organization: EclipseCorner
- User-agent: Thunderbird 2.0.0.12 (Windows/20080213)
KarSc wrote:
Hi all
I would like to add to my RCP application, in the FILE menu, the "open file
..." menu item and hook it with the open action from the main view i have
got .
I have done this for the SAVE action
From ActionBarAdvisor
saveAction = ActionFactory.SAVE.create(window);
register(saveAction);
and managed to hook the real action from the view with the menu button ...
what shall I do for the OPEN FILE?
Thanks for any help
Kar
Hi, here's a sample.
Hope it helps.. ;)
public class OpenAction extends Action{
final IWorkbench workbench = YOURUIPlugin.getDefault().getWorkbench();
public OpenAction(){
super("Open", YOURUIPlugin.getImageDescriptor("/icons/open.png"));
}
public void run(){
final Shell shell = workbench.getActiveWorkbenchWindow().getShell();
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
String path = dialog.open();
if(!FileManager.getInstance().isOpen(path) && path != null){
try{
__Do what you want__
} catch (Exception e) {
e.printStackTrace();
}
}
}
}