jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1203808 - in /jmeter/trunk: src/core/org/apache/jmeter/gui/action/ src/core/org/apache/jmeter/gui/tree/ src/core/org/apache/jmeter/gui/util/ src/core/org/apache/jmeter/resources/ xdocs/
Date Fri, 18 Nov 2011 19:50:17 GMT
Author: sebb
Date: Fri Nov 18 19:50:15 2011
New Revision: 1203808

URL: http://svn.apache.org/viewvc?rev=1203808&view=rev
Log:
Bug 42538 - Add "duplicate node" in context menu

Added:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java   (with props)
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionNames.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/KeyStrokes.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java
    jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java
    jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionNames.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionNames.java?rev=1203808&r1=1203807&r2=1203808&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionNames.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/ActionNames.java Fri Nov 18 19:50:15
2011
@@ -48,6 +48,8 @@ public class ActionNames {
     public static final String DEBUG_OFF        = "debug_off"; // $NON-NLS-1$
     public static final String DISABLE          = "disable"; // $NON-NLS-1$
     public static final String DRAG_ADD         = "drag_n_drop.add";//$NON-NLS-1$
+    /** Copy, then paste afterwards */
+    public static final String DUPLICATE        = "duplicate"; // $NON-NLS-1$
     public static final String EDIT             = "edit"; // $NON-NLS-1$
     public static final String ENABLE           = "enable"; // $NON-NLS-1$
     public static final String EXIT             = "exit"; // $NON-NLS-1$

Added: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java?rev=1203808&view=auto
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java (added)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java Fri Nov 18 19:50:15
2011
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/*
+ * Created on Apr 9, 2003
+ *
+ * Clones a JMeterTreeNode
+ */
+package org.apache.jmeter.gui.action;
+
+import java.awt.event.ActionEvent;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jmeter.gui.GuiPackage;
+import org.apache.jmeter.gui.tree.JMeterTreeListener;
+import org.apache.jmeter.gui.tree.JMeterTreeModel;
+import org.apache.jmeter.gui.tree.JMeterTreeNode;
+
+/**
+ * Implements the Duplicate menu command
+ */
+public class Duplicate extends AbstractAction {
+
+    private static final HashSet<String> commands = new HashSet<String>();
+
+    static {
+        commands.add(ActionNames.DUPLICATE);
+    }
+
+    /*
+     * @see org.apache.jmeter.gui.action.Command#getActionNames()
+     */
+    @Override
+    public Set<String> getActionNames() {
+        return commands;
+    }
+
+    @Override
+    public void doAction(ActionEvent e) {
+        GuiPackage instance = GuiPackage.getInstance();
+        JMeterTreeListener treeListener = instance.getTreeListener();
+        JMeterTreeNode[] copiedNodes = Copy.cloneTreeNodes(treeListener.getSelectedNodes());
+        JMeterTreeNode currentNode = treeListener.getCurrentNode();
+        JMeterTreeNode parentNode = (JMeterTreeNode) currentNode.getParent();
+        JMeterTreeModel treeModel = instance.getTreeModel();
+        for (int i = 0; i < copiedNodes.length; i++) {
+            int index = parentNode.getIndex(currentNode) + 1;
+            treeModel.insertNodeInto(copiedNodes[i], parentNode, index);
+        }
+        instance.getMainFrame().repaint();
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Duplicate.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/KeyStrokes.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/KeyStrokes.java?rev=1203808&r1=1203807&r2=1203808&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/KeyStrokes.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/KeyStrokes.java Fri Nov 18 19:50:15
2011
@@ -36,6 +36,7 @@ public final class KeyStrokes {
     private static final int CONTROL_MASK =Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
 
     public static final KeyStroke COPY              = KeyStroke.getKeyStroke(KeyEvent.VK_C,
CONTROL_MASK);
+    public static final KeyStroke DUPLICATE         = KeyStroke.getKeyStroke(KeyEvent.VK_C,
CONTROL_MASK | KeyEvent.SHIFT_DOWN_MASK);
     public static final KeyStroke DEBUG_OFF         = KeyStroke.getKeyStroke(KeyEvent.VK_D,
CONTROL_MASK);
     public static final KeyStroke DEBUG_ON          = KeyStroke.getKeyStroke(KeyEvent.VK_D,
CONTROL_MASK | KeyEvent.SHIFT_DOWN_MASK);
     public static final KeyStroke CLEAR_ALL         = KeyStroke.getKeyStroke(KeyEvent.VK_E,
CONTROL_MASK);

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java?rev=1203808&r1=1203807&r2=1203808&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/tree/JMeterTreeListener.java Fri Nov 18 19:50:15
2011
@@ -283,14 +283,15 @@ public class JMeterTreeListener implemen
         if (KeyStrokes.matches(e,KeyStrokes.COPY)) {
             ActionRouter actionRouter = ActionRouter.getInstance();
             actionRouter.doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.COPY));
-        }
-        if (KeyStrokes.matches(e,KeyStrokes.PASTE)) {
+        } else if (KeyStrokes.matches(e,KeyStrokes.PASTE)) {
             ActionRouter actionRouter = ActionRouter.getInstance();
             actionRouter.doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.PASTE));
-        }
-        if (KeyStrokes.matches(e,KeyStrokes.CUT)) {
+        } else if (KeyStrokes.matches(e,KeyStrokes.CUT)) {
             ActionRouter actionRouter = ActionRouter.getInstance();
             actionRouter.doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.CUT));
