Example usage for org.eclipse.jdt.internal.core.search JavaSearchScope add

List of usage examples for org.eclipse.jdt.internal.core.search JavaSearchScope add

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core.search JavaSearchScope add.

Prototype

public void add(IJavaElement element) throws JavaModelException 

Source Link

Document

Add an element to the java search scope.

Usage

From source file:org.bonitasoft.studio.connector.model.definition.wizard.support.InputTypeEditingSupport.java

License:Open Source License

@SuppressWarnings("restriction")
protected void openClassSelectionDialog() {
    JavaSearchScope scope = new JavaSearchScope();
    try {/*  w  w w  .  ja v  a  2s. c om*/
        scope.add(RepositoryManager.getInstance().getCurrentRepository().getJavaProject());
    } catch (Exception ex) {
        BonitaStudioLog.error(ex);
    }
    FilteredTypesSelectionDialog searchDialog = new FilteredTypesSelectionDialog(
            Display.getDefault().getActiveShell(), false, null, scope, IJavaSearchConstants.TYPE);
    if (searchDialog.open() == Dialog.OK) {
        input.setType(((IType) searchDialog.getFirstResult()).getFullyQualifiedName());
        getViewer().refresh();
    }
}

From source file:org.bonitasoft.studio.connector.model.definition.wizard.support.OutputTypeEditingSupport.java

License:Open Source License

@SuppressWarnings("restriction")
protected void openClassSelectionDialog() {
    JavaSearchScope scope = new JavaSearchScope();
    try {/*from   w ww  .j  a va  2  s.c  om*/
        scope.add(RepositoryManager.getInstance().getCurrentRepository().getJavaProject());
    } catch (Exception ex) {
        BonitaStudioLog.error(ex);
    }
    FilteredTypesSelectionDialog searchDialog = new FilteredTypesSelectionDialog(
            Display.getDefault().getActiveShell(), false, null, scope, IJavaSearchConstants.TYPE);
    if (searchDialog.open() == Dialog.OK) {
        output.setType(((IType) searchDialog.getFirstResult()).getFullyQualifiedName());
        getViewer().refresh();
    }
}

From source file:org.bonitasoft.studio.data.ui.wizard.DataWizardPage.java

License:Open Source License

@SuppressWarnings("restriction")
protected void openClassSelectionDialog(final Text classText) {
    final JavaSearchScope scope = new JavaSearchScope();
    try {//from  w w  w.  jav a2s.c  om
        scope.add(RepositoryManager.getInstance().getCurrentRepository().getJavaProject());
    } catch (final Exception ex) {
        BonitaStudioLog.error(ex);
    }
    final FilteredTypesSelectionDialog searchDialog = new FilteredTypesSelectionDialog(getShell(), false, null,
            scope, IJavaSearchConstants.TYPE);
    if (searchDialog.open() == Window.OK) {
        classText.setText(((IType) searchDialog.getFirstResult()).getFullyQualifiedName());
    }
}

From source file:org.bonitasoft.studio.properties.sections.iteration.IterationPropertySection.java

License:Open Source License

private String openClassSelectionDialog() {
    final JavaSearchScope scope = new JavaSearchScope();
    try {// www .j av a 2s . c o  m
        scope.add(RepositoryManager.getInstance().getCurrentRepository().getJavaProject());
    } catch (final Exception ex) {
        BonitaStudioLog.error(ex);
    }
    final FilteredTypesSelectionDialog searchDialog = new FilteredTypesSelectionDialog(
            Display.getDefault().getActiveShell(), false, null, scope, IJavaSearchConstants.TYPE);
    if (searchDialog.open() == Dialog.OK) {
        return ((IType) searchDialog.getFirstResult()).getFullyQualifiedName();
    }
    return null;
}

From source file:org.bonitasoft.studio.scripting.provider.ScriptExpressionEditor.java

License:Open Source License

/**
 * @param classText/*from   w  ww  .j  a  v a 2s.co m*/
 */
@SuppressWarnings("restriction")
private void openClassSelectionDialog() {
    JavaSearchScope scope = new JavaSearchScope();
    try {
        scope.add(RepositoryManager.getInstance().getCurrentRepository().getJavaProject());
    } catch (Exception ex) {
        BonitaStudioLog.error(ex);
    }
    FilteredTypesSelectionDialog searchDialog = new FilteredTypesSelectionDialog(
            Display.getDefault().getActiveShell(), false, null, scope, IJavaSearchConstants.TYPE);
    if (searchDialog.open() == Dialog.OK) {
        String selectedTypeName = ((IType) searchDialog.getFirstResult()).getFullyQualifiedName();
        typeCombo.setInput(selectedTypeName);
        inputExpression.setReturnType(selectedTypeName);
    }
}

From source file:org.eclipse.ajdt.core.tests.search.AbstractITDSearchTest.java

License:Open Source License

protected List<SearchMatch> findSearchMatches(IJavaElement elt, String name, int flags) throws Exception {
    javaProject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
    waitForManualBuild();/*  w w  w . j a  va2 s.  c o  m*/
    assertNoProblems(javaProject.getProject());

    AspectJCoreTestPlugin.logInfo("About to create Search pattern in " + name);
    SearchPattern pattern = SearchPattern.createPattern(elt, flags);
    SearchEngine engine = new SearchEngine();
    JavaSearchScope scope = new JavaSearchScope();
    scope.add(javaProject);

    AspectJCoreTestPlugin.logInfo("About to perform search in " + name);
    ITDAwareSearchRequestor requestor = new ITDAwareSearchRequestor();
    engine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope,
            requestor, new NullProgressMonitor());
    return requestor.getMatches();
}

From source file:org.eclipse.ajdt.internal.core.refactoring.ITDAccessorRenameParticipant.java

License:Open Source License

private List<SearchMatch> findReferences(IMember accessor) {
    SearchPattern pattern = SearchPattern.createPattern(accessor, IJavaSearchConstants.REFERENCES);
    SearchEngine engine = new SearchEngine();
    JavaSearchScope scope = new JavaSearchScope();
    try {// w  w w .  jav  a 2s  .  c  om
        scope.add(accessor.getJavaProject());
        CollectingSearchRequestor requestor = new CollectingSearchRequestor();
        engine.search(pattern, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope,
                requestor, new NullProgressMonitor());
        return requestor.getResults();
    } catch (JavaModelException e) {
    } catch (CoreException e) {
    }

    return Collections.emptyList();
}