本文整理汇总了Java中com.intellij.util.containers.OrderedSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java OrderedSet.add方法的具体用法?Java OrderedSet.add怎么用?Java OrderedSet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.OrderedSet
的用法示例。
在下文中一共展示了OrderedSet.add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addShortcutSilently
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
private void addShortcutSilently(String actionId, Shortcut shortcut, final boolean checkParentShortcut) {
OrderedSet<Shortcut> list = myActionId2ListOfShortcuts.get(actionId);
if (list == null) {
list = new OrderedSet<Shortcut>();
myActionId2ListOfShortcuts.put(actionId, list);
Shortcut[] boundShortcuts = getBoundShortcuts(actionId);
if (boundShortcuts != null) {
ContainerUtil.addAll(list, boundShortcuts);
}
else if (myParent != null) {
ContainerUtil.addAll(list, getParentShortcuts(actionId));
}
}
list.add(shortcut);
if (checkParentShortcut && myParent != null && areShortcutsEqual(getParentShortcuts(actionId), getShortcuts(actionId))) {
myActionId2ListOfShortcuts.remove(actionId);
}
cleanShortcutsCache();
}
示例2: addAnnotationsJar
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
private static void addAnnotationsJar(@NotNull Module module, @NotNull OrderedSet<VirtualFile> libs) {
Sdk sdk = ModuleRootManager.getInstance(module).getSdk();
if (sdk == null || !isAndroidSdk(sdk)) {
return;
}
String sdkHomePath = sdk.getHomePath();
if (sdkHomePath == null) {
return;
}
AndroidPlatform platform = AndroidPlatform.getInstance(module);
if (platform != null && platform.needToAddAnnotationsJarToClasspath()) {
String annotationsJarPath = toSystemIndependentName(sdkHomePath) + ANNOTATIONS_JAR_RELATIVE_PATH;
VirtualFile annotationsJar = LocalFileSystem.getInstance().findFileByPath(annotationsJarPath);
if (annotationsJar != null) {
libs.add(annotationsJar);
}
}
}
示例3: collectAllElements
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
protected void collectAllElements(@NotNull PsiElement atCaret, @NotNull OrderedSet<PsiElement> res, boolean recurse) {
res.add(0, atCaret);
if (doNotStepInto(atCaret)) {
if (!recurse) return;
recurse = false;
}
PsiElement parent = atCaret.getParent();
if (atCaret instanceof GrClosableBlock && parent instanceof GrStringInjection && parent.getParent() instanceof GrString) {
res.add(parent.getParent());
}
if (parent instanceof GrArgumentList) {
res.add(parent.getParent());
}
//if (parent instanceof GrWhileStatement) {
// res.add(parent);
//}
final PsiElement[] children = getChildren(atCaret);
for (PsiElement child : children) {
collectAllElements(child, res, recurse);
}
}
示例4: collectAllElements
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
protected void collectAllElements(@NotNull PsiElement element, @NotNull OrderedSet<PsiElement> result, boolean recursive) {
result.add(0, element);
if (doNotStepInto(element)) {
if (!recursive) return;
recursive = false;
}
collectAdditionalElements(element, result);
for (PsiElement child : element.getChildren()) {
collectAllElements(child, result, recursive);
}
}
示例5: collectAllElements
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
@Override
protected void collectAllElements(@NotNull PsiElement atCaret, @NotNull OrderedSet<PsiElement> res, boolean recurse) {
res.add(0, atCaret);
if (doNotStepInto(atCaret)) {
if (!recurse) return;
recurse = false;
}
PsiElement parent = atCaret.getParent();
if (atCaret instanceof GrClosableBlock && parent instanceof GrStringInjection && parent.getParent() instanceof GrString) {
res.add(parent.getParent());
}
if (parent instanceof GrArgumentList) {
res.add(parent.getParent());
}
//if (parent instanceof GrWhileStatement) {
// res.add(parent);
//}
final PsiElement[] children = getChildren(atCaret);
for (PsiElement child : children) {
collectAllElements(child, res, recurse);
}
}
示例6: collectAllElements
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
protected void collectAllElements(@Nonnull PsiElement element, @Nonnull OrderedSet<PsiElement> result, boolean recursive) {
result.add(0, element);
if (doNotStepInto(element)) {
if (!recursive) return;
recursive = false;
}
collectAdditionalElements(element, result);
for (PsiElement child : element.getChildren()) {
collectAllElements(child, result, recursive);
}
}
示例7: removeShortcut
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
@Override
public void removeShortcut(String actionId, Shortcut toDelete) {
OrderedSet<Shortcut> list = myActionId2ListOfShortcuts.get(actionId);
if (list != null) {
Iterator<Shortcut> it = list.iterator();
while (it.hasNext()) {
Shortcut each = it.next();
if (toDelete.equals(each)) {
it.remove();
if ((myParent != null && areShortcutsEqual(getParentShortcuts(actionId), getShortcuts(actionId)))
|| (myParent == null && list.isEmpty())) {
myActionId2ListOfShortcuts.remove(actionId);
}
break;
}
}
}
else {
Shortcut[] inherited = getBoundShortcuts(actionId);
if (inherited == null && myParent != null) {
inherited = getParentShortcuts(actionId);
}
if (inherited != null) {
boolean affected = false;
OrderedSet<Shortcut> newShortcuts = new OrderedSet<Shortcut>(inherited.length);
for (Shortcut eachInherited : inherited) {
if (toDelete.equals(eachInherited)) {
// skip this one
affected = true;
}
else {
newShortcuts.add(eachInherited);
}
}
if (affected) {
myActionId2ListOfShortcuts.put(actionId, newShortcuts);
}
}
}
cleanShortcutsCache();
fireShortcutChanged(actionId);
}
示例8: process
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
protected void process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file, final int attempt)
throws TooManyAttemptsException {
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.complete.statement");
if (attempt > MAX_ATTEMPTS) throw new TooManyAttemptsException();
try {
commit(editor);
if (myFirstErrorOffset != Integer.MAX_VALUE) {
editor.getCaretModel().moveToOffset(myFirstErrorOffset);
}
myFirstErrorOffset = Integer.MAX_VALUE;
PsiElement atCaret = getStatementAtCaret(editor, file);
if (atCaret == null) {
return;
}
OrderedSet<PsiElement> queue = new OrderedSet<PsiElement>();
collectAllElements(atCaret, queue, true);
queue.add(atCaret);
for (PsiElement psiElement : queue) {
for (Fixer fixer : myFixers) {
fixer.apply(editor, this, psiElement);
if (LookupManager.getInstance(project).getActiveLookup() != null) {
return;
}
if (isUncommited(project) || !psiElement.isValid()) {
moveCaretInsideBracesIfAny(editor, file);
process(project, editor, file, attempt + 1);
return;
}
}
}
doEnter(atCaret, file, editor);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
示例9: process
import com.intellij.util.containers.OrderedSet; //导入方法依赖的package包/类
protected void process(@Nonnull final Project project, @Nonnull final Editor editor, @Nonnull final PsiFile file, final int attempt)
throws TooManyAttemptsException {
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.complete.statement");
if (attempt > MAX_ATTEMPTS) throw new TooManyAttemptsException();
try {
commit(editor);
if (myFirstErrorOffset != Integer.MAX_VALUE) {
editor.getCaretModel().moveToOffset(myFirstErrorOffset);
}
myFirstErrorOffset = Integer.MAX_VALUE;
PsiElement atCaret = getStatementAtCaret(editor, file);
if (atCaret == null) {
return;
}
OrderedSet<PsiElement> queue = new OrderedSet<PsiElement>();
collectAllElements(atCaret, queue, true);
queue.add(atCaret);
for (PsiElement psiElement : queue) {
for (Fixer fixer : myFixers) {
fixer.apply(editor, this, psiElement);
if (LookupManager.getInstance(project).getActiveLookup() != null) {
return;
}
if (isUncommited(project) || !psiElement.isValid()) {
moveCaretInsideBracesIfAny(editor, file);
process(project, editor, file, attempt + 1);
return;
}
}
}
doEnter(atCaret, file, editor);
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}