@Override public boolean apply(String input) { return !Strings.isEmpty(input.trim()); } });
protected List<String> getDirectories(String path) { if (Strings.isEmpty(path)) { return Lists.newArrayList(); } final List<String> split = split(emptyIfNull(path), File.pathSeparator); return transform(split, new Function<String, String>() { @Override public String apply(String from) { return new File(new File(from).getAbsoluteFile().toURI().normalize()).getAbsolutePath(); } }); }
/** * Convert a given input string to a Java string. * * Unicode escaping is handled by the {@link UnicodeAwarePostProcessor}. */ @Override public String doConvertToJavaString(final String input) { return Strings.convertToJavaString(input, false); }
/** * Splits the given string into segments and returns them as a {@link QualifiedName}. * * @exception IllegalArgumentException * if the input is empty or null. */ public QualifiedName toQualifiedName(String qualifiedNameAsString) { if (qualifiedNameAsString == null) throw new IllegalArgumentException("Qualified name cannot be null"); if (qualifiedNameAsString.equals("")) throw new IllegalArgumentException("Qualified name cannot be empty"); if (Strings.isEmpty(getDelimiter())) return QualifiedName.create(qualifiedNameAsString); List<String> segs = getDelimiter().length() == 1 ? Strings.split(qualifiedNameAsString, getDelimiter() .charAt(0)) : Strings.split(qualifiedNameAsString, getDelimiter()); return QualifiedName.create(segs); }
@Override public String caseCharacterRange(CharacterRange object) { if (!Strings.isEmpty(object.getCardinality())) result.append('('); doSwitch(object.getLeft()); result.append(".."); doSwitch(object.getRight()); if (!Strings.isEmpty(object.getCardinality())) { result.append(')'); result.append(Strings.emptyIfNull(object.getCardinality())); } return ""; }
/** Change the boot classpath. * * <p>The boot classpath is a list the names of folders or jar files that are separated by {@link File#pathSeparator}. * * @param bootClasspath the new boot classpath. */ public void setBootClassPath(String bootClasspath) { this.bootClasspath = new ArrayList<>(); for (final String path : Strings.split(bootClasspath, Pattern.quote(File.pathSeparator))) { this.bootClasspath.add(normalizeFile(path)); } }
/** Change the extra languages' generators that should be enabled. * * @param identifiers the identifier, the identifiers (separated by {@link File#pathSeparator} of the * extra languages' generator(s) to be enabled. If this parameter is {@code null}, all the extra * languages' generator are disabled. * @since 0.8 */ public void setExtraLanguageGenerators(String identifiers) { this.enabledExtraLanguageContributions = Strings.emptyIfNull(identifiers); }
public static String concat(String separator, List<String> list) { return concat(separator, list, 0); }
protected void normalizeTokens(final IXtextGeneratorFileSystemAccess fsa, final String tokenFile) { String content = fsa.readTextFile(tokenFile).toString(); content = this.newLineNormalizer.postProcess(fsa.getURI(tokenFile), content).toString(); final List<String> splitted = Strings.split(content, this.codeConfig.getLineDelimiter()); Collections.<String>sort(splitted); String _concat = Strings.concat(this.codeConfig.getLineDelimiter(), splitted); String _lineDelimiter = this.codeConfig.getLineDelimiter(); String _plus = (_concat + _lineDelimiter); content = _plus; fsa.generateFile(tokenFile, content); }
private String normalizeEntryRuleName(String entryRuleName) { String antlrEntryRuleName; if (!entryRuleName.startsWith("entryRule")) { if (!entryRuleName.startsWith("rule")) { antlrEntryRuleName = "entryRule" + entryRuleName; } else { antlrEntryRuleName = "entry" + Strings.toFirstUpper(entryRuleName); } } else { antlrEntryRuleName = entryRuleName; } return antlrEntryRuleName; }
protected void startDirectRefactoring() throws InterruptedException { if (Strings.isEmpty(newName)) { restoreOriginalSelection(); } else { String originalName = getOriginalName(getXtextEditor()); if(!equal(originalName, newName)) { IRenameSupport renameSupport = createRenameSupport(renameElementContext, newName); if(renameSupport != null) renameSupport.startDirectRefactoring(); } } }
@Override protected String toEscapedString(String value) { return '"' + Strings.convertToJavaString(value, false) + '"'; }
/** Change the classpath. * * <p>The classpath is a list the names of folders or jar files that are separated by {@link File#pathSeparator}. * * @param classpath the new classpath. */ public void setClassPath(String classpath) { this.classpath = new ArrayList<>(); for (final String path : Strings.split(classpath, Pattern.quote(File.pathSeparator))) { this.classpath.add(normalizeFile(path)); } }
/** Constructor. * @param resourceID the name of the resource where the action is defined. * @param declaringType the declaring type of the action. * @param functionName the name of the action. */ protected QualifiedActionName(String resourceID, JvmIdentifiableElement declaringType, String functionName) { this.functionName = Strings.emptyIfNull(functionName); this.resourceID = Strings.emptyIfNull(resourceID); this.declaringType = declaringType; }
public static String concat(String separator, List<String> list) { return concat(separator, list, 0); }
public static String getContentAssistRuleName(AbstractRule rule) { String ruleName = getRuleName(rule); if (ruleName.startsWith("rule")) return "rule__" + Strings.toFirstUpper(ruleName.substring(4, ruleName.length())); return ruleName; }