org.eclipse.xtext.util.Strings.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.eclipse.xtext.util.Strings.isEmpty()方法的一些代码示例,展示了Strings.isEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Strings.isEmpty()方法的具体详情如下:
包路径:org.eclipse.xtext.util.Strings
类名称:Strings
方法名:isEmpty

Strings.isEmpty介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.xtend/org.eclipse.xtend.core

@Override
  public boolean apply(String input) {
    return !Strings.isEmpty(input.trim());
  }
});

代码示例来源:origin: org.eclipse.xtext/ui

public boolean isSimilar(String s0, String s1) {
  if(Strings.isEmpty(s0) || Strings.isEmpty(s1)) {
    return false;
  }
  double levenshteinDistance = StringUtils.getLevenshteinDistance(s0, s1);
  return levenshteinDistance <= 1;
}

代码示例来源:origin: org.eclipse/xtext

@Override
public String toString() {
  String result = this.getClass().getSimpleName();
  return "TerminalConsumer " + (Strings.isEmpty(result) ? this.getClass().getName() : result) + " for rule '" + getRuleName() + "'";
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

public void writeHidden(EObject grammarElement, String value) throws IOException {
  if (!Strings.isEmpty(value)) {
    this.appender.append(value);
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.builder.standalone

@Override
public void write(char[] data, int offset, int count) throws IOException {
  String message = String.copyValueOf(data, offset, count);
  if (!Strings.isEmpty(message.trim())) {
    if (configuration.isVerbose())
      LOG.info(message);
  }
}

代码示例来源:origin: org.eclipse.xtext/util

public static String[] unpack(String packed) {
  if (isEmpty(packed)) {
    return null;
  } else {
    List<String> strings = Lists.newArrayList();
    unpack(strings, packed);
    return strings.toArray(new String[strings.size()]);
  }
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

public static ModelPath getActiveModelPath() {
  String modelPathString = System.getProperty(ImportResolver.SYS_VARIABLE_MODEL_PATH);
  if (Strings.isEmpty(modelPathString)) {
    return null;
  }
  return new ModelPath(modelPathString);
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

public void writeSemantic(EObject grammarElement, String value) throws IOException {
  if (!Strings.isEmpty(value)) {
    this.appender.append(value);
  }
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Add an implemented type.
 * @param type the qualified name of the implemented type.
 */
public void addImplements(String type) {
  if (!Strings.isEmpty(type)) {
    this.sarlSkill.getImplements().add(newTypeRef(this.sarlSkill, type));
  }
}

代码示例来源:origin: org.eclipse.xtext/org.eclipse.xtext.xbase

protected Multimap<String, JvmDeclaredType> getLocallyDefinedTypes(XtextResource resource) {
  Multimap<String, JvmDeclaredType> result = LinkedHashMultimap.create();
  for(JvmDeclaredType type: config.getLocallyDefinedTypes(resource)) {
    String packageName = type.getPackageName();
    if(isEmpty(packageName)) 
      result.put(type.getQualifiedName('.'), type);
    else 
      result.put(type.getQualifiedName('.').substring(packageName.length() + 1), type);
  }
  return result;
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Change the return type.
 @param type the return type of the member.
 */
public void setReturnType(String type) {
  if (!Strings.isEmpty(type)
      && !Objects.equals("void", type)
      && !Objects.equals(Void.class.getName(), type)) {
    this.sarlAction.setReturnType(newTypeRef(container, type));
  } else {
    this.sarlAction.setReturnType(null);
  }
}

代码示例来源:origin: org.eclipse/xtext

public static String getNamespace(Grammar g) {
  if (Strings.isEmpty(g.getName()))
    return null;
  String[] splitted = g.getName().split("\\.");
  return Strings.concat(".", Arrays.asList(splitted), 1);
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Initialize the Ecore element when inner type declaration.
 */
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
  if (this.sarlInterface == null) {
    this.container = container;
    this.sarlInterface = SarlFactory.eINSTANCE.createSarlInterface();
    container.getMembers().add(this.sarlInterface);
    if (!Strings.isEmpty(name)) {
      this.sarlInterface.setName(name);
    }
  }
}

代码示例来源:origin: io.sarl.lang/io.sarl.lang

/** Initialize the Ecore element when inner type declaration.
 */
public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) {
  if (this.sarlClass == null) {
    this.container = container;
    this.sarlClass = SarlFactory.eINSTANCE.createSarlClass();
    container.getMembers().add(this.sarlClass);
    if (!Strings.isEmpty(name)) {
      this.sarlClass.setName(name);
    }
  }
}

代码示例来源:origin: org.eclipse.xtext/ui

public boolean initialize(EObject targetElement, IRenameElementContext context) {
  this.nameAttribute = getNameAttribute(targetElement);
  if(nameAttribute == null)
    return false;
  this.targetElementOriginalURI = EcoreUtil.getURI(targetElement);
  this.originalName = targetElement.eGet(nameAttribute).toString();
  return !Strings.isEmpty(originalName);
}

代码示例来源:origin: org.eclipse.xtext/builder

protected IProject getBuiltProject(BuildData buildData) {
  if (Strings.isEmpty(buildData.getProjectName()))
    return null;
  return workspace.getRoot().getProject(buildData.getProjectName());
}

代码示例来源:origin: org.eclipse.xtext.ui.codetemplates/ui

@Check
public void checkNameIsNotEmpty(Codetemplate template) {
  if (Strings.isEmpty(template.getName())) {
    error("Template name cannot be empty.", TemplatesPackage.Literals.CODETEMPLATE__NAME);
  }
}

代码示例来源:origin: org.eclipse.xtext/ui

protected String getLabel (EObject o) {
  String text = getLabelProvider().getText(o);
  if(!isEmpty(text))
    return HTMLPrinter.convertToHTMLContent(text);
  else
    return null;
}

代码示例来源:origin: com.reprezen.rapidml/com.reprezen.rapidml

@SuppressWarnings("unused")
  private QualifiedName qualifiedName(ZenModel model) {
    if (!Strings.isEmpty(model.getNamespace())) {
      return QualifiedName.create(model.getNamespace().split("\\.")).append(model.getName()); //$NON-NLS-1$
    }
    return QualifiedName.create(model.getName());
  }
}

代码示例来源:origin: org.eclipse.xtext/ui

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();
    }
  }
}

相关文章