mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup platform-impl: pattern vars
GitOrigin-RevId: f7fe4e33c74a787ea6dd56820405748ce975daeb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
084b2739aa
commit
e2ce16b40d
@@ -76,8 +76,8 @@ public class InheritorChooser {
|
||||
}
|
||||
if (classes.isEmpty()) return false;
|
||||
final FileEditor fileEditor = PlatformCoreDataKeys.FILE_EDITOR.getData(context.getDataContext());
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
final Document document = ((TextEditor)fileEditor).getEditor().getDocument();
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
final Document document = te.getEditor().getDocument();
|
||||
final PsiFile containingFile = PsiDocumentManager.getInstance(context.getProject()).getPsiFile(document);
|
||||
if (containingFile instanceof PsiClassOwner) {
|
||||
final List<PsiClass> psiClasses = new ArrayList<>(Arrays.asList(((PsiClassOwner)containingFile).getClasses()));
|
||||
|
||||
+2
-2
@@ -107,11 +107,11 @@ class TestMethodUsage implements Usage, UsageInFile, UsageInModule, PsiElementUs
|
||||
if (virtualFile == null) return null;
|
||||
Project project = getPointer().getProject();
|
||||
FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(virtualFile);
|
||||
if (!(editor instanceof TextEditor)) return null;
|
||||
if (!(editor instanceof TextEditor te)) return null;
|
||||
|
||||
Segment segment = getPointer().getPsiRange();
|
||||
if (segment == null) return null;
|
||||
return new TextEditorLocation(segment.getStartOffset(), (TextEditor)editor);
|
||||
return new TextEditorLocation(segment.getStartOffset(), te);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ThreesideContentPanel extends JPanel {
|
||||
super(ContainerUtil.map(holders, holder -> holder.getComponent()));
|
||||
|
||||
EditorHolder baseHolder = ThreeSide.BASE.select(holders);
|
||||
myBaseEditor = baseHolder instanceof TextEditorHolder ? ((TextEditorHolder)baseHolder).getEditor() : null;
|
||||
myBaseEditor = baseHolder instanceof TextEditorHolder te ? te.getEditor() : null;
|
||||
|
||||
mySplitter.redispatchWheelEventsTo(baseHolder);
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ public abstract class TreeBasedStructureViewBuilder implements StructureViewBuil
|
||||
public @NotNull StructureView createStructureView(@Nullable FileEditor fileEditor, @NotNull Project project) {
|
||||
StructureViewModel model;
|
||||
try (AccessToken ignore = SlowOperations.knownIssue("IJPL-162970")) {
|
||||
model = createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null);
|
||||
model = createStructureViewModel(fileEditor instanceof TextEditor te ? te.getEditor() : null);
|
||||
}
|
||||
var view = createStructureView(fileEditor, project, model);
|
||||
Disposer.register(view, model);
|
||||
|
||||
+6
-6
@@ -67,8 +67,8 @@ public final class CodeFoldingManagerImpl extends CodeFoldingManager implements
|
||||
public void extensionAdded(@NotNull KeyedLazyInstance<FoldingBuilder> extension, @NotNull PluginDescriptor pluginDescriptor) {
|
||||
// Asynchronously update foldings when an extension is added
|
||||
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
scheduleAsyncFoldingUpdate(((TextEditor)fileEditor).getEditor());
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
scheduleAsyncFoldingUpdate(te.getEditor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,8 +77,8 @@ public final class CodeFoldingManagerImpl extends CodeFoldingManager implements
|
||||
public void extensionRemoved(@NotNull KeyedLazyInstance<FoldingBuilder> extension, @NotNull PluginDescriptor pluginDescriptor) {
|
||||
// Synchronously remove foldings when an extension is removed
|
||||
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
updateFoldRegions(((TextEditor)fileEditor).getEditor());
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
updateFoldRegions(te.getEditor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,8 +86,8 @@ public final class CodeFoldingManagerImpl extends CodeFoldingManager implements
|
||||
|
||||
Runnable listener = () -> {
|
||||
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
FoldingUpdate.clearFoldingCache(((TextEditor)fileEditor).getEditor());
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
FoldingUpdate.clearFoldingCache(te.getEditor());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -77,7 +77,7 @@ public class IntentionWrapper implements LocalQuickFix, IntentionAction, ActionC
|
||||
PsiFile file = element == null ? null : element.getContainingFile();
|
||||
if (file != null) {
|
||||
FileEditor editor = FileEditorManager.getInstance(project).getSelectedEditor(file.getVirtualFile());
|
||||
myAction.invoke(project, editor instanceof TextEditor ? ((TextEditor)editor).getEditor() : null, file);
|
||||
myAction.invoke(project, editor instanceof TextEditor te ? te.getEditor() : null, file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -173,11 +173,11 @@ public final class ConsoleExecutionEditor implements Disposable {
|
||||
|
||||
Editor selectedTextEditor = source.getSelectedTextEditor();
|
||||
for (FileEditor fileEditor : source.getAllEditorList(file)) {
|
||||
if (!(fileEditor instanceof TextEditor)) {
|
||||
if (!(fileEditor instanceof TextEditor te)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
final Editor editor = te.getEditor();
|
||||
if (editor instanceof EditorEx editorEx) {
|
||||
editorEx.addFocusListener(myFocusListener, ConsoleExecutionEditor.this);
|
||||
if (selectedTextEditor == editorEx) { // already focused
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@ final class RunnableStatusListener implements DaemonCodeAnalyzer.DaemonListener
|
||||
if (!LineMarkerSettings.getSettings().isEnabled(new RunLineMarkerProvider())) return;
|
||||
|
||||
for (FileEditor fileEditor : fileEditors) {
|
||||
if (fileEditor instanceof TextEditor && fileEditor.isValid()) {
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (fileEditor instanceof TextEditor te && fileEditor.isValid()) {
|
||||
Editor editor = te.getEditor();
|
||||
Project project = editor.getProject();
|
||||
VirtualFile file = fileEditor.getFile();
|
||||
if (file != null && project != null && file.isValid()) {
|
||||
|
||||
@@ -244,8 +244,8 @@ public final class FindUsagesManager {
|
||||
checkNotNull(primaryElements, handler, "getPrimaryElements()");
|
||||
PsiElement[] secondaryElements = handler.getSecondaryElements();
|
||||
checkNotNull(secondaryElements, handler, "getSecondaryElements()");
|
||||
if (singleFile && fileEditor instanceof TextEditor) {
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (singleFile && fileEditor instanceof TextEditor te) {
|
||||
Editor editor = te.getEditor();
|
||||
editor.putUserData(KEY_START_USAGE_AGAIN, null);
|
||||
findUsagesInEditor(primaryElements, secondaryElements, handler, scopeFile, FileSearchScope.FROM_START, findUsagesOptions.clone(),
|
||||
editor);
|
||||
|
||||
@@ -163,7 +163,7 @@ public final class SelectInContextImpl extends FileSelectInContext {
|
||||
}
|
||||
|
||||
private static @Nullable Object getElementFromStructureTreeView(@NotNull FileEditor fileEditor, TreeBasedStructureViewBuilder builder) {
|
||||
Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null;
|
||||
Editor editor = fileEditor instanceof TextEditor te ? te.getEditor() : null;
|
||||
StructureViewModel model = builder.createStructureViewModel(editor);
|
||||
Object selectorInFile = model.getCurrentEditorElement();
|
||||
Disposer.dispose(model);
|
||||
|
||||
@@ -61,7 +61,7 @@ public final class ViewStructureAction extends DumbAwareAction {
|
||||
if (fileEditor == null) return;
|
||||
|
||||
VirtualFile virtualFile = fileEditor.getFile();
|
||||
Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() :
|
||||
Editor editor = fileEditor instanceof TextEditor te ? te.getEditor() :
|
||||
e.getData(CommonDataKeys.EDITOR);
|
||||
if (editor != null) {
|
||||
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
|
||||
@@ -118,7 +118,7 @@ public final class ViewStructureAction extends DumbAwareAction {
|
||||
}
|
||||
|
||||
FileEditor fileEditor = e.getData(PlatformCoreDataKeys.FILE_EDITOR);
|
||||
Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() :
|
||||
Editor editor = fileEditor instanceof TextEditor te ? te.getEditor() :
|
||||
e.getData(CommonDataKeys.EDITOR);
|
||||
|
||||
boolean enabled = fileEditor != null &&
|
||||
|
||||
@@ -141,8 +141,8 @@ public final class RunIdeConsoleAction extends DumbAwareAction {
|
||||
public static void configureConsole(@NotNull VirtualFile file, @NotNull FileEditorManager source) {
|
||||
MyRunAction runAction = new MyRunAction();
|
||||
for (FileEditor fileEditor : source.getEditors(file)) {
|
||||
if (!(fileEditor instanceof TextEditor)) continue;
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (!(fileEditor instanceof TextEditor te)) continue;
|
||||
Editor editor = te.getEditor();
|
||||
runAction.registerCustomShortcutSet(CommonShortcuts.getCtrlEnter(), editor.getComponent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class EditorHelper {
|
||||
|
||||
public static Editor openInEditor(@NotNull PsiElement element) {
|
||||
FileEditor editor = openInEditor(element, true);
|
||||
return editor instanceof TextEditor ? ((TextEditor)editor).getEditor() : null;
|
||||
return editor instanceof TextEditor te ? te.getEditor() : null;
|
||||
}
|
||||
|
||||
public static @Nullable Editor openInMaybeInjectedEditor(@NotNull PsiElement element) {
|
||||
|
||||
@@ -457,8 +457,8 @@ public final class FileStructurePopup implements Disposable, TreeActionsOwner {
|
||||
return (PsiElement)elementAtCursor;
|
||||
}
|
||||
|
||||
if (psiFile != null && myFileEditor instanceof TextEditor) {
|
||||
return psiFile.getViewProvider().findElementAt(((TextEditor)myFileEditor).getEditor().getCaretModel().getOffset());
|
||||
if (psiFile != null && myFileEditor instanceof TextEditor te) {
|
||||
return psiFile.getViewProvider().findElementAt(te.getEditor().getCaretModel().getOffset());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class FileEditorSelectInContext extends SmartSelectInContext {
|
||||
|
||||
public FileEditorSelectInContext(@NotNull FileEditor fileEditor, @NotNull PsiFile psiFile) {
|
||||
super(psiFile, psiFile, () -> fileEditor);
|
||||
editor = fileEditor instanceof TextEditor ? (TextEditor)fileEditor : null;
|
||||
editor = fileEditor instanceof TextEditor te ? te : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -130,7 +130,7 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr
|
||||
public EditorNotificationPanel(@Nullable FileEditor fileEditor,
|
||||
@Nullable Color backgroundColor,
|
||||
@Nullable ColorKey backgroundColorKey) {
|
||||
this(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null,
|
||||
this(fileEditor instanceof TextEditor te ? te.getEditor() : null,
|
||||
backgroundColor,
|
||||
backgroundColorKey);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public class EditorNotificationPanel extends JPanel implements IntentionActionPr
|
||||
@Nullable Color backgroundColor,
|
||||
@Nullable ColorKey backgroundColorKey,
|
||||
@NotNull Status status) {
|
||||
this(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null, backgroundColor, backgroundColorKey, status);
|
||||
this(fileEditor instanceof TextEditor te ? te.getEditor() : null, backgroundColor, backgroundColorKey, status);
|
||||
}
|
||||
|
||||
public EditorNotificationPanel(@Nullable Editor editor,
|
||||
|
||||
@@ -50,8 +50,8 @@ public class OpenLogAction extends DumbAwareAction {
|
||||
if (file != null) {
|
||||
VfsUtil.markDirtyAndRefresh(true, false, false, file);
|
||||
final FileEditor[] editors = FileEditorManager.getInstance(project).openFile(file, true);
|
||||
if (editors.length > 0 && editors[0] instanceof TextEditor) {
|
||||
scrollToLastIDEStart((TextEditor)editors[0]);
|
||||
if (editors.length > 0 && editors[0] instanceof TextEditor te) {
|
||||
scrollToLastIDEStart(te);
|
||||
}
|
||||
else {
|
||||
PsiNavigationSupport.getInstance().createNavigatable(project, file, -1).navigate(true);
|
||||
|
||||
+2
-2
@@ -124,9 +124,9 @@ public final class TypingEventsLogger extends CounterUsagesCollector {
|
||||
logCurrentLatency();
|
||||
|
||||
FileEditor editor = event.getNewEditor();
|
||||
if (editor instanceof TextEditor) {
|
||||
if (editor instanceof TextEditor te) {
|
||||
myCurrentFile = event.getNewFile();
|
||||
myCurrentEditor = ((TextEditor)editor).getEditor();
|
||||
myCurrentEditor = te.getEditor();
|
||||
myLatencyRecord = new LatencyDistributionRecord(new LatencyDistributionRecordKey("FUS"));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -200,8 +200,8 @@ final class LightEditTabs extends JBEditorTabs implements LightEditorListener, C
|
||||
@Override
|
||||
public void onDiscard() {
|
||||
FileEditor fileEditor = editorInfo.getFileEditor();
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
Editor editor = te.getEditor();
|
||||
FileDocumentManager.getInstance().reloadFromDisk(editor.getDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public final class LightEditorInfoImpl implements LightEditorInfo {
|
||||
}
|
||||
|
||||
public static @Nullable Editor getEditor(@Nullable FileEditor fileEditor) {
|
||||
TextEditor textEditor = fileEditor instanceof TextEditor ? (TextEditor)fileEditor : null;
|
||||
TextEditor textEditor = fileEditor instanceof TextEditor te ? te : null;
|
||||
return textEditor == null ? null : textEditor.getEditor();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public final class LightEditorInfoImpl implements LightEditorInfo {
|
||||
@Override
|
||||
public boolean isSaveRequired() {
|
||||
return isUnsaved() &&
|
||||
(!isNew() || myFileEditor instanceof TextEditor && ((TextEditor)myFileEditor).getEditor().getDocument().getTextLength() > 0);
|
||||
(!isNew() || myFileEditor instanceof TextEditor te && te.getEditor().getDocument().getTextLength() > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -74,10 +74,10 @@ public final class LightEditorManagerImpl implements LightEditorManager, Disposa
|
||||
|
||||
private void installListener(@NotNull LightEditorInfo editorInfo) {
|
||||
FileEditor fileEditor = editorInfo.getFileEditor();
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (editor instanceof EditorEx) {
|
||||
((EditorEx)editor).addFocusListener(new FocusChangeListener() {
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
Editor editor = te.getEditor();
|
||||
if (editor instanceof EditorEx ex) {
|
||||
ex.addFocusListener(new FocusChangeListener() {
|
||||
@Override
|
||||
public void focusGained(@NotNull Editor editor) {
|
||||
WriteIntentReadAction.run(() -> checkUpdate(editor));
|
||||
@@ -252,7 +252,7 @@ public final class LightEditorManagerImpl implements LightEditorManager, Disposa
|
||||
private @Nullable LightEditorInfo findEditor(@NotNull Editor editor) {
|
||||
for (LightEditorInfo editorInfo : editors) {
|
||||
FileEditor fileEditor = editorInfo.getFileEditor();
|
||||
if (fileEditor instanceof TextEditor && editor == ((TextEditor)fileEditor).getEditor()) {
|
||||
if (fileEditor instanceof TextEditor te && editor == te.getEditor()) {
|
||||
return editorInfo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,8 +101,8 @@ public final class StartMarkAction extends BasicUndoableAction {
|
||||
@Deprecated
|
||||
public static StartMarkAction canStart(@NotNull Project project) {
|
||||
for (FileEditor fileEditor : FileEditorManager.getInstance(project).getAllEditors()) {
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
StartMarkAction startMarkAction = ((TextEditor)fileEditor).getEditor().getUserData(START_MARK_ACTION_KEY);
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
StartMarkAction startMarkAction = te.getEditor().getUserData(START_MARK_ACTION_KEY);
|
||||
if (startMarkAction != null) {
|
||||
return startMarkAction;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class EditorUtil {
|
||||
}
|
||||
|
||||
public static @Nullable EditorEx getEditorEx(@Nullable FileEditor fileEditor) {
|
||||
Editor editor = fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null;
|
||||
Editor editor = fileEditor instanceof TextEditor te ? te.getEditor() : null;
|
||||
return editor instanceof EditorEx ? (EditorEx)editor : null;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -34,11 +34,11 @@ final class BidiContentNotificationProvider implements EditorNotificationProvide
|
||||
}
|
||||
|
||||
return fileEditor -> {
|
||||
if (!(fileEditor instanceof TextEditor)) {
|
||||
if (!(fileEditor instanceof TextEditor te)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
Editor editor = te.getEditor();
|
||||
if (!Boolean.TRUE.equals(editor.getUserData(EditorImpl.CONTAINS_BIDI_TEXT)) ||
|
||||
Boolean.TRUE.equals(editor.getUserData(DISABLE_NOTIFICATION))) {
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ final class ForcedSoftWrapsNotificationProvider implements EditorNotificationPro
|
||||
public @NotNull Function<? super @NotNull FileEditor, ? extends @Nullable JComponent> collectNotificationData(@NotNull Project project,
|
||||
@NotNull VirtualFile file) {
|
||||
return fileEditor -> {
|
||||
if (!(fileEditor instanceof TextEditor)) return null;
|
||||
final Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (!(fileEditor instanceof TextEditor te)) return null;
|
||||
final Editor editor = te.getEditor();
|
||||
if (!Boolean.TRUE.equals(editor.getUserData(EditorImpl.FORCED_SOFT_WRAPS)) ||
|
||||
!Boolean.TRUE.equals(editor.getUserData(EditorImpl.SOFT_WRAPS_EXIST)) ||
|
||||
PropertiesComponent.getInstance().isTrueValue(DISABLED_NOTIFICATION_KEY)) return null;
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@ public interface EditorFileSwapper {
|
||||
static @Nullable TextEditorImpl findSinglePsiAwareEditor(@NotNull List<? extends FileEditor> fileEditors) {
|
||||
TextEditorImpl result = null;
|
||||
for (FileEditor fileEditor : fileEditors) {
|
||||
if (fileEditor instanceof TextEditorImpl) {
|
||||
if (fileEditor instanceof TextEditorImpl te) {
|
||||
if (result == null) {
|
||||
result = (TextEditorImpl)fileEditor;
|
||||
result = te;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -30,11 +30,11 @@ public final class LargeFileNotificationProvider implements EditorNotificationPr
|
||||
public @NotNull Function<? super @NotNull FileEditor, ? extends @Nullable JComponent> collectNotificationData(@NotNull Project project,
|
||||
@NotNull VirtualFile file) {
|
||||
return fileEditor -> {
|
||||
if (!(fileEditor instanceof TextEditor) || fileEditor.getUserData(LargeFileEditorProvider.IS_LARGE) != Boolean.TRUE) {
|
||||
if (!(fileEditor instanceof TextEditor te) || fileEditor.getUserData(LargeFileEditorProvider.IS_LARGE) != Boolean.TRUE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
Editor editor = te.getEditor();
|
||||
if (editor.getUserData(HIDDEN_KEY) != null || PropertiesComponent.getInstance().isTrueValue(DISABLE_KEY)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+2
-2
@@ -191,8 +191,8 @@ public final class StructuralSearchDialog extends DialogWrapper implements Docum
|
||||
final Runnable runnable = () -> {
|
||||
removeRestartHighlightingListenerFromCurrentEditor();
|
||||
removeMatchHighlights();
|
||||
if (myNewEditor instanceof TextEditor) {
|
||||
myEditor = ((TextEditor)myNewEditor).getEditor();
|
||||
if (myNewEditor instanceof TextEditor te) {
|
||||
myEditor = te.getEditor();
|
||||
addMatchHighlights();
|
||||
addRestartHighlightingListenerToCurrentEditor();
|
||||
}
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ public class RehighlightAllEditors implements MadTestingAction {
|
||||
public void performCommand(@NotNull Environment env) {
|
||||
env.logMessage(toString());
|
||||
for (FileEditor editor : FileEditorManager.getInstance(myProject).getAllEditors()) {
|
||||
if (editor instanceof TextEditor) {
|
||||
highlightEditor(((TextEditor)editor).getEditor(), myProject);
|
||||
if (editor instanceof TextEditor te) {
|
||||
highlightEditor(te.getEditor(), myProject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ public interface Usage extends Navigatable {
|
||||
*/
|
||||
default int getNavigationOffset() {
|
||||
FileEditorLocation location = getLocation();
|
||||
if (location instanceof TextEditorLocation) {
|
||||
LogicalPosition position = ((TextEditorLocation)location).getPosition();
|
||||
if (location instanceof TextEditorLocation tel) {
|
||||
LogicalPosition position = tel.getPosition();
|
||||
return ((TextEditor)location.getEditor()).getEditor().logicalPositionToOffset(position);
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -213,11 +213,11 @@ public class UsageInfo2UsageAdapter implements UsageInModule, UsageInfoAdapter,
|
||||
VirtualFile virtualFile = getFile();
|
||||
if (virtualFile == null) return null;
|
||||
FileEditor editor = FileEditorManager.getInstance(getProject()).getSelectedEditor(virtualFile);
|
||||
if (!(editor instanceof TextEditor)) return null;
|
||||
if (!(editor instanceof TextEditor te)) return null;
|
||||
|
||||
Segment segment = getUsageInfo().getSegment();
|
||||
if (segment == null) return null;
|
||||
return new TextEditorLocation(segment.getStartOffset(), (TextEditor)editor);
|
||||
return new TextEditorLocation(segment.getStartOffset(), te);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -341,8 +341,8 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
|
||||
public void showAnnotation(FileAnnotation annotation, VirtualFile file, AbstractVcs vcs, int line) {
|
||||
TextEditor textFileEditor;
|
||||
FileEditor fileEditor = FileEditorManager.getInstance(myProject).getSelectedEditor(file);
|
||||
if (fileEditor instanceof TextEditor) {
|
||||
textFileEditor = ((TextEditor)fileEditor);
|
||||
if (fileEditor instanceof TextEditor te) {
|
||||
textFileEditor = te;
|
||||
}
|
||||
else {
|
||||
textFileEditor = ContainerUtil.findInstance(FileEditorManager.getInstance(myProject).getEditorList(file), TextEditor.class);
|
||||
|
||||
+2
-2
@@ -95,8 +95,8 @@ public final class XDebuggerInlayUtil {
|
||||
EDT.assertIsEdt();
|
||||
XSourcePosition position = renderer.getPosition();
|
||||
FileEditor editor = XDebuggerUtil.getInstance().getSelectedEditor(session.getProject(), position.getFile());
|
||||
if (editor instanceof TextEditor) {
|
||||
Editor e = ((TextEditor)editor).getEditor();
|
||||
if (editor instanceof TextEditor te) {
|
||||
Editor e = te.getEditor();
|
||||
int line = position.getLine();
|
||||
if (!DocumentUtil.isValidLine(line, e.getDocument())) return;
|
||||
int lineStart = e.getDocument().getLineStartOffset(line);
|
||||
|
||||
+2
-2
@@ -162,8 +162,8 @@ public class ExecutionPointHighlighter {
|
||||
if (myOpenFileDescriptor != null) {
|
||||
if (!navigate) {
|
||||
FileEditor editor = FileEditorManager.getInstance(myProject).getSelectedEditor(myOpenFileDescriptor.getFile());
|
||||
if (editor instanceof TextEditor) {
|
||||
myEditor = ((TextEditor)editor).getEditor();
|
||||
if (editor instanceof TextEditor te) {
|
||||
myEditor = te.getEditor();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
+6
-5
@@ -235,16 +235,17 @@ public final class ResourceBundleEditor extends UserDataHolderBase implements Do
|
||||
|
||||
// We want to sync selected property key on selection change.
|
||||
if (newEditor == this) {
|
||||
if (oldEditor instanceof TextEditor) {
|
||||
if (oldEditor instanceof TextEditor te) {
|
||||
myPropertiesInsertDeleteManager.reload();
|
||||
setStructureViewSelectionFromPropertiesFile(((TextEditor)oldEditor).getEditor());
|
||||
} else if (myPropertyToSelectWhenVisible != null) {
|
||||
setStructureViewSelectionFromPropertiesFile(te.getEditor());
|
||||
}
|
||||
else if (myPropertyToSelectWhenVisible != null) {
|
||||
setStructureViewSelection(myPropertyToSelectWhenVisible);
|
||||
myPropertyToSelectWhenVisible = null;
|
||||
}
|
||||
}
|
||||
else if (newEditor instanceof TextEditor) {
|
||||
setPropertiesFileSelectionFromStructureView(((TextEditor)newEditor).getEditor());
|
||||
else if (newEditor instanceof TextEditor te) {
|
||||
setPropertiesFileSelectionFromStructureView(te.getEditor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ public final class PythonTemplateRunner {
|
||||
VirtualFile virtualFile = anchor.getContainingFile().getVirtualFile();
|
||||
if (virtualFile == null) return;
|
||||
final FileEditor editor = PythonUiService.getInstance().getSelectedEditor(project, virtualFile);
|
||||
if (editor instanceof TextEditor) {
|
||||
builder.run(((TextEditor)editor).getEditor(), false);
|
||||
if (editor instanceof TextEditor te) {
|
||||
builder.run(te.getEditor(), false);
|
||||
}
|
||||
else {
|
||||
builder.runNonInteractively(false);
|
||||
|
||||
@@ -33,6 +33,6 @@ public class DomStructureViewBuilder extends TreeBasedStructureViewBuilder {
|
||||
|
||||
@Override
|
||||
public @NotNull StructureView createStructureView(final FileEditor fileEditor, final @NotNull Project project) {
|
||||
return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project, true);
|
||||
return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor te ? te.getEditor() : null), project, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user