From 5c4f6a7fd0fec303d00d53127ce82404758f39ab Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 18 Nov 2010 14:29:01 +0300 Subject: [PATCH] select current inspection later (IDEA-49078) --- .../ui/InspectionToolsConfigurable.java | 12 +++++++++++- .../ui/SingleInspectionProfilePanel.java | 4 ++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java index e4f212c4ab54..d9c66679e357 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/InspectionToolsConfigurable.java @@ -50,6 +50,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.profile.Profile; import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; +import com.intellij.util.Alarm; import com.intellij.util.SystemProperties; import com.intellij.util.containers.HashMap; import org.jdom.Document; @@ -86,6 +87,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple protected final InspectionProfileManager myProfileManager; protected final InspectionProjectProfileManager myProjectProfileManager; private static final Logger LOG = Logger.getInstance("#" + InspectionToolsConfigurable.class.getName()); + private Alarm mySelectionAlarm; public InspectionToolsConfigurable(InspectionProjectProfileManager projectProfileManager, InspectionProfileManager profileManager) { @@ -341,8 +343,15 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple myProfiles.setSelectedItem(inspectionProfile); myLayout.show(myPanel, inspectionProfile.getName()); myDeleteButton.setEnabled(getProfiles().size() > 1 && inspectionProfile.getProfileManager() == myProfileManager); - SingleInspectionProfilePanel panel = getSelectedPanel(); + final SingleInspectionProfilePanel panel = getSelectedPanel(); if (panel != null) { + mySelectionAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD); + mySelectionAlarm.addRequest(new Runnable() { + public void run() { + panel.updateSelection(); + } + }, 200); + myShareProfileCheckBox.setSelected(panel.isProfileShared()); } } @@ -359,6 +368,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple panel.disposeUI(); } myPanels.clear(); + Disposer.dispose(mySelectionAlarm); } public void selectProfile(String name) { diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java index 8df435eff698..ab69da6d42f2 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java @@ -143,6 +143,10 @@ public class SingleInspectionProfilePanel extends JPanel { if (mySelectedProfile == null) return; restoreTreeState(); repaintTableData(); + updateSelection(); + } + + public void updateSelection() { final TreePath selectionPath = myTree.getSelectionPath(); if (selectionPath != null) { TreeUtil.selectNode(myTree, (TreeNode)selectionPath.getLastPathComponent());