OSDN Git Service

Rename some layout editor classes
authorTor Norbye <tnorbye@google.com>
Mon, 29 Nov 2010 23:54:33 +0000 (15:54 -0800)
committerTor Norbye <tnorbye@google.com>
Tue, 30 Nov 2010 00:12:06 +0000 (16:12 -0800)
This changeset contains only renaming of some classes (and a couple
of >100 column adjustments), no semantic changes.

The name changes are:

BaseView => BaseViewRule
BaseLayout => BaseLayoutRule
ScaleInfo => CanvasTransform
CanvasSelection => SelectionItem
PropertySheetPage2 => PropertySheetPage
OutlinePage2 => OutlinePage

Change-Id: I14d8c711b12154f4fcb2169129fd553e31fdab84

39 files changed:
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/AbsoluteLayoutRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseLayoutRule.java [moved from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseLayout.java with 99% similarity]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseViewRule.java [moved from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseView.java with 98% similarity]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/DialerFilterRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/FrameLayoutRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/HorizontalScrollViewRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/IgnoredLayoutRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/ImageButtonRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/ImageViewRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/LinearLayoutRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/ListViewRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/MapViewRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/RelativeLayoutRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/ScrollViewRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/SeekBarRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/ViewRule.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/LayoutEditor.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasTransform.java [moved from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ScaleInfo.java with 95% similarity]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ClipboardSupport.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/EmptyViewsOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GestureManager.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GlobalCanvasDragInfo.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/HoverOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/MarqueeGesture.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/MoveGesture.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlineOverlay.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java [moved from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage2.java with 99% similarity]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteComposite.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage.java [moved from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage2.java with 97% similarity]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionItem.java [moved from eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasSelection.java with 94% similarity]
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionManager.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/SelectionOverlay.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseLayoutRuleTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseLayoutTest.java with 83% similarity]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseViewRuleTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseViewTest.java with 64% similarity]
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/TestAttributeInfo.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PointTestCases.java

index 348d6cf..ffa43d9 100644 (file)
@@ -35,7 +35,7 @@ import java.util.Map;
  * An {@link IViewRule} for android.widget.AbsoluteLayout and all its derived
  * classes.
  */
