aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2011-09-02 12:44:16 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-02 12:44:16 -0700
commit8c673fe5661c965b567375c79154e8fb6088af60 (patch)
treeb7cb30b915e9bac069440fbe4bf612536e3cfb69
parent4e9728075fd0272765cba300a8e61e76b3269a50 (diff)
parent83b1c09dfbd241bd08a26ddfc3e9e34c84e7e372 (diff)
downloadsdk-8c673fe5661c965b567375c79154e8fb6088af60.zip
sdk-8c673fe5661c965b567375c79154e8fb6088af60.tar.gz
sdk-8c673fe5661c965b567375c79154e8fb6088af60.tar.bz2
Merge "Change CRLF to LF and remove execute permissions on source files"
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidDocumentChange.java584
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChange.java586
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChangeDescription.java244
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutFileChanges.java122
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidPackageRenameChange.java0
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeMoveChange.java90
-rw-r--r--[-rwxr-xr-x]eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeRenameChange.java0
7 files changed, 813 insertions, 813 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidDocumentChange.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidDocumentChange.java
index fe3c014..902d726 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidDocumentChange.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidDocumentChange.java
@@ -1,292 +1,292 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.refactoring.changes;
-
-import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
-import com.android.ide.eclipse.adt.internal.project.XmlErrorHandler.BasicXmlErrorListener;
-import com.android.ide.eclipse.adt.internal.refactoring.core.RefactoringUtil;
-import com.android.sdklib.SdkConstants;
-import com.android.sdklib.xml.AndroidManifest;
-
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.DocumentChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.util.Map;
-
-/**
- * A text change that operates on android manifest using WTP SSE model.
- * It is base class for Rename Package and Rename Type changes
-*/
-@SuppressWarnings("restriction")
-public class AndroidDocumentChange extends DocumentChange {
-
- protected IFile mAndroidManifest;
-
- protected String mAppPackage;
-
- protected IStructuredModel mModel;
-
- protected IDocument mDocument;
-
- protected Map<String, String> mElements;
-
- protected String mNewName;
-
- protected String mOldName;
-
- protected ITextFileBufferManager mManager;
-
- /**
- * Creates a new <code>AndroidDocumentChange</code> for the given
- * {@link IDocument}.
- *
- * @param document the document this change is working on
- */
- public AndroidDocumentChange(IDocument document) {
- super(SdkConstants.FN_ANDROID_MANIFEST_XML , document);
- }
-
- @Override
- public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException,
- OperationCanceledException {
- RefactoringStatus status = super.isValid(pm);
- if (mModel == null) {
- status.addFatalError("File " + SdkConstants.FN_ANDROID_MANIFEST_XML + " is invalid.");
- } else {
- mAppPackage = getAppPackage();
- if (mAppPackage == null) {
- status.addFatalError("Invalid package in the "
- + SdkConstants.FN_ANDROID_MANIFEST_XML + " file.");
- }
- }
- BasicXmlErrorListener errorListener = new BasicXmlErrorListener();
- AndroidManifestHelper.parseForError(mAndroidManifest, errorListener);
-
- if (errorListener.mHasXmlError == true) {
- status.addFatalError("File " + SdkConstants.FN_ANDROID_MANIFEST_XML + " is invalid.");
- }
- return status;
- }
-
- /**
- * Finds the attribute with values oldName
- *
- * @param xmlDoc the document
- * @param element the element
- * @param attributeName the attribute
- * @param oldName the value
- *
- * @return the attribute
- */
- private Attr findAttribute(IDOMDocument xmlDoc, String element, String attributeName,
- String oldName) {
- NodeList nodes = xmlDoc.getElementsByTagName(element);
- for (int i = 0; i < nodes.getLength(); i++) {
- Node node = nodes.item(i);
- NamedNodeMap attributes = node.getAttributes();
- if (attributes != null) {
- Attr attribute = RefactoringUtil.findAndroidAttributes(attributes, attributeName);
- if (attribute != null) {
- String value = attribute.getValue();
- if (value != null) {
- String fullName = AndroidManifest.combinePackageAndClassName(
- getAppPackage(), value);
- if (fullName != null && fullName.equals(oldName)) {
- return attribute;
- }
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the attribute value
- *
- * @param xmlDoc the document
- * @param element the element
- * @param attributeName the attribute
- *
- * @return the attribute value
- */
- protected String getElementAttribute(IDOMDocument xmlDoc, String element,
- String attributeName, boolean useNamespace) {
- NodeList nodes = xmlDoc.getElementsByTagName(element);
- for (int i = 0; i < nodes.getLength(); i++) {
- Node node = nodes.item(i);
- NamedNodeMap attributes = node.getAttributes();
- if (attributes != null) {
- Attr attribute;
- if (useNamespace) {
- attribute = RefactoringUtil.findAndroidAttributes(attributes, attributeName);
- } else {
- attribute = (Attr) attributes.getNamedItem(attributeName);
- }
- if (attribute != null) {
- return attribute.getValue();
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the SSE model for a document
- *
- * @param document the document
- * @return the model
- *
- */
- protected IStructuredModel getModel(IDocument document) {
- if (mModel != null) {
- return mModel;
- }
- IStructuredModel model;
- model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
- if (model == null) {
- if (document instanceof IStructuredDocument) {
- IStructuredDocument structuredDocument = (IStructuredDocument) document;
- model = StructuredModelManager.getModelManager()
- .getModelForRead(structuredDocument);
- }
- }
- return model;
- }
-
- @Override
- public void setTextType(String type) {
- super.setTextType(mAndroidManifest.getFileExtension());
- }
-
- /**
- * Returns the SSE DOM document
- *
- * @return the attribute value
- */
- protected IDOMDocument getDOMDocument() {
- IDOMModel xmlModel = (IDOMModel) mModel;
- IDOMDocument xmlDoc = xmlModel.getDocument();
- return xmlDoc;
- }
-
- /**
- * Returns the application package
- *
- * @return the package name
- */
- protected String getAppPackage() {
- if (mAppPackage == null) {
- IDOMDocument xmlDoc = getDOMDocument();
- mAppPackage = getElementAttribute(xmlDoc, AndroidManifest.NODE_MANIFEST,
- AndroidManifest.ATTRIBUTE_PACKAGE, false);
- }
- return mAppPackage;
- }
-
- /**
- * Returns the text change that set new value of attribute
- *
- * @param attribute the attribute
- * @param newValue the new value
- *
- * @return the text change
- */
- protected TextEdit createTextEdit(Attr attribute, String newValue) {
- if (attribute == null)
- return null;
-
- if (attribute instanceof IDOMAttr) {
- IDOMAttr domAttr = (IDOMAttr) attribute;
- String region = domAttr.getValueRegionText();
- int offset = domAttr.getValueRegionStartOffset();
- if (region != null && region.length() >= 2) {
- return new ReplaceEdit(offset + 1, region.length() - 2, newValue);
- }
- }
- return null;
- }
-
- /**
- * Returns the text change that change the value of attribute from oldValue to newValue
- * and combine package
- *
- * @param elementName the element name
- * @param attributeName the attribute name
- * @param oldValue the old value
- * @param newValue the new value
- *
- * @return the text change
- */
- protected TextEdit createTextEdit(String elementName, String attributeName, String oldValue,
- String newValue) {
- return createTextEdit(elementName, attributeName, oldValue, newValue, true);
- }
-
- /**
- * Returns the text change that change the value of attribute from oldValue to newValue
- *
- * @param elementName the element name
- * @param attributeName the attribute name
- * @param oldName the old value
- * @param newName the new value
- * @param combinePackage combine package ?
- *
- * @return the text change
- */
- protected TextEdit createTextEdit(String elementName, String attributeName, String oldName,
- String newName, boolean combinePackage) {
- IDOMDocument xmlDoc = getDOMDocument();
- String name = null;
- Attr attr = findAttribute(xmlDoc, elementName, attributeName, oldName);
- if (attr != null) {
- name = attr.getValue();
- }
- if (name != null) {
- String newValue;
- if (combinePackage) {
- newValue = AndroidManifest.extractActivityName(newName, getAppPackage());
- } else {
- newValue = newName;
- }
- if (newValue != null) {
- TextEdit edit = createTextEdit(attr, newValue);
- return edit;
- }
- }
- return null;
- }
-
-}
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.refactoring.changes;
+
+import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
+import com.android.ide.eclipse.adt.internal.project.XmlErrorHandler.BasicXmlErrorListener;
+import com.android.ide.eclipse.adt.internal.refactoring.core.RefactoringUtil;
+import com.android.sdklib.SdkConstants;
+import com.android.sdklib.xml.AndroidManifest;
+
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.DocumentChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.Map;
+
+/**
+ * A text change that operates on android manifest using WTP SSE model.
+ * It is base class for Rename Package and Rename Type changes
+*/
+@SuppressWarnings("restriction")
+public class AndroidDocumentChange extends DocumentChange {
+
+ protected IFile mAndroidManifest;
+
+ protected String mAppPackage;
+
+ protected IStructuredModel mModel;
+
+ protected IDocument mDocument;
+
+ protected Map<String, String> mElements;
+
+ protected String mNewName;
+
+ protected String mOldName;
+
+ protected ITextFileBufferManager mManager;
+
+ /**
+ * Creates a new <code>AndroidDocumentChange</code> for the given
+ * {@link IDocument}.
+ *
+ * @param document the document this change is working on
+ */
+ public AndroidDocumentChange(IDocument document) {
+ super(SdkConstants.FN_ANDROID_MANIFEST_XML, document);
+ }
+
+ @Override
+ public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ RefactoringStatus status = super.isValid(pm);
+ if (mModel == null) {
+ status.addFatalError("File " + SdkConstants.FN_ANDROID_MANIFEST_XML + " is invalid.");
+ } else {
+ mAppPackage = getAppPackage();
+ if (mAppPackage == null) {
+ status.addFatalError("Invalid package in the "
+ + SdkConstants.FN_ANDROID_MANIFEST_XML + " file.");
+ }
+ }
+ BasicXmlErrorListener errorListener = new BasicXmlErrorListener();
+ AndroidManifestHelper.parseForError(mAndroidManifest, errorListener);
+
+ if (errorListener.mHasXmlError == true) {
+ status.addFatalError("File " + SdkConstants.FN_ANDROID_MANIFEST_XML + " is invalid.");
+ }
+ return status;
+ }
+
+ /**
+ * Finds the attribute with values oldName
+ *
+ * @param xmlDoc the document
+ * @param element the element
+ * @param attributeName the attribute
+ * @param oldName the value
+ *
+ * @return the attribute
+ */
+ private Attr findAttribute(IDOMDocument xmlDoc, String element, String attributeName,
+ String oldName) {
+ NodeList nodes = xmlDoc.getElementsByTagName(element);
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes != null) {
+ Attr attribute = RefactoringUtil.findAndroidAttributes(attributes, attributeName);
+ if (attribute != null) {
+ String value = attribute.getValue();
+ if (value != null) {
+ String fullName = AndroidManifest.combinePackageAndClassName(
+ getAppPackage(), value);
+ if (fullName != null && fullName.equals(oldName)) {
+ return attribute;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the attribute value
+ *
+ * @param xmlDoc the document
+ * @param element the element
+ * @param attributeName the attribute
+ *
+ * @return the attribute value
+ */
+ protected String getElementAttribute(IDOMDocument xmlDoc, String element,
+ String attributeName, boolean useNamespace) {
+ NodeList nodes = xmlDoc.getElementsByTagName(element);
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes != null) {
+ Attr attribute;
+ if (useNamespace) {
+ attribute = RefactoringUtil.findAndroidAttributes(attributes, attributeName);
+ } else {
+ attribute = (Attr) attributes.getNamedItem(attributeName);
+ }
+ if (attribute != null) {
+ return attribute.getValue();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the SSE model for a document
+ *
+ * @param document the document
+ * @return the model
+ *
+ */
+ protected IStructuredModel getModel(IDocument document) {
+ if (mModel != null) {
+ return mModel;
+ }
+ IStructuredModel model;
+ model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
+ if (model == null) {
+ if (document instanceof IStructuredDocument) {
+ IStructuredDocument structuredDocument = (IStructuredDocument) document;
+ model = StructuredModelManager.getModelManager()
+ .getModelForRead(structuredDocument);
+ }
+ }
+ return model;
+ }
+
+ @Override
+ public void setTextType(String type) {
+ super.setTextType(mAndroidManifest.getFileExtension());
+ }
+
+ /**
+ * Returns the SSE DOM document
+ *
+ * @return the attribute value
+ */
+ protected IDOMDocument getDOMDocument() {
+ IDOMModel xmlModel = (IDOMModel) mModel;
+ IDOMDocument xmlDoc = xmlModel.getDocument();
+ return xmlDoc;
+ }
+
+ /**
+ * Returns the application package
+ *
+ * @return the package name
+ */
+ protected String getAppPackage() {
+ if (mAppPackage == null) {
+ IDOMDocument xmlDoc = getDOMDocument();
+ mAppPackage = getElementAttribute(xmlDoc, AndroidManifest.NODE_MANIFEST,
+ AndroidManifest.ATTRIBUTE_PACKAGE, false);
+ }
+ return mAppPackage;
+ }
+
+ /**
+ * Returns the text change that set new value of attribute
+ *
+ * @param attribute the attribute
+ * @param newValue the new value
+ *
+ * @return the text change
+ */
+ protected TextEdit createTextEdit(Attr attribute, String newValue) {
+ if (attribute == null)
+ return null;
+
+ if (attribute instanceof IDOMAttr) {
+ IDOMAttr domAttr = (IDOMAttr) attribute;
+ String region = domAttr.getValueRegionText();
+ int offset = domAttr.getValueRegionStartOffset();
+ if (region != null && region.length() >= 2) {
+ return new ReplaceEdit(offset + 1, region.length() - 2, newValue);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the text change that change the value of attribute from oldValue to newValue
+ * and combine package
+ *
+ * @param elementName the element name
+ * @param attributeName the attribute name
+ * @param oldValue the old value
+ * @param newValue the new value
+ *
+ * @return the text change
+ */
+ protected TextEdit createTextEdit(String elementName, String attributeName, String oldValue,
+ String newValue) {
+ return createTextEdit(elementName, attributeName, oldValue, newValue, true);
+ }
+
+ /**
+ * Returns the text change that change the value of attribute from oldValue to newValue
+ *
+ * @param elementName the element name
+ * @param attributeName the attribute name
+ * @param oldName the old value
+ * @param newName the new value
+ * @param combinePackage combine package ?
+ *
+ * @return the text change
+ */
+ protected TextEdit createTextEdit(String elementName, String attributeName, String oldName,
+ String newName, boolean combinePackage) {
+ IDOMDocument xmlDoc = getDOMDocument();
+ String name = null;
+ Attr attr = findAttribute(xmlDoc, elementName, attributeName, oldName);
+ if (attr != null) {
+ name = attr.getValue();
+ }
+ if (name != null) {
+ String newValue;
+ if (combinePackage) {
+ newValue = AndroidManifest.extractActivityName(newName, getAppPackage());
+ } else {
+ newValue = newName;
+ }
+ if (newValue != null) {
+ TextEdit edit = createTextEdit(attr, newValue);
+ return edit;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChange.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChange.java
index cfa4250..c9d6b34 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChange.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChange.java
@@ -1,293 +1,293 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.refactoring.changes;
-
-import com.android.ide.common.layout.LayoutConstants;
-import com.android.ide.eclipse.adt.internal.refactoring.core.RefactoringUtil;
-
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.filebuffers.LocationKind;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.ltk.core.refactoring.DocumentChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.text.edits.TextEdit;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.w3c.dom.Attr;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * A text change that operates on android layout using WTP SSE model.
- * It is base class for Rename Package and Rename Type changes
-*/
-@SuppressWarnings("restriction")
-public class AndroidLayoutChange extends DocumentChange {
-
- private IDocument mDocument;
-
- private ITextFileBufferManager mManager;
-
- private IFile mFile;
-
- private IStructuredModel mModel;
-
- private Set<AndroidLayoutChangeDescription> mChanges;
-
- /**
- * Creates a new <code>AndroidLayoutChange</code>
- *
- * @param file the layout file
- * @param document the document
- * @param manager the buffer manager
- * @param changes the list of changes
- */
- public AndroidLayoutChange(IFile file, IDocument document, ITextFileBufferManager manager,
- Set<AndroidLayoutChangeDescription> changes) {
- super("", document); //$NON-NLS-1$
- mFile = file;
- mDocument = document;
- mManager = manager;
- mChanges = changes;
- try {
- this.mModel = getModel(document);
- } catch (Exception ignore) {
- }
- if (mModel != null) {
- addEdits();
- }
- }
-
- @Override
- public String getName() {
- return mFile.getName();
- }
-
- @Override
- public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException,
- OperationCanceledException {
- RefactoringStatus status = super.isValid(pm);
- if (mModel == null) {
- status.addFatalError("Invalid the " + getName() + " file.");
- }
- return status;
- }
-
- @Override
- public void setTextType(String type) {
- super.setTextType(mFile.getFileExtension());
- }
-
- @Override
- public void dispose() {
- super.dispose();
- RefactoringUtil.fixModel(mModel, mDocument);
-
- if (mManager != null) {
- try {
- mManager.disconnect(mFile.getFullPath(), LocationKind.NORMALIZE,
- new NullProgressMonitor());
- } catch (CoreException e) {
- RefactoringUtil.log(e);
- }
- }
- }
-
- // ----
-
- /**
- * Adds text edits for this change
- */
- private void addEdits() {
- MultiTextEdit multiEdit = new MultiTextEdit();
- for (AndroidLayoutChangeDescription change : mChanges) {
- if (!change.isStandalone()) {
- TextEdit edit = createTextEdit(LayoutConstants.VIEW,
- LayoutConstants.ATTR_CLASS,
- change.getClassName(),
- change.getNewName());
- if (edit != null) {
- multiEdit.addChild(edit);
- }
- } else {
- List<TextEdit> edits = createElementTextEdit(change.getClassName(),
- change.getNewName());
- for (TextEdit edit : edits) {
- multiEdit.addChild(edit);
- }
- }
- }
- setEdit(multiEdit);
- }
-
- /**
- * Returns the text changes which change class (custom layout viewer) in layout file
- *
- * @param className the class name
- * @param newName the new class name
- *
- * @return list of text changes
- */
- private List<TextEdit> createElementTextEdit(String className, String newName) {
- IDOMDocument xmlDoc = getDOMDocument();
- List<TextEdit> edits = new ArrayList<TextEdit>();
- NodeList nodes = xmlDoc.getElementsByTagName(className);
- for (int i = 0; i < nodes.getLength(); i++) {
- Node node = nodes.item(i);
- if (node instanceof IDOMElement) {
- IDOMElement domNode = (IDOMElement) node;
- IStructuredDocumentRegion firstRegion = domNode.getFirstStructuredDocumentRegion();
- if (firstRegion != null) {
- int offset = firstRegion.getStartOffset();
- edits.add(new ReplaceEdit(offset + 1, className.length(), newName));
- }
- IStructuredDocumentRegion endRegion = domNode.getEndStructuredDocumentRegion();
- if (endRegion != null) {
- int offset = endRegion.getStartOffset();
- edits.add(new ReplaceEdit(offset + 2, className.length(), newName));
- }
- }
-
- }
- return edits;
- }
-
- /**
- * Returns the SSE DOM document
- *
- * @return the attribute value
- */
- private IDOMDocument getDOMDocument() {
- IDOMModel xmlModel = (IDOMModel) mModel;
- IDOMDocument xmlDoc = xmlModel.getDocument();
- return xmlDoc;
- }
-
- /**
- * Returns the text change that set new value of attribute
- *
- * @param attribute the attribute
- * @param newValue the new value
- *
- * @return the text change
- */
- private TextEdit createTextEdit(Attr attribute, String newValue) {
- if (attribute == null)
- return null;
-
- if (attribute instanceof IDOMAttr) {
- IDOMAttr domAttr = (IDOMAttr) attribute;
- String region = domAttr.getValueRegionText();
- int offset = domAttr.getValueRegionStartOffset();
- if (region != null && region.length() >= 2) {
- return new ReplaceEdit(offset + 1, region.length() - 2, newValue);
- }
- }
- return null;
- }
-
-
- /**
- * Returns the text change that change the value of attribute from oldValue to newValue
- *
- * @param elementName the element name
- * @param argumentName the attribute name
- * @param oldName the old value
- * @param newName the new value
- *
- * @return the text change
- */
- private TextEdit createTextEdit(String elementName, String argumentName, String oldName,
- String newName) {
- IDOMDocument xmlDoc = getDOMDocument();
- String name = null;
- Attr attr = findAttribute(xmlDoc, elementName, argumentName, oldName);
- if (attr != null) {
- name = attr.getValue();
- }
- if (name != null && newName != null) {
- TextEdit edit = createTextEdit(attr, newName);
- return edit;
- }
- return null;
- }
-
- /**
- * Finds the attribute with values oldName
- *
- * @param xmlDoc the document
- * @param element the element
- * @param attributeName the attribute
- * @param oldValue the value
- *
- * @return the attribute
- */
- private Attr findAttribute(IDOMDocument xmlDoc, String element, String attributeName,
- String oldValue) {
- NodeList nodes = xmlDoc.getElementsByTagName(element);
- for (int i = 0; i < nodes.getLength(); i++) {
- Node node = nodes.item(i);
- NamedNodeMap attributes = node.getAttributes();
- if (attributes != null) {
- Attr attribute = RefactoringUtil.findAndroidAttributes(attributes, attributeName);
- if (attribute != null) {
- String value = attribute.getValue();
- if (value != null && value.equals(oldValue)) {
- return attribute;
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the SSE model for a document
- *
- * @param document the document
- * @return the model
- */
- private IStructuredModel getModel(IDocument document) {
-
- IModelManager manager = StructuredModelManager.getModelManager();
- IStructuredModel model = manager.getExistingModelForRead(document);
- if (model == null && document instanceof IStructuredDocument) {
- model = manager.getModelForRead((IStructuredDocument) document);
- }
-
- return model;
- }
-}
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.refactoring.changes;
+
+import com.android.ide.common.layout.LayoutConstants;
+import com.android.ide.eclipse.adt.internal.refactoring.core.RefactoringUtil;
+
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.filebuffers.LocationKind;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.ltk.core.refactoring.DocumentChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.eclipse.text.edits.TextEdit;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A text change that operates on android layout using WTP SSE model.
+ * It is base class for Rename Package and Rename Type changes
+*/
+@SuppressWarnings("restriction")
+public class AndroidLayoutChange extends DocumentChange {
+
+ private IDocument mDocument;
+
+ private ITextFileBufferManager mManager;
+
+ private IFile mFile;
+
+ private IStructuredModel mModel;
+
+ private Set<AndroidLayoutChangeDescription> mChanges;
+
+ /**
+ * Creates a new <code>AndroidLayoutChange</code>
+ *
+ * @param file the layout file
+ * @param document the document
+ * @param manager the buffer manager
+ * @param changes the list of changes
+ */
+ public AndroidLayoutChange(IFile file, IDocument document, ITextFileBufferManager manager,
+ Set<AndroidLayoutChangeDescription> changes) {
+ super("", document); //$NON-NLS-1$
+ mFile = file;
+ mDocument = document;
+ mManager = manager;
+ mChanges = changes;
+ try {
+ this.mModel = getModel(document);
+ } catch (Exception ignore) {
+ }
+ if (mModel != null) {
+ addEdits();
+ }
+ }
+
+ @Override
+ public String getName() {
+ return mFile.getName();
+ }
+
+ @Override
+ public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException,
+ OperationCanceledException {
+ RefactoringStatus status = super.isValid(pm);
+ if (mModel == null) {
+ status.addFatalError("Invalid the " + getName() + " file.");
+ }
+ return status;
+ }
+
+ @Override
+ public void setTextType(String type) {
+ super.setTextType(mFile.getFileExtension());
+ }
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ RefactoringUtil.fixModel(mModel, mDocument);
+
+ if (mManager != null) {
+ try {
+ mManager.disconnect(mFile.getFullPath(), LocationKind.NORMALIZE,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ RefactoringUtil.log(e);
+ }
+ }
+ }
+
+ // ----
+
+ /**
+ * Adds text edits for this change
+ */
+ private void addEdits() {
+ MultiTextEdit multiEdit = new MultiTextEdit();
+ for (AndroidLayoutChangeDescription change : mChanges) {
+ if (!change.isStandalone()) {
+ TextEdit edit = createTextEdit(LayoutConstants.VIEW,
+ LayoutConstants.ATTR_CLASS,
+ change.getClassName(),
+ change.getNewName());
+ if (edit != null) {
+ multiEdit.addChild(edit);
+ }
+ } else {
+ List<TextEdit> edits = createElementTextEdit(change.getClassName(),
+ change.getNewName());
+ for (TextEdit edit : edits) {
+ multiEdit.addChild(edit);
+ }
+ }
+ }
+ setEdit(multiEdit);
+ }
+
+ /**
+ * Returns the text changes which change class (custom layout viewer) in layout file
+ *
+ * @param className the class name
+ * @param newName the new class name
+ *
+ * @return list of text changes
+ */
+ private List<TextEdit> createElementTextEdit(String className, String newName) {
+ IDOMDocument xmlDoc = getDOMDocument();
+ List<TextEdit> edits = new ArrayList<TextEdit>();
+ NodeList nodes = xmlDoc.getElementsByTagName(className);
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ if (node instanceof IDOMElement) {
+ IDOMElement domNode = (IDOMElement) node;
+ IStructuredDocumentRegion firstRegion = domNode.getFirstStructuredDocumentRegion();
+ if (firstRegion != null) {
+ int offset = firstRegion.getStartOffset();
+ edits.add(new ReplaceEdit(offset + 1, className.length(), newName));
+ }
+ IStructuredDocumentRegion endRegion = domNode.getEndStructuredDocumentRegion();
+ if (endRegion != null) {
+ int offset = endRegion.getStartOffset();
+ edits.add(new ReplaceEdit(offset + 2, className.length(), newName));
+ }
+ }
+
+ }
+ return edits;
+ }
+
+ /**
+ * Returns the SSE DOM document
+ *
+ * @return the attribute value
+ */
+ private IDOMDocument getDOMDocument() {
+ IDOMModel xmlModel = (IDOMModel) mModel;
+ IDOMDocument xmlDoc = xmlModel.getDocument();
+ return xmlDoc;
+ }
+
+ /**
+ * Returns the text change that set new value of attribute
+ *
+ * @param attribute the attribute
+ * @param newValue the new value
+ *
+ * @return the text change
+ */
+ private TextEdit createTextEdit(Attr attribute, String newValue) {
+ if (attribute == null)
+ return null;
+
+ if (attribute instanceof IDOMAttr) {
+ IDOMAttr domAttr = (IDOMAttr) attribute;
+ String region = domAttr.getValueRegionText();
+ int offset = domAttr.getValueRegionStartOffset();
+ if (region != null && region.length() >= 2) {
+ return new ReplaceEdit(offset + 1, region.length() - 2, newValue);
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Returns the text change that change the value of attribute from oldValue to newValue
+ *
+ * @param elementName the element name
+ * @param argumentName the attribute name
+ * @param oldName the old value
+ * @param newName the new value
+ *
+ * @return the text change
+ */
+ private TextEdit createTextEdit(String elementName, String argumentName, String oldName,
+ String newName) {
+ IDOMDocument xmlDoc = getDOMDocument();
+ String name = null;
+ Attr attr = findAttribute(xmlDoc, elementName, argumentName, oldName);
+ if (attr != null) {
+ name = attr.getValue();
+ }
+ if (name != null && newName != null) {
+ TextEdit edit = createTextEdit(attr, newName);
+ return edit;
+ }
+ return null;
+ }
+
+ /**
+ * Finds the attribute with values oldName
+ *
+ * @param xmlDoc the document
+ * @param element the element
+ * @param attributeName the attribute
+ * @param oldValue the value
+ *
+ * @return the attribute
+ */
+ private Attr findAttribute(IDOMDocument xmlDoc, String element, String attributeName,
+ String oldValue) {
+ NodeList nodes = xmlDoc.getElementsByTagName(element);
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node node = nodes.item(i);
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes != null) {
+ Attr attribute = RefactoringUtil.findAndroidAttributes(attributes, attributeName);
+ if (attribute != null) {
+ String value = attribute.getValue();
+ if (value != null && value.equals(oldValue)) {
+ return attribute;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the SSE model for a document
+ *
+ * @param document the document
+ * @return the model
+ */
+ private IStructuredModel getModel(IDocument document) {
+
+ IModelManager manager = StructuredModelManager.getModelManager();
+ IStructuredModel model = manager.getExistingModelForRead(document);
+ if (model == null && document instanceof IStructuredDocument) {
+ model = manager.getModelForRead((IStructuredDocument) document);
+ }
+
+ return model;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChangeDescription.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChangeDescription.java
index b96c412..a12885d 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChangeDescription.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutChangeDescription.java
@@ -1,122 +1,122 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.refactoring.changes;
-
-/**
- * This class describes the text changes of android layout files
- *
- */
-public class AndroidLayoutChangeDescription {
-
- private String mClassName;
-
- private String mNewName;
-
- private int mType;
-
- /**
- * the view layout
- */
- public static final int VIEW_TYPE = 0;
-
- /**
- * the standalone layout
- */
- public static final int STANDALONE_TYPE = 1;
-
- /**
- * Creates a new <code>AndroidDocumentChange</code>
- *
- * @param className the old layout class name
- * @param newName the new layout class name
- * @param type the layout type; valid value are VIEW_TYPE and STANDALONE_TYPE
- */
- public AndroidLayoutChangeDescription(String className, String newName, int type) {
- this.mClassName = className;
- this.mNewName = newName;
- this.mType = type;
- }
-
- /**
- * @return the old class name
- */
- public String getClassName() {
- return mClassName;
- }
-
- /**
- * @return the new class name
- */
- public String getNewName() {
- return mNewName;
- }
-
- /**
- * @return the layout type
- */
- public int getType() {
- return mType;
- }
-
- /**
- * @return true if the layout is standalone
- */
- public boolean isStandalone() {
- return mType == STANDALONE_TYPE;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((mClassName == null) ? 0 : mClassName.hashCode());
- result = prime * result + ((mNewName == null) ? 0 : mNewName.hashCode());
- result = prime * result + mType;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- AndroidLayoutChangeDescription other = (AndroidLayoutChangeDescription) obj;
- if (mClassName == null) {
- if (other.mClassName != null)
- return false;
- } else if (!mClassName.equals(other.mClassName))
- return false;
- if (mNewName == null) {
- if (other.mNewName != null)
- return false;
- } else if (!mNewName.equals(other.mNewName))
- return false;
- if (mType != other.mType)
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return "AndroidLayoutChangeDescription [className=" + mClassName + ", newName=" + mNewName
- + ", type=" + mType + "]";
- }
-
-}
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.refactoring.changes;
+
+/**
+ * This class describes the text changes of android layout files
+ *
+ */
+public class AndroidLayoutChangeDescription {
+
+ private String mClassName;
+
+ private String mNewName;
+
+ private int mType;
+
+ /**
+ * the view layout
+ */
+ public static final int VIEW_TYPE = 0;
+
+ /**
+ * the standalone layout
+ */
+ public static final int STANDALONE_TYPE = 1;
+
+ /**
+ * Creates a new <code>AndroidDocumentChange</code>
+ *
+ * @param className the old layout class name
+ * @param newName the new layout class name
+ * @param type the layout type; valid value are VIEW_TYPE and STANDALONE_TYPE
+ */
+ public AndroidLayoutChangeDescription(String className, String newName, int type) {
+ this.mClassName = className;
+ this.mNewName = newName;
+ this.mType = type;
+ }
+
+ /**
+ * @return the old class name
+ */
+ public String getClassName() {
+ return mClassName;
+ }
+
+ /**
+ * @return the new class name
+ */
+ public String getNewName() {
+ return mNewName;
+ }
+
+ /**
+ * @return the layout type
+ */
+ public int getType() {
+ return mType;
+ }
+
+ /**
+ * @return true if the layout is standalone
+ */
+ public boolean isStandalone() {
+ return mType == STANDALONE_TYPE;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((mClassName == null) ? 0 : mClassName.hashCode());
+ result = prime * result + ((mNewName == null) ? 0 : mNewName.hashCode());
+ result = prime * result + mType;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ AndroidLayoutChangeDescription other = (AndroidLayoutChangeDescription) obj;
+ if (mClassName == null) {
+ if (other.mClassName != null)
+ return false;
+ } else if (!mClassName.equals(other.mClassName))
+ return false;
+ if (mNewName == null) {
+ if (other.mNewName != null)
+ return false;
+ } else if (!mNewName.equals(other.mNewName))
+ return false;
+ if (mType != other.mType)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "AndroidLayoutChangeDescription [className=" + mClassName + ", newName=" + mNewName
+ + ", type=" + mType + "]";
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutFileChanges.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutFileChanges.java
index a20f72b..13f7d6e 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutFileChanges.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidLayoutFileChanges.java
@@ -1,61 +1,61 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.refactoring.changes;
-
-import org.eclipse.core.resources.IFile;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Set of layout files with required text changes
- *
- */
-public class AndroidLayoutFileChanges {
- private IFile mFile;
-
- private Set<AndroidLayoutChangeDescription> mChanges =
- new HashSet<AndroidLayoutChangeDescription>();
-
- /**
- * Creates a new <code>AndroidLayoutFileChanges</code>
- *
- * @param file the layout file
- */
- public AndroidLayoutFileChanges(IFile file) {
- this.mFile = file;
- }
-
- /**
- * Return the layout file
- *
- * @return the file
- */
- public IFile getFile() {
- return mFile;
- }
-
- /**
- * Return the text changes
- *
- * @return the set of changes
- */
- public Set<AndroidLayoutChangeDescription> getChanges() {
- return mChanges;
- }
-
-}
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.refactoring.changes;
+
+import org.eclipse.core.resources.IFile;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Set of layout files with required text changes
+ *
+ */
+public class AndroidLayoutFileChanges {
+ private IFile mFile;
+
+ private Set<AndroidLayoutChangeDescription> mChanges =
+ new HashSet<AndroidLayoutChangeDescription>();
+
+ /**
+ * Creates a new <code>AndroidLayoutFileChanges</code>
+ *
+ * @param file the layout file
+ */
+ public AndroidLayoutFileChanges(IFile file) {
+ this.mFile = file;
+ }
+
+ /**
+ * Return the layout file
+ *
+ * @return the file
+ */
+ public IFile getFile() {
+ return mFile;
+ }
+
+ /**
+ * Return the text changes
+ *
+ * @return the set of changes
+ */
+ public Set<AndroidLayoutChangeDescription> getChanges() {
+ return mChanges;
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidPackageRenameChange.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidPackageRenameChange.java
index 1723087..1723087 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidPackageRenameChange.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidPackageRenameChange.java
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeMoveChange.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeMoveChange.java
index e7f2d1a..7dcc505 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeMoveChange.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeMoveChange.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.ide.eclipse.adt.internal.refactoring.changes;
-
-import org.eclipse.core.filebuffers.ITextFileBufferManager;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IDocument;
-
-import java.util.Map;
-
-/**
- * A text change that operates on android manifest when execute Java Move type refactoring
-*/
-public class AndroidTypeMoveChange extends AndroidTypeRenameChange {
-
- /**
- * Creates a new <code>AndroidTypeMoveChange</code>
- *
- * @param androidManifest the android manifest file
- * @param manager the text buffer manager
- * @param document the document
- * @param elements the elements
- * @param newName the new name
- * @param oldName the old name
- */
- public AndroidTypeMoveChange(IFile androidManifest, ITextFileBufferManager manager,
- IDocument document, Map<String, String> elements, String newName, String oldName) {
- super(androidManifest, manager, document, elements, newName, oldName);
- }
-
-}
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.refactoring.changes;
+
+import org.eclipse.core.filebuffers.ITextFileBufferManager;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+
+import java.util.Map;
+
+/**
+ * A text change that operates on android manifest when execute Java Move type refactoring
+*/
+public class AndroidTypeMoveChange extends AndroidTypeRenameChange {
+
+ /**
+ * Creates a new <code>AndroidTypeMoveChange</code>
+ *
+ * @param androidManifest the android manifest file
+ * @param manager the text buffer manager
+ * @param document the document
+ * @param elements the elements
+ * @param newName the new name
+ * @param oldName the old name
+ */
+ public AndroidTypeMoveChange(IFile androidManifest, ITextFileBufferManager manager,
+ IDocument document, Map<String, String> elements, String newName, String oldName) {
+ super(androidManifest, manager, document, elements, newName, oldName);
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeRenameChange.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeRenameChange.java
index 0f56442..0f56442 100755..100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeRenameChange.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/refactoring/changes/AndroidTypeRenameChange.java