當前位置: 首頁>>代碼示例>>Java>>正文


Java ElementOpen.open方法代碼示例

本文整理匯總了Java中org.netbeans.api.java.source.ui.ElementOpen.open方法的典型用法代碼示例。如果您正苦於以下問題:Java ElementOpen.open方法的具體用法?Java ElementOpen.open怎麽用?Java ElementOpen.open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.netbeans.api.java.source.ui.ElementOpen的用法示例。


在下文中一共展示了ElementOpen.open方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void run(CompilationController controller) throws Exception {
    if (cancel.get()) { return; }
    boolean opened = false;
    if (classBinaryName == null) {
        return;
    }
    TypeElement element = JavaUtils.findClassElementByBinaryName(classBinaryName, controller);
    if (element != null) {
        elementFound.set(true);
        if (cancel.get()) { return; }
        opened = ElementOpen.open(javaSource.getClasspathInfo(), element);
    }
    if (!opened) {
        String msg = NbBundle.getMessage(JavaUtils.class, "LBL_SourceNotFound", classBinaryName); //NOI18N
        StatusDisplayer.getDefault().setStatusText(msg);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:JavaUtils.java

示例2: openable

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@NonNull
public static Openable openable(
        @NonNull final ElementHandle<?> handle,
        @NonNull final FileObject fileObject,
        @NonNull final String displayName) {
    return () -> {
        checkFile(fileObject, displayName);
        FileObject file = fileObject;
        if (isClassFile(file)) {
            final FileObject src = findSource(file, handle);
            if (src != null) {
                file = src;
            }
        }
        if (!ElementOpen.open(file, handle)) {
            noSource(displayName);
        }
    };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:OpenAction.java

示例3: open

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void open() {
    FileObject file = getFileObject();
    if (file != null) {
 ClasspathInfo cpInfo = ClasspathInfo.create(file);

 ElementOpen.open(cpInfo, me);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:ResolvedJavaSymbolDescriptor.java

示例4: run

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void run(CompilationController cc) throws Exception {
    TypeElement type = JavaUtils.findClassElementByBinaryName(className, cc);
    if (type == null) {
        return;
    }
    elementFound.set(true);
    Property[] props = new PropertyFinder(
            type.asType(), propName, cc.getElementUtilities(), MatchType.PREFIX).findProperties();
    if (props.length > 0 && props[0].getSetter() != null) {
        ElementOpen.open(cc.getClasspathInfo(), props[0].getSetter());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:PHyperlinkProcessor.java

示例5: actionPerformed

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@NbBundle.Messages({"MSG_NoSource=Source not available for {0}"})
@Override
public void actionPerformed(ActionEvent e) {
    if (!ElementOpen.open(
            description.getClasspathInfo(),
            description.getHandle())) {
        Toolkit.getDefaultToolkit().beep();
        StatusDisplayer.getDefault().setStatusText(
            Bundle.MSG_NoSource(description.getHandle().getQualifiedName()));
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:Nodes.java

示例6: run

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void run(CompilationController cc) throws Exception {
    cc.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED);
    int dotIndex = propChain.lastIndexOf("."); //NOI18N
    if (className == null) {
        return;
    }
    TypeElement te = JavaUtils.findClassElementByBinaryName(className, cc);
    if (te == null) {
        return;
    }
    TypeMirror startType = te.asType();
    ElementUtilities eu = cc.getElementUtilities();

    // property chain
    if (dotIndex != -1) {
        String getterChain = propChain.substring(0, dotIndex);
        StringTokenizer tokenizer = new StringTokenizer(getterChain, "."); //NOI18N
        while (tokenizer.hasMoreTokens() && startType != null) {
            String propertyName = tokenizer.nextToken();
            Property[] props = new PropertyFinder(startType, propertyName, eu, MatchType.PREFIX).findProperties();

            // no matching element found
            if (props.length == 0 || props[0].getGetter() == null) {
                startType = null;
                break;
            }

            TypeMirror retType = props[0].getGetter().getReturnType();
            if (retType.getKind() == TypeKind.DECLARED) {
                startType = retType;
            } else {
                startType = null;
            }
        }
    }

    if (startType == null) {
        return;
    }

    elementFound.set(true);
    String setterProp = propChain.substring(dotIndex + 1);
    Property[] sProps = new PropertyFinder(startType, setterProp, eu, MatchType.PREFIX).findProperties();
    if (sProps.length > 0) {
        ExecutableElement element = jumpToGetter ? sProps[0].getGetter() : sProps[0].getSetter();
        if (element != null) {
            ElementOpen.open(cc.getClasspathInfo(), element);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:52,代碼來源:PropertyHyperlinkProcessor.java

示例7: run

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void run() {
    SourceClassInfo ci = ProfilerTypeUtils.resolveClass(className, project);
    FileObject sourceFile = ci != null ? ci.getFile() : null;

    if (sourceFile == null) {
        return;
    }

    final JavaSource js = JavaSource.forFileObject(sourceFile);
    if (js != null) {
        ScanSensitiveTask<CompilationController> t = new ScanSensitiveTask<CompilationController>() {

            public void run(CompilationController controller) throws Exception {
                if (!controller.toPhase(JavaSource.Phase.ELEMENTS_RESOLVED).equals(JavaSource.Phase.ELEMENTS_RESOLVED)) {
                    return;
                }
                TypeElement parentClass = ElementUtilitiesEx.resolveClassByName(className, controller, true);

                if (cancelled != null && cancelled.get()) return;
                
                if (ElementOpen.open(controller.getClasspathInfo(), parentClass)) {
                    Document doc = controller.getDocument();
                    if (doc != null && doc instanceof StyledDocument) {
                        if (openAtLine(controller, doc, methodName, line)) {
                            result.set(true);
                            return;
                        }
                        if (methodName != null) {
                            ExecutableElement methodElement = ElementUtilitiesEx.resolveMethodByName(controller, parentClass, methodName, signature);
                            if (methodElement != null && ElementOpen.open(controller.getClasspathInfo(), methodElement)) {
                                result.set(true);
                                return;
                            }
                        }
                    }
                    result.set(true);
                }
            }

            @Override
            public boolean shouldRetry() {
                return !result.get();
            }
        };
        
        ParsingUtils.invokeScanSensitiveTask(js, t);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:50,代碼來源:GoToJavaSourceProvider.java

示例8: open

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void open() {
    if (elementHandle != null) {
        ElementOpen.open(element.getFileObject(), elementHandle);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:WhereUsedQueryUI.java

示例9: open

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void open() {
    if(fileObject != null && handle != null && fileObject.isValid()) {
        ElementOpen.open(fileObject, handle);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:ElementGrip.java

示例10: open

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void open() {
    if (elementHandle!=null) {
        ElementOpen.open(handle.getFileObject(), elementHandle);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:RenameRefactoringUI.java

示例11: open

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
public void open() {
    if (!ElementOpen.open(originalCPInfo, ElementDescription.this.getHandle())) {
        Toolkit.getDefaultToolkit().beep();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:ElementDescription.java

示例12: open

import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public boolean open(ClasspathInfo info, ElementHandle<?> el) {
    return ElementOpen.open(info, el);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:GoToSupport.java


注:本文中的org.netbeans.api.java.source.ui.ElementOpen.open方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。