DESIGNER: CSS Selector, Data-bind info feature 31/20131/1
authorjooyoul_lee <jy.exe.lee@samsung.com>
Mon, 28 Apr 2014 09:52:04 +0000 (18:52 +0900)
committerjooyoul_lee <jy.exe.lee@samsung.com>
Mon, 28 Apr 2014 09:52:04 +0000 (18:52 +0900)
1. CSS Selector : Change double click action to Context Menu.
2. Data-bind info
2-1. Add show binding button to data-binding view
2-2. figure update action added (only figure redraw) - show/hide binding icon
2-3. data-binding tooltip figure added
2-4. data-binding parsing class and model class added
2-5. test icons added.
2-6. EditPart, PartFigure and PageDesigner has data-binded info (boolean)
2-7. PageDesignerUtil class added (for getPageDesigner method)

Change-Id: I8eeb0145128b24a662ca1973b171039cf01d791b
Signed-off-by: jooyoul_lee <jy.exe.lee@samsung.com>
24 files changed:
org.tizen.webuibuilder/res/icons/binded.gif [new file with mode: 0644]
org.tizen.webuibuilder/res/icons/hide_bind.gif [new file with mode: 0644]
org.tizen.webuibuilder/res/icons/show_bind.gif [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ShowDataBindingCommand.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/editparts/HoverViewerEditPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/editparts/HoverViewerRootEditPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/DataBindingTooltipInnerFigure.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/PartFigure.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/TooltipFigure.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/WidgetFigure.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/viewer/DesignerEventDelegator.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/viewer/HoverBrowserViewer.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/pagetemplate/action/CssSelecotrAction.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/actions/WebUIBuilderActionConstants.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/contextmenu/ContextMenu.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/contextmenu/Messages.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/contextmenu/Messages.properties
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesigner.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerUtil.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingPage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingTooltipParser.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingView.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/actions/ShowBindingInfoAction.java [new file with mode: 0644]
org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/model/DataBindingTooltipData.java [new file with mode: 0644]

diff --git a/org.tizen.webuibuilder/res/icons/binded.gif b/org.tizen.webuibuilder/res/icons/binded.gif
new file mode 100644 (file)
index 0000000..5fd9c94
Binary files /dev/null and b/org.tizen.webuibuilder/res/icons/binded.gif differ
diff --git a/org.tizen.webuibuilder/res/icons/hide_bind.gif b/org.tizen.webuibuilder/res/icons/hide_bind.gif
new file mode 100644 (file)
index 0000000..c610608
Binary files /dev/null and b/org.tizen.webuibuilder/res/icons/hide_bind.gif differ
diff --git a/org.tizen.webuibuilder/res/icons/show_bind.gif b/org.tizen.webuibuilder/res/icons/show_bind.gif
new file mode 100644 (file)
index 0000000..d8d7fad
Binary files /dev/null and b/org.tizen.webuibuilder/res/icons/show_bind.gif differ
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ShowDataBindingCommand.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/commands/ShowDataBindingCommand.java
new file mode 100644 (file)
index 0000000..29657c4
--- /dev/null
@@ -0,0 +1,59 @@
+
+
+package org.tizen.webuibuilder.gef.commands;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.webuibuilder.ui.editor.PageDesigner;
+import org.tizen.webuibuilder.ui.editor.PageDesignerForHTML;
+
+
+public class ShowDataBindingCommand extends Command {
+    private boolean show;
+
+    public ShowDataBindingCommand(String propertyName, String propertyValue, boolean show) {
+        this.show = show;
+    }
+
+    @Override
+    public void execute() {
+        PageDesigner pageDesigner = getActivePageDesigner();
+        pageDesigner.showBindingInfo(show);
+    }
+    
+    private PageDesigner getActivePageDesigner() {
+        if (getWorkbenchWindow() == null) {
+            return null;
+        }
+
+        IWorkbenchPage activePage = getWorkbenchWindow().getActivePage();
+        if (activePage == null) {
+            IWorkbenchPage[] pages = getWorkbenchWindow().getPages();
+            if (pages.length > 0) {
+                IEditorPart[] editors = pages[0].getEditors();
+                for (int i = 0; i < editors.length; i++) {
+                    if (editors[i] instanceof PageDesigner) {
+                        return (PageDesigner) editors[i];
+                    }
+                }
+            }
+        } else {
+            IEditorPart activeEditor = activePage.getActiveEditor();
+            if (activeEditor instanceof PageDesigner || activeEditor instanceof PageDesignerForHTML) {
+                return (PageDesigner) activeEditor;
+            }
+        }
+        return null;
+    }
+    
+    private IWorkbenchWindow getWorkbenchWindow() {
+        IWorkbench workbench = PlatformUI.getWorkbench();
+        IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+
+        return workbenchWindow;
+    }
+}
index 72bd134..03cc71f 100644 (file)
@@ -54,6 +54,8 @@ import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.model.PartEvent;
 import org.tizen.webuibuilder.model.css.CssEvent;
 import org.tizen.webuibuilder.model.css.ICssListener;
+import org.tizen.webuibuilder.ui.editor.PageDesigner;
+import org.tizen.webuibuilder.ui.editor.PageDesignerUtil;
 import org.tizen.webuibuilder.ui.editor.ruler.DesignerGuide;
 
 
@@ -113,8 +115,8 @@ public class HoverViewerEditPart extends AbstractGraphicalEditPart implements IP
 
     @Override
     protected IFigure createFigure() {
-       Part part = (Part)getModel();
-       
+        Part part = (Part) getModel();
+
         IFigure figure = null;
         if (part.isPagePart()) {
             figure = new PageFigure(((HoverBrowserViewer) getViewer()).getBrowser().getBrowser());
@@ -165,6 +167,24 @@ public class HoverViewerEditPart extends AbstractGraphicalEditPart implements IP
             figure.setLayout(new Rectangle(0, 0, 0, 0));
         }
         figure.setBorder(model.canBeVisibleBorder());
+
+        // check data binding info
+        String dataBinding = model.getPropertyValue("data-bind");
+
+        boolean binded;
+        PageDesigner pageDesigner = PageDesignerUtil.getActivePageDesigner();
+        if (null != pageDesigner) {
+            binded = pageDesigner.isShowBindingInfo();
+        } else {
+            binded = false;
+        }
+
+        if (null != dataBinding && !dataBinding.isEmpty() && binded) {
+            figure.setBinded(true);
+        } else {
+            figure.setBinded(false);
+        }
+
     }
 
     @Override
@@ -198,8 +218,8 @@ public class HoverViewerEditPart extends AbstractGraphicalEditPart implements IP
     public void propertyChanged(PartEvent e) {
         ((HoverBrowserViewer) getViewer()).updateModel();
         ((HoverBrowserViewer) getViewer()).updateAllPositionsForce();
-        
-        ((AnimatorWidgetPart)e.getPart()).widgetPropertyEdit();
+
+        ((AnimatorWidgetPart) e.getPart()).widgetPropertyEdit();
 
     }
 
index d0c7201..dc4c7be 100644 (file)
@@ -53,11 +53,11 @@ public class HoverViewerRootEditPart extends ScalableFreeformRootEditPart {
         super();
     }
 
-//    private static class FeedbackLayer extends FreeformLayer {
-//        FeedbackLayer() {
-//            setEnabled(false);
-//        }
-//    }
+    // private static class FeedbackLayer extends FreeformLayer {
+    // FeedbackLayer() {
+    // setEnabled(false);
+    // }
+    // }
 
     private class VirtualLayer extends Layer {
 
@@ -117,6 +117,10 @@ public class HoverViewerRootEditPart extends ScalableFreeformRootEditPart {
         getFigure().invalidate();
     }
 
+    public void updateBindingInfo(boolean isBinded) {
+        getFigure().invalidate();
+    }
+
     public void updateScrollBar() {
         Layer virtualLayer = (Layer) getLayer(VIRTUAL_SCREEN_LAYER);
         virtualLayer.invalidate();
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/DataBindingTooltipInnerFigure.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/DataBindingTooltipInnerFigure.java
new file mode 100644 (file)
index 0000000..13f3f20
--- /dev/null
@@ -0,0 +1,111 @@
+
+
+package org.tizen.webuibuilder.gef.figure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.CompoundBorder;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
+
+
+public class DataBindingTooltipInnerFigure extends Figure {
+    private Label dataLabel = null;
+    private List<Label> contentLabels = new ArrayList<Label>();
+
+    public DataBindingTooltipInnerFigure() {
+        setOpaque(true);
+        setLayoutManager(new ToolbarLayout());
+        setBorder(new CompoundBorder(new LineBorder(ColorConstants.black, 2), new MarginBorder(10,
+                                                                                               5,
+                                                                                               10,
+                                                                                               20)));
+        dataLabel = new Label("data");
+        dataLabel.setForegroundColor(ColorResource.BLACK);
+        dataLabel.setOpaque(true);
+        // titleLabel.setBorder(new CompoundBorder(new LineBorder(ColorConstants.green, 0),
+        // new MarginBorder(0, 5, 0, 5)));
+        // titleLabel.setBorder(new MarginBorder(5, 5, 5, 0));
+        FontData fontData = new FontData("Arial", 12, SWT.BOLD);
+        Font font = new Font(Display.getDefault(), fontData);
+        dataLabel.setFont(font);
+
+        add(dataLabel);
+    }
+
+    public void setTitle(String title) {
+        dataLabel.setText(title);
+    }
+
+    public void addContents(String content) {
+        Label child = new Label(content);
+        child.setBorder(new MarginBorder(5, 5, 5, 0));
+        child.setForegroundColor(ColorResource.BLACK);
+        FontData fontData = new FontData("Arial", 10, SWT.NORMAL);
+        Font font = new Font(Display.getDefault(), fontData);
+        child.setFont(font);
+        // child.setBorder(new LineBorder(ColorConstants.red, 1));
+        add(child);
+        contentLabels.add(child);
+        revalidate();
+    }
+
+    @Override
+    public void paint(Graphics g) {
+        g.pushState();
+        g.setBackgroundColor(ColorResource.WHITE);
+        Rectangle r = getBounds();
+        g.fillRectangle(r);
+
+        Rectangle r2 = dataLabel.getBounds();
+        Rectangle r3 = getContentRects();
+
+        g.setForegroundColor(ColorResource.BLACK);
+        g.drawRectangle(r2.x + 1, r2.y + r2.height / 2, r2.width + 10, r2.height / 2 + r3.height);
+        g.setAntialias(1);
+        int x = r2.x - 1;
+        int y = r2.y - 1;
+        int w = r2.width + 2 + 15;
+        int h = r2.height + 2;
+        int[] poly = { x, y, x + w, y, x + w - 15, y + h, x, y + h, x, y };
+        g.setBackgroundColor(ColorResource.GOLDENROD);
+        g.fillPolygon(poly);
+        g.drawPolygon(poly);
+
+        dataLabel.paint(g);
+        for (Label l : contentLabels) {
+            l.setTextAlignment(PositionConstants.LEFT);
+            l.paint(g);
+        }
+        g.popState();
+    }
+
+    private Rectangle getContentRects() {
+        Rectangle result = null;
+        for (Label l : contentLabels) {
+            if (result == null) {
+                result = l.getBounds();
+            } else {
+                Rectangle r = l.getBounds();
+                result.height += r.height;
+            }
+        }
+        if (null == result) {
+            result = new Rectangle(0, 0, 0, 0);
+        }
+        return result;
+    }
+}
index 011a72f..9df4f37 100644 (file)
@@ -44,6 +44,8 @@ public class PartFigure extends Figure {
     private boolean borderVisible = false;
 
     private PointList polygonPoints;
+    private TooltipFigure tooltipFigure = null;
+    private boolean bBinded = false;
 
     protected boolean containtsInChidren(IFigure f, int x, int y) {
         List<IFigure> children = f.getChildren();
@@ -84,12 +86,38 @@ public class PartFigure extends Figure {
         return rc;
     }
 
+    // 2014 04 21 - tooltip added by casval
     public PartFigure() {
         layout = new XYLayout();
         setLayoutManager(layout);
 
         setForegroundColor(ColorConstants.blue);
         setBorder(new LineBorder(2));
+
+        tooltipFigure = new TooltipFigure();
+        setToolTip(null);
+
+    }
+
+    // 2014/04/21 binded added by casval
+    public void setBinded(boolean binded) {
+        this.bBinded = binded;
+    }
+
+    public boolean isBinded() {
+        return bBinded;
+    }
+
+    public void setDataBindTooltipText(String tooltip) {
+        tooltipFigure.setMessage(tooltip);
+    }
+
+    public void setTooltipEnabled(boolean enabled) {
+        if (enabled) {
+            setToolTip(tooltipFigure);
+        } else {
+            setToolTip(null);
+        }
     }
 
     public void setLayout(Rectangle rect) {
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/TooltipFigure.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/gef/figure/TooltipFigure.java
new file mode 100644 (file)
index 0000000..090c86a
--- /dev/null
@@ -0,0 +1,90 @@
+
+
+package org.tizen.webuibuilder.gef.figure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
+import org.tizen.webuibuilder.ui.views.databinding.DataBindingTooltipParser;
+import org.tizen.webuibuilder.ui.views.databinding.model.DataBindingTooltipData;
+
+
+public class TooltipFigure extends Figure {
+
+    private Label titleLabel = null;
+    private List<DataBindingTooltipInnerFigure> children =
+            new ArrayList<DataBindingTooltipInnerFigure>();
+
+    public TooltipFigure() {
+        setOpaque(true);
+        setLayoutManager(new ToolbarLayout());
+    }
+
+    private void createTitle() {
+        titleLabel = new Label("title");
+        titleLabel.setForegroundColor(ColorResource.BLACK);
+        titleLabel.setOpaque(true);
+        titleLabel.setBorder(new MarginBorder(0, 15, 7, 10));
+        FontData titleFontData = new FontData("Arial", 13, SWT.BOLD|SWT.ITALIC);
+        Font titleFont = new Font(Display.getDefault(), titleFontData);
+        titleLabel.setFont(titleFont);
+        titleLabel.setTextAlignment(PositionConstants.CENTER);
+         titleLabel.setBackgroundColor(ColorResource.FLIP);
+        titleLabel.setText("Data-Binding Information");
+        add(titleLabel);
+    }
+
+    public void setMessage(String txt) {
+        removeAll();
+
+        createTitle();
+        
+//        txt =
+//                "text: model0.title, attr: { href: model0.url, title: model0.detail },";
+        List<DataBindingTooltipData> dataList = DataBindingTooltipParser.parse(txt);
+        DataBindingTooltipInnerFigure child = null;
+
+        for (DataBindingTooltipData data : dataList) {
+            child = new DataBindingTooltipInnerFigure();
+            child.setTitle(data.getTitle());
+
+            List<String> subTitles = data.getSubTitle();
+            List<String> contents = data.getContent();
+            StringBuffer output = new StringBuffer();
+
+            if (subTitles.size() > 0) {
+                for (int i = 0; i < subTitles.size(); i++) {
+                    String st = subTitles.get(i);
+                    String ct = contents.get(i);
+                    output.append("[").append(st).append("] ").append(ct);
+                    if (i + 1 < subTitles.size()) {
+                        output.append("\n");
+                    }
+                }
+            } else {
+                output.append(contents.get(0));
+            }
+            child.addContents(output.toString());
+            children.add(child);
+            add(child);
+        }
+
+        // revalidate();
+    }
+
+    // @Override
+    // public void paint(Graphics g) {
+    // titleLabel.paint(g);
+    // super.paint(g);
+    // }
+}
index 8900d34..bc66409 100644 (file)
@@ -28,6 +28,10 @@ import org.eclipse.draw2d.Graphics;
 import org.eclipse.draw2d.MouseEvent;
 import org.eclipse.draw2d.MouseMotionListener;
 import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.swt.graphics.Image;
+import org.tizen.webuibuilder.BuilderConstants;
+import org.tizen.webuibuilder.animator.ui.views.timeline.common.ColorResource;
+import org.tizen.webuibuilder.utility.ResourceManager;
 
 
 public class WidgetFigure extends PartFigure implements MouseMotionListener {
@@ -42,7 +46,6 @@ public class WidgetFigure extends PartFigure implements MouseMotionListener {
 
     @Override
     public boolean containsPoint(int x, int y) {
-
         if (containtsInChidren(this, x, y)) {
             return true;
         } else {
@@ -88,6 +91,21 @@ public class WidgetFigure extends PartFigure implements MouseMotionListener {
                 graphics.fillRectangle(getBounds());
             }
         }
+
+        //data binding icon check
+        if (isBinded()) {
+            Image img = ResourceManager.getImage(BuilderConstants.ICON_DIR, "binded.gif");
+            if (null == img) {
+                Rectangle r = new Rectangle(getBounds().x + 5, getBounds().y + 5, 10, 15);
+                graphics.setAlpha(90);
+                graphics.setForegroundColor(ColorConstants.blue);
+                graphics.setBackgroundColor(ColorResource.RED);
+                graphics.fillRectangle(r);
+                graphics.drawText("B", getBounds().x + 5, getBounds().y + 5);
+            } else {
+                graphics.drawImage(img, getBounds().x + 5, getBounds().y + 5);
+            }
+        }
         graphics.popState();
     }
 
index fad7664..9400859 100644 (file)
@@ -27,21 +27,12 @@ import java.util.List;
 
 import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.CommandStack;
 import org.eclipse.gef.requests.LocationRequest;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.tizen.webuibuilder.gef.commands.CreateCssSelectorCommand;
 import org.tizen.webuibuilder.gef.editparts.DesignerEditPart;
-import org.tizen.webuibuilder.model.Part;
 import org.tizen.webuibuilder.ui.quickstyle.QuickStyleConstants;
-import org.tizen.webuibuilder.ui.selector.CSSSelectorDialog;
-import org.tizen.webuibuilder.ui.selector.CSSSelectorUtil;
 
 
 public class DesignerEventDelegator extends HoverBrowserEventDelegator {
@@ -55,42 +46,29 @@ public class DesignerEventDelegator extends HoverBrowserEventDelegator {
 
     @Override
     public void mouseDoubleClick(MouseEvent e) {
-        @SuppressWarnings("unchecked")
-        List<DesignerEditPart> selectionParts = designEditPartViewer.getSelectedEditParts();
-        if (selectionParts == null || selectionParts.isEmpty()) {
-            return;
-        } // else : keep going
-        DesignerEditPart selectionDesignerPart = selectionParts.get(0);
-        Control control = designEditPartViewer.getControl();
-
-        Rectangle rect = selectionDesignerPart.getFigure().getBounds();
-
-        Part part = (Part) selectionDesignerPart.getModel();
-        String id = part.getIdPropertyValue();
-
-        org.eclipse.swt.graphics.Point p = control.toDisplay(rect.x, rect.y);
-
-        int x = p.x + rect.width, y = p.y;
-
-        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-
-        CSSSelectorDialog selector = new CSSSelectorDialog(shell, id);
-        selector.setGoingBridge(designEditPartViewer.getGoingBridge());
-
-        selector.setPosition(x, y);
-        String obj = (String) selector.open();
-        if (obj == null || obj.isEmpty()) {
-            return;
-        }
-        String defaultSelectorName = part.getDefaultSelectorName();
-        String result = defaultSelectorName + CSSSelectorUtil.parseText(obj);
-
-        CommandStack commandStack = designEditPartViewer.getEditDomain().getCommandStack();
-        Command command =
-                new CreateCssSelectorCommand(
-                                             designEditPartViewer.getPageData().getCurrentCssFile(),
-                                             part, result);
-        commandStack.execute(command);
+//        @SuppressWarnings("unchecked")
+//        List<DesignerEditPart> selectionParts = designEditPartViewer.getSelectedEditParts();
+//        if (selectionParts == null || selectionParts.isEmpty()) {
+//            return;
+//        } // else : keep going
+//        DesignerEditPart selectionDesignerPart = selectionParts.get(0);
+//        Part model = (Part) selectionDesignerPart.getModel();
+//        String partId = selectionDesignerPart.getId();
+//
+//        DescriptorManager descriptorManager =
+//                (DescriptorManager) selectionDesignerPart.getViewer()
+//                        .getProperty("DescriptorManager");
+//        // TODO : apply to all widgets
+//        if (model.getDescriptorId().equals("html.htmlblock")) {
+//            WidgetPosition pos = designEditPartViewer.getBrowser().getWidgetPosition(partId);
+//            if (pos == null) {
+//                return;
+//            } // else : keep going
+//            if (pos.contains(e.x, e.y)) {
+//                // TODO : do default action from part descriptor
+//                HTMLBlockPropertyModifier.getInstance(model).openEditor(model);
+//            } // else : do nothing
+//        }
     }
 
     @Override
index f94bd1d..54e8dc2 100644 (file)
@@ -65,6 +65,8 @@ import org.tizen.webuibuilder.browserwidget.ImageBufferedBrowserWidget.ContentsA
 import org.tizen.webuibuilder.browserwidget.ProgressListener;
 import org.tizen.webuibuilder.gef.editparts.HoverViewerEditPart;
 import org.tizen.webuibuilder.gef.editparts.HoverViewerRootEditPart;
+import org.tizen.webuibuilder.gef.figure.PartFigure;
+import org.tizen.webuibuilder.gef.figure.WidgetFigure;
 import org.tizen.webuibuilder.model.AbsolutePositionProvider;
 import org.tizen.webuibuilder.model.IPartListener;
 import org.tizen.webuibuilder.model.Part;
@@ -104,6 +106,8 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
     // private IProject project;
     protected AppManager appManager;
 
+    protected boolean binded = false;
+
     protected boolean isValidTempHtml = false;
     protected String tempHtml = null;
     protected String rootPathUri = null;
@@ -587,6 +591,36 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
         }
     }
 
+    public boolean isShowBindingInfo() {
+       return binded;
+    }
+
+    public void showBindingInfo(boolean isBinded) {
+        binded = isBinded;
+        showBindingInfo(binded, getCurrentPage());
+    }
+
+    private void showBindingInfo(boolean isBinded, HoverViewerEditPart viewer) {
+
+        Part part = (Part) viewer.getModel();
+        PartFigure figure = (PartFigure) viewer.getFigure();
+
+        String dataBind = part.getPropertyValue("data-bind");
+        if (null != dataBind && !dataBind.isEmpty() && isBinded) {
+            figure.setBinded(true);
+            figure.setTooltipEnabled(true);
+            figure.setDataBindTooltipText(dataBind);
+        } else {
+            figure.setBinded(false);
+            figure.setTooltipEnabled(false);
+        }
+        figure.repaint();
+        List<HoverViewerEditPart> children = viewer.getChildren();
+        for (HoverViewerEditPart child : children) {
+            showBindingInfo(isBinded, child);
+        }
+    }
+
     public void zoomBrowser(float scale) {
         if (rootEditPart != null) {
             updateScrollBar();
@@ -689,11 +723,11 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
             if (part.getPartId() != null && !part.getPartId().isEmpty()) {
                 WidgetPosition pos = widgetPositions.get(part.getPartId());
                 if (pos != null) {
-//                    if (isFireEvent) {
-                        part.setVisualPosition(pos);
-//                    } else {
-//                        part.setVisualPosition(pos);
-//                    }
+                    // if (isFireEvent) {
+                    part.setVisualPosition(pos);
+                    // } else {
+                    // part.setVisualPosition(pos);
+                    // }
                 }
             }
 
@@ -788,8 +822,8 @@ public class HoverBrowserViewer extends ScrollingGraphicalViewer
                 currentPageEditPart = pageEditPart;
 
                 HideAllPages();
-                if(currentPageEditPart != null) {
-                       ((HoverViewerEditPart) currentPageEditPart).getFigure().setVisible(true);
+                if (currentPageEditPart != null) {
+                    ((HoverViewerEditPart) currentPageEditPart).getFigure().setVisible(true);
                 }
                 // DeactivateAllPages();
                 // currentPageEditPart.activate();
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/pagetemplate/action/CssSelecotrAction.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/pagetemplate/action/CssSelecotrAction.java
new file mode 100644 (file)
index 0000000..982ad56
--- /dev/null
@@ -0,0 +1,103 @@
+
+
+package org.tizen.webuibuilder.pagetemplate.action;
+
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CommandStack;
+import org.eclipse.gef.ui.actions.SelectionAction;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.tizen.webuibuilder.gef.commands.CreateCssSelectorCommand;
+import org.tizen.webuibuilder.gef.editparts.DesignerEditPart;
+import org.tizen.webuibuilder.gef.viewer.DesignerBrowserViewer;
+import org.tizen.webuibuilder.model.Part;
+import org.tizen.webuibuilder.ui.actions.WebUIBuilderActionConstants;
+import org.tizen.webuibuilder.ui.contextmenu.Messages;
+import org.tizen.webuibuilder.ui.editor.PageDesigner;
+import org.tizen.webuibuilder.ui.selector.CSSSelectorDialog;
+import org.tizen.webuibuilder.ui.selector.CSSSelectorUtil;
+
+
+public class CssSelecotrAction extends SelectionAction {
+
+    public CssSelecotrAction(IWorkbenchPart part) {
+        super(part);
+        setId(WebUIBuilderActionConstants.CSS_SELECTOR);
+        setText(Messages.CSS_SELECTOR); // css selector message
+        setEnabled(false);
+    }
+
+    @Override
+    protected boolean calculateEnabled() {
+        boolean enabled = true;
+        List<?> selectedObjects = getSelectedObjects();
+        if (selectedObjects == null || selectedObjects.isEmpty()) {
+            enabled = false;
+        } else if (selectedObjects.size() != 1) {
+            enabled = false;
+        } else {
+            for (Object object : selectedObjects) {
+                if (!(object instanceof EditPart)) {
+                    enabled = false;
+                    break;
+                }
+                EditPart editpart = (EditPart) object;
+                Object model = editpart.getModel();
+
+                if (!(model instanceof Part) || ((Part)model).isDocumentPart()) {
+                    enabled =  false;
+                    break;
+                }
+            }
+        }
+        return enabled;
+    }
+
+    @Override
+    public void run() {
+        IWorkbenchPart workbenchPart = getWorkbenchPart();
+        if (workbenchPart instanceof PageDesigner) {
+            DesignerBrowserViewer designEditPartViewer = ((PageDesigner) workbenchPart).getViewer();
+            List<DesignerEditPart> selectionParts = designEditPartViewer.getSelectedEditParts();
+            if (selectionParts == null || selectionParts.isEmpty()) {
+                return;
+            } // else : keep going
+            DesignerEditPart selectionDesignerPart = selectionParts.get(0);
+            Control control = designEditPartViewer.getControl();
+
+            Rectangle rect = selectionDesignerPart.getFigure().getBounds();
+
+            Part part = (Part) selectionDesignerPart.getModel();
+            String id = part.getIdPropertyValue();
+
+            org.eclipse.swt.graphics.Point p = control.toDisplay(rect.x, rect.y);
+
+            int x = p.x + rect.width, y = p.y;
+
+            Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+            CSSSelectorDialog selector = new CSSSelectorDialog(shell, id);
+            selector.setGoingBridge(designEditPartViewer.getGoingBridge());
+
+            selector.setPosition(x, y);
+            String obj = (String) selector.open();
+            if (obj == null || obj.isEmpty()) {
+                return;
+            }
+            String defaultSelectorName = part.getDefaultSelectorName();
+            String result = defaultSelectorName + CSSSelectorUtil.parseText(obj);
+
+            CommandStack commandStack = designEditPartViewer.getEditDomain().getCommandStack();
+            Command command =
+                    new CreateCssSelectorCommand(designEditPartViewer.getPageData()
+                            .getCurrentCssFile(), part, result);
+            commandStack.execute(command);
+        }
+    }
+}
index 87548a3..e92bd11 100644 (file)
@@ -64,6 +64,11 @@ public final class WebUIBuilderActionConstants implements IWorkbenchActionConsta
     public static final String CREATE_TEMPLATE = "org.tizen.webuibuilder.createTemplate";//$NON-NLS-1$
 
     /**
+     * CSS Selelctor action id. Value: <code>"org.tizen.webuibuilder.cssSelector"</code>
+     */
+    public static final String CSS_SELECTOR = "org.tizen.webuibuilder.cssSelector";//$NON-NLS-1$
+    
+    /**
      * Import Template action id. Value: <code>"org.tizen.webuibuilder.importTemplate"</code>
      */
     public static final String IMPORT_TEMPLATE = "org.tizen.webuibuilder.importTemplate";//$NON-NLS-1$
index c593516..0d420cc 100644 (file)
@@ -95,6 +95,9 @@ public class ContextMenu extends ContextMenuProvider {
         action = getAction(WebUIBuilderActionConstants.CREATE_TEMPLATE);
         menu.appendToGroup(GEFActionConstants.GROUP_REST, action);
 
+        action = getAction(WebUIBuilderActionConstants.CSS_SELECTOR);
+        menu.appendToGroup(GEFActionConstants.GROUP_REST, action);
+
         // action =
         // getActionRegistry().getAction(GEFActionConstants.TOGGLE_RULER_VISIBILITY);
         // menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action);
index dd575fd..25b5e90 100644 (file)
@@ -39,6 +39,7 @@ public class Messages {
     public static String CREATE_TEMPLATE;
     public static String IMPORT_TEMPLATE;
     public static String EXPORT_TEMPLATE;
+    public static String CSS_SELECTOR;
 
     static {
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
index 16491ef..128ba3e 100644 (file)
@@ -9,3 +9,4 @@ NEW_PAGE = New Page
 CREATE_TEMPLATE = Create Template
 IMPORT_TEMPLATE = Import Template
 EXPORT_TEMPLATE = Export Template
+CSS_SELECTOR = Edit CSS Style
\ No newline at end of file
index f335c42..51c052d 100644 (file)
@@ -157,6 +157,7 @@ import org.tizen.webuibuilder.outline.OutlinePage;
 import org.tizen.webuibuilder.outline.OutlineRenameAction;
 import org.tizen.webuibuilder.outline.OutlineViewEditPart;
 import org.tizen.webuibuilder.pagetemplate.action.CreateTemplateAction;
+import org.tizen.webuibuilder.pagetemplate.action.CssSelecotrAction;
 import org.tizen.webuibuilder.pagetemplate.action.ExportTemplateAction;
 import org.tizen.webuibuilder.pagetemplate.action.ImportTemplateAction;
 import org.tizen.webuibuilder.pagetemplate.action.NewPageAction;
@@ -183,7 +184,7 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
     protected Part rootPart;
 
     protected DesignerBrowserViewer designer;
-    private BrowserViewerComposite browserComposite;
+    // private BrowserViewerComposite browserComposite;
     private RulerComposite rulerComp;
     // private Composite browserComposite;
     // private DesignerEditPartFactory factory;
@@ -477,6 +478,10 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
 
+        action = new CssSelecotrAction(this);
+        actionRegistry.registerAction(action);
+        getSelectionActions().add(action.getId());
+
         action = new ExportTemplateAction(this);
         actionRegistry.registerAction(action);
         getSelectionActions().add(action.getId());
@@ -1012,6 +1017,10 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
             return timelinePage;
         }
 
+        if (type == PageDesignerToolbar.class) {
+            return toolbar;
+        }
+
         return super.getAdapter(type);
     }
 
@@ -1053,6 +1062,14 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
 
     }
 
+    public void showBindingInfo(boolean isBinded) {
+        designer.showBindingInfo(isBinded);
+    }
+
+    public boolean isShowBindingInfo() {
+        return designer.isShowBindingInfo();
+    }
+
     public void setViewLocation(int x, int y) {
         designer.setViewLocation(x, y);
         if (animator != null) {
@@ -1282,9 +1299,9 @@ public class PageDesigner extends GraphicalEditor implements CommandStackListene
     @Override
     public void propertyChange(PropertyChangeEvent arg0) {
         if (arg0.getPropertyName().equals(RulerProvider.PROPERTY_RULER_VISIBILITY)) {
-            if (browserComposite != null) {
-                browserComposite.layout();
-            }
+            // if (browserComposite != null) {
+            // browserComposite.layout();
+            // }
         }
     }
 
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerUtil.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/editor/PageDesignerUtil.java
new file mode 100644 (file)
index 0000000..8c05f1e
--- /dev/null
@@ -0,0 +1,41 @@
+package org.tizen.webuibuilder.ui.editor;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+public class PageDesignerUtil {
+    public static PageDesigner getActivePageDesigner() {
+        if (getWorkbenchWindow() == null) {
+            return null;
+        }
+        IWorkbenchPage activePage = getWorkbenchWindow().getActivePage();
+        if (activePage == null) {
+            IWorkbenchPage[] pages = getWorkbenchWindow().getPages();
+            if (pages.length > 0) {
+                @SuppressWarnings("deprecation")
+                IEditorPart[] editors = pages[0].getEditors();
+                for (int i = 0; i < editors.length; i++) {
+                    if (editors[i] instanceof PageDesigner) {
+                        return (PageDesigner) editors[i];
+                    }
+                }
+            }
+        } else {
+            IEditorPart activeEditor = activePage.getActiveEditor();
+            if (activeEditor instanceof PageDesigner || activeEditor instanceof PageDesignerForHTML) {
+                return (PageDesigner) activeEditor;
+            }
+        }
+        return null;
+    }
+
+    public static IWorkbenchWindow getWorkbenchWindow() {
+        IWorkbench workbench = PlatformUI.getWorkbench();
+        IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+
+        return workbenchWindow;
+    }
+}
index 152a9a0..ee5d67e 100644 (file)
@@ -33,9 +33,12 @@ import org.eclipse.gef.commands.Command;
 import org.eclipse.gef.commands.CommandStack;
 import org.eclipse.gef.ui.actions.ActionRegistry;
 import org.eclipse.gef.ui.actions.UpdateAction;
+import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
 import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TableViewer;
@@ -51,6 +54,7 @@ import org.eclipse.swt.events.MouseAdapter;
 import org.eclipse.swt.events.MouseEvent;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FillLayout;
@@ -92,17 +96,17 @@ import org.tizen.webuibuilder.ui.views.databinding.actions.RenameViewModelAction
 import org.tizen.webuibuilder.ui.views.databinding.actions.SetTargetAction;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingData;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingDataSetEvent;
+import org.tizen.webuibuilder.ui.views.databinding.model.BindingDataSetEvent.BindingDataSetEventType;
 import org.tizen.webuibuilder.ui.views.databinding.model.BindingObject;
 import org.tizen.webuibuilder.ui.views.databinding.model.IBindingDataSetListener;
 import org.tizen.webuibuilder.ui.views.databinding.model.TreeItemData;
-import org.tizen.webuibuilder.ui.views.databinding.model.BindingDataSetEvent.BindingDataSetEventType;
 import org.tizen.webuibuilder.utility.ResourceManager;
 
 
 public class DataBindingPage extends Page implements IBindingDataSetListener {
 
     private IProject project;
-    //TODO appManager
+    // TODO appManager
     private ProjectManager projectManager;
     private Composite composite;
     private Tree viewModelTree;
@@ -118,7 +122,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     private MenuManager dataSourceMenuManager;
     private MenuManager viewModelMenuManager;
     private MenuManager bindingInfoMenuManager;
-    
+
     private AddViewModelAction addViewModelAction;
     private AddViewModelItemAction addViewModelItemAction;
     private EditDataSourceAction editDataModelAction;
@@ -135,24 +139,29 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     private List<Part> pageList = new ArrayList<Part>();
     private IAction undoHandler;
     private IAction redoHandler;
-    //private List<String> itemPath;
+
+    private boolean showBindInfo = false;
+
+    // private List<String> itemPath;
 
     public DataBindingPage(DataBindingView dataBindingView) {
         this.dataBindingView = dataBindingView;
     }
-    
+
     private void addListeners(Part model) {
-       if (pageDesigner != null) {
-               PageData pageData = pageDesigner.getAppManager().getPageData(model.getPropertyValue("id"));
-               pageData.addPageListener(delegater);
-       }
+        if (pageDesigner != null) {
+            PageData pageData =
+                    pageDesigner.getAppManager().getPageData(model.getPropertyValue("id"));
+            pageData.addPageListener(delegater);
+        }
     }
-    
+
     private void removeListeners(Part model) {
-       if (pageDesigner != null) {
-               PageData pageData = pageDesigner.getAppManager().getPageData(model.getPropertyValue("id"));
-               pageData.removePageListener(delegater);
-       }
+        if (pageDesigner != null) {
+            PageData pageData =
+                    pageDesigner.getAppManager().getPageData(model.getPropertyValue("id"));
+            pageData.removePageListener(delegater);
+        }
     }
 
     /**
@@ -166,8 +175,8 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             updateDataSourceToAppManager(dataSourceTree);
             updateViewModelToAppManager(viewModelTree);
 
-            //FIXME
-            //pageDesigner.getAppManager().save();
+            // FIXME
+            // pageDesigner.getAppManager().save();
         }
     }
 
@@ -193,8 +202,10 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
                 makeObservableObjectsFromDataSourceTreeItem(dataModel, dataSourceTreeItem);
 
-                //pageDesigner.getAppManager().addDataSource(dataModel);
-                Command command = new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_ADDED, pageDesigner.getAppManager(), dataModel, 0);
+                // pageDesigner.getAppManager().addDataSource(dataModel);
+                Command command =
+                        new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_ADDED,
+                                                 pageDesigner.getAppManager(), dataModel, 0);
                 getCommandStackFromPageDesigner().execute(command);
             }
         }
@@ -214,116 +225,116 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             refreshViewModelTree(viewModelTree);
             refreshBindingInfos();
             refreshActions();
-            
+
             expandTreeItem();
             refreshMenus();
         }
     }
 
     private void refreshMenus() {
-       updateDataSourceMenus();
-       updateViewModelMenus();
-               updateBindingInfoMenus();
-       }
-
-       private void expandTreeItem() {
-       
-       if (pageDesigner == null) {
-               return;
-       }
-       
-       List<String> itemPath = pageDesigner.getAppManager().getSelectionPath();
-       if ((itemPath == null) || (itemPath.isEmpty())){
-               return;
-       }
-       
-       List<String> modelPath = new ArrayList<String>();
-       for (int i=0; i<itemPath.size(); i++) {
-               modelPath.add(itemPath.get(i));
-       }
-       
-               if ((modelPath != null) && (!modelPath.isEmpty())) {
-                       TreeItem selectedItem = getSelectedItem(viewModelTree, modelPath);
-                       if (selectedItem != null) {
-                               selectedItem.setExpanded(true); 
-                               viewModelTree.setSelection(selectedItem);
-                       } else {
-                               selectedItem = getSelectedItem(dataSourceTree, itemPath.get(itemPath.size()-1));
-                               if (selectedItem != null) {
-                                       selectedItem.setExpanded(true); 
-                                       dataSourceTree.setSelection(selectedItem);
-                               }
-                       }
-               }
-       }
-    
+        updateDataSourceMenus();
+        updateViewModelMenus();
+        updateBindingInfoMenus();
+    }
+
+    private void expandTreeItem() {
+
+        if (pageDesigner == null) {
+            return;
+        }
+
+        List<String> itemPath = pageDesigner.getAppManager().getSelectionPath();
+        if ((itemPath == null) || (itemPath.isEmpty())) {
+            return;
+        }
+
+        List<String> modelPath = new ArrayList<String>();
+        for (int i = 0; i < itemPath.size(); i++) {
+            modelPath.add(itemPath.get(i));
+        }
+
+        if ((modelPath != null) && (!modelPath.isEmpty())) {
+            TreeItem selectedItem = getSelectedItem(viewModelTree, modelPath);
+            if (selectedItem != null) {
+                selectedItem.setExpanded(true);
+                viewModelTree.setSelection(selectedItem);
+            } else {
+                selectedItem = getSelectedItem(dataSourceTree, itemPath.get(itemPath.size() - 1));
+                if (selectedItem != null) {
+                    selectedItem.setExpanded(true);
+                    dataSourceTree.setSelection(selectedItem);
+                }
+            }
+        }
+    }
+
     private TreeItem getSelectedItem(Tree tree, String name) {
-               
-               TreeItem[] treeItems = tree.getItems();
-               TreeItem selectedItem = null;
-               for (TreeItem treeItem : treeItems) {
-                       if (treeItem.getText().equals(name)) {
-                               selectedItem = treeItem; 
-                               break;
-                       }
-               }
-               return selectedItem;
-       }
-
-       private TreeItem getSelectedItem(Tree tree, List<String> itemPath) {
-               String itemName = itemPath.get(itemPath.size()-1);
-               itemPath.remove(itemPath.size()-1);
-               TreeItem[] treeItems = tree.getItems();
-               TreeItem selectedItem = null;
-               for (TreeItem treeItem : treeItems) {
-                       if (treeItem.getText().equals(itemName)) {
-                               if (itemPath.isEmpty()) {
-                                       selectedItem = treeItem;
-                               } else {
-                                       selectedItem = getSelectedItem(treeItem, itemPath);
-                               }
-                               break;
-                       }
-               }
-               return selectedItem;
-       }
-
-       private TreeItem getSelectedItem(TreeItem parentTreeItem, List<String> itemPath) {
-               if (itemPath.isEmpty()) {
-                       return parentTreeItem;
-               }
-               String itemName = itemPath.get(itemPath.size()-1);
-               itemPath.remove(itemPath.size()-1);
-               
-               TreeItem[] treeItems = parentTreeItem.getItems();
-               TreeItem selectedItem = null;
-               
-               for (TreeItem treeItem : treeItems) {
-                       if (treeItem.getText().equals(itemName)) {
-                               selectedItem = getSelectedItem(treeItem, itemPath);
-                               break;
-                       }
-               }
-               
-               return selectedItem;
-       }
-
-       private void refreshActions() {
-       if (undoHandler != null) {
-               ((UpdateAction) undoHandler).update();
-       }
-       if (redoHandler != null) {
-               ((UpdateAction) redoHandler).update();
-       }
-       }
-
-       private void refreshBindingInfos() {
+
+        TreeItem[] treeItems = tree.getItems();
+        TreeItem selectedItem = null;
+        for (TreeItem treeItem : treeItems) {
+            if (treeItem.getText().equals(name)) {
+                selectedItem = treeItem;
+                break;
+            }
+        }
+        return selectedItem;
+    }
+
+    private TreeItem getSelectedItem(Tree tree, List<String> itemPath) {
+        String itemName = itemPath.get(itemPath.size() - 1);
+        itemPath.remove(itemPath.size() - 1);
+        TreeItem[] treeItems = tree.getItems();
+        TreeItem selectedItem = null;
+        for (TreeItem treeItem : treeItems) {
+            if (treeItem.getText().equals(itemName)) {
+                if (itemPath.isEmpty()) {
+                    selectedItem = treeItem;
+                } else {
+                    selectedItem = getSelectedItem(treeItem, itemPath);
+                }
+                break;
+            }
+        }
+        return selectedItem;
+    }
+
+    private TreeItem getSelectedItem(TreeItem parentTreeItem, List<String> itemPath) {
+        if (itemPath.isEmpty()) {
+            return parentTreeItem;
+        }
+        String itemName = itemPath.get(itemPath.size() - 1);
+        itemPath.remove(itemPath.size() - 1);
+
+        TreeItem[] treeItems = parentTreeItem.getItems();
+        TreeItem selectedItem = null;
+
+        for (TreeItem treeItem : treeItems) {
+            if (treeItem.getText().equals(itemName)) {
+                selectedItem = getSelectedItem(treeItem, itemPath);
+                break;
+            }
+        }
+
+        return selectedItem;
+    }
+
+    private void refreshActions() {
+        if (undoHandler != null) {
+            ((UpdateAction) undoHandler).update();
+        }
+        if (redoHandler != null) {
+            ((UpdateAction) redoHandler).update();
+        }
+    }
+
+    private void refreshBindingInfos() {
         if (pageDesigner != null) {
             List<PageData> pages = pageDesigner.getAppManager().getPageDataSet().getPages();
             for (PageData pageData : pages) {
                 List<Part> parts = pageData.getPagePart().getChildren();
                 // parts.get(0).getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND);
-                refreshBindingInfo(parts); 
+                refreshBindingInfo(parts);
             }
         }
     }
@@ -334,17 +345,19 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         }
         for (Part part : parts) {
             if (part.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND) != null) {
-                String propertyValue = part.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
+                String propertyValue =
+                        part.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
                 if ((propertyValue != null) && (!propertyValue.isEmpty())) {
                     String[] str = propertyValue.split(": ");
-                       if (str[1].startsWith(BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX)) {
-                               String parentPropertyValue = getParentPropertyValue(part, str[1]);
-                               if (parentPropertyValue != null) {
-                                       addInfoTableItem(part, parentPropertyValue, part.getIdPropertyValue(), str[0]);
-                               }
-                       } else {
-                               addInfoTableItem(part, str[1], part.getIdPropertyValue(), str[0]);
-                       }
+                    if (str[1].startsWith(BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX)) {
+                        String parentPropertyValue = getParentPropertyValue(part, str[1]);
+                        if (parentPropertyValue != null) {
+                            addInfoTableItem(part, parentPropertyValue, part.getIdPropertyValue(),
+                                             str[0]);
+                        }
+                    } else {
+                        addInfoTableItem(part, str[1], part.getIdPropertyValue(), str[0]);
+                    }
                 }
             }
             refreshBindingInfo(part.getChildren());
@@ -352,24 +365,27 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     }
 
     private String getParentPropertyValue(Part part, String string) {
-       Part parentPart = part.getParent();
-       String modelName = null;
-       if (parentPart == null) {
-               return null;
-       }
-       
-       String propertyValue = parentPart.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
-       if ((propertyValue == null) || (propertyValue.isEmpty())) {
-               return null;
-       }
-       
-       String[] str = propertyValue.split(": ");
-       modelName = str[1] + BuilderConstants.DOT + string.replace(BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX, "");
-
-               return modelName;
-       }
-
-       private void refreshViewModelTree(Tree viewModelTree) {
+        Part parentPart = part.getParent();
+        String modelName = null;
+        if (parentPart == null) {
+            return null;
+        }
+
+        String propertyValue =
+                parentPart.getProperty(BuilderConstants.ATTRIBUTE_DATA_BIND).getValue();
+        if ((propertyValue == null) || (propertyValue.isEmpty())) {
+            return null;
+        }
+
+        String[] str = propertyValue.split(": ");
+        modelName =
+                str[1] + BuilderConstants.DOT
+                        + string.replace(BuilderConstants.DATABINDING_ARRAYITEM_VALUE_PREFIX, "");
+
+        return modelName;
+    }
+
+    private void refreshViewModelTree(Tree viewModelTree) {
         if (pageDesigner != null) {
             List<BindingData> viewModels = pageDesigner.getAppManager().getViewModels();
             if (viewModels == null) {
@@ -393,16 +409,16 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                 treeItem.setData("TREEITEMDATA", treeItemData);
 
                 if (!viewModel.getDataSourceObjects().isEmpty()) {
-                       makeSubTreeItem(treeItem, viewModel.getDataSourceObjects());
+                    makeSubTreeItem(treeItem, viewModel.getDataSourceObjects());
                 } else if (!viewModel.getViewModelObjects().isEmpty()) {
-                       makeSubTreeItem(treeItem, viewModel.getViewModelObjects());                     
+                    makeSubTreeItem(treeItem, viewModel.getViewModelObjects());
                 }
-                
+
                 TreeItemData data = (TreeItemData) viewModelTree.getData("TREEITEMDATA");
                 if (data == null) {
                     data = new TreeItemData();
                 }
-                //data.setViewModelCount(i + 1);
+                // data.setViewModelCount(i + 1);
                 viewModelTree.setData("TREEITEMDATA", data);
             }
         }
@@ -430,7 +446,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                 if (data == null) {
                     data = new TreeItemData();
                 }
-                //data.setViewModelCount(i + 1);
+                // data.setViewModelCount(i + 1);
                 dataSourceTree.setData("TREEITEMDATA", data);
             }
         }
@@ -463,7 +479,6 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         }
     }
 
-
     private void updateViewModelToAppManager(Tree tree) {
 
         TreeItem[] treeItems = tree.getItems();
@@ -561,100 +576,108 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     public void addViewModel() {
         int idIndex = 0;
         while (!canSetTreeItemName(viewModelTree, "model" + idIndex)) {
-               idIndex++;
+            idIndex++;
         }
-        
+
         BindingData bindingData = new BindingData();
         bindingData.setModelType(BuilderConstants.DATABINDING_TYPE_STATIC);
         bindingData.setModelName("model" + idIndex);
-        
-        Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ADDED, pageDesigner.getAppManager(), bindingData, 0);
+
+        Command command =
+                new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ADDED,
+                                        pageDesigner.getAppManager(), bindingData, 0);
         getCommandStackFromPageDesigner().execute(command);
     }
-    
+
     /**
      * Adds a tree item in the view model panel.
      * 
      * @return tree item
      */
     private List<String> makeItemPath(TreeItem selectedItem) {
-       List<String> itemPath = new ArrayList<String>();
-       
-       TreeItem treeItem = selectedItem;
+        List<String> itemPath = new ArrayList<String>();
+
+        TreeItem treeItem = selectedItem;
         itemPath.add(treeItem.getText());
         while (treeItem.getParentItem() != null) {
-               treeItem = treeItem.getParentItem();
-               itemPath.add(treeItem.getText());
+            treeItem = treeItem.getParentItem();
+            itemPath.add(treeItem.getText());
         }
         return itemPath;
     }
-    
+
     public void addViewModelItem() {
 
-       TreeItem[] selectedItems = viewModelTree.getSelection();
+        TreeItem[] selectedItems = viewModelTree.getSelection();
 
         if (selectedItems.length > 0) {
             int idIndex = 0;
             while (!canSetTreeItemName(selectedItems[0], "viewModelItem" + idIndex)) {
-               idIndex++;
+                idIndex++;
             }
 
-            List<String> itemPath = makeItemPath(selectedItems[0]);                                    
-            BindingData bindingData = pageDesigner.getAppManager().getViewModel(itemPath.get(itemPath.size()-1));
+            List<String> itemPath = makeItemPath(selectedItems[0]);
+            BindingData bindingData =
+                    pageDesigner.getAppManager().getViewModel(itemPath.get(itemPath.size() - 1));
 
-            Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_ADDED, pageDesigner.getAppManager(), bindingData, itemPath, "viewModelItem"+ idIndex, "",0);
+            Command command =
+                    new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_ADDED,
+                                            pageDesigner.getAppManager(), bindingData, itemPath,
+                                            "viewModelItem" + idIndex, "", 0);
             getCommandStackFromPageDesigner().execute(command);
-        } 
+        }
     }
-    
+
     /**
      * Returns TRUE if tree item name can be set.
-     * @param tree 
-     *                           
+     * 
+     * @param tree
+     * 
      * @param itemName
      *            a tree item name
      * @return true if tree item name can be set
      */
     private boolean canSetTreeItemName(Tree tree, String itemName) {
-       TreeItem[] childItems = tree.getItems();
-       for (TreeItem childItem : childItems) {
-               TreeItemData treeItemData = (TreeItemData) childItem.getData("TREEITEMDATA");
-               String originName = null;
-               String name;
-               if (treeItemData != null) {
-                       originName = treeItemData.getOriginModelName();
-               }
-               if (originName == null) {
-                       name = childItem.getText();
-               } else {
-                       name = originName;
-               }
-               
-               if (name != null) {
-                       if (name.equals(itemName)) {
-                               return false;
-                       }
-               }
-       }
-       return true;
-    }
-    
+        TreeItem[] childItems = tree.getItems();
+        for (TreeItem childItem : childItems) {
+            TreeItemData treeItemData = (TreeItemData) childItem.getData("TREEITEMDATA");
+            String originName = null;
+            String name;
+            if (treeItemData != null) {
+                originName = treeItemData.getOriginModelName();
+            }
+            if (originName == null) {
+                name = childItem.getText();
+            } else {
+                name = originName;
+            }
+
+            if (name != null) {
+                if (name.equals(itemName)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
     /**
      * Returns TRUE if tree item name can be set.
+     * 
      * @param TreeItem
-     *                           
+     * 
      * @param itemName
      *            a tree item name
      * @return true if tree item name can be set
      */
     private boolean canSetTreeItemName(TreeItem treeItem, String itemName) {
-       TreeItem[] childItems = treeItem.getItems();
-       for (TreeItem childItem : childItems) {
-               if (childItem.getText().equals(itemName)) {
-                       return false;
-               }
-       }
-       return true;
+        TreeItem[] childItems = treeItem.getItems();
+        for (TreeItem childItem : childItems) {
+            if (childItem.getText().equals(itemName)) {
+                return false;
+            }
+        }
+        return true;
     }
 
     /**
@@ -662,145 +685,176 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
      * 
      */
     public void addDataSource() {
-       int idIndex = 0;
+        int idIndex = 0;
+
+        while (!canSetTreeItemName(dataSourceTree, "source" + idIndex)) {
+            idIndex++;
+        }
 
-       while (!canSetTreeItemName(dataSourceTree, "source" + idIndex)) {
-               idIndex++;
-       }
+        BindingData bindingData = new BindingData();
+        bindingData.setModelType(BuilderConstants.DATABINDING_TYPE_STATIC);
+        bindingData.setSourceName("source" + idIndex);
 
-       BindingData bindingData = new BindingData();
-       bindingData.setModelType(BuilderConstants.DATABINDING_TYPE_STATIC);
-       bindingData.setSourceName("source" + idIndex);
-       
-       Command command = new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_ADDED, pageDesigner.getAppManager(), bindingData, 0);
+        Command command =
+                new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_ADDED,
+                                         pageDesigner.getAppManager(), bindingData, 0);
         getCommandStackFromPageDesigner().execute(command);
     }
-    
+
     public void editDataSource(BindingData dataSource) {
-       Command command = new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_CHANGED, pageDesigner.getAppManager(), dataSource, 0);
+        Command command =
+                new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_CHANGED,
+                                         pageDesigner.getAppManager(), dataSource, 0);
         getCommandStackFromPageDesigner().execute(command);
-       }
-    
+    }
+
     public void editViewModel(BindingData viewModel) {
-       Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_CHANGED, pageDesigner.getAppManager(), viewModel, 0);
+        Command command =
+                new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_CHANGED,
+                                        pageDesigner.getAppManager(), viewModel, 0);
         getCommandStackFromPageDesigner().execute(command);
-       }
-    
+    }
+
     public void setDataSourceToViewModel(BindingData dataSource, BindingData viewModel) {
-       BindingData bindingData;
-       if (dataSource == null) {
-               return;
-       }
-
-       if (viewModel == null) {
-               bindingData = new BindingData();
-               int idIndex = 0;
+        BindingData bindingData;
+        if (dataSource == null) {
+            return;
+        }
+
+        if (viewModel == null) {
+            bindingData = new BindingData();
+            int idIndex = 0;
             while (!canSetTreeItemName(viewModelTree, "model" + idIndex)) {
-               idIndex++;
+                idIndex++;
             }
             bindingData.setModelName("model" + idIndex);
             bindingData.setSourceName(dataSource.getSourceName());
-               bindingData.setModelType(dataSource.getModelType());
-               bindingData.setUpdateOnStartup(dataSource.getUpdateOnStartup());
-               bindingData.addAllHandlerInfos(dataSource.getHandlerInfos());
-               bindingData.addAllViewModelObjects(dataSource.getDataSourceObjects());
-               
-               Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ADDED, pageDesigner.getAppManager(), bindingData, 0);
+            bindingData.setModelType(dataSource.getModelType());
+            bindingData.setUpdateOnStartup(dataSource.getUpdateOnStartup());
+            bindingData.addAllHandlerInfos(dataSource.getHandlerInfos());
+            bindingData.addAllViewModelObjects(dataSource.getDataSourceObjects());
+
+            Command command =
+                    new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ADDED,
+                                            pageDesigner.getAppManager(), bindingData, 0);
             getCommandStackFromPageDesigner().execute(command);
-       } else {
-               BindingData oldBindingData = viewModel.clone();
-               bindingData = viewModel; 
-               bindingData.setSourceName(dataSource.getSourceName());
-               bindingData.setModelType(dataSource.getModelType());
-               bindingData.setUpdateOnStartup(dataSource.getUpdateOnStartup());
-               bindingData.addAllHandlerInfos(dataSource.getHandlerInfos());
-               bindingData.addAllViewModelObjects(dataSource.getDataSourceObjects());
-               
-               Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_SET_DATASOURCE, pageDesigner.getAppManager(), bindingData, oldBindingData, 0);
+        } else {
+            BindingData oldBindingData = viewModel.clone();
+            bindingData = viewModel;
+            bindingData.setSourceName(dataSource.getSourceName());
+            bindingData.setModelType(dataSource.getModelType());
+            bindingData.setUpdateOnStartup(dataSource.getUpdateOnStartup());
+            bindingData.addAllHandlerInfos(dataSource.getHandlerInfos());
+            bindingData.addAllViewModelObjects(dataSource.getDataSourceObjects());
+
+            Command command =
+                    new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_SET_DATASOURCE,
+                                            pageDesigner.getAppManager(), bindingData,
+                                            oldBindingData, 0);
             getCommandStackFromPageDesigner().execute(command);
-       }
-       
-       }
+        }
+
+    }
 
     /**
      * Removes a tree item in the data source panel.
      */
     public void removeDataSource() {
-        TreeItem[] treeItems = dataSourceTree.getSelection();
-         for (TreeItem treeItem : treeItems) {
-                if (treeItem.getParentItem() == null) {
-                        BindingData bindingData = pageDesigner.getAppManager().getDataSource(treeItem.getText());
-                        Command command = new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_REMOVED, pageDesigner.getAppManager(), bindingData, 0);
-                        getCommandStackFromPageDesigner().execute(command);
-                }
-         }
-    }
-    
+        TreeItem[] treeItems = dataSourceTree.getSelection();
+        for (TreeItem treeItem : treeItems) {
+            if (treeItem.getParentItem() == null) {
+                BindingData bindingData =
+                        pageDesigner.getAppManager().getDataSource(treeItem.getText());
+                Command command =
+                        new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_REMOVED,
+                                                 pageDesigner.getAppManager(), bindingData, 0);
+                getCommandStackFromPageDesigner().execute(command);
+            }
+        }
+    }
+
     public boolean canRemoveDataSource() {
-       TreeItem[] treeItems = dataSourceTree.getSelection();
+        TreeItem[] treeItems = dataSourceTree.getSelection();
         if ((treeItems == null) || (treeItems.length < 1)) {
-               return false;
+            return false;
         } else {
-               return true;
+            return true;
         }
     }
