当前位置: 首页>>代码示例>>Java>>正文


Java Project.hasFacet方法代码示例

本文整理汇总了Java中org.jboss.forge.addon.projects.Project.hasFacet方法的典型用法代码示例。如果您正苦于以下问题:Java Project.hasFacet方法的具体用法?Java Project.hasFacet怎么用?Java Project.hasFacet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.forge.addon.projects.Project的用法示例。


在下文中一共展示了Project.hasFacet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeUI

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
@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);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:23,代码来源:NewIntegrationTestClassCommand.java

示例2: createCurrentLineCompleter

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
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);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:AbstractCamelProjectCommand.java

示例3: getXmlResourceFile

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
protected FileResource getXmlResourceFile(Project project, String xmlResourceName) {
    if (xmlResourceName == null) {
        return null;
    }

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

    FileResource file = facet != null ? facet.getResource(xmlResourceName) : null;
    if (file == null || !file.exists()) {
        file = webResourcesFacet != null ? webResourcesFacet.getWebResource(xmlResourceName) : null;
    }
    return file;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:21,代码来源:AbstractCamelProjectCommand.java

示例4: asRelativeFile

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
protected String asRelativeFile(UIContext context, String currentFile) {
    Project project = getSelectedProject(context);

    JavaSourceFacet javaSourceFacet = null;
    ResourcesFacet resourcesFacet = null;
    WebResourcesFacet webResourcesFacet = null;
    if (project.hasFacet(JavaSourceFacet.class)) {
        javaSourceFacet = project.getFacet(JavaSourceFacet.class);
    }
    if (project.hasFacet(ResourcesFacet.class)) {
        resourcesFacet = project.getFacet(ResourcesFacet.class);
    }
    if (project.hasFacet(WebResourcesFacet.class)) {
        webResourcesFacet = project.getFacet(WebResourcesFacet.class);
    }
    return asRelativeFile(currentFile, javaSourceFacet, resourcesFacet, webResourcesFacet);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:18,代码来源:AbstractCamelProjectCommand.java

示例5: initializeUI

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    InputComponentFactory factory = builder.getInputComponentFactory();
    dependencies = factory.createSelectMany("dependencies", VertxDependency.class)
        .setLabel("Dependency List")
        .setDescription("Dependency list");

    UIContext uiContext = builder.getUIContext();
    if (uiContext.getProvider().isGUI()) {
        dependencies.setItemLabelConverter(VertxDependency::getName);
    } else {
        dependencies.setItemLabelConverter(VertxDependency::getArtifactId);
    }
    Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
    final Collection<VertxDependency> deps;
    if (project != null && project.hasFacet(VertxMavenFacet.class)) {
        deps = project.getFacet(VertxMavenFacet.class).getNotUsedDependencies();
    } else {
        deps = VertxMavenFacet.getAllDependencies();
    }

    dependencies.setValueChoices(deps);

    builder.add(dependencies);
}
 
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:26,代码来源:AddDependencyCommand.java

示例6: initializeUI

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    InputComponentFactory factory = builder.getInputComponentFactory();
    dependencies = factory.createSelectMany("dependencies", VertxDependency.class)
        .setLabel("Dependency List")
        .setDescription("Dependency list");

    UIContext uiContext = builder.getUIContext();
    if (uiContext.getProvider().isGUI()) {
        dependencies.setItemLabelConverter(VertxDependency::getName);
    } else {
        dependencies.setItemLabelConverter(VertxDependency::getArtifactId);
    }

    Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
    final Collection<VertxDependency> deps;
    if (project != null && project.hasFacet(VertxMavenFacet.class)) {
        deps = project.getFacet(VertxMavenFacet.class).getUsedDependencies();
    } else {
        deps = VertxMavenFacet.getAllDependencies();
    }

    dependencies.setValueChoices(deps);

    builder.add(dependencies);
}
 
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:27,代码来源:RemoveDependencyCommand.java

示例7: loadCamelConnectionDto

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
protected ConnectionCatalogDto loadCamelConnectionDto(Project project) {
    if (project.hasFacet(ResourcesFacet.class)) {
        ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
        FileResource file = facet.getResource("camel-connector.json");
        String json = file.getContents();

        try {
            ObjectMapper mapper = new ObjectMapper();
            return mapper.readValue(json, ConnectionCatalogDto.class);
        } catch (IOException e) {
            // error
        }
    }

    return null;
}
 
开发者ID:fabric8io,项目名称:django,代码行数:17,代码来源:AbstractIPaaSProjectCommand.java

