org.jboss.forge.addon.projects.Project Java Examples

The following examples show how to use org.jboss.forge.addon.projects.Project. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CamelProjectHelper.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
public static boolean hasManagedDependency(Project project, String groupId, String artifactId, String version) {
    List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getManagedDependencies();
    for (Dependency d : dependencies) {
        boolean match = d.getCoordinate().getGroupId().equals(groupId);
        if (match && artifactId != null) {
            match = d.getCoordinate().getArtifactId().equals(artifactId);
        }
        if (match && version != null) {
            match = d.getCoordinate().getVersion().equals(version);
        }
        if (match) {
            return match;
        }
    }
    return false;
}
 
Example #2
Source File: AbstractCamelProjectCommand.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
protected CurrentLineCompleter createCurrentLineCompleter(int lineNumber, String file, UIContext context) throws Exception {
    Project project = getSelectedProject(context);

    JavaSourceFacet sourceFacet = null;
    ResourcesFacet resourcesFacet = null;
    WebResourcesFacet webResourcesFacet = null;
    if (project.hasFacet(JavaSourceFacet.class)) {
        sourceFacet = project.getFacet(JavaSourceFacet.class);
    }
    if (project.hasFacet(ResourcesFacet.class)) {
        resourcesFacet = project.getFacet(ResourcesFacet.class);
    }
    if (project.hasFacet(WebResourcesFacet.class)) {
        webResourcesFacet = project.getFacet(WebResourcesFacet.class);
    }

    String relativeFile = asRelativeFile(context, file);
    return new CurrentLineCompleter(lineNumber, relativeFile, sourceFacet, resourcesFacet, webResourcesFacet);
}
 
Example #3
Source File: NewIntegrationTestClassCommand.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeUI(final UIBuilder builder) throws Exception {
    super.initializeUI(builder);

    Project project = getCurrentSelectedProject(builder.getUIContext());
    if (project.hasFacet(JavaSourceFacet.class)) {
        JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
        targetPackage.setCompleter(new TestPackageNameCompleter(facet));
    }
    targetPackage.addValidator(new PackageNameValidator());
    targetPackage.setDefaultValue("io.fabric8.itests");

    className.addValidator(new ClassNameValidator(false));
    className.setDefaultValue(new Callable<String>() {
        @Override
        public String call() throws Exception {
            return "IntegrationTestKT";
        }
    });

    builder.add(targetPackage).add(className).add(profile).add(integrationTestWildcard).add(itestPlugin);
}
 
Example #4
Source File: NewNodeXmlTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
protected void testDeleteRoute(Project project) throws Exception {
    String key = "_camelContext1/cbr-route/_choice1/_when1/_to1";
    CommandController command = testHarness.createCommandController(CamelDeleteNodeXmlCommand.class, project.getRoot());
    command.initialize();
    command.setValueFor("xml", "META-INF/spring/camel-context.xml");

    setNodeValue(key, command);

    assertValidAndExecutes(command);

    List<ContextDto> contexts = getRoutesXml(project);
    assertFalse("Should have loaded a camelContext", contexts.isEmpty());

    assertNoNodeWithKey(contexts, key);
    assertNodeWithKey(contexts, NEW_ROUTE_KEY);
}
 
Example #5
Source File: DetectFractionsCommand.java    From thorntail-addon with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
   InputComponentFactory factory = builder.getInputComponentFactory();
   Project project = getSelectedProject(builder);
   inputDir = factory.createInput("inputDir", DirectoryResource.class).setLabel("Input Directory")
            .setDescription("Directory containing the compiled project sources").setRequired(true)
            .setDefaultValue(getTargetDirectory(project));
   build = factory.createInput("build", Boolean.class).setLabel("Build Project?")
            .setDescription("Build project before attempting to auto-detect");
   depend = factory.createInput("depend", Boolean.class)
            .setLabel("Add Missing Fractions as Project Dependencies?")
            .setDescription("Add missing fractions as project dependencies");

   builder.add(inputDir).add(build).add(depend);
}
 
