1 package org.hibernate.eclipse.console; 2 3 4 5 import org.eclipse.jface.action.IAction; 6 import org.eclipse.jface.viewers.ISelection; 7 import org.eclipse.ui.IWorkbenchPage; 8 import org.eclipse.ui.IWorkbenchWindow; 9 import org.eclipse.ui.IWorkbenchWindowActionDelegate; 10 import org.eclipse.ui.PartInitException; 11 import org.eclipse.ui.PlatformUI; 12 import org.hibernate.eclipse.console.editors.HQLEditor; 13 import org.hibernate.eclipse.console.editors.HQLEditorInput; 14 15 16 public class OpenHQLEditorAction implements IWorkbenchWindowActionDelegate { 17 public OpenHQLEditorAction() { 18 } 19 20 public void run(IAction action) { 21 try { 22 final IWorkbenchWindow activeWorkbenchWindow = 23 PlatformUI.getWorkbench().getActiveWorkbenchWindow(); 24 IWorkbenchPage page = activeWorkbenchWindow.getActivePage(); 25 final HQLEditorInput editorInput = 26 new HQLEditorInput("<enter hql here>"); 27 page.openEditor(editorInput, HQLEditor.ID, true); 28 } catch (PartInitException e) { 29 throw new RuntimeException ("Problem creating editor", e); 30 } 31 } 32 33 public void selectionChanged(IAction action, ISelection selection) { 34 } 35 36 public void dispose() { 37 } 38 39 public void init(IWorkbenchWindow window) { 40 } 41 } 42 | Popular Tags |