@Override public void handle( AnnotationValues<MVCAware> annotation, Annotation source, EclipseNode annotationNode) { EclipseType type = EclipseType.typeOf(annotationNode, source); if (type.isAnnotation() || type.isInterface()) { annotationNode.addError(canBeUsedOnClassAndEnumOnly(MVCAware.class)); return; } EclipseUtil.addInterface(type.get(), MVCAwareConstants.MVC_HANDLER_TYPE, source); handler.addMVCSupport(type); type.editor().rebuild(); }
@Override public void handle( AnnotationValues<CassandraAware> annotation, Annotation source, EclipseNode annotationNode) { EclipseType type = EclipseType.typeOf(annotationNode, source); if (type.isAnnotation() || type.isInterface()) { annotationNode.addError(canBeUsedOnClassAndEnumOnly(CassandraAware.class)); return; } EclipseUtil.addInterface( type.get(), CassandraAwareConstants.CASSANDRA_CONTRIBUTION_HANDLER_TYPE, source); handler.addCassandraProviderField(type); handler.addCassandraProviderAccessors(type); handler.addCassandraContributionMethods(type); type.editor().rebuild(); }
/** * Create an eclipse launch configuration file for the specified test * * @param test the GWTTestCase * @param testSrc the source directory where the test lives * @throws MojoExecutionException some error occured */ private void createLaunchConfigurationForGwtTestCase(File testSrc, String test) throws MojoExecutionException { File testFile = new File(testSrc, test); String fqcn = test.replace(File.separatorChar, '.').substring(0, test.lastIndexOf('.')); File launchFile = new File(getProject().getBasedir(), fqcn + ".launch"); if (launchFile.exists() && launchFile.lastModified() > testFile.lastModified()) { return; } Configuration cfg = new Configuration(); cfg.setClassForTemplateLoading(EclipseTestMojo.class, ""); Map<String, Object> context = new HashMap<String, Object>(); List<String> sources = new LinkedList<String>(); sources.addAll(executedProject.getTestCompileSourceRoots()); sources.addAll(executedProject.getCompileSourceRoots()); context.put("sources", sources); context.put("test", fqcn); int basedir = getProject().getBasedir().getAbsolutePath().length(); context.put("out", testOutputDirectory.getAbsolutePath().substring(basedir + 1)); context.put("extraJvmArgs", getExtraJvmArgs()); context.put("project", eclipseUtil.getProjectName(getProject())); try { // context.put( "gwtDevJarPath", getGwtDevJar().getAbsolutePath() ); Writer configWriter = WriterFactory.newXmlWriter(launchFile); Template template = cfg.getTemplate("test-launch.fm", "UTF-8"); template.process(context, configWriter); configWriter.flush(); configWriter.close(); getLog().info("Write launch configuration for GWT test : " + launchFile.getAbsolutePath()); } catch (IOException ioe) { throw new MojoExecutionException("Unable to write launch configuration", ioe); } catch (TemplateException te) { throw new MojoExecutionException("Unable to merge freemarker template", te); } }