use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class ToggleWindowedModeAction method setSelected.
public void setSelected(AnActionEvent event, boolean flag) {
Project project = event.getProject();
if (project == null) {
return;
}
String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
if (id == null) {
return;
}
ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
ToolWindowEx toolWindow = (ToolWindowEx) mgr.getToolWindow(id);
ToolWindowType type = toolWindow.getType();
if (ToolWindowType.WINDOWED == type) {
toolWindow.setType(toolWindow.getInternalType(), null);
} else {
toolWindow.setType(ToolWindowType.WINDOWED, null);
}
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class EditorTabbedContainer method updateTabBorder.
private void updateTabBorder() {
if (!myProject.isOpen())
return;
ToolWindowManagerEx mgr = (ToolWindowManagerEx) ToolWindowManager.getInstance(myProject);
String[] ids = mgr.getToolWindowIds();
Insets border = JBUI.emptyInsets();
UISettings uiSettings = UISettings.getInstance();
List<String> topIds = mgr.getIdsOn(ToolWindowAnchor.TOP);
List<String> bottom = mgr.getIdsOn(ToolWindowAnchor.BOTTOM);
List<String> rightIds = mgr.getIdsOn(ToolWindowAnchor.RIGHT);
List<String> leftIds = mgr.getIdsOn(ToolWindowAnchor.LEFT);
if (!uiSettings.getHideToolStripes() && !uiSettings.getPresentationMode()) {
border.top = !topIds.isEmpty() ? 1 : 0;
border.bottom = !bottom.isEmpty() ? 1 : 0;
border.left = !leftIds.isEmpty() ? 1 : 0;
border.right = !rightIds.isEmpty() ? 1 : 0;
}
for (String each : ids) {
ToolWindow eachWnd = mgr.getToolWindow(each);
if (eachWnd == null || !eachWnd.isAvailable())
continue;
if (eachWnd.isVisible() && eachWnd.getType() == ToolWindowType.DOCKED) {
ToolWindowAnchor eachAnchor = eachWnd.getAnchor();
if (eachAnchor == ToolWindowAnchor.TOP) {
border.top = 0;
} else if (eachAnchor == ToolWindowAnchor.BOTTOM) {
border.bottom = 0;
} else if (eachAnchor == ToolWindowAnchor.LEFT) {
border.left = 0;
} else if (eachAnchor == ToolWindowAnchor.RIGHT) {
border.right = 0;
}
}
}
myTabs.getPresentation().setPaintBorder(border.top, border.left, border.right, border.bottom).setTabSidePaintBorder(5);
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class SpeedSearchBase method manageSearchPopup.
private void manageSearchPopup(@Nullable SearchPopup searchPopup) {
Project project = null;
if (ApplicationManager.getApplication() != null && !ApplicationManager.getApplication().isDisposed()) {
project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myComponent));
}
if (project != null && project.isDefault()) {
project = null;
}
if (mySearchPopup != null) {
myPopupLayeredPane.remove(mySearchPopup);
myPopupLayeredPane.validate();
myPopupLayeredPane.repaint();
myPopupLayeredPane = null;
if (myListenerDisposable != null) {
Disposer.dispose(myListenerDisposable);
}
myListenerDisposable = null;
} else if (searchPopup != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("ui.tree.speedsearch");
}
if (!myComponent.isShowing()) {
mySearchPopup = null;
} else {
mySearchPopup = searchPopup;
}
fireStateChanged();
if (mySearchPopup == null || !myComponent.isDisplayable())
return;
if (project != null) {
myListenerDisposable = Disposer.newDisposable();
ToolWindowManagerEx toolWindowManager = (ToolWindowManagerEx) ToolWindowManager.getInstance(project);
toolWindowManager.addToolWindowManagerListener(myWindowManagerListener, myListenerDisposable);
}
JRootPane rootPane = myComponent.getRootPane();
if (rootPane != null) {
myPopupLayeredPane = rootPane.getLayeredPane();
} else {
myPopupLayeredPane = null;
}
if (myPopupLayeredPane == null) {
LOG.error(toString() + " in " + myComponent);
return;
}
myPopupLayeredPane.add(mySearchPopup, JLayeredPane.POPUP_LAYER);
moveSearchPopup();
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class ContentManagerUtil method getContentManagerFromContext.
/**
* This is utility method. It returns <code>ContentManager</code> from the current context.
*/
public static ContentManager getContentManagerFromContext(DataContext dataContext, boolean requiresVisibleToolWindow) {
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return null;
}
ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
String id = mgr.getActiveToolWindowId();
if (id == null) {
if (mgr.isEditorComponentActive()) {
id = mgr.getLastActiveToolWindowId();
}
}
ToolWindowEx toolWindow = id != null ? (ToolWindowEx) mgr.getToolWindow(id) : null;
if (requiresVisibleToolWindow && (toolWindow == null || !toolWindow.isVisible())) {
return null;
}
ContentManager fromToolWindow = toolWindow != null ? toolWindow.getContentManager() : null;
ContentManager fromContext = PlatformDataKeys.CONTENT_MANAGER.getData(dataContext);
return ObjectUtils.chooseNotNull(fromContext, fromToolWindow);
}
use of com.intellij.openapi.wm.ex.ToolWindowManagerEx in project intellij-community by JetBrains.
the class BaseToolWindowToggleAction method setSelected.
@Override
public final void setSelected(AnActionEvent e, boolean state) {
Project project = e.getProject();
if (project == null) {
return;
}
String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
if (id == null) {
return;
}
ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
ToolWindowEx toolWindow = (ToolWindowEx) mgr.getToolWindow(id);
setSelected(toolWindow, state);
}
Aggregations