Example #6
Source File: CamelProjectAddComponentStep.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    final Project project = getSelectedProject(builder);

    Iterable<ComponentDto> it = CamelCommandsHelper.createAllComponentDtoValues(project, getCamelCatalog(), filter, true).call();
    // flattern the choices to a map so the UI is more responsive, as we can do a direct lookup
    // in the map from the value converter
    final Map<String, ComponentDto> components = new LinkedHashMap<>();
    for (ComponentDto dto : it) {
        components.put(dto.getScheme(), dto);
    }

    componentName.setValueChoices(components.values());
    // include converter from string->dto
    componentName.setValueConverter(components::get);

    builder.add(componentName);
}
 
Example #7
Source File: AddFractionCommand.java    From thorntail-addon with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Result execute(UIExecutionContext context) throws Exception
{
    Project project = getSelectedProject(context);
    ThorntailFacet facet = project.getFacet(ThorntailFacet.class);
    if (fractionElements.hasValue())
    {
        List<FractionDescriptor> fractions = Lists.toList(fractionElements.getValue());
        facet.installFractions(fractions);
        List<String> artifactIds = fractions.stream().map(FractionDescriptor::getArtifactId)
                    .collect(Collectors.toList());
        return Results.success("Thorntail Fractions '"
                    + artifactIds
                    + "' were successfully added to the project descriptor");
    }
    return Results.success();
}
 
Example #8
Source File: NewNodeXmlTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
protected void testAddEndpoint(Project project) throws Exception {
    String key = "_camelContext1/myNewRoute/_from1";
    WizardCommandController command = testHarness.createWizardController(CamelAddEndpointXmlCommand.class, project.getRoot());
    command.initialize();
    command.setValueFor("xml", "META-INF/spring/camel-context.xml");
    setNodeValue(key, command);
    command.setValueFor("componentName", "log");

    command = command.next();
    command.initialize();
    command.setValueFor("loggerName", "myLog");

    assertExecutes(command);

    List<ContextDto> contexts = getRoutesXml(project);
    assertFalse("Should have loaded a camelContext", contexts.isEmpty());

    String expectedKey = "_camelContext1/myNewRoute/_to1";
    assertNodeWithKey(contexts, expectedKey);
}
 
Example #9
Source File: RunCommand.java    From thorntail-addon with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Result execute(UIExecutionContext context)
{
   Project project = getSelectedProject(context);
   UIOutput output = context.getUIContext().getProvider().getOutput();
   PackagingFacet packagingFacet = project.getFacet(PackagingFacet.class);
   try
   {
      packagingFacet.createBuilder().addArguments("thorntail:run").runTests(false).build(output.out(),
               output.err());
   }
   catch (BuildException ie)
   {
      if (!(ie.getCause() instanceof InterruptedException))
      {
         return Results.fail("Error while running the build", ie.getCause());
      }
   }
   return Results.success();
}
 
Example #10
Source File: CamelDeleteNodeXmlCommand.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isEnabled(UIContext context) {
    boolean enabled = super.isEnabled(context);
    if (enabled) {
        // we should only be enabled in non gui
        boolean gui = isRunningInGui(context);
        enabled = !gui;
    }
    if (enabled) {
        // must have xml files with camel routes to be enabled
        Project project = getSelectedProject(context);
        String currentFile = getSelectedFile(context);
        String selected = configureXml(project, xml, currentFile);
        return selected != null;
    }
    return false;
}
 
Example #11
Source File: CamelAddNodeXmlCommand.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    UIContext context = builder.getUIContext();
    Map<Object, Object> attributeMap = context.getAttributeMap();
    attributeMap.remove("navigationResult");

    Project project = getSelectedProject(context);
    String currentFile = getSelectedFile(context);

    String selected = configureXml(project, xml, currentFile);
    parents = configureXmlNodes(context, project, selected, xml, parent);

    nameFilter.setValueChoices(CamelCommandsHelper.createEipLabelValues(project, getCamelCatalog()));
    nameFilter.setDefaultValue("<all>");

    name.setValueChoices(CamelCommandsHelper.createAllEipDtoValues(project, getCamelCatalog(), nameFilter));
    // include converter from string->dto
    name.setValueConverter(text -> createEipDto(getCamelCatalog(), text));

    builder.add(xml).add(parent).add(nameFilter).add(name);
}
 
