Search in sources :

Example 1 with ToolWindowType

use of com.intellij.openapi.wm.ToolWindowType in project intellij-community by JetBrains.

the class ToggleDockModeAction method setSelected.

public void setSelected(AnActionEvent event, boolean flag) {
    Project project = event.getProject();
    if (project == null) {
        return;
    }
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    String id = windowManager.getActiveToolWindowId();
    if (id == null) {
        return;
    }
    ToolWindow toolWindow = windowManager.getToolWindow(id);
    ToolWindowType type = toolWindow.getType();
    if (ToolWindowType.DOCKED == type) {
        toolWindow.setType(ToolWindowType.SLIDING, null);
    } else if (ToolWindowType.SLIDING == type) {
        toolWindow.setType(ToolWindowType.DOCKED, null);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ToolWindowType(com.intellij.openapi.wm.ToolWindowType)

Example 2 with ToolWindowType

use of com.intellij.openapi.wm.ToolWindowType in project intellij-community by JetBrains.

the class ToggleFloatingModeAction 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.FLOATING == type) {
        toolWindow.setType(toolWindow.getInternalType(), null);
    } else {
        toolWindow.setType(ToolWindowType.FLOATING, null);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) ToolWindowType(com.intellij.openapi.wm.ToolWindowType) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 3 with ToolWindowType

use of com.intellij.openapi.wm.ToolWindowType 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);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindowEx(com.intellij.openapi.wm.ex.ToolWindowEx) ToolWindowType(com.intellij.openapi.wm.ToolWindowType) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 4 with ToolWindowType

use of com.intellij.openapi.wm.ToolWindowType in project intellij-community by JetBrains.

the class ToolWindowHeader method paintComponent.

@Override
protected void paintComponent(Graphics g) {
    Rectangle r = getBounds();
    Graphics2D g2d = (Graphics2D) g;
    Shape clip = g2d.getClip();
    ToolWindowType type = myToolWindow.getType();
    Image image;
    if (isActive()) {
        if (myActiveImage == null || /*myActiveImage.getHeight() != r.height ||*/
        type != myImageType) {
            myActiveImage = drawToBuffer(true, r.height, myToolWindow.getType() == ToolWindowType.FLOATING);
        }
        image = myActiveImage;
    } else {
        if (myImage == null || /*myImage.getHeight() != r.height ||*/
        type != myImageType) {
            myImage = drawToBuffer(false, r.height, myToolWindow.getType() == ToolWindowType.FLOATING);
        }
        image = myImage;
    }
    myImageType = myToolWindow.getType();
    Rectangle clipBounds = clip.getBounds();
    for (int x = clipBounds.x; x < clipBounds.x + clipBounds.width; x += 150) {
        UIUtil.drawImage(g, image, x, 0, null);
    }
}
Also used : ToolWindowType(com.intellij.openapi.wm.ToolWindowType) BufferedImage(java.awt.image.BufferedImage)

Example 5 with ToolWindowType

use of com.intellij.openapi.wm.ToolWindowType in project android by JetBrains.

the class NlAbstractWindowManager method initToolWindow.

protected void initToolWindow(@NotNull final String id, @NotNull Icon icon) {
    myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(id, false, getAnchor(), myProject, true);
    myToolWindow.setIcon(icon);
    myToolWindow.setAvailable(false, null);
    myToolWindow.setAutoHide(false);
    myPreviousWindowType = myToolWindow.getType();
    myPreviousWindowAnchor = getEditorMode();
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerAdapter() {

        @Override
        public void stateChanged() {
            if (myProject.isDisposed()) {
                return;
            }
            final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(id);
            ToolWindowType newWindowType = window.getType();
            ToolWindowAnchor newWindowAnchor = getEditorMode();
            if (newWindowType != myPreviousWindowType || newWindowAnchor != myPreviousWindowAnchor) {
                // TODO: Report the window docking state
                NlUsageTrackerManager.getInstance(myDesignSurface).logAction(LayoutEditorEvent.LayoutEditorEventType.UNKNOWN_EVENT_TYPE);
                myPreviousWindowType = newWindowType;
                myPreviousWindowAnchor = newWindowAnchor;
            }
        }
    }, myProject);
    initGearActions();
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) LightToolWindow(com.intellij.designer.LightToolWindow) ToolWindowManagerAdapter(com.intellij.openapi.wm.ex.ToolWindowManagerAdapter) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) ToolWindowType(com.intellij.openapi.wm.ToolWindowType) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Aggregations

ToolWindowType (com.intellij.openapi.wm.ToolWindowType)5 Project (com.intellij.openapi.project.Project)3 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)3 ToolWindow (com.intellij.openapi.wm.ToolWindow)2 ToolWindowEx (com.intellij.openapi.wm.ex.ToolWindowEx)2 LightToolWindow (com.intellij.designer.LightToolWindow)1 ToolWindowAnchor (com.intellij.openapi.wm.ToolWindowAnchor)1 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)1 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)1 BufferedImage (java.awt.image.BufferedImage)1