Refine search
@Override public Result execute(UIExecutionContext context) throws Exception { UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(context); PrintStream out = uiContext.getProvider().getOutput().out(); for (ProjectFacet facet : project.getFacets()) { Object unwrappedFacet = Proxies.unwrap(facet); Class<?> type = unwrappedFacet.getClass(); out.println(type.getSimpleName() + "\t[" + unwrappedFacet + "]"); } out.println(); return Results.success(); }
@Override public Result execute(UIExecutionContext context) { final Result result; Project project = getSelectedProject(context.getUIContext()); DependencyFacet deps = project.getFacet(DependencyFacet.class); String name = named.getValue(); String urlValue = url.getValue(); if (deps.hasRepository(urlValue)) { result = Results.fail("Repository exists [" + url + "]"); } else { deps.addRepository(name, urlValue); result = Results.success("Added repository [" + name + "->" + urlValue + "]"); } return result; }
@Override public Result execute(UIExecutionContext context) throws Exception { UIContext uiContext = context.getUIContext(); Project project = getSelectedProject(uiContext); JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class); SOURCETYPE source = buildJavaSource(javaSourceFacet); JavaResource javaResource; if (source.hasSyntaxErrors()) { UIOutput output = uiContext.getProvider().getOutput(); PrintStream err = output.err(); err.println("Syntax Errors:"); for (SyntaxError error : source.getSyntaxErrors()) { err.println(error); } err.println(); return Results.fail("Syntax Errors found. See above"); } else { SOURCETYPE decorated = delegate.decorateSource(context, project, source); if (decorated != null) source = decorated; javaResource = javaSourceFacet.saveJavaSource(source); } uiContext.setSelection(javaResource); return Results.success(getType() + " " + source.getQualifiedName() + " was created"); }
@Override public Result execute(UIExecutionContext context) throws Exception { JavaResource javaResource = (JavaResource) context.getUIContext().getInitialSelection().get(); JavaClassSource commandClass = javaResource.getJavaType(); commandClass = createCommand(commandClass, named.getValue(), categories.getValue()); javaResource.setContents(commandClass); return Results.success("Annotated UICommand created"); }
@Override public Result execute(UIExecutionContext context) throws Exception { UIContext uiContext = context.getUIContext(); Project project = (Project) uiContext.getAttributeMap().get(Project.class); if (project == null) { project = getSelectedProject(context.getUIContext()); MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class); File folder = project.getRoot().reify(DirectoryResource.class).getUnderlyingResourceObject(); String fabric8Deps = csbFabric8.toString(); String bootVersion = springBootVersion.getValue() + ".RELEASE"; return Results.success("Created new Spring Boot project in directory: " + folder.getName());
@Override public Result execute(UIExecutionContext context) throws Exception Result result = Results.success("Project named '" + named.getValue() + "' has been created."); DirectoryResource targetDir = getTargetDirectory(); boolean overwriteDir = overwrite.getValue() || useTargetLocationRoot.getValue(); if (targetDir.mkdirs() || overwriteDir) UIContext uiContext = context.getUIContext(); MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class); metadataFacet.setProjectName(named.getValue()); metadataFacet.setProjectVersion(version.getValue()); metadataFacet.setProjectGroupName(topLevelPackage.getValue()); if (project.hasFacet(PackagingFacet.class)) PackagingFacet packagingFacet = project.getFacet(PackagingFacet.class); if (finalName.hasValue()) facetFactory.install(project, stack.getValue()); result = Results.aggregate( Arrays.asList(result, Results.success("Stack '" + stackFacet.getStack().getName() + "' installed in project"))); uiContext.setSelection(project.getRoot()); uiContext.getAttributeMap().put(Project.class, project);
@Override public Result execute(UIExecutionContext context) throws Exception { Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); LOG.info("devops tab has attributes:: " + attributeMap); try { return Results.success(""); } catch (IllegalArgumentException e) { return Results.fail(e.getMessage()); } }
@Override public Result execute(UIExecutionContext context) throws Exception UIContext uiContext = context.getUIContext(); UIOutput uiOutput = uiContext.getProvider().getOutput(); Project project = (Project) uiContext.getAttributeMap().get(Project.class); if (project == null) project = getSelectedProject(context.getUIContext()); String bootVersion = springBootVersion.getValue(); final Integer portValue = port.getValue(); if (portValue != 8080) { final Properties properties = new Properties(); final Boolean createStatic = createStaticContent.getValue(); if (createStatic) { final ResourcesFacet resourcesFacet = project.getFacet(ResourcesFacet.class); final FileResource<?> staticDir = resourcesFacet.getResource("static"); if (!staticDir.exists()) { return Results.success( "Created new Spring Boot project in directory: " + folder.getName());
@Override public Result execute(UIExecutionContext context) throws Exception Result result = Results.fail("Error executing script."); UIContext uiContext = context.getUIContext(); Resource<?> currentResource = (Resource<?>) uiContext.getInitialSelection().get(); final UIOutput output = uiContext.getProvider().getOutput(); if (command.hasValue()) String[] commands = command.getValue().split(" "); ProcessBuilder processBuilder = new ProcessBuilder(commands); Object currentDir = currentResource.getUnderlyingResourceObject(); if (returnCode == 0) result = Results.success(); result = Results.fail("Error while executing native command. See output for more details"); .stdout(output.out()).stderr(output.err()).timeout(timeout.getValue()).build(); result = (Result) scriptEngine.eval(resource.getContents(), scriptContext); selectedResource = (Resource<?>) scriptContext uiContext.setSelection(selectedResource);
@Override public Result execute(UIExecutionContext context) throws Exception { GitIgnoreFacet facet = getSelectedProject(context).getFacet(GitIgnoreFacet.class); GitIgnoreResource resource = gitIgnoreResource(context.getUIContext()); StringBuffer buffer = new StringBuffer(); for (String template : templates.getValue().split(" ")) { String content = facet.contentOf(template); buffer.append(content).append("\n"); } String content = buffer.toString(); resource.setContents(content); StringBuilder resultString = new StringBuilder(); resultString.append("Wrote to .gitignore. Content:").append("\n"); resultString.append(content).append("\n"); context.getUIContext().setSelection(resource); return Results.success(resultString.toString()); }
@Override public Result execute(UIExecutionContext context) throws Exception UIContext uiContext = context.getUIContext(); Resource<?> currentResource = (Resource<?>) uiContext.getInitialSelection().get(); Iterator<String> it = arguments.getValue() == null ? Collections.<String> emptyList().iterator() : arguments .getValue().iterator(); Result result = Results.success(); UIOutput output = uiContext.getProvider().getOutput(); while (it.hasNext()) result = Results.fail(); if (color.getValue()) result = Results.fail();
UIOutput output = context.getUIContext().getProvider().getOutput(); output.warn(output.out(), message.getMessage()); if (context.getPrompt().promptBoolean("Would you like to continue?", true) == false) return Results.fail("Aborted by the user."); if (!context.getPrompt().promptBoolean(promptMsg, false)) return Results.fail("Files exist in " + outputPath + ", but --overwrite not specified. Aborting!"); context.getUIContext().getAttributeMap().put(WindupConfiguration.class, windupConfiguration); try (GraphContext graphContext = graphContextFactory.create(graphPath, true)) context.getUIContext().getAttributeMap().put(GraphContext.class, graphContext); UIProgressMonitor uiProgressMonitor = context.getProgressMonitor(); WindupProgressMonitor progressMonitor = new WindupProgressMonitorAdapter(uiProgressMonitor); windupConfiguration return Results.success("Report created: " + indexHtmlPath + System.getProperty("line.separator") + " Access it at this URL: " + indexHtmlPath.toUri());
@Override public void postCommandExecuted(UICommand command, UIExecutionContext context, Result result) Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap(); String skipProjectBuild = Objects.toString(attributeMap.get(PROJECT_BUILDSTATUS_SKIP_FLAG), null); Imported<ProjectFactory> services = SimpleContainer UIContext uiContext = context.getUIContext(); Project project = Projects.getSelectedProject(projectFactory, uiContext.getSelection()); if (project != null && project.hasFacet(PackagingFacet.class)) PackagingFacet facet = project.getFacet(PackagingFacet.class); BuildResult buildResult = facet.getBuildResult(); if (buildResult != null && !buildResult.isSuccess()) UIOutput output = uiContext.getProvider().getOutput(); PrintStream err = output.err(); output.error(err, String.format("Project '%s' has errors", project.getRoot())); for (BuildMessage message : buildResult.getMessages())
@Override public Result execute(UIExecutionContext executionContext) throws Exception UIProgressMonitor progressMonitor = executionContext.getProgressMonitor(); UIOutput output = executionContext.getUIContext().getProvider().getOutput(); FractionUsageAnalyzer analyzer = WildFlySwarmFacet.getFractionUsageAnalyzer(); DirectoryResource value = inputDir.getValue(); analyzer.source(value.getUnderlyingResourceObject()); Project project = getSelectedProject(executionContext); int total = 1; if (build.getValue()) total++; if (depend.getValue()) total++; progressMonitor.beginTask("Detecting fractions", total); if (build.getValue()) PackagingFacet packaging = project.getFacet(PackagingFacet.class); progressMonitor.setTaskName("Building the project..."); FileResource<?> finalArtifact = packaging.createBuilder().build(output.out(), output.err()) WildFlySwarmFacet facet = project.getFacet(WildFlySwarmFacet.class); detectedFractions.removeAll(facet.getInstalledFractions()); return Results.success();
@Override public Result execute(UIExecutionContext context) throws Exception UIOutput output = context.getUIContext().getProvider().getOutput(); PrintStream out = output.out(); if (named.hasValue()) .getArchetypeCatalogFactory(named.getValue()); if (archetypeCatalogFactory != null) return Results.success();
@Override public Result execute(UIExecutionContext context) Project project = getSelectedProject(context.getUIContext()); final DependencyFacet deps = project.getFacet(DependencyFacet.class); if (existingDep != null) if (context.getPrompt().promptBoolean( String.format("Dependency is already managed [%s:%s:%s], reference the managed dependency?", existingDep.getCoordinate().getGroupId(), existingDep.getCoordinate().getArtifactId(), existingDep.getCoordinate().getVersion()))) return Results.success("Project not updated: No changes required."); return Results.success("Installed [" + count + "] dependenc" + (count == 1 ? "y" : "ies") + "."); return Results.fail("No arguments specified.");
@Override public Result execute(UIExecutionContext context) throws Exception { AddonProjectConfigurator addonProjectFactory = SimpleContainer .getServices(getClass().getClassLoader(), AddonProjectConfigurator.class).get(); final Project project = (Project) context.getUIContext().getAttributeMap().get(Project.class); Set<AddonId> dependencyAddons = new TreeSet<>(); if (addons.hasValue() || addons.hasDefaultValue()) { for (AddonId id : addons.getValue()) { dependencyAddons.add(id); } } dependencyAddons.add(furnaceContainer.getValue()); if (splitProjects.getValue()) { addonProjectFactory.setupComplexAddonProject(project, dependencyAddons); } else { addonProjectFactory.setupSimpleAddonProject(project, dependencyAddons); } return Results.success(); }
@Override public Result execute(UIExecutionContext uiExecutionContext) throws Exception { Project project = getSelectedProject(uiExecutionContext.getUIContext()); facet.setFaceted(project); if (! facet.isInstalled()) { return Results.fail("The project is not a vert.x project, execute 'vertx-setup' before adding a verticle."); } String verticleType = type.getValue(); if (verticleType == null || verticleType.isEmpty()) { verticleType = detectVerticleTypeFromVerticleName(name.getValue()); System.out.println("Verticle Type (detected) : " + verticleType); } String packageName = null; String verticleName = name.getValue(); if (verticleType.equalsIgnoreCase("java")) { packageName = extractPackageName(name.getValue()); verticleName = extractJavaClassName(name.getValue()); } String fileName = verticles.createNewVerticle(facet.getFaceted(), verticleName, packageName, verticleType, main.getValue()); return Results.success("Verticle " + fileName + " created"); }
UIProvider provider = context.getUIContext().getProvider(); UIOutput output = provider.getOutput(); UIPrompt prompt = context.getPrompt(); PrintStream out = output.out(); DirectoryResource forgeHome = getForgeHome(); if (updateDir.exists()) return Results.fail( "There is an update pending. Restart Forge for the update to take effect. To abort this update, type 'forge-update-abort'"); return Results.success();