Author: ruschein
Date: 2011-07-06 13:38:39 -0700 (Wed, 06 Jul 2011)
New Revision: 26072
Added:
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/RedoAction.java
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/UndoAction.java
Removed:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/RedoAction.java
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/UndoAction.java
Modified:
core3/core-task-impl/trunk/pom.xml
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
fixes #15 Moved Undo/Redo action.
Modified: core3/core-task-impl/trunk/pom.xml
===================================================================
--- core3/core-task-impl/trunk/pom.xml 2011-07-06 20:15:14 UTC (rev 26071)
+++ core3/core-task-impl/trunk/pom.xml 2011-07-06 20:38:39 UTC (rev 26072)
@@ -96,6 +96,11 @@
<dependencies>
<dependency>
<groupId>org.cytoscape</groupId>
+ <artifactId>swing-application-api</artifactId>
+ <version>3.0.0-alpha3-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.cytoscape</groupId>
<artifactId>model-api</artifactId>
<version>3.0.0-alpha5-SNAPSHOT</version>
</dependency>
Copied:
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/RedoAction.java
(from rev 26067,
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/RedoAction.java)
===================================================================
---
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/RedoAction.java
(rev 0)
+++
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/RedoAction.java
2011-07-06 20:38:39 UTC (rev 26072)
@@ -0,0 +1,99 @@
+/*
+ File: RedoAction.java
+
+ Copyright (c) 2006, 2011, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.task.internal.undo;
+
+
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.Action;
+import javax.swing.event.MenuEvent;
+import javax.swing.undo.CannotUndoException;
+import javax.swing.KeyStroke;
+
+import org.cytoscape.application.swing.AbstractCyAction;
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.work.undo.UndoSupport;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * An action that calls redo for the most recent edit in the
+ * undoable edit stack.
+ */
+public class RedoAction extends AbstractCyAction {
+ private final static long serialVersionUID = 1202339875203626L;
+
+ private final UndoSupport undo;
+ private static final Logger logger =
LoggerFactory.getLogger(RedoAction.class);
+
+ /**
+ * Constructs the action.
+ */
+ public RedoAction(UndoSupport undo, CyApplicationManager appMgr ) {
+ super("Redo",appMgr);
+ setAcceleratorKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_Y,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ setPreferredMenu("Edit");
+ setEnabled(true);
+ setMenuGravity(1.1f);
+ this.undo = undo;
+ }
+
+ /**
+ * Tries to run redo() on the top edit of the edit stack.
+ * @param e The action event that triggers this method call.
+ */
+ public void actionPerformed(ActionEvent e) {
+ try {
+ if ( undo.getUndoManager().canRedo() )
+ undo.getUndoManager().redo();
+ } catch (CannotUndoException ex) {
+ logger.warn("Unable to redo: " + ex);
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Called when the menu that contains this action is clicked on.
+ * @param e The menu event that triggers this method call.
+ */
+ public void menuSelected(MenuEvent e) {
+ if (undo.getUndoManager().canRedo()) {
+ setEnabled(true);
+ putValue(Action.NAME,
undo.getUndoManager().getRedoPresentationName());
+ } else {
+ setEnabled(false);
+ putValue(Action.NAME, "Redo");
+ }
+ }
+}
Copied:
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/UndoAction.java
(from rev 26067,
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/UndoAction.java)
===================================================================
---
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/UndoAction.java
(rev 0)
+++
core3/core-task-impl/trunk/src/main/java/org/cytoscape/task/internal/undo/UndoAction.java
2011-07-06 20:38:39 UTC (rev 26072)
@@ -0,0 +1,102 @@
+/*
+ File: UndoAction.java
+
+ Copyright (c) 2006, 2011, The Cytoscape Consortium (www.cytoscape.org)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+package org.cytoscape.task.internal.undo;
+
+
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+import javax.swing.Action;
+import javax.swing.KeyStroke;
+import javax.swing.event.MenuEvent;
+import javax.swing.undo.CannotUndoException;
+
+import org.cytoscape.application.swing.AbstractCyAction;
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.work.undo.UndoSupport;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * An action that calls undo for the most recent edit in the
+ * undoable edit stack.
+ */
+public class UndoAction extends AbstractCyAction {
+ private final static long serialVersionUID = 1202339875212525L;
+
+ private final static Logger logger =
LoggerFactory.getLogger(UndoAction.class);
+
+ private UndoSupport undo;
+
+ /**
+ * Constructs the action.
+ */
+ public UndoAction(UndoSupport undo,CyApplicationManager appMgr) {
+ super("Undo",appMgr);
+ setAcceleratorKeyStroke(
+ KeyStroke.getKeyStroke(KeyEvent.VK_Z,
Toolkit.getDefaultToolkit()
+ .getMenuShortcutKeyMask()));
+ setPreferredMenu("Edit");
+ setEnabled(true);
+ setMenuGravity(1.0f);
+ this.undo = undo;
+ }
+
+ /**
+ * Tries to run undo() on the top edit of the edit stack.
+ * @param e The action event that triggers this method call.
+ */
+ public void actionPerformed(ActionEvent e) {
+ try {
+ if ( undo.getUndoManager().canUndo() )
+ undo.getUndoManager().undo();
+ } catch (CannotUndoException ex) {
+ logger.warn("Unable to undo: " + ex);
+ ex.printStackTrace();
+ }
+ }
+
+ /**
+ * Called when the menu that contains this action is clicked on.
+ * @param e The menu event that triggers this method call.
+ */
+ public void menuSelected(MenuEvent e) {
+ if (undo.getUndoManager().canUndo()) {
+ setEnabled(true);
+ putValue(Action.NAME,
undo.getUndoManager().getUndoPresentationName());
+ } else {
+ setEnabled(false);
+ putValue(Action.NAME, "Undo");
+ }
+ }
+}
Modified:
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-07-06 20:15:14 UTC (rev 26071)
+++
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-07-06 20:38:39 UTC (rev 26072)
@@ -83,6 +83,11 @@
interface="org.cytoscape.io.write.CyTableWriterManager" />
<!-- now register our services -->
+ <osgi:service id="undoActionService" ref="undoAction"
+ interface="org.cytoscape.application.swing.CyAction" />
+ <osgi:service id="redoActionService" ref="redoAction"
+ interface="org.cytoscape.application.swing.CyAction" />
+
<osgi:service id="loadNetworkFileTaskFactoryService"
ref="loadNetworkFileTaskFactory"
interface="org.cytoscape.work.TaskFactory">
<osgi:service-properties>
Modified:
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-07-06 20:15:14 UTC (rev 26071)
+++
core3/core-task-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-07-06 20:38:39 UTC (rev 26072)
@@ -23,6 +23,16 @@
<context:annotation-config />
+ <bean id="undoAction"
class="org.cytoscape.task.internal.undo.UndoAction">
+ <constructor-arg ref="undoSupportServiceRef" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
+ <bean id="redoAction"
class="org.cytoscape.task.internal.undo.RedoAction">
+ <constructor-arg ref="undoSupportServiceRef" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
<bean id="loadAttrsFileTaskFactory"
class="org.cytoscape.task.internal.loaddatatable.LoadAttributesFileTaskFactoryImpl">
<constructor-arg ref="cyDataTableReaderManagerServiceRef" />
@@ -35,11 +45,11 @@
<constructor-arg ref="cyTableManagerServiceRef" />
</bean>
- <bean id="loadVizmapFileTaskFactory"
-
class="org.cytoscape.task.internal.loadvizmap.LoadVizmapFileTaskFactoryImpl">
- <constructor-arg ref="vizmapReaderManagerServiceRef" />
- <constructor-arg ref="visualMappingManagerServiceRef" />
- </bean>
+ <bean id="loadVizmapFileTaskFactory"
+
class="org.cytoscape.task.internal.loadvizmap.LoadVizmapFileTaskFactoryImpl">
+ <constructor-arg ref="vizmapReaderManagerServiceRef" />
+ <constructor-arg ref="visualMappingManagerServiceRef" />
+ </bean>
<bean id="loadNetworkFileTaskFactory"
class="org.cytoscape.task.internal.loadnetwork.LoadNetworkFileTaskFactoryImpl">
Deleted:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/RedoAction.java
===================================================================
---
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/RedoAction.java
2011-07-06 20:15:14 UTC (rev 26071)
+++
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/RedoAction.java
2011-07-06 20:38:39 UTC (rev 26072)
@@ -1,104 +0,0 @@
-/*
- File: RedoAction.java
-
- Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
-
- The Cytoscape Consortium is:
- - Institute for Systems Biology
- - University of California San Diego
- - Memorial Sloan-Kettering Cancer Center
- - Institut Pasteur
- - Agilent Technologies
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.internal.actions;
-
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-
-import javax.swing.Action;
-import javax.swing.event.MenuEvent;
-import javax.swing.undo.CannotUndoException;
-import javax.swing.KeyStroke;
-
-import org.cytoscape.application.swing.AbstractCyAction;
-import org.cytoscape.session.CyApplicationManager;
-import org.cytoscape.work.undo.UndoSupport;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An action that calls redo for the most recent edit in the
- * undoable edit stack.
- */
-public class RedoAction extends AbstractCyAction {
- private final static long serialVersionUID = 1202339875203626L;
-
- private final UndoSupport undo;
- private static final Logger logger =
LoggerFactory.getLogger(RedoAction.class);
-
- /**
- * Constructs the action.
- */
- public RedoAction(UndoSupport undo, CyApplicationManager appMgr ) {
- super("Redo",appMgr);
- setAcceleratorKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_Y,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
- setPreferredMenu("Edit");
- setEnabled(true);
- setMenuGravity(1.1f);
- this.undo = undo;
- }
-
- /**
- * Tries to run redo() on the top edit of the edit stack.
- * @param e The action event that triggers this method call.
- */
- public void actionPerformed(ActionEvent e) {
- try {
- if ( undo.getUndoManager().canRedo() )
- undo.getUndoManager().redo();
- } catch (CannotUndoException ex) {
- logger.warn("Unable to redo: " + ex);
- ex.printStackTrace();
- }
- }
-
- /**
- * Called when the menu that contains this action is clicked on.
- * @param e The menu event that triggers this method call.
- */
- public void menuSelected(MenuEvent e) {
- if (undo.getUndoManager().canRedo()) {
- setEnabled(true);
- putValue(Action.NAME,
undo.getUndoManager().getRedoPresentationName());
- } else {
- setEnabled(false);
- putValue(Action.NAME, "Redo");
- }
- }
-}
Deleted:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/UndoAction.java
===================================================================
---
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/UndoAction.java
2011-07-06 20:15:14 UTC (rev 26071)
+++
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/actions/UndoAction.java
2011-07-06 20:38:39 UTC (rev 26072)
@@ -1,105 +0,0 @@
-/*
- File: UndoAction.java
-
- Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
-
- The Cytoscape Consortium is:
- - Institute for Systems Biology
- - University of California San Diego
- - Memorial Sloan-Kettering Cancer Center
- - Institut Pasteur
- - Agilent Technologies
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published
- by the Free Software Foundation; either version 2.1 of the License, or
- any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
- MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
- documentation provided hereunder is on an "as is" basis, and the
- Institute for Systems Biology and the Whitehead Institute
- have no obligations to provide maintenance, support,
- updates, enhancements or modifications. In no event shall the
- Institute for Systems Biology and the Whitehead Institute
- be liable to any party for direct, indirect, special,
- incidental or consequential damages, including lost profits, arising
- out of the use of this software and its documentation, even if the
- Institute for Systems Biology and the Whitehead Institute
- have been advised of the possibility of such damage. See
- the GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
-package org.cytoscape.internal.actions;
-
-import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
-
-import javax.swing.Action;
-import javax.swing.KeyStroke;
-import javax.swing.event.MenuEvent;
-import javax.swing.undo.CannotUndoException;
-
-import org.cytoscape.application.swing.AbstractCyAction;
-import org.cytoscape.session.CyApplicationManager;
-import org.cytoscape.work.undo.UndoSupport;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An action that calls undo for the most recent edit in the
- * undoable edit stack.
- */
-public class UndoAction extends AbstractCyAction {
- private final static long serialVersionUID = 1202339875212525L;
-
- private final static Logger logger =
LoggerFactory.getLogger(UndoAction.class);
-
- private UndoSupport undo;
-
- /**
- * Constructs the action.
- */
- public UndoAction(UndoSupport undo,CyApplicationManager appMgr) {
- super("Undo",appMgr);
- setAcceleratorKeyStroke(KeyStroke.getKeyStroke(KeyEvent.VK_Z,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
- setPreferredMenu("Edit");
- setEnabled(true);
- setMenuGravity(1.0f);
- this.undo = undo;
- }
-
- /**
- * Tries to run undo() on the top edit of the edit stack.
- * @param e The action event that triggers this method call.
- */
- public void actionPerformed(ActionEvent e) {
- try {
- if ( undo.getUndoManager().canUndo() )
- undo.getUndoManager().undo();
- } catch (CannotUndoException ex) {
- logger.warn("Unable to undo: " + ex);
- ex.printStackTrace();
- }
- }
-
- /**
- * Called when the menu that contains this action is clicked on.
- * @param e The menu event that triggers this method call.
- */
- public void menuSelected(MenuEvent e) {
- if (undo.getUndoManager().canUndo()) {
- setEnabled(true);
- putValue(Action.NAME,
undo.getUndoManager().getUndoPresentationName());
- } else {
- setEnabled(false);
- putValue(Action.NAME, "Undo");
- }
- }
-}
Modified:
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-07-06 20:15:14 UTC (rev 26071)
+++
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2011-07-06 20:38:39 UTC (rev 26072)
@@ -93,10 +93,6 @@
interface="org.cytoscape.application.swing.CyAction" />
<osgi:service id="exitActionService" ref="exitAction"
interface="org.cytoscape.application.swing.CyAction" />
- <osgi:service id="undoActionService" ref="undoAction"
- interface="org.cytoscape.application.swing.CyAction" />
- <osgi:service id="redoActionService" ref="redoAction"
- interface="org.cytoscape.application.swing.CyAction" />
<osgi:service id="preferenceActionService" ref="preferenceAction"
interface="org.cytoscape.application.swing.CyAction" />
<osgi:service id="bookmarkActionService" ref="bookmarkAction"
Modified:
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-07-06 20:15:14 UTC (rev 26071)
+++
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2011-07-06 20:38:39 UTC (rev 26072)
@@ -125,14 +125,6 @@
<constructor-arg ref="cyApplicationManagerServiceRef" />
<constructor-arg ref="cytoscapeShutdown" />
</bean>
- <bean id="undoAction" class="org.cytoscape.internal.actions.UndoAction">
- <constructor-arg ref="undoSupportServiceRef" />
- <constructor-arg ref="cyApplicationManagerServiceRef" />
- </bean>
- <bean id="redoAction" class="org.cytoscape.internal.actions.RedoAction">
- <constructor-arg ref="undoSupportServiceRef" />
- <constructor-arg ref="cyApplicationManagerServiceRef" />
- </bean>
<bean id="preferenceAction"
class="org.cytoscape.internal.actions.PreferenceAction">
<constructor-arg ref="cytoscapeDesktop" />
<constructor-arg ref="cyApplicationManagerServiceRef" />
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.