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


Java Ref類代碼示例

本文整理匯總了Java中com.intellij.openapi.util.Ref的典型用法代碼示例。如果您正苦於以下問題:Java Ref類的具體用法?Java Ref怎麽用?Java Ref使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Ref類屬於com.intellij.openapi.util包,在下文中一共展示了Ref類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setupConfigurationFromContext

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Override
protected boolean setupConfigurationFromContext(AppleScriptRunConfiguration configuration, ConfigurationContext context, Ref<PsiElement> sourceElement) {
  PsiElement elem = context.getPsiLocation();
  PsiFile file = elem != null ? elem.getContainingFile() : null;
  if (file == null) return false;
  boolean shouldSetUp = file.getFileType() == AppleScriptFileType.INSTANCE;
  VirtualFile vFile = file.getVirtualFile();
  String scriptPath = vFile != null ? file.getVirtualFile().getPath() : null;
  if (scriptPath != null) {
    configuration.setScriptPath(scriptPath);
    String[] parts = scriptPath.split("/");
    if (parts.length > 0) {
      configuration.setName(parts[parts.length - 1]);
    }
  }
  return shouldSetUp;
}
 
開發者ID:ant-druha,項目名稱:AppleScript-IDEA,代碼行數:18,代碼來源:AppleScriptConfigurationProducer.java

示例2: preprocessEnter

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Override
public Result preprocessEnter(
    @NotNull PsiFile psiFile,
    @NotNull Editor editor,
    @NotNull Ref<Integer> caretOffset,
    @NotNull Ref<Integer> caretOffsetChange,
    @NotNull DataContext dataContext,
    @Nullable EditorActionHandler originalHandler) {
  if (psiFile instanceof SoyFile && isBetweenSiblingTags(psiFile, caretOffset.get())) {
    if (originalHandler != null) {
      originalHandler.execute(editor, dataContext);
    }
    return Result.Default;
  }
  return Result.Continue;
}
 
開發者ID:google,項目名稱:bamboo-soy,代碼行數:17,代碼來源:EnterHandler.java

