org.eclipse.search.ui.NewSearchUI Java Examples

The following examples show how to use org.eclipse.search.ui.NewSearchUI. 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: EditorOpener.java    From typescript.java with MIT License 8 votes vote down vote up
public IEditorPart openAndSelect(IWorkbenchPage wbPage, IFile file, int offset, int length, boolean activate) throws PartInitException {
	String editorId= null;
	IEditorDescriptor desc= IDE.getEditorDescriptor(file);
	if (desc == null || !desc.isInternal()) {
		editorId= "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
	} else {
		editorId= desc.getId();
	}

	IEditorPart editor;
	if (NewSearchUI.reuseEditor()) {
		editor= showWithReuse(file, wbPage, editorId, activate);
	} else {
		editor= showWithoutReuse(file, wbPage, editorId, activate);
	}

	if (editor instanceof ITextEditor) {
		ITextEditor textEditor= (ITextEditor) editor;
		textEditor.selectAndReveal(offset, length);
	} else if (editor != null) {
		showWithMarker(editor, file, offset, length);
	}
	return editor;
}
 
Example #2
Source File: Implementations.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart part = HandlerUtil.getActiveEditor(event);
	if (part instanceof ITextEditor) {
		Collection<LSPDocumentInfo> infos = LanguageServiceAccessor.getLSPDocumentInfosFor(
				LSPEclipseUtils.getDocument((ITextEditor) part),
				capabilities -> Boolean.TRUE.equals(capabilities.getReferencesProvider()));
		if (!infos.isEmpty()) {
			LSPDocumentInfo info = infos.iterator().next();
			ISelection sel = ((AbstractTextEditor) part).getSelectionProvider().getSelection();

			if (sel instanceof TextSelection) {
				try {
					int offset = ((TextSelection) sel).getOffset();
					ImplementationsSearchQuery query = new ImplementationsSearchQuery(offset, info);
					NewSearchUI.runQueryInBackground(query);
				} catch (BadLocationException e) {
					LanguageServerPlugin.logError(e);
				}
			}
		}
	}
	return null;
}
 
Example #3
Source File: PythonPerspectiveFactory.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param layout
 * @param editorArea
 */
public void defineLayout(IPageLayout layout) {
    String editorArea = layout.getEditorArea();
    IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, (float) 0.26, editorArea); //$NON-NLS-1$
    topLeft.addView("org.python.pydev.navigator.view");

    IFolderLayout outputfolder = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
    //outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
    outputfolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
    outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
    outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
    outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);

    //Add the outline only if we're not using the minimap.
    if (!MinimapOverviewRulerPreferencesPage.getShowMinimapContents()) {
        layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, editorArea);
    }
}
 
Example #4
Source File: PythonPerspectiveFactory.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param layout
 */
public void defineActions(IPageLayout layout) {
    layout.addNewWizardShortcut(PythonProjectWizard.WIZARD_ID);
    layout.addNewWizardShortcut(PythonSourceFolderWizard.WIZARD_ID);
    layout.addNewWizardShortcut(PythonPackageWizard.WIZARD_ID);
    layout.addNewWizardShortcut(PythonModuleWizard.WIZARD_ID);
    layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
    layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
    layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$

    layout.addShowViewShortcut("org.python.pydev.navigator.view");
    layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
    layout.addShowViewShortcut("org.python.pydev.debug.pyunit.pyUnitView");
    layout.addShowViewShortcut("org.python.pydev.debug.profile.ProfileView");
    layout.addShowViewShortcut("org.python.pydev.views.PyCodeCoverageView");
    layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
    layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
    layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
    //layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);-- Navigator no longer supported
    layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView");
    layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);

    layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
    layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);

}
 
Example #5
Source File: InvasiveThemeHijacker.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void partClosed(IWorkbenchPartReference partRef)
{
	if (partRef instanceof IEditorReference)
	{
		IEditorPart part = (IEditorPart) partRef.getPart(false);
		if (part instanceof MultiPageEditorPart)
		{
			MultiPageEditorPart multi = (MultiPageEditorPart) part;
			if (pageListener != null)
			{
				multi.getSite().getSelectionProvider().removeSelectionChangedListener(pageListener);
			}
		}
	}
	// If it's a search view, remove any query listeners for it!
	else if (partRef instanceof IViewReference)
	{
		IViewPart view = (IViewPart) partRef.getPart(false);
		if (queryListeners.containsKey(view))
		{
			NewSearchUI.removeQueryListener(queryListeners.remove(view));
		}
	}
}
 
