1 20 21 package org.apache.directory.ldapstudio.browser.ui.editors.schemabrowser; 22 23 24 import org.apache.directory.ldapstudio.browser.core.model.IConnection; 25 import org.apache.directory.ldapstudio.browser.core.model.schema.SchemaPart; 26 import org.eclipse.ui.PartInitException; 27 import org.eclipse.ui.PlatformUI; 28 29 30 37 public class SchemaBrowserManager 38 { 39 40 41 private static SchemaBrowserInput DUMMY_INPUT = new SchemaBrowserInput( null, null ); 42 43 44 50 public static void setInput( IConnection connection, SchemaPart schemaElement ) 51 { 52 SchemaBrowserInput input = new SchemaBrowserInput( connection, schemaElement ); 53 setInput( input ); 54 } 55 56 57 62 private static void setInput( SchemaBrowserInput input ) 63 { 64 SchemaBrowser editor = ( SchemaBrowser ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() 65 .findEditor( DUMMY_INPUT ); 66 if ( editor == null && input != null ) 67 { 68 try 70 { 71 editor = ( SchemaBrowser ) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() 72 .openEditor( input, SchemaBrowser.getId(), false ); 73 editor.setInput( input ); 74 } 75 catch ( PartInitException e ) 76 { 77 e.printStackTrace(); 78 } 79 } 80 else if ( editor != null ) 81 { 82 editor.setInput( input ); 84 85 if ( input.getSchemaElement() != null ) 87 { 88 if ( !PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().isPartVisible( editor ) ) 89 { 90 PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().bringToTop( editor ); 91 } 92 } 93 } 94 } 95 96 } 97 | Popular Tags |