Example #12
Source File: NewComponentInstanceTest.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
@Test
public void testSomething() throws Exception {
    File tempDir = OperatingSystemUtils.createTempDir();
    try {
        Project project = projectFactory.createTempProject();
        Assert.assertNotNull("Should have created a project", project);

        CommandController command = testHarness.createCommandController(CamelSetupCommand.class, project.getRoot());
        command.initialize();
        command.setValueFor("kind", "camel-spring");

        Result result = command.execute();
        Assert.assertFalse("Should setup Camel in the project", result instanceof Failed);

        command = testHarness.createCommandController(CamelGetComponentsCommand.class, project.getRoot());
        command.initialize();

        result = command.execute();
        Assert.assertFalse("Should not fail", result instanceof Failed);

        String message = result.getMessage();
        System.out.println(message);
    } finally {
        tempDir.delete();
    }
}
 
Example #13
Source File: ScaffoldableEntitySelectionWizard.java    From angularjs-addon with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
   UIContext uiContext = builder.getUIContext();
   Project project = getSelectedProject(uiContext);

   JPAFacet<?> persistenceFacet = project.getFacet(JPAFacet.class);
   List<JavaClassSource> allEntities = persistenceFacet.getAllEntities();
   List<JavaClassSource> supportedEntities = new ArrayList<>();
   for (JavaClassSource entity : allEntities)
   {
      for (Member<?> member : entity.getMembers())
      {
         // FORGE-823 Only add entities with @Id as valid entities for REST resource generation.
         // Composite keys are not yet supported.
         if (member.hasAnnotation(Id.class))
         {
            supportedEntities.add(entity);
         }
      }
   }
   targets.setValueChoices(supportedEntities);
   targets.setItemLabelConverter(JavaClassSource::getQualifiedName);
   builder.add(targets).add(generateRestResources);
}
 
Example #14
Source File: CamelProjectHelper.java    From fabric8-forge with Apache License 2.0 6 votes vote down vote up
public static boolean hasDependency(Project project, String groupId, String artifactId, String version) {
    List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies();
    for (Dependency d : dependencies) {
        boolean match = d.getCoordinate().getGroupId().equals(groupId);
        if (match && artifactId != null) {
            match = d.getCoordinate().getArtifactId().equals(artifactId);
        }
        if (match && version != null) {
            match = d.getCoordinate().getVersion().equals(version);
        }
        if (match) {
            return match;
        }
    }
    return false;
}
 
Example #15
Source File: CamelProjectAddComponentCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    final Project project = getSelectedProject(builder);

    filter.setValueChoices(CamelCommandsHelper.createComponentLabelValues(project, getCamelCatalog()));
    filter.setDefaultValue("<all>");

    // we use the componentName in the next step so do not add it to this builder
    builder.add(filter);
}
 
Example #16
Source File: AbstractCamelProjectCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
protected XmlFileCompleter createXmlFileCompleter(Project project, Function<String, Boolean> filter) {
    ResourcesFacet resourcesFacet = null;
    WebResourcesFacet webResourcesFacet = null;
    if (project.hasFacet(ResourcesFacet.class)) {
        resourcesFacet = project.getFacet(ResourcesFacet.class);
    }
    if (project.hasFacet(WebResourcesFacet.class)) {
        webResourcesFacet = project.getFacet(WebResourcesFacet.class);
    }

    return new XmlFileCompleter(resourcesFacet, webResourcesFacet, filter);
}
 