Example #6
Source File: LangPerspective.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
protected void addViewStructure(IPageLayout layout) {
	String editorArea = layout.getEditorArea();
	
	IFolderLayout leftFolder = layout.createFolder("leftPane", IPageLayout.LEFT, 0.25f, editorArea);
	leftFolder.addView(IPageLayout.ID_PROJECT_EXPLORER);
	
	IFolderLayout bottomFolder = layout.createFolder("bottomPane", IPageLayout.BOTTOM, 0.75f, editorArea);
	
	bottomFolder.addView(IPageLayout.ID_PROBLEM_VIEW);
	bottomFolder.addView(IPageLayout.ID_TASK_LIST);
	bottomFolder.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
	bottomFolder.addView(IPageLayout.ID_PROGRESS_VIEW);
	bottomFolder.addView(IConsoleConstants.ID_CONSOLE_VIEW);
	
	// Create outline after bottom pane
	layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, 0.75f, editorArea);
}
 
Example #7
Source File: TypeScriptPerspectiveFactory.java    From typescript.java with MIT License 6 votes vote down vote up
@Override
public void createInitialLayout(IPageLayout layout) {
	String editorArea = layout.getEditorArea();

	IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, (float) 0.25, editorArea); //$NON-NLS-1$
	left.addView(IPageLayout.ID_PROJECT_EXPLORER);
	left.addPlaceholder(IPageLayout.ID_RES_NAV);

	IFolderLayout bottom = layout.createFolder("bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
	bottom.addView("org.eclipse.tm.terminal.view.ui.TerminalsView");
	bottom.addView(IPageLayout.ID_PROBLEM_VIEW);

	bottom.addPlaceholder(TemplatesView.ID);
	bottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
	bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
	bottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
	bottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
	bottom.addPlaceholder(IPageLayout.ID_TASK_LIST);
	bottom.addPlaceholder(IPageLayout.ID_PROP_SHEET);

	layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float) 0.75, editorArea);

}
 
Example #8
Source File: EditorOpener.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public IEditorPart openAndSelect(IWorkbenchPage wbPage, IFile file, int offset, int length, boolean activate)
        throws PartInitException {
    String editorId = null;
    IEditorDescriptor desc = IDE.getEditorDescriptor(file);
    if (desc == null || !desc.isInternal()) {
        editorId = "org.eclipse.ui.DefaultTextEditor"; //$NON-NLS-1$
    } else {
        editorId = desc.getId();
    }

    IEditorPart editor;
    if (NewSearchUI.reuseEditor()) {
        editor = showWithReuse(file, wbPage, editorId, activate);
    } else {
        editor = showWithoutReuse(file, wbPage, editorId, activate);
    }

    if (editor instanceof ITextEditor) {
        ITextEditor textEditor = (ITextEditor) editor;
        textEditor.selectAndReveal(offset, length);
    } else if (editor != null) {
        showWithMarker(editor, file, offset, length);
    }
    return editor;
}
 
Example #9
Source File: FindAction.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	ITextSelection textSelection = getSelectedStringFromEditor();
	if (textSelection != null) {
		ISourceViewer textViewer = (ISourceViewer)editor.getAdapter(ISourceViewer.class);
		
		PstLeafNode pstLeafNode = ModulaEditorSymbolUtils.getIdentifierPstLeafNode(editor, textSelection.getOffset());
	    if (pstLeafNode != null) {
	        IModulaSymbol symbol = ModulaEditorSymbolUtils.getModulaSymbol(
                   textViewer.getDocument(), pstLeafNode
               );
	        IResource searchScope = getSearchScope();
			if (symbol != null && searchScope != null) {
				NewSearchUI.activateSearchResultView();
		        NewSearchUI.runQueryInBackground(new ModulaSearchQuery(getInput(symbol, searchScope)));
			}
	    }
	}
}
 