示例8: transform

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
@Override
public UICommand transform(UIContext context, UICommand original)
{
   final Project project = helper.getProject(context);
   if (project != null && project.hasFacet(SpringBootFacet.class))
   {
      if (original instanceof org.jboss.forge.addon.javaee.rest.ui.RestNewEndpointCommand)
      {
         return JavaSourceCommandWrapper.wrap(original,
                  new RestNewEndpointDecorator((RestNewEndpointCommand) original));
      }

      if (original instanceof JPASetupWizard)
      {
         return jpaSetupWizard.get();
      }

      if (original instanceof JPANewEntityCommand)
      {
         return JavaSourceCommandWrapper.wrap(original,
                  new CreateSpringBootJPASupportDecorator((AbstractJavaSourceCommand) original));
      }

      if (original.getClass().getName().contains("RestEndpointFromEntityCommand"))
      {
         return new RestGenerateFromEntitiesCommand(original, helper);
      }

      if (original.getClass().getName().contains("CrossOriginResourceSharingFilterCommand"))
      {
         return new RestCORSFilterCommand((AbstractJavaSourceCommand<JavaClassSource>) original);
      }
   }

   return original;
}
 
开发者ID:forge,项目名称:springboot-addon,代码行数:37,代码来源:SpringBootCommandTransformer.java

示例9: isEnabled

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
@Override
public boolean isEnabled(UIContext context) {
    // must be fabric8 and java project
    boolean answer = isFabric8Project(getSelectedProjectOrNull(context));
    if (answer) {
        Project project = getCurrentSelectedProject(context);
        answer = project.hasFacet(JavaSourceFacet.class);
    }
    return answer;
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:11,代码来源:NewIntegrationTestClassCommand.java

示例10: createXmlEndpointsCompleter

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
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);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:AbstractCamelProjectCommand.java

示例11: createXmlFileCompleter

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
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);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:13,代码来源:AbstractCamelProjectCommand.java

示例12: createSpringBootConfigurationFileCompleter

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
protected SpringBootConfigurationFileCompleter createSpringBootConfigurationFileCompleter(UIContext context, Function<String, Boolean> filter) {
    Project project = getSelectedProject(context);
    ResourcesFacet resourcesFacet = null;
    if (project.hasFacet(ResourcesFacet.class)) {
        resourcesFacet = project.getFacet(ResourcesFacet.class);
    }
    return new SpringBootConfigurationFileCompleter(resourcesFacet, filter);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:9,代码来源:AbstractCamelProjectCommand.java

示例13: execute

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
@Override
public Result execute(UIExecutionContext context) throws Exception {
    Project project = getSelectedProject(context);

    // does the project already have camel?
    Dependency core = findCamelCoreDependency(project);
    if (core == null) {
        return Results.fail("The project does not include camel-core");
    }

    ProjectDto camelProject = new ProjectDto();

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

    // use value choices instead of completer as that works better in web console
    XmlEndpointsCompleter xmlEndpointCompleter = new XmlEndpointsCompleter(resourcesFacet, webResourcesFacet, null);
    JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);

    // use value choices instead of completer as that works better in web console
    RouteBuilderEndpointsCompleter javaEndpointsCompleter = new RouteBuilderEndpointsCompleter(javaSourceFacet, null);

    camelProject.addEndpoints(javaEndpointsCompleter.getEndpoints());
    camelProject.addEndpoints(xmlEndpointCompleter.getEndpoints());

    CamelCurrentComponentsFinder componentsFinder = new CamelCurrentComponentsFinder(getCamelCatalog(), project);
    List<ComponentDto> currentComponents = componentsFinder.findCurrentComponents();
    camelProject.setComponents(currentComponents);

    String result = formatResult(camelProject);
    return Results.success(result);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:36,代码来源:CamelGetOverviewCommand.java

示例14: getCamelConnectorFile

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
protected FileResource getCamelConnectorFile(UIContext context) {
    Project project = getSelectedProjectOrNull(context);
    if (project != null && project.hasFacet(ResourcesFacet.class)) {
        ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
        return facet.getResource("camel-connector.json");
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:django,代码行数:10,代码来源:AbstractIPaaSProjectCommand.java

示例15: getCamelComponentFile

import org.jboss.forge.addon.projects.Project; //导入方法依赖的package包/类
protected FileResource getCamelComponentFile(Project project, String scheme) {
    if (project != null && project.hasFacet(ResourcesFacet.class)) {
        ResourcesFacet facet = project.getFacet(ResourcesFacet.class);
        return facet.getResource("META-INF/services/org/apache/camel/component/" + scheme);
    } else {
        return null;
    }
}
 
开发者ID:fabric8io,项目名称:django,代码行数:9,代码来源:ConnectorSelectComponentStep.java


注:本文中的org.jboss.forge.addon.projects.Project.hasFacet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。