本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
}