-public class AbsoluteLayoutRule extends BaseLayout {
+public class AbsoluteLayoutRule extends BaseLayoutRule {
 
     // ==== Drag'n'drop support ====
     // The AbsoluteLayout accepts any drag'n'drop anywhere on its surface.
@@ -39,7 +39,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-public class BaseLayout extends BaseView {
+public class BaseLayoutRule extends BaseViewRule {
 
     @Override
     public boolean onInitialize(String fqcn, IClientRulesEngine engine) {
@@ -258,7 +258,7 @@ public class BaseLayout extends BaseView {
     }
 
     /**
-     * For use by {@link BaseLayout#addAttributes} A filter should return a
+     * For use by {@link BaseLayoutRule#addAttributes} A filter should return a
      * valid replacement string.
      */
     public static interface AttributeFilter {
@@ -48,7 +48,7 @@ import java.util.Set;
 /**
  * Common IViewRule processing to all view and layout classes.
  */
-public class BaseView implements IViewRule {
+public class BaseViewRule implements IViewRule {
     protected IClientRulesEngine mRulesEngine;
 
     // Cache of attributes. Key is FQCN of a node mixed with its view hierarchy
@@ -418,8 +418,8 @@ public class BaseView implements IViewRule {
             String parentFqcn = parent.getFqcn();
             IViewRule parentRule = mRulesEngine.loadRule(parentFqcn);
 
-            if (parentRule instanceof BaseLayout) {
-                ((BaseLayout) parentRule).onPasteBeforeChild(parent, targetNode, elements);
+            if (parentRule instanceof BaseLayoutRule) {
+                ((BaseLayoutRule) parentRule).onPasteBeforeChild(parent, targetNode, elements);
             }
         }
     }
index 311af84..4c1af19 100644 (file)
@@ -31,7 +31,7 @@ import com.android.ide.common.api.InsertType;
 /**
  * An {@link IViewRule} for android.widget.DialerFilterRule.
  */
-public class DialerFilterRule extends BaseView {
+public class DialerFilterRule extends BaseViewRule {
 
     @Override
     public void onCreate(INode node, INode parent, InsertType insertType) {
index 16b477b..46b3bb7 100755 (executable)
@@ -33,7 +33,7 @@ import java.util.Map;
  * An {@link IViewRule} for android.widget.FrameLayout and all its derived
  * classes.
  */
-public class FrameLayoutRule extends BaseLayout {
+public class FrameLayoutRule extends BaseLayoutRule {
 
     // ==== Drag'n'drop support ====
     // The FrameLayout accepts any drag'n'drop anywhere on its surface.
index 6ae6872..cceee78 100644 (file)
@@ -31,7 +31,7 @@ import com.android.ide.common.api.InsertType;
 /**
  * An {@link IViewRule} for android.widget.HorizontalScrollView.
  */
-public class HorizontalScrollViewRule extends BaseView {
+public class HorizontalScrollViewRule extends BaseViewRule {
 
     @Override
     public void onChildInserted(INode child, INode parent, InsertType insertType) {
index af92c71..a0b56d2 100644 (file)
@@ -30,7 +30,7 @@ import com.android.ide.common.api.INode;
  * LinearLayout even though it extends it. Our ZoomControls rule is therefore a
  * subclass of this {@link IgnoredLayoutRule} class.
  */
-public abstract class IgnoredLayoutRule extends BaseLayout {
+public abstract class IgnoredLayoutRule extends BaseLayoutRule {
     @Override
     public DropFeedback onDropEnter(INode targetNode, IDragElement[] elements) {
         // Do nothing; this layout rule corresponds to a layout that
index 9ea5dc2..4338a9a 100644 (file)
@@ -26,7 +26,7 @@ import com.android.ide.common.api.InsertType;
 /**
  * An {@link IViewRule} for android.widget.ImageButtonRule.
  */
-public class ImageButtonRule extends BaseView {
+public class ImageButtonRule extends BaseViewRule {
 
     @Override
     public void onCreate(INode node, INode parent, InsertType insertType) {
index 9b1eac3..9d26e75 100644 (file)
@@ -26,7 +26,7 @@ import com.android.ide.common.api.InsertType;
 /**
  * An {@link IViewRule} for android.widget.ImageViewRule.
  */
-public class ImageViewRule extends BaseView {
+public class ImageViewRule extends BaseViewRule {
 
     @Override
     public void onCreate(INode node, INode parent, InsertType insertType) {
index 77e6d54..d797677 100644 (file)
@@ -48,7 +48,7 @@ import java.util.Map;
  * An {@link IViewRule} for android.widget.LinearLayout and all its derived
  * classes.
  */
-public class LinearLayoutRule extends BaseLayout {
+public class LinearLayoutRule extends BaseLayoutRule {
     /**
      * Add an explicit Orientation toggle to the context menu.
      */
index d3d226c..c83e294 100755 (executable)
@@ -29,7 +29,7 @@ import com.android.ide.common.api.InsertType;
  * This is the "root" rule, that is used whenever there is not more specific
  * rule to apply.
  */
-public class ListViewRule extends BaseView {
+public class ListViewRule extends BaseViewRule {
 
     @Override
     public void onCreate(INode node, INode parent, InsertType insertType) {
index b8ddedd..301385a 100644 (file)
@@ -28,7 +28,7 @@ import com.android.ide.common.api.InsertType;
  * TODO: This class should be pulled out of the ADT and bundled with the add ons
  * (not the core jar but an optional tool jar)
  */
-public class MapViewRule extends BaseView {
+public class MapViewRule extends BaseViewRule {
 
     @Override
     public void onCreate(INode node, INode parent, InsertType insertType) {
index 04629b2..bf708a3 100755 (executable)
@@ -45,7 +45,7 @@ import java.util.Set;
  * An {@link IViewRule} for android.widget.RelativeLayout and all its derived
  * classes.
  */
-public class RelativeLayoutRule extends BaseLayout {
+public class RelativeLayoutRule extends BaseLayoutRule {
 
     // ==== Selection ====
 
index 5324278..0d3af83 100644 (file)
@@ -29,7 +29,7 @@ import com.android.ide.common.api.InsertType;
 /**
  * An {@link IViewRule} for android.widget.ScrollView.
  */
-public class ScrollViewRule extends BaseView {
+public class ScrollViewRule extends BaseViewRule {
 
     @Override
     public void onChildInserted(INode child, INode parent, InsertType insertType) {
index 727d231..40fb608 100644 (file)
@@ -27,7 +27,7 @@ import com.android.ide.common.api.InsertType;
 /**
  * An {@link IViewRule} for android.widget.SeekBar
  */
-public class SeekBarRule extends BaseView {
+public class SeekBarRule extends BaseViewRule {
 
     @Override
     public void onCreate(INode node, INode parent, InsertType insertType) {
index d645364..470b6a4 100755 (executable)
@@ -26,6 +26,6 @@ import com.android.ide.common.api.IViewRule;
  * There is no customization here, everything that is common to all views is
  * simply implemented in BaseView.
  */
-public class ViewRule extends BaseView {
+public class ViewRule extends BaseViewRule {
 
 }
index 74e86a0..2124aae 100644 (file)
@@ -26,8 +26,8 @@ import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.CustomVie
 import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
 import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
 import com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart;
-import com.android.ide.eclipse.adt.internal.editors.layout.gle2.OutlinePage2;
-import com.android.ide.eclipse.adt.internal.editors.layout.gle2.PropertySheetPage2;
+import com.android.ide.eclipse.adt.internal.editors.layout.gle2.OutlinePage;
+import com.android.ide.eclipse.adt.internal.editors.layout.gle2.PropertySheetPage;
 import com.android.ide.eclipse.adt.internal.editors.layout.gre.RulesEngine;
 import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
 import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
@@ -315,7 +315,7 @@ public class LayoutEditor extends AndroidXmlEditor implements IShowEditorInput,
         if (IContentOutlinePage.class == adapter && mGraphicalEditor != null) {
 
             if (mOutline == null && mGraphicalEditor != null) {
-                mOutline = new OutlinePage2(mGraphicalEditor);
+                mOutline = new OutlinePage(mGraphicalEditor);
             }
 
             return mOutline;
@@ -323,7 +323,7 @@ public class LayoutEditor extends AndroidXmlEditor implements IShowEditorInput,
 
         if (IPropertySheetPage.class == adapter && mGraphicalEditor != null) {
             if (mPropertyPage == null) {
-                mPropertyPage = new PropertySheetPage2();
+                mPropertyPage = new PropertySheetPage();
             }
 
             return mPropertyPage;
@@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.ScrollBar;
  * Helper class to convert between control pixel coordinates and canvas coordinates.
  * Takes care of the zooming and offset of the canvas.
  */
-public class ScaleInfo implements ICanvasTransform {
+public class CanvasTransform implements ICanvasTransform {
     /**
      * The canvas which controls the zooming.
      */
@@ -44,7 +44,7 @@ public class ScaleInfo implements ICanvasTransform {
     /** Scrollbar widget. */
     private ScrollBar mScrollbar;
 
-    public ScaleInfo(LayoutCanvas layoutCanvas, ScrollBar scrollbar) {
+    public CanvasTransform(LayoutCanvas layoutCanvas, ScrollBar scrollbar) {
         mCanvas = layoutCanvas;
         mScrollbar = scrollbar;
         mScale = 1.0;
@@ -55,7 +55,7 @@ public class ScaleInfo implements ICanvasTransform {
             public void widgetSelected(SelectionEvent e) {
                 // User requested scrolling. Changes translation and redraw canvas.
                 mTranslate = mScrollbar.getSelection();
-                ScaleInfo.this.mCanvas.redraw();
+                CanvasTransform.this.mCanvas.redraw();
             }
         });
     }
index 680c12e..540aedb 100644 (file)
@@ -83,7 +83,7 @@ public class ClipboardSupport {
      *            <b>this should be a copy already - this method will not make a
      *            copy</b>
      */
-    public void copySelectionToClipboard(List<CanvasSelection> selection) {
+    public void copySelectionToClipboard(List<SelectionItem> selection) {
         SelectionManager.sanitize(selection);
 
         if (selection.isEmpty()) {
@@ -91,8 +91,8 @@ public class ClipboardSupport {
         }
 
         Object[] data = new Object[] {
-                CanvasSelection.getAsElements(selection),
-                CanvasSelection.getAsText(mCanvas, selection)
+                SelectionItem.getAsElements(selection),
+                SelectionItem.getAsText(mCanvas, selection)
         };
 
         Transfer[] types = new Transfer[] {
@@ -116,7 +116,7 @@ public class ClipboardSupport {
      *            <b>this should be a copy already - this method will not make a
      *            copy</b>
      */
-    public void cutSelectionToClipboard(List<CanvasSelection> selection) {
+    public void cutSelectionToClipboard(List<SelectionItem> selection) {
         copySelectionToClipboard(selection);
         deleteSelection(
                 mCanvas.getCutLabel(),
@@ -134,7 +134,7 @@ public class ClipboardSupport {
      *            case nothing happens. The selection list will be sanitized so
      *            the caller should pass in a copy.
      */
-    public void deleteSelection(String verb, final List<CanvasSelection> selection) {
+    public void deleteSelection(String verb, final List<SelectionItem> selection) {
         SelectionManager.sanitize(selection);
 
         if (selection.isEmpty()) {
@@ -143,7 +143,7 @@ public class ClipboardSupport {
 
         // If all selected items have the same *kind* of parent, display that in the undo title.
         String title = null;
-        for (CanvasSelection cs : selection) {
+        for (SelectionItem cs : selection) {
             CanvasViewInfo vi = cs.getViewInfo();
             if (vi != null && vi.getParent() != null) {
                 if (title == null) {
@@ -180,7 +180,7 @@ public class ClipboardSupport {
         // resetting the selection.
         mCanvas.getLayoutEditor().wrapUndoEditXmlModel(title, new Runnable() {
             public void run() {
-                for (CanvasSelection cs : selection) {
+                for (SelectionItem cs : selection) {
                     CanvasViewInfo vi = cs.getViewInfo();
                     // You can't delete the root element
                     if (vi != null && !vi.isRoot()) {
@@ -202,7 +202,7 @@ public class ClipboardSupport {
      *            <b>this should be a copy already - this method will not make a
      *            copy</b>
      */
-    public void pasteSelection(List<CanvasSelection> selection) {
+    public void pasteSelection(List<SelectionItem> selection) {
 
         SimpleXmlTransfer sxt = SimpleXmlTransfer.getInstance();
         SimpleElement[] pasted = (SimpleElement[]) mClipboard.getContents(sxt);
@@ -224,7 +224,7 @@ public class ClipboardSupport {
         SelectionManager.sanitize(selection);
         CanvasViewInfo target = lastRoot;
         if (selection.size() > 0) {
-            CanvasSelection cs = selection.get(0);
+            SelectionItem cs = selection.get(0);
             target = cs.getViewInfo();
         }
 
index a514447..ca08209 100755 (executable)
@@ -51,7 +51,7 @@ import java.util.regex.Pattern;
  * This class is tied to a specific {@link LayoutCanvas} instance and a root {@link MenuManager}.
  * <p/>
  * Two instances of this are used: one created by {@link LayoutCanvas} and the other one
- * created by {@link OutlinePage2}. Different root {@link MenuManager}s are populated, however
+ * created by {@link OutlinePage}. Different root {@link MenuManager}s are populated, however
  * they are both linked to the current selection state of the {@link LayoutCanvas}.
  */
 /* package */ class DynamicContextMenu {
@@ -74,7 +74,7 @@ import java.util.regex.Pattern;
      * @param canvas The {@link LayoutCanvas} providing the selection, the node factory and
      *   the rules engine.
      * @param rootMenu The root of the context menu displayed. In practice this may be the
-     *   context menu manager of the {@link LayoutCanvas} or the one from {@link OutlinePage2}.
+     *   context menu manager of the {@link LayoutCanvas} or the one from {@link OutlinePage}.
      */
     public DynamicContextMenu(LayoutEditor editor, LayoutCanvas canvas, MenuManager rootMenu) {
         mEditor = editor;
@@ -218,7 +218,7 @@ import java.util.regex.Pattern;
             final TreeMap<String, ArrayList<MenuAction>> outActionsMap,
             final TreeMap<String, MenuAction.Group> outGroupsMap) {
         int maxMenuSelection = 0;
-        for (CanvasSelection selection : mCanvas.getSelectionManager().getSelections()) {
+        for (SelectionItem selection : mCanvas.getSelectionManager().getSelections()) {
             List<MenuAction> viewActions = null;
             if (selection != null) {
                 CanvasViewInfo vi = selection.getViewInfo();
index 946c381..8df6c58 100644 (file)
@@ -33,21 +33,24 @@ public class EmptyViewsOverlay extends Overlay {
     private Color mBorderColor;
 
     /** Vertical scaling & scrollbar information. */
-    private ScaleInfo mVScale;
+    private CanvasTransform mVScale;
 
     /** Horizontal scaling & scrollbar information. */
-    private ScaleInfo mHScale;
+    private CanvasTransform mHScale;
 
     /**
      * Constructs a new {@link EmptyViewsOverlay} linked to the given view hierarchy.
      *
      * @param viewHierarchy The {@link ViewHierarchy} to render.
-     * @param hScale The {@link ScaleInfo} to use to transfer horizontal layout
+     * @param hScale The {@link CanvasTransform} to use to transfer horizontal layout
      *            coordinates to screen coordinates.
-     * @param vScale The {@link ScaleInfo} to use to transfer vertical layout coordinates
+     * @param vScale The {@link CanvasTransform} to use to transfer vertical layout coordinates
      *            to screen coordinates.
      */
-    public EmptyViewsOverlay(ViewHierarchy viewHierarchy, ScaleInfo hScale, ScaleInfo vScale) {
+    public EmptyViewsOverlay(
+            ViewHierarchy viewHierarchy,
+            CanvasTransform hScale,
+            CanvasTransform vScale) {
         super();
         this.mViewHierarchy = viewHierarchy;
         this.mHScale = hScale;
index 2c7bd73..d3a7820 100644 (file)
@@ -476,7 +476,7 @@ public class GestureManager {
          * canvas selection due to the "sanitize" pass. Can be empty but never
          * null.
          */
-        private final ArrayList<CanvasSelection> mDragSelection = new ArrayList<CanvasSelection>();
+        private final ArrayList<SelectionItem> mDragSelection = new ArrayList<SelectionItem>();
 
         private SimpleElement[] mDragElements;
 
@@ -497,14 +497,14 @@ public class GestureManager {
             // element, *change* the selection to match the element under the
             // cursor and use that. If nothing can be selected, abort the drag
             // operation.
-            List<CanvasSelection> selections = mCanvas.getSelectionManager().getSelections();
+            List<SelectionItem> selections = mCanvas.getSelectionManager().getSelections();
             mDragSelection.clear();
 
             if (!selections.isEmpty()) {
                 // Is the cursor on top of a selected element?
                 boolean insideSelection = false;
 
-                for (CanvasSelection cs : selections) {
+                for (SelectionItem cs : selections) {
                     if (!cs.isRoot() && cs.getRect().contains(p.x, p.y)) {
                         insideSelection = true;
                         break;
@@ -532,7 +532,7 @@ public class GestureManager {
                         mDragSelection.addAll(selections);
                     } else {
                         // Only drag non-root items.
-                        for (CanvasSelection cs : selections) {
+                        for (SelectionItem cs : selections) {
                             if (!cs.isRoot()) {
                                 mDragSelection.add(cs);
                             }
@@ -555,9 +555,9 @@ public class GestureManager {
             e.doit = !mDragSelection.isEmpty();
             int imageCount = mDragSelection.size();
             if (e.doit) {
-                mDragElements = CanvasSelection.getAsElements(mDragSelection);
+                mDragElements = SelectionItem.getAsElements(mDragSelection);
                 GlobalCanvasDragInfo.getInstance().startDrag(mDragElements,
-                        mDragSelection.toArray(new CanvasSelection[imageCount]),
+                        mDragSelection.toArray(new SelectionItem[imageCount]),
                         mCanvas, new Runnable() {
                             public void run() {
                                 mCanvas.getClipboardSupport().deleteSelection("Remove",
@@ -593,7 +593,7 @@ public class GestureManager {
                     if (imageCount > 0) {
                         ImageData data = image.getImageData();
                         Rectangle imageRectangle = new Rectangle(0, 0, data.width, data.height);
-                        for (CanvasSelection item : mDragSelection) {
+                        for (SelectionItem item : mDragSelection) {
                             Rectangle bounds = item.getRect();
                             // Some bounds can be outside the rendered rectangle (for
                             // example, in an absolute layout, you can have negative
@@ -630,7 +630,7 @@ public class GestureManager {
          */
         public void dragSetData(DragSourceEvent e) {
             if (TextTransfer.getInstance().isSupportedType(e.dataType)) {
-                e.data = CanvasSelection.getAsText(mCanvas, mDragSelection);
+                e.data = SelectionItem.getAsText(mCanvas, mDragSelection);
                 return;
             }
 
index 7aee9bc..3fd98a3 100755 (executable)
@@ -40,7 +40,7 @@ final class GlobalCanvasDragInfo {
     private static final GlobalCanvasDragInfo sInstance = new GlobalCanvasDragInfo();
 
     private SimpleElement[] mCurrentElements = null;
-    private CanvasSelection[] mCurrentSelection;
+    private SelectionItem[] mCurrentSelection;
     private Object mSourceCanvas = null;
     private Runnable mRemoveSourceHandler;
 
@@ -66,7 +66,7 @@ final class GlobalCanvasDragInfo {
      *            source. It should only be invoked if the drag operation is a
      *            move, not a copy.
      */
-    public void startDrag(SimpleElement[] elements, CanvasSelection[] selection,
+    public void startDrag(SimpleElement[] elements, SelectionItem[] selection,
             Object sourceCanvas, Runnable removeSourceHandler) {
         mCurrentElements = elements;
         mCurrentSelection = selection;
@@ -89,12 +89,12 @@ final class GlobalCanvasDragInfo {
     /** Returns the selection originally dragged.
      * Can be null if the drag did not start in a canvas.
      */
-    public CanvasSelection[] getCurrentSelection() {
+    public SelectionItem[] getCurrentSelection() {
         return mCurrentSelection;
     }
 
     /**
-     * Returns the object that call {@link #startDrag(SimpleElement[], CanvasSelection[], Object)}.
+     * Returns the object that call {@link #startDrag(SimpleElement[], SelectionItem[], Object)}.
      * Can be null.
      * This is not meant to access the object indirectly, it is just meant to compare if the
      * source and the destination of the drag'n'drop are the same, so object identity
index 9a39427..27a6024 100644 (file)
@@ -33,10 +33,10 @@ public class HoverOverlay extends Overlay {
     private Color mHoverFillColor;
 
     /** Vertical scaling & scrollbar information. */
-    private ScaleInfo mVScale;
+    private CanvasTransform mVScale;
 
     /** Horizontal scaling & scrollbar information. */
-    private ScaleInfo mHScale;
+    private CanvasTransform mHScale;
 
     /**
      * Current mouse hover border rectangle. Null when there's no mouse hover.
@@ -48,12 +48,12 @@ public class HoverOverlay extends Overlay {
     /**
      * Constructs a new {@link HoverOverlay} linked to the given view hierarchy.
      *
-     * @param hScale The {@link ScaleInfo} to use to transfer horizontal layout
+     * @param hScale The {@link CanvasTransform} to use to transfer horizontal layout
      *            coordinates to screen coordinates.
-     * @param vScale The {@link ScaleInfo} to use to transfer vertical layout
+     * @param vScale The {@link CanvasTransform} to use to transfer vertical layout
      *            coordinates to screen coordinates.
      */
-    public HoverOverlay(ScaleInfo hScale, ScaleInfo vScale) {
+    public HoverOverlay(CanvasTransform hScale, CanvasTransform vScale) {
         super();
         this.mHScale = hScale;
         this.mVScale = vScale;
index b920607..893ed8f 100644 (file)
@@ -35,10 +35,10 @@ public class ImageOverlay extends Overlay {
     private LayoutCanvas mCanvas;
 
     /** Vertical scaling & scrollbar information. */
-    private ScaleInfo mVScale;
+    private CanvasTransform mVScale;
 
     /** Horizontal scaling & scrollbar information. */
-    private ScaleInfo mHScale;
+    private CanvasTransform mHScale;
 
     /**
      * Constructs an {@link ImageOverlay} tied to the given canvas.
@@ -47,7 +47,7 @@ public class ImageOverlay extends Overlay {
      * @param hScale The horizontal scale information.
      * @param vScale The vertical scale information.
      */
-    public ImageOverlay(LayoutCanvas canvas, ScaleInfo hScale, ScaleInfo vScale) {
+    public ImageOverlay(LayoutCanvas canvas, CanvasTransform hScale, CanvasTransform vScale) {
         this.mCanvas = canvas;
         this.mHScale = hScale;
         this.mVScale = vScale;
@@ -107,8 +107,8 @@ public class ImageOverlay extends Overlay {
                 gc_setAlpha(gc, 128); // half-transparent
             }
 
-            ScaleInfo hi = mHScale;
-            ScaleInfo vi = mVScale;
+            CanvasTransform hi = mHScale;
+            CanvasTransform vi = mVScale;
 
             // we only anti-alias when reducing the image size.
             int oldAlias = -2;
index 89eb9a4..4782204 100755 (executable)
@@ -141,10 +141,10 @@ class LayoutCanvas extends Canvas {
     private final NodeFactory mNodeFactory = new NodeFactory();
 
     /** Vertical scaling & scrollbar information. */
-    private ScaleInfo mVScale;
+    private CanvasTransform mVScale;
 
     /** Horizontal scaling & scrollbar information. */
-    private ScaleInfo mHScale;
+    private CanvasTransform mHScale;
 
     /** Drag source associated with this canvas. */
     private DragSource mDragSource;
@@ -156,7 +156,7 @@ class LayoutCanvas extends Canvas {
      * when page's widget is already disposed.
      * Added the DisposeListener to OutlinePage2 in order to correctly dispose this page.
      **/
-    private OutlinePage2 mOutlinePage;
+    private OutlinePage mOutlinePage;
 
     /** Delete action for the Edit or context menu. */
     private Action mDeleteAction;
@@ -217,8 +217,8 @@ class LayoutCanvas extends Canvas {
         mRulesEngine = rulesEngine;
 
         mClipboardSupport = new ClipboardSupport(this, parent);
-        mHScale = new ScaleInfo(this, getHorizontalBar());
-        mVScale = new ScaleInfo(this, getVerticalBar());
+        mHScale = new CanvasTransform(this, getHorizontalBar());
+        mVScale = new CanvasTransform(this, getVerticalBar());
 
         mGCWrapper = new GCWrapper(mHScale, mVScale);
 
@@ -286,8 +286,8 @@ class LayoutCanvas extends Canvas {
         // --- setup outline ---
         // Get the outline associated with this editor, if any and of the right type.
         Object outline = layoutEditor.getAdapter(IContentOutlinePage.class);
-        if (outline instanceof OutlinePage2) {
-            mOutlinePage = (OutlinePage2) outline;
+        if (outline instanceof OutlinePage) {
+            mOutlinePage = (OutlinePage) outline;
         }
     }
 
@@ -368,7 +368,7 @@ class LayoutCanvas extends Canvas {
 
     /**
      * Returns our {@link DragSourceListener}.
-     * This is used by {@link OutlinePage2} to delegate drag source events.
+     * This is used by {@link OutlinePage} to delegate drag source events.
      */
     /* package */ DragSourceListener getDragListener() {
         return mGestureManager.getDragSourceListener();
@@ -376,7 +376,7 @@ class LayoutCanvas extends Canvas {
 
     /**
      * Returns our {@link DropTargetListener}.
-     * This is used by {@link OutlinePage2} to delegate drop target events.
+     * This is used by {@link OutlinePage} to delegate drop target events.
      */
     /* package */ DropTargetListener getDropListener() {
         return mGestureManager.getDropTargetListener();
@@ -408,24 +408,24 @@ class LayoutCanvas extends Canvas {
     }
 
     /**
-     * Returns the horizontal {@link ScaleInfo} transform object, which can map
+     * Returns the horizontal {@link CanvasTransform} transform object, which can map
      * a layout point into a control point.
      *
-     * @return A {@link ScaleInfo} for mapping between layout and control
+     * @return A {@link CanvasTransform} for mapping between layout and control
      *         coordinates in the horizontal dimension.
      */
-    /* package */ ScaleInfo getHorizontalTransform() {
+    /* package */ CanvasTransform getHorizontalTransform() {
         return mHScale;
     }
 
     /**
-     * Returns the vertical {@link ScaleInfo} transform object, which can map a
+     * Returns the vertical {@link CanvasTransform} transform object, which can map a
      * layout point into a control point.
      *
-     * @return A {@link ScaleInfo} for mapping between layout and control
+     * @return A {@link CanvasTransform} for mapping between layout and control
      *         coordinates in the vertical dimension.
      */
-    /* package */ ScaleInfo getVerticalTransform() {
+    /* package */ CanvasTransform getVerticalTransform() {
         return mVScale;
     }
 
@@ -632,11 +632,11 @@ class LayoutCanvas extends Canvas {
         // see if any of the selected items are among the invisible nodes, and if so
         // add them to a lazily constructed set which we pass back for rendering.
         Set<UiElementNode> result = null;
-        List<CanvasSelection> selections = mSelectionManager.getSelections();
+        List<SelectionItem> selections = mSelectionManager.getSelections();
         if (selections.size() > 0) {
             List<CanvasViewInfo> invisibleParents = mViewHierarchy.getInvisibleViews();
             if (invisibleParents.size() > 0) {
-                for (CanvasSelection item : selections) {
+                for (SelectionItem item : selections) {
                     CanvasViewInfo viewInfo = item.getViewInfo();
                     // O(n^2) here, but both the selection size and especially the
                     // invisibleParents size are expected to be small
@@ -809,7 +809,7 @@ class LayoutCanvas extends Canvas {
     /**
      * Helper to create the drag source for the given control.
      * <p/>
-     * This is static with package-access so that {@link OutlinePage2} can also
+     * This is static with package-access so that {@link OutlinePage} can also
      * create an exact copy of the source with the same attributes.
      */
     /* package */static DragSource createDragSource(Control control) {
@@ -824,7 +824,7 @@ class LayoutCanvas extends Canvas {
     /**
      * Helper to create the drop target for the given control.
      * <p/>
-     * This is static with package-access so that {@link OutlinePage2} can also
+     * This is static with package-access so that {@link OutlinePage} can also
      * create an exact copy of the drop target with the same attributes.
      */
     /* package */static DropTarget createDropTarget(Control control) {
@@ -1007,8 +1007,8 @@ class LayoutCanvas extends Canvas {
         manager.add(new Action("Run My Test", IAction.AS_PUSH_BUTTON) {
             @Override
             public void run() {
-                List<CanvasSelection> selection = mSelectionManager.getSelections();
-                CanvasSelection canvasSelection = selection.get(0);
+                List<SelectionItem> selection = mSelectionManager.getSelections();
+                SelectionItem canvasSelection = selection.get(0);
                 CanvasViewInfo info = canvasSelection.getViewInfo();
 
                 Object viewObject = info.getViewObject();
index f9c91f4..c374b0e 100644 (file)
@@ -53,9 +53,9 @@ public class MarqueeGesture extends Gesture {
         this.mCanvas = canvas;
 
         if (toggle) {
-            List<CanvasSelection> selection = canvas.getSelectionManager().getSelections();
+            List<SelectionItem> selection = canvas.getSelectionManager().getSelections();
             mInitialSelection = new ArrayList<CanvasViewInfo>(selection.size());
-            for (CanvasSelection item : selection) {
+            for (SelectionItem item : selection) {
                 mInitialSelection.add(item.getViewInfo());
             }
         } else {
index d36b96c..f047cbc 100644 (file)
@@ -572,9 +572,9 @@ public class MoveGesture extends DropGesture {
                         // layout itself: a copy would be ok but not a move operation of the
                         // layout into himself.
 
-                        CanvasSelection[] selection = mGlobalDragInfo.getCurrentSelection();
+                        SelectionItem[] selection = mGlobalDragInfo.getCurrentSelection();
                         if (selection != null) {
-                            for (CanvasSelection cs : selection) {
+                            for (SelectionItem cs : selection) {
                                 if (cs.getViewInfo() == targetVi) {
                                     // The node that responded is one of the selection roots.
                                     // Simply invalidate the drop feedback and move on the
index 942da2b..a2c533e 100644 (file)
@@ -33,22 +33,25 @@ public class OutlineOverlay extends Overlay {
     private Color mOutlineColor;
 
     /** Vertical scaling & scrollbar information. */
-    private ScaleInfo mVScale;
+    private CanvasTransform mVScale;
 
     /** Horizontal scaling & scrollbar information. */
-    private ScaleInfo mHScale;
+    private CanvasTransform mHScale;
 
     /**
      * Constructs a new {@link OutlineOverlay} linked to the given view
      * hierarchy.
      *
      * @param viewHierarchy The {@link ViewHierarchy} to render
-     * @param hScale The {@link ScaleInfo} to use to transfer horizontal layout
+     * @param hScale The {@link CanvasTransform} to use to transfer horizontal layout
      *            coordinates to screen coordinates
-     * @param vScale The {@link ScaleInfo} to use to transfer vertical layout
+     * @param vScale The {@link CanvasTransform} to use to transfer vertical layout
      *            coordinates to screen coordinates
      */
-    public OutlineOverlay(ViewHierarchy viewHierarchy, ScaleInfo hScale, ScaleInfo vScale) {
+    public OutlineOverlay(
+            ViewHierarchy viewHierarchy,
+            CanvasTransform hScale,
+            CanvasTransform vScale) {
         super();
         this.mViewHierarchy = viewHierarchy;
         this.mHScale = hScale;
@@ -76,7 +76,7 @@ import java.util.ArrayList;
  *
  * @since GLE2
  */
-public class OutlinePage2 extends ContentOutlinePage
+public class OutlinePage extends ContentOutlinePage
     implements ISelectionListener, INullSelectionListener {
 
     /**
@@ -108,7 +108,7 @@ public class OutlinePage2 extends ContentOutlinePage
      */
     private DropTarget mDropTarget;
 
-    public OutlinePage2(GraphicalEditorPart graphicalEditorPart) {
+    public OutlinePage(GraphicalEditorPart graphicalEditorPart) {
         super();
         mGraphicalEditorPart = graphicalEditorPart;
     }
index ba7b7b5..fc4d5d1 100755 (executable)
@@ -700,7 +700,7 @@ public class PaletteComposite extends Composite {
             AndroidTargetData data = layoutEditor.getTargetData();
             DocumentDescriptor documentDescriptor;
             if (data == null) {
-                documentDescriptor = new DocumentDescriptor("temp", null /*children*/); //$NON-NLS-1$
+                documentDescriptor = new DocumentDescriptor("temp", null/*children*/);//$NON-NLS-1$
             } else {
                 documentDescriptor = data.getLayoutDescriptors().getDescriptor();
             }
@@ -793,7 +793,7 @@ public class PaletteComposite extends Composite {
                                     && !ImageUtils.containsDarkPixels(cropped);
                             cropped = ImageUtils.createDropShadow(cropped,
                                     hasTransparency ? 3 : 5 /* shadowSize */,
-                                    !hasTransparency ? 0.6f : needsContrast ? 0.8f : 0.7f /* alpha */,
+                                    !hasTransparency ? 0.6f : needsContrast ? 0.8f : 0.7f/*alpha*/,
                                     0x000000 /* shadowRgb */);
 
                             Display display = getControl().getDisplay();
@@ -29,7 +29,6 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Tree;
 import org.eclipse.swt.widgets.TreeItem;
 import org.eclipse.ui.views.properties.PropertySheetEntry;
-import org.eclipse.ui.views.properties.PropertySheetPage;
 
 /**
  * A customized property sheet page for the graphical layout editor v2.
@@ -45,10 +44,10 @@ import org.eclipse.ui.views.properties.PropertySheetPage;
  *
  * @since GLE2
  */
-public class PropertySheetPage2 extends PropertySheetPage {
+public class PropertySheetPage extends org.eclipse.ui.views.properties.PropertySheetPage {
 
 
-    public PropertySheetPage2() {
+    public PropertySheetPage() {
         super();
     }
 
@@ -32,7 +32,7 @@ import java.util.List;
 /**
  * Represents one selection in {@link LayoutCanvas}.
  */
-/* package */ class CanvasSelection {
+/* package */ class SelectionItem {
 
     /** Current selected view info. Can be null. */
     private final CanvasViewInfo mCanvasViewInfo;
@@ -47,12 +47,12 @@ import java.util.List;
     private final String mName;
 
     /**
-     * Creates a new {@link CanvasSelection} object.
+     * Creates a new {@link SelectionItem} object.
      * @param canvasViewInfo The view info being selected. Must not be null.
      * @param gre the rules engine
      * @param nodeFactory the node factory
      */
-    public CanvasSelection(CanvasViewInfo canvasViewInfo,
+    public SelectionItem(CanvasViewInfo canvasViewInfo,
             RulesEngine gre,
             NodeFactory nodeFactory) {
 
@@ -160,11 +160,11 @@ import java.util.List;
      * Gets the XML text from the given selection for a text transfer.
      * The returned string can be empty but not null.
      */
-    /* package */ static String getAsText(LayoutCanvas canvas, List<CanvasSelection> selection) {
+    /* package */ static String getAsText(LayoutCanvas canvas, List<SelectionItem> selection) {
         StringBuilder sb = new StringBuilder();
 
         LayoutEditor layoutEditor = canvas.getLayoutEditor();
-        for (CanvasSelection cs : selection) {
+        for (SelectionItem cs : selection) {
             CanvasViewInfo vi = cs.getViewInfo();
             UiViewElementNode key = vi.getUiViewNode();
             Node node = key.getXmlNode();
@@ -186,10 +186,10 @@ import java.util.List;
      * @param items Items to wrap in elements
      * @return An array of wrapper elements. Never null.
      */
-    /* package */ static SimpleElement[] getAsElements(List<CanvasSelection> items) {
+    /* package */ static SimpleElement[] getAsElements(List<SelectionItem> items) {
         ArrayList<SimpleElement> elements = new ArrayList<SimpleElement>();
 
-        for (CanvasSelection cs : items) {
+        for (SelectionItem cs : items) {
             CanvasViewInfo vi = cs.getViewInfo();
 
             SimpleElement e = vi.toSimpleElement();
index 136414e..5e93adb 100644 (file)
@@ -60,10 +60,10 @@ public class SelectionManager implements ISelectionProvider {
     private LayoutCanvas mCanvas;
 
     /** The current selection list. The list is never null, however it can be empty. */
-    private final LinkedList<CanvasSelection> mSelections = new LinkedList<CanvasSelection>();
+    private final LinkedList<SelectionItem> mSelections = new LinkedList<SelectionItem>();
 
     /** An unmodifiable view of {@link #mSelections}. */
-    private final List<CanvasSelection> mUnmodifiableSelection =
+    private final List<SelectionItem> mUnmodifiableSelection =
         Collections.unmodifiableList(mSelections);
 
     /** Barrier set when updating the selection to prevent from recursively
@@ -98,13 +98,13 @@ public class SelectionManager implements ISelectionProvider {
      }
 
     /**
-     * Returns the native {@link CanvasSelection} list.
+     * Returns the native {@link SelectionItem} list.
      *
-     * @return An immutable list of {@link CanvasSelection}. Can be empty but not null.
+     * @return An immutable list of {@link SelectionItem}. Can be empty but not null.
      * @see #getSelection() {@link #getSelection()} to retrieve a {@link TreeViewer}
      *                      compatible {@link ISelection}.
      */
-    /* package */ List<CanvasSelection> getSelections() {
+    /* package */ List<SelectionItem> getSelections() {
         return mUnmodifiableSelection;
     }
 
@@ -114,8 +114,8 @@ public class SelectionManager implements ISelectionProvider {
      *
      * @return A copy of the current selection. Never null.
      */
-    /* package */ List<CanvasSelection> getSnapshot() {
-        return new ArrayList<CanvasSelection>(mSelections);
+    /* package */ List<SelectionItem> getSnapshot() {
+        return new ArrayList<SelectionItem>(mSelections);
     }
 
     /**
@@ -129,7 +129,7 @@ public class SelectionManager implements ISelectionProvider {
 
         ArrayList<TreePath> paths = new ArrayList<TreePath>();
 
-        for (CanvasSelection cs : mSelections) {
+        for (SelectionItem cs : mSelections) {
             CanvasViewInfo vi = cs.getViewInfo();
             if (vi != null) {
                 ArrayList<Object> segments = new ArrayList<Object>();
@@ -184,7 +184,7 @@ public class SelectionManager implements ISelectionProvider {
 
                 // Create a list of all currently selected view infos
                 Set<CanvasViewInfo> oldSelected = new HashSet<CanvasViewInfo>();
-                for (CanvasSelection cs : mSelections) {
+                for (SelectionItem cs : mSelections) {
                     oldSelected.add(cs.getViewInfo());
                 }
 
@@ -263,7 +263,7 @@ public class SelectionManager implements ISelectionProvider {
             // Otherwise we select the item under the cursor.
 
             if (!isCycleClick && !isMultiClick) {
-                for (CanvasSelection cs : mSelections) {
+                for (SelectionItem cs : mSelections) {
                     if (cs.getRect().contains(p.x, p.y)) {
                         // The cursor is inside the selection. Don't change anything.
                         return;
@@ -395,7 +395,7 @@ public class SelectionManager implements ISelectionProvider {
 
     /** Returns true if the view hierarchy is showing exploded items. */
     private boolean hasExplodedItems() {
-        for (CanvasSelection item : mSelections) {
+        for (SelectionItem item : mSelections) {
             if (item.getViewInfo().isExploded()) {
                 return true;
             }
@@ -528,8 +528,8 @@ public class SelectionManager implements ISelectionProvider {
             return false;
         }
 
-        for (ListIterator<CanvasSelection> it = mSelections.listIterator(); it.hasNext(); ) {
-            CanvasSelection s = it.next();
+        for (ListIterator<SelectionItem> it = mSelections.listIterator(); it.hasNext(); ) {
+            SelectionItem s = it.next();
             if (canvasViewInfo == s.getViewInfo()) {
                 it.remove();
                 return true;
@@ -544,8 +544,8 @@ public class SelectionManager implements ISelectionProvider {
      * Callers are responsible for calling redraw() and updateOulineSelection() after.
      */
     private void deselectAll(List<CanvasViewInfo> canvasViewInfos) {
-        for (ListIterator<CanvasSelection> it = mSelections.listIterator(); it.hasNext(); ) {
-            CanvasSelection s = it.next();
+        for (ListIterator<SelectionItem> it = mSelections.listIterator(); it.hasNext(); ) {
+            SelectionItem s = it.next();
             if (canvasViewInfos.contains(s.getViewInfo())) {
                 it.remove();
             }
@@ -556,8 +556,8 @@ public class SelectionManager implements ISelectionProvider {
     /* package */ void sync(CanvasViewInfo lastValidViewInfoRoot) {
         // Check if the selection is still the same (based on the object keys)
         // and eventually recompute their bounds.
-        for (ListIterator<CanvasSelection> it = mSelections.listIterator(); it.hasNext(); ) {
-            CanvasSelection s = it.next();
+        for (ListIterator<SelectionItem> it = mSelections.listIterator(); it.hasNext(); ) {
+            SelectionItem s = it.next();
 
             // Check if the selected object still exists
             ViewHierarchy viewHierarchy = mCanvas.getViewHierarchy();
@@ -623,13 +623,13 @@ public class SelectionManager implements ISelectionProvider {
      *      given list is going to be altered and we should never alter the user-made selection.
      *      Instead the caller should provide its own copy.
      */
-    /* package */ static void sanitize(List<CanvasSelection> selection) {
+    /* package */ static void sanitize(List<SelectionItem> selection) {
         if (selection.isEmpty()) {
             return;
         }
 
-        for (Iterator<CanvasSelection> it = selection.iterator(); it.hasNext(); ) {
-            CanvasSelection cs = it.next();
+        for (Iterator<SelectionItem> it = selection.iterator(); it.hasNext(); ) {
+            SelectionItem cs = it.next();
             CanvasViewInfo vi = cs.getViewInfo();
             UiViewElementNode key = vi == null ? null : vi.getUiViewNode();
             Node node = key == null ? null : key.getXmlNode();
@@ -640,9 +640,9 @@ public class SelectionManager implements ISelectionProvider {
             }
 
             if (vi != null) {
-                for (Iterator<CanvasSelection> it2 = selection.iterator();
+                for (Iterator<SelectionItem> it2 = selection.iterator();
                      it2.hasNext(); ) {
-                    CanvasSelection cs2 = it2.next();
+                    SelectionItem cs2 = it2.next();
                     if (cs != cs2) {
                         CanvasViewInfo vi2 = cs2.getViewInfo();
                         if (vi.isParent(vi2)) {
@@ -665,8 +665,8 @@ public class SelectionManager implements ISelectionProvider {
         mCanvas.redraw();
     }
 
-    private CanvasSelection createSelection(CanvasViewInfo vi) {
-        return new CanvasSelection(vi, mCanvas.getRulesEngine(),
+    private SelectionItem createSelection(CanvasViewInfo vi) {
+        return new SelectionItem(vi, mCanvas.getRulesEngine(),
                 mCanvas.getNodeFactory());
     }
 }
index 696ca49..94c917c 100644 (file)
@@ -46,11 +46,11 @@ public class SelectionOverlay extends Overlay {
      */
     public void paint(SelectionManager selectionManager, GCWrapper gcWrapper,
             RulesEngine rulesEngine) {
-        List<CanvasSelection> selections = selectionManager.getSelections();
+        List<SelectionItem> selections = selectionManager.getSelections();
         int n = selections.size();
         if (n > 0) {
             boolean isMultipleSelection = n > 1;
-            for (CanvasSelection s : selections) {
+            for (SelectionItem s : selections) {
                 if (s.isRoot()) {
                     // The root selection is never painted
                     continue;
@@ -22,7 +22,7 @@ import static com.android.ide.common.layout.LayoutConstants.ATTR_ID;
 import com.android.ide.common.api.IDragElement;
 import com.android.ide.common.api.INode;
 import com.android.ide.common.api.Rect;
-import com.android.ide.common.layout.BaseLayout.AttributeFilter;
+import com.android.ide.common.layout.BaseLayoutRule.AttributeFilter;
 
 import java.util.Arrays;
 import java.util.HashMap;
@@ -34,7 +34,7 @@ import java.util.Set;
 // TODO: Check equals() but not == strings by using new String("") to prevent interning
 // TODO: Rename BaseLayout to BaseLayoutRule, and tests too of course
 
-public class BaseLayoutTest extends LayoutTestBase {
+public class BaseLayoutRuleTest extends LayoutTestBase {
 
     /** Provides test data used by other test cases */
     private IDragElement[] createSampleElements() {
@@ -51,18 +51,18 @@ public class BaseLayoutTest extends LayoutTestBase {
         return elements;
     }
 
-    /** Test {@link BaseLayout#collectIds}: Check that basic lookup of id works */
+    /** Test {@link BaseLayoutRule#collectIds}: Check that basic lookup of id works */
     public final void testCollectIds1() {
         IDragElement[] elements = TestDragElement.create(TestDragElement.create(
                 "android.widget.Button", new Rect(0, 0, 100, 80)).id("@+id/Button01"));
         Map<String, Pair<String, String>> idMap = new HashMap<String, Pair<String, String>>();
-        Map<String, Pair<String, String>> ids = new BaseLayout().collectIds(idMap, elements);
+        Map<String, Pair<String, String>> ids = new BaseLayoutRule().collectIds(idMap, elements);
         assertEquals(1, ids.size());
         assertEquals("@+id/Button01", ids.keySet().iterator().next());
     }
 
     /**
-     * Test {@link BaseLayout#collectIds}: Check that with the wrong URI we
+     * Test {@link BaseLayoutRule#collectIds}: Check that with the wrong URI we
      * don't pick up the ID
      */
     public final void testCollectIds2() {
@@ -71,42 +71,42 @@ public class BaseLayoutTest extends LayoutTestBase {
                 "@+id/Button01"));
 
         Map<String, Pair<String, String>> idMap = new HashMap<String, Pair<String, String>>();
-        Map<String, Pair<String, String>> ids = new BaseLayout().collectIds(idMap, elements);
+        Map<String, Pair<String, String>> ids = new BaseLayoutRule().collectIds(idMap, elements);
         assertEquals(0, ids.size());
     }
 
     /**
-     * Test {@link BaseLayout#normalizeId(String)}
+     * Test {@link BaseLayoutRule#normalizeId(String)}
      */
     public final void testNormalizeId() {
-        assertEquals("foo", new BaseLayout().normalizeId("foo"));
-        assertEquals("@+id/name", new BaseLayout().normalizeId("@id/name"));
-        assertEquals("@+id/name", new BaseLayout().normalizeId("@+id/name"));
+        assertEquals("foo", new BaseLayoutRule().normalizeId("foo"));
+        assertEquals("@+id/name", new BaseLayoutRule().normalizeId("@id/name"));
+        assertEquals("@+id/name", new BaseLayoutRule().normalizeId("@+id/name"));
     }
 
     /**
-     * Test {@link BaseLayout#collectExistingIds}
+     * Test {@link BaseLayoutRule#collectExistingIds}
      */
     public final void testCollectExistingIds1() {
         Set<String> existing = new HashSet<String>();
         INode node = TestNode.create("android.widget.Button").id("@+id/Button012").add(
                 TestNode.create("android.widget.Button").id("@+id/Button2"));
 
-        new BaseLayout().collectExistingIds(node, existing);
+        new BaseLayoutRule().collectExistingIds(node, existing);
 
         assertEquals(2, existing.size());
         assertContainsSame(Arrays.asList("@+id/Button2", "@+id/Button012"), existing);
     }
 
     /**
-     * Test {@link BaseLayout#collectIds}: Check that with multiple elements and
+     * Test {@link BaseLayoutRule#collectIds}: Check that with multiple elements and
      * some children we still pick up all the right id's
      */
     public final void testCollectIds3() {
         Map<String, Pair<String, String>> idMap = new HashMap<String, Pair<String, String>>();
 
         IDragElement[] elements = createSampleElements();
-        Map<String, Pair<String, String>> ids = new BaseLayout().collectIds(idMap, elements);
+        Map<String, Pair<String, String>> ids = new BaseLayoutRule().collectIds(idMap, elements);
         assertEquals(5, ids.size());
         assertContainsSame(Arrays.asList("@+id/Button01", "@+id/Button02", "@+id/Button011",
                 "@+id/Button012", "@+id/LinearLayout01"), ids.keySet());
@@ -119,11 +119,11 @@ public class BaseLayoutTest extends LayoutTestBase {
     }
 
     /**
-     * Test {@link BaseLayout#remapIds}: Ensure that it identifies a conflict
+     * Test {@link BaseLayoutRule#remapIds}: Ensure that it identifies a conflict
      */
     public final void testRemapIds1() {
         Map<String, Pair<String, String>> idMap = new HashMap<String, Pair<String, String>>();
-        BaseLayout baseLayout = new BaseLayout();
+        BaseLayoutRule baseLayout = new BaseLayoutRule();
         IDragElement[] elements = createSampleElements();
         baseLayout.collectIds(idMap, elements);
         INode node = TestNode.create("android.widget.Button").id("@+id/Button012").add(
@@ -142,10 +142,10 @@ public class BaseLayoutTest extends LayoutTestBase {
 
 
     /**
-     * Test {@link BaseLayout#getDropIdMap}
+     * Test {@link BaseLayoutRule#getDropIdMap}
      */
     public final void testGetDropIdMap() {
-        BaseLayout baseLayout = new BaseLayout();
+        BaseLayoutRule baseLayout = new BaseLayoutRule();
         IDragElement[] elements = createSampleElements();
         INode node = TestNode.create("android.widget.Button").id("@+id/Button012").add(
                 TestNode.create("android.widget.Button").id("@+id/Button2"));
@@ -160,7 +160,7 @@ public class BaseLayoutTest extends LayoutTestBase {
     }
 
     public final void testAddAttributes1() {
-        BaseLayout layout = new BaseLayout();
+        BaseLayoutRule layout = new BaseLayoutRule();
 
         // First try with no filter
         IDragElement oldElement = TestDragElement.create("a.w.B").id("@+id/foo");
@@ -178,7 +178,7 @@ public class BaseLayoutTest extends LayoutTestBase {
 
     public final void testAddAttributes2() {
         // Test filtering
-        BaseLayout layout = new BaseLayout();
+        BaseLayoutRule layout = new BaseLayoutRule();
 
         // First try with no filter
         IDragElement oldElement = TestDragElement.create("a.w.B").id("@+id/foo");
@@ -203,7 +203,7 @@ public class BaseLayoutTest extends LayoutTestBase {
     }
 
     public final void testFindNewId() {
-        BaseLayout baseLayout = new BaseLayout();
+        BaseLayoutRule baseLayout = new BaseLayoutRule();
         Set<String> existing = new HashSet<String>();
         assertEquals("@+id/Widget01", baseLayout.findNewId("a.w.Widget", existing));
 
@@ -218,11 +218,11 @@ public class BaseLayoutTest extends LayoutTestBase {
     }
 
     public final void testDefaultAttributeFilter() {
-        assertEquals("true", BaseLayout.DEFAULT_ATTR_FILTER.replace("myuri", "layout_alignRight",
+        assertEquals("true", BaseLayoutRule.DEFAULT_ATTR_FILTER.replace("myuri", "layout_alignRight",
                 "true"));
-        assertEquals(null, BaseLayout.DEFAULT_ATTR_FILTER.replace(ANDROID_URI,
+        assertEquals(null, BaseLayoutRule.DEFAULT_ATTR_FILTER.replace(ANDROID_URI,
                 "layout_alignRight", "true"));
-        assertEquals("true", BaseLayout.DEFAULT_ATTR_FILTER.replace(ANDROID_URI,
+        assertEquals("true", BaseLayoutRule.DEFAULT_ATTR_FILTER.replace(ANDROID_URI,
                 "myproperty", "true"));
     }
 
@@ -234,7 +234,7 @@ public class BaseLayoutTest extends LayoutTestBase {
                         "value2a").set("uri", "childprop2b", "value2b"));
         INode newNode = TestNode.create("a.w.B").id("@+id/foo");
         Map<String, Pair<String, String>> idMap = new HashMap<String, Pair<String, String>>();
-        BaseLayout layout = new BaseLayout();
+        BaseLayoutRule layout = new BaseLayoutRule();
         layout.addInnerElements(newNode, oldElement, idMap);
         assertEquals(2, newNode.getChildren().length);
 
@@ -21,12 +21,12 @@ import java.util.Collections;
 
 import junit.framework.TestCase;
 
-public class BaseViewTest extends TestCase {
+public class BaseViewRuleTest extends TestCase {
     public final void testPrettyName() {
-        assertEquals(null, BaseView.prettyName(null));
-        assertEquals("", BaseView.prettyName(""));
-        assertEquals("Foo", BaseView.prettyName("foo"));
-        assertEquals("Foo bar", BaseView.prettyName("foo_bar"));
+        assertEquals(null, BaseViewRule.prettyName(null));
+        assertEquals("", BaseViewRule.prettyName(""));
+        assertEquals("Foo", BaseViewRule.prettyName("foo"));
+        assertEquals("Foo bar", BaseViewRule.prettyName("foo_bar"));
         // TODO: We should check this to capitalize each initial word
         // assertEquals("Foo Bar", BaseView.prettyName("foo_bar"));
         // TODO: We should also handle camelcase properties
@@ -34,9 +34,9 @@ public class BaseViewTest extends TestCase {
     }
 
     public final void testJoin() {
-        assertEquals("foo", BaseView.join('|', Arrays.asList("foo")));
-        assertEquals("", BaseView.join('|', Collections.<String>emptyList()));
-        assertEquals("foo,bar", BaseView.join(',', Arrays.asList("foo", "bar")));
-        assertEquals("foo|bar", BaseView.join('|', Arrays.asList("foo", "bar")));
+        assertEquals("foo", BaseViewRule.join('|', Arrays.asList("foo")));
+        assertEquals("", BaseViewRule.join('|', Collections.<String>emptyList()));
+        assertEquals("foo,bar", BaseViewRule.join(',', Arrays.asList("foo", "bar")));
+        assertEquals("foo|bar", BaseViewRule.join('|', Arrays.asList("foo", "bar")));
     }
 }
index a864764..0f2ab21 100644 (file)
@@ -15,6 +15,8 @@
  */
 package com.android.ide.common.layout;
 
+import static junit.framework.Assert.fail;
+
 import com.android.ide.common.api.IAttributeInfo;
 
 /** Test/mock implementation of {@link IAttributeInfo} */
@@ -26,27 +28,27 @@ public class TestAttributeInfo implements IAttributeInfo {
     }
 
     public String getDeprecatedDoc() {
-        BaseLayoutTest.fail("Not supported yet in tests");
+        fail("Not supported yet in tests");
         return null;
     }
 
     public String[] getEnumValues() {
-        BaseLayoutTest.fail("Not supported yet in tests");
+        fail("Not supported yet in tests");
         return null;
     }
 
     public String[] getFlagValues() {
-        BaseLayoutTest.fail("Not supported yet in tests");
+        fail("Not supported yet in tests");
         return null;
     }
 
     public Format[] getFormats() {
-        BaseLayoutTest.fail("Not supported yet in tests");
+        fail("Not supported yet in tests");
         return null;
     }
 
     public String getJavaDoc() {
-        BaseLayoutTest.fail("Not supported yet in tests");
+        fail("Not supported yet in tests");
         return null;
     }
 
index e68d2a5..c6a0578 100644 (file)
@@ -66,24 +66,24 @@ public abstract class PointTestCases extends TestCase {
         }
 
         @Override
-        ScaleInfo getHorizontalTransform() {
+        CanvasTransform getHorizontalTransform() {
             ScrollBar scrollBar = new List(this, SWT.V_SCROLL|SWT.H_SCROLL).getHorizontalBar();
-            return new TestScaleInfo(scrollBar, mScaleX, mTranslateX);
+            return new TestCanvasTransform(scrollBar, mScaleX, mTranslateX);
         }
 
         @Override
-        ScaleInfo getVerticalTransform() {
+        CanvasTransform getVerticalTransform() {
             ScrollBar scrollBar = new List(this, SWT.V_SCROLL|SWT.H_SCROLL).getVerticalBar();
-            return new TestScaleInfo(scrollBar, mScaleY, mTranslateY);
+            return new TestCanvasTransform(scrollBar, mScaleY, mTranslateY);
         }
     }
 
-    static class TestScaleInfo extends ScaleInfo {
+    static class TestCanvasTransform extends CanvasTransform {
         float mScale;
 
         float mTranslate;
 
-        public TestScaleInfo(ScrollBar scrollBar, float scale, float translate) {
+        public TestCanvasTransform(ScrollBar scrollBar, float scale, float translate) {
             super(null, scrollBar);
             this.mScale = scale;
             this.mTranslate = translate;