Example #10
Source File: JavaSearchEditorOpener.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public IEditorPart openElement(Object element) throws PartInitException {
	IWorkbenchPage wbPage= JavaPlugin.getActivePage();
	IEditorPart editor;
	if (NewSearchUI.reuseEditor())
		editor= showWithReuse(element, wbPage);
	else
		editor= showWithoutReuse(element);

	if (element instanceof IJavaElement)
		EditorUtility.revealInEditor(editor, (IJavaElement) element);

	return editor;
}
 
Example #11
Source File: JavaBrowsingPerspectiveFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createVerticalLayout(IPageLayout layout) {
	String relativePartId= IPageLayout.ID_EDITOR_AREA;
	int relativePos= IPageLayout.LEFT;

	IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
	placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
	placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
	placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
	placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
	placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);

	if (shouldShowProjectsView()) {
		layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA);
		relativePartId= JavaUI.ID_PROJECTS_VIEW;
		relativePos= IPageLayout.BOTTOM;
	}
	if (shouldShowPackagesView()) {
		layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
		relativePartId= JavaUI.ID_PACKAGES_VIEW;
		relativePos= IPageLayout.BOTTOM;
	}
	layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
	layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.BOTTOM, (float)0.50, JavaUI.ID_TYPES_VIEW);

	IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
	placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
	placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
	placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
	placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
	placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
	placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
	placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
 
Example #12
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private boolean isQueryRunning() {
	AbstractTextSearchResult result= getInput();
	if (result != null) {
		return NewSearchUI.isQueryRunning(result.getQuery());
	}
	return false;
}
 
