From 7b53e3937797ee1eea71c6291bdcd58cb9dedf7a Mon Sep 17 00:00:00 2001 From: The Android Open Source Project Date: Tue, 20 Jan 2009 14:03:55 -0800 Subject: [PATCH] auto import from //branches/cupcake/...@127101 --- build/sdk.atree | 4 +- build/tools/make_windows_sdk.sh | 3 +- .../prebuilt/usb/driver_amd_64/androidusb.sys | Bin 31744 -> 37360 bytes .../usb/driver_amd_64/androidusba64.cat | Bin 1811 -> 7282 bytes pdk/Pdk.mk | 9 +- pdk/README | 4 + pdk/doxygen_config/footer.html | 2 + pdk/doxygen_config/header.html | 15 + .../android/softkeyboard/SoftKeyboard.java | 248 +++-- tools/activitycreator/.classpath | 6 - tools/activitycreator/.project | 17 - tools/activitycreator/Android.mk | 17 - tools/activitycreator/MODULE_LICENSE_APACHE2 | 0 tools/activitycreator/etc/Android.mk | 20 - tools/activitycreator/etc/activitycreator | 20 - tools/activitycreator/etc/activitycreator.bat | 22 - tools/activitycreator/src/Android.mk | 23 - .../activitycreator/ActivityCreator.java | 881 ------------------ .../com/android/prefs/AndroidLocation.java | 44 +- .../com.android.ide.eclipse.adt/.project | 2 + .../com/android/ide/eclipse/adt/sdk/Sdk.java | 2 + .../ide/eclipse/common/AndroidConstants.java | 3 - .../common/project/AndroidManifestParser.java | 5 +- .../common/project/AndroidXPathFactory.java | 4 +- .../eclipse/editors/AndroidContentAssist.java | 10 +- .../descriptors/AttributeDescriptor.java | 4 +- .../editors/descriptors/DescriptorsUtils.java | 7 +- .../descriptors/ElementDescriptor.java | 4 +- .../ReferenceAttributeDescriptor.java | 6 +- .../descriptors/TextAttributeDescriptor.java | 4 +- .../editors/layout/WidgetPullParser.java | 5 +- .../layout/descriptors/LayoutDescriptors.java | 9 +- .../layout/parts/UiElementEditPart.java | 4 +- .../layout/uimodel/UiViewElementNode.java | 3 +- .../AndroidManifestDescriptors.java | 5 +- .../descriptors/ClassAttributeDescriptor.java | 4 +- .../manifest/model/UiManifestElementNode.java | 6 +- .../menu/descriptors/MenuDescriptors.java | 6 +- .../editors/uimodel/UiElementNode.java | 18 +- .../editors/uimodel/UiListAttributeNode.java | 4 +- .../wizards/NewXmlFileCreationPage.java | 10 +- .../ide/eclipse/editors/xml/XmlEditor.java | 3 +- .../xml/descriptors/XmlDescriptors.java | 11 +- .../com.android.ide.eclipse.tests/.classpath | 1 + .../com.android.ide.eclipse.tests/.project | 1 + .../layout/UiElementPullParserTest.java | 39 +- tools/runtest | 2 +- tools/scripts/build.alias.template | 2 +- tools/scripts/build.template | 2 +- .../sdkmanager/CommandLineProcessor.java | 57 +- .../app/src/com/android/sdkmanager/Main.java | 44 +- .../android/sdkmanager/SdkCommandLine.java | 32 +- .../com/android/sdkmanager/MockStdLogger.java | 48 + .../src/com/android/sdklib/SdkConstants.java | 22 +- .../sdklib/project/ProjectCreator.java | 366 +++++++- .../sdklib/project/ProjectProperties.java | 4 + .../src/com/android/sdklib/vm/VmManager.java | 184 +++- 57 files changed, 1009 insertions(+), 1269 deletions(-) create mode 100644 pdk/doxygen_config/footer.html create mode 100644 pdk/doxygen_config/header.html delete mode 100644 tools/activitycreator/.classpath delete mode 100644 tools/activitycreator/.project delete mode 100644 tools/activitycreator/Android.mk delete mode 100644 tools/activitycreator/MODULE_LICENSE_APACHE2 delete mode 100644 tools/activitycreator/etc/Android.mk delete mode 100755 tools/activitycreator/etc/activitycreator delete mode 100755 tools/activitycreator/etc/activitycreator.bat delete mode 100644 tools/activitycreator/src/Android.mk delete mode 100644 tools/activitycreator/src/com/android/activitycreator/ActivityCreator.java create mode 100644 tools/sdkmanager/app/tests/com/android/sdkmanager/MockStdLogger.java diff --git a/build/sdk.atree b/build/sdk.atree index f12a30c0b..b9126d4a2 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -112,9 +112,7 @@ framework/swing-worker-1.1.jar tools/lib/swing-worker-1.1.jar bin/traceview tools/traceview framework/traceview.jar tools/lib/traceview.jar -# activitycreator -bin/activitycreator tools/activitycreator -framework/activitycreator.jar tools/lib/activitycreator.jar +# custom ant tasks framework/anttasks.jar tools/lib/anttasks.jar # sdkmanager diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh index 4f3cee815..bf52679ac 100755 --- a/build/tools/make_windows_sdk.sh +++ b/build/tools/make_windows_sdk.sh @@ -87,7 +87,7 @@ function package() { # Remove obsolete stuff from tools TOOLS="$DEST/tools" LIB="$DEST/tools/lib" - rm -v "$TOOLS"/{aapt,aidl,adb,emulator,traceview,draw9patch,hierarchyviewer,dx,dexdump,apkbuilder,ddms,dmtracedump,mksdcard,sqlite3,activitycreator,android} + rm -v "$TOOLS"/{aapt,aidl,adb,emulator,traceview,draw9patch,hierarchyviewer,dx,dexdump,apkbuilder,ddms,dmtracedump,mksdcard,sqlite3,android} rm -v --force "$LIB"/*.so "$LIB"/*.jnilib # Copy all the new stuff in tools @@ -108,7 +108,6 @@ function package() { cp -v development/tools/traceview/etc/traceview.bat "$TOOLS" cp -v development/tools/hierarchyviewer/etc/hierarchyviewer.bat "$TOOLS" cp -v development/tools/draw9patch/etc/draw9patch.bat "$TOOLS" - cp -v development/tools/activitycreator/etc/activitycreator.bat "$TOOLS" cp -v development/tools/sdkmanager/app/etc/android.bat "$TOOLS" # Fix EOL chars to make window users happy - fix all files at the top level only diff --git a/host/windows/prebuilt/usb/driver_amd_64/androidusb.sys b/host/windows/prebuilt/usb/driver_amd_64/androidusb.sys index 70ce24fd11b96b1b5f3e3b4a08f78c11c4c29214..e610ebea005246eb28f5204011314425755ba5cb 100644 GIT binary patch delta 5688 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 diff --git a/host/windows/prebuilt/usb/driver_amd_64/androidusba64.cat b/host/windows/prebuilt/usb/driver_amd_64/androidusba64.cat index 9d5db5d1f4864f72e786e9c244dc6a8f60a32769..cabb288b4d65262cbe86bd1534943ef1d76ce3a3 100644 GIT binary patch literal 7282 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 delta 39 vcmexlF_}-=poyKIjZ>@5qwPB{BRkWACUypcCbmCJjEsgG)xNPY88QF>+)N5$ diff --git a/pdk/Pdk.mk b/pdk/Pdk.mk index 88fedf572..319c5ae3d 100644 --- a/pdk/Pdk.mk +++ b/pdk/Pdk.mk @@ -48,7 +48,7 @@ pdk_docs_intermediates := $(call intermediates-dir-for,PACKAGING,pdkdocs) pdk_templates_dir := development/pdk/docs pdk_config_dir := development/pdk/doxygen_config pdk_docsfile_dir := $(pdk_config_dir)/docsfiles -pdk_hardware_dir := hardware/libhardware/include/hardware +pdk_legacy_hardware_dir := hardware/libhardware_legacy/include/hardware_legacy pdk_camera_dir := frameworks/base/include/ui # Destination directory for docs (templates + doxygenated headers) @@ -74,9 +74,10 @@ doxygen_version = doxygen # Header files to doxygenize. # Add new header files to document here, also adjust the templates to have # descriptions for the new headers and point to the new doxygen created html. -pdk_headers := $(pdk_hardware_dir)/AudioHardwareInterface.h \ - $(pdk_hardware_dir)/gps.h \ - $(pdk_hardware_dir)/wifi.h \ +pdk_headers := \ + $(pdk_legacy_hardware_dir)/AudioHardwareInterface.h \ + $(pdk_legacy_hardware_dir)/gps.h \ + $(pdk_legacy_hardware_dir)/wifi.h \ $(pdk_camera_dir)/CameraHardwareInterface.h # Create a rule to copy the list of PDK headers to be doxyginated. diff --git a/pdk/README b/pdk/README index ab923becf..29f46d41a 100644 --- a/pdk/README +++ b/pdk/README @@ -66,3 +66,7 @@ The build target 'pdk' brings in the pdk/ndk make files into the build system. pdk_docs - which builds the pdk documentation ndk - which builds the native development kit (native compiler, linker, etc.) pdk_all - which builds the above two targets + +for doxygen version changing you can pass in the variable: +doxygen_version='' +on the make line. diff --git a/pdk/doxygen_config/footer.html b/pdk/doxygen_config/footer.html new file mode 100644 index 000000000..691287b6e --- /dev/null +++ b/pdk/doxygen_config/footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/pdk/doxygen_config/header.html b/pdk/doxygen_config/header.html new file mode 100644 index 000000000..b26c3030a --- /dev/null +++ b/pdk/doxygen_config/header.html @@ -0,0 +1,15 @@ + + + + +Doxygen-Generated Content + + + + \ No newline at end of file diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java index c6e572923..36d4233ff 100644 --- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java +++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java @@ -16,7 +16,6 @@ package com.example.android.softkeyboard; -import android.content.Context; import android.inputmethodservice.InputMethodService; import android.inputmethodservice.Keyboard; import android.inputmethodservice.KeyboardView; @@ -25,7 +24,6 @@ import android.util.Log; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.View; -import android.view.WindowManager; import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; @@ -44,6 +42,16 @@ public class SoftKeyboard extends InputMethodService implements KeyboardView.OnKeyboardActionListener { static final boolean DEBUG = false; + /** + * This boolean indicates the optional example code for performing + * processing of hard keys in addition to regular text generation + * from on-screen interaction. It would be used for input methods that + * perform language translations (such as converting text entered on + * a QWERTY keyboard to Chinese), but may not be used for input methods + * that are primarily intended to be used for on-screen text entry. + */ + static final boolean PROCESS_HARD_KEYS = true; + private KeyboardView mInputView; private CandidateView mCandidateView; private CompletionInfo[] mCompletions; @@ -62,13 +70,17 @@ public class SoftKeyboard extends InputMethodService private String mWordSeparators; + /** + * Helper function to generate the various keyboard layouts used by the + * input method. Takes care of regenerating the layouts if the width + * of the input method changes. + */ private void makeKeyboards() { - // Configuration change is coming after the keyboard gets recreated. So don't rely on that. - // If keyboards have already been made, check if we have a screen width change and - // create the keyboard layouts again at the correct orientation if (mQwertyKeyboard != null) { - WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE); - int displayWidth = wm.getDefaultDisplay().getWidth(); + // Configuration changes can happen after the keyboard gets recreated, + // so we need to be able to re-build the keyboards if the available + // space has changed. + int displayWidth = getMaxWidth(); if (displayWidth == mLastDisplayWidth) return; mLastDisplayWidth = displayWidth; } @@ -77,14 +89,25 @@ public class SoftKeyboard extends InputMethodService mSymbolsShiftedKeyboard = new LatinKeyboard(this, R.xml.symbols_shift); } + /** + * Main initialization of the input method component. Be sure to call + * to super class. + */ @Override public void onCreate() { super.onCreate(); makeKeyboards(); mWordSeparators = getResources().getString(R.string.word_separators); } - @Override - public View onCreateInputView() { + /** + * Called by the framework when your view for creating input needs to + * be generated. This will be called the first time your input method + * is displayed, and every time it needs to be re-created such as due to + * a configuration change. + */ + @Override public View onCreateInputView() { + // We call makeKeyboards() here to regenerate them if needed due to + // a configuration change. makeKeyboards(); mInputView = (KeyboardView) getLayoutInflater().inflate( R.layout.input, null); @@ -93,15 +116,27 @@ public class SoftKeyboard extends InputMethodService return mInputView; } - @Override - public View onCreateCandidatesView() { + /** + * Called by the framework when your view for showing candidates needs to + * be generated, like {@link #onCreateInputView}. + */ + @Override public View onCreateCandidatesView() { mCandidateView = new CandidateView(this); mCandidateView.setService(this); return mCandidateView; } - @Override - public void onStartInputView(EditorInfo attribute, boolean restarting) { + /** + * This is the main point where we do our initialization of the input method + * to begin operating on an application. At this point we have been + * bound to the client, and are now receiving all of the detailed information + * about the target of our edits. + */ + @Override public void onStartInputView(EditorInfo attribute, boolean restarting) { + super.onStartInputView(attribute, restarting); + + // Reset our state. We want to do this even if restarting, because + // the underlying state of the text editor could have changed in any way. mComposing.setLength(0); updateCandidates(); @@ -114,57 +149,105 @@ public class SoftKeyboard extends InputMethodService mCompletionOn = false; mCompletions = null; Keyboard keyboard; + + // We are now going to initialize our state based on the type of + // text being edited. switch (attribute.inputType&EditorInfo.TYPE_MASK_CLASS) { case EditorInfo.TYPE_CLASS_NUMBER: case EditorInfo.TYPE_CLASS_DATETIME: + // Numbers and dates default to the symbols keyboard, with + // no extra features. keyboard = mSymbolsKeyboard; break; + case EditorInfo.TYPE_CLASS_PHONE: + // Phones will also default to the symbols keyboard, though + // often you will want to have a dedicated phone keyboard. keyboard = mSymbolsKeyboard; break; - default: + + case EditorInfo.TYPE_CLASS_TEXT: + // This is general text editing. We will default to the + // normal alphabetic keyboard, and assume that we should + // be doing predictive text (showing candidates as the + // user types). keyboard = mQwertyKeyboard; mPredictionOn = true; - // Make sure that passwords are not displayed in candidate view + + // We now look for a few special variations of text that will + // modify our behavior. int variation = attribute.inputType & EditorInfo.TYPE_MASK_VARIATION; if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD) { + // Do not display predictions / what the user is typing + // when they are entering a password. mPredictionOn = false; } + if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS || variation == EditorInfo.TYPE_TEXT_VARIATION_URI) { + // Our predictions are not useful for e-mail addresses + // or URIs. mPredictionOn = false; } + if ((attribute.inputType&EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) { + // If this is an auto-complete text view, then our predictions + // will not be shown and instead we will allow the editor + // to supply their own. We only show the editor's + // candidates when in fullscreen mode, otherwise relying + // own it displaying its own UI. mPredictionOn = false; mCompletionOn = isFullscreenMode(); } + + // We also want to look at the current state of the editor + // to decide whether our alphabetic keyboard should start out + // shifted. updateShiftKeyState(attribute); break; + + default: + // For all unknown input types, default to the alphabetic + // keyboard with no special features. + keyboard = mQwertyKeyboard; } + // Apply the selected keyboard to the input view. if (mInputView != null) { mInputView.setKeyboard(keyboard); mInputView.closing(); } - - mComposing.setLength(0); - setSuggestions(null, false, false); } - @Override - public void onFinishInput() { + /** + * This is called when the user is done editing a field. We can use + * this to reset our state. + */ + @Override public void onFinishInput() { super.onFinishInput(); + + // Clear current composing text and candidates. mComposing.setLength(0); updateCandidates(); + + // We only hide the candidates window when finishing input on + // a particular editor, to avoid popping the underlying application + // up and down if the user is entering text into the bottom of + // its window. + setCandidatesViewShown(false); + if (mInputView != null) { mInputView.closing(); } } - @Override - public void onUpdateSelection(int oldSelStart, int oldSelEnd, + /** + * Deal with the editor reporting movement of its cursor. + */ + @Override public void onUpdateSelection(int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) { + // If the current selection in the text view changes, we should // clear whatever candidate text we have. if (mComposing.length() > 0 && (newSelStart != candidatesEnd @@ -178,8 +261,13 @@ public class SoftKeyboard extends InputMethodService } } - @Override - public void onDisplayCompletions(CompletionInfo[] completions) { + /** + * This tells us about completions that the editor has determined based + * on the current text in it. We want to use this in fullscreen mode + * to show the completions ourself, since the editor can not be seen + * in that situation. + */ + @Override public void onDisplayCompletions(CompletionInfo[] completions) { if (mCompletionOn) { mCompletions = completions; if (completions == null) { @@ -196,6 +284,11 @@ public class SoftKeyboard extends InputMethodService } } + /** + * This translates incoming hard key events in to edit operations on an + * InputConnection. It is only needed when using the + * PROCESS_HARD_KEYS option. + */ private boolean translateKeyDown(int keyCode, KeyEvent event) { mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState, keyCode, event); @@ -228,55 +321,71 @@ public class SoftKeyboard extends InputMethodService return true; } - @Override - public boolean onKeyDown(int keyCode, KeyEvent event) { + /** + * Use this to monitor key events being delivered to the application. + * We get first crack at them, and can either resume them or let them + * continue to the app. + */ + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: + // The InputMethodService already takes care of the back + // key for us, to dismiss the input method if it is shown. + // However, our keyboard could be showing a pop-up window + // that back should dismiss, so we first allow it to do that. if (event.getRepeatCount() == 0 && mInputView != null) { if (mInputView.handleBack()) { return true; } } break; + case KeyEvent.KEYCODE_DEL: + // Special handling of the delete key: if we currently are + // composing text for the user, we want to modify that instead + // of let the application to the delete itself. if (mComposing.length() > 0) { onKey(Keyboard.KEYCODE_DELETE, null); return true; } break; + default: - if (mPredictionOn && translateKeyDown(keyCode, event)) { - return true; + // For all other keys, if we want to do transformations on + // text being entered with a hard keyboard, we need to process + // it and do the appropriate action. + if (PROCESS_HARD_KEYS) { + if (mPredictionOn && translateKeyDown(keyCode, event)) { + return true; + } } } + return super.onKeyDown(keyCode, event); } - @Override - public boolean onKeyUp(int keyCode, KeyEvent event) { - switch (keyCode) { - case KeyEvent.KEYCODE_DPAD_DOWN: - case KeyEvent.KEYCODE_DPAD_UP: - case KeyEvent.KEYCODE_DPAD_LEFT: - case KeyEvent.KEYCODE_DPAD_RIGHT: - // Enable shift key and DPAD to do selections - if (mInputView != null && mInputView.isShown() && mInputView.isShifted()) { - event = new KeyEvent(event.getDownTime(), event.getEventTime(), - event.getAction(), event.getKeyCode(), event.getRepeatCount(), - KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON); - getCurrentInputConnection().sendKeyEvent(event); - return true; - } - break; - default: - if (mPredictionOn) { - mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState, - keyCode, event); - } + /** + * Use this to monitor key events being delivered to the application. + * We get first crack at them, and can either resume them or let them + * continue to the app. + */ + @Override public boolean onKeyUp(int keyCode, KeyEvent event) { + // If we want to do transformations on text being entered with a hard + // keyboard, we need to process the up events to update the meta key + // state we are tracking. + if (PROCESS_HARD_KEYS) { + if (mPredictionOn) { + mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState, + keyCode, event); + } } + return super.onKeyUp(keyCode, event); } + /** + * Helper function to commit any text being composed in to the editor. + */ private void commitTyped(InputConnection inputConnection) { if (mComposing.length() > 0) { inputConnection.commitText(mComposing, mComposing.length()); @@ -285,7 +394,11 @@ public class SoftKeyboard extends InputMethodService } } - public void updateShiftKeyState(EditorInfo attr) { + /** + * Helper to update the shift state of our keyboard based on the initial + * editor state. + */ + private void updateShiftKeyState(EditorInfo attr) { if (attr != null && mInputView != null && mQwertyKeyboard == mInputView.getKeyboard()) { int caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType); @@ -293,6 +406,9 @@ public class SoftKeyboard extends InputMethodService } } + /** + * Helper to determine if a given character code is alphabetic. + */ private boolean isAlphabet(int code) { if (Character.isLetter(code)) { return true; @@ -301,6 +417,9 @@ public class SoftKeyboard extends InputMethodService } } + /** + * Helper to send a key down / key up pair to the current editor. + */ private void keyDownUp(int keyEventCode) { getCurrentInputConnection().sendKeyEvent( new KeyEvent(KeyEvent.ACTION_DOWN, keyEventCode)); @@ -308,6 +427,9 @@ public class SoftKeyboard extends InputMethodService new KeyEvent(KeyEvent.ACTION_UP, keyEventCode)); } + /** + * Helper to send a character to the editor as raw key events. + */ private void sendKey(int keyCode) { switch (keyCode) { case '\n': @@ -378,13 +500,13 @@ public class SoftKeyboard extends InputMethodService public void setSuggestions(List suggestions, boolean completions, boolean typedWordValid) { - mCandidateView.setSuggestions(suggestions, completions, typedWordValid); - if (suggestions != null && suggestions.size() > 0) { - setCandidatesViewShown(true); - } else if (isFullscreenMode()) { - setCandidatesViewShown(true); - } else { - setCandidatesViewShown(false); + if (mCandidateView != null) { + mCandidateView.setSuggestions(suggestions, completions, typedWordValid); + if (suggestions != null && suggestions.size() > 0) { + setCandidatesViewShown(true); + } else if (isFullscreenMode()) { + setCandidatesViewShown(true); + } } } @@ -399,7 +521,6 @@ public class SoftKeyboard extends InputMethodService getCurrentInputConnection().commitText("", 0); updateCandidates(); } else { - //getCurrentInputConnection().deleteSurroundingText(1, 0); keyDownUp(KeyEvent.KEYCODE_DEL); } updateShiftKeyState(getCurrentInputEditorInfo()); @@ -439,7 +560,7 @@ public class SoftKeyboard extends InputMethodService updateCandidates(); } else { getCurrentInputConnection().commitText( - String.valueOf((char) primaryCode), 0); + String.valueOf((char) primaryCode), 1); } } @@ -459,7 +580,7 @@ public class SoftKeyboard extends InputMethodService } } - protected String getWordSeparators() { + private String getWordSeparators() { return mWordSeparators; } @@ -504,10 +625,11 @@ public class SoftKeyboard extends InputMethodService } public void swipeUp() { - // ? } - public void onPress(int primaryCode) { } + public void onPress(int primaryCode) { + } - public void onRelease(int primaryCode) { } + public void onRelease(int primaryCode) { + } } diff --git a/tools/activitycreator/.classpath b/tools/activitycreator/.classpath deleted file mode 100644 index fb5011632..000000000 --- a/tools/activitycreator/.classpath +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tools/activitycreator/.project b/tools/activitycreator/.project deleted file mode 100644 index b81a8871d..000000000 --- a/tools/activitycreator/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - ActivityCreator - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - diff --git a/tools/activitycreator/Android.mk b/tools/activitycreator/Android.mk deleted file mode 100644 index 924c9b6c4..000000000 --- a/tools/activitycreator/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 -# -# 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. - -ACTIVITY_CREATOR_LOCAL_DIR := $(call my-dir) -include $(ACTIVITY_CREATOR_LOCAL_DIR)/etc/Android.mk -include $(ACTIVITY_CREATOR_LOCAL_DIR)/src/Android.mk diff --git a/tools/activitycreator/MODULE_LICENSE_APACHE2 b/tools/activitycreator/MODULE_LICENSE_APACHE2 deleted file mode 100644 index e69de29bb..000000000 diff --git a/tools/activitycreator/etc/Android.mk b/tools/activitycreator/etc/Android.mk deleted file mode 100644 index 9128d8838..000000000 --- a/tools/activitycreator/etc/Android.mk +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 -# -# 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. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PREBUILT_EXECUTABLES := activitycreator -include $(BUILD_HOST_PREBUILT) - diff --git a/tools/activitycreator/etc/activitycreator b/tools/activitycreator/etc/activitycreator deleted file mode 100755 index f387d171c..000000000 --- a/tools/activitycreator/etc/activitycreator +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 -# -# 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. - -TOOLS_DIR=`dirname $0` -AC_JARFILE=$TOOLS_DIR/lib/activitycreator.jar - -java -Dcom.android.activitycreator.toolsdir=$TOOLS_DIR -cp $AC_JARFILE com.android.activitycreator.ActivityCreator "$@" diff --git a/tools/activitycreator/etc/activitycreator.bat b/tools/activitycreator/etc/activitycreator.bat deleted file mode 100755 index 1cf1847fc..000000000 --- a/tools/activitycreator/etc/activitycreator.bat +++ /dev/null @@ -1,22 +0,0 @@ -@echo off -rem Copyright (C) 2007 The Android Open Source Project -rem -rem Licensed under the Apache License, Version 2.0 (the "License"); -rem you may not use this file except in compliance with the License. -rem You may obtain a copy of the License at -rem -rem http://www.apache.org/licenses/LICENSE-2.0 -rem -rem Unless required by applicable law or agreed to in writing, software -rem distributed under the License is distributed on an "AS IS" BASIS, -rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -rem See the License for the specific language governing permissions and -rem limitations under the License. - -rem don't modify the caller's environmeny -setlocal - -set toolsdir=%~dp0\ -set acjarfile=%toolsdir%/lib/activitycreator.jar - -call java -Dcom.android.activitycreator.toolsdir="%toolsdir%" -cp "%acjarfile%" com.android.activitycreator.ActivityCreator %* diff --git a/tools/activitycreator/src/Android.mk b/tools/activitycreator/src/Android.mk deleted file mode 100644 index eea427a0d..000000000 --- a/tools/activitycreator/src/Android.mk +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2007 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 -# -# 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. - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_MODULE := activitycreator - -include $(BUILD_HOST_JAVA_LIBRARY) - diff --git a/tools/activitycreator/src/com/android/activitycreator/ActivityCreator.java b/tools/activitycreator/src/com/android/activitycreator/ActivityCreator.java deleted file mode 100644 index f7db7df6d..000000000 --- a/tools/activitycreator/src/com/android/activitycreator/ActivityCreator.java +++ /dev/null @@ -1,881 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 - * - * 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.activitycreator; - -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import javax.xml.XMLConstants; -import javax.xml.namespace.NamespaceContext; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - -/** - * Creates the basic files needed to get an Android project up and running. Also - * allows creation of IntelliJ project files. - * - * @hide - */ -public class ActivityCreator { - // FIXME: target platform must be provided by the user - private final String mTargetPlatform = "android-1.1"; - - /** Whether we are in silent mode (i.e.: don't print any non-error messages) */ - private boolean mSilent; - - /** Path to tools */ - private String mToolsDir; - - /** Path to SDK */ - private String mSdkDir; - - /** Path to target platform's template folder */ - private String mTemplateDir; - - /** Path to tools/lib for the build templates */ - private String mLibDir; - - /** Path to output */ - private String mOutDir; - - /** IDE to generate for */ - private String mIde; - - /** Data used for the "alias" mode */ - private String mAliasData; - - /** Application label used in the "alias" mode */ - private String mApplicationLabel; - - /** Package of Activity */ - private String mPackageFull; - - /** - * Constructs object. - * @param args arguments passed to the program - */ - public ActivityCreator(String[] args) { - mSilent = false; - - mIde = ""; - - initPathVars(); - parseArgs(args); - - if (isAliasProject()) { - setupAliasProject(); - } else { - setupProject(); - } - } - - /** - * Initializes the path variables based on location of this class. - */ - private void initPathVars() { - /* We get passed a property for the tools dir */ - String toolsDirProp = System.getProperty("com.android.activitycreator.toolsdir"); - if (toolsDirProp == null) { - // for debugging, it's easier to override using the process environment - toolsDirProp = System.getenv("com.android.activitycreator.toolsdir"); - } - if (toolsDirProp == null) { - printHelpAndExit("ERROR: The tools directory property is not set, please make sure you are executing activitycreator or activitycreator.bat"); - } - - /* Absolute path */ - File toolsDir = new File(toolsDirProp); - try { - mToolsDir = toolsDir.getCanonicalPath(); - } catch (IOException e) { - printHelpAndExit("ERROR: Could not determine the tools directory."); - } - toolsDir = new File(mToolsDir); - - mSdkDir = toolsDir.getParent(); - mLibDir = mToolsDir + File.separator + "lib"; - mTemplateDir = mSdkDir + File.separator + "platforms" + File.separator + - mTargetPlatform + File.separator + "templates"; - try { - mOutDir = new File("").getCanonicalPath(); - } catch (IOException e) { - printHelpAndExit("ERROR: Could not determine the current directory."); - } - - if (!toolsDir.exists()) { - printHelpAndExit("ERROR: Tools directory does not exist."); - } - - if (!(new File(mSdkDir).exists())) { - printHelpAndExit("ERROR: SDK directory does not exist."); - } - - if (!(new File(mTemplateDir).exists())) { - printHelpAndExit("ERROR: Target platform templates directory does not exist."); - } - - if (!(new File(mLibDir).exists())) { - printHelpAndExit("ERROR: Library directory does not exist."); - } - } - - /** - * Parses command-line arguments, or prints help/usage and exits if error. - * @param args arguments passed to the program - */ - private void parseArgs(String[] args) { - final int numArgs = args.length; - - try { - int argPos = 0; - for (; argPos < numArgs; argPos++) { - final String arg = args[argPos]; - if (arg.equals("-o") || arg.equals("-out") || arg.equals("--out")) { - argPos++; - mOutDir = args[argPos]; - } else if (arg.equals("-d") || arg.equals("-data") || arg.equals("--data")) { - argPos++; - mAliasData = args[argPos]; - } else if (arg.equals("-l") || arg.equals("-label") || arg.equals("--label")) { - argPos++; - mApplicationLabel = args[argPos]; - } else if (arg.equals("-i") || arg.equals("-ide") || arg.equals("--ide")) { - argPos++; - mIde = args[argPos].toLowerCase(); - } else if (arg.equals("-h") || arg.equals("-help") || arg.equals("--help")) { - printHelpAndExit(null); - } else if (arg.equals("-s") || arg.equals("-silent") || arg.equals("--silent")) { - mSilent = true; - } else { - if (mPackageFull == null) { - mPackageFull = extractPackageFromManifest(args[argPos]); - if (mPackageFull == null) { - mPackageFull = args[argPos]; - } - } else { - /* Package has already been set, so this is an extra argument */ - printHelpAndExit("ERROR: Too many arguments: %1$s", args[argPos]); - } - } - } - } catch (ArrayIndexOutOfBoundsException e) { - /* Any OOB triggers help */ - printHelpAndExit("ERROR: Not enough arguments."); - } - - if (isStringEmpty(mPackageFull)) { - printHelpAndExit("ERROR: Please enter a package."); - } - - if (isStringEmpty(mOutDir)) { - printHelpAndExit("ERROR: Please enter an output directory."); - } - - // we need both application label and url for the "alias" mode - if (isStringEmpty(mAliasData) ^ isStringEmpty(mApplicationLabel)) { - printHelpAndExit("ERROR: Alias projects require both --data and --label."); - } - - if (mIde.equals("eclipse")) { - printHelpAndExit("ERROR: For Eclipse support, please install the Eclipse ADT plugin and use its New Project Wizard."); - } - } - - /** - * Prints the help/usage and exits. - * @param errorFormat Optional error message to print prior to usage using String.format - * @param args Arguments for String.format - */ - private void printHelpAndExit(String errorFormat, Object... args) { - if (errorFormat != null) { - System.err.println(String.format(errorFormat, args)); - } - - /* - * usage should fit in 80 columns - * 12345678901234567890123456789012345678901234567890123456789012345678901234567890 - */ - final String usage = "\n" + - "Activity Creator Script.\n" + - "\n" + - "Usage:\n" + - " activitycreator --out outdir [--ide intellij] your.package.name.ActivityName\n" + - " activitycreator --out outdir [--ide intellij] path/to/AndroidManifest.xml\n" + - " activitycreator --out outdir --data data --label app_label your.package.name\n" + - "\n" + - "With both the --data and --label options, ActivityCreator creates the structure\n" + - "of an 'alias' Android application.\n" + - " An Alias project is an application with no code that simply launches an\n" + - " android.intent.action.VIEW intent with the provided data.\n" + - " The following will be created (existing files will not be modified):\n" + - " - AndroidManifest.xml: The application manifest file.\n" + - " - build.xml: An Ant script to build/package the application.\n" + - " - res/values/strings.xml: an XML file defining the application label\n" + - " string resource.\n" + - " - res/xml/alias.xml: an XML file defining the VIEW intent and its data.\n " + - "\n" + - "Without --data and --label, ActivityCreator creates the structure of a minimal\n" + - "Android application.\n" + - " The following will be created (existing files will not be modified):\n" + - " - AndroidManifest.xml: The application manifest file.\n" + - " - build.xml: An Ant script to build/package the application.\n" + - " - res : The resource directory.\n" + - " - src : The source directory.\n" + - " - src/your/package/name/ActivityName.java the Activity java class.\n" + - " packageName is a fully qualified java Package in the format\n" + - " .... (with at least two components).\n" + - " - bin : The output folder for the build script.\n" + - "\n" + - "Options:\n" + - " -o , --out \n" + - " Specifies where to create the files/folders.\n" + - " -i intellij, --ide intellij\n" + - " Creates project files for IntelliJ (non alias application only)\n" + - " -d , --data \n" + - " The data passed to the VIEW intent. For instance, this can be a url,\n" + - " such as http://www.android.com\n" + - " -l , --label \n" + - " The name the alias application will have in the HOME screen.\n" + - " -h, --help\n" + - " Display this help.\n" + - " -s, --silent\n" + - " Silent mode.\n" + - "\n" + - "For Eclipse support, please use the ADT plugin.\n"; - - println(usage); - System.exit(1); - } - - /** - * Installs a destination file that is based on a code template file at the source. - * For each match of each key in keywords will be replaced with its - * corresponding value in the destination file. - * - * Invokes {@link #installProjectTemplate(String, String, Map, boolean, String)} with - * the main project output directory (#mOutDir) as the last argument. - * - * @param source the name of to the source template file - * @param dest the path to the destination file - * @param keywords in the destination file, the keys will be replaced by their values - * @param force True to force writing the file even if it already exists - * - * @see #installProjectTemplate(String, String, Map, boolean, String) - */ - private void installProjectTemplate(String source, String dest, - Map keywords, boolean force) { - installProjectTemplate(source, dest, keywords, force, mOutDir); - } - - /** - * Installs a destination file that is based on a code template file at the source. - * For each match of each key in keywords will be replaced with its - * corresponding value in the destination file. - * - * @param source the name of to the source template file - * @param dest the path to the destination file - * @param keywords in the destination file, the keys will be replaced by their values - * @param force True to force writing the file even if it already exists - * @param outDir the output directory to copy the template file to - */ - private void installProjectTemplate(String source, String dest, - Map keywords, boolean force, String outDir) { - final String sourcePath = mTemplateDir + File.separator + source; - final String destPath = outDir + File.separator + dest; - - installFullPathTemplate(sourcePath, destPath, keywords, force); - } - - /** - * Installs a destination file that is based on a build template file at the source. - * For each match of each key in keywords will be replaced with its - * corresponding value in the destination file. - * - * Invokes {@link #installBuildTemplate(String, String, Map, boolean, String)} with - * the main project output directory (#mOutDir) as the last argument. - * - * @param source the name of to the source template file - * @param dest the path to the destination file - * @param keywords in the destination file, the keys will be replaced by their values - * @param force True to force writing the file even if it already exists - * - * @see #installBuildTemplate(String, String, Map, boolean, String) - */ - private void installBuildTemplate(String source, String dest, - Map keywords, boolean force) { - installBuildTemplate(source, dest, keywords, force, mOutDir); - } - - /** - * Installs a destination file that is based on a build template file at the source. - * For each match of each key in keywords will be replaced with its - * corresponding value in the destination file. - * - * @param source the name of to the source template file - * @param dest the path to the destination file - * @param keywords in the destination file, the keys will be replaced by their values - * @param force True to force writing the file even if it already exists - * @param outDir the output directory to copy the template file to - */ - private void installBuildTemplate(String source, String dest, - Map keywords, boolean force, String outDir) { - final String sourcePath = mLibDir + File.separator + source; - final String destPath = outDir + File.separator + dest; - - installFullPathTemplate(sourcePath, destPath, keywords, force); - } - - /** - * Installs a destination file that is based on the template file at source. - * For each match of each key in keywords will be replaced with its - * corresponding value in the destination file. - * - * @param sourcePath the full path to the source template file - * @param destPath the full path to the destination file - * @param keywords in the destination file, the keys will be replaced by their values - * @param force True to force writing the file even if it already exists - */ - private void installFullPathTemplate(String sourcePath, String destPath, - Map keywords, boolean force) { - final File destPathFile = new File(destPath); - if (!force && destPathFile.exists()) { - println("WARNING! The file %1$s already exists and will not be overwritten!\n", - destPathFile.getName()); - return; - } - - try { - BufferedWriter out = new BufferedWriter(new FileWriter(destPathFile)); - BufferedReader in = new BufferedReader(new FileReader(sourcePath)); - String line; - - while ((line = in.readLine()) != null) { - for (String key : keywords.keySet()) { - line = line.replace(key, keywords.get(key)); - } - - out.write(line); - out.newLine(); - } - - out.close(); - in.close(); - } catch (Exception e) { - printHelpAndExit("ERROR: Could not access %1$s: %2$s", destPath, e.getMessage()); - } - - println("Added file %1$s", destPath); - } - - /** - * Set up the Android-related files - */ - private void setupProject() { - String packageName = null; - String activityName = null; - String activityTestName = null; - try { - /* Grab package and Activity names */ - int lastPeriod = mPackageFull.lastIndexOf('.'); - packageName = mPackageFull.substring(0, lastPeriod); - if (lastPeriod < mPackageFull.length() - 1) { - activityName = mPackageFull.substring(lastPeriod+1); - activityTestName = activityName + "Test"; - } - - if (packageName.indexOf('.') == -1) { - printHelpAndExit("ERROR: Package name must be composed of at least two java identifiers."); - } - } catch (RuntimeException e) { - printHelpAndExit("ERROR: Invalid package or activity name."); - } - - println("Package: %1$s", packageName); - println("Output directory: %1$s", mOutDir); - String testsOutDir = mOutDir + File.separator + "tests"; - println("Tests directory: %1$s", testsOutDir); - - if (activityName != null) { - println("Activity name: %1$s", activityName); - } - if (activityTestName != null) { - println("ActivityTest name: %1$s", activityTestName); - } - - final HashMap keywords = createBaseKeywordMap(); - - addTargetKeywords(keywords); - - keywords.put("PACKAGE", packageName); - if (activityName != null) { - keywords.put("ACTIVITY_NAME", activityName); - } - - final String packagePath = - stripString(packageName.replace(".", File.separator), - File.separatorChar); - keywords.put("PACKAGE_PATH", packagePath); - - /* Other files that are always created */ - - /* Make Activity java file */ - final String srcDir = "src" + File.separator + packagePath; - createDirs(srcDir); - if (isDirEmpty(srcDir, "Java") && activityName != null) { - installProjectTemplate("java_file.template", srcDir + File.separator - + activityName + ".java", keywords, false /*force*/); - } - createDirs("bin"); - createDirs("libs"); - createDirs("res"); - - /* Make ActivityTest java file */ - createDirs(srcDir, testsOutDir); - if (isDirEmpty(srcDir, "Java", testsOutDir) && activityTestName != null) { - installProjectTemplate("java_tests_file.template", srcDir + File.separator - + activityTestName + ".java", keywords, false, testsOutDir); - } - createDirs("bin", testsOutDir); - createDirs("libs", testsOutDir); - createDirs("res", testsOutDir); - - /* Make res files */ - final String valuesDir = "res" + File.separator + "values"; - createDirs(valuesDir); - if (isDirEmpty(valuesDir, "Resource Values")) { - installProjectTemplate("strings.template", valuesDir + File.separator - + "strings.xml", keywords, false /*force*/); - } - - final String layoutDir = "res" + File.separator + "layout"; - createDirs(layoutDir); - if (isDirEmpty(layoutDir, "Resource Layout")) { - installProjectTemplate("layout.template", layoutDir + File.separator - + "main.xml", keywords, false /*force*/); - } - - /* Make AndroidManifest.xml and build.xml files */ - installProjectTemplate("AndroidManifest.template", "AndroidManifest.xml", - keywords, false /*force*/); - - installBuildTemplate("build.template", "build.xml", keywords, false /*force*/); - installBuildTemplate("default.properties.template", "default.properties", keywords, - true /*force*/); - - /* Make AndroidManifest.xml and build.xml files for tests */ - installProjectTemplate("AndroidManifest.tests.template", "AndroidManifest.xml", - keywords, false /*force*/, testsOutDir); - - installBuildTemplate("build.template", "build.xml", keywords, false /*force*/, testsOutDir); - installBuildTemplate("default.properties.template", "default.properties", keywords, - true /*force*/, testsOutDir); - - if (mIde.equals("intellij")) { - /* IntelliJ files */ - if (activityName != null) { - installProjectTemplate("iml.template", activityName + ".iml", keywords, - false /*force*/); - installProjectTemplate("ipr.template", activityName + ".ipr", keywords, - false /*force*/); - installProjectTemplate("iws.template", activityName + ".iws", keywords, - false /*force*/); - } - } else if (!isStringEmpty(mIde)) { - println("WARNING: Unknown IDE option \"%1$s\". No IDE files generated.", - mIde); - } - } - - - /** - * Sets up the files for an alias project. - */ - private void setupAliasProject() { - println("Package: %1$s", mPackageFull); - println("Output directory: %1$s", mOutDir); - println("URL: %1$s", mAliasData); - println("Application label: %1$s", mApplicationLabel); - - if (mIde != null) { - println("Alias project: ignoring --ide option."); - } - - final HashMap keywords = createBaseKeywordMap(); - keywords.put("PACKAGE", mPackageFull); - keywords.put("ALIASDATA", mAliasData); - - // since strings.xml uses ACTIVITY_NAME for the application label we use it as well. - // since we'll use a different AndroidManifest template this is not a problem. - keywords.put("ACTIVITY_NAME", mApplicationLabel); - - /* Make res files */ - final String xmlDir = "res" + File.separator + "xml"; - createDirs(xmlDir); - if (isDirEmpty(xmlDir, "Resource Xml")) { - installProjectTemplate("alias.template", xmlDir + File.separator + "alias.xml", - keywords, false /*force*/); - } - - final String valuesDir = "res" + File.separator + "values"; - createDirs(valuesDir); - if (isDirEmpty(valuesDir, "Resource Values")) { - installProjectTemplate("strings.template", valuesDir + File.separator - + "strings.xml", keywords, false /*force*/); - } - - - /* Make AndroidManifest.xml and build.xml files */ - installProjectTemplate("AndroidManifest.alias.template", "AndroidManifest.xml", keywords, - false /*force*/); - - installBuildTemplate("build.alias.template", "build.xml", keywords, false /*force*/); - installBuildTemplate("default.properties.template", "default.properties", keywords, true /*force*/); - } - - - private HashMap createBaseKeywordMap() { - final HashMap keywords = new HashMap(); - - // When the tools & sdk folder on Windows get written to a properties file, - // we need to transform \ in /, otherwise it gets interpreted as an escape character. - // This is OK since ant can understand / as a separator even under Windows. - // References: - // - http://ant.apache.org/manual/CoreTasks/property.html - // - http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#load(java.io.InputStream) - keywords.put("ANDROID_SDK_TOOLS", mToolsDir.replace('\\', '/')); - keywords.put("ANDROID_SDK_FOLDER", mSdkDir.replace('\\', '/')); - - return keywords; - } - - private void addTargetKeywords(HashMap keywords) { - // FIXME: get this from the target selection - keywords.put("TARGET_MODE", "platform"); - keywords.put("TARGET_API", "1"); // this is potentially wrong but since it's only used - // when editing a project config, this is ok for now. - keywords.put("TARGET_NAME", "android"); // this is only used in add-on mode. - keywords.put("TARGET_FOLDER", mTargetPlatform); - keywords.put("TARGET_MODE", "platform"); - } - - - /** - * Called first. - * @param args arguments passed to the program - */ - public static void main(String[] args) { - new ActivityCreator(args); - } - - /** - * Prints a message unless silence is enabled. - * @param format Format for String.format - * @param args Arguments for String.format - */ - public void println(String format, Object... args) { - if (!mSilent) { - System.out.println(String.format(format, args)); - } - } - - /** - * Checks whether a string is "empty" (null or trimmed length == 0) - * @param s the string to check - * @return true if empty - */ - public static boolean isStringEmpty(String s) { - return (s == null) || (s.trim().length() == 0); - } - - /** - * Creates the path in the output directory along with any parent paths - * that don't exist. - * - * Invokes ActivityCreator#createDirs(String, String) with - * the main project output directory (#mOutDir) as the last argument. - * - * @param path the directory out/path that is created. - * - * @see com.android.activitycreator.ActivityCreator#createDirs(String, String) - */ - public void createDirs(String path) { - createDirs(path, mOutDir); - } - - /** - * Creates the path in the output directory along with any parent paths - * that don't exist. - * - * @param path the directory out/path that is created. - * @param dir the directory in which the path to be created - */ - public void createDirs(String path, String dir) { - final File pathFile = new File(dir + File.separator + path); - boolean existedBefore = true; - - if (!pathFile.exists()) { - if (!pathFile.mkdirs()) { - printHelpAndExit("ERROR: Could not create directory: %1$s", pathFile); - } - existedBefore = false; - } - - if (pathFile.isDirectory()) { - if (!pathFile.canWrite()) { - printHelpAndExit("ERROR: Path is not writable: %1$s", pathFile); - } - } else { - printHelpAndExit("ERROR: Path is not a directory: %1$s", pathFile); - } - - if (!existedBefore) { - try { - println("Created directory %1$s", pathFile.getCanonicalPath()); - } catch (IOException e) { - printHelpAndExit("ERROR: Could not determine canonical path of created directory"); - } - } - } - - /** - * Checks whether the path in the output directory is empty - * - * Invokes ActivityCreator#isDirEmpty(String, String, String) with - * the main project output directory (#mOutDir) as the last argument. - * - * @param path the out/path directory that is checked - * @param message the logical name for what this path points to (used in - * warning message) - * @return whether the directory is empty - * @see com.android.activitycreator.ActivityCreator#isDirEmpty(String, String, String) - */ - public boolean isDirEmpty(String path, String message) { - return isDirEmpty(path, message, mOutDir); - } - - /** - * Checks whether the path in the output directory is empty - * - * @param path the out/path directory that is checked - * @param message the logical name for what this path points to (used in - * warning message) - * @param outDir the output director to check - * @return whether the directory is empty - */ - public boolean isDirEmpty(String path, String message, String outDir) { - File pathFile = new File(outDir + File.separator + path); - - String[] pathListing = pathFile.list(); - if ((pathListing != null) && (pathListing.length > 0)) { - println("WARNING: There are already some %1$s files present. None will be created!", - message); - return false; - } - - return true; - } - - /** - * Strips the string of beginning and trailing characters (multiple - * characters will be stripped, example stripString("..test...", '.') - * results in "test"; - * - * @param s the string to strip - * @param strip the character to strip from beginning and end - * @return the stripped string or the empty string if everything is stripped. - */ - public static String stripString(String s, char strip) { - final int sLen = s.length(); - int newStart = 0, newEnd = sLen - 1; - - while (newStart < sLen && s.charAt(newStart) == strip) { - newStart++; - } - while (newEnd >= 0 && s.charAt(newEnd) == strip) { - newEnd--; - } - - /* - * newEnd contains a char we want, and substring takes end as being - * exclusive - */ - newEnd++; - - if (newStart >= sLen || newEnd < 0) { - return ""; - } - - return s.substring(newStart, newEnd); - } - - /** - * Returns true if the project is an alias project. - *

