Example usage for org.eclipse.jdt.core.search IJavaSearchScope setIncludesBinaries

List of usage examples for org.eclipse.jdt.core.search IJavaSearchScope setIncludesBinaries

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.search IJavaSearchScope setIncludesBinaries.

Prototype

public void setIncludesBinaries(boolean includesBinaries);

Source Link

Document

Sets whether this scope contains any .class files (either in folders or within JARs).

Usage

From source file:org.eclipse.jst.ws.internal.ui.dialog.DialogUtils.java

License:Open Source License

public static IType browseClassesAsIType(Shell parentShell, IResource[] resources, IRunnableContext ctxt) {
    Vector javaElements = new Vector();
    for (int i = 0; i < resources.length; i++) {
        IJavaElement javaElement = JavaCore.create(resources[i]);
        if (javaElement != null)
            javaElements.add(javaElement);
    }/* w  w  w  .  java  2s .co  m*/
    IJavaElement[] elements = (IJavaElement[]) javaElements.toArray(new IJavaElement[0]);

    IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
    scope.setIncludesClasspaths(true);
    scope.setIncludesBinaries(true);

    //Creating and opening a TypeSelectionDialog
    try {
        // We want to show every class when the dialog is opened, so throw in this String
        String filterStringToSelectEverything = "* "; //$NON-NLS-1$

        SelectionDialog dialog = JavaUI.createTypeDialog(parentShell, ctxt, scope,
                IJavaElementSearchConstants.CONSIDER_CLASSES, false, filterStringToSelectEverything);
        dialog.setTitle(WSUIPluginMessages.DIALOG_TITLE_CLASS_BROWSE);
        dialog.setMessage(WSUIPluginMessages.LABEL_CLASS_BROWSE);
        dialog.open();

        //Getting the result and returning it
        Object[] results = dialog.getResult();
        if (results != null && results.length > 0) {
            if (results[0] instanceof IType) {
                return (IType) results[0];
            }
        }
    } catch (JavaModelException jme) {
    }
    return null;
}

From source file:org.eclipse.jst.ws.internal.ui.dialog.DialogUtils.java

License:Open Source License

/**
* Raises a dialog for browsing interfaces on a project's class path.
* @param parentShell The parent shell, optionally null.
* @param project The project./* ww w .  j  a  va2  s.  c  o  m*/
* @param container The container of the launching wizard.
* @return The qualified name of the selected java interface.
*/
public static String browseInterfaces(Shell parentShell, IProject project, IWizardContainer container)

{
    String interfaceName = null;

    //Limiting search scope to the project
    IResource[] resources = new IResource[1];
    resources[0] = project;
    IJavaElement[] elements = new IJavaElement[1];
    elements[0] = JavaCore.create(resources[0]);
    IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements);
    scope.setIncludesClasspaths(true);
    scope.setIncludesBinaries(true);

    //Creating and opening a TypeSelectionDialog
    try {
        SelectionDialog dialog = JavaUI.createTypeDialog(parentShell, container, scope,
                IJavaElementSearchConstants.CONSIDER_TYPES, false);
        dialog.setTitle(WSUIPluginMessages.DIALOG_TITLE_INTERFACE_BROWSE);
        dialog.setMessage(WSUIPluginMessages.DIALOG_TITLE_INTERFACE_BROWSE);
        dialog.open();

        //Getting the result and returning it
        Object[] results = dialog.getResult();
        if (results != null && results.length > 0) {
            if (results[0] instanceof IType) {
                IType resultInterface = (IType) results[0];
                interfaceName = resultInterface.getFullyQualifiedName();
            }
        }
    } catch (JavaModelException jme) {
    }

    return interfaceName;
}

From source file:org.eclipse.xtext.common.types.xtext.ui.IntersectingJavaSearchScope.java

License:Open Source License

@Override
@Deprecated/* w  w  w . j  a  va2 s  . c o m*/
public void setIncludesBinaries(boolean includesBinaries) {
    for (IJavaSearchScope scope : scopes)
        scope.setIncludesBinaries(includesBinaries);
}

From source file:org.summer.dsl.model.types.xtext.ui.IntersectingJavaSearchScope.java

License:Open Source License

@Deprecated
public void setIncludesBinaries(boolean includesBinaries) {
    for (IJavaSearchScope scope : scopes)
        scope.setIncludesBinaries(includesBinaries);
}