diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java index 8ac2c3f1481..8f43f62c889 100755 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java @@ -732,14 +732,18 @@ public interface OdeMessages extends Messages, ComponentTranslations { @Description("Information about the Companion") String companionInformation(); - @DefaultMessage("Update the Companion") - @Description("Menu item to update the Companion to the latest version") + @DefaultMessage("Update the Companion for Emulator") + @Description("Menu item to update the Companion to the latest version for the Android emulator") String companionUpdate(); - @DefaultMessage("You must have a project open to update the Companion") + @DefaultMessage("You must have a project open to update the Companion for Emulator") @Description("") String companionUpdateMustHaveProject(); + @DefaultMessage("The emulator must be running to update the Companion") + @Description("Error message when user tries to update companion without emulator running") + String companionUpdateNeedEmulator(); + @DefaultMessage("Show Splash Screen") @Description("Redisplay the Splash Screen") String showSplashMenuItem(); diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ca.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ca.properties index b673e200739..c2436dc4b5a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ca.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ca.properties @@ -1251,7 +1251,7 @@ sendingAssetToCompanion=Enviant {0} al Companion... refreshCompanionMenuItem=Refresca la pantalla del Companion # Description: companionUpdateMustHaveProject=Has de tenir un projecte obert per actualitzar el Companion. -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate=Actualitza el Companion # Description: Information about the Companion companionInformation=Informació sobre el Companion diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_es_ES.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_es_ES.properties index c8e5254c14e..782bac5ab87 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_es_ES.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_es_ES.properties @@ -2546,7 +2546,7 @@ compilingPart2=Compilando parte 2 (por favor espere) compilingPart1=Compilando parte 1 # Description: companionUpdateMustHaveProject=Debes tener un proyecto abierto para actualizar Companion -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate=Actualizar el Companion # Description: Information about the Companion companionInformation=Información Companion diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_hy.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_hy.properties index 018c7fb1edc..7c3e4fa047d 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_hy.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_hy.properties @@ -2124,7 +2124,7 @@ blocksLoadFailure=Էկրանի {0} բլոկներ չեն բեռնվել ինչպ downloadKeystoreError=Սերվերի սխալ․ չի հաջողվել ներբեռնել ձեր բանալիների պահոցը։ # Description: Error message reported when a server error occurs during delete keystore deleteKeystoreError=Սերվերի սխալ․չի հաջողվել ջնջել բանալիների պահոցը։ -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate=Թարմացնել Companion-ը # Description: Label of the button for canceling the blocks editor launch cancelBlocksEditorButton=Բլոկների խմբագրիչի բացում...(սեղմեք չեղարկելու համար) diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ja.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ja.properties index 0da74381b24..5ee22023d3a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ja.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ja.properties @@ -2753,7 +2753,7 @@ colorValues=カラー # Description: # Description: # Description: -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate=コンパニオンのアップデート # Description: companionUpdateMustHaveProject=コンパニオンを更新するには、プロジェクトを開いている必要があります diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ko_KR.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ko_KR.properties index 02e00a4ee00..21d0ae253c0 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ko_KR.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_ko_KR.properties @@ -3270,7 +3270,7 @@ cmRestore = 펼치기 # Description: Information about the Companion companionInformation = 컴패니언 정보 -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate = 컴패니언 업데이트 # Description: diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pl.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pl.properties index 9015059ed5e..070100ebc2f 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pl.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pl.properties @@ -3333,7 +3333,7 @@ cmRestore = Rozszerz # Description: Information about the Companion companionInformation = Informacje towarzyszące -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate = Zaktualizuj Companion # Description: diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pt.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pt.properties index ae8c969a44b..fd9279f56e6 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pt.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_pt.properties @@ -480,8 +480,8 @@ aiaMediaAsset = To use this file, click Projects > Import project (.aia) from my aiaMediaAssetHelp = http://appinventor.mit.edu/explore/ai2/share.html aiaMediaAssetTitle = Error: Cannot upload .aia file as media asset buildComponentMenuItem = Build component -companionUpdate = Update the Companion -companionUpdateMustHaveProject = You must have a project open to update the Companion +companionUpdate = Update the Companion for Emulator +companionUpdateMustHaveProject = You must have a project open to update the Companion for Emulator componentImportError = Import Extension Failed! componentImportUnknownURLError = Extension Import failed due to unknown URL componentImportWizardCaption = Import an extension into project diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_tr.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_tr.properties index 47c14ed4f2d..d72d2dc35f0 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_tr.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_tr.properties @@ -984,7 +984,7 @@ cmRestore=Genişlet # Description: # Description: Information about the Companion companionInformation=AICompanion Bilgileri -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate=AICompanion Güncelle # Description: companionUpdateMustHaveProject=Derleyiciyi güncellemek için bir projeniz olmalıdır. diff --git a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_uk.properties b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_uk.properties index 9292b67f07f..3bc574ce22d 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_uk.properties +++ b/appinventor/appengine/src/com/google/appinventor/client/OdeMessages_uk.properties @@ -3032,7 +3032,7 @@ cmRestore=Відновити colorValues=колір # Description: # Description: -# Description: Menu item to update the Companion to the latest version +# Description: Menu item to update the Companion to the latest version for the Android emulator companionUpdate=Оновіть Компаньйона # Description: companionUpdateMustHaveProject=Щоб оновити Компаньона, потрібно відкрити проект diff --git a/appinventor/appengine/src/com/google/appinventor/client/actions/CompanionUpdateAction.java b/appinventor/appengine/src/com/google/appinventor/client/actions/CompanionUpdateAction.java index d51491c6c5c..1edf8a79b6a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/actions/CompanionUpdateAction.java +++ b/appinventor/appengine/src/com/google/appinventor/client/actions/CompanionUpdateAction.java @@ -22,6 +22,13 @@ public void execute() { return; } DesignToolbar.Screen screen = currentProject.screens.get(currentProject.currentScreen); + + // Check if emulator is running + if (!screen.blocksEditor.isEmulatorRunning()) { + Window.alert(MESSAGES.companionUpdateNeedEmulator()); + return; + } + screen.blocksEditor.updateCompanion(); } } diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/FileEditor.java b/appinventor/appengine/src/com/google/appinventor/client/editor/FileEditor.java index 99c80ca8b54..24a7547c01a 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/FileEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/FileEditor.java @@ -185,6 +185,14 @@ public boolean isDamaged() { public void updateCompanion() { } + /** + * Check if the emulator is currently running and connected. + * @return true if emulator is running, false otherwise + */ + public boolean isEmulatorRunning() { + return false; + } + public void getBlocksImage(Callback callback) { } diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/blocks/BlocklyPanel.java b/appinventor/appengine/src/com/google/appinventor/client/editor/blocks/BlocklyPanel.java index 49132b4fb84..e60fb236d93 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/blocks/BlocklyPanel.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/blocks/BlocklyPanel.java @@ -539,6 +539,15 @@ public static void updateCompanion(String formName) { doUpdateCompanion(formName); } + /** + * Check if the emulator is currently running and connected. + * @return true if emulator is running, false otherwise + */ + public static native boolean isEmulatorRunning() /*-{ + return $wnd.ReplState && $wnd.ReplState.replcode === 'emulator' && + $wnd.ReplState.state === $wnd.Blockly.ReplMgr.rsState.CONNECTED; + }-*/; + /** * Access UI translations for generating a deletion warning dialog. * @param message Identifier of message diff --git a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaBlocksEditor.java b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaBlocksEditor.java index d03991f8bbb..b320bc1ca2d 100644 --- a/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaBlocksEditor.java +++ b/appinventor/appengine/src/com/google/appinventor/client/editor/youngandroid/YaBlocksEditor.java @@ -257,6 +257,14 @@ public void updateCompanion() { blocksArea.updateCompanion(); } + /* + * Check if emulator is running + */ + @Override + public boolean isEmulatorRunning() { + return BlocklyPanel.isEmulatorRunning(); + } + @Override public void onProjectLoaded(Project project) { for (ProjectNode node : project.getRootNode().getAllSourceNodes()) {