1 20 21 package org.apache.directory.ldapstudio.ldifeditor.wizards; 22 23 24 import org.apache.directory.ldapstudio.ldifeditor.editor.LdifEditor; 25 import org.apache.directory.ldapstudio.ldifeditor.editor.NonExistingLdifEditorInput; 26 import org.eclipse.jface.viewers.IStructuredSelection; 27 import org.eclipse.jface.wizard.Wizard; 28 import org.eclipse.ui.IEditorInput; 29 import org.eclipse.ui.INewWizard; 30 import org.eclipse.ui.IWorkbench; 31 import org.eclipse.ui.IWorkbenchPage; 32 import org.eclipse.ui.IWorkbenchWindow; 33 import org.eclipse.ui.PartInitException; 34 35 36 43 44 public class NewLdifFileWizard extends Wizard implements INewWizard 45 { 46 47 48 private IWorkbenchWindow window; 49 50 51 54 public NewLdifFileWizard() 55 { 56 } 57 58 59 62 public void init( IWorkbench workbench, IStructuredSelection selection ) 63 { 64 window = workbench.getActiveWorkbenchWindow(); 65 } 66 67 68 71 public void dispose() 72 { 73 window = null; 74 } 75 76 77 82 public static String getId() 83 { 84 return NewLdifFileWizard.class.getName(); 85 } 86 87 88 91 public boolean performFinish() 92 { 93 IEditorInput input = new NonExistingLdifEditorInput(); 94 String editorId = LdifEditor.getId(); 95 96 try 97 { 98 IWorkbenchPage page = window.getActivePage(); 99 page.openEditor( input, editorId ); 100 } 101 catch ( PartInitException e ) 102 { 103 return false; 104 } 105 return true; 106 } 107 108 } 109 | Popular Tags |