View | Details | Raw Unified | Return to bug 219852 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/ui/refactoring/ResourceMoveParticipant.java (+8 lines)
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 16-21 Link Here
16
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.core.runtime.IProgressMonitor;
17
import org.eclipse.ltk.core.refactoring.Change;
18
import org.eclipse.ltk.core.refactoring.Change;
18
import org.eclipse.ltk.core.refactoring.CompositeChange;
19
import org.eclipse.ltk.core.refactoring.CompositeChange;
20
import org.eclipse.pde.internal.core.ICoreConstants;
19
import org.eclipse.pde.internal.core.WorkspaceModelManager;
21
import org.eclipse.pde.internal.core.WorkspaceModelManager;
20
22
21
public abstract class ResourceMoveParticipant extends PDEMoveParticipant {
23
public abstract class ResourceMoveParticipant extends PDEMoveParticipant {
Lines 64-69 Link Here
64
			if (change != null)
66
			if (change != null)
65
				result.add(change);
67
				result.add(change);
66
		}
68
		}
69
		file = fProject.getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
70
		if (file.exists()) {
71
			Change change = BundleManifestChange.createRenameChange(file, fElements.keySet().toArray(), getNewNames(), pm);
72
			if (change != null)
73
				result.add(change);
74
		}
67
	}
75
	}
68
76
69
}
77
}
(-)src/org/eclipse/pde/internal/ui/refactoring/BuildPropertiesChange.java (-1 / +1 lines)
Lines 48-54 Link Here
48
					if (affectedElements[i] instanceof IJavaElement)
48
					if (affectedElements[i] instanceof IJavaElement)
49
						continue;
49
						continue;
50
					IResource res = (IResource) affectedElements[i];
50
					IResource res = (IResource) affectedElements[i];
51
					// if resource instanceof IProject, then the project is being renamed and there is no action to do in the build.properties for the resource// if resource instanceof IProject, then the project is being renamed and there is no action to do in the build.properties for the resource
51
					// if resource instanceof IProject, then the project is being renamed and there is no action to do in the build.properties for the resource
52
					if (res instanceof IProject)
52
					if (res instanceof IProject)
53
						continue;
53
						continue;
54
					for (int j = 0; j < entries.length; j++) {
54
					for (int j = 0; j < entries.length; j++) {
(-)src/org/eclipse/pde/internal/ui/refactoring/PDERenameParticipant.java (-2 / +1 lines)
Lines 41-48 Link Here
41
		if (!getArguments().getUpdateReferences())
41
		if (!getArguments().getUpdateReferences())
42
			return null;
42
			return null;
43
		CompositeChange result = new CompositeChange(getName());
43
		CompositeChange result = new CompositeChange(getName());
44
		if (updateManifest())
44
		addBundleManifestChange(result, pm);
45
			addBundleManifestChange(result, pm);
46
		if (updateBuildProperties())
45
		if (updateBuildProperties())
47
			addBuildPropertiesChange(result, pm);
46
			addBuildPropertiesChange(result, pm);
48
		addChange(result, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, pm);
47
		addChange(result, ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR, pm);
(-)src/org/eclipse/pde/internal/ui/refactoring/BundleManifestChange.java (-2 / +20 lines)
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
}

Return to bug 219852