Examples of IClassFile


Examples of org.eclipse.jdt.core.IClassFile

        }
        boolean abstractOrInterface = false;
        try {
            switch (javaEl.getElementType()) {
                case IJavaElement.CLASS_FILE :
                    IClassFile classFile = (IClassFile) javaEl;
                    if(isOnClasspath(javaEl)) {
                        abstractOrInterface = classFile.isInterface();
                    } /*else {
                       this is the case for eclipse-generated class files.
                       if we do not perform the check in if, then we will have java model
                       exception on classFile.isInterface() call.
                    }*/
 
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

        return decompiled;
    }

    private IEditorInput doOpenBuffer(IJavaReferenceType type,
        IClassFile parent, boolean externalClass) {
        IClassFile classFile = null;
        try {
            classFile = JdtUtils.getInnerType(parent, getSourceMapper()
                .getDecompiledClass(parent), type.getSignature());
        } catch (DebugException e) {
            BytecodeOutlinePlugin.log(e, IStatus.ERROR);
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

    }

    private IEditorInput doOpenBuffer(IEditorInput input, boolean force,
        boolean reuseSource) {
        if (input instanceof IClassFileEditorInput) {
            IClassFile cf = ((IClassFileEditorInput) input).getClassFile();
            String origSrc = getAttachedJavaSource(cf, force);
            if (origSrc != null && !hasMappedSource) {
                // remember, that the JDT knows where the real source is and can show it
                setHasMappedSource(true);
            }

            if (origSrc == null || (force && !reuseSource)) {
                setDecompiled(true);
                char[] src;
                if (input instanceof ExternalClassFileEditorInput) {
                    ExternalClassFileEditorInput extInput = (ExternalClassFileEditorInput) input;
                    src = getSourceMapper().getSource(
                        extInput.getFile(), cf, decompilerFlags);
                } else {
                    src = getSourceMapper().getSource(cf, decompilerFlags);
                }
                changeBufferContent(cf, src);
            } else {
                setDecompiled(false);
            }
        } else if (input instanceof FileEditorInput) {
            FileEditorInput fileEditorInput = (FileEditorInput) input;
            // make class file from that
            IClassFileEditorInput cfi = (IClassFileEditorInput) transformEditorInput(input);
            // return changed reference
            input = cfi;
            setDecompiled(true);
            IClassFile cf = cfi.getClassFile();
            char[] src = getSourceMapper().getSource(
                fileEditorInput.getFile(), cf, decompilerFlags);
            changeBufferContent(cf, src);
        }
        return input;
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

    /*
     * @see JavaEditor#getElementAt(int)
     */
    protected IJavaElement getElementAt(int offset) {

        IClassFile classFile = getClassFile();
        if (classFile == null) {
            return null;
        }
        IJavaElement result = null;
        if (isDecompiled()) {
            IDocument document = getDocumentProvider().getDocument(
                getEditorInput());
            try {
                // XXX have test if the requested line is from bytecode or sourcecode?!?
                if(document.getLength() > offset){
                    int lineAtOffset = document.getLineOfOffset(offset);
                    // get DecompiledMethod from line, then get JavaElement with same
                    // signature, because we do not have offsets or lines in the class file,
                    // only java elements...
                    result = getSourceMapper().findElement(classFile, lineAtOffset);
                }
            } catch (BadLocationException e) {
                BytecodeOutlinePlugin.log(e, IStatus.ERROR);
            }
        } else {
            try {
                result = classFile.getElementAt(offset);
            } catch (JavaModelException e) {
                BytecodeOutlinePlugin.log(e, IStatus.ERROR);
            }
        }

View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

    /*
     * @see JavaEditor#getCorrespondingElement(IJavaElement)
     */
    protected IJavaElement getCorrespondingElement(IJavaElement element) {
        IClassFile classFile = getClassFile();
        if (classFile == null) {
            return super.getCorrespondingElement(element);
        }
        if (classFile.equals(element.getAncestor(IJavaElement.CLASS_FILE))) {
            return element;
        }
        return super.getCorrespondingElement(element);
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

     */
    public void inputChanged(final IClassFileEditorInput input) {
        Runnable updateInput = new Runnable() {
            public void run() {
                fInputUpdater.post(input);
                IClassFile cf = input.getClassFile();
                try {
                    String source = cf.getSource();
                    setDecompiled(source != null && source.startsWith(MARK));
                } catch (JavaModelException e) {
                    BytecodeOutlinePlugin.log(e, IStatus.ERROR);
                }

View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

        if (documentProvider instanceof ClassFileDocumentProvider) {
            ((ClassFileDocumentProvider) documentProvider)
                .removeInputChangeListener(this);
        }

        IClassFile classFile = getClassFile();
        BytecodeBufferManager.removeBuffer(BytecodeBufferManager
            .getBuffer(classFile));
        super.dispose();
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

        IEditorInput input = null;
        // check if it is a inner class from the class in editor
        if (!hasInnerClass(debugType, parent)) {
            // not only inner classes could be defined in the same source file, but also
            // local types (non public non inner classes in the same source file)
            IClassFile classFile = getLocalTypeClass(debugType, parent);
            if(classFile != null){
                input = editor.doOpenBuffer(classFile, externalClass);
            }
        } else {
            // if both exists, replace the input to the inner class
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

            createTypedElement(element2, modes)));
    }

    protected TypedElement createTypedElement(IJavaElement javaElement, BitSet modes) {
        String name;
        IClassFile classFile = (IClassFile) javaElement
            .getAncestor(IJavaElement.CLASS_FILE);
        // existing read-only class files
        if (classFile != null) {
            name = classFile.getPath().toOSString();
            if (!name.endsWith(".class")) { //$NON-NLS-1$
                name += '/' + JdtUtils.getFullBytecodeName(classFile);
            }
        } else {
            // usual eclipse - generated bytecode
View Full Code Here

Examples of org.eclipse.jdt.core.IClassFile

                    IClasspathEntry ce = rt.getRawClasspathEntry();
                    IPath path = ce.getPath();
                    skip = "org.eclipse.jdt.launching.JRE_CONTAINER".equals(path.toString());
                    break;
                case IJavaElement.CLASS_FILE:
                    IClassFile cf = (IClassFile) e;
                    if (cf.getElementName().startsWith(pckg))
                    {
                        findIndirectReferences(indirect,
                            findPackage(cf.getType().getSuperclassName()), p, p);
                    }
                    break;
                case IJavaElement.COMPILATION_UNIT:
                    ICompilationUnit cu = (ICompilationUnit) e;
                    break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.