public class CopyAction extends AbstractColumbaAction implements PropertyChangeListener { private JComponent focusOwner = null; public CopyAction(IFrameMediator controller) { super(controller, GlobalResourceLoader.getString(null, null, "menu_edit_copy")); // tooltip text putValue(SHORT_DESCRIPTION, GlobalResourceLoader.getString(null, null, "menu_edit_copy_tooltip").replaceAll("&", "")); // small icon for menu putValue(SMALL_ICON, ImageLoader.getSmallIcon(IconKeys.EDIT_COPY)); // large icon for toolbar putValue(LARGE_ICON, ImageLoader.getIcon(IconKeys.EDIT_COPY)); // short cut key putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); // disable toolbar text setShowToolBarText(false); setEnabled(true); putValue(Action.ACTION_COMMAND_KEY, (String) TransferHandler .getCopyAction().getValue(Action.NAME)); KeyboardFocusManager manager = KeyboardFocusManager .getCurrentKeyboardFocusManager(); manager.addPropertyChangeListener("permanentFocusOwner", this); } public void propertyChange(PropertyChangeEvent e) { Object o = e.getNewValue(); if (o instanceof JComponent) { focusOwner = (JComponent) o; setEnabled(isEnabled()); } else focusOwner = null; } /** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if (focusOwner == null) return; String action = (String) e.getActionCommand(); Action a = focusOwner.getActionMap().get(action); if (a != null) a.actionPerformed(new ActionEvent(focusOwner, ActionEvent.ACTION_PERFORMED, null)); } /** * @see org.columba.core.gui.action.AbstractColumbaAction#isSingleton() */ public boolean isSingleton() { return true
public class PasteAction extends AbstractColumbaAction implements PropertyChangeListener { private JComponent focusOwner = null; public PasteAction(IFrameMediator controller) { super(controller, GlobalResourceLoader.getString(null, null, "menu_edit_paste")); // tooltip text putValue(SHORT_DESCRIPTION, GlobalResourceLoader.getString(null, null, "menu_edit_paste_tooltip").replaceAll("&", "")); // small icon for menu putValue(SMALL_ICON, ImageLoader.getSmallIcon(IconKeys.EDIT_PASTE)); // large icon for toolbar putValue(LARGE_ICON, ImageLoader.getIcon(IconKeys.EDIT_PASTE)); // shortcut key putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); // disable toolbar text setShowToolBarText(false); setEnabled(true); putValue(Action.ACTION_COMMAND_KEY, (String) TransferHandler .getPasteAction().getValue(Action.NAME)); KeyboardFocusManager manager = KeyboardFocusManager .getCurrentKeyboardFocusManager(); manager.addPropertyChangeListener("permanentFocusOwner", this); } public void propertyChange(PropertyChangeEvent e) { Object o = e.getNewValue(); if (o instanceof JComponent) focusOwner = (JComponent) o; else focusOwner = null; } /** * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ public void actionPerformed(ActionEvent e) { if (focusOwner == null) return; String action = (String) e.getActionCommand(); Action a = focusOwner.getActionMap().get(action); if (a != null) a.actionPerformed(new ActionEvent(focusOwner, ActionEvent.ACTION_PERFORMED, null)); } /** * @see org.columba.core.gui.action.AbstractColumbaAction#isSingleton() */ public boolean isSingleton() { return true
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/globalactions/CopyAction.java File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/globalactions/PasteAction.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class CopyAction extends AbstractColumbaAction implements
1
public class PasteAction extends AbstractColumbaAction implements
2
		PropertyChangeListener {
2
		PropertyChangeListener {
3
	private JComponent focusOwner = null;
3
	private JComponent focusOwner = null;
4
	public CopyAction(IFrameMediator controller) {
4
	public PasteAction(IFrameMediator controller) {
5
		super(controller, GlobalResourceLoader.getString(null, null,
5
		super(controller, GlobalResourceLoader.getString(null, null,
6
				"menu_edit_copy"));
6
				"menu_edit_paste"));
7
		// tooltip text
7
		// tooltip text
8
		putValue(SHORT_DESCRIPTION, GlobalResourceLoader.getString(null, null,
8
		putValue(SHORT_DESCRIPTION, GlobalResourceLoader.getString(null, null,
9
				"menu_edit_copy_tooltip").replaceAll("&", ""));
9
				"menu_edit_paste_tooltip").replaceAll("&", ""));
10
		// small icon for menu
10
		// small icon for menu
11
		putValue(SMALL_ICON, ImageLoader.getSmallIcon(IconKeys.EDIT_COPY));
11
		putValue(SMALL_ICON, ImageLoader.getSmallIcon(IconKeys.EDIT_PASTE));
12
		// large icon for toolbar
12
		// large icon for toolbar
13
		putValue(LARGE_ICON, ImageLoader.getIcon(IconKeys.EDIT_COPY));
13
		putValue(LARGE_ICON, ImageLoader.getIcon(IconKeys.EDIT_PASTE));
14
		// short cut key
14
		// shortcut key
15
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_C,
15
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V,
16
				Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
16
				Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
17
		// disable toolbar text
17
		// disable toolbar text
18
		setShowToolBarText(false);
18
		setShowToolBarText(false);
19
		setEnabled(true);
19
		setEnabled(true);
20
		putValue(Action.ACTION_COMMAND_KEY, (String) TransferHandler
20
		putValue(Action.ACTION_COMMAND_KEY, (String) TransferHandler
21
				.getCopyAction().getValue(Action.NAME));
21
				.getPasteAction().getValue(Action.NAME));
22
		KeyboardFocusManager manager = KeyboardFocusManager
22
		KeyboardFocusManager manager = KeyboardFocusManager
23
				.getCurrentKeyboardFocusManager();
23
				.getCurrentKeyboardFocusManager();
24
		manager.addPropertyChangeListener("permanentFocusOwner", this);
24
		manager.addPropertyChangeListener("permanentFocusOwner", this);
25
	}
25
	}
26
	public void propertyChange(PropertyChangeEvent e) {
26
	public void propertyChange(PropertyChangeEvent e) {
27
		Object o = e.getNewValue();
27
		Object o = e.getNewValue();
28
		if (o instanceof JComponent) {
28
		if (o instanceof JComponent)
29
			focusOwner = (JComponent) o;
29
			focusOwner = (JComponent) o;
30
			
30
		
31
			setEnabled(isEnabled());
32
		}
33
		else
31
else
34
			focusOwner = null;
32
			focusOwner = null;
35
	}
33
	}
36
	/**
34
	/**
37
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
35
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
38
	 */
36
	 */
39
	public void actionPerformed(ActionEvent e) {
37
	public void actionPerformed(ActionEvent e) {
40
		if (focusOwner == null)
38
		if (focusOwner == null)
41
			return;
39
			return;
42
		String action = (String) e.getActionCommand();
40
		String action = (String) e.getActionCommand();
43
		Action a = focusOwner.getActionMap().get(action);
41
		Action a = focusOwner.getActionMap().get(action);
44
		if (a != null)
42
		if (a != null)
45
			a.actionPerformed(new ActionEvent(focusOwner,
43
			a.actionPerformed(new ActionEvent(focusOwner,
46
					ActionEvent.ACTION_PERFORMED, null));
44
					ActionEvent.ACTION_PERFORMED, null));
47
	}
45
	}
48
	/**
46
	/**
49
	 * @see org.columba.core.gui.action.AbstractColumbaAction#isSingleton()
47
	 * @see org.columba.core.gui.action.AbstractColumbaAction#isSingleton()
50
	 */
48
	 */
51
	public boolean isSingleton() {
49
	public boolean isSingleton() {
52
		return true
50
		return true
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0