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


Java Key类代码示例

本文整理汇总了Java中com.intellij.openapi.util.Key的典型用法代码示例。如果您正苦于以下问题:Java Key类的具体用法?Java Key怎么用?Java Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: printMessageToConsole

import com.intellij.openapi.util.Key; //导入依赖的package包/类
/**
 * Prints the message to console
 */
private void printMessageToConsole(String line) {
    final ConsoleView console = getConsole();
    final LogFilterModel.MyProcessingResult processingResult = myLogFilterModel.processLine(line);
    if (processingResult.isApplicable()) {
        final Key key = processingResult.getKey();
        if (key != null) {
            ConsoleViewContentType type = ConsoleViewContentType.getConsoleViewType(key);
            if (type != null) {
                final String messagePrefix = processingResult.getMessagePrefix();
                if (messagePrefix != null) {
                    String formattedPrefix = logFormatter.formatPrefix(messagePrefix);
                    if (console != null) {
                        console.print(formattedPrefix, type);
                    }
                }
                String formattedMessage = logFormatter.formatMessage(line);
                if (console != null) {
                    console.print(formattedMessage + "\n", type);
                }
            }
        }
    }
}
 
开发者ID:josesamuel,项目名称:logviewer,代码行数:27,代码来源:LogView.java

示例2: onTextAvailable

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
  if (!myAuthData.isOAuth2() && !myPasswordEntered && !outputType.equals(ProcessOutputTypes.SYSTEM) && event.getText().contains(myAuthData.getEmail())) {
    myPasswordEntered = true;
    final OutputStream processInput = myProcessHandler.getProcessInput();
    if (processInput != null) {
      //noinspection IOResourceOpenedButNotSafelyClosed
      final PrintWriter input = new PrintWriter(processInput);
      input.println(myAuthData.getPassword());
      input.flush();
      String message = StringUtil.repeatSymbol('*', myAuthData.getPassword().length()) + "\n";
      if (myConsole != null) {
        myConsole.print(message, ConsoleViewContentType.USER_INPUT);
      }
      else if (myLoggingHandler != null) {
        myLoggingHandler.print(message);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AppEngineUploader.java

示例3: getCachedValue

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@Nullable
private static <T> T getCachedValue(PsiExpression expression, Key<T> key) {
  final T data = expression.getUserData(key);
  if (!(expression instanceof PsiBinaryExpression)) {
    return data;
  }
  final PsiBinaryExpression binaryExpression =
    (PsiBinaryExpression)expression;
  final PsiExpression lhs = binaryExpression.getLOperand();
  T childData = null;
  if (lhs instanceof PsiBinaryExpression) {
    childData = lhs.getUserData(key);
  }
  if (childData == null) {
    final PsiExpression rhs = binaryExpression.getROperand();
    if (rhs instanceof PsiBinaryExpression) {
      childData = rhs.getUserData(key);
    }
  }
  if (childData != data) {
    expression.putUserData(key, childData);
  }
  return childData;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:NonNlsUtils.java

示例4: findData

import com.intellij.openapi.util.Key; //导入依赖的package包/类
/**
 * Search for data in dataholder or members of union recursively
 * @param type start point
 * @param key key to search
 * @param <T> result tyoe
 * @return data or null if not found
 */
@Nullable
public static <T> T findData(@NotNull final PyType type, @NotNull final Key<T> key) {
  if (type instanceof UserDataHolder) {
    return ((UserDataHolder)type).getUserData(key);
  }
  if (type instanceof PyUnionType) {
    for (final PyType memberType : ((PyUnionType)type).getMembers()) {
      if (memberType == null) {
        continue;
      }
      final T result = findData(memberType, key);
      if (result != null) {
        return result;
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PyTypeUtil.java

示例5: getHolderForClass

import com.intellij.openapi.util.Key; //导入依赖的package包/类
public static GdkMethodHolder getHolderForClass(final PsiClass categoryClass, final boolean isStatic, final GlobalSearchScope scope) {
  final Project project = categoryClass.getProject();
  Key<CachedValue<GdkMethodHolder>> key = isStatic ? CACHED_STATIC : CACHED_NON_STATIC;
  return CachedValuesManager.getManager(project).getCachedValue(categoryClass, key, new CachedValueProvider<GdkMethodHolder>() {
    @Override
    public Result<GdkMethodHolder> compute() {
      GdkMethodHolder result = new GdkMethodHolder(categoryClass, isStatic, scope);

      final ProjectRootManager rootManager = ProjectRootManager.getInstance(project);
      final VirtualFile vfile = categoryClass.getContainingFile().getVirtualFile();
      if (vfile != null && (rootManager.getFileIndex().isInLibraryClasses(vfile) || rootManager.getFileIndex().isInLibrarySource(vfile))) {
        return Result.create(result, rootManager);
      }

      return Result.create(result, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, rootManager);
    }
  }, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GdkMethodHolder.java

示例6: getEmbedder

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@NotNull
public synchronized MavenEmbedderWrapper getEmbedder(Key kind) {
  MavenEmbedderWrapper result = myPool.get(kind);
  boolean alwaysOnline = kind == FOR_DOWNLOAD;

  if (result == null) {
    result = MavenServerManager.getInstance().createEmbedder(myProject, alwaysOnline);
    myPool.put(kind, result);
  }

  if (myEmbeddersInUse.contains(result)) {
    MavenLog.LOG.warn("embedder " + kind + " is already used");
    return MavenServerManager.getInstance().createEmbedder(myProject, alwaysOnline);
  }

  myEmbeddersInUse.add(result);
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenEmbeddersManager.java

示例7: createGdkMethod

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@NotNull
public static GrGdkMethod createGdkMethod(@NotNull final PsiMethod original,
                                          final boolean isStatic,
                                          @Nullable final String originInfo) {
  final Key<CachedValue<GrGdkMethodImpl>> cachedValueKey = isStatic ? CACHED_STATIC : CACHED_NON_STATIC;
  CachedValue<GrGdkMethodImpl> cachedValue = original.getUserData(cachedValueKey);
  if (cachedValue == null) {
    cachedValue = CachedValuesManager.getManager(original.getProject()).createCachedValue(new CachedValueProvider<GrGdkMethodImpl>() {
      @Override
      public Result<GrGdkMethodImpl> compute() {
        return Result.create(new GrGdkMethodImpl(original, isStatic, originInfo),
                             PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
      }
    });
    original.putUserData(cachedValueKey, cachedValue);
  }

  return cachedValue.getValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GrGdkMethodImpl.java

示例8: minus

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@NotNull
@Override
public KeyFMap minus(@NotNull Key<?> key) {
  int oldSize = size();
  int keyCode = key.hashCode();
  if (!containsKey(keyCode)) {
    return this;
  }
  if (oldSize == ArrayBackedFMap.ARRAY_THRESHOLD + 1) {
    int[] keys = keys();
    Object[] values = getValues();
    int i = ArrayUtil.indexOf(keys, keyCode);
    keys = ArrayUtil.remove(keys, i);
    values = ArrayUtil.remove(values, i);
    return new ArrayBackedFMap(keys, values);
  }
  return new MapBackedFMap(this, keyCode);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MapBackedFMap.java

示例9: onLineAvailable

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@Override
public void onLineAvailable(String line, Key outputType) {
  if (ProcessOutputTypes.STDOUT.equals(outputType)) {
    final ProgressEvent event = converter.convert(line);
    if (event != null) {
      beforeHandler(event);
      try {
        callHandler(event);
      }
      catch (SVNException e) {
        cancel();
        exception.set(e);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BaseUpdateCommandListener.java

示例10: notifyLine

import com.intellij.openapi.util.Key; //导入依赖的package包/类
/**
 * Notify single line
 *
 * @param line       a line to notify
 * @param outputType output type
 */
private void notifyLine(final String line, final Key outputType) {
  String trimmed = LineHandlerHelper.trimLineSeparator(line);
  // if line ends with return, then it is a progress line, ignore it
  if (myVcs != null && !"\r".equals(line.substring(trimmed.length()))) {
    if (outputType == ProcessOutputTypes.STDOUT) {
      if (!isStdoutSuppressed() && !mySilent && !StringUtil.isEmptyOrSpaces(line)) {
        myVcs.showMessages(trimmed);
        LOG.info(line.trim());
      }
      else {
        OUTPUT_LOG.debug(line.trim());
      }
    }
    else if (outputType == ProcessOutputTypes.STDERR && !isStderrSuppressed() && !mySilent && !StringUtil.isEmptyOrSpaces(line)) {
      myVcs.showErrorMessages(trimmed);
      LOG.info(line.trim());
    }
    else {
      LOG.debug(line.trim());
    }
  }
  myLineListeners.getMulticaster().onLineAvailable(trimmed, outputType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:GitLineHandler.java

示例11: getProcessOutputType

import com.intellij.openapi.util.Key; //导入依赖的package包/类
private static Key getProcessOutputType(@NotNull Log.LogLevel level) {
  switch (level) {
    case VERBOSE:
      return AndroidLogcatConstants.VERBOSE;
    case INFO:
      return AndroidLogcatConstants.INFO;
    case DEBUG:
      return AndroidLogcatConstants.DEBUG;
    case WARN:
      return AndroidLogcatConstants.WARNING;
    case ERROR:
      return AndroidLogcatConstants.ERROR;
    case ASSERT:
      return AndroidLogcatConstants.ASSERT;
  }
  return ProcessOutputTypes.STDOUT;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AndroidLogFilterModel.java

示例12: getCopyableUserData

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@Override
@Nullable
@Contract(
        pure = true
)
public <T> T getCopyableUserData(Key<T> key) {
    return xmlTag.getCopyableUserData(key);
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:9,代码来源:LineMarkerXmlTagDecorator.java

示例13: processLine

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@NotNull
@Override
public MyProcessingResult processLine(String line) {
    LogCatMessage message = null;
    String continuation = null;
    boolean validContinuation = false;
    try {
        message = AndroidLogcatFormatter.tryParseMessage(line);
        continuation = message == null ? AndroidLogcatFormatter.tryParseContinuation(line) : null;
        validContinuation = continuation != null && this.myPrevHeader != null;
    } catch (Exception ignored) {
    }

    if (message == null && !validContinuation) {
        return new MyProcessingResult(ProcessOutputTypes.STDOUT, canAcceptMessage(line), null);
    } else {
        if (message != null) {
            this.myPrevHeader = message.getHeader();
            this.myCustomApplicable = this.isMessageApplicable(message);
            this.myMessageSoFar.setLength(0);
        }

        boolean isApplicable = this.myCustomApplicable;
        if (!isApplicable) {
            this.myMessageSoFar.append(line);
            this.myMessageSoFar.append('\n');
        }

        Key key = AndroidLogcatUtils.getProcessOutputType(this.myPrevHeader.getLogLevel());
        MyProcessingResult result = new MyProcessingResult(key, isApplicable, this.myMessageSoFar.toString());
        if (isApplicable) {
            this.myMessageSoFar.setLength(0);
        }

        return result;
    }
}
 
开发者ID:josesamuel,项目名称:logviewer,代码行数:38,代码来源:LogView.java

示例14: getProvider

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@Nullable
public static <T extends BeforeRunTask> BeforeRunTaskProvider<T> getProvider(Project project, Key<T> key) {
  BeforeRunTaskProvider<BeforeRunTask>[] providers = Extensions.getExtensions(EXTENSION_POINT_NAME, project);
  for (BeforeRunTaskProvider<BeforeRunTask> provider : providers) {
    if (provider.getId() == key) {
      //noinspection unchecked
      return (BeforeRunTaskProvider<T>)provider;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BeforeRunTaskProvider.java

示例15: get

import com.intellij.openapi.util.Key; //导入依赖的package包/类
@Override
public <T> T get(@NotNull Key<T> key) {
  Object value = myKey.equals(key) ? myValue : null;
  if (value == null && key instanceof KeyWithDefaultValue) {
    return ((KeyWithDefaultValue<T>)key).getDefaultValue();
  }
  return (T)value;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ResolveState.java


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