+        } else if (KeyStrokes.matches(e,KeyStrokes.DUPLICATE)) {
+            ActionRouter actionRouter = ActionRouter.getInstance();
+            actionRouter.doActionNow(new ActionEvent(e.getSource(), e.getID(), ActionNames.DUPLICATE));
         }
     }
 

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java?rev=1203808&r1=1203807&r2=1203808&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/util/MenuFactory.java Fri Nov 18 19:50:15
2011
@@ -180,6 +180,7 @@ public final class MenuFactory {
         }
         menu.add(makeMenuItemRes("copy", ActionNames.COPY, KeyStrokes.COPY));  //$NON-NLS-1$
         menu.add(makeMenuItemRes("paste", ActionNames.PASTE, KeyStrokes.PASTE)); //$NON-NLS-1$
+        menu.add(makeMenuItemRes("duplicate", ActionNames.DUPLICATE, KeyStrokes.DUPLICATE));
 //$NON-NLS-1$
         menu.add(makeMenuItemRes("reset_gui", ActionNames.RESET_GUI )); //$NON-NLS-1$
         if (removable) {
             menu.add(makeMenuItemRes("remove", ActionNames.REMOVE, KeyStrokes.REMOVE)); //$NON-NLS-1$

Modified: jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1203808&r1=1203807&r2=1203808&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Fri Nov 18 19:50:15
2011
@@ -196,6 +196,7 @@ dn=DN
 domain=Domain
 done=Done
 down=Down
+duplicate=Duplicate
 duration=Duration (seconds)
 duration_assertion_duration_test=Duration to Assert
 duration_assertion_failure=The operation lasted too long\: It took {0} milliseconds, but
should not have lasted longer than {1} milliseconds.

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1203808&r1=1203807&r2=1203808&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Nov 18 19:50:15 2011
@@ -215,6 +215,7 @@ This behaviour can be changed with prope
 <li>Bug 51886 - SampleSender configuration resolved partly on client and partly on
server</li>
 <li>Bug 52161 - Enable plugins to add own translation rules in addition to upgrade.properties.
 Loads any additional properties found in META-INF/resources/org.apache.jmeter.nameupdater.properties
files</li>
+<li>Bug 42538 - Add "duplicate node" in context menu</li>
 </ul>
 
 <h2>Non-functional changes</h2>



Mime
View raw message