Author: dazarov
Date: 2008-11-11 06:19:01 -0500 (Tue, 11 Nov 2008)
New Revision: 11664
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/PagesCompoundCommand.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3035
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java 2008-11-11
11:18:38 UTC (rev 11663)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/PagesEditor.java 2008-11-11
11:19:01 UTC (rev 11664)
@@ -96,6 +96,10 @@
import org.jboss.tools.seam.pages.xml.model.helpers.SeamPagesDiagramStructureHelper;
import org.jboss.tools.seam.ui.pages.SeamUIPagesMessages;
import org.jboss.tools.seam.ui.pages.SeamUiPagesPlugin;
+import org.jboss.tools.seam.ui.pages.editor.actions.PagesCopyAction;
+import org.jboss.tools.seam.ui.pages.editor.actions.PagesCutAction;
+import org.jboss.tools.seam.ui.pages.editor.actions.PagesDeleteAction;
+import org.jboss.tools.seam.ui.pages.editor.actions.PagesPasteAction;
import org.jboss.tools.seam.ui.pages.editor.dnd.FileTransferDropTargetListener;
import org.jboss.tools.seam.ui.pages.editor.dnd.PagesTemplateTransferDropTargetListener;
import org.jboss.tools.seam.ui.pages.editor.dnd.XModelTransferDropTargetListener;
@@ -457,10 +461,10 @@
}
protected void createActions() {
-// register(new JSFDeleteAction(this), true, false);
-// register(new JSFCopyAction(this), true, false);
-// register(new JSFPasteAction(this), true, false);
-// register(new JSFCutAction(this), true, false);
+ register(new PagesDeleteAction(this), true, false);
+ register(new PagesCopyAction(this), true, false);
+ register(new PagesPasteAction(this), true, false);
+ register(new PagesCutAction(this), true, false);
//register(new MyPrintAction(this), false, true);
register(new DiagramAlignmentAction(this, PositionConstants.LEFT), true, false);
register(new DiagramAlignmentAction(this, PositionConstants.RIGHT), true, false);
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/PagesCompoundCommand.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/PagesCompoundCommand.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/PagesCompoundCommand.java 2008-11-11
11:19:01 UTC (rev 11664)
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.pages.editor.commands;
+
+import java.util.*;
+
+import org.jboss.tools.common.model.ui.dnd.DnDUtil;
+import org.eclipse.gef.commands.Command;
+
+import org.jboss.tools.common.meta.action.XAction;
+import org.jboss.tools.common.meta.action.XActionInvoker;
+import org.jboss.tools.common.model.XModelObject;
+
+public class PagesCompoundCommand extends Command {
+ private List<Object> elements = new ArrayList<Object>();
+ private String actionName;
+
+ public PagesCompoundCommand(String actionName) {
+ super();
+ this.actionName = actionName;
+ }
+
+ public boolean canExecute() {
+ if(elements.size() > 0){
+ XModelObject[] objects = (XModelObject[])elements.toArray(new XModelObject[]{});
+ XModelObject object= objects[0];
+ if(elements.size() == 1) objects = null;
+ XAction action = DnDUtil.getEnabledAction(object, objects, actionName);
+ if(action != null) return true;
+ }
+ return false;
+ }
+
+ public boolean canUndo() {
+ return false;
+ }
+
+ public void add(Object element){
+ elements.add(element);
+ }
+
+ public void execute() {
+ XModelObject[] objects = (XModelObject[])elements.toArray(new XModelObject[]{});
+ XModelObject object= objects[0];
+ if(elements.size() == 1) objects = null;
+ XActionInvoker.invoke(actionName, object, objects, null);
+ }
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/commands/PagesCompoundCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain