ANIMATOR : Fixed animator initialization 87/20687/2
authorjinwooim.bae <jinwooim.bae@samsung.com>
Mon, 12 May 2014 05:28:41 +0000 (14:28 +0900)
committerjinwooim.bae <jinwooim.bae@samsung.com>
Mon, 12 May 2014 06:33:47 +0000 (15:33 +0900)
This is fixing animator initialization.

Change-Id: I1d08120afd4222ac899bae1821c5ee1b3f96d2f9
Signed-off-by: jinwooim.bae <jinwooim.bae@samsung.com>
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/TimelinePage.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/editpart/TimelineEditPart.java
org.tizen.webuibuilder/src/org/tizen/webuibuilder/animator/ui/views/timeline/tree/TimeTreeElement.java

index e91d22d..eaa2604 100644 (file)
@@ -129,8 +129,6 @@ public class TimelinePage extends ContentOutlinePage {
         id = ActionFactory.REDO.getId();
         timelineActionRegistry.registerAction(getActionRegistry().getAction(id));
 
-        initAction();
-
     }
 
     /*
@@ -213,8 +211,8 @@ public class TimelinePage extends ContentOutlinePage {
         mainContainerFormData.right = new FormAttachment(100);
         getMainContainer().setLayoutData(mainContainerFormData);
 
+        initAction();
         initViewer();
-
         initPage();
 
     }
@@ -273,7 +271,7 @@ public class TimelinePage extends ContentOutlinePage {
 
         action = new CutKeyFrameAction("Cut", getViewer());
         timelineActionRegistry.registerAction(action);
-        
+
         action = new PasteKeyFrameAction("Paste", getViewer());
         timelineActionRegistry.registerAction(action);
 
index 4dece40..e97ee6d 100644 (file)
 package org.tizen.webuibuilder.animator.ui.views.timeline.editpart;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.gef.EditPart;
 import org.eclipse.gef.TreeEditPart;
 import org.eclipse.gef.editparts.AbstractTreeEditPart;
 import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.SelectionAction;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.ScrolledComposite;
@@ -351,6 +353,9 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                                            SWT.DOUBLE_BUFFERED));
         getTimeElement().setData("RefrenceTreeItem", selectorTreeItem);
 
+        // action selectionProvider
+        setActionRegistryProvider();
+
         // set time element
         selectorTreeItem.setData("ReferentTreeWidget", getTimeElement());
 
@@ -485,6 +490,33 @@ public class TimelineEditPart extends AbstractTreeEditPart {
         widgetElement.setAppliedAnimationInfos((AnimatorWidget) widget);
     }
 
+    /**
+     * Set ActionRegistryProvider
+     */
+    private void setActionRegistryProvider() {
+        Iterator iter = actionRegistry.getActions();
+        while (iter.hasNext()) {
+            IAction action = (IAction) iter.next();
+            if (action instanceof SelectionAction) {
+                ((SelectionAction) action).setSelectionProvider(getTimeElement());
+            }
+        }
+    }
+
+    /**
+     * Update Action
+     */
+    public void updateAction() {
+
+        Iterator iter = actionRegistry.getActions();
+        while (iter.hasNext()) {
+            IAction action = (IAction) iter.next();
+            if (action instanceof SelectionAction) {
+                ((SelectionAction) action).update();
+            }
+        }
+    }
+
     /*****************************************************************************
      * Getter, Setter
      *****************************************************************************/
@@ -604,6 +636,15 @@ public class TimelineEditPart extends AbstractTreeEditPart {
         this.isSelected = isSelected;
     }
 
+    /**
+     * Get TimelineActionRegistry
+     * 
+     * @return
+     */
+    public ActionRegistry getTimelineActionRegistry() {
+        return this.actionRegistry;
+    }
+
     /*****************************************************************************
      * Listener
      *****************************************************************************/
@@ -669,7 +710,7 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                         findKeyframeComponent.selected();
                     }
                     treeElement.redraw();
-                    treeElement.updateAction();
+                    updateAction();
                 }
                 if (selectedItem != null) {
                     ScrolledComposite treeContainer =
@@ -683,7 +724,8 @@ public class TimelineEditPart extends AbstractTreeEditPart {
 
                     viewer.select(TimelineEditPart.this);
 
-                    AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
+                    AnimatorModelManager manager =
+                            AnimatorUtils.getAppManager().getAnimatorModelManager();
                     manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
                                       AnimatorModelEvent.Origin.TIMELINE, model);
 
@@ -703,16 +745,16 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                         case 107:
                             // add keyframe (k)
                             action = actionRegistry.getAction("Add");
-                            if(action != null) {
+                            if (action != null) {
                                 if (action.isEnabled()) {
                                     action.run();
                                 }
-                           }
+                            }
                             break;
                         case 99:
                             // copy (c)
                             action = actionRegistry.getAction("Copy");
-                            if(action != null) {
+                            if (action != null) {
                                 if (action.isEnabled()) {
                                     action.run();
                                 }
@@ -721,7 +763,7 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                         case 120:
                             // cut (x)
                             action = actionRegistry.getAction("Cut");
-                            if(action != null) {
+                            if (action != null) {
                                 if (action.isEnabled()) {
                                     action.run();
                                 }
@@ -730,7 +772,7 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                         case 118:
                             // paste (v)
                             action = actionRegistry.getAction("Paste");
-                            if(action != null) {
+                            if (action != null) {
                                 if (action.isEnabled()) {
                                     action.run();
                                 }
@@ -977,7 +1019,8 @@ public class TimelineEditPart extends AbstractTreeEditPart {
                 /**********************************
                  * Change selection
                  *********************************/
-                AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
+                AnimatorModelManager manager =
+                        AnimatorUtils.getAppManager().getAnimatorModelManager();
                 manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
                                   AnimatorModelEvent.Origin.TIMELINE, model);
 
index 6f2f32b..e7de633 100644 (file)
 package org.tizen.webuibuilder.animator.ui.views.timeline.tree;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.ui.actions.SelectionAction;
-import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -118,7 +115,6 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
         this.editpart = editpart;
 
         initKeyFrames(selector);
-        setActionRegistryProvider();
         createContextMenu();
 
         addPaintListener(latticePaintListener);
@@ -212,19 +208,6 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
     }
 
     /**
-     * Set ActionRegistryProvider
-     */
-    private void setActionRegistryProvider() {
-        Iterator iter = editpart.getViewer().getPage().getTimelineActionRegistry().getActions();
-        while (iter.hasNext()) {
-            IAction action = (IAction) iter.next();
-            if (action instanceof SelectionAction) {
-                ((SelectionAction) action).setSelectionProvider(this);
-            }
-        }
-    }
-
-    /**
      * Create ContextMenu
      */
     private void createContextMenu() {
@@ -703,21 +686,6 @@ public class TimeTreeElement extends Canvas implements ISelectionProvider {
         }
     }
 
-    /**
-     * Update Action
-     */
-    public void updateAction() {
-
-        Iterator iter = editpart.getViewer().getPage().getTimelineActionRegistry().getActions();
-        while (iter.hasNext()) {
-            IAction action = (IAction) iter.next();
-            if (action instanceof SelectionAction) {
-                ((SelectionAction) action).update();
-            }
-        }
-
-    }
-
     private PaintListener latticePaintListener = new PaintListener() {
         @Override
         public void paintControl(PaintEvent e) {