Layout actions

This commit is contained in:
Alexander Lobas
2012-04-02 18:55:03 +04:00
parent cef6bf6e7d
commit 2dd3af9bf2
5 changed files with 42 additions and 38 deletions
@@ -16,8 +16,10 @@
package com.intellij.android.designer.model;
import com.android.ide.common.rendering.api.ViewInfo;
import com.intellij.designer.designSurface.DesignerEditorPanel;
import com.intellij.designer.model.RadComponent;
import com.intellij.designer.propertyTable.Property;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.psi.xml.XmlAttribute;
import com.intellij.psi.xml.XmlTag;
@@ -153,4 +155,15 @@ public class RadViewComponent extends RadComponent {
child.copyTo(parent);
}
}
@Override
public void addSelectionActions(DesignerEditorPanel designer,
DefaultActionGroup actionGroup,
JComponent shortcuts,
List<RadComponent> selection) {
RadViewLayout layout = (RadViewLayout)getLayout();
if (layout != null) {
layout.addContainerSelectionActions(designer, actionGroup, shortcuts, selection);
}
}
}
@@ -1,36 +0,0 @@
/*
* 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 RadViewGroupComponent extends RadViewComponent {
@Override
public void addSelectionActions(DesignerEditorPanel designer,
DefaultActionGroup actionGroup,
JComponent shortcuts,
List<RadComponent> selection) {
super.addSelectionActions(designer, actionGroup, shortcuts, selection); // TODO: Auto-generated method stub
}
}
@@ -16,10 +16,13 @@
package com.intellij.android.designer.model;
import com.intellij.designer.designSurface.ComponentDecorator;
import com.intellij.designer.designSurface.DesignerEditorPanel;
import com.intellij.designer.designSurface.selection.NonResizeSelectionDecorator;
import com.intellij.designer.model.RadComponent;
import com.intellij.designer.model.RadLayout;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import javax.swing.*;
import java.awt.*;
import java.util.List;
@@ -33,4 +36,10 @@ public class RadViewLayout extends RadLayout {
public ComponentDecorator getChildSelectionDecorator(RadComponent component, List<RadComponent> selection) {
return new NonResizeSelectionDecorator(Color.RED, 1);
}
public void addContainerSelectionActions(DesignerEditorPanel designer,
DefaultActionGroup actionGroup,
JComponent shortcuts,
List<RadComponent> selection) {
}
}
@@ -19,11 +19,13 @@ import com.intellij.android.designer.model.ModelParser;
import com.intellij.android.designer.model.RadViewComponent;
import com.intellij.android.designer.model.RadViewLayoutWithData;
import com.intellij.designer.componentTree.TreeEditOperation;
import com.intellij.designer.designSurface.DesignerEditorPanel;
import com.intellij.designer.designSurface.EditOperation;
import com.intellij.designer.designSurface.FeedbackLayer;
import com.intellij.designer.designSurface.OperationContext;
import com.intellij.designer.designSurface.feedbacks.AlphaComponent;
import com.intellij.designer.model.RadComponent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -49,6 +51,22 @@ public class RadLinearLayout extends RadViewLayoutWithData {
return null;
}
@Override
public void addContainerSelectionActions(DesignerEditorPanel designer,
DefaultActionGroup actionGroup,
JComponent shortcuts,
List<RadComponent> selection) {
super.addContainerSelectionActions(designer, actionGroup, shortcuts, selection); // TODO: Auto-generated method stub
}
@Override
public void addSelectionActions(DesignerEditorPanel designer,
DefaultActionGroup actionGroup,
JComponent shortcuts,
List<RadComponent> selection) {
super.addSelectionActions(designer, actionGroup, shortcuts, selection); // TODO: Auto-generated method stub
}
private void addNewComponent(RadViewComponent newComponent, @Nullable RadViewComponent insertBefore) throws Exception {
ModelParser.addComponent((RadViewComponent)myContainer, newComponent, insertBefore);
}
@@ -983,7 +983,7 @@
<!-- ================= Layouts ================= -->
<meta model="com.intellij.android.designer.model.RadViewGroupComponent"
<meta model="com.intellij.android.designer.model.RadViewComponent"
layout="com.intellij.android.designer.model.layout.RadLinearLayout"
class="android.widget.LinearLayout"
tag="LinearLayout">
@@ -1004,7 +1004,7 @@
</creation>
</meta>
<meta model="com.intellij.android.designer.model.RadViewGroupComponent"
<meta model="com.intellij.android.designer.model.RadViewComponent"
layout="com.intellij.android.designer.model.layout.RadFrameLayout"
class="android.widget.FrameLayout"
tag="FrameLayout">