Java 类com.intellij.util.StringSetSpinAllocator 实例源码

项目:intellij-ce-playground    文件:AntBuildGroup.java   
private static void fillGroup(final AntBuildFile buildFile, final DefaultActionGroup group, final AntConfiguration antConfiguration) {
  final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
  if (model.getDefaultTargetName() != null) {
    DefaultActionGroup subgroup = new DefaultActionGroup();
    subgroup.add(getOrCreateAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[]{TargetAction.DEFAULT_TARGET_NAME}, null,
                                   model.getDefaultTargetActionId()));
    group.add(subgroup);
  }

  final Set<String> addedTargetNames = StringSetSpinAllocator.alloc();
  try {
    addGroupOfTargets(buildFile, model.getFilteredTargets(), addedTargetNames, group);
    addGroupOfTargets(buildFile, antConfiguration.getMetaTargets(buildFile), addedTargetNames, group);
  }
  finally {
    StringSetSpinAllocator.dispose(addedTargetNames);
  }
}
项目:tools-idea    文件:AntBuildGroup.java   
private static void fillGroup(final AntBuildFile buildFile, final DefaultActionGroup group, final AntConfiguration antConfiguration) {
  final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
  if (model.getDefaultTargetName() != null) {
    DefaultActionGroup subgroup = new DefaultActionGroup();
    subgroup.add(getOrCreateAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[]{TargetAction.DEFAULT_TARGET_NAME}, null,
                                   model.getDefaultTargetActionId()));
    group.add(subgroup);
  }

  final Set<String> addedTargetNames = StringSetSpinAllocator.alloc();
  try {
    addGroupOfTargets(buildFile, model.getFilteredTargets(), addedTargetNames, group);
    addGroupOfTargets(buildFile, antConfiguration.getMetaTargets(buildFile), addedTargetNames, group);
  }
  finally {
    StringSetSpinAllocator.dispose(addedTargetNames);
  }
}
项目:consulo-apache-ant    文件:AntBuildActionGroup.java   
private static void fillGroup(final AntBuildFile buildFile, final DefaultActionGroup group, final AntConfiguration antConfiguration) {
  final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
  if (model.getDefaultTargetName() != null) {
    DefaultActionGroup subgroup = new DefaultActionGroup();
    subgroup.add(getOrCreateAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[]{TargetAction.DEFAULT_TARGET_NAME}, null,
                                   model.getDefaultTargetActionId()));
    group.add(subgroup);
  }

  final Set<String> addedTargetNames = StringSetSpinAllocator.alloc();
  try {
    addGroupOfTargets(buildFile, model.getFilteredTargets(), addedTargetNames, group);
    addGroupOfTargets(buildFile, antConfiguration.getMetaTargets(buildFile), addedTargetNames, group);
  }
  finally {
    StringSetSpinAllocator.dispose(addedTargetNames);
  }
}
项目:intellij-ce-playground    文件:BaseExecuteBeforeRunDialog.java   
private DefaultMutableTreeNode buildNodes() {
  DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Descriptor());
  RunManager runManager = RunManager.getInstance(myProject);
  final ConfigurationType[] configTypes = runManager.getConfigurationFactories();

  for (final ConfigurationType type : configTypes) {
    final Icon icon = type.getIcon();
    DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new ConfigurationTypeDescriptor(type, icon, isConfigurationAssigned(type)));
    root.add(typeNode);
    final Set<String> addedNames = StringSetSpinAllocator.alloc();
    try {
      List<RunConfiguration> configurations = runManager.getConfigurationsList(type);
      for (final RunConfiguration configuration : configurations) {
        final String configurationName = configuration.getName();
        if (addedNames.contains(configurationName)) {
          // add only the first configuration if more than one has the same name
          continue;
        }
        addedNames.add(configurationName);
        typeNode.add(new DefaultMutableTreeNode(
          new ConfigurationDescriptor(configuration, isConfigurationAssigned(configuration))));
      }
    }
    finally {
      StringSetSpinAllocator.dispose(addedNames);
    }
  }

  return root;
}
项目:intellij-ce-playground    文件:AntConfigurationImpl.java   
private void updateRegisteredActions() {
  final Project project = getProject();
  if (project.isDisposed()) {
    return;
  }
  final List<Pair<String, AnAction>> actionList = new ArrayList<Pair<String, AnAction>>();
  for (final AntBuildFile buildFile : getBuildFiles()) {
    final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
    String defaultTargetActionId = model.getDefaultTargetActionId();
    if (defaultTargetActionId != null) {
      final TargetAction action =
        new TargetAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[]{TargetAction.DEFAULT_TARGET_NAME}, null);
      actionList.add(new Pair<String, AnAction>(defaultTargetActionId, action));
    }

    collectTargetActions(model.getFilteredTargets(), actionList, buildFile);
    collectTargetActions(getMetaTargets(buildFile), actionList, buildFile);
  }

  synchronized (this) {
    // unregister Ant actions
    ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    final String[] oldIds = actionManager.getActionIds(AntConfiguration.getActionIdPrefix(project));
    for (String oldId : oldIds) {
      actionManager.unregisterAction(oldId);
    }
    final Set<String> registeredIds = StringSetSpinAllocator.alloc();
    try {
      for (Pair<String, AnAction> pair : actionList) {
        if (!registeredIds.contains(pair.first)) {
          registeredIds.add(pair.first);
          actionManager.registerAction(pair.first, pair.second);
        }
      }
    }
    finally {
      StringSetSpinAllocator.dispose(registeredIds);
    }
  }
}
项目:tools-idea    文件:BaseExecuteBeforeRunDialog.java   
private DefaultMutableTreeNode buildNodes() {
  DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Descriptor());
  RunManager runManager = RunManager.getInstance(myProject);
  final ConfigurationType[] configTypes = runManager.getConfigurationFactories();

  for (final ConfigurationType type : configTypes) {
    final Icon icon = type.getIcon();
    DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new ConfigurationTypeDescriptor(type, icon, isConfigurationAssigned(type)));
    root.add(typeNode);
    final Set<String> addedNames = StringSetSpinAllocator.alloc();
    try {
      RunConfiguration[] configurations = runManager.getConfigurations(type);
      for (final RunConfiguration configuration : configurations) {
        final String configurationName = configuration.getName();
        if (addedNames.contains(configurationName)) {
          // add only the first configuration if more than one has the same name
          continue;
        }
        addedNames.add(configurationName);
        typeNode.add(new DefaultMutableTreeNode(
          new ConfigurationDescriptor(configuration, isConfigurationAssigned(configuration))));
      }
    }
    finally {
      StringSetSpinAllocator.dispose(addedNames);
    }
  }

  return root;
}
项目:tools-idea    文件:AntConfigurationImpl.java   
private void updateRegisteredActions() {
  final Project project = getProject();
  if (project.isDisposed()) {
    return;
  }
  final List<Pair<String, AnAction>> actionList = new ArrayList<Pair<String, AnAction>>();
  for (final AntBuildFile buildFile : getBuildFiles()) {
    final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
    String defaultTargetActionId = model.getDefaultTargetActionId();
    if (defaultTargetActionId != null) {
      final TargetAction action =
        new TargetAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[]{TargetAction.DEFAULT_TARGET_NAME}, null);
      actionList.add(new Pair<String, AnAction>(defaultTargetActionId, action));
    }

    collectTargetActions(model.getFilteredTargets(), actionList, buildFile);
    collectTargetActions(getMetaTargets(buildFile), actionList, buildFile);
  }

  synchronized (this) {
    // unregister Ant actions
    ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    final String[] oldIds = actionManager.getActionIds(AntConfiguration.getActionIdPrefix(project));
    for (String oldId : oldIds) {
      actionManager.unregisterAction(oldId);
    }
    final Set<String> registeredIds = StringSetSpinAllocator.alloc();
    try {
      for (Pair<String, AnAction> pair : actionList) {
        if (!registeredIds.contains(pair.first)) {
          registeredIds.add(pair.first);
          actionManager.registerAction(pair.first, pair.second);
        }
      }
    }
    finally {
      StringSetSpinAllocator.dispose(registeredIds);
    }
  }
}
项目:consulo-apache-ant    文件:AntConfigurationImpl.java   
private void updateRegisteredActions() {
  final Project project = getProject();
  if (project.isDisposed()) {
    return;
  }
  final List<Pair<String, AnAction>> actionList = new ArrayList<Pair<String, AnAction>>();
  for (final AntBuildFile buildFile : getBuildFiles()) {
    final AntBuildModelBase model = (AntBuildModelBase)buildFile.getModel();
    String defaultTargetActionId = model.getDefaultTargetActionId();
    if (defaultTargetActionId != null) {
      final TargetAction action =
        new TargetAction(buildFile, TargetAction.DEFAULT_TARGET_NAME, new String[]{TargetAction.DEFAULT_TARGET_NAME}, null);
      actionList.add(new Pair<String, AnAction>(defaultTargetActionId, action));
    }

    collectTargetActions(model.getFilteredTargets(), actionList, buildFile);
    collectTargetActions(getMetaTargets(buildFile), actionList, buildFile);
  }

  synchronized (this) {
    // unregister Ant actions
    ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
    final String[] oldIds = actionManager.getActionIds(AntConfiguration.getActionIdPrefix(project));
    for (String oldId : oldIds) {
      actionManager.unregisterAction(oldId);
    }
    final Set<String> registeredIds = StringSetSpinAllocator.alloc();
    try {
      for (Pair<String, AnAction> pair : actionList) {
        if (!registeredIds.contains(pair.first)) {
          registeredIds.add(pair.first);
          actionManager.registerAction(pair.first, pair.second);
        }
      }
    }
    finally {
      StringSetSpinAllocator.dispose(registeredIds);
    }
  }
}
项目:consulo    文件:BaseExecuteBeforeRunDialog.java   
private DefaultMutableTreeNode buildNodes() {
  DefaultMutableTreeNode root = new DefaultMutableTreeNode(new Descriptor());
  RunManager runManager = RunManager.getInstance(myProject);
  final ConfigurationType[] configTypes = runManager.getConfigurationFactories();

  for (final ConfigurationType type : configTypes) {
    final Icon icon = type.getIcon();
    DefaultMutableTreeNode typeNode = new DefaultMutableTreeNode(new ConfigurationTypeDescriptor(type, icon, isConfigurationAssigned(type)));
    root.add(typeNode);
    final Set<String> addedNames = StringSetSpinAllocator.alloc();
    try {
      RunConfiguration[] configurations = runManager.getConfigurations(type);
      for (final RunConfiguration configuration : configurations) {
        final String configurationName = configuration.getName();
        if (addedNames.contains(configurationName)) {
          // add only the first configuration if more than one has the same name
          continue;
        }
        addedNames.add(configurationName);
        typeNode.add(new DefaultMutableTreeNode(
          new ConfigurationDescriptor(configuration, isConfigurationAssigned(configuration))));
      }
    }
    finally {
      StringSetSpinAllocator.dispose(addedNames);
    }
  }

  return root;
}