diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java index 216709a18dc3..3f9b7711f8a3 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/AndroidDesignerEditorPanel.java @@ -177,6 +177,8 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel { ModelParser.updateRootComponent(rootComponent, mySession, rootView); myLayeredPane.repaint(); + + DesignerToolWindowManager.getInstance(getProject()).refresh(); } }); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/DropToOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/DropToOperation.java index 3ccb4f968921..8ac4aaf9f624 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/DropToOperation.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/DropToOperation.java @@ -81,8 +81,15 @@ public class DropToOperation implements EditOperation { @Override public void execute() throws Exception { - for (RadComponent component : myComponents) { - ModelParser.addComponent(myContainer, (RadViewComponent)component, null); + if (myContext.isAdd()) { + for (RadComponent component : myComponents) { + ModelParser.moveComponent(myContainer, (RadViewComponent)component, null); + } + } + else { + for (RadComponent component : myComponents) { + ModelParser.addComponent(myContainer, (RadViewComponent)component, null); + } } } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/designSurface/TreeDropToOperation.java b/plugins/android-designer/src/com/intellij/android/designer/designSurface/TreeDropToOperation.java index 80fd38068843..9c1b22416373 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/designSurface/TreeDropToOperation.java +++ b/plugins/android-designer/src/com/intellij/android/designer/designSurface/TreeDropToOperation.java @@ -31,6 +31,18 @@ public class TreeDropToOperation extends TreeEditOperation { @Override protected void execute(RadComponent insertBefore) throws Exception { - ModelParser.addComponent((RadViewComponent)myHost, (RadViewComponent)myComponents.get(0), (RadViewComponent)insertBefore); + RadViewComponent host = (RadViewComponent)myHost; + RadViewComponent before = (RadViewComponent)insertBefore; + + if (myContext.isAdd()) { + for (RadComponent component : myComponents) { + ModelParser.moveComponent(host, (RadViewComponent)component, before); + } + } + else { + for (RadComponent component : myComponents) { + ModelParser.addComponent(host, (RadViewComponent)component, before); + } + } } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/AdapterViewFlipper.png b/plugins/android-designer/src/com/intellij/android/designer/icons/AdapterViewFlipper.png new file mode 100644 index 000000000000..89f8c638d1e8 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/AdapterViewFlipper.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/ExpandableListView.png b/plugins/android-designer/src/com/intellij/android/designer/icons/ExpandableListView.png new file mode 100644 index 000000000000..fd1069797a82 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/ExpandableListView.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/Gallery.png b/plugins/android-designer/src/com/intellij/android/designer/icons/Gallery.png new file mode 100644 index 000000000000..36b8ff625ccb Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/Gallery.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/ImageSwitcher.png b/plugins/android-designer/src/com/intellij/android/designer/icons/ImageSwitcher.png new file mode 100644 index 000000000000..c089a2aca0b1 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/ImageSwitcher.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/MediaController.png b/plugins/android-designer/src/com/intellij/android/designer/icons/MediaController.png new file mode 100644 index 000000000000..ef30b340a953 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/MediaController.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/Spinner.png b/plugins/android-designer/src/com/intellij/android/designer/icons/Spinner.png new file mode 100644 index 000000000000..34cdc7cf96b7 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/Spinner.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/StackView.png b/plugins/android-designer/src/com/intellij/android/designer/icons/StackView.png new file mode 100644 index 000000000000..203bafc61986 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/StackView.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/TextSwitcher.png b/plugins/android-designer/src/com/intellij/android/designer/icons/TextSwitcher.png new file mode 100644 index 000000000000..6de1d92e1bbb Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/TextSwitcher.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/ViewAnimator.png b/plugins/android-designer/src/com/intellij/android/designer/icons/ViewAnimator.png new file mode 100644 index 000000000000..7d6bea60223d Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/ViewAnimator.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/ViewFlipper.png b/plugins/android-designer/src/com/intellij/android/designer/icons/ViewFlipper.png new file mode 100644 index 000000000000..300ed2d7386d Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/ViewFlipper.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/ViewSwitcher.png b/plugins/android-designer/src/com/intellij/android/designer/icons/ViewSwitcher.png new file mode 100644 index 000000000000..adc0abe98db2 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/ViewSwitcher.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/icons/scroll_to_h_v.png b/plugins/android-designer/src/com/intellij/android/designer/icons/scroll_to_h_v.png new file mode 100644 index 000000000000..5b69347f1245 Binary files /dev/null and b/plugins/android-designer/src/com/intellij/android/designer/icons/scroll_to_h_v.png differ diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java index 020a3f689bdd..0de4c1179468 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/ModelParser.java @@ -27,7 +27,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; -import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiErrorElement; import com.intellij.psi.XmlElementFactory; import com.intellij.psi.XmlRecursiveElementVisitor; @@ -36,7 +35,6 @@ import com.intellij.psi.xml.XmlTag; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.Nullable; -import javax.swing.*; import java.util.List; /** @@ -123,6 +121,45 @@ public class ModelParser extends XmlRecursiveElementVisitor { return component; } + public static void moveComponent(final RadViewComponent container, + final RadViewComponent movedComponent, + @Nullable final RadViewComponent insertBefore) + throws Exception { + movedComponent.getParent().getChildren().remove(movedComponent); + movedComponent.setParent(container); + + List children = container.getChildren(); + if (insertBefore == null) { + children.add(movedComponent); + } + else { + children.add(children.indexOf(insertBefore), movedComponent); + } + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + XmlTag xmlTag = movedComponent.getTag(); + + XmlTag parentTag = container.getTag(); + XmlTag nextTag = insertBefore == null ? null : insertBefore.getTag(); + XmlTag newXmlTag; + if (nextTag == null) { + newXmlTag = parentTag.addSubTag(xmlTag, false); + } + else { + newXmlTag = (XmlTag)parentTag.addBefore(xmlTag, nextTag); + } + + xmlTag.delete(); + movedComponent.setTag(newXmlTag); + } + }); + + PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY); + propertyParser.load(movedComponent); + } + public static void addComponent(RadViewComponent container, RadViewComponent newComponent, @Nullable RadViewComponent insertBefore) throws Exception { newComponent.setParent(container); @@ -135,13 +172,13 @@ public class ModelParser extends XmlRecursiveElementVisitor { children.add(children.indexOf(insertBefore), newComponent); } - setComponentTag(container.getTag(), newComponent, insertBefore == null ? null : insertBefore.getTag()); + addComponentTag(container.getTag(), newComponent, insertBefore == null ? null : insertBefore.getTag()); PropertyParser propertyParser = container.getRoot().getClientProperty(PropertyParser.KEY); propertyParser.load(newComponent); } - public static void setComponentTag(final XmlTag parentTag, final RadViewComponent component, final XmlTag nextTag) { + public static void addComponentTag(final XmlTag parentTag, final RadViewComponent component, final XmlTag nextTag) { ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java index b1fcb7f861ed..62c155ea5646 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/PropertyParser.java @@ -197,6 +197,17 @@ public class PropertyParser { return properties; } + public boolean isAssignableFrom(MetaModel base, MetaModel test) { + try { + Class baseClass = myClassLoader.loadClass(base.getTarget()); + Class testClass = myClassLoader.loadClass(test.getTarget()); + return baseClass.isAssignableFrom(testClass); + } + catch (Throwable e) { + } + return false; + } + @NotNull public ResourceDialog createResourceDialog(ResourceType[] types) { return new ResourceDialog(myModule, types); diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadImageSwitcherLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadImageSwitcherLayout.java new file mode 100644 index 000000000000..ce4821e3431e --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadImageSwitcherLayout.java @@ -0,0 +1,25 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.model; + +/** + * @author Alexander Lobas + */ +public class RadImageSwitcherLayout extends RadTypeSwitcherLayout { + public RadImageSwitcherLayout() { + super("ImageView"); + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewComponent.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewComponent.java index 34ff955852a7..163178a83053 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewComponent.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewComponent.java @@ -15,8 +15,62 @@ */ package com.intellij.android.designer.model; +import com.intellij.designer.designSurface.DesignerEditorPanel; +import com.intellij.designer.model.MetaManager; +import com.intellij.designer.model.MetaModel; +import com.intellij.designer.model.RadComponent; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.DefaultActionGroup; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.util.IconLoader; +import com.intellij.util.ThrowableRunnable; + +import javax.swing.*; +import java.util.List; + /** * @author Alexander Lobas */ public class RadScrollViewComponent extends RadViewComponent { + private static final Icon SCROLL = IconLoader.getIcon("/com/intellij/android/designer/icons/scroll_to_h_v.png"); + + @Override + public void addSelectionActions(DesignerEditorPanel designer, + DefaultActionGroup actionGroup, + JComponent shortcuts, + List selection) { + if (selection.size() == 1) { + addScrollAction(designer, actionGroup, shortcuts, this); + } + } + + public static void addScrollAction(final DesignerEditorPanel designer, + DefaultActionGroup actionGroup, + JComponent shortcuts, + final RadViewComponent scrollContainer) { + String text = "Convert ScrollView to horizontal/vertical"; + actionGroup.add(new AnAction(text, text, SCROLL) { + @Override + public void actionPerformed(AnActionEvent e) { + designer.getToolProvider().execute(new ThrowableRunnable() { + @Override + public void run() throws Exception { + MetaManager manager = ViewsMetaManager.getInstance(scrollContainer.getTag().getProject()); + MetaModel vScrollView = manager.getModelByTag("ScrollView"); + MetaModel hScrollView = manager.getModelByTag("HorizontalScrollView"); + + scrollContainer.setMetaModel(scrollContainer.getMetaModel() == vScrollView ? hScrollView : vScrollView); + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + scrollContainer.getTag().setName(scrollContainer.getMetaModel().getTag()); + } + }); + } + }); + } + }); + } } \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewLayout.java new file mode 100644 index 000000000000..dd123d7ae30d --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadScrollViewLayout.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.model; + +import com.intellij.designer.designSurface.DesignerEditorPanel; +import com.intellij.designer.model.RadComponent; +import com.intellij.openapi.actionSystem.DefaultActionGroup; + +import javax.swing.*; +import java.util.List; + +/** + * @author Alexander Lobas + */ +public class RadScrollViewLayout extends RadSingleChildrenViewLayout { + @Override + public void addSelectionActions(DesignerEditorPanel designer, + DefaultActionGroup actionGroup, + JComponent shortcuts, + List selection) { + if (selection.size() == 1) { + RadScrollViewComponent.addScrollAction(designer, actionGroup, shortcuts, (RadViewComponent)myContainer); + } + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadSingleChildrenViewLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadSingleChildrenViewLayout.java index f1ef896eea80..c7e2e0e3aef5 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/RadSingleChildrenViewLayout.java +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadSingleChildrenViewLayout.java @@ -26,7 +26,9 @@ import com.intellij.designer.designSurface.OperationContext; public class RadSingleChildrenViewLayout extends RadViewLayout { @Override public EditOperation processChildOperation(OperationContext context) { - if (myContainer.getChildren().isEmpty() && (context.isCreate() || context.isPaste()) && context.getComponents().size() == 1) { + if (myContainer.getChildren().isEmpty() && + (context.isCreate() || context.isPaste() || context.isAdd()) && + context.getComponents().size() == 1) { if (context.isTree()) { return new TreeDropToOperation(myContainer, context); } diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadTextSwitcherLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadTextSwitcherLayout.java new file mode 100644 index 000000000000..59b120f74d0b --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadTextSwitcherLayout.java @@ -0,0 +1,27 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.model; + +import com.intellij.designer.designSurface.OperationContext; + +/** + * @author Alexander Lobas + */ +public class RadTextSwitcherLayout extends RadTypeSwitcherLayout { + public RadTextSwitcherLayout() { + super("TextView"); + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadTypeSwitcherLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadTypeSwitcherLayout.java new file mode 100644 index 000000000000..7808fa3fffe7 --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadTypeSwitcherLayout.java @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.model; + +import com.intellij.designer.designSurface.OperationContext; +import com.intellij.designer.model.MetaManager; +import com.intellij.designer.model.MetaModel; +import com.intellij.designer.model.RadComponent; + +/** + * @author Alexander Lobas + */ +public class RadTypeSwitcherLayout extends RadViewSwitcherLayout { + private final String myTypeTag; + private MetaModel myTypeModel; + + public RadTypeSwitcherLayout(String tag) { + myTypeTag = tag; + } + + @Override + protected boolean checkChildOperation(OperationContext context) { + if (super.checkChildOperation(context)) { + if (myTypeModel == null) { + MetaManager manager = ViewsMetaManager.getInstance(((RadViewComponent)myContainer).getTag().getProject()); + myTypeModel = manager.getModelByTag(myTypeTag); + } + + PropertyParser parser = myContainer.getRoot().getClientProperty(PropertyParser.KEY); + + for (RadComponent component : context.getComponents()) { + if (!parser.isAssignableFrom(myTypeModel, component.getMetaModel())) { + return false; + } + } + + return true; + } + + return false; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewAnimatorLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewAnimatorLayout.java new file mode 100644 index 000000000000..45185f5c29db --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewAnimatorLayout.java @@ -0,0 +1,41 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.model; + +import com.intellij.android.designer.designSurface.DropToOperation; +import com.intellij.android.designer.designSurface.TreeDropToOperation; +import com.intellij.designer.designSurface.EditOperation; +import com.intellij.designer.designSurface.OperationContext; + +/** + * @author Alexander Lobas + */ +public class RadViewAnimatorLayout extends RadViewLayout { + public EditOperation processChildOperation(OperationContext context) { + if ((context.isCreate() || context.isPaste() || context.isAdd()) && checkChildOperation(context)) { + if (context.isTree()) { + return new TreeDropToOperation(myContainer, context); + } + return new DropToOperation((RadViewComponent)myContainer, context); + } + + return null; + } + + protected boolean checkChildOperation(OperationContext context) { + return true; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/RadViewSwitcherLayout.java b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewSwitcherLayout.java new file mode 100644 index 000000000000..7f99403f539d --- /dev/null +++ b/plugins/android-designer/src/com/intellij/android/designer/model/RadViewSwitcherLayout.java @@ -0,0 +1,28 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.android.designer.model; + +import com.intellij.designer.designSurface.OperationContext; + +/** + * @author Alexander Lobas + */ +public class RadViewSwitcherLayout extends RadViewAnimatorLayout { + @Override + protected boolean checkChildOperation(OperationContext context) { + return myContainer.getChildren().size() < 2; + } +} \ No newline at end of file diff --git a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml index 15dd71e8da68..85f7bcaeebab 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml +++ b/plugins/android-designer/src/com/intellij/android/designer/model/views-meta-model.xml @@ -567,6 +567,7 @@ @@ -586,6 +587,7 @@ @@ -606,6 +608,7 @@ @@ -626,6 +629,7 @@ @@ -643,6 +647,7 @@ @@ -660,6 +665,7 @@ @@ -678,7 +684,12 @@ + + + + @@ -698,6 +709,26 @@ + + + + + + + + ]]> + + + + @@ -717,6 +748,7 @@ @@ -734,7 +766,7 @@ @@ -754,7 +786,7 @@ @@ -773,6 +805,198 @@ + + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + + + ]]> + + + + + + + + + + ]]> + + + + + + + + + + ]]> + + + + + + + + + + ]]> + + + - + + + @@ -839,9 +1063,18 @@ + + + - + + + + + + + diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java index 8ee859cbc358..690475b3e658 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/DesignerToolWindowManager.java @@ -121,7 +121,12 @@ public final class DesignerToolWindowManager implements ProjectComponent { public void refresh() { if (myTreeBuilder != null) { - myTreeBuilder.queueUpdate(); + myTreeBuilder.queueUpdate().doWhenDone(new Runnable() { + @Override + public void run() { + myComponentTree.repaint(); + } + }); } } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/actions/DesignerActionPanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/actions/DesignerActionPanel.java index fa6bc87f4d46..2705d49328bb 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/actions/DesignerActionPanel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/actions/DesignerActionPanel.java @@ -40,10 +40,12 @@ public class DesignerActionPanel implements DataProvider { private final DefaultActionGroup myStaticGroup = new DefaultActionGroup(); private final DefaultActionGroup myDynamicGroup = new DefaultActionGroup(); private JComponent myToolbar; + private final DesignerEditorPanel myDesigner; private final CommonEditActionsProvider myCommonEditActionsProvider; private final JComponent myShortcuts; public DesignerActionPanel(DesignerEditorPanel designer, JComponent shortcuts) { + myDesigner = designer; myCommonEditActionsProvider = new CommonEditActionsProvider(designer); myShortcuts = shortcuts; @@ -128,10 +130,10 @@ public class DesignerActionPanel implements DataProvider { } for (RadComponent parent : parents) { - parent.getLayout().addSelectionActions(myDynamicGroup, myShortcuts, selection); + parent.getLayout().addSelectionActions(myDesigner, myDynamicGroup, myShortcuts, selection); } for (RadComponent component : selection) { - component.addSelectionActions(myDynamicGroup, myShortcuts, selection); + component.addSelectionActions(myDesigner, myDynamicGroup, myShortcuts, selection); } update |= isVisible(myDynamicGroup); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java index 05ed077f0b91..11b10e28e919 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java @@ -15,6 +15,7 @@ */ package com.intellij.designer.model; +import com.intellij.designer.designSurface.DesignerEditorPanel; import com.intellij.designer.designSurface.OperationContext; import com.intellij.designer.designSurface.tools.DragTracker; import com.intellij.designer.designSurface.tools.InputTool; @@ -103,7 +104,10 @@ public abstract class RadComponent { public void processDropOperation(OperationContext context) { } - public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List selection) { + public void addSelectionActions(DesignerEditorPanel designer, + DefaultActionGroup actionGroup, + JComponent shortcuts, + List selection) { } ////////////////////////////////////////////////////////////////////////////////////////// // diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java index 509ed90ffdc8..50f5a59356f3 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadLayout.java @@ -16,6 +16,7 @@ package com.intellij.designer.model; import com.intellij.designer.designSurface.ComponentDecorator; +import com.intellij.designer.designSurface.DesignerEditorPanel; import com.intellij.designer.designSurface.EditOperation; import com.intellij.designer.designSurface.OperationContext; import com.intellij.openapi.actionSystem.DefaultActionGroup; @@ -41,6 +42,9 @@ public abstract class RadLayout { return null; } - public void addSelectionActions(DefaultActionGroup actionGroup, JComponent shortcuts, List selection) { + public void addSelectionActions(DesignerEditorPanel designer, + DefaultActionGroup actionGroup, + JComponent shortcuts, + List selection) { } } \ No newline at end of file