本文整理汇总了Java中com.intellij.openapi.util.Ref.create方法的典型用法代码示例。如果您正苦于以下问题:Java Ref.create方法的具体用法?Java Ref.create怎么用?Java Ref.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.Ref
的用法示例。
在下文中一共展示了Ref.create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanForModifiedClassesWithProgress
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
private Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress( List<DebuggerSession> sessions, HotSwapProgressImpl progress )
{
Ref<Map<DebuggerSession, Map<String, HotSwapFile>>> result = Ref.create( null );
ProgressManager.getInstance().runProcess(
() -> {
try
{
result.set( scanForModifiedClasses( sessions, progress ) );
}
finally
{
progress.finished();
}
}, progress.getProgressIndicator() );
return result.get();
}
示例2: resolveInner
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Nullable
private PsiElement resolveInner() {
final String value = getValue();
if (value.length() == 0) {
return null;
}
final Ref<PsiElement> result = Ref.create();
processApkPackageAttrs(new Processor<GenericAttributeValue<String>>() {
@Override
public boolean process(GenericAttributeValue<String> domValue) {
if (value.equals(domValue.getValue())) {
final XmlAttributeValue xmlValue = domValue.getXmlAttributeValue();
if (xmlValue != null) {
result.set(xmlValue);
return false;
}
}
return true;
}
});
return result.get();
}
示例3: resolveInner
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Nullable
private PsiElement resolveInner() {
final String value = getValue();
if (value.isEmpty()) {
return null;
}
final Ref<PsiElement> ref = Ref.create();
processFields(new Processor<Pair<PsiField, String>>() {
@Override
public boolean process(Pair<PsiField, String> pair) {
if (value.equals(pair.getSecond())) {
ref.set(pair.getFirst());
return false;
}
return true;
}
});
return ref.get();
}
示例4: containsMultilineStrings
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
private static boolean containsMultilineStrings(GrExpression expr) {
final Ref<Boolean> result = Ref.create(false);
expr.accept(new GroovyRecursiveElementVisitor() {
@Override
public void visitLiteralExpression(GrLiteral literal) {
if (GrStringUtil.isMultilineStringLiteral(literal) && literal.getText().contains("\n")) {
result.set(true);
}
}
@Override
public void visitElement(GroovyPsiElement element) {
if (!result.get()) {
super.visitElement(element);
}
}
});
return result.get();
}
示例5: getDataPack
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Nullable
private static VisiblePack getDataPack(@Nullable VcsLogManager logManager) {
if (logManager != null) {
final VcsLogUiImpl ui = logManager.getLogUi();
if (ui != null) {
final Ref<VisiblePack> dataPack = Ref.create();
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
dataPack.set(ui.getDataPack());
}
}, ModalityState.defaultModalityState());
return dataPack.get();
}
}
return null;
}
示例6: findFileByNameInDirectory
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Override
@Nullable
public File findFileByNameInDirectory(
@NotNull final File directory,
@NotNull final String fileName,
@Nullable final TaskProgressProcessor<File> progressListenerProcessor
) throws InterruptedException {
Validate.notNull(directory);
Validate.isTrue(directory.isDirectory());
Validate.notNull(fileName);
final Ref<File> result = Ref.create();
final Ref<Boolean> interrupted = Ref.create(false);
FileUtil.processFilesRecursively(directory, file -> {
if (progressListenerProcessor != null && !progressListenerProcessor.shouldContinue(directory)) {
interrupted.set(true);
return false;
}
if (StringUtils.endsWith(file.getAbsolutePath(), fileName)) {
result.set(file);
return false;
}
return true;
});
if (interrupted.get()) {
throw new InterruptedException("Modules scanning has been interrupted.");
}
return result.get();
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:32,代码来源:DefaultVirtualFileSystemService.java
示例7: getComputerName
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
protected static String getComputerName() {
synchronized (computerNameLock) {
if (cachedComputerNameRef == null) {
cachedComputerNameRef = Ref.create(computeComputerName());
}
return cachedComputerNameRef.get();
}
}
示例8: getPackagedFacet
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Nullable
public static AndroidFacet getPackagedFacet(Project project, Artifact artifact) {
final Ref<AndroidFinalPackageElement> elementRef = Ref.create(null);
final PackagingElementResolvingContext resolvingContext = ArtifactManager.getInstance(project).getResolvingContext();
ArtifactUtil
.processPackagingElements(artifact, AndroidFinalPackageElementType.getInstance(), new Processor<AndroidFinalPackageElement>() {
@Override
public boolean process(AndroidFinalPackageElement e) {
elementRef.set(e);
return false;
}
}, resolvingContext, true);
final AndroidFinalPackageElement element = elementRef.get();
return element != null ? element.getFacet() : null;
}
示例9: isFirstUnboundRead
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
private static boolean isFirstUnboundRead(@NotNull PyReferenceExpression node, @NotNull ScopeOwner owner) {
final String nodeName = node.getReferencedName();
final Scope scope = ControlFlowCache.getScope(owner);
final ControlFlow flow = ControlFlowCache.getControlFlow(owner);
final Instruction[] instructions = flow.getInstructions();
final int num = ControlFlowUtil.findInstructionNumberByElement(instructions, node);
if (num < 0) {
return true;
}
final Ref<Boolean> first = Ref.create(true);
ControlFlowUtil.iteratePrev(num, instructions, new Function<Instruction, ControlFlowUtil.Operation>() {
@Override
public ControlFlowUtil.Operation fun(Instruction instruction) {
if (instruction instanceof ReadWriteInstruction) {
final ReadWriteInstruction rwInstruction = (ReadWriteInstruction)instruction;
final String name = rwInstruction.getName();
final PsiElement element = rwInstruction.getElement();
if (element != null && name != null && name.equals(nodeName) && instruction.num() != num) {
try {
if (scope.getDeclaredVariable(element, name) == null) {
final ReadWriteInstruction.ACCESS access = rwInstruction.getAccess();
if (access.isReadAccess()) {
first.set(false);
return ControlFlowUtil.Operation.BREAK;
}
}
}
catch (DFALimitExceededException e) {
first.set(false);
}
return ControlFlowUtil.Operation.CONTINUE;
}
}
return ControlFlowUtil.Operation.NEXT;
}
});
return first.get();
}
示例10: findLibrary
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Nullable
public static Library findLibrary(@NotNull Module module, @NotNull final String name) {
final Ref<Library> result = Ref.create(null);
OrderEnumerator.orderEntries(module).forEachLibrary(new Processor<Library>() {
@Override
public boolean process(Library library) {
if (name.equals(library.getName())) {
result.set(library);
return false;
}
return true;
}
});
return result.get();
}
示例11: execute
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Override
public boolean execute(final ThrowableRunnable<Exception> operation, String command, final boolean updateProperties) {
myLastExecuteCommand = command;
final Ref<Boolean> result = Ref.create(Boolean.TRUE);
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
public void run() {
result.set(DesignerEditorPanel.this.execute(operation, updateProperties));
}
}, command, null);
return result.get();
}
示例12: getReturnType
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
@Nullable
@Override
public Ref<PyType> getReturnType(@NotNull PyCallable callable, @NotNull TypeEvalContext context) {
final PyCallable callableSkeleton = PyUserSkeletonsUtil.getUserSkeleton(callable);
if (callableSkeleton != null) {
final PyType type = context.getReturnType(callableSkeleton);
if (type != null) {
return Ref.create(type);
}
}
return null;
}
示例13: isReassignedVarImpl
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
private static boolean isReassignedVarImpl(@NotNull final GrVariable resolved) {
final GrControlFlowOwner variableScope = PsiTreeUtil.getParentOfType(resolved, GrCodeBlock.class, GroovyFile.class);
if (variableScope == null) return false;
final String name = resolved.getName();
final Ref<Boolean> isReassigned = Ref.create(false);
for (PsiElement scope = resolved.getParent().getNextSibling(); scope != null; scope = scope.getNextSibling()) {
if (scope instanceof GroovyPsiElement) {
((GroovyPsiElement)scope).accept(new GroovyRecursiveElementVisitor() {
@Override
public void visitClosure(GrClosableBlock closure) {
if (getUsedVarsInsideBlock(closure).contains(name)) {
isReassigned.set(true);
}
}
@Override
public void visitElement(GroovyPsiElement element) {
if (isReassigned.get()) return;
super.visitElement(element);
}
});
if (isReassigned.get()) break;
}
}
return isReassigned.get();
}
示例14: test_checkout_with_unmerged_file_in_second_repo_should_propose_to_rollback
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
public void test_checkout_with_unmerged_file_in_second_repo_should_propose_to_rollback() {
branchWithCommit(myRepositories, "feature");
unmergedFiles(myCommunity);
final Ref<Boolean> rollbackProposed = Ref.create(false);
checkoutBranch("feature", new TestUiHandler() {
@Override
public boolean showUnmergedFilesMessageWithRollback(@NotNull String operationName, @NotNull String rollbackProposal) {
rollbackProposed.set(true);
return false;
}
});
assertTrue("Rollback was not proposed if unmerged files prevented checkout in the second repository", rollbackProposed.get());
}
示例15: getSynchronouslyWithModal
import com.intellij.openapi.util.Ref; //导入方法依赖的package包/类
protected Result getSynchronouslyWithModal(@NotNull final RemoteTask task, @NotNull final Argument argument, String title) {
final Ref<Result> result = Ref.create();
new Task.Modal(myProject, title, false) {
public void run(@NotNull ProgressIndicator indicator) {
indicator.setText(task.getName(argument));
result.set(getSynchronously(task, argument));
}
}.queue();
return result.get();
}