Search in sources :

Example 1 with LightToolWindow

use of com.intellij.designer.LightToolWindow in project android by JetBrains.

the class AnalysisResultsManager method createContent.

@Override
protected LightToolWindow createContent(@NotNull DesignerEditorPanelFacade designer) {
    AnalysisResultsContent content = new AnalysisResultsContent();
    content.update(designer);
    Icon icon = content.getIcon();
    if (icon == null) {
        icon = getIcon();
    }
    // TODO figure out how to properly dispose this if it needs to be
    JComponent focus = content.getFocusComponent();
    LightToolWindow lightToolWindow = createContent(designer, content, getToolWindowTitleBarText(), icon, content.getMainPanel(), focus == null ? content.getMainPanel() : focus, 320, createActions());
    try {
        // When LightToolWindow#minimize() is added to the base platform and upstreamed,
        // replace this:
        LightToolWindow.class.getDeclaredMethod("minimize").invoke(lightToolWindow);
    // with lightToolWindow.minimize();
    } catch (Exception ignore) {
    }
    return lightToolWindow;
}
Also used : LightToolWindow(com.intellij.designer.LightToolWindow)

Example 2 with LightToolWindow

use of com.intellij.designer.LightToolWindow in project android by JetBrains.

the class AnalysisResultsManager method getContentFromDesigner.

@Nullable
private AnalysisResultsContent getContentFromDesigner() {
    DesignerEditorPanelFacade activeDesigner = getActiveDesigner();
    if (activeDesigner != null && activeDesigner instanceof CapturePanel) {
        Object property = activeDesigner.getClientProperty(getComponentName());
        if (property instanceof LightToolWindow) {
            LightToolWindow lightToolWindow = (LightToolWindow) property;
            Object content = lightToolWindow.getContent();
            if (content instanceof AnalysisResultsContent) {
                return (AnalysisResultsContent) content;
            }
        } else if (property instanceof AnalysisResultsContent) {
            return (AnalysisResultsContent) property;
        }
    }
    return null;
}
Also used : LightToolWindow(com.intellij.designer.LightToolWindow) DesignerEditorPanelFacade(com.intellij.designer.DesignerEditorPanelFacade) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with LightToolWindow

use of com.intellij.designer.LightToolWindow in project android by JetBrains.

the class NlAbstractWindowManager method activateToolWindow.

public void activateToolWindow(@NotNull DesignerEditorPanelFacade designer, @NotNull Runnable runnable) {
    LightToolWindow toolWindow = (LightToolWindow) designer.getClientProperty(getComponentName());
    if (toolWindow != null) {
        restore(toolWindow);
        runnable.run();
    } else {
        myToolWindow.show(runnable);
    }
}
Also used : LightToolWindow(com.intellij.designer.LightToolWindow)

Example 4 with LightToolWindow

use of com.intellij.designer.LightToolWindow in project android by JetBrains.

the class LayersManager method createContent.

@Override
protected LightToolWindow createContent(@NotNull DesignerEditorPanelFacade designer) {
    if (!(designer instanceof LayeredImageEditorPanel)) {
        return null;
    }
    LightToolWindow toolWindow = (LightToolWindow) designer.getClientProperty(getComponentName());
    if (toolWindow != null) {
        return toolWindow;
    }
    LayersPanel layersPanel = new LayersPanel();
    layersPanel.setImage(getImage(designer));
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
    // When LightToolWindowManager#getEditorMode() is public (or a constructor which lets
    // me not specify it) is available and upstreamed, replace the following with just
    // anchor = getEditorMode() :
    String value = propertiesComponent.getValue(myEditorModeKey);
    ToolWindowAnchor anchor;
    if (value == null) {
        anchor = getAnchor();
    } else {
        anchor = value.equals("ToolWindow") ? null : ToolWindowAnchor.fromText(value);
    }
    ThreeComponentsSplitter contentSplitter = designer.getContentSplitter();
    if (contentSplitter.getInnerComponent() == null) {
        // This is a fix for http://b.android.com/219047
        return null;
    }
    return new LightToolWindow(layersPanel, "Image Layers", AllIcons.Toolwindows.ToolWindowPalette, layersPanel, layersPanel, contentSplitter, anchor, this, myProject, propertiesComponent, getVisibilityKeyName(designer), 200, null);
}
Also used : LightToolWindow(com.intellij.designer.LightToolWindow) ToolWindowAnchor(com.intellij.openapi.wm.ToolWindowAnchor) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) ThreeComponentsSplitter(com.intellij.openapi.ui.ThreeComponentsSplitter)

Aggregations

LightToolWindow (com.intellij.designer.LightToolWindow)4 DesignerEditorPanelFacade (com.intellij.designer.DesignerEditorPanelFacade)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 ThreeComponentsSplitter (com.intellij.openapi.ui.ThreeComponentsSplitter)1 ToolWindowAnchor (com.intellij.openapi.wm.ToolWindowAnchor)1 Nullable (org.jetbrains.annotations.Nullable)1