Example #13
Source File: JavaBrowsingPerspectiveFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void createHorizontalLayout(IPageLayout layout) {
	String relativePartId= IPageLayout.ID_EDITOR_AREA;
	int relativePos= IPageLayout.TOP;

	if (shouldShowProjectsView()) {
		layout.addView(JavaUI.ID_PROJECTS_VIEW, IPageLayout.TOP, (float)0.25, IPageLayout.ID_EDITOR_AREA);
		relativePartId= JavaUI.ID_PROJECTS_VIEW;
		relativePos= IPageLayout.RIGHT;
	}
	if (shouldShowPackagesView()) {
		layout.addView(JavaUI.ID_PACKAGES_VIEW, relativePos, (float)0.25, relativePartId);
		relativePartId= JavaUI.ID_PACKAGES_VIEW;
		relativePos= IPageLayout.RIGHT;
	}
	layout.addView(JavaUI.ID_TYPES_VIEW, relativePos, (float)0.33, relativePartId);
	layout.addView(JavaUI.ID_MEMBERS_VIEW, IPageLayout.RIGHT, (float)0.50, JavaUI.ID_TYPES_VIEW);

	IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
	placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
	placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
	placeHolderLeft.addPlaceholder(JavaUI.ID_PACKAGES);
	placeHolderLeft.addPlaceholder(JavaPlugin.ID_RES_NAV);
	placeHolderLeft.addPlaceholder(IPageLayout.ID_PROJECT_EXPLORER);


	IPlaceholderFolderLayout placeHolderBottom= layout.createPlaceholderFolder("bottom", IPageLayout.BOTTOM, (float)0.75, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
	placeHolderBottom.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
	placeHolderBottom.addPlaceholder(NewSearchUI.SEARCH_VIEW_ID);
	placeHolderBottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
	placeHolderBottom.addPlaceholder(IPageLayout.ID_BOOKMARKS);
	placeHolderBottom.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
	placeHolderBottom.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
	placeHolderBottom.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
}
 
Example #14
Source File: JavaSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void showWithMarker(IEditorPart editor, IFile file, int offset, int length) throws PartInitException {
	try {
		IMarker marker= file.createMarker(NewSearchUI.SEARCH_MARKER);
		HashMap<String, Integer> attributes= new HashMap<String, Integer>(4);
		attributes.put(IMarker.CHAR_START, new Integer(offset));
		attributes.put(IMarker.CHAR_END, new Integer(offset + length));
		marker.setAttributes(attributes);
		IDE.gotoMarker(editor, marker);
		marker.delete();
	} catch (CoreException e) {
		throw new PartInitException(SearchMessages.JavaSearchResultPage_error_marker, e);
	}
}
 
Example #15
Source File: OpenJavaSearchPageAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void run(IAction action) {
	if (fWindow == null || fWindow.getActivePage() == null) {
		beep();
		JavaPlugin.logErrorMessage("Could not open the search dialog - for some reason the window handle was null"); //$NON-NLS-1$
		return;
	}
	NewSearchUI.openSearchDialog(fWindow, JAVA_SEARCH_PAGE_ID);
}
 
Example #16
Source File: SearchResultUpdater.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void queryRemoved(ISearchQuery query) {
    if (fResult.equals(query.getSearchResult())) {
        ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
        NewSearchUI.removeQueryListener(this);
    }
}
 
Example #17
Source File: TagsSearchHandler.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see com.mulgasoft.emacsplus.commands.MinibufferExecHandler#doExecuteResult(org.eclipse.ui.texteditor.ITextEditor, java.lang.Object)
 */
public boolean doExecuteResult(ITextEditor editor, Object minibufferResult) {
	TextSearchQueryProvider provider= TextSearchQueryProvider.getPreferred();
	ISearchResult result = (ISearchResult)minibufferResult; 
	try {
		ISearchQuery query= provider.createQuery(getTextInput(result.getSearchStr(),result.isCaseSensitive(),getInputObject(editor)));
		if (query != null) {
			// and execute the search
			NewSearchUI.runQueryInBackground(query);
		}	
	} catch (OperationCanceledException ex) {
		// action canceled
	} catch (CoreException e) {}
	return true;
}
 
Example #18
Source File: OccurrencesSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void partHidden(IWorkbenchPartReference partRef) {
	if (NewSearchUI.SEARCH_VIEW_ID.equals(partRef.getId()) && partRef.getPart(true) == getViewPart()) {
		fIsVisible= false;
		uninstallOnActiveEditor();
	} else if (partRef instanceof IEditorReference && partRef.getPart(true) == fActiveEditor) {
		uninstallOnActiveEditor();
	}
}
 
Example #19
Source File: OccurrencesSearchResultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void partVisible(IWorkbenchPartReference partRef) {
	if (NewSearchUI.SEARCH_VIEW_ID.equals(partRef.getId()) && partRef.getPart(true) == getViewPart()) {
		if (fActiveEditor == null) {
			fIsVisible= true;
		}
	}
}
 
Example #20
Source File: SearchResultUpdater.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void queryRemoved(ISearchQuery query) {
    if (fResult.equals(query.getSearchResult())) {
        ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
        NewSearchUI.removeQueryListener(this);
    }
}
 
Example #21
Source File: PyFindAllOccurrences.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected String perform(IAction action, IProgressMonitor monitor) throws Exception {
    IPyRefactoring2 r = (IPyRefactoring2) AbstractPyRefactoring.getPyRefactoring();
    RefactoringRequest req = getRefactoringRequest(new NullProgressMonitor()); //as we're doing it in the background
    req.fillInitialNameAndOffset();
    if (req.initialName != null && req.initialName.trim().length() > 0) {
        NewSearchUI.runQueryInBackground(newQuery(r, req));
    }
    return null;
}
 
Example #22
Source File: SearchLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public SearchLabelProvider(JavaSearchResultPage page) {
	super(DEFAULT_SEARCH_TEXTFLAGS, DEFAULT_SEARCH_IMAGEFLAGS);
	addLabelDecorator(new ProblemsLabelDecorator(null));

	fPage= page;
	fLabelProviderMap= new HashMap<IMatchPresentation, ILabelProvider>(5);

	fSearchPreferences= new ScopedPreferenceStore(InstanceScope.INSTANCE, NewSearchUI.PLUGIN_ID);
	fSearchPropertyListener= new IPropertyChangeListener() {
		public void propertyChange(PropertyChangeEvent event) {
			doSearchPropertyChange(event);
		}
	};
	fSearchPreferences.addPropertyChangeListener(fSearchPropertyListener);
}
 
Example #23
Source File: PySearchIndexPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean performAction() {
    ScopeAndData scopeAndData = getScopeAndData();
    SearchIndexData data = new SearchIndexData(fPattern.getText(), fIsCaseSensitiveCheckbox.getSelection(),
            fIsWholeWordCheckbox.getSelection(), scopeAndData.scope, scopeAndData.scopeData, "*"); // filenamePattern is always * for Python searches (we'll always be searching the whole index).
    PySearchIndexQuery query = new PySearchIndexQuery(data);
    NewSearchUI.runQueryInBackground(query);
    searchIndexDataHistory.add(data);
    searchIndexDataHistory.writeConfiguration();
    return true;
}
 
Example #24
Source File: FindHelper.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private static void performFind(final String searchText, final boolean caseSensitive, final boolean isRegEx,
		final FileTextSearchScope searchScope)
{
	try
	{
		ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput()
		{

			public boolean isRegExSearch()
			{
				return isRegEx;
			}

			public boolean isCaseSensitiveSearch()
			{
				return caseSensitive;
			}

			public String getSearchText()
			{
				return searchText;
			}

			public FileTextSearchScope getScope()
			{
				return searchScope; //$NON-NLS-1$
			}
		});
		NewSearchUI.runQueryInBackground(query);
	}
	catch (CoreException e1)
	{
		FindBarPlugin.log(e1);
	}
}
 