Example #17
Source File: JSONRestResourceFromEntityCommand.java    From angularjs-addon with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
   UIContext context = builder.getUIContext();
   Project project = getSelectedProject(context);
   JPAFacet<PersistenceCommonDescriptor> persistenceFacet = project.getFacet(JPAFacet.class);
   JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
   List<String> persistenceUnits = new ArrayList<>();
   List<PersistenceUnitCommon> allUnits = persistenceFacet.getConfig().getAllPersistenceUnit();
   for (PersistenceUnitCommon persistenceUnit : allUnits)
   {
      persistenceUnits.add(persistenceUnit.getName());
   }
   if (!persistenceUnits.isEmpty())
   {
      persistenceUnit.setValueChoices(persistenceUnits).setDefaultValue(persistenceUnits.get(0));
   }

   // TODO: May detect where @Path resources are located
   packageName.setDefaultValue(javaSourceFacet.getBasePackage() + ".rest");

   RestResourceGenerator defaultResourceGenerator = null;
   for (RestResourceGenerator generator : resourceGenerators)
   {
      if (generator.getName().equals(RestGenerationConstants.JPA_ENTITY))
      {
         defaultResourceGenerator = generator;
      }
   }
   generator.setDefaultValue(defaultResourceGenerator);
   generator.setItemLabelConverter(
            context.getProvider().isGUI() ? RestResourceGenerator::getDescription : RestResourceGenerator::getName);
   builder.add(generator).add(packageName).add(persistenceUnit);
}
 
Example #18
Source File: ConfigureEndpointPropertiesStep.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
protected Result addEndpointJava(Project project, JavaSourceFacet facet, JavaResource file, String uri,
                                 String endpointInstanceName, String routeBuilder, String cursorPosition) throws Exception {

    JavaClassSource clazz = file.getJavaType();

    // we do not want to change the current code formatting so we need to search
    // replace the unformatted class source code
    StringBuilder sb = new StringBuilder(clazz.toUnformattedString());

    int pos = Integer.valueOf(cursorPosition);

    // move to end if pos is after the content
    pos = Math.min(sb.length(), pos);

    LOG.info("Adding endpoint at pos: " + pos + " in file: " + routeBuilder);

    // check if prev and next is a quote and if not then add it automatic
    int prev = pos - 1;
    int next = pos + 1;
    char ch = sb.charAt(prev);
    char ch2 = next < sb.length() ? sb.charAt(next) : ' ';
    if (ch != '"' && ch2 != '"') {
        uri = "\"" + uri + "\"";
    }

    // insert uri at position
    sb.insert(pos, uri);

    // use this code currently to save content unformatted
    file.setContents(sb.toString());

    return Results.success("Added endpoint " + uri + " in " + routeBuilder);
}
 
Example #19
Source File: SetupFractionsStep.java    From thorntail-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Result execute(UIExecutionContext context)
{
    Project project = getSelectedProject(context);
    ThorntailFacet thorntail = project.getFacet(ThorntailFacet.class);
    List<FractionDescriptor> installedFractions = thorntail.getInstalledFractions();
    if (enableJAXRS(installedFractions))
    {
        JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
        JavaClassSource restEndpoint = Roaster.create(JavaClassSource.class)
                    .setPackage(facet.getBasePackage() + ".rest")
                    .setName("HelloWorldEndpoint");
        if (hasCDI(installedFractions))
        {
            restEndpoint.addAnnotation(ApplicationScoped.class);
        }
        restEndpoint.addAnnotation(Path.class).setStringValue("/hello");
        MethodSource<JavaClassSource> method = restEndpoint.addMethod().setPublic().setReturnType(Response.class)
                    .setName("doGet")
                    .setBody("return Response.ok(\"Hello from Thorntail!\").build();");
        method.addAnnotation(GET.class);
        method.addAnnotation(javax.ws.rs.Produces.class).setStringArrayValue(new String[] { MediaType.TEXT_PLAIN });
        facet.saveJavaSource(restEndpoint);
    }
    if (hasTopologyJgroups(installedFractions))
    {
        ThorntailConfiguration config = thorntail.getConfiguration();
        Map<String, String> props = new TreeMap<>(config.getProperties());
        props.put("swarm.bind.address", "127.0.0.1");
        props.put("java.net.preferIPv4Stack", "true");
        props.put("jboss.node.name", "${project.artifactId}");
        thorntail.setConfiguration(ThorntailConfigurationBuilder.create(config).properties(props));
    }
    return Results.success();
}
 
