List of usage examples for org.springframework.ide.eclipse.boot.wizard.content BuildType getBuildScript
public IPath getBuildScript()
From source file:org.springframework.ide.eclipse.boot.wizard.content.CodeSet.java
/** * Fetch list of build types that are supported by the CodeSet. Note that * determining this information requires inspecting some of the directory * entries in the CodeSet and therefore it requires downloading the * content / zip / repo the CodeSet is contained in (unless it is * already cached locally)./* www.j ava 2 s .c om*/ */ public List<BuildType> getBuildTypes() throws UIThreadDownloadDisallowed { //Only use 'default' build type if no other build type works. if (this.buildTypes == null) { //Careful if the code in here throws (e.g. because not yet downloaded and in UI thread... //then do NOT stick an empty list into this.buildTypes! ArrayList<BuildType> buildTypes = new ArrayList<BuildType>(); for (BuildType type : BuildType.values()) { IPath scriptFile = type.getBuildScript(); if (scriptFile != null && hasFile(scriptFile)) { buildTypes.add(type); } } if (buildTypes.isEmpty()) { buildTypes.add(BuildType.GENERAL); } this.buildTypes = buildTypes; } return this.buildTypes; }
From source file:org.springframework.ide.eclipse.boot.wizard.content.CodeSet.java
public ValidationResult validateBuildType(BuildType buildType) throws UIThreadDownloadDisallowed { List<BuildType> validBuildTypes = getBuildTypes(); if (validBuildTypes.contains(buildType)) { return ValidationResult.OK; }//w w w. ja va2 s . c o m //Not valid formulate a nice explanation IPath expectedScript = buildType.getBuildScript(); if (expectedScript != null) { return ValidationResult .error("Can't use '" + buildType.displayName() + "': There is no '" + expectedScript + "'"); } else { StringBuilder message = new StringBuilder("Should be imported as "); boolean first = true; for (BuildType bt : validBuildTypes) { if (!first) { message.append(" or "); } message.append("'" + bt.displayName() + "'"); first = false; } return ValidationResult.error(message.toString()); } }