mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show better error message if activity is not declared in AndroidManifest.xml
This commit is contained in:
@@ -56,7 +56,8 @@ create.global.library=Create Glob&al library ''{0}''
|
||||
create.library.dialog.title=Create Android library
|
||||
select.target.dialog.text=Please select Android Target
|
||||
default.activity.not.found.error=Default Activity not found
|
||||
activity.not.launchable.error=The Intent Filter of the Activity must contain {0} action
|
||||
activity.not.launchable.error=The intent-filter of the activity must contain {0} action
|
||||
activity.not.declared.in.manifest=The activity ''{0}'' is not declared in AndroidManifest.xml
|
||||
new.typed.resource.command.name=New {0} resource file
|
||||
new.typed.resource.dialog.title=New {0} Resource File
|
||||
new.file.dialog.text=Enter a new file name
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
@@ -82,7 +81,12 @@ public class AndroidRunConfiguration extends AndroidRunConfigurationBase impleme
|
||||
if (!c.isInheritor(activityClass, true)) {
|
||||
throw new RuntimeConfigurationError(AndroidBundle.message("not.activity.subclass.error", ACTIVITY_CLASS));
|
||||
}
|
||||
if (!isActivityLaunchable(facet.getModule(), c)) {
|
||||
|
||||
final Activity activity = AndroidDomUtil.getActivityDomElementByClass(facet.getModule(), c);
|
||||
if (activity == null) {
|
||||
throw new RuntimeConfigurationError(AndroidBundle.message("activity.not.declared.in.manifest", c.getName()));
|
||||
}
|
||||
if (!isActivityLaunchable(activity)) {
|
||||
throw new RuntimeConfigurationError(AndroidBundle.message("activity.not.launchable.error", AndroidUtils.LAUNCH_ACTION_NAME));
|
||||
}
|
||||
}
|
||||
@@ -170,13 +174,10 @@ public class AndroidRunConfiguration extends AndroidRunConfigurationBase impleme
|
||||
return new MyApplicationLauncher(activityToLaunch);
|
||||
}
|
||||
|
||||
private static boolean isActivityLaunchable(@NotNull Module module, PsiClass c) {
|
||||
Activity activity = AndroidDomUtil.getActivityDomElementByClass(module, c);
|
||||
if (activity != null) {
|
||||
for (IntentFilter filter : activity.getIntentFilters()) {
|
||||
if (AndroidDomUtil.containsAction(filter, AndroidUtils.LAUNCH_ACTION_NAME)) {
|
||||
return true;
|
||||
}
|
||||
private static boolean isActivityLaunchable(Activity activity) {
|
||||
for (IntentFilter filter : activity.getIntentFilters()) {
|
||||
if (AndroidDomUtil.containsAction(filter, AndroidUtils.LAUNCH_ACTION_NAME)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user