-    
+
     public BindingData getDataSource(String name) {
-       return pageDesigner.getAppManager().getDataSource(name);
+        return pageDesigner.getAppManager().getDataSource(name);
     }
-    
+
     public BindingData getViewModel(String name) {
-       return pageDesigner.getAppManager().getViewModel(name);
+        return pageDesigner.getAppManager().getViewModel(name);
     }
 
     /**
      * Removes a tree item in the view model panel.
      */
     public void removeViewModel() {
-       TreeItem[] treeItems = viewModelTree.getSelection();
+        TreeItem[] treeItems = viewModelTree.getSelection();
         for (TreeItem treeItem : treeItems) {
-               if (treeItem.getParentItem() == null) {
-                               BindingData bindingData = pageDesigner.getAppManager().getViewModel(treeItem.getText());
-                               Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_REMOVED, pageDesigner.getAppManager(), bindingData, 0);
-                               getCommandStackFromPageDesigner().execute(command);
-               } else {
-                       List<String> itemPath = makeItemPath(treeItem);
-                       BindingData bindingData = pageDesigner.getAppManager().getViewModel(itemPath.get(itemPath.size()-1));
-                       Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_REMOVED, pageDesigner.getAppManager(), bindingData, itemPath, treeItem.getText(), "",0);
+            if (treeItem.getParentItem() == null) {
+                BindingData bindingData =
+                        pageDesigner.getAppManager().getViewModel(treeItem.getText());
+                Command command =
+                        new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_REMOVED,
+                                                pageDesigner.getAppManager(), bindingData, 0);
+                getCommandStackFromPageDesigner().execute(command);
+            } else {
+                List<String> itemPath = makeItemPath(treeItem);
+                BindingData bindingData =
+                        pageDesigner.getAppManager()
+                                .getViewModel(itemPath.get(itemPath.size() - 1));
+                Command command =
+                        new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_REMOVED,
+                                                pageDesigner.getAppManager(), bindingData,
+                                                itemPath, treeItem.getText(), "", 0);
                 getCommandStackFromPageDesigner().execute(command);
