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.ldifeditor.LdifEditorActivator; 26 import org.apache.directory.ldapstudio.ldifeditor.LdifEditorConstants; 27 import org.apache.directory.ldapstudio.ldifeditor.editor.LdifEditor; 28 import org.apache.directory.ldapstudio.ldifeditor.editor.NonExistingLdifEditorInput; 29 import org.eclipse.jface.resource.ImageDescriptor; 30 import org.eclipse.ui.IEditorInput; 31 import org.eclipse.ui.IWorkbenchPage; 32 import org.eclipse.ui.PartInitException; 33 import org.eclipse.ui.PlatformUI; 34 35 36 42 public class NewLdifFileAction extends BrowserAction 43 { 44 48 public NewLdifFileAction() 49 { 50 super(); 51 } 52 53 54 57 public void run() 58 { 59 IEditorInput input = new NonExistingLdifEditorInput(); 60 String editorId = LdifEditor.getId(); 61 try 62 { 63 IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); 64 page.openEditor( input, editorId ); 65 } 66 catch ( PartInitException e ) 67 { 68 } 69 } 70 71 72 75 public String getText() 76 { 77 return "New LDIF File"; 78 } 79 80 81 84 public ImageDescriptor getImageDescriptor() 85 { 86 return LdifEditorActivator.getDefault().getImageDescriptor( LdifEditorConstants.IMG_LDIFEDITOR_NEW ); 87 } 88 89 90 93 public String getCommandId() 94 { 95 return null; 96 } 97 98 99 102 public boolean isEnabled() 103 { 104 return true; 105 } 106 } 107 | Popular Tags |