org.eclipse.jdt.internal.ui.search.SearchUtil Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.search.SearchUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImplementorsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindImplementorsAction, javaSearchMM);
	addAction(fFindImplementorsInProjectAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindImplementorsInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #2
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(getName(), IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindReferencesAction, javaSearchMM);
	addAction(fFindReferencesInProjectAction, javaSearchMM);
	addAction(fFindReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #3
Source File: WriteReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindWriteReferencesAction, javaSearchMM);
	addAction(fFindWriteReferencesInProjectAction, javaSearchMM);
	addAction(fFindWriteReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindWriteReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #4
Source File: FindAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void performNewSearch(IJavaElement element) throws JavaModelException, InterruptedException {
	JavaSearchQuery query= new JavaSearchQuery(createQuery(element));
	if (query.canRunInBackground()) {
		/*
		 * This indirection with Object as parameter is needed to prevent the loading
		 * of the Search plug-in: the VM verifies the method call and hence loads the
		 * types used in the method signature, eventually triggering the loading of
		 * a plug-in (in this case ISearchQuery results in Search plug-in being loaded).
		 */
		SearchUtil.runQueryInBackground(query);
	} else {
		IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
		/*
		 * This indirection with Object as parameter is needed to prevent the loading
		 * of the Search plug-in: the VM verifies the method call and hence loads the
		 * types used in the method signature, eventually triggering the loading of
		 * a plug-in (in this case it would be ISearchQuery).
		 */
		IStatus status= SearchUtil.runQueryInForeground(progressService, query);
		if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
			ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message, status);
		}
	}
}
 
