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


Java UserDataHolderBase类代码示例

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


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

示例1: doSelectElement

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
@NotNull
@Override
@RequiredReadAction
public Collection<PsiElement> doSelectElement(@NotNull CSharpResolveContext context, boolean deep)
{
	if(myNameWithAt.isEmpty())
	{
		return Collections.emptyList();
	}

	UserDataHolderBase options = new UserDataHolderBase();
	options.putUserData(BaseDotNetNamespaceAsElement.FILTER, DotNetNamespaceAsElement.ChildrenFilter.ONLY_ELEMENTS);

	if(myNameWithAt.charAt(0) == '@')
	{
		return context.findByName(myNameWithAt.substring(1, myNameWithAt.length()), deep, options);
	}
	else
	{
		Collection<PsiElement> withoutSuffix = context.findByName(myNameWithAt, deep, options);

		Collection<PsiElement> array = ContainerUtil2.concat(withoutSuffix, context.findByName(myNameWithAt + AttributeSuffix, deep, options));

		return ContainerUtil.findAll(array, element -> element instanceof CSharpTypeDeclaration && DotNetInheritUtil.isAttribute((DotNetTypeDeclaration) element));
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:27,代码来源:AttributeByNameSelector.java

示例2: collectRequests

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
@NotNull
private static List<DiffRequest> collectRequests(@Nullable Project project,
                                                 @NotNull final DiffRequestChain chain,
                                                 @NotNull ProgressIndicator indicator) {
  List<DiffRequest> requests = new ArrayList<DiffRequest>();

  UserDataHolderBase context = new UserDataHolderBase();
  List<String> errorRequests = new ArrayList<String>();

  // TODO: show all changes on explicit selection
  List<? extends DiffRequestProducer> producers = Collections.singletonList(chain.getRequests().get(chain.getIndex()));

  for (DiffRequestProducer producer : producers) {
    try {
      requests.add(producer.process(context, indicator));
    }
    catch (DiffRequestProducerException e) {
      LOG.warn(e);
      errorRequests.add(producer.getName());
    }
  }

  if (!errorRequests.isEmpty()) {
    new Notification("diff", "Can't load some changes", StringUtil.join(errorRequests, "<br>"), NotificationType.ERROR).notify(project);
  }

  return requests;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ExternalDiffTool.java

示例3: checkLeak

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
/**
 * Checks if there is a memory leak if an object of type {@code suspectClass} is strongly accessible via references from the {@code root} object.
 */
@TestOnly
public static <T> void checkLeak(@NotNull Collection<Object> roots, @NotNull Class<T> suspectClass, @Nullable final Processor<? super T> isReallyLeak) throws AssertionError {
  if (SwingUtilities.isEventDispatchThread()) {
    UIUtil.dispatchAllInvocationEvents();
  }
  else {
    UIUtil.pump();
  }
  PersistentEnumeratorBase.clearCacheForTests();
  walkObjects(suspectClass, roots, new Processor<BackLink>() {
    @Override
    public boolean process(BackLink backLink) {
      UserDataHolder leaked = (UserDataHolder)backLink.value;
      if (((UserDataHolderBase)leaked).replace(REPORTED_LEAKED, null, Boolean.TRUE) &&
          (isReallyLeak == null || isReallyLeak.process((T)leaked))) {
        String place = leaked instanceof Project ? PlatformTestCase.getCreationPlace((Project)leaked) : "";
        System.out.println("Leaked object found:" + leaked +
                           "; hash: " + System.identityHashCode(leaked) + "; place: " + place);
        while (backLink != null) {
          String valueStr;
          try {
            valueStr = backLink.value instanceof FList ? "FList" : backLink.value instanceof Collection ? "Collection" : String.valueOf(backLink.value);
          }
          catch (Throwable e) {
            valueStr = "(" + e.getMessage() + " while computing .toString())";
          }
          System.out.println("-->" + backLink.field + "; Value: " + valueStr + "; " + backLink.value.getClass());
          backLink = backLink.backLink;
        }
        System.out.println(";-----");

        throw new AssertionError();
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:LeakHunter.java

示例4: treeToBufferWithUserData

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
private static void treeToBufferWithUserData(Appendable buffer, PsiElement root, int indent, boolean skipWhiteSpaces) {
  if (skipWhiteSpaces && root instanceof PsiWhiteSpace) return;

  StringUtil.repeatSymbol(buffer, ' ', indent);
  try {
    if (root instanceof CompositeElement) {
      buffer.append(root.toString());
    }
    else {
      final String text = fixWhiteSpaces(root.getText());
      buffer.append(root.toString()).append("('").append(text).append("')");
    }
    buffer.append(((UserDataHolderBase)root).getUserDataString());
    buffer.append("\n");

    PsiElement[] children = root.getChildren();

    for (PsiElement child : children) {
      treeToBufferWithUserData(buffer, child, indent + 2, skipWhiteSpaces);
    }

    if (children.length == 0) {
      StringUtil.repeatSymbol(buffer, ' ', indent + 2);
      buffer.append("<empty list>\n");
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:DebugUtil.java

示例5: computeChildren

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
@Override
public void computeChildren(@NotNull UserDataHolderBase dataHolder,
		@NotNull DotNetDebugContext debugContext,
		@NotNull DotNetAbstractVariableValueNode parentNode,
		@NotNull DotNetStackFrameProxy frameProxy,
		@Nullable DotNetValueProxy value,
		@NotNull XCompositeNode node)
{
	XValueChildrenList childrenList = new XValueChildrenList();

	computeChildrenImpl(debugContext, parentNode, frameProxy, value, childrenList);

	node.addChildren(childrenList, true);
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:15,代码来源:BaseDotNetLogicView.java

示例6: computeChildren

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void computeChildren(@NotNull UserDataHolderBase dataHolder,
		@NotNull DotNetDebugContext debugContext,
		@NotNull DotNetAbstractVariableValueNode parentNode,
		@NotNull DotNetStackFrameProxy frameProxy,
		@Nullable DotNetValueProxy oldValue,
		@NotNull XCompositeNode node)
{
	if(oldValue == null || !isMyValue(oldValue))
	{
		node.setErrorMessage("No value");
		return;
	}

	T value = (T) oldValue;

	final int length = getSize(value);
	final int startIndex = ObjectUtil.notNull(dataHolder.getUserData(ourLastIndex), 0);

	XValueChildrenList childrenList = new XValueChildrenList();
	int max = Math.min(startIndex + XCompositeNode.MAX_CHILDREN_TO_SHOW, length);
	for(int i = startIndex; i < max; i++)
	{
		childrenList.add(createChildValue(i, debugContext, frameProxy, value));
	}

	dataHolder.putUserData(ourLastIndex, max);

	node.addChildren(childrenList, true);

	if(length > max)
	{
		node.tooManyChildren(length - max);
	}
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:37,代码来源:LimitableDotNetLogicValueView.java

示例7: collectRequests

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
@Nonnull
private static List<DiffRequest> collectRequests(@javax.annotation.Nullable Project project,
                                                 @Nonnull final DiffRequestChain chain,
                                                 @Nonnull ProgressIndicator indicator) {
  List<DiffRequest> requests = new ArrayList<DiffRequest>();

  UserDataHolderBase context = new UserDataHolderBase();
  List<String> errorRequests = new ArrayList<String>();

  // TODO: show all changes on explicit selection
  List<? extends DiffRequestProducer> producers = Collections.singletonList(chain.getRequests().get(chain.getIndex()));

  for (DiffRequestProducer producer : producers) {
    try {
      requests.add(producer.process(context, indicator));
    }
    catch (DiffRequestProducerException e) {
      LOG.warn(e);
      errorRequests.add(producer.getName());
    }
  }

  if (!errorRequests.isEmpty()) {
    new Notification("diff", "Can't load some changes", StringUtil.join(errorRequests, "<br>"), NotificationType.ERROR).notify(project);
  }

  return requests;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:ExternalDiffTool.java

示例8: readObject

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
private void readObject(ObjectInputStream in)
  throws IOException, ClassNotFoundException {
  in.defaultReadObject();
  myChildrenView = Collections.unmodifiableList(myChildren);
  myUserData = new UserDataHolderBase();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DataNode.java

示例9: DataContextWrapper

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
public DataContextWrapper(@NotNull DataContext delegate) {
  myDelegate = delegate;
  myDataHolder = delegate instanceof UserDataHolder ? (UserDataHolder) delegate : new UserDataHolderBase();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DataContextWrapper.java

示例10: setVagrantConnectionType

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
public void setVagrantConnectionType(VagrantBasedCredentialsHolder vagrantBasedCredentials) {
  myCredentialsTypeHolder = new UserDataHolderBase();
  myCredentialsTypeHolder.putUserData(VAGRANT_BASED_CREDENTIALS, vagrantBasedCredentials);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoteConnectionCredentialsWrapper.java

示例11: setPlainSshCredentials

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
public void setPlainSshCredentials(RemoteCredentialsHolder credentials) {
  myCredentialsTypeHolder = new UserDataHolderBase();
  myCredentialsTypeHolder.putUserData(PLAIN_SSH_CREDENTIALS, credentials);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoteConnectionCredentialsWrapper.java

示例12: setWebDeploymentCredentials

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
public void setWebDeploymentCredentials(WebDeploymentCredentialsHolder webDeploymentCredentials) {
  myCredentialsTypeHolder = new UserDataHolderBase();
  myCredentialsTypeHolder.putUserData(WEB_DEPLOYMENT_BASED_CREDENTIALS, webDeploymentCredentials);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoteConnectionCredentialsWrapper.java

示例13: setDockerDeploymentCredentials

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
public void setDockerDeploymentCredentials(DockerCredentialsHolder credentials) {
  myCredentialsTypeHolder = new UserDataHolderBase();
  myCredentialsTypeHolder.putUserData(DOCKER_CREDENTIALS, credentials);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoteConnectionCredentialsWrapper.java

示例14: createContextWrapper

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
private static CompileContext createContextWrapper(final CompileContext delegate) {
  final ClassLoader loader = delegate.getClass().getClassLoader();
  final UserDataHolderBase localDataHolder = new UserDataHolderBase();
  final Set<Object> deletedKeysSet = new ConcurrentHashSet<Object>();
  final Class<UserDataHolder> dataHolderInterface = UserDataHolder.class;
  final Class<MessageHandler> messageHandlerInterface = MessageHandler.class;
  return (CompileContext)Proxy.newProxyInstance(loader, new Class[]{CompileContext.class}, new InvocationHandler() {
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
      final Class<?> declaringClass = method.getDeclaringClass();
      if (dataHolderInterface.equals(declaringClass)) {
        final Object firstArgument = args[0];
        if (!(firstArgument instanceof GlobalContextKey)) {
          final boolean isWriteOperation = args.length == 2 /*&& void.class.equals(method.getReturnType())*/;
          if (isWriteOperation) {
            if (args[1] == null) {
              deletedKeysSet.add(firstArgument);
            }
            else {
              deletedKeysSet.remove(firstArgument);
            }
          }
          else {
            if (deletedKeysSet.contains(firstArgument)) {
              return null;
            }
          }
          final Object result = method.invoke(localDataHolder, args);
          if (isWriteOperation || result != null) {
            return result;
          }
        }
      }
      else if (messageHandlerInterface.equals(declaringClass)) {
        final BuildMessage msg = (BuildMessage)args[0];
        if (msg.getKind() == BuildMessage.Kind.ERROR) {
          Utils.ERRORS_DETECTED_KEY.set(localDataHolder, Boolean.TRUE);
        }
      }
      try {
        return method.invoke(delegate, args);
      }
      catch (InvocationTargetException e) {
        final Throwable targetEx = e.getTargetException();
        if (targetEx instanceof ProjectBuildException) {
          throw targetEx;
        }
        throw e;
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:IncProjectBuilder.java

示例15: checkLeak

import com.intellij.openapi.util.UserDataHolderBase; //导入依赖的package包/类
@TestOnly
public static <T> void checkLeak(@NotNull Object root, @NotNull Class<T> suspectClass, @Nullable final Processor<? super T> isReallyLeak) throws AssertionError {
  if (SwingUtilities.isEventDispatchThread()) {
    UIUtil.dispatchAllInvocationEvents();
  }
  else {
    UIUtil.pump();
  }
  PersistentEnumerator.clearCacheForTests();
  toVisit.clear();
  visited.clear();
  toVisit.push(new BackLink(root.getClass(), root, null,null));
  try {
    walkObjects(suspectClass, new Processor<BackLink>() {
      @Override
      public boolean process(BackLink backLink) {
        UserDataHolder leaked = (UserDataHolder)backLink.value;
        if (((UserDataHolderBase)leaked).replace(REPORTED_LEAKED,null,Boolean.TRUE) && (isReallyLeak == null || isReallyLeak.process((T)leaked))) {
          String place = leaked instanceof Project ? PlatformTestCase.getCreationPlace((Project)leaked) : "";
          System.out.println("Leaked object found:" + leaked +
                             "; hash: "+System.identityHashCode(leaked) + "; place: "+ place);
          while (backLink != null) {
            String valueStr;
            try {
              valueStr = String.valueOf(backLink.value);
            }
            catch (Throwable e) {
              valueStr = "("+e.getMessage()+" while computing .toString())";
            }
            System.out.println("-->"+backLink.field+"; Value: "+ valueStr +"; "+backLink.aClass);
            backLink = backLink.backLink;
          }
          System.out.println(";-----");

          throw new AssertionError();
        }
        return true;
      }
    });
  }
  finally {
    visited.clear();
    ((THashSet)visited).compact();
    toVisit.clear();
    toVisit.trimToSize();
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:48,代码来源:LeakHunter.java


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