Example usage for org.eclipse.jdt.core IPackageFragment close

List of usage examples for org.eclipse.jdt.core IPackageFragment close

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IPackageFragment close.

Prototype

public void close() throws JavaModelException;

Source Link

Document

Closes this element and its buffer (if any).

Usage

From source file:org.eclipse.recommenders.codesearch.rcp.index.ui.ProjectIndexerRunnable.java

License:Open Source License

private void analyzePackageFragments() throws Exception {
    for (final IJavaElement child : usingToString().sortedCopy(asList(root.getChildren()))) {
        final IPackageFragment fragment = cast(child);
        monitor.subTask("Analyzing " + fragment.getElementName());

        if (fragment.getElementName().startsWith("sun.")) {
            continue;
        }/*from w  ww .  ja v a  2 s  . c  om*/
        if (fragment.getElementName().startsWith("com.sun.")) {
            continue;
        }
        if (fragment.getElementName().startsWith("com.oracle.")) {
            continue;
        }
        if (fragment.getElementName().startsWith("sunw.")) {
            continue;
        }

        for (final IClassFile clazz : usingToString().sortedCopy(asList(fragment.getClassFiles()))) {
            analyzeClassFile(clazz);
        }
        for (final ICompilationUnit cu : fragment.getCompilationUnits()) {
            analyzeCompilationUnit(cu);
        }
        fragment.close();
    }
    addArchiveVisitedMarker();
}

From source file:org.eclipse.recommenders.internal.apidocs.rcp.StaticHooksProvider.java

License:Open Source License

@JavaSelectionSubscriber
public void onPackageRootSelection(final IPackageFragmentRoot root, final JavaElementSelectionEvent event,
        final Composite parent) throws ExecutionException {

    final TreeMultimap<IType, IMethod> index = TreeMultimap.create(new TypeNameComparator(),
            new MethodNameComparator());
    try {// w  w  w.  j av a  2  s.  c o m
        for (final IJavaElement e : root.getChildren()) {
            if (e.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
                final IPackageFragment pkg = (IPackageFragment) e;
                findStaticHooks(pkg, index);
                pkg.close();
            }
        }
    } catch (final Exception x) {
        log(ERROR_FAILED_TO_DETERMINE_STATIC_MEMBERS, x, root.getElementName());
    }
    runSyncInUiThread(new HooksRendererRunnable(index, parent));
}