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;
SWT.DOUBLE_BUFFERED));
getTimeElement().setData("RefrenceTreeItem", selectorTreeItem);
+ // action selectionProvider
+ setActionRegistryProvider();
+
// set time element
selectorTreeItem.setData("ReferentTreeWidget", getTimeElement());
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
*****************************************************************************/
this.isSelected = isSelected;
}
+ /**
+ * Get TimelineActionRegistry
+ *
+ * @return
+ */
+ public ActionRegistry getTimelineActionRegistry() {
+ return this.actionRegistry;
+ }
+
/*****************************************************************************
* Listener
*****************************************************************************/
findKeyframeComponent.selected();
}
treeElement.redraw();
- treeElement.updateAction();
+ updateAction();
}
if (selectedItem != null) {
ScrolledComposite treeContainer =
viewer.select(TimelineEditPart.this);
- AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
+ AnimatorModelManager manager =
+ AnimatorUtils.getAppManager().getAnimatorModelManager();
manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
AnimatorModelEvent.Origin.TIMELINE, model);
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();
}
case 120:
// cut (x)
action = actionRegistry.getAction("Cut");
- if(action != null) {
+ if (action != null) {
if (action.isEnabled()) {
action.run();
}
case 118:
// paste (v)
action = actionRegistry.getAction("Paste");
- if(action != null) {
+ if (action != null) {
if (action.isEnabled()) {
action.run();
}
/**********************************
* Change selection
*********************************/
- AnimatorModelManager manager = AnimatorUtils.getAppManager().getAnimatorModelManager();
+ AnimatorModelManager manager =
+ AnimatorUtils.getAppManager().getAnimatorModelManager();
manager.fireEvent(AnimatorModelEvent.EventType.SELECTION_CHANGE,
AnimatorModelEvent.Origin.TIMELINE, model);
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;
this.editpart = editpart;
initKeyFrames(selector);
- setActionRegistryProvider();
createContextMenu();
addPaintListener(latticePaintListener);
}
/**
- * 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() {
}
}
- /**
- * 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) {