-               }
-               
+            }
+
         }
     }
-    
+
     public boolean canRemoveViewModel() {
-       TreeItem[] treeItems = viewModelTree.getSelection();
+        TreeItem[] treeItems = viewModelTree.getSelection();
         if ((treeItems == null) || (treeItems.length < 1)) {
-               return false;
+            return false;
         } else {
-               return true;
+            return true;
         }
     }
-    
+
     public void renameViewModel(TreeItem treeItem, String newName) {
-       if (treeItem.getParentItem() == null) {
-                       BindingData bindingData = pageDesigner.getAppManager().getViewModel(treeItem.getText());
-                       Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_RENAMED, pageDesigner.getAppManager(), bindingData, newName, 0);
-                       getCommandStackFromPageDesigner().execute(command);
-       } else {
-               List<String> itemPath = makeItemPath(treeItem);
-               BindingData bindingData = pageDesigner.getAppManager().getViewModel(itemPath.get(itemPath.size()-1));
-               Command command = new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_RENAMED, pageDesigner.getAppManager(), bindingData, itemPath, treeItem.getText(), newName,0);
+        if (treeItem.getParentItem() == null) {
+            BindingData bindingData = pageDesigner.getAppManager().getViewModel(treeItem.getText());
+            Command command =
+                    new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_RENAMED,
+                                            pageDesigner.getAppManager(), bindingData, newName, 0);
             getCommandStackFromPageDesigner().execute(command);
