Lines 7-12
Link Here
|
7 |
* |
7 |
* |
8 |
* Contributors: |
8 |
* Contributors: |
9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* Benjamin Cabe <benjamin.cabe@anyware-tech.com> - bug 219852 |
10 |
*******************************************************************************/ |
11 |
*******************************************************************************/ |
11 |
package org.eclipse.pde.internal.ui.refactoring; |
12 |
package org.eclipse.pde.internal.ui.refactoring; |
12 |
|
13 |
|
Lines 101-110
Link Here
|
101 |
BundleModel model = (BundleModel) bundle.getModel(); |
102 |
BundleModel model = (BundleModel) bundle.getModel(); |
102 |
BundleTextChangeListener listener = new BundleTextChangeListener(model.getDocument()); |
103 |
BundleTextChangeListener listener = new BundleTextChangeListener(model.getDocument()); |
103 |
bundle.getModel().addModelChangedListener(listener); |
104 |
bundle.getModel().addModelChangedListener(listener); |
|
|
105 |
boolean localizationRenamed = false; |
104 |
for (int i = 0; i < elements.length; i++) { |
106 |
for (int i = 0; i < elements.length; i++) { |
105 |
Object element = elements[i]; |
107 |
Object element = elements[i]; |
106 |
String newText = newTexts[i]; |
108 |
String newText = newTexts[i]; |
107 |
if (element instanceof IType) { |
109 |
if (element instanceof IFile) { |
|
|
110 |
String fileName = ((IFile) element).getProjectRelativePath().toString(); |
111 |
if (!localizationRenamed && fileName.endsWith(".properties")) { //$NON-NLS-1$ |
112 |
String oldText = fileName.substring(0, fileName.lastIndexOf(".")); //$NON-NLS-1$ |
113 |
String oldLocalization = bundle.getLocalization(); |
114 |
if (oldText.equals(oldLocalization)) { |
115 |
renameLocalization(bundle, oldText, newText); |
116 |
localizationRenamed = true; |
117 |
} |
118 |
} |
119 |
} else if (element instanceof IType) { |
108 |
String oldText = ((IType) element).getFullyQualifiedName('$'); |
120 |
String oldText = ((IType) element).getFullyQualifiedName('$'); |
109 |
resetHeaderValue(bundle.getManifestHeader(Constants.BUNDLE_ACTIVATOR), false, oldText, newText); |
121 |
resetHeaderValue(bundle.getManifestHeader(Constants.BUNDLE_ACTIVATOR), false, oldText, newText); |
110 |
resetHeaderValue(bundle.getManifestHeader(ICoreConstants.PLUGIN_CLASS), false, oldText, newText); |
122 |
resetHeaderValue(bundle.getManifestHeader(ICoreConstants.PLUGIN_CLASS), false, oldText, newText); |
Lines 140-145
Link Here
|
140 |
return null; |
152 |
return null; |
141 |
} |
153 |
} |
142 |
|
154 |
|
|
|
155 |
private static void renameLocalization(Bundle bundle, String oldText, String newText) { |
156 |
if (newText.endsWith(".properties")) //$NON-NLS-1$ |
157 |
bundle.setLocalization(newText.substring(0, newText.lastIndexOf("."))); //$NON-NLS-1$ |
158 |
else |
159 |
bundle.setLocalization(null); |
160 |
} |
161 |
|
143 |
private static void resetHeaderValue(IManifestHeader header, boolean isPackage, String oldText, String newText) { |
162 |
private static void resetHeaderValue(IManifestHeader header, boolean isPackage, String oldText, String newText) { |
144 |
if (header != null) { |
163 |
if (header != null) { |
145 |
String value = header.getValue(); |
164 |
String value = header.getValue(); |
Lines 209-213
Link Here
|
209 |
model.load(); |
228 |
model.load(); |
210 |
return model.isLoaded() ? (Bundle) model.getBundle() : null; |
229 |
return model.isLoaded() ? (Bundle) model.getBundle() : null; |
211 |
} |
230 |
} |
212 |
|
|
|
213 |
} |
231 |
} |