Example usage for org.eclipse.jdt.core ITypeHierarchy refresh

List of usage examples for org.eclipse.jdt.core ITypeHierarchy refresh

Introduction

In this page you can find the example usage for org.eclipse.jdt.core ITypeHierarchy refresh.

Prototype

void refresh(IProgressMonitor monitor) throws JavaModelException;

Source Link

Document

Re-computes the type hierarchy reporting progress.

Usage

From source file:org.eclipse.objectteams.otdt.tests.hierarchy.FileBasedHierarchyTest.java

License:Open Source License

private ITypeHierarchy createTypeHierarchy(IType focusType, boolean computeSubtypes) throws JavaModelException {
    ITypeHierarchy hierarchy = new TypeHierarchy(focusType, null, focusType.getJavaProject(), computeSubtypes);
    hierarchy.refresh(new NullProgressMonitor());
    return hierarchy;
}

From source file:org.eclipse.objectteams.otdt.tests.hierarchy.ITypeIOTTypeTest.java

License:Open Source License

public void _testGetOTSuperTypeHierarchy() throws JavaModelException {
    _testObj = createTypeHierarchy(_MyTeam);

    ITypeHierarchy first = new TypeHierarchy(_MyTeam, null, _MyTeam.getJavaProject(), false);
    first.refresh(null);
    ITypeHierarchy second = new TypeHierarchy(_OT_MyTeam, null, _OT_MyTeam.getJavaProject(), false);
    second.refresh(null);/*from ww  w  .j  a  v a2  s .  com*/

    assertEquals(first, second);
}

From source file:org.eclipse.objectteams.otdt.tests.superhierarchy.OTSuperTypeHierarchyTest008.java

License:Open Source License

public void testGetAllSuperclasses_T22T11R2() throws JavaModelException {
    _focusType = _T22T11R2;//from w  ww  .j  a va  2 s. c o  m

    ITypeHierarchy hierarchy = new TypeHierarchy(_focusType, null, _focusType.getJavaProject(), false);
    hierarchy.refresh(new NullProgressMonitor());

    IType[] actual = hierarchy.getAllSuperclasses(_focusType);
    IType[] expected = new IType[] { _objectType, _T22T11R1, _T21T11R1, _T21T11R2, };

    assertEquals(expected.length, actual.length);
    assertTrue(compareTypes(expected, actual));
}

From source file:org.eclipse.objectteams.otdt.tests.superhierarchy.OTSuperTypeHierarchyTest008.java

License:Open Source License

public void testGetAllSuperclasses_T22T12R3() throws JavaModelException {
    _focusType = _T22T12R3;/*w w w. ja  va 2 s.  com*/

    ITypeHierarchy hierarchy = new TypeHierarchy(_focusType, null, _focusType.getJavaProject(), false);
    hierarchy.refresh(new NullProgressMonitor());

    IType[] actual = hierarchy.getAllSuperclasses(_focusType);
    IType[] expected = new IType[] { _objectType, _T21T11R1, _T21T11R2, _T21T11R3, _T21T12R1, _T21T12R2,
            _T21T12R3, _T22T11R1, _T22T11R2, _T22T11R3, _T22T12R1, _T22T12R2, };

    assertEquals(expected.length, actual.length);
    assertTrue(compareTypes(expected, actual));
}

From source file:org.hawkinssoftware.rns.analysis.compile.source.TypeHierarchyCache.java

License:Open Source License

public ITypeHierarchy get(String typename) {
    ITypeHierarchy hierarchy = hierarchiesByTypename.get(typename);
    if (modifiedHierarchies.contains(typename)) {
        Log.out(Tag.DEBUG, "Refreshing type hierarchy for %s", typename);

        try {/*from  w w w .ja  v  a 2 s . c o m*/
            hierarchy.refresh(null);
        } catch (CoreException e) {
            hierarchiesByTypename.remove(typename);
            throw new RuntimeException(
                    String.format("Failed to refresh the type hierarchy for type %s", typename));
        }

        modifiedHierarchies.remove(typename);
    }
    return hierarchy;
}

