mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[web browsers] WEB-71342 use 'xml' setting for large xml files for 'open in browser' popup
GitOrigin-RevId: 1fd8e8b1581812827f7f6ba1de4388bf225ba645
This commit is contained in:
committed by
intellij-monorepo-bot
parent
55c88459cb
commit
ce072b2d87
+17
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.browsers.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -7,12 +7,15 @@ import com.intellij.ide.browsers.WebBrowser;
|
||||
import com.intellij.ide.browsers.WebBrowserManager;
|
||||
import com.intellij.ide.browsers.WebBrowserXmlService;
|
||||
import com.intellij.ide.impl.TrustedProjects;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.diff.impl.DiffUtil;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileTypes.LanguageFileType;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.CachedValue;
|
||||
import com.intellij.psi.util.CachedValueProvider;
|
||||
@@ -105,11 +108,22 @@ public abstract class OpenInBrowserBaseGroupAction extends ActionGroup implement
|
||||
Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
final WebBrowserManager browserManager = WebBrowserManager.getInstance();
|
||||
PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE);
|
||||
boolean needShowOnHover = psiFile != null && WebBrowserXmlService.getInstance().isXmlLanguage(psiFile.getViewProvider().getBaseLanguage())
|
||||
Language language = null;
|
||||
if (psiFile != null) {
|
||||
language = psiFile.getViewProvider().getBaseLanguage();
|
||||
}
|
||||
else {
|
||||
VirtualFile virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
|
||||
if (virtualFile != null && virtualFile.getFileType() instanceof LanguageFileType fileType) {
|
||||
language = fileType.getLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
boolean needShowOnHover = language != null && WebBrowserXmlService.getInstance().isXmlLanguage(language)
|
||||
? browserManager.isShowBrowserHoverXml()
|
||||
: browserManager.isShowBrowserHover();
|
||||
boolean enabled = needShowOnHover &&
|
||||
(!browserManager.getActiveBrowsers().isEmpty() || OpenInBrowserBaseGroupAction.hasLocalBrowser())
|
||||
(!browserManager.getActiveBrowsers().isEmpty() || hasLocalBrowser())
|
||||
&& editor != null && !DiffUtil.isDiffEditor(editor);
|
||||
e.getPresentation().setEnabledAndVisible(enabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user