mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[file-history] edit source from changes should only be active in changes browser
Since revision3aa11a5618, Edit Source action from Changes Browser is registered via xml file. So it started to be active when there are changes in context. This led for this action to be executed from file history by f4 shortcut instead of Open Repository Version (IDEA-180371). Open Repository Version action inherited icon and shortcut from Edit Source, which is weird since it is a separate action and the two can appear in the same context simultaneously, so it was changed in52f1c1ee48. All this led to IDEA-190169 issue: Edit Source is always invoked by f4 even when user wants to assign f4 to Open Repository Version. Solution of the problem is to restrict EditSourceFromChangesBrowserAction to Changes Browser.
This commit is contained in:
+6
-2
@@ -24,6 +24,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase;
|
||||
import com.intellij.pom.Navigatable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -43,8 +44,11 @@ class EditSourceFromChangesBrowserAction extends EditSourceAction {
|
||||
super.update(event);
|
||||
event.getPresentation().setIcon(myEditSourceIcon);
|
||||
event.getPresentation().setText("Edit Source");
|
||||
if ((!ModalityState.NON_MODAL.equals(ModalityState.current())) ||
|
||||
CommittedChangesBrowserUseCase.IN_AIR.equals(CommittedChangesBrowserUseCase.DATA_KEY.getData(event.getDataContext()))) {
|
||||
if (event.getData(ChangesBrowserBase.DATA_KEY) == null) {
|
||||
event.getPresentation().setEnabledAndVisible(false);
|
||||
}
|
||||
else if ((!ModalityState.NON_MODAL.equals(ModalityState.current())) ||
|
||||
CommittedChangesBrowserUseCase.IN_AIR.equals(CommittedChangesBrowserUseCase.DATA_KEY.getData(event.getDataContext()))) {
|
||||
event.getPresentation().setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user