Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IJavaElement


   */
  public void test_isEntryPoint() throws Exception {
    IJavaProject javaProject = m_testProject.getJavaProject();
    // IJavaProject is NOT EntryPoint
    {
      IJavaElement element = javaProject;
      assertFalse(Utils.isEntryPoint(element));
    }
    // existing EntryPoint
    {
      IJavaElement element = javaProject.findType("test.client.Module");
      assertTrue(Utils.isEntryPoint(element));
    }
    // RemoteService impl is NOT EntryPoint
    {
      IType element = GTestUtils.createTestService(this)[0];
View Full Code Here


        {
            candidate = ((IAdaptable) candidate).getAdapter(IJavaElement.class);
        }
        if (candidate instanceof IJavaElement)
        {
            IJavaElement element = (IJavaElement) candidate;
            IJavaElement elementToLaunch = null;
            try
            {
                switch (element.getElementType())
                {
                    case IJavaElement.JAVA_PROJECT:
View Full Code Here

     */
    protected IMember[] evaluateTests(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException
    {
        IJavaProject javaProject = getJavaProject(configuration);

        IJavaElement testTarget = getTestTarget(configuration, javaProject);
        String testMethodName = configuration.getAttribute(JUnitLaunchConfigurationConstants.ATTR_TEST_METHOD_NAME, ""); //$NON-NLS-1$
        if (testMethodName.length() > 0)
        {
            if (testTarget instanceof IType)
            {
View Full Code Here

    private final IJavaElement getTestTarget(ILaunchConfiguration configuration, IJavaProject javaProject) throws CoreException
    {
        String containerHandle = configuration.getAttribute(JUnitLaunchConfigurationConstants.ATTR_TEST_CONTAINER, ""); //$NON-NLS-1$
        if (containerHandle.length() != 0)
        {
            IJavaElement element = JavaCore.create(containerHandle);
            if (element == null || !element.exists())
            {
                abort(JUnitMessages.JUnitLaunchConfigurationDelegate_error_input_element_deosn_not_exist, null, IJavaLaunchConfigurationConstants.ERR_UNSPECIFIED_MAIN_TYPE);
            }
            return element;
        }
View Full Code Here

    /* (non-Javadoc)
     * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
     */
    public void setDefaults(ILaunchConfigurationWorkingCopy config)
    {
        IJavaElement javaElement = getContext();
        if (javaElement != null)
        {
            initializeJavaProject(javaElement, config);
        }
        else
View Full Code Here

                    {
                        return (IJavaElement) obj;
                    }
                    if (obj instanceof IResource)
                    {
                        IJavaElement je = JavaCore.create((IResource) obj);
                        if (je == null)
                        {
                            IProject pro = ((IResource) obj).getProject();
                            je = JavaCore.create(pro);
                        }
View Full Code Here

    }
   
    private void filterLocations(MapInstance map) throws OperationCanceledException, CoreException {
        List<Location> result = new ArrayList<Location>();
        for (Location each: map.locations()) {
            IJavaElement javaElement = Resources.asJavaElement(each.getDocument());
            IType[] findTestTypes = JUnitCore.findTestTypes(javaElement, null);
            // we have found a test within the resource, in our case this means the
            // resource is a test as the resources represent files a.k.a. compilation units
            if (findTestTypes.length >= 1) continue;
            result.add(each);
View Full Code Here

  }

  public static String asPath(Object each) {
    IResource resource = Adaptables.adapt(each, IResource.class);
    if (resource != null) return asPath(resource);
    IJavaElement element = Adaptables.adapt(each, IJavaElement.class);
    if (element != null) return asPath(element);
    return null;
  }
View Full Code Here

         * with Test).
         *
         * This is a TODO for a world where days have more than 24h.
         *
         */
        IJavaElement javaElement = Resources.asJavaElement(resource);
        if (javaElement == null) return false;
        // find all tests for the given file
        IType[] findTestTypes;
        try {
            findTestTypes = JUnitCore.findTestTypes(javaElement, null);
View Full Code Here

            this.identifiers = identifiers;
        }

        @Override
        public boolean visit(IResource resource) throws CoreException {
            IJavaElement javaElement = JavaCore.create(resource);
            if (javaElement == null)
                return true;
            if (javaElement.getElementType() != IJavaElement.COMPILATION_UNIT)
                return true;
            ICompilationUnit compilationUnit = (ICompilationUnit) javaElement
                    .getAdapter(ICompilationUnit.class);
            return visit(compilationUnit);
        }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IJavaElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.