本文整理匯總了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);
}
}
示例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);
}
};
}
示例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);
}
}
示例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());
}
}
示例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()));
}
}
示例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);
}
}
}
示例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);
}
}
示例8: open
import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void open() {
if (elementHandle != null) {
ElementOpen.open(element.getFileObject(), elementHandle);
}
}
示例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);
}
}
示例10: open
import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public void open() {
if (elementHandle!=null) {
ElementOpen.open(handle.getFileObject(), elementHandle);
}
}
示例11: open
import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
public void open() {
if (!ElementOpen.open(originalCPInfo, ElementDescription.this.getHandle())) {
Toolkit.getDefaultToolkit().beep();
}
}
示例12: open
import org.netbeans.api.java.source.ui.ElementOpen; //導入方法依賴的package包/類
@Override
public boolean open(ClasspathInfo info, ElementHandle<?> el) {
return ElementOpen.open(info, el);
}