本文整理匯總了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();
}