@Override public void initializeUI(UIBuilder builder) throws Exception { setupTargetClass(builder.getUIContext()); properties.setValueChoices( new Callable<Iterable<String>>() { @Override public Iterable<String> call() throws Exception { List<String> strings = new ArrayList<>(); JavaResource javaResource = targetClass.getValue(); JavaClassSource targetClass = javaResource.getJavaType(); List<PropertySource<JavaClassSource>> properties = targetClass.getProperties(); for (PropertySource<JavaClassSource> property : properties) { strings.add(property.getName()); } return strings; } }); properties.setEnabled( new Callable<Boolean>() { @Override public Boolean call() { return (targetClass.getValue() != null); } }); builder.add(targetClass).add(builderPattern).add(properties); }
@Override public void initializeUI(UIBuilder builder) throws Exception { initContainers(builder.getUIContext()); initProviders(); initConfigureMetadata(); builder.add(jpaVersion).add(container).add(provider).add(configureMetadata); }
@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory inputFactory = builder.getInputComponentFactory(); archetypeGroupId = inputFactory .createInput("archetypeGroupId", String.class) .setLabel("Archetype Group Id") .setRequired(true); archetypeArtifactId = inputFactory .createInput("archetypeArtifactId", String.class) .setLabel("Archetype Artifact Id") .setRequired(true); archetypeVersion = inputFactory .createInput("archetypeVersion", String.class) .setLabel("Archetype Version") .setRequired(true); archetypeRepository = inputFactory .createInput("archetypeRepository", String.class) .setLabel("Archetype repository URL") .setRequired(true); builder .add(archetypeGroupId) .add(archetypeArtifactId) .add(archetypeVersion) .add(archetypeRepository); }
@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory factory = builder.getInputComponentFactory(); named = factory .createInput("named", String.class) .setLabel("Archetype catalog Name") .setDescription("The archetype catalog name to be used") .setRequired(true); url = factory .createInput("url", URLResource.class) .setLabel("Archetype catalog URL") .setDescription("The archetype catalog URL to be used") .setRequired(true); builder.add(named).add(url); }
@Override public void initializeUI(UIBuilder builder) throws Exception { builder .add(named) .add(timeout) .add(conversationFieldName) .add(beginMethodName) .add(endMethodName) .add(overwrite); }
private void configureTargetLocationInput(final UIBuilder builder) { UISelection<Resource<?>> currentSelection = builder.getUIContext().getInitialSelection(); if (!currentSelection.isEmpty()) { Resource<?> resource = currentSelection.get(); if (resource instanceof DirectoryResource) { targetLocation.setDefaultValue((DirectoryResource) resource); } } else { targetLocation.setDefaultValue( resourceFactory.create(DirectoryResource.class, OperatingSystemUtils.getUserHomeDir())); } }
@Override public void initializeUI(UIBuilder builder) throws Exception { super.initializeUI(builder); UIContext context = builder.getUIContext(); Project project = getSelectedProject(context); JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class); final List<JavaResource> entities = persistenceOperations.getProjectEntities(project); forEntity.setValueChoices(entities); setDefaultTargetEntity(context.<FileResource<?>>getInitialSelection(), entities); getTargetPackage().setDescription("Repository package name"); getTargetPackage() .setDefaultValue(javaSourceFacet.getBasePackage() + DEFAULT_REPOSITORY_PACKAGE); repositoryType.setDefaultValue(SpringBootRepositoryType.PAGING_AND_SORTING); builder.add(forEntity); builder.add(repositoryType); }
@Override public void initializeUI(final UIBuilder builder) throws Exception { super.initializeUI(builder); buildName.setDefaultValue( new Callable<String>() { @Override public String call() throws Exception { Model mavenModel = getMavenModel(builder); if (mavenModel != null) { return mavenModel.getArtifactId(); } return null; } }); builder.add(buildName); builder.add(imageName); builder.add(gitUri); builder.add(outputImage); builder.add(webHookSecret); }
@Override public void initializeUI(UIBuilder builder) throws Exception { Set<AddonId> choices = new TreeSet<>(); for (AddonRepository repository : furnace.getRepositories()) { // Avoid immutable repositories if (repository instanceof MutableAddonRepository) { for (AddonId id : repository.listEnabled()) { if (id.getName().contains(":")) choices.add(id); } } } addonDependencies.setValueChoices(choices); addonDependencies.setDefaultValue(new ArrayList<AddonId>()); builder.add(addonDependencies); }
private void configureProjectTypeInput(final UIBuilder builder) { if (builder.getUIContext().getProvider().isGUI()) { type.setItemLabelConverter( new Converter<ProjectType, String>() { @Override public String convert(ProjectType source) { return source == null ? null : source.getType(); } }); } // Add Project types List<ProjectType> projectTypes = new ArrayList<>(); for (ProjectType projectType : type.getValueChoices()) { boolean buildable = false; for (ProjectProvider buildSystem : buildSystems) { if (isProjectTypeBuildable(projectType, buildSystem)) { projectTypes.add(projectType); buildable = true; break; } } if (!buildable) log.log( Level.FINE, "ProjectType [" + projectType.getType() + "] " + "deactivated because it cannot be built with any registered ProjectProvider instances [" + buildSystems + "]."); } Collections.sort( projectTypes, new Comparator<ProjectType>() { @Override public int compare(ProjectType left, ProjectType right) { return new Integer(left.priority()).compareTo(right.priority()); } }); if (!projectTypes.isEmpty()) { type.setDefaultValue(projectTypes.get(0)); } type.setValueChoices(projectTypes); }
@Override public void initializeUI(final UIBuilder builder) throws Exception { configureProjectNamedInput(); configureVersionInput(); configureTargetLocationInput(builder); configureOverwriteInput(); configureProjectTypeInput(builder); configureTopLevelPackageInput(); configureBuildSystemInput(); builder .add(named) .add(topLevelPackage) .add(version) .add(finalName) .add(targetLocation) .add(overwrite) .add(type) .add(buildSystem); }
@Override public void initializeUI(UIBuilder builder) throws Exception { final UIContext context = builder.getUIContext(); copyPipelineToProject.setValue(Boolean.TRUE); pipeline.setCompleter( new UICompleter<PipelineDTO>() { @Override public Iterable<PipelineDTO> getCompletionProposals( UIContext context, InputComponent<?, PipelineDTO> input, String value) { return getPipelines(context, true); } }); pipeline.setValueConverter( new Converter<String, PipelineDTO>() { @Override public PipelineDTO convert(String text) { return getPipelineForValue(context, text); } }); pipeline.addValueChangeListener( new ValueChangeListener() { @Override public void valueChanged(ValueChangeEvent event) { String value = event.getNewValue() != null ? event.getNewValue().toString() : null; if (value != null) { String description = getDescriptionForFlow(value); pipeline.setNote(description != null ? description : ""); } else { pipeline.setNote(""); } boolean canCopy = Strings.isNotBlank(value); copyPipelineToProject.setEnabled(canCopy); } }); if (getCurrentSelectedProject(context) != null) { PipelineDTO defaultValue = getPipelineForValue(context, DEFAULT_MAVEN_FLOW); if (defaultValue != null) { pipeline.setDefaultValue(defaultValue); pipeline.setValue(defaultValue); } } chatRoom.setCompleter( new UICompleter<String>() { @Override public Iterable<String> getCompletionProposals( UIContext context, InputComponent<?, String> input, String value) { return filterCompletions(getChatRoomNames(), value); } }); chatRoom.addValueChangeListener( new ValueChangeListener() { @Override public void valueChanged(ValueChangeEvent event) { String value = event.getNewValue() != null ? event.getNewValue().toString() : null; if (value != null) { String description = getDescriptionForChatRoom(value); chatRoom.setNote(description != null ? description : ""); } else { chatRoom.setNote(""); } } }); issueProjectName.setCompleter( new UICompleter<String>() { @Override public Iterable<String> getCompletionProposals( UIContext context, InputComponent<?, String> input, String value) { return filterCompletions(getIssueProjectNames(), value); } }); issueProjectName.addValueChangeListener( new ValueChangeListener() { @Override public void valueChanged(ValueChangeEvent event) { String value = event.getNewValue() != null ? event.getNewValue().toString() : null; if (value != null) { String description = getDescriptionForIssueProject(value); issueProjectName.setNote(description != null ? description : ""); } else { issueProjectName.setNote(""); } } }); // lets initialise the data from the current config if it exists ProjectConfig config = null; Project project = getCurrentSelectedProject(context); File configFile = getProjectConfigFile(context, getSelectedProject(context)); if (configFile != null && configFile.exists()) { config = ProjectConfigs.parseProjectConfig(configFile); } if (config != null) { PipelineDTO flow = getPipelineForValue(context, config.getPipeline()); if (flow != null) { CommandHelpers.setInitialComponentValue(this.pipeline, flow); } CommandHelpers.setInitialComponentValue(chatRoom, config.getChatRoom()); CommandHelpers.setInitialComponentValue(issueProjectName, config.getIssueProjectName()); CommandHelpers.setInitialComponentValue(codeReview, config.getCodeReview()); } inputComponents = new ArrayList<>(); File jenkinsFile = CommandHelpers.getProjectContextFile(context, project, "Jenkinsfile"); boolean hasJenkinsFile = Files.isFile(jenkinsFile); LOG.debug("Has Jenkinsfile " + hasJenkinsFile + " with file: " + jenkinsFile); if (!hasJenkinsFile) { inputComponents.addAll( CommandHelpers.addInputComponents(builder, pipeline, copyPipelineToProject)); } inputComponents.addAll( CommandHelpers.addInputComponents(builder, chatRoom, issueProjectName, codeReview)); }
@Override public void initializeUI(UIBuilder builder) throws Exception { builder.add(named).add(createPackageInfo).add(testFolder); }
@Override public void initializeUI(UIBuilder builder) throws Exception { builder.add(label).add(verbose); }
@Override public void initializeUI(UIBuilder builder) throws Exception { builder.add(javaEEVersion); }
@Override public void initializeUI(UIBuilder builder) throws Exception { builder.add(name); super.initializeUI(builder); }
@Override public void initializeUI(UIBuilder builder) throws Exception { builder.add(url); }
@Override public void initializeUI(UIBuilder builder) throws Exception { name.setCompleter(new CamelContextCompleter(getController())); builder.add(name); }
@Override public void initializeUI(UIBuilder builder) throws Exception { super.initializeUI(builder); builder.add(pseudo).add(passivating); }