Search in sources :

Example 1 with DesignerToolWindow

use of com.intellij.uiDesigner.propertyInspector.DesignerToolWindow in project intellij-community by JetBrains.

the class GuiEditor method getData.

public Object getData(final String dataId) {
    if (PlatformDataKeys.HELP_ID.is(dataId)) {
        return ourHelpID;
    }
    // Standard Swing cut/copy/paste actions should work if user is editing something inside property inspector
    Project project = getProject();
    if (project.isDisposed())
        return null;
    DesignerToolWindow toolWindow = DesignerToolWindowManager.getInstance(this);
    if (toolWindow == null)
        return null;
    final PropertyInspector inspector = toolWindow.getPropertyInspector();
    if (inspector != null && inspector.isEditing()) {
        return null;
    }
    if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
        return myDeleteProvider;
    }
    if (PlatformDataKeys.COPY_PROVIDER.is(dataId) || PlatformDataKeys.CUT_PROVIDER.is(dataId) || PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
        return myCutCopyPasteSupport;
    }
    return null;
}
Also used : Project(com.intellij.openapi.project.Project) DesignerToolWindow(com.intellij.uiDesigner.propertyInspector.DesignerToolWindow) PropertyInspector(com.intellij.uiDesigner.propertyInspector.PropertyInspector)

Example 2 with DesignerToolWindow

use of com.intellij.uiDesigner.propertyInspector.DesignerToolWindow in project intellij-community by JetBrains.

the class GuiEditor method refreshAndSave.

public void refreshAndSave(final boolean forceSync) {
    DesignerToolWindow toolWindow = DesignerToolWindowManager.getInstance(this);
    if (toolWindow == null) {
        return;
    }
    // Update property inspector
    final PropertyInspector propertyInspector = toolWindow.getPropertyInspector();
    if (propertyInspector != null) {
        propertyInspector.synchWithTree(forceSync);
    }
    UsageTrigger.trigger("swing-designer.edit");
    refresh();
    saveToFile();
    // TODO[yole]: install appropriate listeners so that the captions repaint themselves at correct time
    myHorzCaptionPanel.repaint();
    myVertCaptionPanel.repaint();
}
Also used : DesignerToolWindow(com.intellij.uiDesigner.propertyInspector.DesignerToolWindow) PropertyInspector(com.intellij.uiDesigner.propertyInspector.PropertyInspector)

Example 3 with DesignerToolWindow

use of com.intellij.uiDesigner.propertyInspector.DesignerToolWindow in project intellij-community by JetBrains.

the class GuiEditor method refreshProperties.

private void refreshProperties() {
    final Ref<Boolean> anythingModified = new Ref<>();
    FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor() {

        public boolean visit(final IComponent component) {
            final RadComponent radComponent = (RadComponent) component;
            boolean componentModified = false;
            for (IProperty prop : component.getModifiedProperties()) {
                if (prop instanceof IntroStringProperty) {
                    IntroStringProperty strProp = (IntroStringProperty) prop;
                    componentModified = strProp.refreshValue(radComponent) || componentModified;
                }
            }
            if (component instanceof RadContainer) {
                componentModified = ((RadContainer) component).updateBorder() || componentModified;
            }
            if (component.getParentContainer() instanceof RadTabbedPane) {
                componentModified = ((RadTabbedPane) component.getParentContainer()).refreshChildTitle(radComponent) || componentModified;
            }
            if (componentModified) {
                anythingModified.set(Boolean.TRUE);
            }
            return true;
        }
    });
    if (!anythingModified.isNull()) {
        refresh();
        DesignerToolWindow designerToolWindow = DesignerToolWindowManager.getInstance(this);
        ComponentTree tree = designerToolWindow.getComponentTree();
        if (tree != null)
            tree.repaint();
        PropertyInspector inspector = designerToolWindow.getPropertyInspector();
        if (inspector != null)
            inspector.synchWithTree(true);
    }
}
Also used : IComponent(com.intellij.uiDesigner.lw.IComponent) RadComponent(com.intellij.uiDesigner.radComponents.RadComponent) DesignerToolWindow(com.intellij.uiDesigner.propertyInspector.DesignerToolWindow) PropertyInspector(com.intellij.uiDesigner.propertyInspector.PropertyInspector) ComponentTree(com.intellij.uiDesigner.componentTree.ComponentTree) Ref(com.intellij.openapi.util.Ref) RadTabbedPane(com.intellij.uiDesigner.radComponents.RadTabbedPane) IProperty(com.intellij.uiDesigner.lw.IProperty) IntroStringProperty(com.intellij.uiDesigner.propertyInspector.properties.IntroStringProperty) RadContainer(com.intellij.uiDesigner.radComponents.RadContainer)

Aggregations

DesignerToolWindow (com.intellij.uiDesigner.propertyInspector.DesignerToolWindow)3 PropertyInspector (com.intellij.uiDesigner.propertyInspector.PropertyInspector)3 Project (com.intellij.openapi.project.Project)1 Ref (com.intellij.openapi.util.Ref)1 ComponentTree (com.intellij.uiDesigner.componentTree.ComponentTree)1 IComponent (com.intellij.uiDesigner.lw.IComponent)1 IProperty (com.intellij.uiDesigner.lw.IProperty)1 IntroStringProperty (com.intellij.uiDesigner.propertyInspector.properties.IntroStringProperty)1 RadComponent (com.intellij.uiDesigner.radComponents.RadComponent)1 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)1 RadTabbedPane (com.intellij.uiDesigner.radComponents.RadTabbedPane)1