當前位置: 首頁>>代碼示例>>Java>>正文


Java Ref.create方法代碼示例

本文整理匯總了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();
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:17,代碼來源:HotSwapComponent.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:InstrumentationTargetPackageConverter.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:22,代碼來源:ConstantFieldConverter.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:ConvertConcatenationToGstringIntention.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:VcsLogRepoSizeCollector.java

示例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();
    }
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:9,代碼來源:StatsRequest.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:AndroidArtifactUtil.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:39,代碼來源:PyUnboundLocalVariableInspection.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:LibraryUtil.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:DesignerEditorPanel.java

示例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;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:PyUserSkeletonsTypeProvider.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:GrReassignedLocalVarsChecker.java

示例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());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:GitBranchWorkerTest.java

示例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();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:MavenRemoteManager.java


注:本文中的com.intellij.openapi.util.Ref.create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。