From source file:org.jboss.tools.ws.jaxrs.core.jdt.JdtUtils.java

License:Open Source License

/**
 * Returns the hierarchy for the given type, or null if it could not be
 * 'computed'.// w  ww  .  ja v a2s .c o  m
 * 
 * @param baseType
 *            the base type for the hierarchy
 * @param includeLibraries
 *            should the hierarchy include type from libraries
 * @param progressMonitor
 *            a progress monitor (or null)
 * @return the SourceType Hierarchy for the base type
 * @throws CoreException
 *             the underlying CoreException thrown by the manipulated JDT
 *             APIs
 */
public static ITypeHierarchy resolveTypeHierarchy(final IType baseType, final IJavaElement scope,
        final boolean includeLibraries, final IProgressMonitor progressMonitor) throws CoreException {
    // create type hierarchy
    // FIXME : restrict operation scope to sources only, exclude application
    // libraries.
    int appLibs = 0;
    if (includeLibraries) {
        appLibs = IJavaSearchScope.APPLICATION_LIBRARIES;
    }
    IJavaSearchScope searchScope = SearchEngine.createJavaSearchScope(new IJavaElement[] { scope },
            IJavaSearchScope.SOURCES | appLibs | IJavaSearchScope.REFERENCED_PROJECTS);
    CreateTypeHierarchyOperation operation = new CreateTypeHierarchyOperation(baseType, null, searchScope,
            true);
    ITypeHierarchy hierarchy = operation.getResult();
    if (hierarchy != null && hierarchy.exists()) {
        hierarchy.refresh(progressMonitor);
        return hierarchy;
    }
    Logger.warn("No type hierarchy found for " + baseType.getFullyQualifiedName());
    return null;
}

From source file:org.mwc.debrief.editable.test.EditableTests.java

License:Open Source License

/**
 * Run the editable properties/*from   w  w w.j  a  v a 2  s  .c  o  m*/
 * 
 * @throws CoreException
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
public void testEditable()
        throws CoreException, ClassNotFoundException, InstantiationException, IllegalAccessException {
    IProgressMonitor monitor = new NullProgressMonitor();
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(ORG_MWC_CMAP_LEGACY);
    IJavaProject javaProject = null;
    if (project.exists()) {
        javaProject = JavaCore.create(project);
        javaProject.open(monitor);
    }
    //      else
    //      {
    //         SearchablePluginsManager manager = PDECore.getDefault().getSearchablePluginsManager();
    //         javaProject = manager.getProxyProject();
    //      }
    IType editableType = javaProject.findType("MWC.GUI.Editable");
    ITypeHierarchy hierarchy = editableType.newTypeHierarchy(null);
    hierarchy.refresh(monitor);
    IType[] subTypes = hierarchy.getAllSubtypes(editableType);
    for (IType type : subTypes) {
        if (type.isClass() && !Flags.isAbstract(type.getFlags()) && Flags.isPublic(type.getFlags())) {
            //System.out.println(type.getFullyQualifiedName());
            Editable editable = getEditable(type);
            if (editable == null) {
                continue;
            }
            EditorType info = null;
            try {
                info = editable.getInfo();
            } catch (Exception e) {
                System.out.println("Info issue " + type.getFullyQualifiedName() + " " + e.getMessage());
                continue;
            }
            if (info == null) {
                continue;
            }
            //System.out.println("Testing " + type.getFullyQualifiedName());
            if ("org.mwc.cmap.core.ui_support.swt.SWTCanvasAdapter".equals(type.getFullyQualifiedName())) {
                final Editable ed = editable;
                Display.getDefault().syncExec(new Runnable() {

                    @Override
                    public void run() {
                        testTheseParameters(ed);
                    }
                });
            } else {
                testTheseParameters(editable);
            }
        }
    }
}