1 20 21 package org.apache.directory.ldapstudio.browser.ui.actions; 22 23 24 import org.apache.directory.ldapstudio.browser.common.actions.BrowserAction; 25 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants; 26 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin; 27 import org.apache.directory.ldapstudio.browser.ui.wizards.NewEntryWizard; 28 import org.eclipse.jface.resource.ImageDescriptor; 29 import org.eclipse.jface.viewers.IStructuredSelection; 30 import org.eclipse.jface.wizard.WizardDialog; 31 import org.eclipse.ui.IWorkbenchWindow; 32 33 34 40 public class NewEntryAction extends BrowserAction 41 { 42 private IWorkbenchWindow window; 43 44 45 48 public NewEntryAction() 49 { 50 } 51 52 53 59 public NewEntryAction( IWorkbenchWindow window ) 60 { 61 super(); 62 this.window = window; 63 } 64 65 66 69 public void dispose() 70 { 71 super.dispose(); 72 this.window = null; 73 } 74 75 76 79 public void init( IWorkbenchWindow window ) 80 { 81 super.init( window ); 82 this.window = window; 83 } 84 85 86 89 public void run() 90 { 91 NewEntryWizard wizard = new NewEntryWizard(); 92 93 wizard.init( this.window.getWorkbench(), ( IStructuredSelection ) this.window.getSelectionService() 94 .getSelection() ); 95 WizardDialog dialog = new WizardDialog( getShell(), wizard ); 96 dialog.setBlockOnOpen( true ); 97 dialog.create(); 98 dialog.open(); 99 } 100 101 102 105 public String getText() 106 { 107 return "New Entry..."; 108 } 109 110 111 114 public ImageDescriptor getImageDescriptor() 115 { 116 return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_ENTRY_ADD ); 117 } 118 119 120 123 public String getCommandId() 124 { 125 return null; 126 } 127 128 129 132 public boolean isEnabled() 133 { 134 return true; 135 } 136 } 137 | Popular Tags |