1 20 21 package org.apache.directory.ldapstudio.browser.ui.actions; 22 23 24 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants; 25 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin; 26 import org.eclipse.jface.resource.ImageDescriptor; 27 28 29 36 public class LocateEntryInDitAction extends LocateInDitAction 37 { 38 39 42 public LocateEntryInDitAction() 43 { 44 } 45 46 47 50 public String getText() 51 { 52 if ( getSelectedSearchResults().length == 1 53 && getSelectedBookmarks().length + getSelectedEntries().length + getSelectedBrowserViewCategories().length == 0 ) 54 { 55 return "Open Search Result in DIT"; 56 } 57 else if ( getSelectedBookmarks().length == 1 58 && getSelectedSearchResults().length + getSelectedEntries().length 59 + getSelectedBrowserViewCategories().length == 0 ) 60 { 61 return "Open Bookmark in DIT"; 62 } 63 else 64 { 65 return "Open Entry in DIT"; 66 } 67 } 68 69 70 73 public ImageDescriptor getImageDescriptor() 74 { 75 if ( getSelectedSearchResults().length == 1 76 && getSelectedBookmarks().length + getSelectedEntries().length + getSelectedBrowserViewCategories().length == 0 ) 77 { 78 return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LOCATE_SEARCHRESULT_IN_DIT ); 79 } 80 else if ( getSelectedBookmarks().length == 1 81 && getSelectedSearchResults().length + getSelectedEntries().length 82 + getSelectedBrowserViewCategories().length == 0 ) 83 { 84 return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LOCATE_BOOKMARK_IN_DIT ); 85 } 86 else 87 { 88 return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_LOCATE_ENTRY_IN_DIT ); 89 } 90 } 91 92 93 97 protected ConnectionAndDn getConnectionAndDn() 98 { 99 if ( getSelectedSearchResults().length == 1 100 && getSelectedBookmarks().length + getSelectedEntries().length + getSelectedBrowserViewCategories().length == 0 ) 101 { 102 return new ConnectionAndDn( getSelectedSearchResults()[0].getEntry().getConnection(), 103 getSelectedSearchResults()[0].getEntry().getDn() ); 104 } 105 else if ( getSelectedBookmarks().length == 1 106 && getSelectedSearchResults().length + getSelectedEntries().length 107 + getSelectedBrowserViewCategories().length == 0 ) 108 { 109 return new ConnectionAndDn( getSelectedBookmarks()[0].getConnection(), getSelectedBookmarks()[0].getDn() ); 110 } 111 else 112 { 113 return null; 114 } 115 } 116 } 117 | Popular Tags |