本文整理汇总了Java中com.intellij.util.containers.HashMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java HashMap.get方法的具体用法?Java HashMap.get怎么用?Java HashMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.HashMap
的用法示例。
在下文中一共展示了HashMap.get方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeComponentFromContainer
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@Override public void removeComponentFromContainer(final RadContainer container, final RadComponent component) {
LOG.debug("Removing component with ID " + component.getId());
final JTabbedPane tabbedPane = getTabbedPane();
final JComponent delegee = component.getDelegee();
final int i = tabbedPane.indexOfComponent(delegee);
if (i == -1) {
throw new IllegalArgumentException("cannot find tab for " + component);
}
final HashMap<String, LwTabbedPane.Constraints> id2Constraints = getId2Constraints(RadTabbedPane.this);
LwTabbedPane.Constraints constraints = id2Constraints.get(component.getId());
if (constraints == null) {
LOG.debug("title of removed component is null");
constraints = new LwTabbedPane.Constraints(StringDescriptor.create(tabbedPane.getTitleAt(i)));
}
else {
LOG.debug("title of removed component is " + constraints.myTitle.toString());
}
component.setCustomLayoutConstraints(constraints);
id2Constraints.remove(component.getId());
tabbedPane.removeTabAt(i);
}
示例2: determineUsedMethods
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
private void determineUsedMethods(
Set<PsiMethod> privateMethods,
HashMap<PsiMethod, Collection<PsiReference>> referenceMap) {
final Set<PsiMethod> remainingMethods =
new HashSet<PsiMethod>(privateMethods);
boolean stabilized = false;
while (!stabilized) {
stabilized = true;
final Set<PsiMethod> methodsDeterminedThisPass =
new HashSet<PsiMethod>();
for (PsiMethod method : remainingMethods) {
final Collection<PsiReference> references =
referenceMap.get(method);
for (PsiReference reference : references) {
if (isKnownToBeUsed(reference)) {
usedMethods.add(method);
methodsDeterminedThisPass.add(method);
stabilized = false;
}
}
}
remainingMethods.removeAll(methodsDeterminedThisPass);
}
unusedMethods.addAll(remainingMethods);
}
示例3: registerConflict
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
private static void registerConflict(PsiJavaCodeReferenceElement reference,
PsiElement resolved,
HashMap<PsiElement, HashSet<PsiElement>> reported, MultiMap<PsiElement, String> conflicts) {
final PsiElement container = ConflictsUtil.getContainer(reference);
HashSet<PsiElement> containerSet = reported.get(container);
if (containerSet == null) {
containerSet = new HashSet<PsiElement>();
reported.put(container, containerSet);
}
if (!containerSet.contains(resolved)) {
containerSet.add(resolved);
String placesDescription;
if (containerSet.size() == 1) {
placesDescription = RefactoringUIUtil.getDescription(resolved, true);
} else {
placesDescription = "<ol><li>" + StringUtil.join(containerSet, new Function<PsiElement, String>() {
@Override
public String fun(PsiElement element) {
return RefactoringUIUtil.getDescription(element, true);
}
}, "</li><li>") + "</li></ol>";
}
String message = RefactoringBundle.message("0.will.become.inaccessible.from.1",
placesDescription,
RefactoringUIUtil.getDescription(container, true));
conflicts.put(container, Collections.singletonList(message));
}
}
示例4: findConstructorUsages
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@Nullable
private static Condition<PsiElement> findConstructorUsages(PsiMethod constructor, Collection<PsiReference> originalReferences, List<UsageInfo> usages,
final PsiElement[] allElementsToDelete) {
HashMap<PsiMethod, Collection<PsiReference>> constructorsToRefs = new HashMap<PsiMethod, Collection<PsiReference>>();
HashSet<PsiMethod> newConstructors = new HashSet<PsiMethod>();
if (isTheOnlyEmptyDefaultConstructor(constructor)) return null;
newConstructors.add(constructor);
constructorsToRefs.put(constructor, originalReferences);
HashSet<PsiMethod> passConstructors = new HashSet<PsiMethod>();
do {
passConstructors.clear();
for (PsiMethod method : newConstructors) {
final Collection<PsiReference> references = constructorsToRefs.get(method);
for (PsiReference reference : references) {
PsiMethod overridingConstructor = getOverridingConstructorOfSuperCall(reference.getElement());
if (overridingConstructor != null && !constructorsToRefs.containsKey(overridingConstructor)) {
Collection<PsiReference> overridingConstructorReferences = ReferencesSearch.search(overridingConstructor).findAll();
constructorsToRefs.put(overridingConstructor, overridingConstructorReferences);
passConstructors.add(overridingConstructor);
}
}
}
newConstructors.clear();
newConstructors.addAll(passConstructors);
}
while(!newConstructors.isEmpty());
final Set<PsiMethod> validOverriding =
validateOverridingMethods(constructor, originalReferences, constructorsToRefs.keySet(), constructorsToRefs, usages,
allElementsToDelete);
return new Condition<PsiElement>() {
public boolean value(PsiElement usage) {
if(usage instanceof PsiFile) return false;
return isInside(usage, allElementsToDelete) || isInside(usage, validOverriding);
}
};
}
示例5: moveFieldInitializations
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@Override
public void moveFieldInitializations(LinkedHashSet<PsiField> movedFields) {
PsiMethod[] constructors = myTargetSuperClass.getConstructors();
if (constructors.length == 0) {
constructors = new PsiMethod[]{null};
}
HashMap<PsiMethod,HashSet<PsiMethod>> constructorsToSubConstructors = buildConstructorsToSubConstructorsMap(constructors);
for (PsiMethod constructor : constructors) {
HashSet<PsiMethod> subConstructors = constructorsToSubConstructors.get(constructor);
tryToMoveInitializers(constructor, subConstructors, movedFields);
}
}
示例6: assertDirectoriesEqual
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@SuppressWarnings("UnsafeVfsRecursion")
public static void assertDirectoriesEqual(VirtualFile dirAfter, VirtualFile dirBefore, @Nullable VirtualFileFilter fileFilter) throws IOException {
FileDocumentManager.getInstance().saveAllDocuments();
VirtualFile[] childrenAfter = dirAfter.getChildren();
if (dirAfter.isInLocalFileSystem() && dirAfter.getFileSystem() != TempFileSystem.getInstance()) {
File[] ioAfter = new File(dirAfter.getPath()).listFiles();
shallowCompare(childrenAfter, ioAfter);
}
VirtualFile[] childrenBefore = dirBefore.getChildren();
if (dirBefore.isInLocalFileSystem() && dirBefore.getFileSystem() != TempFileSystem.getInstance()) {
File[] ioBefore = new File(dirBefore.getPath()).listFiles();
shallowCompare(childrenBefore, ioBefore);
}
HashMap<String, VirtualFile> mapAfter = buildNameToFileMap(childrenAfter, fileFilter);
HashMap<String, VirtualFile> mapBefore = buildNameToFileMap(childrenBefore, fileFilter);
Set<String> keySetAfter = mapAfter.keySet();
Set<String> keySetBefore = mapBefore.keySet();
assertEquals(dirAfter.getPath(), keySetAfter, keySetBefore);
for (String name : keySetAfter) {
VirtualFile fileAfter = mapAfter.get(name);
VirtualFile fileBefore = mapBefore.get(name);
if (fileAfter.isDirectory()) {
assertDirectoriesEqual(fileAfter, fileBefore, fileFilter);
}
else {
assertFilesEqual(fileAfter, fileBefore);
}
}
}
示例7: getConstraintsForComponent
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@NotNull
private LwTabbedPane.Constraints getConstraintsForComponent(final RadComponent tabComponent) {
final HashMap<String, LwTabbedPane.Constraints> id2Constraints = getId2Constraints(this);
LwTabbedPane.Constraints constraints = id2Constraints.get(tabComponent.getId());
if (constraints == null) {
int index = indexOfComponent(tabComponent);
constraints = new LwTabbedPane.Constraints(StringDescriptor.create(getTabbedPane().getTitleAt(index)));
id2Constraints.put(tabComponent.getId(), constraints);
}
return constraints;
}
示例8: determineUsageMap
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
private void determineUsageMap(HashMap<PsiMethod,
Collection<PsiReference>> referenceMap) {
final Set<PsiMethod> remainingMethods =
new HashSet<PsiMethod>(usedMethods);
boolean stabilized = false;
while (!stabilized) {
stabilized = true;
final Set<PsiMethod> methodsDeterminedThisPass =
new HashSet<PsiMethod>();
for (PsiMethod method : remainingMethods) {
final Collection<PsiReference> references =
referenceMap.get(method);
boolean areAllReferencesSynchronized = true;
for (PsiReference reference : references) {
if (isKnownToBeUsed(reference)) {
if (isInKnownUnsynchronizedContext(reference)) {
methodsNotAlwaysSynchronized.add(method);
methodsDeterminedThisPass.add(method);
areAllReferencesSynchronized = false;
stabilized = false;
break;
}
if (!isInKnownSynchronizedContext(reference)) {
areAllReferencesSynchronized = false;
}
}
}
if (areAllReferencesSynchronized &&
unusedMethods.contains(method)) {
methodsAlwaysSynchronized.add(method);
methodsDeterminedThisPass.add(method);
stabilized = false;
}
}
remainingMethods.removeAll(methodsDeterminedThisPass);
}
methodsAlwaysSynchronized.addAll(remainingMethods);
}
示例9: groupSuites
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
private static void groupSuites(final HashMap<CoverageRunner, Map<String, List<CoverageSuite>>> grouped,
final CoverageSuite[] suites,
final CoverageEngine engine) {
for (CoverageSuite suite : suites) {
if (engine != null && suite.getCoverageEngine() != engine) continue;
final CoverageFileProvider provider = suite.getCoverageDataFileProvider();
if (provider instanceof DefaultCoverageFileProvider &&
Comparing.strEqual(((DefaultCoverageFileProvider)provider).getSourceProvider(), DefaultCoverageFileProvider.class.getName())) {
if (!provider.ensureFileExists()) continue;
}
final CoverageRunner runner = suite.getRunner();
Map<String, List<CoverageSuite>> byProviders = grouped.get(runner);
if (byProviders == null) {
byProviders = new HashMap<String, List<CoverageSuite>>();
grouped.put(runner, byProviders);
}
final String sourceProvider = provider instanceof DefaultCoverageFileProvider
? ((DefaultCoverageFileProvider)provider).getSourceProvider()
: provider.getClass().getName();
List<CoverageSuite> list = byProviders.get(sourceProvider);
if (list == null) {
list = new ArrayList<CoverageSuite>();
byProviders.put(sourceProvider, list);
}
list.add(suite);
}
}
示例10: buildChildren
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@NotNull
protected final Object[] buildChildren(@NotNull final HierarchyNodeDescriptor descriptor) {
final PsiMember enclosingElement = ((CallHierarchyNodeDescriptor)descriptor).getEnclosingElement();
if (!(enclosingElement instanceof PsiMethod)) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final PsiMethod method = (PsiMethod)enclosingElement;
final ArrayList<PsiMethod> methods = new ArrayList<PsiMethod>();
final PsiCodeBlock body = method.getBody();
if (body != null) {
visitor(body, methods);
}
final PsiMethod baseMethod = (PsiMethod)((CallHierarchyNodeDescriptor)getBaseDescriptor()).getTargetElement();
final PsiClass baseClass = baseMethod.getContainingClass();
final HashMap<PsiMethod,CallHierarchyNodeDescriptor> methodToDescriptorMap = new HashMap<PsiMethod, CallHierarchyNodeDescriptor>();
final ArrayList<CallHierarchyNodeDescriptor> result = new ArrayList<CallHierarchyNodeDescriptor>();
for (final PsiMethod calledMethod : methods) {
if (!isInScope(baseClass, calledMethod, myScopeType)) continue;
CallHierarchyNodeDescriptor d = methodToDescriptorMap.get(calledMethod);
if (d == null) {
d = new CallHierarchyNodeDescriptor(myProject, descriptor, calledMethod, false, false);
methodToDescriptorMap.put(calledMethod, d);
result.add(d);
}
else {
d.incrementUsageCount();
}
}
// also add overriding methods as children
final PsiMethod[] overridingMethods = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
for (final PsiMethod overridingMethod : overridingMethods) {
if (!isInScope(baseClass, overridingMethod, myScopeType)) continue;
final CallHierarchyNodeDescriptor node = new CallHierarchyNodeDescriptor(myProject, descriptor, overridingMethod, false, false);
if (!result.contains(node)) result.add(node);
}
/*
// show method implementations in EJB Class
final PsiMethod[] ejbImplementations = EjbUtil.findEjbImplementations(method, null);
for (int i = 0; i < ejbImplementations.length; i++) {
PsiMethod ejbImplementation = ejbImplementations[i];
result.add(new CallHierarchyNodeDescriptor(myProject, descriptor, ejbImplementation, false));
}
*/
return ArrayUtil.toObjectArray(result);
}
示例11: getConflicts
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@Override
public Map<String, ArrayList<KeyboardShortcut>> getConflicts(String actionId, KeyboardShortcut keyboardShortcut) {
HashMap<String, ArrayList<KeyboardShortcut>> result = new HashMap<String, ArrayList<KeyboardShortcut>>();
String[] actionIds = getActionIds(keyboardShortcut.getFirstKeyStroke());
for (String id : actionIds) {
if (id.equals(actionId)) {
continue;
}
if (actionId.startsWith(EDITOR_ACTION_PREFIX) && id.equals("$" + actionId.substring(6))) {
continue;
}
if (StringUtil.startsWithChar(actionId, '$') && id.equals(EDITOR_ACTION_PREFIX + actionId.substring(1))) {
continue;
}
final String useShortcutOf = myKeymapManager.getActionBinding(id);
if (useShortcutOf != null && useShortcutOf.equals(actionId)) {
continue;
}
Shortcut[] shortcuts = getShortcuts(id);
for (Shortcut shortcut1 : shortcuts) {
if (!(shortcut1 instanceof KeyboardShortcut)) {
continue;
}
KeyboardShortcut shortcut = (KeyboardShortcut)shortcut1;
if (!shortcut.getFirstKeyStroke().equals(keyboardShortcut.getFirstKeyStroke())) {
continue;
}
if (keyboardShortcut.getSecondKeyStroke() != null &&
shortcut.getSecondKeyStroke() != null &&
!keyboardShortcut.getSecondKeyStroke().equals(shortcut.getSecondKeyStroke())) {
continue;
}
ArrayList<KeyboardShortcut> list = result.get(id);
if (list == null) {
list = new ArrayList<KeyboardShortcut>();
result.put(id, list);
}
list.add(shortcut);
}
}
return result;
}
示例12: getChildTitle
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
@Nullable
public StringDescriptor getChildTitle(RadComponent component) {
final HashMap<String, LwTabbedPane.Constraints> id2Constraints = getId2Constraints(this);
final LwTabbedPane.Constraints constraints = id2Constraints.get(component.getId());
return constraints == null ? null : constraints.myTitle;
}
示例13: getTabProperty
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
public StringDescriptor getTabProperty(IComponent component, final String propName) {
final HashMap<String, LwTabbedPane.Constraints> id2Constraints = getId2Constraints(this);
final LwTabbedPane.Constraints constraints = id2Constraints.get(component.getId());
return constraints == null ? null : constraints.getProperty(propName);
}
示例14: writeChildConstraints
import com.intellij.util.containers.HashMap; //导入方法依赖的package包/类
public void writeChildConstraints(final XmlWriter writer, final RadComponent child) {
writer.startElement(UIFormXmlConstants.ELEMENT_TABBEDPANE);
try{
final JComponent delegee = child.getDelegee();
final JTabbedPane tabbedPane = getTabbedPane();
final int i = tabbedPane.indexOfComponent(delegee);
if (i == -1) {
throw new IllegalArgumentException("cannot find tab for " + child);
}
final HashMap<String, LwTabbedPane.Constraints> id2Constraints = getId2Constraints(RadTabbedPane.this);
final LwTabbedPane.Constraints tabTitleConstraints = id2Constraints.get(child.getId());
if (tabTitleConstraints != null) {
writer.writeStringDescriptor(tabTitleConstraints.myTitle,
UIFormXmlConstants.ATTRIBUTE_TITLE,
UIFormXmlConstants.ATTRIBUTE_TITLE_RESOURCE_BUNDLE,
UIFormXmlConstants.ATTRIBUTE_TITLE_KEY);
if (tabTitleConstraints.myIcon != null) {
writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ICON, tabTitleConstraints.myIcon.getIconPath());
}
if (tabTitleConstraints.myDisabledIcon != null) {
writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_DISABLED_ICON, tabTitleConstraints.myDisabledIcon.getIconPath());
}
if (!tabTitleConstraints.myEnabled) {
writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_ENABLED, false);
}
if (tabTitleConstraints.myToolTip != null) {
writer.startElement(UIFormXmlConstants.ELEMENT_TOOLTIP);
writer.writeStringDescriptor(tabTitleConstraints.myToolTip,
UIFormXmlConstants.ATTRIBUTE_VALUE,
UIFormXmlConstants.ATTRIBUTE_RESOURCE_BUNDLE,
UIFormXmlConstants.ATTRIBUTE_KEY);
writer.endElement();
}
}
else {
final String title = tabbedPane.getTitleAt(i);
writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_TITLE, title != null ? title : "");
}
}
finally{
writer.endElement();
}
}