Skip to content

Commit

Permalink
small bugfixes on first contact
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeec committed Jul 15, 2021
1 parent f13f60e commit 8cae6dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ public static List<Object> convertInput(List<Object> javaElements, InputInterpre
// Take first input type as precondition for the input is that all input types are part of the
// same project
try {
IType rootType = ((ICompilationUnit) elem).getTypes()[0];
IType[] types = ((ICompilationUnit) elem).getTypes();
if (types.length < 1) {
throw new GeneratorCreationException("The input does not declare a class");
}
IType rootType = types[0];
try {
ClassLoader projectClassLoader =
ClassLoaderUtil.getProjectClassLoader(rootType.getJavaProject());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte
monitor.beginTask("Searching valid triggers...", 1);
if (!generator.isValidInput(monitor)) {
LOG.info("No matching Trigger. Exiting generate command.");
MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "No matching Trigger!",
"Your current selection is not valid as input for any generation purpose. "
+ "Please find the specification of valid inputs in the context configuration ('"
+ ResourceConstants.CONFIG_PROJECT_NAME + "/context.xml').");
PlatformUIUtil.getWorkbench().getDisplay().syncExec(
() -> MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "No matching Trigger!",
"Your current selection is not valid as input for any generation purpose. "
+ "Please find the specification of valid inputs in the context configuration ('"
+ ResourceConstants.CONFIG_PROJECT_NAME + "/context.xml')."));
return;
}
monitor.worked(1);
Expand Down

0 comments on commit 8cae6dd

Please sign in to comment.