1 20 21 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult; 22 23 24 import org.apache.directory.ldapstudio.valueeditors.IValueEditor; 25 import org.apache.directory.ldapstudio.valueeditors.ValueEditorManager; 26 import org.eclipse.jface.viewers.TableViewer; 27 28 29 public class OpenBestEditorAction extends AbstractOpenEditorAction 30 { 31 32 private IValueEditor valueEditor; 33 34 35 public OpenBestEditorAction( TableViewer viewer, SearchResultEditorCursor cursor, 36 SearchResultEditorActionGroup actionGroup, ValueEditorManager valueEditorManager ) 37 { 38 super( viewer, cursor, actionGroup, valueEditorManager ); 39 } 40 41 42 public IValueEditor getBestValueEditor() 43 { 44 return this.valueEditor; 45 } 46 47 48 protected void updateEnabledState() 49 { 50 51 if ( viewer.getCellModifier().canModify( this.selectedSearchResult, this.selectedProperty ) ) 52 { 53 54 if ( this.selectedAttributeHierarchie == null ) 55 { 56 this.valueEditor = this.valueEditorManager.getCurrentValueEditor( this.selectedSearchResult 57 .getEntry(), this.selectedProperty ); 58 } 59 else 60 { 61 this.valueEditor = this.valueEditorManager 62 .getCurrentValueEditor( this.selectedAttributeHierarchie ); 63 } 64 65 super.cellEditor = this.valueEditor.getCellEditor(); 66 this.setEnabled( true ); 67 this.setText( "" + this.valueEditor.getValueEditorName() ); 68 this.setToolTipText( "" + this.valueEditor.getValueEditorName() ); 69 this.setImageDescriptor( this.valueEditor.getValueEditorImageDescriptor() ); 70 71 } 72 else 73 { 74 this.setEnabled( false ); 75 this.cellEditor = null; 76 this.setText( "Best Editor" ); 77 this.setToolTipText( "Best Editor" ); 78 this.setImageDescriptor( null ); 79 } 80 } 81 82 } 83 | Popular Tags |