JPopupMenuText.java

1
/*******************************************************************************
2
 * Copyhacked (H) 2012-2020.
3
 * This program and the accompanying materials
4
 * are made available under no term at all, use it like
5
 * you want, but share and discuss about it
6
 * every time possible with every body.
7
 * 
8
 * Contributors:
9
 *      ron190 at ymail dot com - initial implementation
10
 ******************************************************************************/
11
package com.jsql.view.swing.popupmenu;
12
13
import com.jsql.view.swing.menubar.JMenuItemWithMargin;
14
15
import javax.swing.*;
16
import javax.swing.text.DefaultEditorKit;
17
import javax.swing.text.JTextComponent;
18
import java.awt.event.InputEvent;
19
import java.awt.event.KeyEvent;
20
21
/**
22
 * Default popup menu for textfield and texteditor.
23
 */
24
public class JPopupMenuText extends JPopupMenuComponent {
25
    
26
    /**
27
     * Create popup menu for this component.
28
     * @param component The component receiving the menu
29
     */
30
    public JPopupMenuText(JTextComponent component) {
31
        
32
        super(component);
33
34 1 1. <init> : negated conditional → NO_COVERAGE
        if (component.isEditable()) {
35
            
36
            JMenuItem cutItem = new JMenuItemWithMargin();
37 1 1. <init> : removed call to javax/swing/JMenuItem::setAction → NO_COVERAGE
            cutItem.setAction(component.getActionMap().get(DefaultEditorKit.cutAction));
38 1 1. <init> : removed call to javax/swing/JMenuItem::setText → NO_COVERAGE
            cutItem.setText("Cut");
39 1 1. <init> : removed call to javax/swing/JMenuItem::setAccelerator → NO_COVERAGE
            cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_DOWN_MASK));
40 1 1. <init> : removed call to javax/swing/JMenuItem::setMnemonic → NO_COVERAGE
            cutItem.setMnemonic('t');
41
42
            JMenuItem pasteItem = new JMenuItemWithMargin();
43 1 1. <init> : removed call to javax/swing/JMenuItem::setAction → NO_COVERAGE
            pasteItem.setAction(component.getActionMap().get(DefaultEditorKit.pasteAction));
44 1 1. <init> : removed call to javax/swing/JMenuItem::setText → NO_COVERAGE
            pasteItem.setText("Paste");
45 1 1. <init> : removed call to javax/swing/JMenuItem::setAccelerator → NO_COVERAGE
            pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));
46 1 1. <init> : removed call to javax/swing/JMenuItem::setMnemonic → NO_COVERAGE
            pasteItem.setMnemonic('P');
47
48
            // Before Copy menu
49
            this.add(cutItem, 0);
50
            
51
            // After Copy menu
52
            this.add(pasteItem, 2);
53
        }
54
    }
55
}

Mutations

34

1.1
Location : <init>
Killed by : none
negated conditional → NO_COVERAGE

37

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setAction → NO_COVERAGE

38

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setText → NO_COVERAGE

39

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setAccelerator → NO_COVERAGE

40

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setMnemonic → NO_COVERAGE

43

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setAction → NO_COVERAGE

44

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setText → NO_COVERAGE

45

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setAccelerator → NO_COVERAGE

46

1.1
Location : <init>
Killed by : none
removed call to javax/swing/JMenuItem::setMnemonic → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.16.1