本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.isEmpty方法的具体用法?Java ContainerUtil.isEmpty怎么用?Java ContainerUtil.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtil
的用法示例。
在下文中一共展示了ContainerUtil.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTemplates
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ProjectTemplate[] createTemplates(@Nullable String group, WizardContext context) {
// myGroups contains only not-null keys
if (group == null) {
return ProjectTemplate.EMPTY_ARRAY;
}
List<ProjectTemplate> templates = null;
for (Pair<URL, ClassLoader> url : myGroups.getValue().get(group)) {
try {
for (String child : UrlUtil.getChildrenRelativePaths(url.first)) {
if (child.endsWith(ZIP)) {
if (templates == null) {
templates = new SmartList<ProjectTemplate>();
}
templates.add(new LocalArchivedTemplate(new URL(url.first.toExternalForm() + '/' + child), url.second));
}
}
}
catch (IOException e) {
LOG.error(e);
}
}
return ContainerUtil.isEmpty(templates) ? ProjectTemplate.EMPTY_ARRAY : templates.toArray(new ProjectTemplate[templates.size()]);
}
示例2: revert
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void revert(@NotNull Collection<File> paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
if (!ContainerUtil.isEmpty(paths)) {
Command command = newCommand(SvnCommandName.revert);
command.put(depth);
command.setTargets(paths);
// TODO: handler should be called in parallel with command execution, but this will be in other thread
// TODO: check if that is ok for current handler implementation
// TODO: add possibility to invoke "handler.checkCancelled" - process should be killed
SvnTarget target = SvnTarget.fromFile(ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(paths)));
CommandExecutor executor = execute(myVcs, target, CommandUtil.getHomeDirectory(), command, null);
FileStatusResultParser parser = new FileStatusResultParser(CHANGED_PATH, handler, new RevertStatusConvertor());
parser.parse(executor.getOutput());
}
}
示例3: getText
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public String getText() {
List<String> data = new ArrayList<String>();
if (myConfigDir != null) {
data.add("--config-dir");
data.add(myConfigDir.getPath());
}
data.add(myName.getName());
data.addAll(myOriginalParameters);
List<String> targetsPaths = getTargetsPaths();
if (!ContainerUtil.isEmpty(targetsPaths)) {
data.addAll(targetsPaths);
}
return StringUtil.join(data, " ");
}
示例4: getChosenFiles
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static List<VirtualFile> getChosenFiles(final List<String> paths) {
if (ContainerUtil.isEmpty(paths)) {
return Collections.emptyList();
}
final LocalFileSystem fs = LocalFileSystem.getInstance();
final List<VirtualFile> files = ContainerUtil.newArrayListWithCapacity(paths.size());
for (String path : paths) {
final String vfsPath = FileUtil.toSystemIndependentName(path);
final VirtualFile file = fs.refreshAndFindFileByPath(vfsPath);
if (file != null && file.isValid()) {
files.add(file);
}
}
return files;
}
示例5: throwIfNotEmpty
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static void throwIfNotEmpty(@Nullable List<Throwable> throwables) {
if (ContainerUtil.isEmpty(throwables)) {
return;
}
if (throwables.size() == 1) {
Throwable throwable = throwables.get(0);
if (throwable instanceof Error) {
throw (Error)throwable;
}
else if (throwable instanceof RuntimeException) {
throw (RuntimeException)throwable;
}
else {
throw new RuntimeException(throwable);
}
}
else {
throw new CompoundRuntimeException(throwables);
}
}
示例6: setSession
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void setSession(@NotNull XDebugSessionImpl session, @Nullable ExecutionEnvironment environment, @Nullable Icon icon) {
myEnvironment = environment;
mySession = session;
mySessionData = session.getSessionData();
myConsole = session.getConsoleView();
AnAction[] restartActions;
List<AnAction> restartActionsList = session.getRestartActions();
if (ContainerUtil.isEmpty(restartActionsList)) {
restartActions = AnAction.EMPTY_ARRAY;
}
else {
restartActions = restartActionsList.toArray(new AnAction[restartActionsList.size()]);
}
myRunContentDescriptor = new RunContentDescriptor(myConsole, session.getDebugProcess().getProcessHandler(),
myUi.getComponent(), session.getSessionName(), icon, myRebuildWatchesRunnable, restartActions);
Disposer.register(myRunContentDescriptor, this);
Disposer.register(myProject, myRunContentDescriptor);
}
示例7: readFilters
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static ClassFilter[] readFilters(List<Element> children) throws InvalidDataException {
if (ContainerUtil.isEmpty(children)) {
return ClassFilter.EMPTY_ARRAY;
}
ClassFilter[] filters = new ClassFilter[children.size()];
for (int i = 0, size = children.size(); i < size; i++) {
filters[i] = create(children.get(i));
}
return filters;
}
示例8: getSourceContent
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
public String getSourceContent(@NotNull MappingEntry entry) {
if (ContainerUtil.isEmpty(sourceContents)) {
return null;
}
int index = entry.getSource();
return index < 0 || index >= sourceContents.size() ? null : sourceContents.get(index);
}
示例9: select
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public List<Proxy> select(@Nullable URI uri) {
isInstalledAssertion();
if (uri == null) {
return NO_PROXY_LIST;
}
LOG.debug("CommonProxy.select called for " + uri.toString());
if (Boolean.TRUE.equals(ourReenterDefence.get())) {
return NO_PROXY_LIST;
}
try {
ourReenterDefence.set(Boolean.TRUE);
String host = StringUtil.notNullize(uri.getHost());
if (NetUtils.isLocalhost(host)) {
return NO_PROXY_LIST;
}
final HostInfo info = new HostInfo(uri.getScheme(), host, correctPortByProtocol(uri));
final Map<String, ProxySelector> copy;
synchronized (myLock) {
if (myNoProxy.contains(Pair.create(info, Thread.currentThread()))) {
LOG.debug("CommonProxy.select returns no proxy (in no proxy list) for " + uri.toString());
return NO_PROXY_LIST;
}
copy = new THashMap<String, ProxySelector>(myCustom);
}
for (Map.Entry<String, ProxySelector> entry : copy.entrySet()) {
final List<Proxy> proxies = entry.getValue().select(uri);
if (!ContainerUtil.isEmpty(proxies)) {
LOG.debug("CommonProxy.select returns custom proxy for " + uri.toString() + ", " + proxies.toString());
return proxies;
}
}
return NO_PROXY_LIST;
}
finally {
ourReenterDefence.remove();
}
}
示例10: getBooleanParameter
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
protected static boolean getBooleanParameter(@NotNull String name, @NotNull QueryStringDecoder urlDecoder, boolean defaultValue) {
List<String> values = urlDecoder.parameters().get(name);
if (ContainerUtil.isEmpty(values)) {
return defaultValue;
}
String value = values.get(values.size() - 1);
// if just name specified, so, true
return value.isEmpty() || Boolean.parseBoolean(value);
}
示例11: mergeLocalSettings
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private void mergeLocalSettings() {
for (ExternalSystemManager<?, ?, ?, ?, ?> manager : ExternalSystemApiUtil.getAllManagers()) {
final ProjectSystemId systemId = manager.getSystemId();
AbstractExternalSystemLocalSettings settings = manager.getLocalSettingsProvider().fun(myProject);
final Map<ExternalProjectPojo, Collection<ExternalProjectPojo>> availableProjects = settings.getAvailableProjects();
final Map<String, Collection<ExternalTaskPojo>> availableTasks = settings.getAvailableTasks();
for (Map.Entry<ExternalProjectPojo, Collection<ExternalProjectPojo>> entry : availableProjects.entrySet()) {
final ExternalProjectPojo projectPojo = entry.getKey();
final String externalProjectPath = projectPojo.getPath();
final Pair<ProjectSystemId, File> key = Pair.create(systemId, new File(externalProjectPath));
InternalExternalProjectInfo externalProjectInfo = myExternalRootProjects.get(key);
if (externalProjectInfo == null) {
final DataNode<ProjectData> dataNode = convert(systemId, projectPojo, entry.getValue(), availableTasks);
externalProjectInfo = new InternalExternalProjectInfo(systemId, externalProjectPath, dataNode);
myExternalRootProjects.put(key, externalProjectInfo);
changed.set(true);
}
// restore linked project sub-modules
ExternalProjectSettings linkedProjectSettings =
manager.getSettingsProvider().fun(myProject).getLinkedProjectSettings(externalProjectPath);
if (linkedProjectSettings != null && ContainerUtil.isEmpty(linkedProjectSettings.getModules())) {
final Set<String> modulePaths = ContainerUtil.map2Set(
ExternalSystemApiUtil.findAllRecursively(externalProjectInfo.getExternalProjectStructure(), ProjectKeys.MODULE),
new Function<DataNode<ModuleData>, String>() {
@Override
public String fun(DataNode<ModuleData> node) {
return node.getData().getLinkedExternalProjectPath();
}
});
linkedProjectSettings.setModules(modulePaths);
}
}
}
}
示例12: findChild
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public VirtualFile findChild(@NotNull @NonNls String name) {
if (!ContainerUtil.isEmpty(myChildren)) {
for (VirtualFile child : myChildren) {
if (StringUtil.equals(child.getNameSequence(), name)) {
return child;
}
}
}
return null;
}
示例13: isAvailable
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
if (ContainerUtil.isEmpty(getAvailableLanguages(project))) {
return false;
}
setText(getFamilyName());
return element.isValid();
}
示例14: run
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public void run() {
final FilePresentation filePresentation = myRecentPathFileChange.get();
if ((filePresentation == null) || (filePresentation.getVf() == null)) {
ApplicationManager.getApplication().invokeLater(myReset);
return;
}
final VirtualFile file = filePresentation.getVf();
final PatchReader patchReader = loadPatches(filePresentation);
if (patchReader == null) return;
List<FilePatch> filePatches = ContainerUtil.<FilePatch>newArrayList(patchReader.getPatches());
if (!ContainerUtil.isEmpty(myBinaryShelvedPatches)) {
filePatches.addAll(myBinaryShelvedPatches);
}
final List<AbstractFilePatchInProgress> matchedPatches = new MatchPatchPaths(myProject).execute(filePatches);
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
myChangeListChooser.setDefaultName(file.getNameWithoutExtension().replace('_', ' ').trim());
myPatches.clear();
myPatches.addAll(matchedPatches);
myReader = patchReader;
updateTree(true);
paintBusy(false);
}
});
}
示例15: getData
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public Object getData(DataProvider dataProvider) {
List<VcsRevisionNumber> revisionNumbers = getRevisionNumbers(dataProvider);
return !ContainerUtil.isEmpty(revisionNumbers) ? ArrayUtil.toObjectArray(revisionNumbers, VcsRevisionNumber.class) : null;
}