Author: dazarov
Date: 2008-11-11 06:18:38 -0500 (Tue, 11 Nov 2008)
New Revision: 11663
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCommandFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCopyAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutRetargetAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesDeleteAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesPasteAction.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3035
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCommandFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCommandFactory.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCommandFactory.java 2008-11-11
11:18:38 UTC (rev 11663)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.actions;
+
+import java.util.List;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.seam.ui.pages.editor.commands.PagesCompoundCommand;
+import org.jboss.tools.seam.ui.pages.editor.ecore.pages.PagesElement;
+import org.jboss.tools.seam.ui.pages.editor.edit.LinkEditPart;
+import org.jboss.tools.seam.ui.pages.editor.edit.PagesEditPart;
+
+public class PagesCommandFactory {
+
+ private static Command createCommand(List objects, String commandPath) {
+ Object source = null;
+ if (objects.isEmpty())
+ return null;
+ if ((objects.get(0) instanceof PagesEditPart) || (objects.get(0) instanceof
LinkEditPart)){
+ PagesCompoundCommand compoundCmd = new PagesCompoundCommand(commandPath);
+ for (int i = 0; i < objects.size(); i++) {
+ source = null;
+ if(objects.get(i) instanceof PagesEditPart) source =
((PagesElement)((PagesEditPart)objects.get(i)).getModel()).getData();
+ else if(objects.get(i) instanceof LinkEditPart) source =
((PagesElement)((LinkEditPart)objects.get(i)).getModel()).getData();
+ if(source != null)compoundCmd.add(source);
+ }
+ return compoundCmd;
+ } else return null;
+ }
+
+ public static Command createDeleteCommand(List objects) {
+ return createCommand(objects, "DeleteActions.Delete");
+ }
+
+ public static Command createCopyCommand(List objects) {
+ return createCommand(objects, "CopyActions.Copy");
+ }
+
+ public static Command createCutCommand(List objects) {
+ return createCommand(objects, "CopyActions.Cut");
+ }
+
+ public static Command createPasteCommand(List objects) {
+ return createCommand(objects, "CopyActions.Paste");
+ }
+
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCommandFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCopyAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCopyAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCopyAction.java 2008-11-11
11:18:38 UTC (rev 11663)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.actions;
+
+import java.util.List;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.common.gef.action.DiagramCopyAction;
+
+final public class PagesCopyAction extends DiagramCopyAction {
+
+ public PagesCopyAction(IWorkbenchPart editor) {
+ super(editor);
+ }
+
+ protected Command createCommand(List objects) {
+ return PagesCommandFactory.createCopyCommand(objects);
+ }
+
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCopyAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutAction.java 2008-11-11
11:18:38 UTC (rev 11663)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.actions;
+
+import java.util.List;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.common.gef.action.DiagramCutAction;
+
+final public class PagesCutAction extends DiagramCutAction {
+
+ public PagesCutAction(IWorkbenchPart editor) {
+ super(editor);
+ }
+
+ protected Command createCommand(List objects) {
+ return PagesCommandFactory.createCutCommand(objects);
+ }
+
+}
+
+
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutRetargetAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutRetargetAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutRetargetAction.java 2008-11-11
11:18:38 UTC (rev 11663)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * 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.actions;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.RetargetAction;
+
+/**
+ * @author Eric Bordeau
+ */
+public class PagesCutRetargetAction extends RetargetAction {
+
+ /**
+ * Constructs a new CopyRetargetAction with the default ID, label and image.
+ */
+ public PagesCutRetargetAction() {
+ super(ActionFactory.CUT.getId(), "&Copy"/* GEFMessages.CopyAction_Label
*/);
+ setImageDescriptor(getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
+ setHoverImageDescriptor(getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
+ setDisabledImageDescriptor(getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
+ }
+
+ private ImageDescriptor getImageDescriptor(String symbolicName) {
+ return WorkbenchImages.getImageDescriptor(symbolicName);
+ }
+
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesCutRetargetAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesDeleteAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesDeleteAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesDeleteAction.java 2008-11-11
11:18:38 UTC (rev 11663)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.actions;
+
+import java.util.List;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.common.gef.action.DiagramDeleteAction;
+
+final public class PagesDeleteAction extends DiagramDeleteAction {
+
+ public PagesDeleteAction(IWorkbenchPart editor) {
+ super(editor);
+ }
+
+ protected Command createCommand(List objects) {
+ return PagesCommandFactory.createDeleteCommand(objects);
+ }
+
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesDeleteAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesPasteAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesPasteAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesPasteAction.java 2008-11-11
11:18:38 UTC (rev 11663)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * 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.actions;
+
+import java.util.List;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.gef.commands.Command;
+import org.jboss.tools.common.gef.action.DiagramPasteAction;
+
+final public class PagesPasteAction extends DiagramPasteAction {
+
+ public PagesPasteAction(IWorkbenchPart editor) {
+ super(editor);
+ }
+
+ protected Command createCommand(List objects) {
+ return PagesCommandFactory.createPasteCommand(objects);
+ }
+
+}
+
+
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/actions/PagesPasteAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain