1 20 21 package org.apache.directory.ldapstudio.browser.ui.editors.searchresult; 22 23 24 import java.util.HashMap ; 25 import java.util.Iterator ; 26 import java.util.Map ; 27 28 import org.apache.directory.ldapstudio.browser.core.model.ISearch; 29 import org.apache.directory.ldapstudio.browser.ui.actions.CopyAttributeDescriptionAction; 30 import org.apache.directory.ldapstudio.browser.ui.actions.CopyDnAction; 31 import org.apache.directory.ldapstudio.browser.ui.actions.CopyEntryAsCsvAction; 32 import org.apache.directory.ldapstudio.browser.ui.actions.CopySearchFilterAction; 33 import org.apache.directory.ldapstudio.browser.ui.actions.CopyUrlAction; 34 import org.apache.directory.ldapstudio.browser.ui.actions.CopyValueAction; 35 import org.apache.directory.ldapstudio.browser.ui.actions.LocateDnInDitAction; 36 import org.apache.directory.ldapstudio.browser.ui.actions.NewBatchOperationAction; 37 import org.apache.directory.ldapstudio.browser.ui.actions.NewSearchAction; 38 import org.apache.directory.ldapstudio.browser.ui.actions.OpenSchemaBrowserAction; 39 import org.apache.directory.ldapstudio.browser.ui.actions.OpenSearchResultAction; 40 import org.apache.directory.ldapstudio.browser.ui.actions.proxy.SearchResultEditorActionProxy; 41 import org.apache.directory.ldapstudio.browser.common.BrowserCommonActivator; 42 import org.apache.directory.ldapstudio.browser.common.BrowserCommonConstants; 43 import org.apache.directory.ldapstudio.browser.common.actions.CopyAction; 44 import org.apache.directory.ldapstudio.browser.common.actions.NewValueAction; 45 import org.apache.directory.ldapstudio.browser.common.actions.PropertiesAction; 46 import org.apache.directory.ldapstudio.browser.common.actions.RefreshAction; 47 import org.apache.directory.ldapstudio.browser.common.actions.ShowRawValuesAction; 48 import org.apache.directory.ldapstudio.browser.common.actions.ValueEditorPreferencesAction; 49 import org.apache.directory.ldapstudio.browser.common.actions.proxy.BrowserActionProxy; 50 import org.apache.directory.ldapstudio.valueeditors.IValueEditor; 51 import org.eclipse.jface.action.IAction; 52 import org.eclipse.jface.action.IMenuListener; 53 import org.eclipse.jface.action.IMenuManager; 54 import org.eclipse.jface.action.IToolBarManager; 55 import org.eclipse.jface.action.MenuManager; 56 import org.eclipse.jface.action.Separator; 57 import org.eclipse.jface.commands.ActionHandler; 58 import org.eclipse.jface.viewers.TableViewer; 59 import org.eclipse.ui.IActionBars; 60 import org.eclipse.ui.IWorkbenchActionConstants; 61 import org.eclipse.ui.PlatformUI; 62 import org.eclipse.ui.actions.ActionFactory; 63 import org.eclipse.ui.actions.ContributionItemFactory; 64 import org.eclipse.ui.commands.ICommandService; 65 66 67 public class SearchResultEditorActionGroup implements IMenuListener 68 { 69 70 private ShowDNAction showDNAction; 71 72 private ShowLinksAction showLinksAction; 73 74 private ShowRawValuesAction showRawValuesAction; 75 76 private OpenSearchResultEditorPreferencePage openSearchResultEditorPreferencePage; 77 78 private ShowQuickFilterAction showQuickFilterAction; 79 80 private OpenDefaultEditorAction openDefaultEditorAction; 81 82 private OpenBestEditorAction openBestEditorAction; 83 84 private OpenEditorAction[] openEditorActions; 85 86 private ValueEditorPreferencesAction openValueEditorPreferencesAction; 87 88 private static final String copyTableAction = "copyTableAction"; 89 90 private static final String refreshSearchAction = "refreshSearchAction"; 91 92 private final static String newValueAction = "newValueAction"; 93 94 private final static String newSearchAction = "newSearchAction"; 95 96 private static final String newBatchOperationAction = "newBatchOperationAction"; 97 98 private final static String copyAction = "copyAction"; 99 100 private final static String pasteAction = "pasteAction"; 101 102 private final static String deleteAction = "deleteAction"; 103 104 private static final String copyDnAction = "copyDnAction"; 105 106 private static final String copyUrlAction = "copyUrlAction"; 107 108 private static final String copyAttriuteDescriptionAction = "copyAttriuteDescriptionAction"; 109 110 private static final String copyValueUtf8Action = "copyValueUtf8Action"; 111 112 private static final String copyValueBase64Action = "copyValueBase64Action"; 113 114 private static final String copyValueHexAction = "copyValueHexAction"; 115 116 private static final String copyValueAsLdifAction = "copyValueAsLdifAction"; 117 118 private static final String copySearchFilterAction = "copySearchFilterAction"; 119 120 private static final String copyNotSearchFilterAction = "copyNotSearchFilterAction"; 121 122 private static final String copyAndSearchFilterAction = "copyAndSearchFilterAction"; 123 124 private static final String copyOrSearchFilterAction = "copyOrSearchFilterAction"; 125 126 private static final String openSearchResultAction = "showEntryInSearchResultsAction"; 127 128 private static final String locateDnInDitAction = "locateDnInDitAction"; 129 130 private static final String showOcdAction = "showOcdAction"; 131 132 private static final String showAtdAction = "showAtdAction"; 133 134 private static final String showEqualityMrdAction = "showEqualityMrdAction"; 135 136 private static final String showSubstringMrdAction = "showSubstringMrdAction"; 137 138 private static final String showOrderingMrdAction = "showOrderingMrdAction"; 139 140 private static final String showLsdAction = "showLsdAction"; 141 142 private final static String propertyDialogAction = "propertyDialogAction"; 143 144 private Map searchResultEditorActionMap; 145 146 private IActionBars actionBars; 147 148 private SearchResultEditor searchResultEditor; 149 150 151 public SearchResultEditorActionGroup( SearchResultEditor searchResultEditor ) 152 { 153 this.searchResultEditor = searchResultEditor; 154 this.searchResultEditorActionMap = new HashMap (); 155 156 TableViewer viewer = searchResultEditor.getMainWidget().getViewer(); 157 SearchResultEditorCursor cursor = searchResultEditor.getConfiguration().getCursor( viewer ); 158 159 this.showDNAction = new ShowDNAction(); 160 this.showLinksAction = new ShowLinksAction(); 161 this.showRawValuesAction = new ShowRawValuesAction(); 162 this.openSearchResultEditorPreferencePage = new OpenSearchResultEditorPreferencePage(); 163 this.showQuickFilterAction = new ShowQuickFilterAction( searchResultEditor.getMainWidget() 164 .getQuickFilterWidget() ); 165 166 this.openBestEditorAction = new OpenBestEditorAction( viewer, searchResultEditor.getConfiguration().getCursor( 167 viewer ), this, searchResultEditor.getConfiguration().getValueEditorManager( viewer ) ); 168 this.openDefaultEditorAction = new OpenDefaultEditorAction( this.openBestEditorAction ); 169 IValueEditor[] valueEditors = searchResultEditor.getConfiguration().getValueEditorManager( viewer ) 170 .getAllValueEditors(); 171 this.openEditorActions = new OpenEditorAction[valueEditors.length]; 172 for ( int i = 0; i < this.openEditorActions.length; i++ ) 173 { 174 this.openEditorActions[i] = new OpenEditorAction( viewer, searchResultEditor.getConfiguration().getCursor( 175 viewer ), this, searchResultEditor.getConfiguration().getValueEditorManager( viewer ), 176 valueEditors[i] ); 177 } 178 this.openValueEditorPreferencesAction = new ValueEditorPreferencesAction(); 179 180 this.searchResultEditorActionMap.put( copyTableAction, new SearchResultEditorActionProxy( cursor, 181 new CopyEntryAsCsvAction( CopyEntryAsCsvAction.MODE_TABLE ) ) ); 182 this.searchResultEditorActionMap.put( refreshSearchAction, new SearchResultEditorActionProxy( cursor, 183 new RefreshAction() ) ); 184 185 this.searchResultEditorActionMap.put( newValueAction, new SearchResultEditorActionProxy( cursor, 186 new NewValueAction() ) ); 187 this.searchResultEditorActionMap.put( newSearchAction, new SearchResultEditorActionProxy( cursor, 188 new NewSearchAction() ) ); 189 this.searchResultEditorActionMap.put( newBatchOperationAction, new SearchResultEditorActionProxy( cursor, 190 new NewBatchOperationAction() ) ); 191 192 this.searchResultEditorActionMap.put( locateDnInDitAction, new SearchResultEditorActionProxy( cursor, 193 new LocateDnInDitAction() ) ); 194 this.searchResultEditorActionMap.put( openSearchResultAction, new SearchResultEditorActionProxy( cursor, 195 new OpenSearchResultAction() ) ); 196 197 this.searchResultEditorActionMap.put( showOcdAction, new SearchResultEditorActionProxy( cursor, 198 new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_OBJECTCLASS ) ) ); 199 this.searchResultEditorActionMap.put( showAtdAction, new SearchResultEditorActionProxy( cursor, 200 new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_ATTRIBUTETYPE ) ) ); 201 this.searchResultEditorActionMap.put( showEqualityMrdAction, new SearchResultEditorActionProxy( cursor, 202 new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_EQUALITYMATCHINGRULE ) ) ); 203 this.searchResultEditorActionMap.put( showSubstringMrdAction, new SearchResultEditorActionProxy( cursor, 204 new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_SUBSTRINGMATCHINGRULE ) ) ); 205 this.searchResultEditorActionMap.put( showOrderingMrdAction, new SearchResultEditorActionProxy( cursor, 206 new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_ORDERINGMATCHINGRULE ) ) ); 207 this.searchResultEditorActionMap.put( showLsdAction, new SearchResultEditorActionProxy( cursor, 208 new OpenSchemaBrowserAction( OpenSchemaBrowserAction.MODE_SYNTAX ) ) ); 209 210 this.searchResultEditorActionMap.put( pasteAction, new SearchResultEditorActionProxy( cursor, 211 new SearchResultEditorPasteAction() ) ); 212 this.searchResultEditorActionMap.put( copyAction, new SearchResultEditorActionProxy( cursor, new CopyAction( 213 ( BrowserActionProxy ) this.searchResultEditorActionMap.get( pasteAction ) ) ) ); 214 this.searchResultEditorActionMap.put( deleteAction, new SearchResultEditorActionProxy( cursor, 215 new SearchResultDeleteAction() ) ); 216 217 this.searchResultEditorActionMap.put( copyDnAction, new SearchResultEditorActionProxy( cursor, 218 new CopyDnAction() ) ); 219 this.searchResultEditorActionMap.put( copyUrlAction, new SearchResultEditorActionProxy( cursor, 220 new CopyUrlAction() ) ); 221 this.searchResultEditorActionMap.put( copyAttriuteDescriptionAction, new SearchResultEditorActionProxy( cursor, 222 new CopyAttributeDescriptionAction() ) ); 223 this.searchResultEditorActionMap.put( copyValueUtf8Action, new SearchResultEditorActionProxy( cursor, 224 new CopyValueAction( CopyValueAction.MODE_UTF8 ) ) ); 225 this.searchResultEditorActionMap.put( copyValueBase64Action, new SearchResultEditorActionProxy( cursor, 226 new CopyValueAction( CopyValueAction.MODE_BASE64 ) ) ); 227 this.searchResultEditorActionMap.put( copyValueHexAction, new SearchResultEditorActionProxy( cursor, 228 new CopyValueAction( CopyValueAction.MODE_HEX ) ) ); 229 this.searchResultEditorActionMap.put( copyValueAsLdifAction, new SearchResultEditorActionProxy( cursor, 230 new CopyValueAction( CopyValueAction.MODE_LDIF ) ) ); 231 232 this.searchResultEditorActionMap.put( copySearchFilterAction, new SearchResultEditorActionProxy( cursor, 233 new CopySearchFilterAction( CopySearchFilterAction.MODE_EQUALS ) ) ); 234 this.searchResultEditorActionMap.put( copyNotSearchFilterAction, new SearchResultEditorActionProxy( cursor, 235 new CopySearchFilterAction( CopySearchFilterAction.MODE_NOT ) ) ); 236 this.searchResultEditorActionMap.put( copyAndSearchFilterAction, new SearchResultEditorActionProxy( cursor, 237 new CopySearchFilterAction( CopySearchFilterAction.MODE_AND ) ) ); 238 this.searchResultEditorActionMap.put( copyOrSearchFilterAction, new SearchResultEditorActionProxy( cursor, 239 new CopySearchFilterAction( CopySearchFilterAction.MODE_OR ) ) ); 240 241 this.searchResultEditorActionMap.put( propertyDialogAction, new SearchResultEditorActionProxy( cursor, 242 new PropertiesAction() ) ); 243 244 } 245 246 247 public void dispose() 248 { 249 250 if ( this.searchResultEditor != null ) 251 { 252 this.showRawValuesAction = null; 253 this.showDNAction.dispose(); 254 this.showDNAction = null; 255 this.showLinksAction.dispose(); 256 this.showLinksAction = null; 257 this.openSearchResultEditorPreferencePage = null; 258 this.showQuickFilterAction.dispose(); 259 this.showQuickFilterAction = null; 260 261 this.openDefaultEditorAction.dispose(); 262 this.openDefaultEditorAction = null; 263 this.openBestEditorAction.dispose(); 264 this.openBestEditorAction = null; 265 for ( int i = 0; i < this.openEditorActions.length; i++ ) 266 { 267 this.openEditorActions[i].dispose(); 268 this.openEditorActions[i] = null; 269 } 270 this.openValueEditorPreferencesAction = null; 271 272 for ( Iterator it = this.searchResultEditorActionMap.keySet().iterator(); it.hasNext(); ) 273 { 274 String key = ( String ) it.next(); 275 SearchResultEditorActionProxy action = ( SearchResultEditorActionProxy ) this.searchResultEditorActionMap 276 .get( key ); 277 action.dispose(); 278 action = null; 279 it.remove(); 280 } 281 this.searchResultEditorActionMap.clear(); 282 this.searchResultEditorActionMap = null; 283 284 this.actionBars = null; 285 this.searchResultEditor = null; 286 } 287 } 288 289 290 public void fillToolBar( IToolBarManager toolBarManager ) 291 { 292 toolBarManager.add( new Separator() ); 293 toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( newValueAction ) ); 294 toolBarManager.add( new Separator() ); 295 toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( deleteAction ) ); 296 toolBarManager.add( new Separator() ); 297 toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( refreshSearchAction ) ); 298 toolBarManager.add( new Separator() ); 299 toolBarManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyTableAction ) ); 300 toolBarManager.add( new Separator() ); 301 toolBarManager.add( this.showQuickFilterAction ); 302 toolBarManager.update( true ); 303 } 304 305 306 public void fillMenu( IMenuManager menuManager ) 307 { 308 menuManager.add( this.showDNAction ); 309 menuManager.add( this.showLinksAction ); 310 menuManager.add( this.showRawValuesAction ); 311 menuManager.add( new Separator() ); 312 menuManager.add( this.openSearchResultEditorPreferencePage ); 313 menuManager.addMenuListener( new IMenuListener() 314 { 315 public void menuAboutToShow( IMenuManager manager ) 316 { 317 showRawValuesAction.setChecked( BrowserCommonActivator.getDefault().getPreferenceStore().getBoolean( 318 BrowserCommonConstants.PREFERENCE_SHOW_RAW_VALUES ) ); 319 } 320 } ); 321 menuManager.update( true ); 322 } 323 324 325 public void enableGlobalActionHandlers( IActionBars actionBars ) 326 { 327 this.actionBars = actionBars; 328 this.activateGlobalActionHandlers(); 329 } 330 331 332 public void fillContextMenu( IMenuManager menuManager ) 333 { 334 menuManager.setRemoveAllWhenShown( true ); 335 menuManager.addMenuListener( this ); 336 } 337 338 339 public void menuAboutToShow( IMenuManager menuManager ) 340 { 341 342 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( newValueAction ) ); 344 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( newSearchAction ) ); 345 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( newBatchOperationAction ) ); 346 menuManager.add( new Separator() ); 347 348 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction ) ); 350 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction ) ); 351 MenuManager schemaMenuManager = new MenuManager( "Open Schema Browser" ); 352 schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showOcdAction ) ); 353 schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showAtdAction ) ); 354 schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showEqualityMrdAction ) ); 355 schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showSubstringMrdAction ) ); 356 schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showOrderingMrdAction ) ); 357 schemaMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( showLsdAction ) ); 358 menuManager.add( schemaMenuManager ); 359 MenuManager showInSubMenu = new MenuManager( "Show In" ); 360 showInSubMenu.add( ContributionItemFactory.VIEWS_SHOW_IN.create( PlatformUI.getWorkbench() 361 .getActiveWorkbenchWindow() ) ); 362 menuManager.add( showInSubMenu ); 363 menuManager.add( new Separator() ); 364 365 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyAction ) ); 367 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( pasteAction ) ); 368 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( deleteAction ) ); 369 MenuManager advancedMenuManager = new MenuManager( "Advanced" ); 370 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyDnAction ) ); 371 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyUrlAction ) ); 372 advancedMenuManager.add( new Separator() ); 373 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyAttriuteDescriptionAction ) ); 374 advancedMenuManager.add( new Separator() ); 375 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueUtf8Action ) ); 376 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueBase64Action ) ); 377 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueHexAction ) ); 378 advancedMenuManager.add( new Separator() ); 379 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyValueAsLdifAction ) ); 380 advancedMenuManager.add( new Separator() ); 381 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copySearchFilterAction ) ); 382 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyNotSearchFilterAction ) ); 383 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyAndSearchFilterAction ) ); 384 advancedMenuManager.add( ( IAction ) this.searchResultEditorActionMap.get( copyOrSearchFilterAction ) ); 385 menuManager.add( advancedMenuManager ); 386 menuManager.add( new Separator() ); 387 388 menuManager.add( this.openDefaultEditorAction ); 390 MenuManager editorMenuManager = new MenuManager( "Edit Value With" ); 391 if ( this.openBestEditorAction.isEnabled() ) 392 { 393 editorMenuManager.add( this.openBestEditorAction ); 394 editorMenuManager.add( new Separator() ); 395 } 396 for ( int i = 0; i < this.openEditorActions.length; i++ ) 397 { 398 if ( this.openEditorActions[i].isEnabled() 399 && this.openEditorActions[i].getValueEditor().getClass() != this.openBestEditorAction 400 .getBestValueEditor().getClass() ) 401 { 402 editorMenuManager.add( this.openEditorActions[i] ); 403 } 404 } 405 editorMenuManager.add( new Separator() ); 406 editorMenuManager.add( this.openValueEditorPreferencesAction ); 407 menuManager.add( editorMenuManager ); 408 menuManager.add( new Separator() ); 409 410 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( refreshSearchAction ) ); 412 menuManager.add( new Separator() ); 413 414 menuManager.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) ); 416 417 menuManager.add( ( IAction ) this.searchResultEditorActionMap.get( propertyDialogAction ) ); 419 420 } 421 422 423 public void activateGlobalActionHandlers() 424 { 425 426 if ( this.actionBars != null ) 427 { 428 actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), ( IAction ) this.searchResultEditorActionMap 429 .get( copyAction ) ); 430 actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), 431 ( IAction ) this.searchResultEditorActionMap.get( pasteAction ) ); 432 actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), 433 ( IAction ) this.searchResultEditorActionMap.get( deleteAction ) ); 434 actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), 435 ( IAction ) this.searchResultEditorActionMap.get( refreshSearchAction ) ); 436 actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), 437 ( IAction ) this.searchResultEditorActionMap.get( propertyDialogAction ) ); 438 actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), this.showQuickFilterAction ); 439 actionBars.updateActionBars(); 440 } 441 442 ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter( 443 ICommandService.class ); 444 if ( commandService != null ) 445 { 446 IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction ); 447 commandService.getCommand( nva.getActionDefinitionId() ).setHandler( new ActionHandler( nva ) ); 448 IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction ); 449 commandService.getCommand( lid.getActionDefinitionId() ).setHandler( new ActionHandler( lid ) ); 450 IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction ); 451 commandService.getCommand( osr.getActionDefinitionId() ).setHandler( new ActionHandler( osr ) ); 452 commandService.getCommand( openDefaultEditorAction.getActionDefinitionId() ).setHandler( 453 new ActionHandler( openDefaultEditorAction ) ); 454 } 455 456 } 457 458 459 public void deactivateGlobalActionHandlers() 460 { 461 462 if ( this.actionBars != null ) 463 { 464 actionBars.setGlobalActionHandler( ActionFactory.COPY.getId(), null ); 465 actionBars.setGlobalActionHandler( ActionFactory.PASTE.getId(), null ); 466 actionBars.setGlobalActionHandler( ActionFactory.DELETE.getId(), null ); 467 actionBars.setGlobalActionHandler( ActionFactory.REFRESH.getId(), null ); 468 actionBars.setGlobalActionHandler( ActionFactory.FIND.getId(), null ); 469 actionBars.setGlobalActionHandler( ActionFactory.PROPERTIES.getId(), null ); 470 actionBars.updateActionBars(); 471 } 472 473 ICommandService commandService = ( ICommandService ) PlatformUI.getWorkbench().getAdapter( 474 ICommandService.class ); 475 if ( commandService != null ) 476 { 477 IAction nva = ( IAction ) this.searchResultEditorActionMap.get( newValueAction ); 478 commandService.getCommand( nva.getActionDefinitionId() ).setHandler( null ); 479 IAction lid = ( IAction ) this.searchResultEditorActionMap.get( locateDnInDitAction ); 480 commandService.getCommand( lid.getActionDefinitionId() ).setHandler( null ); 481 IAction osr = ( IAction ) this.searchResultEditorActionMap.get( openSearchResultAction ); 482 commandService.getCommand( osr.getActionDefinitionId() ).setHandler( null ); 483 commandService.getCommand( openDefaultEditorAction.getActionDefinitionId() ).setHandler( null ); 484 } 485 486 } 487 488 489 public OpenBestEditorAction getOpenBestEditorAction() 490 { 491 return openBestEditorAction; 492 } 493 494 495 public void setInput( ISearch search ) 496 { 497 for ( Iterator it = this.searchResultEditorActionMap.values().iterator(); it.hasNext(); ) 498 { 499 SearchResultEditorActionProxy action = ( SearchResultEditorActionProxy ) it.next(); 500 action.inputChanged( search ); 501 } 502 } 503 504 505 public boolean isEditorActive() 506 { 507 if ( this.openDefaultEditorAction.isActive() ) 508 { 509 return true; 510 } 511 if ( this.openBestEditorAction.isActive() ) 512 { 513 return true; 514 } 515 for ( int i = 0; i < this.openEditorActions.length; i++ ) 516 { 517 if ( this.openEditorActions[i].isActive() ) 518 { 519 return true; 520 } 521 } 522 523 return false; 524 } 525 526 } 527 | Popular Tags |