- * Alias projects require both the --url and the --label options. - * @return boolean true if the project requested is an alias project - */ - private boolean isAliasProject() { - return (!isStringEmpty(mAliasData) && !isStringEmpty(mApplicationLabel)); - } - - /** - * Extracts a "full" package & activity name from an AndroidManifest.xml. - * @param osManifestPath The OS path to the AndroidManifest.xml - * @return A full "package.ActivtyName" if this is a valid manifest, - * or "package." (with a dot at the end) if there's no activity, - * or null if there's no valid package namespace. - */ - private String extractPackageFromManifest(String osManifestPath) { - File f = new File(osManifestPath); - if (!f.isFile()) { - return null; - } - - try { - final String nsPrefix = "android"; - final String nsURI = "http://schemas.android.com/apk/res/android"; - - XPath xpath = XPathFactory.newInstance().newXPath(); - - xpath.setNamespaceContext(new NamespaceContext() { - public String getNamespaceURI(String prefix) { - if (nsPrefix.equals(prefix)) { - return nsURI; - } - return XMLConstants.NULL_NS_URI; - } - - public String getPrefix(String namespaceURI) { - if (nsURI.equals(namespaceURI)) { - return nsPrefix; - } - return null; - } - - @SuppressWarnings("unchecked") - public Iterator getPrefixes(String namespaceURI) { - if (nsURI.equals(namespaceURI)) { - ArrayList list = new ArrayList(); - list.add(nsPrefix); - return list.iterator(); - } - return null; - } - - }); - - InputSource source = new InputSource(new FileReader(osManifestPath)); - String packageName = xpath.evaluate("/manifest/@package", source); - - source = new InputSource(new FileReader(osManifestPath)); - - // Select the "android:name" attribute of all nodes but only if they - // contain a sub-node with an "android:name" attribute which - // is 'android.intent.action.MAIN' and an with an - // "android:name" attribute which is 'android.intent.category.LAUNCHER' - String expression = String.format("/manifest/application/activity" + - "[intent-filter/action/@%1$s:name='android.intent.action.MAIN' and " + - "intent-filter/category/@%1$s:name='android.intent.category.LAUNCHER']" + - "/@%1$s:name", nsPrefix); - - NodeList activityNames = (NodeList) xpath.evaluate(expression, source, - XPathConstants.NODESET); - - // If we get here, both XPath expressions were valid so we're most likely dealing - // with an actual AndroidManifest.xml file. The nodes may not have the requested - // attributes though, if which case we should warn. - - if (packageName == null || packageName.length() == 0) { - printHelpAndExit("ERROR: missing in '%1$s'", - osManifestPath); - } - - // Get the first activity that matched earlier. If there is no activity, - // activityName is set to an empty string and the generated "combined" name - // will be in the form "package." (with a dot at the end). - String activityName = ""; - if (activityNames.getLength() > 0) { - activityName = activityNames.item(0).getNodeValue(); - } - - if (!mSilent && activityNames.getLength() > 1) { - println("WARNING: There is more than one activity defined in '%1$s'.\n" + - "Only the first one will be used. If this is not appropriate, you need\n" + - "to specify one of these values manually instead:", - osManifestPath); - - for (int i = 0; i < activityNames.getLength(); i++) { - String name = activityNames.item(i).getNodeValue(); - name = combinePackageActivityNames(packageName, name); - println("- %1$s", name); - } - } - - if (!mSilent && activityName.length() == 0) { - println("WARNING: missing in '%2$s'.\n" + - "No activity will be generated.", - nsPrefix, osManifestPath); - } - - return combinePackageActivityNames(packageName, activityName); - - } catch (IOException e) { - printHelpAndExit("ERROR: failed to read '%1$s', %2$s", osManifestPath, e.getMessage()); - } catch (XPathExpressionException e) { - Throwable t = e.getCause(); - printHelpAndExit("ERROR: failed to parse '%1$s', %2$s", osManifestPath, - t == null ? e.getMessage() : t.getMessage()); - } - - return null; - } - - private String combinePackageActivityNames(String packageName, - String activityName) { - // Activity Name can have 3 forms: - // - ".Name" means this is a class name in the given package name. - // The full FQCN is thus packageName + ".Name" - // - "Name" is an older variant of the former. Full FQCN is packageName + "." + "Name" - // - "com.blah.Name" is a full FQCN. Ignore packageName and use activityName as-is. - // To be valid, the package name should have at least two components. This is checked - // later during the creation of the build.xml file, so we just need to detect there's - // a dot but not at pos==0. - - int pos = activityName.indexOf('.'); - if (pos == 0) { - return packageName + activityName; - } else if (pos > 0) { - return activityName; - } else { - return packageName + "." + activityName; - } - } - -} diff --git a/tools/androidprefs/src/com/android/prefs/AndroidLocation.java b/tools/androidprefs/src/com/android/prefs/AndroidLocation.java index 3530f2dd1..a7ceb76a4 100644 --- a/tools/androidprefs/src/com/android/prefs/AndroidLocation.java +++ b/tools/androidprefs/src/com/android/prefs/AndroidLocation.java @@ -56,47 +56,15 @@ public final class AndroidLocation { */ public final static String getFolder() throws AndroidLocationException { if (sPrefsLocation == null) { - String osName = System.getProperty("os.name"); - - // First we check for unknown or non windows OS. - if (osName == null || osName.startsWith("Windows") == false) { - String home = findValidPath("user.home", "HOME"); - - if (home != null) { - sPrefsLocation = home + File.separator + ".android" + File.separator; - } - } else { - String localAppData = findValidPath("LOCALAPPDATA"); - if (localAppData == null) { - localAppData = findValidPath("USERPROFILE"); - if (localAppData != null) { - localAppData = localAppData + "\\Local Settings\\Application Data"; - - // check that this directory exists. - File f = new File(localAppData); - if (f.isDirectory() == false) { - localAppData = null; - } - } - - // ok if nothing worked, revert to HOME - if (localAppData == null) { - localAppData = findValidPath("HOME", "user.home"); - } - } - - if (localAppData != null) { - sPrefsLocation = localAppData + "\\Android\\"; - } - } + String home = findValidPath("user.home", "HOME"); - // if all the above failed, try to create a temporary file to get its parent and - // use that as the folder - if (sPrefsLocation == null) { - // no home dir? + // if the above failed, we throw an exception. + if (home == null) { throw new AndroidLocationException( "Unable to get the home directory. Make sure the user.home property is set up"); } else { + sPrefsLocation = home + File.separator + ".android" + File.separator; + // make sure the folder exists! File f = new File(sPrefsLocation); if (f.exists() == false) { @@ -107,7 +75,7 @@ public final class AndroidLocation { } } } - + return sPrefsLocation; } diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/.project b/tools/eclipse/plugins/com.android.ide.eclipse.adt/.project index 6689a1f9b..c7b1ad476 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/.project +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/.project @@ -3,6 +3,8 @@ adt + SdkLib + SdkUiLib diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/sdk/Sdk.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/sdk/Sdk.java index a0a3603fb..172b4ae34 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/sdk/Sdk.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/sdk/Sdk.java @@ -82,9 +82,11 @@ public class Sdk { logMessages.add(throwable.getMessage()); } } + public void warning(String warningFormat, Object... arg) { logMessages.add(String.format(warningFormat, arg)); } + public void printf(String msgFormat, Object... arg) { logMessages.add(String.format(msgFormat, arg)); } diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/AndroidConstants.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/AndroidConstants.java index 0e780a982..65817c306 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/AndroidConstants.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/AndroidConstants.java @@ -158,9 +158,6 @@ public class AndroidConstants { /** Regexp for aidl extension, i.e. "\.aidl$" */ public final static String RE_AIDL_EXT = "\\.aidl$"; //$NON-NLS-1$ - /** Namespace for the resource XML, i.e. "http://schemas.android.com/apk/res/android" */ - public final static String NS_RESOURCES = "http://schemas.android.com/apk/res/android"; //$NON-NLS-1$ - /** Namespace pattern for the custom resource XML, i.e. "http://schemas.android.com/apk/res/%s" */ public final static String NS_CUSTOM_RESOURCES = "http://schemas.android.com/apk/res/%1$s"; //$NON-NLS-1$ diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidManifestParser.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidManifestParser.java index 2866ce21f..850c59d71 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidManifestParser.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidManifestParser.java @@ -18,6 +18,7 @@ package com.android.ide.eclipse.common.project; import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.common.project.XmlErrorHandler.XmlErrorListener; +import com.android.sdklib.SdkConstants; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IMarker; @@ -442,7 +443,7 @@ public class AndroidManifestParser { * @param attributeName the name of the attribute to look for. * @param hasNamespace Indicates whether the attribute has an android namespace. * @return a String with the value or null if the attribute was not found. - * @see AndroidConstants#NS_RESOURCES + * @see SdkConstants#NS_RESOURCES */ private String getAttributeValue(Attributes attributes, String attributeName, boolean hasNamespace) { @@ -450,7 +451,7 @@ public class AndroidManifestParser { for (int i = 0 ; i < count ; i++) { if (attributeName.equals(attributes.getLocalName(i)) && ((hasNamespace && - AndroidConstants.NS_RESOURCES.equals(attributes.getURI(i))) || + SdkConstants.NS_RESOURCES.equals(attributes.getURI(i))) || (hasNamespace == false && attributes.getURI(i).length() == 0))) { return attributes.getValue(i); } diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidXPathFactory.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidXPathFactory.java index 8544b25ff..0f1e25574 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidXPathFactory.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/common/project/AndroidXPathFactory.java @@ -16,7 +16,7 @@ package com.android.ide.eclipse.common.project; -import com.android.ide.eclipse.common.AndroidConstants; +import com.android.sdklib.SdkConstants; import java.util.Iterator; @@ -48,7 +48,7 @@ public class AndroidXPathFactory { public String getNamespaceURI(String prefix) { if (prefix != null) { if (prefix.equals(mAndroidPrefix)) { - return AndroidConstants.NS_RESOURCES; + return SdkConstants.NS_RESOURCES; } } diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/AndroidContentAssist.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/AndroidContentAssist.java index 50d3d2856..a325ccbf6 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/AndroidContentAssist.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/AndroidContentAssist.java @@ -17,7 +17,6 @@ package com.android.ide.eclipse.editors; import com.android.ide.eclipse.adt.sdk.AndroidTargetData; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; @@ -29,6 +28,7 @@ import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor; import com.android.ide.eclipse.editors.uimodel.UiAttributeNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; import com.android.ide.eclipse.editors.uimodel.UiFlagAttributeNode; +import com.android.sdklib.SdkConstants; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; @@ -199,13 +199,13 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor { * * @param node The current node. Must not be null. * @param nsUri The namespace URI of which the prefix is to be found, - * e.g. AndroidConstants.NS_RESOURCES + * e.g. {@link SdkConstants#NS_RESOURCES} * @return The first prefix declared or the default "android" prefix. */ private String lookupNamespacePrefix(Node node, String nsUri) { // Note: Node.lookupPrefix is not implemented in wst/xml/core NodeImpl.java // The following emulates this: - // String prefix = node.lookupPrefix(AndroidConstants.NS_RESOURCES); + // String prefix = node.lookupPrefix(SdkConstants.NS_RESOURCES); if (XmlnsAttributeDescriptor.XMLNS_URI.equals(nsUri)) { return "xmlns"; //$NON-NLS-1$ @@ -223,7 +223,7 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor { Node attr = attrs.item(n); if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$ String uri = attr.getNodeValue(); - if (AndroidConstants.NS_RESOURCES.equals(uri)) { + if (SdkConstants.NS_RESOURCES.equals(uri)) { return attr.getLocalName(); } visited.add(uri); @@ -234,7 +234,7 @@ public abstract class AndroidContentAssist implements IContentAssistProcessor { // Use a sensible default prefix if we can't find one. // We need to make sure the prefix is not one that was declared in the scope // visited above. - prefix = AndroidConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$ + prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$ String base = prefix; for (int i = 1; visited.contains(prefix); i++) { prefix = base + Integer.toString(i); diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/AttributeDescriptor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/AttributeDescriptor.java index 70d03a19b..e0ec86bfb 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/AttributeDescriptor.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/AttributeDescriptor.java @@ -17,10 +17,10 @@ package com.android.ide.eclipse.editors.descriptors; import com.android.ide.eclipse.adt.AdtPlugin; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.IconFactory; import com.android.ide.eclipse.editors.uimodel.UiAttributeNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; +import com.android.sdklib.SdkConstants; import org.eclipse.swt.graphics.Image; @@ -45,7 +45,7 @@ public abstract class AttributeDescriptor { * * @param xmlLocalName The XML name of the attribute (case sensitive) * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. */ public AttributeDescriptor(String xmlLocalName, String nsUri) { mXmlLocalName = xmlLocalName; diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/DescriptorsUtils.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/DescriptorsUtils.java index 09f147833..cc923bf54 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/DescriptorsUtils.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/DescriptorsUtils.java @@ -23,6 +23,7 @@ import com.android.ide.eclipse.common.resources.DeclareStyleableInfo.AttributeIn import com.android.ide.eclipse.editors.layout.LayoutConstants; import com.android.ide.eclipse.editors.uimodel.UiDocumentNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; +import com.android.sdklib.SdkConstants; import org.eclipse.swt.graphics.Image; @@ -75,7 +76,7 @@ public final class DescriptorsUtils { * @param xmlName The XML attribute name. * @param uiName The UI attribute name. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param tooltip An optional tooltip. * @return A new {@link TextAttributeDescriptor} (or derived) instance. */ @@ -90,7 +91,7 @@ public final class DescriptorsUtils { * @param elementXmlName Optional XML local name of the element to which attributes are * being added. When not null, this is used to filter overrides. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param infos The array of {@link AttributeInfo} to read and append to attributes * @param requiredAttributes An optional set of attributes to mark as "required" (i.e. append * a "*" to their UI name as a hint for the user.) If not null, must contains @@ -125,7 +126,7 @@ public final class DescriptorsUtils { * being added. When not null, this is used to filter overrides. * @param info The {@link AttributeInfo} to append to attributes * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param required True if the attribute is to be marked as "required" (i.e. append * a "*" to its UI name as a hint for the user.) * @param overrides A map [attribute name => TextAttributeDescriptor creator]. A creator diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ElementDescriptor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ElementDescriptor.java index 7d7b1c9be..555015537 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ElementDescriptor.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ElementDescriptor.java @@ -17,9 +17,9 @@ package com.android.ide.eclipse.editors.descriptors; import com.android.ide.eclipse.adt.AdtPlugin; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.IconFactory; import com.android.ide.eclipse.editors.uimodel.UiElementNode; +import com.android.sdklib.SdkConstants; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; @@ -147,7 +147,7 @@ public class ElementDescriptor { public final String getNamespace() { // For now we hard-code the prefix as being "android" if (mXmlName.startsWith("android:")) { //$NON-NLs-1$ - return AndroidConstants.NS_RESOURCES; + return SdkConstants.NS_RESOURCES; } return ""; //$NON-NLs-1$ diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ReferenceAttributeDescriptor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ReferenceAttributeDescriptor.java index 3d3ff2901..336dfe2b3 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ReferenceAttributeDescriptor.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/ReferenceAttributeDescriptor.java @@ -16,12 +16,12 @@ package com.android.ide.eclipse.editors.descriptors; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.common.resources.ResourceType; import com.android.ide.eclipse.editors.ui.ResourceValueCellEditor; import com.android.ide.eclipse.editors.uimodel.UiAttributeNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; import com.android.ide.eclipse.editors.uimodel.UiResourceAttributeNode; +import com.android.sdklib.SdkConstants; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.swt.widgets.Composite; @@ -39,7 +39,7 @@ public final class ReferenceAttributeDescriptor extends TextAttributeDescriptor * @param xmlLocalName The XML name of the attribute (case sensitive) * @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param tooltip A non-empty tooltip string or null */ public ReferenceAttributeDescriptor(String xmlLocalName, String uiName, String nsUri, @@ -55,7 +55,7 @@ public final class ReferenceAttributeDescriptor extends TextAttributeDescriptor * @param xmlLocalName The XML name of the attribute (case sensitive) * @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param tooltip A non-empty tooltip string or null */ public ReferenceAttributeDescriptor(ResourceType resourceType, diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/TextAttributeDescriptor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/TextAttributeDescriptor.java index a9d2b2e65..77fc0678d 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/TextAttributeDescriptor.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/descriptors/TextAttributeDescriptor.java @@ -16,11 +16,11 @@ package com.android.ide.eclipse.editors.descriptors; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.ui.TextValueCellEditor; import com.android.ide.eclipse.editors.uimodel.UiAttributeNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; import com.android.ide.eclipse.editors.uimodel.UiTextAttributeNode; +import com.android.sdklib.SdkConstants; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.ILabelProvider; @@ -47,7 +47,7 @@ public class TextAttributeDescriptor extends AttributeDescriptor implements IPro * @param xmlLocalName The XML name of the attribute (case sensitive) * @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param tooltip A non-empty tooltip string or null */ public TextAttributeDescriptor(String xmlLocalName, String uiName, diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/WidgetPullParser.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/WidgetPullParser.java index 75d10eda0..e62ab6951 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/WidgetPullParser.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/WidgetPullParser.java @@ -19,6 +19,7 @@ package com.android.ide.eclipse.editors.layout; import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor; import com.android.layoutlib.api.IXmlPullParser; +import com.android.sdklib.SdkConstants; import org.xmlpull.v1.XmlPullParserException; @@ -61,7 +62,7 @@ public class WidgetPullParser extends BasePullParser { } public String getAttributeNamespace(int index) { - return AndroidConstants.NS_RESOURCES; + return SdkConstants.NS_RESOURCES; } public String getAttributePrefix(int index) { @@ -78,7 +79,7 @@ public class WidgetPullParser extends BasePullParser { } public String getAttributeValue(String ns, String name) { - if (AndroidConstants.NS_RESOURCES.equals(ns)) { + if (SdkConstants.NS_RESOURCES.equals(ns)) { for (String[] attribute : mAttributes) { if (name.equals(attribute[0])) { return attribute[1]; diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/descriptors/LayoutDescriptors.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/descriptors/LayoutDescriptors.java index cad9ccf60..7caa50f12 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/descriptors/LayoutDescriptors.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/descriptors/LayoutDescriptors.java @@ -26,6 +26,7 @@ import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider; import com.android.ide.eclipse.editors.descriptors.SeparatorAttributeDescriptor; +import com.android.sdklib.SdkConstants; import java.util.ArrayList; import java.util.Collections; @@ -134,7 +135,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { ArrayList attributes = new ArrayList(); DescriptorsUtils.appendAttributes(attributes, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, info.getAttributes(), null, // requiredAttributes null /* overrides */); @@ -148,7 +149,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { String.format("Attributes from %1$s", link.getShortClassName()))); DescriptorsUtils.appendAttributes(attributes, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, attrList, null, // requiredAttributes null /* overrides */); @@ -163,7 +164,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { boolean need_separator = true; for (AttributeInfo attr_info : layoutParams.getAttributes()) { if (DescriptorsUtils.containsAttribute(layoutAttributes, - AndroidConstants.NS_RESOURCES, attr_info)) { + SdkConstants.NS_RESOURCES, attr_info)) { continue; } if (need_separator) { @@ -182,7 +183,7 @@ public final class LayoutDescriptors implements IDescriptorProvider { } DescriptorsUtils.appendAttribute(layoutAttributes, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, attr_info, false, // required null /* overrides */); diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/parts/UiElementEditPart.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/parts/UiElementEditPart.java index d873005ce..a2e05c7fa 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/parts/UiElementEditPart.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/parts/UiElementEditPart.java @@ -16,10 +16,10 @@ package com.android.ide.eclipse.editors.layout.parts; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.uimodel.IUiUpdateListener; import com.android.ide.eclipse.editors.uimodel.UiElementNode; +import com.android.sdklib.SdkConstants; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Point; @@ -177,7 +177,7 @@ public abstract class UiElementEditPart extends AbstractGraphicalEditPart NamedNodeMap nodeAttributes = xmlNode.getAttributes(); if (nodeAttributes != null) { Node attr = nodeAttributes.getNamedItemNS( - AndroidConstants.NS_RESOURCES, attrName); + SdkConstants.NS_RESOURCES, attrName); if (attr != null) { return attr.getNodeValue(); } diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/uimodel/UiViewElementNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/uimodel/UiViewElementNode.java index 45cbc7760..1bf5d5abf 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/uimodel/UiViewElementNode.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/layout/uimodel/UiViewElementNode.java @@ -26,6 +26,7 @@ import com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor; import com.android.ide.eclipse.editors.uimodel.UiDocumentNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; import com.android.sdklib.IAndroidTarget; +import com.android.sdklib.SdkConstants; import org.eclipse.core.resources.IProject; @@ -109,7 +110,7 @@ public class UiViewElementNode extends UiElementNode { if (need_xmlns) { AttributeDescriptor desc = new XmlnsAttributeDescriptor( "android", //$NON-NLS-1$ - AndroidConstants.NS_RESOURCES); + SdkConstants.NS_RESOURCES); mCachedAttributeDescriptors[direct_attrs.length + layout_attrs.length] = desc; } diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/AndroidManifestDescriptors.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/AndroidManifestDescriptors.java index a0b30ecab..61b73a279 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/AndroidManifestDescriptors.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/AndroidManifestDescriptors.java @@ -28,6 +28,7 @@ import com.android.ide.eclipse.editors.descriptors.ListAttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.ReferenceAttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.TextAttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor; +import com.android.sdklib.SdkConstants; import org.eclipse.core.runtime.IStatus; @@ -166,7 +167,7 @@ public final class AndroidManifestDescriptors implements IDescriptorProvider { XmlnsAttributeDescriptor xmlns = new XmlnsAttributeDescriptor( "android", //$NON-NLS-1$ - AndroidConstants.NS_RESOURCES); + SdkConstants.NS_RESOURCES); // -- setup the required attributes overrides -- @@ -355,7 +356,7 @@ public final class AndroidManifestDescriptors implements IDescriptorProvider { ArrayList attrDescs = new ArrayList(); DescriptorsUtils.appendAttributes(attrDescs, elemDesc.getXmlLocalName(), - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, style.getAttributes(), requiredAttributes, overrides); diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/ClassAttributeDescriptor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/ClassAttributeDescriptor.java index 1144006d2..abaf438d6 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/ClassAttributeDescriptor.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/descriptors/ClassAttributeDescriptor.java @@ -44,7 +44,7 @@ public class ClassAttributeDescriptor extends TextAttributeDescriptor { * @param xmlLocalName The XML name of the attribute (case sensitive, with android: prefix). * @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param tooltip A non-empty tooltip string or null. * @param mandatory indicates if the class attribute is mandatory. */ @@ -64,7 +64,7 @@ public class ClassAttributeDescriptor extends TextAttributeDescriptor { * @param xmlLocalName The XML local name of the attribute (case sensitive). * @param uiName The UI name of the attribute. Cannot be an empty string and cannot be null. * @param nsUri The URI of the attribute. Can be null if attribute has no namespace. - * See {@link AndroidConstants#NS_RESOURCES} for a common value. + * See {@link SdkConstants#NS_RESOURCES} for a common value. * @param tooltip A non-empty tooltip string or null. * @param mandatory indicates if the class attribute is mandatory. */ diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/model/UiManifestElementNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/model/UiManifestElementNode.java index 79295a817..fb8f2115d 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/model/UiManifestElementNode.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/manifest/model/UiManifestElementNode.java @@ -16,12 +16,12 @@ package com.android.ide.eclipse.editors.manifest.model; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.manifest.descriptors.AndroidManifestDescriptors; import com.android.ide.eclipse.editors.manifest.descriptors.ManifestElementDescriptor; import com.android.ide.eclipse.editors.uimodel.UiAttributeNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; +import com.android.sdklib.SdkConstants; import org.w3c.dom.Element; @@ -74,10 +74,10 @@ public final class UiManifestElementNode extends UiElementNode { if (desc != manifestDescriptors.getManifestElement() && desc != manifestDescriptors.getApplicationElement()) { Element elem = (Element) getXmlNode(); - String attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES, + String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES, AndroidManifestDescriptors.ANDROID_NAME_ATTR); if (attr == null || attr.length() == 0) { - attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES, + attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES, AndroidManifestDescriptors.ANDROID_LABEL_ATTR); } if (attr != null && attr.length() > 0) { diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/menu/descriptors/MenuDescriptors.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/menu/descriptors/MenuDescriptors.java index 34c7bb275..40a8f16db 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/menu/descriptors/MenuDescriptors.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/menu/descriptors/MenuDescriptors.java @@ -16,13 +16,13 @@ package com.android.ide.eclipse.editors.menu.descriptors; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.common.resources.DeclareStyleableInfo; import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider; import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor; +import com.android.sdklib.SdkConstants; import java.util.ArrayList; import java.util.Map; @@ -121,7 +121,7 @@ public final class MenuDescriptors implements IDescriptorProvider { false /* mandatory */); XmlnsAttributeDescriptor xmlns = new XmlnsAttributeDescriptor("android", //$NON-NLS-1$ - AndroidConstants.NS_RESOURCES); + SdkConstants.NS_RESOURCES); updateElement(mDescriptor, styleMap, "Menu", xmlns); //$NON-NLS-1$ mDescriptor.setChildren(new ElementDescriptor[] { top_item, top_group }); @@ -159,7 +159,7 @@ public final class MenuDescriptors implements IDescriptorProvider { if (style != null) { DescriptorsUtils.appendAttributes(descs, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, style.getAttributes(), null, // requiredAttributes null); // overrides diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiElementNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiElementNode.java index e0e9a4051..3728886b5 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiElementNode.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiElementNode.java @@ -18,7 +18,6 @@ package com.android.ide.eclipse.editors.uimodel; import com.android.ide.eclipse.adt.AdtPlugin; import com.android.ide.eclipse.adt.sdk.AndroidTargetData; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.AndroidEditor; import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; @@ -31,6 +30,7 @@ import com.android.ide.eclipse.editors.manifest.descriptors.AndroidManifestDescr import com.android.ide.eclipse.editors.resources.descriptors.ResourcesDescriptors; import com.android.ide.eclipse.editors.uimodel.IUiUpdateListener.UiUpdateState; import com.android.ide.eclipse.editors.xml.descriptors.XmlDescriptors; +import com.android.sdklib.SdkConstants; import org.eclipse.core.runtime.IStatus; import org.eclipse.ui.IEditorInput; @@ -201,21 +201,21 @@ public class UiElementNode implements IPropertySource { // just using the UI name below. Element elem = (Element) mXmlNode; - String attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES, + String attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES, AndroidManifestDescriptors.ANDROID_NAME_ATTR); if (attr == null || attr.length() == 0) { - attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES, + attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES, AndroidManifestDescriptors.ANDROID_LABEL_ATTR); } if (attr == null || attr.length() == 0) { - attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES, + attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES, XmlDescriptors.PREF_KEY_ATTR); } if (attr == null || attr.length() == 0) { attr = elem.getAttribute(ResourcesDescriptors.NAME_ATTR); } if (attr == null || attr.length() == 0) { - attr = elem.getAttributeNS(AndroidConstants.NS_RESOURCES, + attr = elem.getAttributeNS(SdkConstants.NS_RESOURCES, LayoutDescriptors.ID_ATTR); if (attr != null && attr.length() > 0) { @@ -1205,13 +1205,13 @@ public class UiElementNode implements IPropertySource { * * @param node The current node. Must not be null. * @param nsUri The namespace URI of which the prefix is to be found, - * e.g. AndroidConstants.NS_RESOURCES + * e.g. SdkConstants.NS_RESOURCES * @return The first prefix declared or the default "android" prefix. */ private String lookupNamespacePrefix(Node node, String nsUri) { // Note: Node.lookupPrefix is not implemented in wst/xml/core NodeImpl.java // The following code emulates this simple call: - // String prefix = node.lookupPrefix(AndroidConstants.NS_RESOURCES); + // String prefix = node.lookupPrefix(SdkConstants.NS_RESOURCES); // if the requested URI is null, it denotes an attribute with no namespace. if (nsUri == null) { @@ -1234,7 +1234,7 @@ public class UiElementNode implements IPropertySource { if ("xmlns".equals(attr.getPrefix())) { //$NON-NLS-1$ String uri = attr.getNodeValue(); String nsPrefix = attr.getLocalName(); - if (AndroidConstants.NS_RESOURCES.equals(uri)) { + if (SdkConstants.NS_RESOURCES.equals(uri)) { return nsPrefix; } visited.add(nsPrefix); @@ -1245,7 +1245,7 @@ public class UiElementNode implements IPropertySource { // Use a sensible default prefix if we can't find one. // We need to make sure the prefix is not one that was declared in the scope // visited above. - String prefix = AndroidConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$ + String prefix = SdkConstants.NS_RESOURCES.equals(nsUri) ? "android" : "ns"; //$NON-NLS-1$ //$NON-NLS-2$ String base = prefix; for (int i = 1; visited.contains(prefix); i++) { prefix = base + Integer.toString(i); diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiListAttributeNode.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiListAttributeNode.java index aaad0ce72..c5c10aa11 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiListAttributeNode.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/uimodel/UiListAttributeNode.java @@ -18,7 +18,6 @@ package com.android.ide.eclipse.editors.uimodel; import com.android.ide.eclipse.adt.AdtPlugin; import com.android.ide.eclipse.adt.sdk.AndroidTargetData; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.AndroidEditor; import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils; @@ -26,6 +25,7 @@ import com.android.ide.eclipse.editors.descriptors.ListAttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.TextAttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor; import com.android.ide.eclipse.editors.ui.SectionHelper; +import com.android.sdklib.SdkConstants; import org.eclipse.core.runtime.IStatus; import org.eclipse.swt.SWT; @@ -135,7 +135,7 @@ public class UiListAttributeNode extends UiAbstractTextAttributeNode { // FrameworkResourceManager expects a specific prefix for the attribute. String prefix = ""; - if (AndroidConstants.NS_RESOURCES.equals(descriptor.getNamespaceUri())) { + if (SdkConstants.NS_RESOURCES.equals(descriptor.getNamespaceUri())) { prefix = "android:"; //$NON-NLS-1$ } else if (XmlnsAttributeDescriptor.XMLNS_URI.equals(descriptor.getNamespaceUri())) { prefix = "xmlns:"; //$NON-NLS-1$ diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/wizards/NewXmlFileCreationPage.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/wizards/NewXmlFileCreationPage.java index cc643be49..4d171762c 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/wizards/NewXmlFileCreationPage.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/wizards/NewXmlFileCreationPage.java @@ -163,7 +163,7 @@ class NewXmlFileCreationPage extends WizardPage { /** * If the generated resource XML file requires an "android" XMLNS, this should be set - * to {@link AndroidConstants#NS_RESOURCES}. When it is null, no XMLNS is generated. + * to {@link SdkConstants#NS_RESOURCES}. When it is null, no XMLNS is generated. */ String getXmlns() { return mXmlns; @@ -188,7 +188,7 @@ class NewXmlFileCreationPage extends WizardPage { ResourceFolderType.LAYOUT, // folder type AndroidTargetData.DESCRIPTOR_LAYOUT, // root seed "LinearLayout", // default root - AndroidConstants.NS_RESOURCES, // xmlns + SdkConstants.NS_RESOURCES, // xmlns "android:layout_width=\"wrap_content\"\n" + // default attributes "android:layout_height=\"wrap_content\"" ), @@ -205,7 +205,7 @@ class NewXmlFileCreationPage extends WizardPage { ResourceFolderType.MENU, // folder type MenuDescriptors.MENU_ROOT_ELEMENT, // root seed null, // default root - AndroidConstants.NS_RESOURCES, // xmlns + SdkConstants.NS_RESOURCES, // xmlns null // default attributes ), new TypeInfo("Preference", // UI name @@ -213,7 +213,7 @@ class NewXmlFileCreationPage extends WizardPage { ResourceFolderType.XML, // folder type AndroidTargetData.DESCRIPTOR_PREFERENCES, // root seed AndroidConstants.CLASS_PREFERENCE_SCREEN, // default root - AndroidConstants.NS_RESOURCES, // xmlns + SdkConstants.NS_RESOURCES, // xmlns null // default attributes ), new TypeInfo("Searchable", // UI name @@ -221,7 +221,7 @@ class NewXmlFileCreationPage extends WizardPage { ResourceFolderType.XML, // folder type AndroidTargetData.DESCRIPTOR_SEARCHABLE, // root seed null, // default root - AndroidConstants.NS_RESOURCES, // xmlns + SdkConstants.NS_RESOURCES, // xmlns null // default attributes ), new TypeInfo("Animation", // UI name diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/XmlEditor.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/XmlEditor.java index b1900ae41..d7f611949 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/XmlEditor.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/XmlEditor.java @@ -26,6 +26,7 @@ import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.uimodel.UiDocumentNode; import com.android.sdklib.IAndroidTarget; +import com.android.sdklib.SdkConstants; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; @@ -80,7 +81,7 @@ public class XmlEditor extends AndroidEditor { FirstElementParser.Result result = FirstElementParser.parse( file.getLocation().toOSString(), - AndroidConstants.NS_RESOURCES); + SdkConstants.NS_RESOURCES); if (result != null) { String name = result.getElement(); diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/descriptors/XmlDescriptors.java b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/descriptors/XmlDescriptors.java index 31b4c617a..fa1370f31 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/descriptors/XmlDescriptors.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/editors/xml/descriptors/XmlDescriptors.java @@ -25,9 +25,10 @@ import com.android.ide.eclipse.editors.descriptors.DescriptorsUtils; import com.android.ide.eclipse.editors.descriptors.DocumentDescriptor; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.descriptors.IDescriptorProvider; -import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.SeparatorAttributeDescriptor; +import com.android.ide.eclipse.editors.descriptors.XmlnsAttributeDescriptor; import com.android.ide.eclipse.editors.layout.descriptors.ViewElementDescriptor; +import com.android.sdklib.SdkConstants; import java.util.ArrayList; import java.util.Map; @@ -111,7 +112,7 @@ public final class XmlDescriptors implements IDescriptorProvider { XmlnsAttributeDescriptor xmlns = new XmlnsAttributeDescriptor( "android", //$NON-NLS-1$ - AndroidConstants.NS_RESOURCES); + SdkConstants.NS_RESOURCES); ElementDescriptor searchable = createSearchable(searchableStyleMap, xmlns); ElementDescriptor preferences = createPreference(prefs, prefGroups, xmlns); @@ -191,7 +192,7 @@ public final class XmlDescriptors implements IDescriptorProvider { if (style != null) { DescriptorsUtils.appendAttributes(descs, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, style.getAttributes(), null, // requiredAttributes null); // overrides @@ -280,7 +281,7 @@ public final class XmlDescriptors implements IDescriptorProvider { ArrayList attributes = new ArrayList(); DescriptorsUtils.appendAttributes(attributes, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, info.getAttributes(), null, // requiredAttributes null); // overrides @@ -294,7 +295,7 @@ public final class XmlDescriptors implements IDescriptorProvider { String.format("Attributes from %1$s", link.getShortClassName()))); DescriptorsUtils.appendAttributes(attributes, null, // elementName - AndroidConstants.NS_RESOURCES, + SdkConstants.NS_RESOURCES, attrList, null, // requiredAttributes null); // overrides diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath index 1cc51e994..40886832d 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath +++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.classpath @@ -5,5 +5,6 @@ + diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.project b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.project index 094260254..99e496486 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/.project +++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/.project @@ -3,6 +3,7 @@ adt-tests + SdkLib diff --git a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/editors/layout/UiElementPullParserTest.java b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/editors/layout/UiElementPullParserTest.java index 1427eeea0..b0deda0ad 100644 --- a/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/editors/layout/UiElementPullParserTest.java +++ b/tools/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/editors/layout/UiElementPullParserTest.java @@ -16,18 +16,17 @@ package com.android.ide.eclipse.editors.layout; -import com.android.ide.eclipse.common.AndroidConstants; import com.android.ide.eclipse.editors.descriptors.AttributeDescriptor; import com.android.ide.eclipse.editors.descriptors.ElementDescriptor; import com.android.ide.eclipse.editors.descriptors.TextAttributeDescriptor; import com.android.ide.eclipse.editors.mock.MockXmlNode; import com.android.ide.eclipse.editors.uimodel.UiElementNode; +import com.android.sdklib.SdkConstants; import org.w3c.dom.Node; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -import java.io.IOException; import java.util.HashMap; import junit.framework.TestCase; @@ -47,22 +46,22 @@ public class UiElementPullParserTest extends TestCase { // Also add some dummy attributes. ElementDescriptor buttonDescriptor = new ElementDescriptor("Button", "Button", "", "", new AttributeDescriptor[] { - new TextAttributeDescriptor("name", "name", AndroidConstants.NS_RESOURCES, ""), - new TextAttributeDescriptor("text", "text", AndroidConstants.NS_RESOURCES, ""), + new TextAttributeDescriptor("name", "name", SdkConstants.NS_RESOURCES, ""), + new TextAttributeDescriptor("text", "text", SdkConstants.NS_RESOURCES, ""), }, new ElementDescriptor[] {}, false); ElementDescriptor textDescriptor = new ElementDescriptor("TextView", "TextView", "", "", new AttributeDescriptor[] { - new TextAttributeDescriptor("name", "name", AndroidConstants.NS_RESOURCES, ""), - new TextAttributeDescriptor("text", "text", AndroidConstants.NS_RESOURCES, ""), }, + new TextAttributeDescriptor("name", "name", SdkConstants.NS_RESOURCES, ""), + new TextAttributeDescriptor("text", "text", SdkConstants.NS_RESOURCES, ""), }, new ElementDescriptor[] {}, false); ElementDescriptor linearDescriptor = new ElementDescriptor("LinearLayout", "Linear Layout", "", "", new AttributeDescriptor[] { new TextAttributeDescriptor("orientation", "orientation", - AndroidConstants.NS_RESOURCES, ""), + SdkConstants.NS_RESOURCES, ""), }, new ElementDescriptor[] { }, false); @@ -70,7 +69,7 @@ public class UiElementPullParserTest extends TestCase { "Relative Layout", "", "", new AttributeDescriptor[] { new TextAttributeDescriptor("orientation", "orientation", - AndroidConstants.NS_RESOURCES, ""), + SdkConstants.NS_RESOURCES, ""), }, new ElementDescriptor[] { }, false); @@ -99,8 +98,8 @@ public class UiElementPullParserTest extends TestCase { */ MockXmlNode button1 = new MockXmlNode(null /* namespace */, "Button", Node.ELEMENT_NODE, null); - button1.addAttributes(AndroidConstants.NS_RESOURCES, "name", "button1"); - button1.addAttributes(AndroidConstants.NS_RESOURCES, "text", "button1text"); + button1.addAttributes(SdkConstants.NS_RESOURCES, "name", "button1"); + button1.addAttributes(SdkConstants.NS_RESOURCES, "text", "button1text"); // create a map of the attributes we add to the multi-attribute nodes so that // we can more easily test the values when we parse the XML. @@ -112,8 +111,8 @@ public class UiElementPullParserTest extends TestCase { MockXmlNode button2 = new MockXmlNode(null /* namespace */, "Button", Node.ELEMENT_NODE, null); - button2.addAttributes(AndroidConstants.NS_RESOURCES, "name", "button2"); - button2.addAttributes(AndroidConstants.NS_RESOURCES, "text", "button2text"); + button2.addAttributes(SdkConstants.NS_RESOURCES, "name", "button2"); + button2.addAttributes(SdkConstants.NS_RESOURCES, "text", "button2text"); button2Map = new HashMap(); button2Map.put("name", "button2"); @@ -121,8 +120,8 @@ public class UiElementPullParserTest extends TestCase { MockXmlNode text = new MockXmlNode(null /* namespace */, "TextView", Node.ELEMENT_NODE, null); - text.addAttributes(AndroidConstants.NS_RESOURCES, "name", "text1"); - text.addAttributes(AndroidConstants.NS_RESOURCES, "text", "text1text"); + text.addAttributes(SdkConstants.NS_RESOURCES, "name", "text1"); + text.addAttributes(SdkConstants.NS_RESOURCES, "text", "text1text"); textMap = new HashMap(); textMap.put("name", "text1"); @@ -130,17 +129,17 @@ public class UiElementPullParserTest extends TestCase { MockXmlNode relative = new MockXmlNode(null /* namespace */, "RelativeLayout", Node.ELEMENT_NODE, new MockXmlNode[] { button2, text }); - relative.addAttributes(AndroidConstants.NS_RESOURCES, "orientation", "toto"); + relative.addAttributes(SdkConstants.NS_RESOURCES, "orientation", "toto"); MockXmlNode linear = new MockXmlNode(null /* namespace */, "LinearLayout", Node.ELEMENT_NODE, new MockXmlNode[] { button1, relative }); - linear.addAttributes(AndroidConstants.NS_RESOURCES, "orientation", "vertical"); + linear.addAttributes(SdkConstants.NS_RESOURCES, "orientation", "vertical"); MockXmlNode root = new MockXmlNode(null /* namespace */, "root", Node.ELEMENT_NODE, new MockXmlNode[] { linear }); // put the namespace/prefix in place - root.setPrefix(AndroidConstants.NS_RESOURCES, "android"); + root.setPrefix(SdkConstants.NS_RESOURCES, "android"); // load the xml into the UiElementNode ui.loadFromXmlNode(root); @@ -165,7 +164,7 @@ public class UiElementPullParserTest extends TestCase { assertEquals("LinearLayout", parser.getName()); assertEquals(1, parser.getAttributeCount()); assertEquals("orientation", parser.getAttributeName(0)); - assertEquals(AndroidConstants.NS_RESOURCES, parser.getAttributeNamespace(0)); + assertEquals(SdkConstants.NS_RESOURCES, parser.getAttributeNamespace(0)); assertEquals("android", parser.getAttributePrefix(0)); assertEquals("vertical", parser.getAttributeValue(0)); @@ -183,7 +182,7 @@ public class UiElementPullParserTest extends TestCase { assertEquals("RelativeLayout", parser.getName()); assertEquals(1, parser.getAttributeCount()); assertEquals("orientation", parser.getAttributeName(0)); - assertEquals(AndroidConstants.NS_RESOURCES, parser.getAttributeNamespace(0)); + assertEquals(SdkConstants.NS_RESOURCES, parser.getAttributeNamespace(0)); assertEquals("android", parser.getAttributePrefix(0)); assertEquals("toto", parser.getAttributeValue(0)); @@ -234,7 +233,7 @@ public class UiElementPullParserTest extends TestCase { assertNotNull(referenceValue); assertEquals(referenceValue, value); - assertEquals(AndroidConstants.NS_RESOURCES, parser.getAttributeNamespace(i)); + assertEquals(SdkConstants.NS_RESOURCES, parser.getAttributeNamespace(i)); assertEquals("android", parser.getAttributePrefix(i)); } diff --git a/tools/runtest b/tools/runtest index 989f8a493..9978504d9 100755 --- a/tools/runtest +++ b/tools/runtest @@ -114,7 +114,7 @@ knownTests=( # system-wide tests "framework frameworks/base/tests/FrameworkTest # com.android.frameworktest.AllTests com.android.frameworktest.tests #" "android frameworks/base/tests/AndroidTests com.android.unit_tests AndroidTests # #" - "smoke tests/SmokeTest com.android.smoketest # com.android.smoketest.tests #" + "smoke frameworks/base/tests/SmokeTest com.android.smoketest # com.android.smoketest.tests #" "core frameworks/base/tests/CoreTests # android.core.CoreTests android.core #" "libcore frameworks/base/tests/CoreTests # android.core.JavaTests android.core #" "apidemos samples/ApiDemos com.example.android.apis # com.example.android.apis.tests #" diff --git a/tools/scripts/build.alias.template b/tools/scripts/build.alias.template index b85887e8c..f7de2e889 100644 --- a/tools/scripts/build.alias.template +++ b/tools/scripts/build.alias.template @@ -1,5 +1,5 @@ - +