use of com.intellij.pom.Navigatable in project intellij-community by JetBrains.
the class AutoScrollToSourceHandler method scrollToSource.
protected void scrollToSource(final Component tree) {
DataContext dataContext = DataManager.getInstance().getDataContext(tree);
getReady(dataContext).doWhenDone(() -> {
DataContext context = DataManager.getInstance().getDataContext(tree);
final VirtualFile vFile = CommonDataKeys.VIRTUAL_FILE.getData(context);
if (vFile != null) {
// asking to register some file type for this file. This behaviour is undesirable when autoscrolling.
if (vFile.getFileType() == FileTypes.UNKNOWN || vFile.getFileType() instanceof INativeFileType)
return;
//IDEA-84881 Don't autoscroll to very large files
if (vFile.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize())
return;
}
Navigatable[] navigatables = CommonDataKeys.NAVIGATABLE_ARRAY.getData(context);
if (navigatables != null) {
if (navigatables.length > 1) {
return;
}
for (Navigatable navigatable : navigatables) {
// we are not going to open modal dialog during autoscrolling
if (!navigatable.canNavigateToSource())
return;
}
}
OpenSourceUtil.navigate(false, true, navigatables);
});
}
use of com.intellij.pom.Navigatable in project intellij-plugins by JetBrains.
the class ResolveExternalInlineStyleSourceAction method run.
@Override
public void run() {
Navigatable target = find();
if (target == null) {
LOG.error("Can't find target property " + targetStyleName + " of " + elementFqn + " in " + parentFqn);
} else {
target.navigate(true);
ProjectUtil.focusProjectWindow(project, true);
}
}
use of com.intellij.pom.Navigatable in project intellij by bazelbuild.
the class IssueOutputFilter method openConsoleToHyperlink.
private Navigatable openConsoleToHyperlink(HyperlinkInfo link, int originalOffset) {
return new Navigatable() {
@Override
public void navigate(boolean requestFocus) {
BlazeConsoleView consoleView = BlazeConsoleView.getInstance(project);
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(BlazeConsoleToolWindowFactory.ID);
toolWindow.activate(() -> consoleView.navigateToHyperlink(link, originalOffset), true);
}
@Override
public boolean canNavigate() {
return true;
}
@Override
public boolean canNavigateToSource() {
return true;
}
};
}
use of com.intellij.pom.Navigatable in project intellij by bazelbuild.
the class AndroidSdkFromProjectView method getAndroidSdkPlatform.
@Nullable
public static AndroidSdkPlatform getAndroidSdkPlatform(BlazeContext context, ProjectViewSet projectViewSet) {
List<Sdk> sdks = BlazeSdkProvider.getInstance().getAllAndroidSdks();
if (sdks.isEmpty()) {
IssueOutput.error("No Android SDK configured. Please use the SDK manager to configure.").navigatable(new Navigatable() {
@Override
public void navigate(boolean b) {
SdkUtil.openSdkManager();
}
@Override
public boolean canNavigate() {
return true;
}
@Override
public boolean canNavigateToSource() {
return false;
}
}).submit(context);
return null;
}
if (projectViewSet == null) {
return null;
}
String androidSdk = projectViewSet.getScalarValue(AndroidSdkPlatformSection.KEY).orElse(null);
Integer androidMinSdk = projectViewSet.getScalarValue(AndroidMinSdkSection.KEY).orElse(null);
if (androidSdk == null) {
ProjectViewFile projectViewFile = projectViewSet.getTopLevelProjectViewFile();
IssueOutput.error(("No android_sdk_platform set. Please set to an android platform. " + "Available android_sdk_platforms are: " + getAvailableTargetHashesAsList(sdks))).inFile(projectViewFile != null ? projectViewFile.projectViewFile : null).submit(context);
return null;
}
Sdk sdk = BlazeSdkProvider.getInstance().findSdk(androidSdk);
if (sdk == null) {
ProjectViewFile projectViewFile = projectViewSet.getTopLevelProjectViewFile();
IssueOutput.error(("No such android_sdk_platform: '" + androidSdk + "'. " + "Available android_sdk_platforms are: " + getAvailableTargetHashesAsList(sdks) + ". " + "Please change android_sdk_platform or run SDK manager " + "to download missing SDK platforms.")).inFile(projectViewFile != null ? projectViewFile.projectViewFile : null).submit(context);
return null;
}
if (androidMinSdk == null) {
androidMinSdk = getAndroidSdkApiLevel(sdk);
}
return new AndroidSdkPlatform(androidSdk, androidMinSdk);
}
use of com.intellij.pom.Navigatable in project intellij by bazelbuild.
the class BlazeProblemsViewPanel method scrollToSource.
private void scrollToSource(Component tree) {
DataContext dataContext = DataManager.getInstance().getDataContext(tree);
getReady(dataContext).doWhenDone(() -> TransactionGuard.submitTransaction(ApplicationManager.getApplication(), () -> {
DataContext context = DataManager.getInstance().getDataContext(tree);
Navigatable navigatable = BLAZE_CONSOLE_NAVIGATABLE_DATA_KEY.getData(context);
if (navigatable != null) {
OpenSourceUtil.navigate(false, true, navigatable);
}
}));
}
Aggregations