本文整理匯總了Java中com.intellij.navigation.NavigationItem.canNavigate方法的典型用法代碼示例。如果您正苦於以下問題:Java NavigationItem.canNavigate方法的具體用法?Java NavigationItem.canNavigate怎麽用?Java NavigationItem.canNavigate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.navigation.NavigationItem
的用法示例。
在下文中一共展示了NavigationItem.canNavigate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openFileWithPsiElement
import com.intellij.navigation.NavigationItem; //導入方法依賴的package包/類
public static boolean openFileWithPsiElement(PsiElement element, boolean searchForOpen, boolean requestFocus) {
boolean openAsNative = false;
if (element instanceof PsiFile) {
VirtualFile virtualFile = ((PsiFile)element).getVirtualFile();
if (virtualFile != null) {
openAsNative = ElementBase.isNativeFileType(virtualFile.getFileType());
}
}
if (searchForOpen) {
element.putUserData(FileEditorManager.USE_CURRENT_WINDOW, null);
}
else {
element.putUserData(FileEditorManager.USE_CURRENT_WINDOW, true);
}
if (openAsNative || !activatePsiElementIfOpen(element, searchForOpen, requestFocus)) {
final NavigationItem navigationItem = (NavigationItem)element;
if (!navigationItem.canNavigate()) return false;
navigationItem.navigate(requestFocus);
return true;
}
element.putUserData(FileEditorManager.USE_CURRENT_WINDOW, null);
return false;
}
示例2: canNavigate
import com.intellij.navigation.NavigationItem; //導入方法依賴的package包/類
@Override
public boolean canNavigate() {
final NavigationItem item = getNavigationItem();
return item != null && item.canNavigate();
}