-       }
+        } else {
+            List<String> itemPath = makeItemPath(treeItem);
+            BindingData bindingData =
+                    pageDesigner.getAppManager().getViewModel(itemPath.get(itemPath.size() - 1));
+            Command command =
+                    new SetViewModelCommand(BindingDataSetEventType.VIEWMODEL_ITEM_RENAMED,
+                                            pageDesigner.getAppManager(), bindingData, itemPath,
+                                            treeItem.getText(), newName, 0);
+            getCommandStackFromPageDesigner().execute(command);
+        }
     }
-    
+
     public void renameDataSource(TreeItem treeItem, String newName) {
-       if (treeItem.getParentItem() == null) {
-                       BindingData bindingData = pageDesigner.getAppManager().getDataSource(treeItem.getText());
-                       Command command = new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_RENAMED, pageDesigner.getAppManager(), bindingData, newName, 0);
-                       getCommandStackFromPageDesigner().execute(command);
-       } 
+        if (treeItem.getParentItem() == null) {
+            BindingData bindingData =
+                    pageDesigner.getAppManager().getDataSource(treeItem.getText());
+            Command command =
+                    new SetDataSourceCommand(BindingDataSetEventType.DATASOURCE_RENAMED,
+                                             pageDesigner.getAppManager(), bindingData, newName, 0);
+            getCommandStackFromPageDesigner().execute(command);
+        }
     }
 
     /**
@@ -851,12 +905,11 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
      * @param editor
      */
     public void removeInfoTableItem(Part part) {
-       if (delegater != null) {
-               delegater.valueChanged(part, BuilderConstants.ATTRIBUTE_DATA_BIND, "", true);
+        if (delegater != null) {
+            delegater.valueChanged(part, BuilderConstants.ATTRIBUTE_DATA_BIND, "", true);
         }
     }
 
-
     /**
      * Gets the view model tree.
      * 
@@ -890,22 +943,22 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         composite.setLayout(new FillLayout());
 
         createActions();
-        
+
         SashForm sashForm = new SashForm(composite, SWT.HORIZONTAL);
         makeDataModelParentPanel(sashForm);
         makeBindingInfoPanel(sashForm);
 
         refresh();
     }
-    
+
     @Override
     public void dispose() {
-       if (pageDesigner != null) {
-               pageDesigner.getAppManager().getBindingDataSet().removeBindingDataListener(this);
-       }
-       
+        if (pageDesigner != null) {
+            pageDesigner.getAppManager().getBindingDataSet().removeBindingDataListener(this);
+        }
+
         for (Part pagePart : pageList) {
-               removeListeners(pagePart);
+            removeListeners(pagePart);
         }
         pageList.clear();
         super.dispose();
@@ -913,7 +966,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
     private void makeBindingInfoPanel(SashForm sashForm) {
         Composite dataInfoPanel = new Composite(sashForm, SWT.BORDER);
-        //dataInfoPanel.setLayout(new FillLayout(SWT.VERTICAL));
+        // dataInfoPanel.setLayout(new FillLayout(SWT.VERTICAL));
         FormLayout layout = new FormLayout();
         dataInfoPanel.setLayout(layout);
 
@@ -922,7 +975,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         toolBarData.top = new FormAttachment(0, 0);
         toolBarData.right = new FormAttachment(100, 0);
         toolBar.setLayoutData(toolBarData);
-        
+
         infoTableViewer = new TableViewer(dataInfoPanel, SWT.NONE);
         FormData tableData = new FormData();
         tableData.top = new FormAttachment(toolBar, 0);
@@ -945,42 +998,51 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
         infoTableViewer.getTable().setHeaderVisible(true);
         infoTableViewer.getTable().setLinesVisible(true);
-        
+
         infoTableViewer.getTable().addKeyListener(new KeyAdapter() {
-               public void keyPressed(KeyEvent event) {
-                       switch (event.keyCode) {
-                               case SWT.DEL:
-                                       removeBindingInfo();
-                                       break;
-                       }
-               }
+            public void keyPressed(KeyEvent event) {
+                switch (event.keyCode) {
+                    case SWT.DEL:
+                        removeBindingInfo();
+                        break;
+                }
+            }
         });
         infoTableViewer.getTable().addSelectionListener(new SelectionAdapter() {
-               public void widgetSelected(SelectionEvent e) {
-                       updateBindingInfoMenus();
-               }
+            public void widgetSelected(SelectionEvent e) {
+                updateBindingInfoMenus();
+            }
         });
-        
+
         makeBindingInfoContextMenu();
     }
-    
+
+    public void showDataBindingInfo(boolean show) {
+        // if (delegater != null) {
+        // delegater.showDataBindInfo(show);
+        // }
+        if (null != pageDesigner) {
+            pageDesigner.showBindingInfo(show);
+        }
+    }
+
     public void removeBindingInfo() {
-       TableItem[] tableItems = infoTableViewer.getTable().getSelection();
-               for (TableItem tableItem : tableItems) {
-                       Part part = (Part) tableItem.getData("PART");
-                       if (part != null) {
-                               removeInfoTableItem(part);
-                       }
-               }                                       
-    }
-    
+        TableItem[] tableItems = infoTableViewer.getTable().getSelection();
+        for (TableItem tableItem : tableItems) {
+            Part part = (Part) tableItem.getData("PART");
+            if (part != null) {
+                removeInfoTableItem(part);
+            }
+        }
+    }
+
     public boolean canRemoveBindingInfo() {
-       TableItem[] tableItems = infoTableViewer.getTable().getSelection();
-       if ((tableItems == null) || (tableItems.length < 1)) {
-               return false;
+        TableItem[] tableItems = infoTableViewer.getTable().getSelection();
+        if ((tableItems == null) || (tableItems.length < 1)) {
+            return false;
         } else {
-               return true;
-        }                              
+            return true;
+        }
     }
 
     private void makeDataModelParentPanel(SashForm parentSashForm) {
@@ -1026,7 +1088,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         treeData.left = new FormAttachment(0, 0);
         treeData.right = new FormAttachment(100, 0);
         dataSourceTree.setLayoutData(treeData);
-        
+
         dataSourceTreeEditor = new TreeEditor(dataSourceTree);
         dataSourceTreeEditor.horizontalAlignment = SWT.LEFT;
         dataSourceTreeEditor.grabHorizontal = true;
@@ -1043,7 +1105,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
                 Rectangle rect = treeItem.getBounds();
                 if (rect.contains(point)) {
-                       renameDataSource(treeItem);
+                    renameDataSource(treeItem);
                 }
 
             }
@@ -1054,23 +1116,23 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                 // Make sure one and only one item is selected when F2 is
                 // pressed
                 if (event.keyCode == SWT.F2 && dataSourceTree.getSelectionCount() == 1) {
-                       renameDataSource(null);
+                    renameDataSource(null);
                 } else if (event.keyCode == SWT.DEL) {
-                       removeViewModel();
+                    removeViewModel();
                 }
             }
         });
-        
+
         dataSourceTree.addSelectionListener(new SelectionAdapter() {
-               public void widgetSelected(SelectionEvent e) {
-                       updateDataSourceMenus();
-               }
+            public void widgetSelected(SelectionEvent e) {
+                updateDataSourceMenus();
+            }
         });
-        
+
         dataSourceTree.addKeyListener(new KeyAdapter() {
             public void keyPressed(KeyEvent event) {
-               if (event.keyCode == SWT.DEL) {
-                       removeDataSource();
+                if (event.keyCode == SWT.DEL) {
+                    removeDataSource();
                 }
             }
         });
@@ -1078,10 +1140,10 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         // DataBindingDnDManager.addDragAndDropListenerToTree(dataSourceTree);
         DataBindingDnDManager.addDragListenerToDataSourceTree(dataSourceTree);
         makeDataSourceContextMenu();
-    }    
-    
+    }
+
     public void renameDataSource(TreeItem treeItem) {
-       renameTreeItem(dataSourceTree, dataSourceTreeEditor, treeItem);
+        renameTreeItem(dataSourceTree, dataSourceTreeEditor, treeItem);
     }
 
     private ToolBar makeDataSourcePanelToolbar(Composite panel) {
@@ -1095,16 +1157,16 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
         return toolBar;
     }
-    
+
     private void makeDataSourceContextMenu() {
-       dataSourceMenuManager = new MenuManager("#dataSourceMenu");
-       dataSourceMenuManager.add(editDataModelAction);
-       dataSourceMenuManager.add(removeDataSourceAction);
-       dataSourceMenuManager.add(addDataSourceAction);
-       dataSourceMenuManager.add(renameDataSourceAction);
-       dataSourceMenuManager.update(true);
-       
-       Menu menu = dataSourceMenuManager.createContextMenu(dataSourceTree);            
+        dataSourceMenuManager = new MenuManager("#dataSourceMenu");
+        dataSourceMenuManager.add(editDataModelAction);
+        dataSourceMenuManager.add(removeDataSourceAction);
+        dataSourceMenuManager.add(addDataSourceAction);
+        dataSourceMenuManager.add(renameDataSourceAction);
+        dataSourceMenuManager.update(true);
+
+        Menu menu = dataSourceMenuManager.createContextMenu(dataSourceTree);
         dataSourceTree.setMenu(menu);
     }
 
@@ -1121,39 +1183,61 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
         return toolBar;
     }
-    
+
     private void makeViewModelContextMenu() {
-       viewModelMenuManager = new MenuManager("#viewModelMenu");
-       viewModelMenuManager.add(setTargetAction);
-       viewModelMenuManager.add(getSourceAction);
-       viewModelMenuManager.add(removeViewModelAction);
-       viewModelMenuManager.add(addViewModelItemAction);
-       viewModelMenuManager.add(addViewModelAction);
-       viewModelMenuManager.add(renameViewModelAction);
-       viewModelMenuManager.update(true);
-       
-       Menu menu = viewModelMenuManager.createContextMenu(viewModelTree);      
-       viewModelTree.setMenu(menu);
-    }
-    
+        viewModelMenuManager = new MenuManager("#viewModelMenu");
+        viewModelMenuManager.add(setTargetAction);
+        viewModelMenuManager.add(getSourceAction);
+        viewModelMenuManager.add(removeViewModelAction);
+        viewModelMenuManager.add(addViewModelItemAction);
+        viewModelMenuManager.add(addViewModelAction);
+        viewModelMenuManager.add(renameViewModelAction);
+        viewModelMenuManager.update(true);
+
+        Menu menu = viewModelMenuManager.createContextMenu(viewModelTree);
+        viewModelTree.setMenu(menu);
+    }
+
     private ToolBar makeBindingInfoToolbar(Composite panel) {
         ToolBar toolBar = new ToolBar(panel, SWT.FLAT);
         bindingInfoToolBarManager = new ToolBarManager(toolBar);
 
+        Image img = ResourceManager.getImage(BuilderConstants.ICON_DIR, "show_bind.gif");
+        ImageDescriptor imgDesc = ImageDescriptor.createFromImage(img);
+        Action showBindingInfo = new Action("show data binding info", imgDesc) {
+
+            public void run() {
+                showBindInfo = !showBindInfo;
+                pageDesigner.showBindingInfo(showBindInfo);
+                Image img = null;
+                if (showBindInfo) {
+                    img = ResourceManager.getImage(BuilderConstants.ICON_DIR, "hide_bind.gif");
+                } else {
+                    img = ResourceManager.getImage(BuilderConstants.ICON_DIR, "show_bind.gif");
+                }
+                ImageDescriptor imgDesc = ImageDescriptor.createFromImage(img);
+                setImageDescriptor(imgDesc);
+            }
+
+        };
+
+        bindingInfoToolBarManager.add(showBindingInfo);
+        bindingInfoToolBarManager.add(new Separator());
         bindingInfoToolBarManager.add(removeBindingInfoAction);
+
         bindingInfoToolBarManager.update(true);
 
         return toolBar;
     }
-    
+
     private void makeBindingInfoContextMenu() {
-       bindingInfoMenuManager = new MenuManager("#BindingInfoMenu");
-       
-       bindingInfoMenuManager.add(removeBindingInfoAction);
-       bindingInfoMenuManager.update(true);
-       
-       Menu menu = bindingInfoMenuManager.createContextMenu(infoTableViewer.getTable());       
-       infoTableViewer.getTable().setMenu(menu);
+        bindingInfoMenuManager = new MenuManager("#BindingInfoMenu");
+
+        bindingInfoMenuManager.add(removeBindingInfoAction);
+        bindingInfoMenuManager.update(true);
+
+        Menu menu = bindingInfoMenuManager.createContextMenu(infoTableViewer.getTable());
+        infoTableViewer.getTable().setMenu(menu);
     }
 
     private void makeDataViewModelPanel(SashForm sashForm) {
@@ -1205,7 +1289,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
 
                 Rectangle rect = treeItem.getBounds();
                 if (rect.contains(point)) {
-                       renameViewModel(treeItem);
+                    renameViewModel(treeItem);
                 }
 
             }
@@ -1216,17 +1300,17 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                 // Make sure one and only one item is selected when F2 is
                 // pressed
                 if (event.keyCode == SWT.F2 && viewModelTree.getSelectionCount() == 1) {
-                       renameViewModel(null);
+                    renameViewModel(null);
                 } else if (event.keyCode == SWT.DEL) {
-                       removeViewModel();
+                    removeViewModel();
                 }
             }
         });
-        
+
         viewModelTree.addSelectionListener(new SelectionAdapter() {
-               public void widgetSelected(SelectionEvent e) {
-                       updateViewModelMenus();
-               }
+            public void widgetSelected(SelectionEvent e) {
+                updateViewModelMenus();
+            }
         });
 
         DataBindingDnDManager.addDragAndDropListenerToViewModelTree(viewModelTree, dataBindingView,
@@ -1234,22 +1318,22 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         // DataBindingDnDManager.addDropListenerToViewModelTree(viewModelTree);
         makeViewModelContextMenu();
     }
-    
+
     public void renameViewModel(TreeItem treeItem) {
-       renameTreeItem(viewModelTree, viewModelTreeEditor, treeItem);
+        renameTreeItem(viewModelTree, viewModelTreeEditor, treeItem);
     }
-    
+
     private void renameTreeItem(final Tree tree, TreeEditor treeEditor, TreeItem treeItem) {
-       // Determine the item to edit
-       final TreeItem item;
-       if (treeItem == null) {
-               item = tree.getSelection()[0];
-       } else {
-               item = treeItem;
-       }
-       if (treeEditor == null) {
-               return;
-       }
+        // Determine the item to edit
+        final TreeItem item;
+        if (treeItem == null) {
+            item = tree.getSelection()[0];
+        } else {
+            item = treeItem;
+        }
+        if (treeEditor == null) {
+            return;
+        }
 
         Control oldEditor = treeEditor.getEditor();
         if (oldEditor != null) {
@@ -1266,11 +1350,11 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         // and end the editing session
         text.addFocusListener(new FocusAdapter() {
             public void focusLost(FocusEvent event) {
-               if (tree.equals(getDataSourceTree())) {
-                       renameDataSource(item, text.getText());
-               } else {
-                       renameViewModel(item, text.getText());
-               }
+                if (tree.equals(getDataSourceTree())) {
+                    renameDataSource(item, text.getText());
+                } else {
+                    renameViewModel(item, text.getText());
+                }
                 text.dispose();
             }
         });
@@ -1286,19 +1370,19 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                     case SWT.CR:
                         // Enter hit--set the text into the tree and
                         // drop through
-                       if (tree.equals(getDataSourceTree())) {
-                               renameDataSource(item, text.getText());
-                       } else {
-                               renameViewModel(item, text.getText());
-                       }
+                        if (tree.equals(getDataSourceTree())) {
+                            renameDataSource(item, text.getText());
+                        } else {
+                            renameViewModel(item, text.getText());
+                        }
                         text.dispose();
                         break;
                     case SWT.KEYPAD_CR:
-                       if (tree.equals(getDataSourceTree())) {
-                               renameDataSource(item, text.getText());
-                       } else {
-                               renameViewModel(item, text.getText());
-                       }
+                        if (tree.equals(getDataSourceTree())) {
+                            renameDataSource(item, text.getText());
+                        } else {
+                            renameViewModel(item, text.getText());
+                        }
                         text.dispose();
                         break;
                     case SWT.ESC:
@@ -1364,7 +1448,7 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
             return null;
         }
     }
-    
+
     private ActionRegistry getActionRegistryFromPageDesigner() {
         if (pageDesigner != null) {
             return (ActionRegistry) pageDesigner.getAdapter(ActionRegistry.class);
@@ -1376,22 +1460,24 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
     public void setInput(PageDesigner pageDesigner) {
         this.pageDesigner = pageDesigner;
         this.delegater = new DataBindingEventDelegater(getCommandStackFromPageDesigner(), this);
-        
+
         if (getActionRegistryFromPageDesigner() != null) {
-               this.undoHandler = getActionRegistryFromPageDesigner().getAction(ActionFactory.UNDO.getId());
-               this.redoHandler = getActionRegistryFromPageDesigner().getAction(ActionFactory.REDO.getId());
+            this.undoHandler =
+                    getActionRegistryFromPageDesigner().getAction(ActionFactory.UNDO.getId());
+            this.redoHandler =
+                    getActionRegistryFromPageDesigner().getAction(ActionFactory.REDO.getId());
         }
-        
+
         pageDesigner.getAppManager().getBindingDataSet().addBindingDataListener(this);
-        
+
     }
 
     public PageDesigner getInput() {
         return this.pageDesigner;
     }
 
-       public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-               if (selection instanceof StructuredSelection && !selection.isEmpty()) {
+    public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+        if (selection instanceof StructuredSelection && !selection.isEmpty()) {
             StructuredSelection ssel = (StructuredSelection) selection;
 
             if (part instanceof PageDesigner || part instanceof ContentOutline) {
@@ -1406,75 +1492,79 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
                         if (editPart.getModel() instanceof Part) {
                             Part model = (Part) editPart.getModel();
                             selModels.add(model);
-                        } 
+                        }
                     }
                 }
-                
+
                 if (selModels.get(0).getOwnerPage() != null) {
-                       if (!pageList.contains(selModels.get(0).getOwnerPage())) {
-                               pageList.add(selModels.get(0).getOwnerPage());
-                       addListeners(selModels.get(0).getOwnerPage());
-                       }
+                    if (!pageList.contains(selModels.get(0).getOwnerPage())) {
+                        pageList.add(selModels.get(0).getOwnerPage());
+                        addListeners(selModels.get(0).getOwnerPage());
+                    }
                 }
             }
         }
-       }
-       
-       public void updateDataSourceMenus() {
-               if (removeDataSourceAction != null) {
-                       removeDataSourceAction.refresh();
-               }
-               if (editDataModelAction != null) {
-                       editDataModelAction.refresh();
-               }
-               if (renameDataSourceAction != null) {
-                       renameDataSourceAction.refresh();
-               }
-               if (dataSourceToolBarManager != null) {
-                       dataSourceToolBarManager.update(true);
-               }
-               if (dataSourceMenuManager != null) {
-                       dataSourceMenuManager.update(true);
-               }
-       }
-       
-       public void updateViewModelMenus() {
-               if (addViewModelItemAction != null) {
-                       addViewModelItemAction.refresh();
-               }
-               if (removeViewModelAction != null) {
-                       removeViewModelAction.refresh();
-               }
-               if (setTargetAction != null) {
-                       setTargetAction.refresh();
-               }
-               if (getSourceAction != null) {
-                       getSourceAction.refresh();
-               }
-               if (renameViewModelAction != null) {
-                       renameViewModelAction.refresh();
-               }
-               if (viewModelToolBarManager != null) {
-                       viewModelToolBarManager.update(true);
-               }
-               if (viewModelMenuManager != null) {
-                       viewModelMenuManager.update(true);
-               }
-       }
-       
-       public void updateBindingInfoMenus() {
-               if (removeBindingInfoAction != null) {
-                       removeBindingInfoAction.refresh();
-               }
-               if (bindingInfoToolBarManager != null) {
-                       bindingInfoToolBarManager.update(true);
-               }
-               if (bindingInfoMenuManager != null) {
-                       bindingInfoMenuManager.update(true);
-               }
-       }
-       
-       @Override
+    }
+
+    public void updateDataSourceMenus() {
+        if (removeDataSourceAction != null) {
+            removeDataSourceAction.refresh();
+        }
+        if (editDataModelAction != null) {
+            editDataModelAction.refresh();
+        }
+        if (renameDataSourceAction != null) {
+            renameDataSourceAction.refresh();
+        }
+        if (dataSourceToolBarManager != null) {
+            dataSourceToolBarManager.update(true);
+        }
+        if (dataSourceMenuManager != null) {
+            dataSourceMenuManager.update(true);
+        }
+    }
+
+    public void updateViewModelMenus() {
+        if (addViewModelItemAction != null) {
+            addViewModelItemAction.refresh();
+        }
+        if (removeViewModelAction != null) {
+            removeViewModelAction.refresh();
+        }
+        if (setTargetAction != null) {
+            setTargetAction.refresh();
+        }
+        if (getSourceAction != null) {
+            getSourceAction.refresh();
+        }
+        if (renameViewModelAction != null) {
+            renameViewModelAction.refresh();
+        }
+        if (viewModelToolBarManager != null) {
+            viewModelToolBarManager.update(true);
+        }
+        if (viewModelMenuManager != null) {
+            viewModelMenuManager.update(true);
+        }
+    }
+
+    public void updateBindingInfoMenus() {
+        if (removeBindingInfoAction != null) {
+            removeBindingInfoAction.refresh();
+        }
+        if (bindingInfoToolBarManager != null) {
+            bindingInfoToolBarManager.update(true);
+        }
+        if (bindingInfoMenuManager != null) {
+            bindingInfoMenuManager.update(true);
+        }
+    }
+
+    public boolean isShowBindInfo() {
+        return showBindInfo;
+    }
+
+    @Override
     public void setActionBars(IActionBars actionBars) {
         // register global action handlers for undo and redo
         actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoHandler);
@@ -1482,59 +1572,59 @@ public class DataBindingPage extends Page implements IBindingDataSetListener {
         actionBars.updateActionBars();
     }
 
-       @Override
-       public void allDataSourcesReseted(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void dataSourceAdded(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void dataSourceRemoved(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void dataSourceRenamed(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void dataSourceMoved(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void allViewModelReseted(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void viewModelAdded(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void viewModelRemoved(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void viewModelRenamed(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void viewModelMoved(BindingDataSetEvent e) {
-               refresh();
-       }
-
-       @Override
-       public void viewModelChanged(BindingDataSetEvent e) {
-               refresh();
-       }
-       
+    @Override
+    public void allDataSourcesReseted(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void dataSourceAdded(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void dataSourceRemoved(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void dataSourceRenamed(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void dataSourceMoved(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void allViewModelReseted(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void viewModelAdded(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void viewModelRemoved(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void viewModelRenamed(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void viewModelMoved(BindingDataSetEvent e) {
+        refresh();
+    }
+
+    @Override
+    public void viewModelChanged(BindingDataSetEvent e) {
+        refresh();
+    }
+
 }
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingTooltipParser.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/DataBindingTooltipParser.java
new file mode 100644 (file)
index 0000000..7cb4444
--- /dev/null
@@ -0,0 +1,82 @@
+
+
+package org.tizen.webuibuilder.ui.views.databinding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.activation.CommandInfo;
+
+import org.tizen.webuibuilder.ui.views.databinding.model.DataBindingTooltipData;
+
+
+public class DataBindingTooltipParser {
+    public static List<DataBindingTooltipData> parse(String txt) {
+        List<DataBindingTooltipData> list = new ArrayList<DataBindingTooltipData>();
+        DataBindingTooltipData data = null;
+        int start = 0;
+
+        while (txt.length() > 0) {
+            data = new DataBindingTooltipData();
+
+            int braceIndex = txt.indexOf("{", start);
+            int commaIndex = txt.indexOf(",", start);
+
+            if (braceIndex < 0 || commaIndex < braceIndex) {
+                txt = parseSubSet(txt, data, false);
+            } else if (braceIndex < commaIndex) {
+                int colonIndex = txt.indexOf(":");
+                String title = txt.substring(0, colonIndex).trim();
+                data.setTitle(title);
+                txt = txt.substring(braceIndex + 1, txt.length()).trim();
+                txt = parseSubSet(txt, data, true);
+            }
+            list.add(data);
+        }
+        return list;
+    }
+
+    private static String parseSubSet(String txt, DataBindingTooltipData data, boolean isSubtitle) {
+        String sample = txt;
+
+        while (true) {
+            int colonIndex = sample.indexOf(":");
+            String title = sample.substring(0, colonIndex);
+            if (isSubtitle) {
+                data.addSubTitle(title.trim());
+            } else {
+                data.setTitle(title.trim());
+            }
+            sample = sample.substring(colonIndex + 1, sample.length()).trim();
+
+            int commaIndex = sample.indexOf(",");
+            int closeBraceIndex = sample.indexOf("}");
+            if ((commaIndex < 0 && closeBraceIndex >= 0) || (closeBraceIndex < commaIndex)) {
+                String content = sample.substring(0, closeBraceIndex);
+                data.addContent(content);
+
+                sample = sample.substring(closeBraceIndex + 1, sample.length());
+                commaIndex = sample.indexOf(",");
+                if (commaIndex >= 0 && sample.length() > 0) {
+                    sample = sample.substring(commaIndex + 1, sample.length());
+                }
+                break;
+            }
+            if (commaIndex < 0) {
+                String content = sample.substring(0, sample.length()).trim();
+                data.addContent(content);
+                sample = "";
+            } else {
+                String content = sample.substring(0, commaIndex).trim();
+                data.addContent(content);
+
+                sample = sample.substring(commaIndex + 1, sample.length()).trim();
+            }
+
+            if (!isSubtitle) {
+                break;
+            }
+        }
+        return sample;
+    }
+}
index 8a1662d..33842a0 100644 (file)
@@ -199,6 +199,9 @@ public class DataBindingView extends SimplePageBookView {
 
         if (editor instanceof PageDesigner) {
             pageDesigner = (PageDesigner) editor;
+            if (null != page) {
+                pageDesigner.showBindingInfo(page.isShowBindInfo());
+            }
         } else {
             pageDesigner = null;
         }
@@ -250,12 +253,12 @@ public class DataBindingView extends SimplePageBookView {
         }
         // updateActions();
     }
-    
+
     @Override
     public void selectionChanged(IWorkbenchPart part, ISelection selection) {
-       if ((page != null) && (part != null) && (selection != null)) {
-               page.selectionChanged(part, selection);
-       }
+        if ((page != null) && (part != null) && (selection != null)) {
+            page.selectionChanged(part, selection);
+        }
     }
 
 }
\ No newline at end of file
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/actions/ShowBindingInfoAction.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/actions/ShowBindingInfoAction.java
new file mode 100644 (file)
index 0000000..304b1c2
--- /dev/null
@@ -0,0 +1,52 @@
+
+
+package org.tizen.webuibuilder.ui.views.databinding.actions;
+
+import org.eclipse.gef.ui.actions.SelectionAction;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.IPage;
+import org.tizen.webuibuilder.ui.views.databinding.DataBindingPage;
+import org.tizen.webuibuilder.ui.views.databinding.DataBindingView;
+
+
+public class ShowBindingInfoAction extends SelectionAction {
+
+    protected DataBindingView view;
+    private boolean show;
+
+    public ShowBindingInfoAction(String text, DataBindingView view) {
+        super(view);
+        setText(text);
+        this.view = view;
+        setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+    }
+
+    public void setToggle(boolean push) {
+        this.show = push;
+    }
+
+    @Override
+    protected boolean calculateEnabled() {
+        return true;
+    }
+
+    public void run() {
+        IPage page = view.getCurrentPage();
+        if (!(page instanceof DataBindingPage)) {
+            return;
+        }
+        DataBindingPage dataBindingPage = (DataBindingPage) page;
+        show = !show;
+        dataBindingPage.showDataBindingInfo(show);
+        if (show) {
+            setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                               .getImageDescriptor(ISharedImages.IMG_TOOL_BACK_HOVER));
+        } else {
+            setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
+                               .getImageDescriptor(ISharedImages.IMG_TOOL_NEW_WIZARD));
+        }
+    }
+}
diff --git a/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/model/DataBindingTooltipData.java b/org.tizen.webuibuilder/src/org/tizen/webuibuilder/ui/views/databinding/model/DataBindingTooltipData.java
new file mode 100644 (file)
index 0000000..e44e9d1
--- /dev/null
@@ -0,0 +1,43 @@
+
+
+package org.tizen.webuibuilder.ui.views.databinding.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class DataBindingTooltipData {
+    private String title = null;
+    private List<String> subTitleList = null;
+    private List<String> contentList = null;
+
+    public DataBindingTooltipData() {
+        subTitleList = new ArrayList<String>();
+        contentList = new ArrayList<String>();
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public List<String> getSubTitle() {
+        return subTitleList;
+    }
+
+    public void addSubTitle(String subTitle) {
+        subTitleList.add(subTitle);
+    }
+
+    public List<String> getContent() {
+        return contentList;
+    }
+
+    public void addContent(String content) {
+        contentList.add(content);
+    }
+
+}