Examples of IJavaElement


Examples of org.eclipse.jdt.core.IJavaElement

     */
    private static void collectAllAnonymous(List list, IParent parent,
        boolean allowNested) throws JavaModelException {
        IJavaElement[] children = parent.getChildren();
        for (int i = 0; i < children.length; i++) {
            IJavaElement childElem = children[i];
            if (isAnonymousType(childElem)) {
                list.add(childElem);
            }
            if (childElem instanceof IParent) {
                if(allowNested || !(childElem instanceof IType)) {
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

     */
    private static int getAnonCompilePriority50(IJavaElement javaElement,
        IJavaElement firstAncestor, IJavaElement topAncestor) {

        // search for initializer block
        IJavaElement initBlock = getLastAncestor(javaElement, IJavaElement.INITIALIZER);
        // test is for anon. classes from initializer blocks
        if (initBlock != null) {
            return 10; // from inner from class init
        }

View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

        IJavaElement firstAncestor, IJavaElement topAncestor, boolean is50OrHigher) {
        if(is50OrHigher){
            return getAnonCompilePriority50(elt, firstAncestor, topAncestor);
        }

        IJavaElement firstNonAnon = getFirstNonAnonymous(elt, topAncestor);

        // get rid of children from local types
        if(topAncestor != firstNonAnon && isLocal(firstNonAnon)){
            return 5; // local anon. types have same prio as anon. from regular code
        }

        IJavaElement initBlock = getLastAncestor(elt, IJavaElement.INITIALIZER);
        // test is for anon. classes from initializer blocks
        if (initBlock != null) {
            if(isAnyParentLocal(firstAncestor, topAncestor)){
                return 5; // init blocks from local types have same prio as regular
            }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

        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?!?
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

        } else {
            int offset = sourceViewer.getVisibleRegion().getOffset();
            caret = offset + styledText.getCaretOffset();
        }

        IJavaElement element = getElementAt(caret);

        if (!(element instanceof ISourceReference)) {
            return null;
        }
        return (ISourceReference) element;
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

     * @param file the class file
     * @return the package fragment root of the given class file
     */
    IPackageFragmentRoot getPackageFragmentRoot(IClassFile file) {

        IJavaElement element= file.getParent();
        while (element != null && element.getElementType() != IJavaElement.PACKAGE_FRAGMENT_ROOT) {
            element= element.getParent();
        }

        return (IPackageFragmentRoot) element;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

         * Very simple comparision based on init/not init block decision and then on the
         * source code position
         */
        private int compare50(IType m1, IType m2){

            IJavaElement firstAncestor1 = getFirstAncestor(m1);
            IJavaElement firstAncestor2 = getFirstAncestor(m2);

            int compilePrio1 = getCompilePrio(m1, firstAncestor1);
            int compilePrio2 = getCompilePrio(m2, firstAncestor2);

            if (compilePrio1 > compilePrio2) {
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

            IType m2 = (IType) o2;
            if(is50OrHigher){
                return compare50(m1, m2);
            }

            IJavaElement firstAncestor1 = getFirstAncestor(m1);
            IJavaElement firstAncestor2 = getFirstAncestor(m2);

            int compilePrio1 = getCompilePrio(m1, firstAncestor1);
            int compilePrio2 = getCompilePrio(m2, firstAncestor2);

            if (compilePrio1 > compilePrio2) {
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

     * @return editor input as IJavaElement
     */
    public static IJavaElement getJavaInput(IEditorPart part) {
        IEditorInput editorInput = part.getEditorInput();
        if (editorInput != null) {
            IJavaElement input = (IJavaElement) editorInput
                .getAdapter(IJavaElement.class);
            return input;
        }
        return null;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IJavaElement

        int type = resource.getElementType();
        if (type == IJavaElement.PACKAGE_FRAGMENT
            || type == IJavaElement.PACKAGE_FRAGMENT_ROOT) {
            return name;
        }
        IJavaElement ancestor = resource
            .getAncestor(IJavaElement.PACKAGE_FRAGMENT);
        if (ancestor != null) {
            return ancestor.getElementName();
        }
        return ""; //$NON-NLS-1$
    }
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.