1 11 package org.eclipse.search.ui; 12 13 import org.eclipse.search.internal.ui.SearchMessages; 14 import org.eclipse.search.internal.ui.SearchPlugin; 15 import org.eclipse.search.internal.ui.SearchPluginImages; 16 import org.eclipse.search.internal.ui.SearchPreferencePage; 17 import org.eclipse.search.internal.ui.util.ExceptionHandler; 18 19 import org.eclipse.swt.graphics.Image; 20 21 import org.eclipse.ui.IViewPart; 22 import org.eclipse.ui.IWorkbenchWindow; 23 import org.eclipse.ui.PartInitException; 24 import org.eclipse.ui.PlatformUI; 25 import org.eclipse.ui.WorkbenchException; 26 27 41 public final class SearchUI { 42 43 47 public static final String PLUGIN_ID= NewSearchUI.PLUGIN_ID; 48 49 55 public static final String SEARCH_MARKER= NewSearchUI.SEARCH_MARKER; 56 57 63 public static final String LINE= "line"; 65 81 public static final String POTENTIAL_MATCH= "potentialMatch"; 83 87 public static final String SEARCH_RESULT_VIEW_ID= "org.eclipse.search.SearchResultView"; 89 94 public static final String SEARCH_VIEW_ID= NewSearchUI.SEARCH_VIEW_ID; 95 96 103 public static final String ACTION_SET_ID= NewSearchUI.ACTION_SET_ID; 104 105 113 public static boolean activateSearchResultView() { 114 String defaultPerspectiveId= SearchUI.getDefaultPerspectiveId(); 115 if (defaultPerspectiveId != null) { 116 IWorkbenchWindow window= SearchPlugin.getActiveWorkbenchWindow(); 117 if (window != null && window.getShell() != null && !window.getShell().isDisposed()) { 118 try { 119 PlatformUI.getWorkbench().showPerspective(defaultPerspectiveId, window); 120 } catch (WorkbenchException ex) { 121 } 123 } 124 } 125 126 try { 127 IViewPart viewPart= SearchPlugin.getActivePage().findView(SearchUI.SEARCH_RESULT_VIEW_ID); 128 if (viewPart == null || SearchPreferencePage.isViewBroughtToFront()) { 129 return (SearchPlugin.getActivePage().showView(SearchUI.SEARCH_RESULT_VIEW_ID) != null); 130 } 131 return true; 132 } catch (PartInitException ex) { 133 ExceptionHandler.handle(ex, SearchMessages.Search_Error_openResultView_title, SearchMessages.Search_Error_openResultView_message); 134 return false; 135 } 136 } 137 138 149 public static void openSearchDialog(IWorkbenchWindow window, String pageId) { 150 NewSearchUI.openSearchDialog(window, pageId); 151 } 152 153 154 162 public static ISearchResultView getSearchResultView() { 163 IViewPart part= SearchPlugin.getActivePage().findView(SearchUI.SEARCH_RESULT_VIEW_ID); 164 if (part instanceof ISearchResultView) 165 return (ISearchResultView) part; 166 return null; 167 } 168 169 177 public static Image getSearchMarkerImage() { 178 return SearchPluginImages.get(SearchPluginImages.IMG_OBJ_SEARCHMARKER); 179 } 180 181 191 public static boolean reuseEditor() { 192 return NewSearchUI.reuseEditor(); 193 } 194 195 207 public static boolean arePotentialMatchesIgnored() { 208 return NewSearchUI.arePotentialMatchesIgnored(); 209 } 210 211 222 public static String getDefaultPerspectiveId() { 223 return NewSearchUI.getDefaultPerspectiveId(); 224 } 225 226 229 private SearchUI() { 230 } 231 } 232 | Popular Tags |