Project

General

Profile

« Previous | Next » 

Revision ae137b34

Added by Patrick Plitzner about 7 years ago

ref #4611 some l10n for taxeditor and taxeditor.editor plugin

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/handler/DeleteNodeHandler.java
22 22

  
23 23
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
24 24
import eu.etaxonomy.taxeditor.editor.EditorUtil;
25
import eu.etaxonomy.taxeditor.editor.Messages;
25 26
import eu.etaxonomy.taxeditor.editor.key.KeyEditor;
26 27
import eu.etaxonomy.taxeditor.editor.key.polytomous.IPolytomousKeyEditorPage;
27 28
import eu.etaxonomy.taxeditor.editor.key.polytomous.PolytomousKeyEditorLabels;
28 29
import eu.etaxonomy.taxeditor.editor.key.polytomous.operation.DeleteNodeOperation;
30
import eu.etaxonomy.taxeditor.model.AbstractUtility;
29 31
import eu.etaxonomy.taxeditor.model.MessagingUtils;
30 32
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
31 33

  
......
37 39
public class DeleteNodeHandler extends AbstractPolytomousKeyNodeHandler {
38 40

  
39 41

  
42
    private static final String DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE = Messages.DeleteNodeHandler_REALLY_DELETE;
43
    private static final String CONFIRM_DELETION_OF_CHILDREN = Messages.DeleteNodeHandler_CONFIRM_DELETE;
44
    private static final String NO = Messages.DeleteNodeHandler_NO;
45
    private static final String CANCEL = Messages.DeleteNodeHandler_CANCEL;
46
    private static final String YES = Messages.DeleteNodeHandler_YES;
40 47
    PolytomousKeyNode nodeToBeDeleted;
41 48
    boolean deleteChildren;
42 49
    /**
......
76 83
                nodeToBeDeleted = node;
77 84
                MessageDialog dialog;
78 85
                if (node.getChildren().size()>0){
79
                    String[] buttonLables = {"Yes", "No","Cancel"};
80
                    dialog = new MessageDialog(null, "Confirm deletion of children", null, "Do you really want to delete the node. This operation is not reversable. The selected node has children, do you want to delete them, too?", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
86
                    String[] buttonLables = {YES, NO,CANCEL};
87
                    dialog = new MessageDialog(null, CONFIRM_DELETION_OF_CHILDREN, null, DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE+Messages.DeleteNodeHandler_NODE_HAS_CHILDREN, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
81 88
                    int returnCode = dialog.open();
82 89

  
83 90
                    if (returnCode == 0){
......
85 92
                    } else if (returnCode == 1){
86 93
                        deleteChildren = true;
87 94
                    } else{
88
                        return new Status(IStatus.CANCEL, "unknown",
95
                        return new Status(IStatus.CANCEL, "unknown", //$NON-NLS-1$
89 96
                                null);
90 97
                    }
91 98

  
92 99

  
93 100
                }else{
94
                    String[] buttonLables = {"Yes", "Cancel"};
95
                    dialog = new MessageDialog(null, "Confirm deletion of children", null, "Do you really want to delete the node. This operation is not reversable.", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 1);
101
                    String[] buttonLables = {YES, CANCEL};
102
                    dialog = new MessageDialog(null, CONFIRM_DELETION_OF_CHILDREN, null, DO_YOU_REALLY_WANT_TO_DELETE_THE_NODE_THIS_OPERATION_IS_NOT_REVERSABLE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 1);
96 103
                    int returnCode = dialog.open();
97 104

  
98 105
                    if (returnCode == 0){
99 106
                        deleteChildren = false;
100 107
                    } else if (returnCode == 1){
101
                       return new Status(IStatus.CANCEL, "unknown",
108
                       return new Status(IStatus.CANCEL, "unknown", //$NON-NLS-1$
102 109
                                null);
103 110
                    }
104 111
                }
......
107 114

  
108 115

  
109 116
            } catch (NotDefinedException e) {
110
                MessagingUtils.warn(getClass(), "Command name not set.");
117
                MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
111 118
            }
112 119
        } else {
113 120
                MessageDialog.openInformation(
114
                        EditorUtil.getShell(),
115
                        "No Key Node Selected",
116
                        "Please right-click on a specific key node to delete a key node.");
121
                        AbstractUtility.getShell(),
122
                        PolytomousKeyEditorLabels.NO_KEY_NODE_SELECTED,
123
                        PolytomousKeyEditorLabels.NO_KEY_NODE_FOR_INSERT_NODE_SELECTED_MESSAGE
124
                        );
117 125
        }
118 126

  
119 127
        return Status.OK_STATUS;
......
125 133
    @Override
126 134
    public AbstractOperation prepareOperation(ExecutionEvent event) {
127 135
        IUndoContext undoContext = EditorUtil.getUndoContext();
128
        String label = "";
136
        String label = ""; //$NON-NLS-1$
129 137
        IEditorPart editor = HandlerUtil.getActiveEditor(event);
130 138
        if (editor.isDirty()){
131 139
            boolean proceed = MessageDialog.openQuestion(null,
132
                    "Save changes", "You have made changes that must be saved before you can delete the node. Would you like to proceed?");
140
                    Messages.DeleteNodeHandler_SAVE_CHANGES_TITLE, Messages.DeleteNodeHandler_SAVE_CHANGES_MESSAGE);
133 141
            if (!proceed) {
134 142
                return null;
135 143
            }else{
......
140 148
        try {
141 149
            label = event.getCommand().getName();
142 150
        } catch (NotDefinedException e) {
143
            MessagingUtils.warn(getClass(), "Command name not set.");
151
            MessagingUtils.warn(getClass(), "Command name not set."); //$NON-NLS-1$
144 152
        }
145 153
        DeleteNodeOperation operation ;
146 154
        if (deleteChildren){

Also available in: Unified diff