Example #25
Source File: ReferencesCodeLens.java    From typescript.java with MIT License 5 votes vote down vote up
@Override
public void open() {
	// Execute Search
	try {
		int offset = tsFile.getPosition(getRange().startLineNumber, getRange().startColumn);
		TypeScriptSearchQuery query = new TypeScriptSearchQuery(tsFile.getResource(), offset);
		NewSearchUI.runQueryInBackground(query);
	} catch (TypeScriptException e) {
		e.printStackTrace();
	}
}
 
Example #26
Source File: SearchWholeWordAction.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run(IAction action) {
   	final String pattern = getPattern();
   	if (pattern.isEmpty()) {
   		return;
   	}
       
       try {
       	ISearchQuery query = TextSearchQueryProvider.getPreferred().createQuery(new TextSearchInput() {
			
			@Override
			public boolean isRegExSearch() {
				return true;
			}
			
			@Override
			public boolean isCaseSensitiveSearch() {
				return true;
			}
			
			@Override
			public String getSearchText() {
				return pattern;
			}
			
			@Override
			public FileTextSearchScope getScope() {
				return SearchWholeWordAction.this.getScope(); //$NON-NLS-1$
			}
		});
       	NewSearchUI.runQueryInBackground(query);
	} catch (CoreException e) {
		e.printStackTrace();
	}
       
	return;
}
 
Example #27
Source File: ModulaSearchPage.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean performAction() {
    saveQueryData();
    NewSearchUI.activateSearchResultView();
    NewSearchUI.runQueryInBackground(new ModulaSearchQuery(getInput()));
    return true;
 }
 
Example #28
Source File: OpenModulaSearchPage.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run(IAction action) {
    if (fWindow == null || fWindow.getActivePage() == null) {
        beep();
        LogHelper.logError("Could not open the search dialog - for some reason the window handle was null"); //$NON-NLS-1$
        return;
    }
    NewSearchUI.openSearchDialog(fWindow, ModulaSearchPage.PAGE_ID);
}
 
Example #29
Source File: LangPerspective.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void addShowViewShortcuts(IPageLayout layout) {
	layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
	
	layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
	layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
	layout.addShowViewShortcut(NewSearchUI.SEARCH_VIEW_ID);
	layout.addShowViewShortcut(IPageLayout.ID_PROGRESS_VIEW);
	layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
}
 
Example #30
Source File: GoSearchPage.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public boolean performAction() {
  try {
    NewSearchUI.runQueryInBackground(newQuery());
  } catch (CoreException e) {
    ErrorDialog.openError(getShell(), "Search",
        "Problems occurred while searching. The affected files will be skipped.", e.getStatus());
    return false;
  }
  return true;
}