Example #5
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	MenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindReadReferencesAction, javaSearchMM);
	addAction(fFindReadReferencesInProjectAction, javaSearchMM);
	addAction(fFindReadReferencesInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindReadReferencesInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #6
Source File: DeclarationsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void fillContextMenu(IMenuManager manager) {
	IMenuManager javaSearchMM= new MenuManager(MENU_TEXT, IContextMenuConstants.GROUP_SEARCH);
	addAction(fFindDeclarationsAction, javaSearchMM);
	addAction(fFindDeclarationsInProjectAction, javaSearchMM);
	addAction(fFindDeclarationsInHierarchyAction, javaSearchMM);

	javaSearchMM.add(new Separator());

	Iterator<IWorkingSet[]> iter= SearchUtil.getLRUWorkingSets().sortedIterator();
	while (iter.hasNext()) {
		addWorkingSetAction(iter.next(), javaSearchMM);
	}
	addAction(fFindDeclarationsInWorkingSetAction, javaSearchMM);

	if (!javaSearchMM.isEmpty())
		manager.appendToGroup(fGroupId, javaSearchMM);
}
 
Example #7
Source File: ImplementorsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) {
	FindAction action;
	if (fEditor != null)
		action= new WorkingSetFindAction(fEditor, new FindImplementorsInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
	else
		action= new WorkingSetFindAction(fSite, new FindImplementorsInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
	action.update(getContext().getSelection());
	addAction(action, manager);
}
 
Example #8
Source File: JavaElementAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void updateLazyLoadedAdapters() {
	if (fSearchPageScoreComputer == null && SearchUtil.isSearchPlugInActivated())
		createSearchPageScoreComputer();
	if (!fIsTeamUILoaded && isTeamUIPlugInActivated()) {
		addClassToAdapterList(IHistoryPageSource.class);
		fIsTeamUILoaded= true;
	}
}
 
Example #9
Source File: ReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) {
	FindAction action;
	if (fEditor != null)
		action= new WorkingSetFindAction(fEditor, new FindReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
	else
		action= new WorkingSetFindAction(fSite, new FindReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
	action.update(getContext().getSelection());
	addAction(action, manager);
}
 
Example #10
Source File: FindDeclarationsInWorkingSetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
QuerySpecification createQuery(IJavaElement element) throws JavaModelException, InterruptedException {
	JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();

	IWorkingSet[] workingSets= fWorkingSet;
	if (fWorkingSet == null) {
		workingSets= factory.queryWorkingSets();
		if (workingSets == null)
			return super.createQuery(element); // in workspace
	}
	SearchUtil.updateLRUWorkingSets(workingSets);
	IJavaSearchScope scope= factory.createJavaSearchScope(workingSets, JavaSearchScopeFactory.NO_PROJ);
	String description= factory.getWorkingSetScopeDescription(workingSets, JavaSearchScopeFactory.NO_PROJ);
	return new ElementQuerySpecification(element, getLimitTo(), scope, description);
}
 
Example #11
Source File: ReadReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) {
	FindAction action;
	if (fEditor != null)
		action= new WorkingSetFindAction(fEditor, new FindReadReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
	else
		action= new WorkingSetFindAction(fSite, new FindReadReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
	action.update(getContext().getSelection());
	addAction(action, manager);
}
 
Example #12
Source File: FindReferencesInWorkingSetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
QuerySpecification createQuery(IJavaElement element) throws JavaModelException, InterruptedException {
	JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();

	IWorkingSet[] workingSets= fWorkingSets;
	if (fWorkingSets == null) {
		workingSets= factory.queryWorkingSets();
		if (workingSets == null)
			return super.createQuery(element); // in workspace
	}
	SearchUtil.updateLRUWorkingSets(workingSets);
	IJavaSearchScope scope= factory.createJavaSearchScope(workingSets, JavaSearchScopeFactory.NO_PROJ);
	String description= factory.getWorkingSetScopeDescription(workingSets, JavaSearchScopeFactory.NO_PROJ);
	return new ElementQuerySpecification(element, getLimitTo(), scope, description);
}
 
Example #13
Source File: DeclarationsSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) {
	FindAction action;
	if (fEditor != null)
		action= new WorkingSetFindAction(fEditor, new FindDeclarationsInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
	else
		action= new WorkingSetFindAction(fSite, new FindDeclarationsInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
	action.update(getContext().getSelection());
	addAction(action, manager);
}
 
Example #14
Source File: FindImplementorsInWorkingSetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
QuerySpecification createQuery(IJavaElement element) throws JavaModelException, InterruptedException {
	JavaSearchScopeFactory factory= JavaSearchScopeFactory.getInstance();

	IWorkingSet[] workingSets= fWorkingSets;
	if (fWorkingSets == null) {
		workingSets= factory.queryWorkingSets();
		if (workingSets == null)
			return super.createQuery(element); // workspace
	}
	SearchUtil.updateLRUWorkingSets(workingSets);
	IJavaSearchScope scope= factory.createJavaSearchScope(workingSets, JavaSearchScopeFactory.NO_PROJ);
	String description= factory.getWorkingSetScopeDescription(workingSets, JavaSearchScopeFactory.NO_PROJ);
	return new ElementQuerySpecification(element, getLimitTo(), scope, description);
}
 
Example #15
Source File: WriteReferencesSearchGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addWorkingSetAction(IWorkingSet[] workingSets, IMenuManager manager) {
	FindAction action;
	if (fEditor != null)
		action= new WorkingSetFindAction(fEditor, new FindWriteReferencesInWorkingSetAction(fEditor, workingSets), SearchUtil.toString(workingSets));
	else
		action= new WorkingSetFindAction(fSite, new FindWriteReferencesInWorkingSetAction(fSite, workingSets), SearchUtil.toString(workingSets));
	action.update(getContext().getSelection());
	addAction(action, manager);
}
 
Example #16
Source File: JdtReferenceFinder.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected void performNewSearch(String label, Iterable<? extends IJavaElement> elements) throws JavaModelException, InterruptedException {
	CompositeSearchQuery compositeSearchQuery = createCompositeQuery(label, elements);
	if (compositeSearchQuery.canRunInBackground()) {
		SearchUtil.runQueryInBackground(compositeSearchQuery);
	} else {
		IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
		IStatus status= SearchUtil.runQueryInForeground(progressService, compositeSearchQuery);
		if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
			ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title, SearchMessages.Search_Error_search_message, status);
		}
	}
}
 
Example #17
Source File: FindReferencesAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void run(IJavaElement element) {
	SearchUtil.warnIfBinaryConstant(element, getShell());
	super.run(element);
}
 
Example #18
Source File: MarkerAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void updateLazyLoadedAdapters() {
	if (fSearchPageScoreComputer == null && SearchUtil.isSearchPlugInActivated())
		createSearchPageScoreComputer();
}
 
Example #19
Source File: EditorInputAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void updateLazyLoadedAdapters() {
	if (fSearchPageScoreComputer == null && SearchUtil.isSearchPlugInActivated())
		createSearchPageScoreComputer();
}
 
Example #20
Source File: LogicalPackageAdapterFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void updateLazyLoadedAdapters() {
	if (fSearchPageScoreComputer == null && SearchUtil.isSearchPlugInActivated())
		createSearchPageScoreComputer();
}
 
Example #21
Source File: JavaBrowsingPart.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private boolean isSearchResultView(IWorkbenchPart part) {
	return SearchUtil.isSearchPlugInActivated() && part instanceof ISearchResultViewPart;
}