blob: 062ef060e88b962e62496542ea68aa034e9e5c73 (
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) 2012 Alexej Strelzow.
* 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:
* Alexej Strelzow - initial API and implementation
******************************************************************************/
package org.eclipse.babel.editor.tree.actions;
import org.eclipse.babel.core.message.manager.RBManager;
import org.eclipse.babel.core.message.tree.internal.KeyTreeNode;
import org.eclipse.babel.editor.internal.AbstractMessagesEditor;
import org.eclipse.babel.editor.plugin.MessagesEditorPlugin;
import org.eclipse.babel.editor.util.UIUtils;
import org.eclipse.jface.viewers.TreeViewer;
/**
* An action, which triggers the refactoring of message keys.
*
* @author Alexej Strelzow
*/
public class RefactorKeyAction extends AbstractTreeAction {
/**
* Constructor.
*
* @param editor
* The {@link MessagesEditor}
* @param treeViewer
* The {@link TreeViewer}
*/
public RefactorKeyAction(AbstractMessagesEditor editor,
TreeViewer treeViewer) {
super(editor, treeViewer);
setText(MessagesEditorPlugin.getString("key.refactor") + " ..."); //$NON-NLS-1$
setImageDescriptor(UIUtils
.getImageDescriptor(UIUtils.IMAGE_REFACTORING));
setToolTipText("Refactor the name of the key");
}
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
KeyTreeNode node = getNodeSelection();
String key = node.getMessageKey();
String bundleId = node.getMessagesBundleGroup().getResourceBundleId();
String projectName = node.getMessagesBundleGroup().getProjectName();
RBManager.getRefactorService().openRefactorDialog(projectName,
bundleId, key, null);
}
}
|