Example #20
Source File: AbstractCamelProjectCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
protected XmlEndpointsCompleter createXmlEndpointsCompleter(Project project, Function<String, Boolean> filter) {
    ResourcesFacet resourcesFacet = null;
    WebResourcesFacet webResourcesFacet = null;
    if (project.hasFacet(ResourcesFacet.class)) {
        resourcesFacet = project.getFacet(ResourcesFacet.class);
    }
    if (project.hasFacet(WebResourcesFacet.class)) {
        webResourcesFacet = project.getFacet(WebResourcesFacet.class);
    }

    return new XmlEndpointsCompleter(resourcesFacet, webResourcesFacet, filter);
}
 
Example #21
Source File: CamelGetRoutesXmlCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);

    String xmlResourceName = xml.getValue();
    List<ContextDto> camelContexts = CamelXmlHelper.loadCamelContext(getCamelCatalog(), context.getUIContext(), project, xmlResourceName);
    if (camelContexts == null) {
        return Results.fail("No file found for: " + xmlResourceName);
    }
    String result = formatResult(camelContexts);
    return Results.success(result);
}
 
Example #22
Source File: CamelSetupCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnabled(UIContext context) {
    Project project = getSelectedProjectOrNull(context);
    // only enable if we do not have Camel yet
    if (project == null) {
        // must have a project
        return false;
    } else {
        // and the project must not have camel already
        return !isCamelProject(project);
    }
}
 
Example #23
Source File: CamelEditNodeXmlCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnabled(UIContext context) {
    boolean enabled = super.isEnabled(context);
    // this command works both in Web UI and in GUI mode
    if (enabled) {
        // must have xml files with camel routes to be enabled
        Project project = getSelectedProject(context);
        String currentFile = getSelectedFile(context);
        String selected = configureXml(project, xml, currentFile);
        return selected != null;
    }
    return false;
}
 
Example #24
Source File: CamelGetComponentsCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);
    boolean excludeProjectComponents = isValueTrue(excludeProject);
    Callable<Iterable<ComponentDto>> callable = CamelCommandsHelper.createAllComponentDtoValues(project, getCamelCatalog(), filter, excludeProjectComponents);
    Iterable<ComponentDto> results = callable.call();
    String result = formatResult(results);
    return Results.success(result);
}
 
Example #25
Source File: CamelGetRoutesXmlCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    Project project = getSelectedProject(builder.getUIContext());
    String currentFile = getSelectedFile(builder.getUIContext());

    String selected = configureXml(project, xml, currentFile);
    builder.add(xml).add(format);
}
 
Example #26
Source File: AddFractionCommand.java    From thorntail-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
    InputComponentFactory factory = builder.getInputComponentFactory();
    fractionElements = factory.createSelectMany("fractions", FractionDescriptor.class)
                .setLabel("Fraction List")
                .setDescription("Fraction list");

    UIContext uiContext = builder.getUIContext();
    if (uiContext.getProvider().isGUI())
    {
        fractionElements.setItemLabelConverter(FractionDescriptor::getName);
    }
    else
    {
        fractionElements.setItemLabelConverter(FractionDescriptor::getArtifactId);
    }
    Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
    final Collection<FractionDescriptor> fractions;
    if (project != null && project.hasFacet(ThorntailFacet.class))
    {
        fractions = project.getFacet(ThorntailFacet.class).getFractions();
    }
    else
    {
        fractions = ThorntailFacet.getAllFractionDescriptors();
    }
    final List<FractionDescriptor> nonInternalfractions = fractions.stream()
                .filter(f -> !f.isInternal())
                .collect(Collectors.toList());
    fractionElements.setValueChoices(nonInternalfractions);

    builder.add(fractionElements);
}
 
