本文整理汇总了Java中com.intellij.openapi.util.text.StringUtil.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.isEmpty方法的具体用法?Java StringUtil.isEmpty怎么用?Java StringUtil.isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.text.StringUtil
的用法示例。
在下文中一共展示了StringUtil.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verify
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
public static boolean verify(Options options) {
String message = null;
if (StringUtil.isEmpty(options.keyStorePath)) {
message = "Please choose a keystore file";
} else if (StringUtil.isEmpty(options.keyStorePassword)) {
message = "Please enter the keystore password";
} else if (StringUtil.isEmpty(options.keyPassword)) {
message = "Please enter the key password";
} else if (StringUtil.isEmpty(options.keyAlias)) {
message = "Please enter the key alias";
} else if (options.channels.size() == 0) {
message = "Please enter channels";
} else if (StringUtil.isEmpty(options.zipalignPath)) {
message = "Please choose a zipalign file";
} else if (StringUtil.isEmpty(options.signer)) {
message = "Please choose a signer";
} else if (StringUtil.isEmpty(options.buildType)) {
message = "Please choose a build type";
}
boolean success = message == null;
if (!success) {
NotificationHelper.error(message);
}
return success;
}
示例2: findOrCreateEnum
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@Nullable
TSMetaEnumImpl findOrCreateEnum(final @NotNull EnumType domEnumType) {
final String name = TSMetaEnumImpl.extractName(domEnumType);
if (StringUtil.isEmpty(name)) {
return null;
}
final NoCaseMap<TSMetaEnumImpl> enums = getEnums();
TSMetaEnumImpl impl = enums.get(name);
if (impl == null) {
impl = new TSMetaEnumImpl(name, domEnumType);
enums.put(name, impl);
} else {
//report a problem
}
return impl;
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:17,代码来源:TSMetaModelImpl.java
示例3: parseExpression
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
/**
* If inside tell (only in a tell?) compound statement - first check it's terms
*/
public static boolean parseExpression(PsiBuilder b, int l, String dictionaryTermToken, Parser expression) {
if (!recursion_guard_(b, l, "parseExpression")) return false;
if (!nextTokenIsFast(b, dictionaryTermToken)) return false;
boolean r;
//check application terms first
if (b.getUserData(PARSING_TELL_COMPOUND_STATEMENT) == Boolean.TRUE) {
String toldAppName = peekTargetApplicationName(b);
if (!StringUtil.isEmpty(toldAppName)) {
StringHolder parsedName = new StringHolder();
PsiBuilder.Marker mComName = enter_section_(b, l, _AND_, "<parse Expression>");
r = parseCommandNameForApplication(b, l + 1, parsedName, toldAppName, true);
exit_section_(b, l, mComName, null, r, false, null);
if (r) return false;
if (ParsableScriptSuiteRegistryHelper.isPropertyWithPrefixExist(toldAppName, dictionaryTermToken)) {
return false;
// PsiBuilder.Marker m = enter_section_(b, l, _AND_, null, "<dictionary constant>");
// r = parseDictionaryConstant(b, l + 1);
// exit_section_(b, l, m, r, false, null);
// if (r) return false;
}
}
}
return expression.parse(b, l + 1);
}
示例4: parse
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
public static void parse(@NotNull XmlFile file, @NotNull ApplicationDictionary parsedDictionary) {
System.out.println("Start parsing xml file --- " + file.toString() + " ---");
LOG.debug("Start parsing xml file --- " + file.toString() + " ---");
if (parsedDictionary.getRootTag() == null) {
parsedDictionary.setRootTag(file.getRootTag());
}
final XmlDocument document = file.getDocument();
if (document != null) {
final XmlTag rootTag = document.getRootTag();
if (rootTag != null) {
XmlAttribute attr = rootTag.getAttribute("title");
if ("dictionary".equals(rootTag.getName()) && attr != null) {
String dicTitle = attr.getValue();
if (!StringUtil.isEmpty(dicTitle)) {
parsedDictionary.setName(dicTitle);
}
}
parseRootTag(parsedDictionary, rootTag);
}
}
System.out.println("parsing completed for file.");
LOG.debug("parsing completed for file.");
}
示例5: getPropertiesFromTags
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
private static List<AppleScriptPropertyDefinition> getPropertiesFromTags(@NotNull DictionaryComponent classOrRecord,
@NotNull XmlTag[] propertyTags) {
if (!(classOrRecord instanceof AppleScriptClass) && !(classOrRecord instanceof DictionaryRecord))
return new ArrayList<>(0);
List<AppleScriptPropertyDefinition> properties = new ArrayList<>(propertyTags.length);
for (XmlTag propTag : propertyTags) {
AppleScriptPropertyDefinition property;
String pName = propTag.getAttributeValue("name");
String pCode = propTag.getAttributeValue("code");
String pDescription = propTag.getAttributeValue("description");
String pType = propTag.getAttributeValue("type");
if (StringUtil.isEmpty(pType)) {
XmlTag tType = propTag.findFirstSubTag("type");
pType = tType != null ? tType.getAttributeValue("type") : null;
}
String pAccessType = propTag.getAttributeValue("access");
AccessType accessType = "r".equals(pAccessType) ? AccessType.R : AccessType.RW;
if (pName != null && pCode != null && pType != null) {
property = new DictionaryPropertyImpl(classOrRecord, pName, pCode, pType, pDescription, propTag, accessType);
properties.add(property);
}
}
return properties;
}
示例6: getExtendingMetaClassNamesStream
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@NotNull
private static Stream<TSMetaClass> getExtendingMetaClassNamesStream(@NotNull final ItemType source) {
final String code = source.getCode().getStringValue();
if (StringUtil.isEmpty(code)) {
return Stream.empty();
}
final XmlElement xmlElement = source.getXmlElement();
final PsiFile psiFile = xmlElement == null ? null : xmlElement.getContainingFile();
if (psiFile == null) {
return Stream.empty();
}
final TSMetaModel metaModel = TSMetaModelAccess.getInstance(psiFile.getProject()).getTypeSystemMeta(psiFile);
final TSMetaClass sourceMeta = metaModel.findMetaClassForDom(source);
if (sourceMeta == null) {
return Stream.empty();
}
return metaModel
.getMetaClassesStream()
.map(TSMetaClass.class::cast)
.filter(meta -> sourceMeta.getName().equals(meta.getExtendedMetaClassName()));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:25,代码来源:TypeSystemGutterAnnotator.java
示例7: collectNavigationMarkers
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@Override
protected void collectNavigationMarkers(@NotNull PsiElement element,
@NotNull Collection<? super RelatedItemLineMarkerInfo> result) {
if (element instanceof AppleScriptApplicationReference) {
PsiElement leafNode = PsiTreeUtil.firstChild(element);
if (leafNode == null) return;
AppleScriptProjectDictionaryService dictionaryService = ServiceManager.getService(element.getProject(),
AppleScriptProjectDictionaryService.class);
AppleScriptApplicationReference appRef = (AppleScriptApplicationReference) element;
String appName = appRef.getApplicationName();
if (dictionaryService == null || StringUtil.isEmpty(appName)) return;
ApplicationDictionary dictionary = dictionaryService.getDictionary(appName);
if (dictionary == null /*|| dictionary.getApplicationBundle() == null*/) return;
NavigationGutterIconBuilder<PsiElement> builder =
NavigationGutterIconBuilder.create(dictionary.getIcon(0)).
setTargets(dictionary).setTooltipText("Navigate to application dictionary file");
result.add(builder.createLineMarkerInfo(leafNode));
}
}
示例8: initDictionariesInfoFromCache
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
/**
* Fill {@link #dictionaryInfoMap} from saved data
*
* @param systemDictionaryRegistry application component, which saves/loads the data
*/
private void initDictionariesInfoFromCache(@NotNull AppleScriptSystemDictionaryRegistryComponent systemDictionaryRegistry) {
notScriptableApplicationList.addAll(systemDictionaryRegistry.getNotScriptableApplications());
for (DictionaryInfo.State dInfoState : systemDictionaryRegistry.getDictionariesPersistedInfo()) {
String appName = dInfoState.applicationName;
String dictionaryUrl = dInfoState.dictionaryUrl;
String applicationUrl = dInfoState.applicationUrl;
if (!StringUtil.isEmptyOrSpaces(appName) && !StringUtil.isEmptyOrSpaces(dictionaryUrl)) {
File dictionaryFile = !StringUtil.isEmpty(dictionaryUrl) ? new File(dictionaryUrl) : null;
File applicationFile = !StringUtil.isEmpty(applicationUrl) ? new File(applicationUrl) : null;
if (dictionaryFile != null && dictionaryFile.exists()) {
DictionaryInfo dInfo = new DictionaryInfo(appName, dictionaryFile, applicationFile);
addDictionaryInfo(dInfo);
}
}
}
}
示例9: parseClassElement
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private void parseClassElement(@NotNull String applicationName, @NotNull Element classElement, boolean isExtends) {
// if isExtends -> name is always == "application"
String className = isExtends ? classElement.getAttributeValue("extends") : classElement.getAttributeValue("name");
String code = classElement.getAttributeValue("code");
String pluralClassName = classElement.getAttributeValue("plural");
if (className == null || code == null) return;
pluralClassName = !StringUtil.isEmpty(pluralClassName) ? pluralClassName : className + "s";
updateObjectNameSetForApplication(className, applicationName, applicationNameToClassNameSetMap);
updateObjectNameSetForApplication(pluralClassName, applicationName, applicationNameToClassNamePluralSetMap);
if (ApplicationDictionary.SCRIPTING_ADDITIONS_LIBRARY.equals(applicationName)) {
updateApplicationNameSetFor(className, applicationName, stdClassNameToApplicationNameSetMap);
updateApplicationNameSetFor(pluralClassName, applicationName, stdClassNamePluralToApplicationNameSetMap);
}
}
示例10: showTip
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private void showTip(KeyPromoterAction action) {
if (action == null || !action.isValid() || statsService.isSuppressed(action)) {
return;
}
final String shortcut = action.getShortcut();
if (!StringUtil.isEmpty(shortcut)) {
statsService.registerAction(action);
KeyPromoterNotification.showTip(action, statsService.get(action).getCount());
} else {
final String ideaActionID = action.getIdeaActionID();
withoutShortcutStats.putIfAbsent(ideaActionID, 0);
withoutShortcutStats.put(ideaActionID, withoutShortcutStats.get(ideaActionID) + 1);
if (keyPromoterSettings.getProposeToCreateShortcutCount() > 0 && withoutShortcutStats.get(ideaActionID) % keyPromoterSettings.getProposeToCreateShortcutCount() == 0) {
KeyPromoterNotification.askToCreateShortcut(action);
}
}
}
示例11: resetEditorFrom
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
@Override
protected void resetEditorFrom(AppleScriptRunConfiguration configuration) {
String scriptPath = configuration.getScriptPath();
String scriptParameters = configuration.getScriptParameters();
String scriptOptions = configuration.getScriptOptions();
boolean showAppleEvents = configuration.isShowAppleEvents();
if (!StringUtil.isEmpty(scriptPath)) {
scriptTextField.setText(scriptPath);
String[] parts = scriptPath.split("/");
if (parts.length > 0) {
runConfiguration.setName(parts[parts.length - 1]);
}
}
if (!StringUtil.isEmpty(scriptParameters)) {
parametersTextField.setText(scriptParameters);
}
if (!StringUtil.isEmpty(scriptOptions)) {
scriptOptionsTextField.setText(scriptOptions);
}
showAppleEventsCheckBox.setSelected(showAppleEvents);
}
示例12: processIncludes
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private static void processIncludes(@NotNull ApplicationDictionary parsedDictionary, @Nullable XmlTag[] includes) {
if (includes == null) return;
for (XmlTag include : includes) {
String hrefIncl = include.getAttributeValue("href");
if (!StringUtil.isEmpty(hrefIncl)) {
hrefIncl = hrefIncl.replace("file://localhost", "");
File includedFile = new File(hrefIncl);
// ((IncludedXmlTag) suiteTag).getOriginal().getContainingFile();
//as there is assertion error (java.lang.AssertionError: File accessed outside allowed roots),
// we are trying to find if the dictionary file for this included dictionary was already generated
AppleScriptSystemDictionaryRegistryService dictionarySystemRegistry = ServiceManager
.getService(AppleScriptSystemDictionaryRegistryService.class);
VirtualFile vFile;
File ioFile = null;
DictionaryInfo dInfo = dictionarySystemRegistry.getDictionaryInfoByApplicationPath(includedFile.getPath());
if (dInfo != null) {
ioFile = dInfo.getDictionaryFile();
} else if (includedFile.isFile()) {
String fName = includedFile.getName();
int index = fName.lastIndexOf('.');
fName = index < 0 ? fName : fName.substring(0, index);
ioFile = dictionarySystemRegistry.getDictionaryFile(fName);
}
if (ioFile == null || !ioFile.exists()) ioFile = includedFile;
if (ioFile.exists()) {
vFile = LocalFileSystem.getInstance().findFileByIoFile(ioFile);
if (vFile == null || !vFile.isValid()) continue;
PsiFile psiFile = PsiManager.getInstance(parsedDictionary.getProject()).findFile(vFile);
XmlFile xmlFile = (XmlFile) psiFile;
if (xmlFile != null) {
parsedDictionary.processInclude(xmlFile);
}
}
}
}
}
示例13: parseClassTag
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private static AppleScriptClass parseClassTag(XmlTag classTag, Suite suite) {
String name = classTag.getAttributeValue("name");
String code = classTag.getAttributeValue("code");
String pluralName = classTag.getAttributeValue("plural");
if (name == null || code == null) return null;
String parentClassName = classTag.getAttributeValue("inherits");
List<String> elementNames = initClassElements(classTag);
List<String> respondingCommands = initClassRespondingMessages(classTag);
final AppleScriptClass aClass = new DictionaryClass(suite, name, code, classTag, parentClassName, elementNames,
respondingCommands, pluralName);
String description = classTag.getAttributeValue("description");
aClass.setDescription(description);
XmlTag[] propertyTags = classTag.findSubTags("property");
final List<AppleScriptPropertyDefinition> properties = new ArrayList<>();
for (XmlTag propTag : propertyTags) {
String pName = propTag.getAttributeValue("name");
String pCode = propTag.getAttributeValue("code");
String pDescription = propTag.getAttributeValue("description");
String pType = propTag.getAttributeValue("type");
if (StringUtil.isEmpty(pType)) {
XmlTag tType = propTag.findFirstSubTag("type");
pType = tType != null ? tType.getAttributeValue("type") : null;
}
String pAccessType = propTag.getAttributeValue("access");
AccessType accessType = "r".equals(pAccessType) ? AccessType.R : AccessType.RW;
if (pName != null && pCode != null && pType != null) {
final AppleScriptPropertyDefinition property = new DictionaryPropertyImpl(aClass, pName, pCode, pType,
pDescription, propTag, accessType);
properties.add(property);
}
}
aClass.setProperties(properties);
return aClass;
}
示例14: Validate
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
private void Validate(String token, String botName, String iconUrl
, String maxCommitsToDisplay, String showBuildAgent, String proxyHost, String proxyPort, String proxyUser, String proxyPassword) throws MsTeamsConfigValidationException {
if(token == null || StringUtil.isEmpty(token)
|| botName == null || StringUtil.isEmpty(botName)
|| iconUrl == null || StringUtil.isEmpty(iconUrl)
|| (showBuildAgent.toLowerCase() == "false" && (maxCommitsToDisplay == null || StringUtil.isEmpty(maxCommitsToDisplay)))
|| tryParseInt(maxCommitsToDisplay) == null
|| (!isNullOrEmpty(proxyHost) && isNullOrEmpty(proxyPort))
|| (!isNullOrEmpty(proxyUser) && isNullOrEmpty(proxyPassword))
|| (!isNullOrEmpty(proxyPort) && tryParseInt(proxyPort) == null)
){
throw new MsTeamsConfigValidationException("Could not validate parameters. Please recheck the request.");
}
}
示例15: openLoadDirectoryDialog
import com.intellij.openapi.util.text.StringUtil; //导入方法依赖的package包/类
public static void openLoadDirectoryDialog(@NotNull final Project project, @Nullable VirtualFile directoryFile, @Nullable final String appName) {
final boolean chooseMultiple = StringUtil.isEmpty(appName);
FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, chooseMultiple);
FileChooser.chooseFiles(descriptor, project, directoryFile, files -> {
AppleScriptProjectDictionaryService projectDictionaryRegistry = ServiceManager.getService(project, AppleScriptProjectDictionaryService
.class);
if (projectDictionaryRegistry == null) return;
for (VirtualFile file : files) {
if (!ApplicationDictionaryImpl.extensionSupported(file.getExtension())) continue;
if (chooseMultiple) {
String applicationName;
if (ApplicationDictionary.SUPPORTED_APPLICATION_EXTENSIONS.contains(file.getExtension())) {
applicationName = file.getNameWithoutExtension();
} else {
applicationName = Messages.showInputDialog(project, "Please specify application name for dictionary "
+ file.getName(), "Enter Application Name", null, file.getNameWithoutExtension(), null);
}
if (StringUtil.isEmpty(applicationName)) continue;
projectDictionaryRegistry.createDictionaryFromFile(applicationName, file);
} else {
projectDictionaryRegistry.createDictionaryFromFile(appName, file);
return;
}
}
});
}