From 2f70fafe0bc1cf6d14cb35241ca252ca3cbe5674 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Thu, 16 Dec 2010 13:29:01 -0800 Subject: [PATCH] Fix non-externalized-string references I had accidentally used //NON-NLS- instead of //$NON-NLS- in some code. That explains why Eclipse would sometimes insert a space between the // and the NON part... This changeset replaces these with proper //$NON-NLS- entries. Change-Id: Icf4251a352895293ebe82d8207a4dbfe7d8126d5 --- .../src/com/android/ide/eclipse/adt/AdtPlugin.java | 12 ++++---- .../editors/layout/gle2/DynamicContextMenu.java | 2 +- .../editors/layout/gle2/GestureManager.java | 2 +- .../editors/layout/gle2/GraphicalEditorPart.java | 2 +- .../editors/layout/gle2/IncludeFinder.java | 16 +++++----- .../editors/layout/gle2/PropertySheetPage.java | 2 +- .../adt/internal/editors/xml/Hyperlinks.java | 34 +++++++++++----------- 7 files changed, 35 insertions(+), 35 deletions(-) mode change 100755 => 100644 eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java mode change 100755 => 100644 eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage.java diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java index 4ce667556..f3da152eb 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java @@ -427,7 +427,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { contents.close(); } } catch (IOException e) { - AdtPlugin.log(e, "Can't read file %1$s", file); //NON-NLS-1$ + AdtPlugin.log(e, "Can't read file %1$s", file); //$NON-NLS-1$ } } @@ -448,7 +448,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { String charset = file.getCharset(); return streamContains(new InputStreamReader(contents, charset), string); } catch (Exception e) { - AdtPlugin.log(e, "Can't read file %1$s", file); //NON-NLS-1$ + AdtPlugin.log(e, "Can't read file %1$s", file); //$NON-NLS-1$ } return false; @@ -493,14 +493,14 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { } } } catch (Exception e) { - AdtPlugin.log(e, "Can't read stream"); //NON-NLS-1$ + AdtPlugin.log(e, "Can't read stream"); //$NON-NLS-1$ } finally { try { if (reader != null) { reader.close(); } } catch (IOException e) { - AdtPlugin.log(e, "Can't read stream"); //NON-NLS-1$ + AdtPlugin.log(e, "Can't read stream"); //$NON-NLS-1$ } } @@ -598,7 +598,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { contents.close(); } } catch (IOException e) { - AdtPlugin.log(e, "Can't read layout file"); //NON-NLS-1$ + AdtPlugin.log(e, "Can't read layout file"); //$NON-NLS-1$ } } @@ -632,7 +632,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger { reader.close(); } } catch (IOException e) { - AdtPlugin.log(e, "Can't read input stream"); //NON-NLS-1$ + AdtPlugin.log(e, "Can't read input stream"); //$NON-NLS-1$ } } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java old mode 100755 new mode 100644 index b7070343d..3f58df1c3 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/DynamicContextMenu.java @@ -209,7 +209,7 @@ import java.util.regex.Pattern; // Not yet enabled because we need to backport layoutlib changes to Android 2.0, 2.1, 2.2 // first: - if (System.getenv("ADT_TEST") != null) { //NON-NLS-1$ + if (System.getenv("ADT_TEST") != null) { //$NON-NLS-1$ insertShowIncludedMenu(endId); } } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GestureManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GestureManager.java index 6cc65bb90..bbd62fef2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GestureManager.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GestureManager.java @@ -50,7 +50,7 @@ import java.util.List; */ public class GestureManager { /** Drag source data key */ - private static String KEY_DRAG_PREVIEW = "dragpreview"; //NON-NLS-1$ + private static String KEY_DRAG_PREVIEW = "dragpreview"; //$NON-NLS-1$ /** The canvas which owns this GestureManager. */ private final LayoutCanvas mCanvas; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java index 920a8e4c3..a964c132d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java @@ -1515,7 +1515,7 @@ public class GraphicalEditorPart extends EditorPart topParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true); topParser.setInput(new FileReader(layoutFile)); } catch (XmlPullParserException e) { - AdtPlugin.log(e, ""); //NON-NLS-1$ + AdtPlugin.log(e, ""); //$NON-NLS-1$ } catch (FileNotFoundException e) { // this will not happen since we check above. } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java index 07c52feab..f064c1487 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java @@ -487,7 +487,7 @@ public class IncludeFinder { * if it detects the string <include in the file. */ private List findIncludes(String xml) { - int index = xml.indexOf("b=>c=>d etc */ - private final String CHAIN_FORMAT = "%1$s=>%2$s"; //NON-NLS-1$ + private final String CHAIN_FORMAT = "%1$s=>%2$s"; //$NON-NLS-1$ private String dfs(String from, Set seen) { seen.add(from); @@ -881,7 +881,7 @@ public class IncludeFinder { * given reference */ public static String getProjectRelativePath(String reference) { - if (!reference.contains(WS_SEP)) { //NON-NLS-1$ + if (!reference.contains(WS_SEP)) { //$NON-NLS-1$ reference = SdkConstants.FD_LAYOUT + WS_SEP + reference; } return SdkConstants.FD_RESOURCES + WS_SEP + reference + '.' + EXT_XML; @@ -995,10 +995,10 @@ public class IncludeFinder { @Override public String toString() { - return "Reference [getId()=" + getId() // NON-NLS-1$ - + ", getDisplayName()=" + getDisplayName() // NON-NLS-1$ - + ", getName()=" + getName() // NON-NLS-1$ - + ", getFile()=" + getFile() + "]"; // NON-NLS-1$ + return "Reference [getId()=" + getId() //$NON-NLS-1$ + + ", getDisplayName()=" + getDisplayName() //$NON-NLS-1$ + + ", getName()=" + getName() //$NON-NLS-1$ + + ", getFile()=" + getFile() + "]"; //$NON-NLS-1$ } /** diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage.java old mode 100755 new mode 100644 index c786695c4..d33fffca9 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PropertySheetPage.java @@ -85,7 +85,7 @@ public class PropertySheetPage extends org.eclipse.ui.views.properties.PropertyS // Strip out newlines to make this a single line entry help = help.replace('\n', ' '); // Remove repeated spaces in case there were trailing spaces - help = help.replaceAll(" ", " "); //NON-NLS-1$ //NON-NLS-2$ + help = help.replaceAll(" ", " "); //$NON-NLS-1$ //$NON-NLS-2$ IActionBars actionBars = getSite().getActionBars(); IStatusLineManager status = actionBars.getStatusLineManager(); status.setMessage(help); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java index 2cb1bb7e2..4c6945f56 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java @@ -127,7 +127,7 @@ public class Hyperlinks { /** Regular expression matching a FQCN for a view class */ @VisibleForTesting /* package */ static final Pattern CLASS_PATTERN = Pattern.compile( - "(([a-zA-Z_\\$][a-zA-Z0-9_\\$]*)+\\.)+[a-zA-Z_\\$][a-zA-Z0-9_\\$]*"); //NON-NLS-1$ + "(([a-zA-Z_\\$][a-zA-Z0-9_\\$]*)+\\.)+[a-zA-Z_\\$][a-zA-Z0-9_\\$]*"); //$NON-NLS-1$ /** Determines whether the given attribute name is linkable */ private static boolean isAttributeNameLink(@SuppressWarnings("unused") XmlContext context) { @@ -158,7 +158,7 @@ public class Hyperlinks { } String value = attribute.getValue(); - if (value.startsWith("@+")) { //NON-NLS-1$ + if (value.startsWith("@+")) { //$NON-NLS-1$ // It's a value -declaration-, nowhere else to jump // (though we could consider jumping to the R-file; would that // be helpful?) @@ -494,7 +494,7 @@ public class Hyperlinks { if (valueStr.startsWith("?")) { //$NON-NLS-1$ // FIXME: It's a reference. We should resolve this properly. return false; - } else if (valueStr.startsWith("@")) { //NON-NLS-1$ + } else if (valueStr.startsWith("@")) { //$NON-NLS-1$ // Refers to a different resource; resolve it iteratively if (seen.contains(valueStr)) { return false; @@ -534,7 +534,7 @@ public class Hyperlinks { // Handle inner classes if (fqcn.indexOf('$') != -1) { - fqcn = fqcn.replaceAll("\\$", "."); //NON-NLS-1$ //NON-NLS-2$ + fqcn = fqcn.replaceAll("\\$", "."); //$NON-NLS-1$ //$NON-NLS-2$ } try { @@ -546,7 +546,7 @@ public class Hyperlinks { } } } catch (Throwable e) { - AdtPlugin.log(e, "Can't open class %1$s", fqcn); //NON-NLS-1$ + AdtPlugin.log(e, "Can't open class %1$s", fqcn); //$NON-NLS-1$ } return false; @@ -616,7 +616,7 @@ public class Hyperlinks { } } } catch (CoreException e) { - AdtPlugin.log(e, ""); //NON-NLS-1$ + AdtPlugin.log(e, ""); //$NON-NLS-1$ } return null; @@ -651,7 +651,7 @@ public class Hyperlinks { } } } catch (CoreException e) { - AdtPlugin.log(e, ""); //NON-NLS-1$ + AdtPlugin.log(e, ""); //$NON-NLS-1$ } } @@ -689,7 +689,7 @@ public class Hyperlinks { } } } catch (CoreException e) { - AdtPlugin.log(e, ""); //NON-NLS-1$ + AdtPlugin.log(e, ""); //$NON-NLS-1$ } } return null; @@ -715,9 +715,9 @@ public class Hyperlinks { return findValueInDocument(type, name, file, document); } } catch (IOException e) { - AdtPlugin.log(e, "Can't parse %1$s", file); //NON-NLS-1$ + AdtPlugin.log(e, "Can't parse %1$s", file); //$NON-NLS-1$ } catch (CoreException e) { - AdtPlugin.log(e, "Can't parse %1$s", file); //NON-NLS-1$ + AdtPlugin.log(e, "Can't parse %1$s", file); //$NON-NLS-1$ } finally { if (model != null) { model.releaseFromRead(); @@ -733,7 +733,7 @@ public class Hyperlinks { String targetTag = type.getName(); if (type == ResourceType.ID) { // Ids are recorded in tags instead of tags - targetTag = "item"; //NON-NLS-1$ + targetTag = "item"; //$NON-NLS-1$ } Element root = document.getDocumentElement(); if (root.getTagName().equals(ROOT_ELEMENT)) { @@ -782,9 +782,9 @@ public class Hyperlinks { return findIdInDocument(id, file, document); } } catch (IOException e) { - AdtPlugin.log(e, "Can't parse %1$s", file); //NON-NLS-1$ + AdtPlugin.log(e, "Can't parse %1$s", file); //$NON-NLS-1$ } catch (CoreException e) { - AdtPlugin.log(e, "Can't parse %1$s", file); //NON-NLS-1$ + AdtPlugin.log(e, "Can't parse %1$s", file); //$NON-NLS-1$ } finally { if (model != null) { model.releaseFromRead(); @@ -797,7 +797,7 @@ public class Hyperlinks { /** Looks within an XML DOM document for the given resource name and returns it */ private static Pair findIdInDocument(String id, IFile file, Document document) { - String targetAttribute = "@+id/" + id; //NON-NLS-1$ + String targetAttribute = "@+id/" + id; //$NON-NLS-1$ return findIdInElement(document.getDocumentElement(), file, targetAttribute); } @@ -852,7 +852,7 @@ public class Hyperlinks { int nameBegin = typeEnd + 1; // Skip @ and @+ - int typeBegin = url.startsWith("@+") ? 2 : 1; //NON-NLS-1$ + int typeBegin = url.startsWith("@+") ? 2 : 1; //$NON-NLS-1$ int colon = url.lastIndexOf(':', typeEnd); if (colon != -1) { @@ -955,7 +955,7 @@ public class Hyperlinks { IJavaElement element = elements[0]; if (element.getElementType() == IJavaElement.FIELD) { IJavaElement unit = element.getAncestor(IJavaElement.COMPILATION_UNIT); - if ("R.java".equals(unit.getElementName())) { // NON-NLS-1$ + if ("R.java".equals(unit.getElementName())) { //$NON-NLS-1$ // Yes, we're in an R class. Offer hyperlink navigation to XML // resource // files for the various definitions @@ -1141,7 +1141,7 @@ public class Hyperlinks { } } } catch (BadLocationException e) { - AdtPlugin.log(e, ""); //NON-NLS-1$ + AdtPlugin.log(e, ""); //$NON-NLS-1$ } return new Region(start, length); } -- 2.11.0