@Override public void initializeUI(UIBuilder builder) throws Exception { InputComponentFactory factory = builder.getInputComponentFactory(); coordinate = factory.createInput("coordinate", String.class).setLabel("Coordinate") .setDescription("The addon's \"groupId:artifactId,version\" coordinate") .setNote("The addon's \"groupId:artifactId,version\" coordinate").setRequired(true); ProjectFactory projectFactory = SimpleContainer.getServices(getClass().getClassLoader(), ProjectFactory.class) .get(); Project project = Projects.getSelectedProject(projectFactory, builder.getUIContext()); if (project != null) { MetadataFacet facet = project.getFacet(MetadataFacet.class); Coordinate c = facet.getOutputDependency().getCoordinate(); coordinate.setDefaultValue(AddonId.from(c.getGroupId() + ":" + c.getArtifactId(), c.getVersion()) .toCoordinates()); } List<String> defaultCoords = Arrays.asList(CoordinateUtils.FORGE_ADDON_GROUP_ID); coordinate.setCompleter((UIContext context, InputComponent<?, String> input, String value) -> { Iterable<String> items = Collections.emptySet(); if (Strings.isNullOrEmpty(value)) { items = defaultCoords; } return items; }); builder.add(coordinate); }
Coordinate coordinate = project.getFacet(MetadataFacet.class).getOutputDependency().getCoordinate(); try
Coordinate buildCoordinate = project.getFacet(MetadataFacet.class).getOutputDependency().getCoordinate(); try
Project testsProject = createSubmoduleProject(project, "tests", projectName + "-tests", AddonTestFacet.class); Dependency apiProjectDependency = apiProject.getFacet(MetadataFacet.class).getOutputDependency(); Dependency implProjectDependency = implProject.getFacet(MetadataFacet.class).getOutputDependency(); spiProject.getFacet(MetadataFacet.class).getOutputDependency()) .setClassifier(FORGE_ADDON_CLASSIFIER); addonProject.getFacet(MetadataFacet.class).getOutputDependency()) .setClassifier(FORGE_ADDON_CLASSIFIER);