EA-39276 - ISE: ToolWindowManagerImpl.checkId

This commit is contained in:
Alexey Kudravtsev
2012-12-10 16:23:07 +04:00
parent 9a9707df9d
commit 8ac22f1c2e
2 changed files with 11 additions and 14 deletions
@@ -35,13 +35,10 @@ public class UsageViewManagerImpl extends UsageViewManager {
private final Key<Boolean> REUSABLE_CONTENT_KEY = Key.create("UsageTreeManager.REUSABLE_CONTENT_KEY");
private final Key<Boolean> NOT_REUSABLE_CONTENT_KEY = Key.create("UsageTreeManager.NOT_REUSABLE_CONTENT_KEY"); //todo[myakovlev] dont use it
private final Key<UsageView> NEW_USAGE_VIEW_KEY = Key.create("NEW_USAGE_VIEW_KEY");
private final ToolWindowManager myToolWindowManager;
private final ContentManager myFindContentManager;
public UsageViewManagerImpl(final Project project, final ToolWindowManager toolWindowManager) {
myToolWindowManager = toolWindowManager;
ToolWindow toolWindow = myToolWindowManager.registerToolWindow(ToolWindowId.FIND, true, ToolWindowAnchor.BOTTOM, project, true);
ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.FIND, true, ToolWindowAnchor.BOTTOM, project, true);
toolWindow.setToHideOnEmptyContent(true);
toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowFind);
myFindContentManager = toolWindow.getContentManager();
@@ -45,8 +45,9 @@ import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.ui.HyperlinkAdapter;
import com.intellij.ui.content.Content;
import com.intellij.usageView.UsageViewBundle;
import com.intellij.usageView.*;
import com.intellij.usages.*;
import com.intellij.usages.UsageViewManager;
import com.intellij.util.Alarm;
import com.intellij.util.ArrayUtil;
import com.intellij.util.CommonProcessors;
@@ -322,9 +323,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
findUsagesStartedBalloon.addRequest(new Runnable() {
@Override
public void run() {
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.FIND, MessageType.INFO,
"Find Usages in progress...",
AllIcons.Actions.Find, null);
notifyByFindBalloon("Find Usages in progress...", null);
findStartedBalloonShown.set(true);
}
}, 300, ModalityState.NON_MODAL);
@@ -409,9 +408,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
myPresentation.getScopeText());
if (notFoundActions == null || notFoundActions.isEmpty()) {
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.FIND, MessageType.INFO,
"<html>"+message+".<br>" + createOptionsHtml() + "</html>",
AllIcons.Actions.Find, createGotToOptionsListener(mySearchFor));
notifyByFindBalloon("<html>"+message+".<br>" + createOptionsHtml() + "</html>", createGotToOptionsListener(mySearchFor));
findStartedBalloonShown.set(false);
}
else {
@@ -443,9 +440,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
usage.navigate(true);
flashUsageScriptaculously(usage);
}
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.FIND, MessageType.INFO,
"<html>Only one usage found.<br>" + createOptionsHtml() + "</html>",
AllIcons.Actions.Find, createGotToOptionsListener(mySearchFor));
notifyByFindBalloon("<html>Only one usage found.<br>" + createOptionsHtml() + "</html>", createGotToOptionsListener(mySearchFor));
}
}, ModalityState.NON_MODAL, myProject.getDisposed());
}
@@ -485,6 +480,11 @@ public class UsageViewManagerImpl extends UsageViewManager {
}
}
private void notifyByFindBalloon(@NotNull String text, HyperlinkListener listener) {
com.intellij.usageView.UsageViewManager.getInstance(myProject); // in case tool window not registered
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.FIND, MessageType.INFO, text, AllIcons.Actions.Find, listener);
}
@NotNull
private HyperlinkListener createGotToOptionsListener(@NotNull final UsageTarget[] targets) {
return new HyperlinkAdapter() {