当前位置: 首页>>代码示例>>Java>>正文


Java ObjectUtils.notNull方法代码示例

本文整理汇总了Java中com.intellij.util.ObjectUtils.notNull方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectUtils.notNull方法的具体用法?Java ObjectUtils.notNull怎么用?Java ObjectUtils.notNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.ObjectUtils的用法示例。


在下文中一共展示了ObjectUtils.notNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@Override
protected void actionPerformed(@NotNull final Project project, @NotNull final Map<GitRepository, VcsFullCommitDetails> commits) {
  GitVcsSettings settings = GitVcsSettings.getInstance(project);
  GitResetMode defaultMode = ObjectUtils.notNull(settings.getResetMode(), GitResetMode.getDefault());
  GitNewResetDialog dialog = new GitNewResetDialog(project, commits, defaultMode);
  if (dialog.showAndGet()) {
    final GitResetMode selectedMode = dialog.getResetMode();
    settings.setResetMode(selectedMode);
    new Task.Backgroundable(project, "Git reset", true) {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        new GitResetOperation(project, commits, selectedMode, indicator).execute();
      }
    }.queue();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GitResetAction.java

示例2: openTipInBrowser

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
public static void openTipInBrowser(@Nullable TipAndTrickBean tip, JEditorPane browser) {
  if (tip == null) return;
  try {
    PluginDescriptor pluginDescriptor = tip.getPluginDescriptor();
    ClassLoader tipLoader = pluginDescriptor == null ? TipUIUtil.class.getClassLoader() :
                            ObjectUtils.notNull(pluginDescriptor.getPluginClassLoader(), TipUIUtil.class.getClassLoader());

    URL url = ResourceUtil.getResource(tipLoader, "/tips/", tip.fileName);

    if (url == null) {
      setCantReadText(browser, tip);
      return;
    }

    StringBuffer text = new StringBuffer(ResourceUtil.loadText(url));
    updateShortcuts(text);
    updateImages(text, tipLoader);
    String replaced = text.toString().replace("&productName;", ApplicationNamesInfo.getInstance().getFullProductName());
    String major = ApplicationInfo.getInstance().getMajorVersion();
    replaced = replaced.replace("&majorVersion;", major);
    String minor = ApplicationInfo.getInstance().getMinorVersion();
    replaced = replaced.replace("&minorVersion;", minor);
    replaced = replaced.replace("&majorMinorVersion;", major + ("0".equals(minor) ? "" : ("." + minor)));
    replaced = replaced.replace("&settingsPath;", CommonBundle.settingsActionPath());
    replaced = replaced.replaceFirst("<link rel=\"stylesheet\".*tips\\.css\">", ""); // don't reload the styles
    if (browser.getUI() == null) {
      browser.updateUI();
      boolean succeed = browser.getUI() != null;
      String message = "reinit JEditorPane.ui: " + (succeed ? "OK" : "FAIL") +
                       ", laf=" + LafManager.getInstance().getCurrentLookAndFeel();
      if (succeed) LOG.warn(message);
      else LOG.error(message);
    }
    adjustFontSize(((HTMLEditorKit)browser.getEditorKit()).getStyleSheet());
    browser.read(new StringReader(replaced), url);
  }
  catch (IOException e) {
    setCantReadText(browser, tip);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:TipUIUtil.java

示例3: requeueIfPossible

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
public static void requeueIfPossible(InferenceCapable element) {
    final Boolean userData = ObjectUtils.notNull(element.getContainingFile().getUserData(PsiFileEx.BATCH_REFERENCE_PROCESSING), false);
    if (!userData && !PsiTreeUtil.hasErrorElements(element)) {
        final Project project = element.getProject();
        if (project != null)
            LuaPsiManager.getInstance(project).queueInferences(element);
    }
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:9,代码来源:InferenceUtil.java

示例4: findOrCreateRemoteBranch

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@NotNull
public static GitRemoteBranch findOrCreateRemoteBranch(@NotNull GitRepository repository,
                                                       @NotNull GitRemote remote,
                                                       @NotNull String branchName) {
  GitRemoteBranch remoteBranch = findRemoteBranch(repository, remote, branchName);
  return ObjectUtils.notNull(remoteBranch, new GitStandardRemoteBranch(remote, branchName, GitBranch.DUMMY_HASH));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GitUtil.java

示例5: tuple

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@Nullable("null means no luck, otherwise it's tuple(guessed encoding, hint about content if was unable to guess, BOM)")
public static Trinity<Charset, CharsetToolkit.GuessedEncoding, byte[]> guessFromContent(@NotNull VirtualFile virtualFile, @NotNull byte[] content, int length) {
  Charset defaultCharset = ObjectUtils.notNull(EncodingManager.getInstance().getEncoding(virtualFile, true), CharsetToolkit.getDefaultSystemCharset());
  CharsetToolkit toolkit = GUESS_UTF ? new CharsetToolkit(content, defaultCharset) : null;
  String detectedFromBytes = null;
  try {
    if (GUESS_UTF) {
      toolkit.setEnforce8Bit(true);
      Charset charset = toolkit.guessFromBOM();
      if (charset != null) {
        detectedFromBytes = AUTO_DETECTED_FROM_BOM;
        byte[] bom = ObjectUtils.notNull(CharsetToolkit.getMandatoryBom(charset), CharsetToolkit.UTF8_BOM);
        return Trinity.create(charset, null, bom);
      }
      CharsetToolkit.GuessedEncoding guessed = toolkit.guessFromContent(length);
      if (guessed == CharsetToolkit.GuessedEncoding.VALID_UTF8) {
        detectedFromBytes = "auto-detected from bytes";
        return Trinity.create(CharsetToolkit.UTF8_CHARSET, guessed, null); //UTF detected, ignore all directives
      }
      if (guessed == CharsetToolkit.GuessedEncoding.SEVEN_BIT) {
        return Trinity.create(null, guessed, null);
      }
    }
    return null;
  }
  finally {
    setCharsetWasDetectedFromBytes(virtualFile, detectedFromBytes);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:LoadTextUtil.java

示例6: GitPushOperation

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
public GitPushOperation(@NotNull Project project,
                        @NotNull GitPushSupport pushSupport,
                        @NotNull Map<GitRepository, PushSpec<GitPushSource, GitPushTarget>> pushSpecs,
                        @Nullable GitPushTagMode tagMode,
                        boolean force) {
  myProject = project;
  myPushSupport = pushSupport;
  myPushSpecs = pushSpecs;
  myTagMode = tagMode;
  myForce = force;
  myGit = ServiceManager.getService(Git.class);
  myProgressIndicator = ObjectUtils.notNull(ProgressManager.getInstance().getProgressIndicator(), new EmptyProgressIndicator());
  mySettings = GitVcsSettings.getInstance(myProject);
  myPlatformFacade = ServiceManager.getService(project, GitPlatformFacade.class);
  myRepositoryManager = ServiceManager.getService(myProject, GitRepositoryManager.class);

  Map<GitRepository, GitRevisionNumber> currentHeads = ContainerUtil.newHashMap();
  for (GitRepository repository : pushSpecs.keySet()) {
    repository.update();
    String head = repository.getCurrentRevision();
    if (head == null) {
      LOG.error("This repository has no commits");
    }
    else {
      currentHeads.put(repository, new GitRevisionNumber(head));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GitPushOperation.java

示例7: paint

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
public void paint(Graphics g, JComponent current) {
  if (myPainters.isEmpty()) return;
  Graphics2D g2d = (Graphics2D)g;
  Rectangle clip = ObjectUtils.notNull(g.getClipBounds(), current.getBounds());

  Component component = null;
  Rectangle componentBounds = null;
  boolean clipMatched = false;
  for (Painter painter : myPainters) {
    if (!painter.needsRepaint()) continue;

    Component cur = myPainter2Component.get(painter);
    if (cur != component || componentBounds == null) {
      Container parent = (component = cur).getParent();
      if (parent == null) continue;
      componentBounds = SwingUtilities.convertRectangle(parent, component.getBounds(), current);
      clipMatched = clip.contains(componentBounds) || clip.intersects(componentBounds);
    }
    if (!clipMatched) continue;

    Point targetPoint = SwingUtilities.convertPoint(current, 0, 0, component);
    Rectangle targetRect = new Rectangle(targetPoint, component.getSize());
    g2d.setClip(clip.intersection(componentBounds));
    g2d.translate(-targetRect.x, -targetRect.y);
    painter.paint(component, g2d);
    g2d.translate(targetRect.x, targetRect.y);
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:PaintersHelper.java

示例8: expand

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
public static void expand(@NotNull String key, @NotNull CustomTemplateCallback callback,
                          @NotNull ZenCodingGenerator defaultGenerator,
                          @NotNull Collection<? extends ZenCodingFilter> extraFilters,
                          boolean expandPrimitiveAbbreviations, int segmentsLimit) throws EmmetException {
  final ZenCodingNode node = parse(key, callback, defaultGenerator, null);
  if (node == null) {
    return;
  }
  if (node instanceof TemplateNode) {
    if (key.equals(((TemplateNode)node).getTemplateToken().getKey()) && callback.findApplicableTemplates(key).size() > 1) {
      TemplateManagerImpl templateManager = (TemplateManagerImpl)callback.getTemplateManager();
      Map<TemplateImpl, String> template2Argument = templateManager.findMatchingTemplates(callback.getFile(), callback.getEditor(), null, TemplateSettings.getInstance());
      Runnable runnable = templateManager.startNonCustomTemplates(template2Argument, callback.getEditor(), null);
      if (runnable != null) {
        runnable.run();
      }
      return;
    }
  }

  PsiElement context = callback.getContext();
  ZenCodingGenerator generator = ObjectUtils.notNull(findApplicableGenerator(node, context, false), defaultGenerator);
  List<ZenCodingFilter> filters = getFilters(node, context);
  filters.addAll(extraFilters);

  checkTemplateOutputLength(node, callback);
  
  callback.deleteTemplateKey(key);
  expand(node, generator, filters, null, callback, expandPrimitiveAbbreviations, segmentsLimit);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ZenCodingTemplate.java

示例9: check

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@NotNull
public ListMergeStatus check(@NotNull CommittedChangeList list, @NotNull MergeInfoCached state, boolean isCached) {
  SvnMergeInfoCache.MergeCheckResult mergeCheckResult = state.getMap().get(list.getNumber());
  ListMergeStatus result = state.copiedAfter(list) ? ListMergeStatus.COMMON : ListMergeStatus.from(mergeCheckResult);

  return ObjectUtils.notNull(result, isCached ? ListMergeStatus.REFRESHING : ListMergeStatus.ALIEN);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MergeInfoHolder.java

示例10: collectAllOriginalElements

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
/**
 * Collect original elements from all filters.
 */
@NotNull
private static List<? extends PsiElement> collectAllOriginalElements(@NotNull PsiElement element) {
  List<PsiElement> result = null;
  for (GeneratedSourcesFilter filter : GeneratedSourcesFilter.EP_NAME.getExtensions()) {
    result = addAll(filter.getOriginalElements(element), result);
  }
  return ObjectUtils.notNull(result, Collections.<PsiElement>emptyList());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:EditSourceUtil.java

示例11: extractCharsetFromFileContent

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@NotNull
public static Charset extractCharsetFromFileContent(@Nullable Project project, @NotNull VirtualFile virtualFile, @NotNull CharSequence text) {
  return ObjectUtils.notNull(charsetFromContentOrNull(project, virtualFile, text), virtualFile.getCharset());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LoadTextUtil.java

示例12: getHelpTopic

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@Override
public String getHelpTopic() {
  return ObjectUtils.notNull(super.getHelpTopic(), "reference.settings.clouds");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoteServerListConfigurable.java

示例13: getColor

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@NotNull
public Color getColor() {
  return ObjectUtils.notNull(getColorInner(), JBColor.GRAY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:HighlightDisplayLevel.java

示例14: getUpdateType

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@NotNull
public UpdateMethod getUpdateType() {
  return ObjectUtils.notNull(myState.UPDATE_TYPE, UpdateMethod.BRANCH_DEFAULT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GitVcsSettings.java

示例15: restoreLRUItems

import com.intellij.util.ObjectUtils; //导入方法依赖的package包/类
@NotNull
private String[] restoreLRUItems() {
  return ObjectUtils.notNull(myPropertiesComponent.getValues(getLRUKey()), ArrayUtil.EMPTY_STRING_ARRAY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LRUPopupBuilder.java


注:本文中的com.intellij.util.ObjectUtils.notNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。