本文整理匯總了Java中com.intellij.navigation.NavigationItem.navigate方法的典型用法代碼示例。如果您正苦於以下問題:Java NavigationItem.navigate方法的具體用法?Java NavigationItem.navigate怎麽用?Java NavigationItem.navigate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.navigation.NavigationItem
的用法示例。
在下文中一共展示了NavigationItem.navigate方法的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: navigate
import com.intellij.navigation.NavigationItem; //導入方法依賴的package包/類
public static void navigate(@NotNull NavigationItem item, boolean requestFocus, boolean useCurrentWindow) {
if (item instanceof UserDataHolder) {
((UserDataHolder)item).putUserData(FileEditorManager.USE_CURRENT_WINDOW, useCurrentWindow);
}
item.navigate(requestFocus);
if (item instanceof UserDataHolder) {
((UserDataHolder)item).putUserData(FileEditorManager.USE_CURRENT_WINDOW, null);
}
}