示例3: createTaskContent

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Override
public PsiDirectory createTaskContent(@NotNull Project project,
                                      @NotNull Task task,
                                      @Nullable IdeView view,
                                      @NotNull PsiDirectory parentDirectory,
                                      @NotNull Course course) {
  final Ref<PsiDirectory> taskDirectory = new Ref<>();
  ApplicationManager.getApplication().runWriteAction(() -> {
    String taskDirName = EduNames.TASK + task.getIndex();
    taskDirectory.set(DirectoryUtil.createSubdirectories(taskDirName, parentDirectory, "\\/"));
    if (taskDirectory.isNull()) return;

    if (course.isAdaptive() && !task.getTaskFiles().isEmpty()) {
      createTaskFilesFromText(task, taskDirectory.get());
    }
    else {
      createFilesFromTemplates(project, view, taskDirectory.get());
    }
  });
  return taskDirectory.get();
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:22,代碼來源:PyEduPluginConfigurator.java

示例4: scheduleCourseListUpdate

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
public void scheduleCourseListUpdate(Application application) {
  if (!checkNeeded()) {
    return;
  }
  application.getMessageBus().connect(application).subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {
    @Override
    public void appFrameCreated(String[] commandLineArgs, @NotNull Ref<Boolean> willOpenProject) {

      long timeToNextCheck = StudySettings.getInstance().getLastTimeChecked() + CHECK_INTERVAL - System.currentTimeMillis();
      if (timeToNextCheck <= 0) {
        myCheckRunnable.run();
      }
      else {
        queueNextCheck(timeToNextCheck);
      }
    }
  });
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:19,代碼來源:EduStepicUpdater.java

示例5: generateFolder

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Nullable
public static VirtualFile generateFolder(@NotNull Project project, @NotNull Module module, String name) {
  VirtualFile generatedRoot = getGeneratedFilesFolder(project, module);
  if (generatedRoot == null) {
    return null;
  }

  final Ref<VirtualFile> folder = new Ref<>(generatedRoot.findChild(name));
  //need to delete old folder
  ApplicationManager.getApplication().runWriteAction(() -> {
    try {
      if (folder.get() != null) {
        folder.get().delete(null);
      }
      folder.set(generatedRoot.createChildDirectory(null, name));
    }
    catch (IOException e) {
      LOG.info("Failed to generate folder " + name, e);
    }
  });
  return folder.get();
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:23,代碼來源:CCUtils.java

示例6: 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

示例7: setupConfigurationFromContext

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Override
protected boolean setupConfigurationFromContext(MuleConfiguration muleConfiguration, ConfigurationContext configurationContext, Ref<PsiElement> ref)
{
    final Location location = configurationContext.getLocation();
    if (location != null)
    {
        final boolean muleFile = MuleConfigUtils.isMuleFile(location.getPsiElement().getContainingFile());
        final Module module = configurationContext.getModule();
        if (muleFile && module != null)
        {
            muleConfiguration.setModule(module);
            muleConfiguration.setName(StringUtils.capitalize(module.getName()));
            return true;
        }
    }
    return false;
}
 
開發者ID:machaval,項目名稱:mule-intellij-plugins,代碼行數:18,代碼來源:MuleApplicationConfigurationProducer.java

示例8: findKeyCharacters

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
private static CharSequence findKeyCharacters(LighterASTNode newNode, FlyweightCapableTreeStructure<LighterASTNode> structure) {
  Ref<LighterASTNode[]> childrenRef = Ref.create(null);
  int childrenCount = structure.getChildren(newNode, childrenRef);
  LighterASTNode[] children = childrenRef.get();

  try {
    for (int i = 0; i < children.length; ++i) {
      if (children[i].getTokenType() == PropertiesTokenTypes.KEY_CHARACTERS)
        return ((LighterASTTokenNode) children[i]).getText();
    }
    return null;
  }
  finally {
    structure.disposeChildren(children, childrenCount);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:PropertiesParser.java

示例9: setupConfigurationFromContext

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Override
protected boolean setupConfigurationFromContext(TesterTestMethodRunConfiguration runConfiguration, ConfigurationContext context, Ref<PsiElement> ref) {
    PsiElement element = context.getPsiLocation();
    Method method = PhpPsiUtil.getParentByCondition(element, parent -> parent instanceof Method);

    if (method != null && isValid(method)) {
        VirtualFile file = method.getContainingFile().getVirtualFile();
        ref.set(method);

        if (!FileTypeManager.getInstance().isFileOfType(file, ScratchFileType.INSTANCE)) {
            VirtualFile root = ProjectRootManager.getInstance(element.getProject()).getFileIndex().getContentRootForFile(file);
            if (root == null) {
                return false;
            }
        }

        PhpScriptRunConfiguration.Settings settings = runConfiguration.getSettings();
        settings.setPath(file.getPresentableUrl());
        runConfiguration.setMethod(method);
        runConfiguration.setName(runConfiguration.suggestedName());
        return true;
    }

    return false;
}
 
開發者ID:jiripudil,項目名稱:intellij-nette-tester,代碼行數:26,代碼來源:TesterTestMethodRunConfigurationProducer.java

示例10: createHandler

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@NotNull
private LogEntryConsumer createHandler(@NotNull final Ref<Long> latest) {
  return new LogEntryConsumer() {
    @Override
    public void consume(final LogEntry logEntry) throws SVNException {
      final Map changedPaths = logEntry.getChangedPaths();
      for (Object o : changedPaths.values()) {
        final LogEntryPath path = (LogEntryPath)o;
        if ((path.getType() == 'D') && (myRelativeUrl.equals(path.getPath()))) {
          latest.set(logEntry.getRevision());
          throw new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE);
        }
      }
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:LatestExistentSearcher.java

示例11: CvsRootAsStringConfigurationPanel

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
public CvsRootAsStringConfigurationPanel(boolean readOnly, Ref<Boolean> isUpdating) {
  myIsUpdating = isUpdating;
  myCvsRoot.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    public void textChanged(DocumentEvent event) {
      notifyListeners();
    }
  });

  myEditFieldByFieldButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final CvsRootConfiguration cvsRootConfiguration =
        CvsApplicationLevelConfiguration.createNewConfiguration(CvsApplicationLevelConfiguration.getInstance());
      cvsRootConfiguration.CVS_ROOT = FormUtils.getFieldValue(myCvsRoot, false);
      final EditCvsConfigurationFieldByFieldDialog dialog = new EditCvsConfigurationFieldByFieldDialog(myCvsRoot.getText());
      if (dialog.showAndGet()) {
        myCvsRoot.setText(dialog.getConfiguration());
      }
    }
  });
  if (readOnly) {
    myCvsRoot.setEditable(false);
    myEditFieldByFieldButton.setEnabled(false);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:CvsRootAsStringConfigurationPanel.java

示例12: initRoot

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
@Nullable
private static SVNURL initRoot(final Project project, final SVNURL url) throws SvnBindException {
  final Ref<SVNURL> result = new Ref<SVNURL>();
  final Ref<SvnBindException> excRef = new Ref<SvnBindException>();

  ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    public void run() {
      try {
        result.set(SvnUtil.getRepositoryRoot(SvnVcs.getInstance(project), url));
      } catch (SvnBindException e) {
        excRef.set(e);
      }
    }
  }, "Detecting repository root", true, project);
  if (! excRef.isNull()) {
    throw excRef.get();
  }
  return result.get();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:SelectLocationDialog.java

示例13: test_dont_propose_to_update_if_force_push_is_rejected

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
public void test_dont_propose_to_update_if_force_push_is_rejected() throws IOException {
  final Ref<Boolean> dialogShown = Ref.create(false);
  myDialogManager.registerDialogHandler(GitRejectedPushUpdateDialog.class, new TestDialogHandler<GitRejectedPushUpdateDialog>() {
    @Override
    public int handleDialog(GitRejectedPushUpdateDialog dialog) {
      dialogShown.set(true);
      return DialogWrapper.CANCEL_EXIT_CODE;
    }
  });

  Pair<String, GitPushResult> remoteTipAndPushResult = forcePushWithReject();
  assertResult(REJECTED, -1, "master", "origin/master", remoteTipAndPushResult.second);
  assertFalse("Rejected push dialog should not be shown", dialogShown.get());
  cd(myParentRepo.getPath());
  assertEquals("The commit pushed from bro should be the last one", remoteTipAndPushResult.first, last());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:GitPushOperationSingleRepoTest.java

示例14: findFileByPath

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
private static VirtualFile findFileByPath(final String resPath, @Nullable final String dtdUrl, ProgressIndicator indicator) {
  final Ref<VirtualFile> ref = new Ref<VirtualFile>();
  ApplicationManager.getApplication().invokeAndWait(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          ref.set(LocalFileSystem.getInstance().refreshAndFindFileByPath(resPath.replace(File.separatorChar, '/')));
          if (dtdUrl != null) {
            ExternalResourceManager.getInstance().addResource(dtdUrl, resPath);
          }
        }
      });
    }
  }, indicator.getModalityState());
  return ref.get();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:FetchExtResourceAction.java

示例15: setupEditorForInjectedLanguage

import com.intellij.openapi.util.Ref; //導入依賴的package包/類
private static void setupEditorForInjectedLanguage() {
  if (myEditor != null) {
    final Ref<EditorWindow> editorWindowRef = new Ref<EditorWindow>();
    myEditor.getCaretModel().runForEachCaret(new CaretAction() {
      @Override
      public void perform(Caret caret) {
        Editor editor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(myEditor, myFile);
        if (caret == myEditor.getCaretModel().getPrimaryCaret() && editor instanceof EditorWindow) {
          editorWindowRef.set((EditorWindow)editor);
        }
      }
    });
    if (!editorWindowRef.isNull()) {
      myEditor = editorWindowRef.get();
      myFile = editorWindowRef.get().getInjectedFile();
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:LightPlatformCodeInsightTestCase.java


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