Example #27
Source File: CreateTestClassCommand.java    From thorntail-addon with Eclipse Public License 1.0 5 votes vote down vote up
private void addDefaultDeploymentAnnotation(JavaClassSource test, Project project) throws ClassNotFoundException, IOException {
    test.addImport("org.wildfly.swarm.arquillian.DefaultDeployment");
    final AnnotationSource<JavaClassSource> defaultDeploymentAnnotation = test.addAnnotation("DefaultDeployment");
    if (asClient.hasValue()) {
        defaultDeploymentAnnotation.setLiteralValue("testable", "false");
    }

    if (archiveType.hasValue()) {
        defaultDeploymentAnnotation.setLiteralValue("type", String.format("DefaultDeployment.Type.%s", archiveType.getValue()));
    }
}
 
Example #28
Source File: AngularScaffoldProvider.java    From angularjs-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public boolean isSetup(ScaffoldSetupContext setupContext)
{
   Project project = setupContext.getProject();
   String targetDir = setupContext.getTargetDirectory();
   targetDir = targetDir == null ? "" : targetDir;
   if (project.hasAllFacets(WebResourcesFacet.class, DependencyFacet.class, JPAFacet.class, EJBFacet.class,
            CDIFacet.class, RestFacet.class))
   {
      WebResourcesFacet web = project.getFacet(WebResourcesFacet.class);
      boolean areResourcesInstalled = web.getWebResource(targetDir + GLYPHICONS_SVG).exists()
               && web.getWebResource(targetDir + GLYPHICONS_EOT).exists()
               && web.getWebResource(targetDir + GLYPHICONS_SVG).exists()
               && web.getWebResource(targetDir + GLYPHICONS_TTF).exists()
               && web.getWebResource(targetDir + GLYPHICONS_WOFF).exists()
               && web.getWebResource(targetDir + GLYPHICONS_WOFF2).exists()
               && web.getWebResource(targetDir + FORGE_LOGO_PNG).exists()
               && web.getWebResource(targetDir + ANGULAR_RESOURCE_JS).exists()
               && web.getWebResource(targetDir + ANGULAR_ROUTE_JS).exists()
               && web.getWebResource(targetDir + ANGULAR_JS).exists()
               && web.getWebResource(targetDir + MODERNIZR_JS).exists()
               && web.getWebResource(targetDir + JQUERY_JS).exists()
               && web.getWebResource(targetDir + BOOTSTRAP_JS).exists()
               && web.getWebResource(targetDir + OFFCANVAS_JS).exists()
               && web.getWebResource(targetDir + MAIN_CSS).exists()
               && web.getWebResource(targetDir + BOOTSTRAP_CSS).exists()
               && web.getWebResource(targetDir + BOOTSTRAP_THEME_CSS).exists()
               && web.getWebResource(targetDir + LANDING_VIEW).exists();
      return areResourcesInstalled;
   }
   return false;
}
 
Example #29
Source File: CommandHelpers.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
public static File getBaseDir(Project project) {
    if (project == null) {
        return null;
    }
    Resource<?> root = project.getRoot();
    if (root == null) {
        return null;
    }
    return ResourceUtil.getContextFile(root);
}
 
Example #30
Source File: CamelCommandsHelper.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
public static Callable<Iterable<ComponentDto>> createComponentDtoValues(final Project project, final CamelCatalog camelCatalog,
                                                                        final UISelectOne<String> componentCategoryFilter,
                                                                        final boolean excludeComponentsOnClasspath,
                                                                        final boolean consumerOnly, final boolean producerOnly,
                                                                        final boolean mustHaveOptions) {
    // use callable so we can live update the filter
    return new Callable<Iterable<ComponentDto>>() {
        @Override
        public Iterable<ComponentDto> call() throws Exception {
            String label = componentCategoryFilter != null ? componentCategoryFilter.getValue() : null;
            return new CamelComponentsCompleter(project, camelCatalog, null, excludeComponentsOnClasspath, false, consumerOnly, producerOnly, mustHaveOptions).getValueChoices(label);
        }
    };
}