Skip to content

Commit 8cae6dd

Browse files
committed
small bugfixes on first contact
1 parent f13f60e commit 8cae6dd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/java/JavaInputConverter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ public static List<Object> convertInput(List<Object> javaElements, InputInterpre
6262
// Take first input type as precondition for the input is that all input types are part of the
6363
// same project
6464
try {
65-
IType rootType = ((ICompilationUnit) elem).getTypes()[0];
65+
IType[] types = ((ICompilationUnit) elem).getTypes();
66+
if (types.length < 1) {
67+
throw new GeneratorCreationException("The input does not declare a class");
68+
}
69+
IType rootType = types[0];
6670
try {
6771
ClassLoader projectClassLoader =
6872
ClassLoaderUtil.getProjectClassLoader(rootType.getJavaProject());

cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/workbenchcontrol/handler/GenerateJob.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,11 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte
7777
monitor.beginTask("Searching valid triggers...", 1);
7878
if (!generator.isValidInput(monitor)) {
7979
LOG.info("No matching Trigger. Exiting generate command.");
80-
MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "No matching Trigger!",
81-
"Your current selection is not valid as input for any generation purpose. "
82-
+ "Please find the specification of valid inputs in the context configuration ('"
83-
+ ResourceConstants.CONFIG_PROJECT_NAME + "/context.xml').");
80+
PlatformUIUtil.getWorkbench().getDisplay().syncExec(
81+
() -> MessageDialog.openInformation(HandlerUtil.getActiveShell(event), "No matching Trigger!",
82+
"Your current selection is not valid as input for any generation purpose. "
83+
+ "Please find the specification of valid inputs in the context configuration ('"
84+
+ ResourceConstants.CONFIG_PROJECT_NAME + "/context.xml')."));
8485
return;
8586
}
8687
monitor.worked(1);

0 commit comments

Comments
 (0)