Skip to main content
summaryrefslogtreecommitdiffstats
blob: ba647968433efdfe3bee30506459189dcb9124cc (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*******************************************************************************
 * Copyright (c) 2009 Nigel Westbury
 * 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:
 *    Nigel Westbury - initial implementation
 ******************************************************************************/
package org.eclipse.babel.editor.refactoring;

import org.eclipse.core.runtime.Assert;
import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;

/**
 * This class contains the data that a processor provides to its rename resource
 * bundle key participants.
 */
public class RenameKeyArguments extends RefactoringArguments {

    private String fNewName;

    private boolean fRenameChildKeys;

    private boolean fUpdateReferences;

    /**
     * Creates new rename arguments.
     * 
     * @param newName
     *            the new name of the element to be renamed
     * @param renameChildKeys
     *            <code>true</code> if child keys are to be renamed;
     *            <code>false</code> otherwise
     * @param updateReferences
     *            <code>true</code> if reference updating is requested;
     *            <code>false</code> otherwise
     */
    public RenameKeyArguments(String newName, boolean renameChildKeys,
            boolean updateReferences) {
        Assert.isNotNull(newName);
        fNewName = newName;
        fRenameChildKeys = renameChildKeys;
        fUpdateReferences = updateReferences;
    }

    /**
     * Returns the new element name.
     * 
     * @return the new element name
     */
    public String getNewName() {
        return fNewName;
    }

    /**
     * Returns whether child keys are to be renamed or not.
     * 
     * @return returns <code>true</code> if child keys are to be renamed;
     *         <code>false</code> otherwise
     */
    public boolean getRenameChildKeys() {
        return fRenameChildKeys;
    }

    /**
     * Returns whether reference updating is requested or not.
     * 
     * @return returns <code>true</code> if reference updating is requested;
     *         <code>false</code> otherwise
     */
    public boolean getUpdateReferences() {
        return fUpdateReferences;
    }

    public String toString() {
        return "rename to " + fNewName //$NON-NLS-1$
                + (fRenameChildKeys ? " (rename child keys)" : " (don't rename child keys)") //$NON-NLS-1$//$NON-NLS-2$
                + (fUpdateReferences ? " (update references)" : " (don't update references)"); //$NON-NLS-1$//$NON-NLS-2$
    }
}

Back to the top