Skip to main content
summaryrefslogtreecommitdiffstats
blob: add1ff9084d262ea6e2e598df1c94ae7140e99c7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*******************************************************************************
 * Copyright (c) 2007 Pascal Essiembre.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Pascal Essiembre - initial API and implementation
 ******************************************************************************/
package org.eclipse.babel.editor.tree.actions;

import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
import org.eclipse.babel.editor.internal.MessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.refactoring.RenameKeyProcessor;
import org.eclipse.babel.editor.refactoring.RenameKeyWizard;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;

/**
 * @author Pascal Essiembre
 * 
 */
public class RenameKeyAction extends AbstractTreeAction {

    /**
     * 
     */
    public RenameKeyAction(MessagesEditor editor, TreeViewer treeViewer) {
        super(editor, treeViewer);
        setText(MessagesEditorPlugin.getString("key.rename") + " ..."); //$NON-NLS-1$
        setImageDescriptor(UIUtils.getImageDescriptor(UIUtils.IMAGE_RENAME));
        setToolTipText("TODO put something here"); // TODO put tooltip
    }

    /**
     * @see org.eclipse.jface.action.Action#run()
     */
    @Override
    public void run() {
        KeyTreeNode node = getNodeSelection();

        // Rename single item
        RenameKeyProcessor refactoring = new RenameKeyProcessor(node,
                getBundleGroup());

        RefactoringWizard wizard = new RenameKeyWizard(node, refactoring);
        try {
            RefactoringWizardOpenOperation operation = new RefactoringWizardOpenOperation(
                    wizard);
            operation.run(getShell(), "Introduce Indirection");
        } catch (InterruptedException exception) {
            // Do nothing
        }
    }
}

Back to the top