mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Rename "Synchronize" action to "Reload from Disk", delete old "Reload from Disk" action (IDEA-85947)
GitOrigin-RevId: 805c455d5c10b684ff851fe34da9b8559bf81049
This commit is contained in:
committed by
intellij-monorepo-bot
parent
12a0fd8eee
commit
4a5149b1a7
@@ -1,58 +0,0 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ReloadFromDiskAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = e.getProject();
|
||||
final Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
if (project == null || editor == null) return;
|
||||
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
if (file == null) return;
|
||||
|
||||
String message = IdeBundle.message("prompt.reload.file.from.disk", file.getVirtualFile().getPresentableUrl());
|
||||
int res = Messages.showOkCancelDialog(project, message, IdeBundle.message("title.reload.file"), Messages.getWarningIcon());
|
||||
if (res != Messages.OK) return;
|
||||
|
||||
Runnable command = () -> ApplicationManager.getApplication().runWriteAction(
|
||||
() -> {
|
||||
if (!project.isDisposed()) {
|
||||
file.getVirtualFile().refresh(false, false);
|
||||
PsiManager.getInstance(project).reloadFromDisk(file);
|
||||
}
|
||||
}
|
||||
);
|
||||
CommandProcessor.getInstance().executeCommand(project, command, IdeBundle.message("command.reload.from.disk"), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent event) {
|
||||
boolean enabled = false;
|
||||
|
||||
Project project = event.getProject();
|
||||
Editor editor = event.getData(CommonDataKeys.EDITOR);
|
||||
if (project != null && editor != null) {
|
||||
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
if (file != null && file.getVirtualFile() != null) {
|
||||
enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
event.getPresentation().setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
@@ -313,7 +313,7 @@ action.ImportFromEclipse.text=Import From Eclipse...
|
||||
action.ImportFromEclipse.description=Create project from Eclipse projects
|
||||
action.ExportToEclipse.text=Export To Eclipse...
|
||||
action.ExportToEclipse.description=Create Eclipse projects for each module
|
||||
action.Synchronize.text=S_ynchronize
|
||||
action.Synchronize.text=Reload All from Disk
|
||||
action.Synchronize.description=Detect all externally changed files and reload them from disk
|
||||
action.ReloadFromDisk.text=Reload from Dis_k
|
||||
action.ReloadFromDisk.description=Reload current file from disk and lose all changes
|
||||
@@ -1178,7 +1178,7 @@ action.AssociateWithFileType.text=Associate with File Type...
|
||||
action.AssociateWithFileType.description=Associate selected file with one of file types
|
||||
action.RestoreDefaultExtensionScripts.text=Restore Default Extensions
|
||||
action.RestoreDefaultExtensionScripts.description=Restore bundled extensions for this directory
|
||||
action.SynchronizeCurrentFile.text=Synchronize selected file
|
||||
action.SynchronizeCurrentFile.text=Reload from Disk
|
||||
action.TypeHierarchy.BaseOnThisType.text=Base On This Type
|
||||
action.TypeHierarchy.Class.text=Class Hierarchy
|
||||
action.TypeHierarchy.Subtypes.text=Subtypes Hierarchy
|
||||
|
||||
@@ -75,12 +75,6 @@
|
||||
|
||||
<!-- File -->
|
||||
|
||||
<action id="ReloadFromDisk" class="com.intellij.ide.actions.ReloadFromDiskAction">
|
||||
<!--
|
||||
<add-to-group group-id="FileMenu" anchor="after" relative-to-action="Synchronize"/>
|
||||
-->
|
||||
</action>
|
||||
|
||||
<group id="NewProjectOrModuleGroup">
|
||||
</group>
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ public class SynchronizeCurrentFileAction extends AnAction implements DumbAware
|
||||
}
|
||||
else {
|
||||
e.getPresentation().setEnabledAndVisible(true);
|
||||
e.getPresentation().setText(getMessage(project, files));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user