|
32 | 32 | import freemarker.template.TemplateException;
|
33 | 33 |
|
34 | 34 | /**
|
35 |
| - * |
| 35 | + * Wrapper for CobiGen providing an eclipse compliant API. |
36 | 36 | * @author mbrunnli (02.12.2014)
|
37 | 37 | */
|
38 | 38 | public abstract class CobiGenWrapper extends AbstractCobiGenWrapper {
|
@@ -432,111 +432,4 @@ public List<String> getMatchingTriggerIds(Object loadClass) {
|
432 | 432 | */
|
433 | 433 | public abstract boolean isValidInput(IStructuredSelection selection) throws InvalidInputException;
|
434 | 434 |
|
435 |
| - // /** |
436 |
| - // * Checks if the selected items are supported by one or more {@link Trigger}s, and if they are supported |
437 |
| - // * by the same {@link Trigger}s |
438 |
| - // * |
439 |
| - // * @param selection |
440 |
| - // * the selection made |
441 |
| - // * @return true, if all items are supported by the same trigger(s)<br> |
442 |
| - // * false, if they are not supported by any trigger at all |
443 |
| - // * @throws InvalidInputException |
444 |
| - // * if the input could not be read as expected |
445 |
| - // * @author trippl (22.04.2013) |
446 |
| - // */ |
447 |
| - // public boolean isValidInput(IStructuredSelection selection) throws InvalidInputException { |
448 |
| - // |
449 |
| - // Iterator<?> it = selection.iterator(); |
450 |
| - // List<String> firstTriggers = null; |
451 |
| - // |
452 |
| - // boolean uniqueSourceSelected = false; |
453 |
| - // |
454 |
| - // while (it.hasNext()) { |
455 |
| - // Object tmp = it.next(); |
456 |
| - // if (tmp instanceof ICompilationUnit) { |
457 |
| - // if (firstTriggers == null) { |
458 |
| - // firstTriggers = findMatchingTriggers((ICompilationUnit) tmp); |
459 |
| - // } else { |
460 |
| - // if (!firstTriggers.equals(findMatchingTriggers((ICompilationUnit) tmp))) { |
461 |
| - // throw new InvalidInputException( |
462 |
| - // "You selected at least two inputs, which are not matching the same triggers. " |
463 |
| - // + "For batch processing all inputs have to match the same triggers."); |
464 |
| - // } |
465 |
| - // } |
466 |
| - // } else if (tmp instanceof IPackageFragment) { |
467 |
| - // uniqueSourceSelected = true; |
468 |
| - // firstTriggers = |
469 |
| - // cobiGen.getMatchingTriggerIds(new PackageFolder(((IPackageFragment) tmp).getResource() |
470 |
| - // .getLocationURI(), ((IPackageFragment) tmp).getElementName())); |
471 |
| - // } else if (tmp instanceof IFile) { |
472 |
| - // uniqueSourceSelected = true; |
473 |
| - // try (InputStream stream = ((IFile) tmp).getContents()) { |
474 |
| - // LOG.debug("Try parsing file {} as xml...", ((IFile) tmp).getName()); |
475 |
| - // Document domDocument = XmlUtil.parseXmlStreamToDom(stream); |
476 |
| - // firstTriggers = cobiGen.getMatchingTriggerIds(domDocument); |
477 |
| - // } catch (CoreException e) { |
478 |
| - // throw new InvalidInputException("An eclipse internal exception occured! ", e); |
479 |
| - // } catch (IOException e) { |
480 |
| - // throw new InvalidInputException("The file " + ((IFile) tmp).getName() |
481 |
| - // + " could not be read!", e); |
482 |
| - // } catch (ParserConfigurationException e) { |
483 |
| - // throw new InvalidInputException("The file " + ((IFile) tmp).getName() |
484 |
| - // + " could not be parsed, because of an internal configuration error!", e); |
485 |
| - // } catch (SAXException e) { |
486 |
| - // throw new InvalidInputException("The contents of the file " + ((IFile) tmp).getName() |
487 |
| - // + " could not be detected as an instance of any CobiGen supported input language."); |
488 |
| - // } |
489 |
| - // } else { |
490 |
| - // throw new InvalidInputException( |
491 |
| - // "You selected at least one input, which type is currently not supported as input for generation. " |
492 |
| - // + "Please choose a different one or read the CobiGen documentation for more details."); |
493 |
| - // } |
494 |
| - // |
495 |
| - // if (uniqueSourceSelected && selection.size() > 1) { |
496 |
| - // throw new InvalidInputException( |
497 |
| - // "You selected at least one input in a mass-selection," |
498 |
| - // + " which type is currently not supported for batch processing. " |
499 |
| - // + "Please just select multiple inputs only if batch processing is supported for all inputs."); |
500 |
| - // } |
501 |
| - // } |
502 |
| - // return firstTriggers != null && !firstTriggers.isEmpty(); |
503 |
| - // } |
504 |
| - // |
505 |
| - // /** |
506 |
| - // * Returns a {@link Set} of {@link Trigger}s that support the give {@link ICompilationUnit} |
507 |
| - // * |
508 |
| - // * @param cu |
509 |
| - // * {@link ICompilationUnit} to be checked |
510 |
| - // * @return the {@link Set} of {@link Trigger}s |
511 |
| - // * @throws InvalidInputException |
512 |
| - // * if the input could not be read as expected |
513 |
| - // * @author trippl (22.04.2013) |
514 |
| - // */ |
515 |
| - // private List<String> findMatchingTriggers(ICompilationUnit cu) throws InvalidInputException { |
516 |
| - // |
517 |
| - // ClassLoader classLoader; |
518 |
| - // IType type = null; |
519 |
| - // try { |
520 |
| - // classLoader = ClassLoaderUtil.getProjectClassLoader(cu.getJavaProject()); |
521 |
| - // type = EclipseJavaModelUtil.getJavaClassType(cu); |
522 |
| - // return cobiGen.getMatchingTriggerIds(classLoader.loadClass(type.getFullyQualifiedName())); |
523 |
| - // } catch (MalformedURLException e) { |
524 |
| - // throw new InvalidInputException("Error while retrieving the project's ('" |
525 |
| - // + cu.getJavaProject().getElementName() + "') classloader.", e); |
526 |
| - // } catch (CoreException e) { |
527 |
| - // throw new InvalidInputException("An eclipse internal exception occured!", e); |
528 |
| - // } catch (ClassNotFoundException e) { |
529 |
| - // throw new InvalidInputException("The class '" + type.getFullyQualifiedName() |
530 |
| - // + "' could not be found. " |
531 |
| - // + "This may be cause of a non-compiling host project of the selected input.", e); |
532 |
| - // } catch (UnsupportedClassVersionError e) { |
533 |
| - // throw new InvalidInputException( |
534 |
| - // "Incompatible java version: " |
535 |
| - // + |
536 |
| - // "You have selected a java class, which Java version is higher than the Java runtime your eclipse is running with. " |
537 |
| - // + |
538 |
| - // "Please update your PATH variable to reference the latest Java runtime you are developing for and restart eclipse.\n" |
539 |
| - // + "Current runtime: " + System.getProperty("java.version"), e); |
540 |
| - // } |
541 |
| - // } |
542 | 435 | }
|
0 commit comments