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


Java Task.queue方法代碼示例

本文整理匯總了Java中com.intellij.openapi.progress.Task.queue方法的典型用法代碼示例。如果您正苦於以下問題:Java Task.queue方法的具體用法?Java Task.queue怎麽用?Java Task.queue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.progress.Task的用法示例。


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

示例1: actionPerformed

import com.intellij.openapi.progress.Task; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    Project project = anActionEvent.getProject();

    if (project != null) {

        try {
            initFiles(project);
        } catch (IOException e) {
            e.printStackTrace();
        }

        if (TextUtils.isEmpty(apkPath)) {
            chooseAndSaveApkFile(project);
        }

        packageName = PropertiesManager.getData(project, PropertyKeys.PACKAGE_NAME);

        if (TextUtils.isEmpty(packageName)) {
            setPackageName(project);
        }

        isInnerClassEnabled = PropertiesManager.getData(project, PropertyKeys.IS_INNER_CLASS_ENABLE, Strings.TRUE);

        if (!TextUtils.isEmpty(apkPath) && !TextUtils.isEmpty(packageName)) {
            Task task = generateDependencyInjectionGraph(project);
            task.queue();
        }
    }
}
 
開發者ID:kaygisiz,項目名稱:Dependency-Injection-Graph,代碼行數:31,代碼來源:GenerateDependencyInjectionGraph.java

示例2: queueLater

import com.intellij.openapi.progress.Task; //導入方法依賴的package包/類
private static void queueLater(final Task task) {
  final Application app = ApplicationManager.getApplication();
  if (app.isDispatchThread()) {
    task.queue();
  } else {
    app.invokeLater(new Runnable() {
      public void run() {
        task.queue();
      }
    });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:AntConfigurationImpl.java

示例3: perform

import com.intellij.openapi.progress.Task; //導入方法依賴的package包/類
private T perform(boolean modal, final Disposable disposable) {
  final Semaphore semaphore = new Semaphore();
  semaphore.down();

  final AtomicReference<T> result = new AtomicReference<T>();

  final Progressive progressive = new Progressive() {

    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      indicator.setIndeterminate(true);
      while (!indicator.isCanceled()) {
        if (semaphore.waitFor(500)) {
          if (mySuccess.get()) {
            UIUtil.invokeLaterIfNeeded(new Runnable() {

              @Override
              public void run() {
                if (disposable == null || !Disposer.isDisposed(disposable)) {
                  postPerform(result.get());
                }
              }
            });
          }
          break;
        }
      }
    }
  };

  Task task;
  boolean cancellable = isCancellable(modal);
  if (modal) {
    task = new Task.Modal(myProject, myTitle, cancellable) {

      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        progressive.run(indicator);
      }
    };
  }
  else {
    task = new Task.Backgroundable(myProject, myTitle, cancellable) {

      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        progressive.run(indicator);
      }

      @Override
      public boolean shouldStartInBackground() {
        return CloudRuntimeTask.this.shouldStartInBackground();
      }
    };
  }

  mySuccess.set(false);
  myErrorMessage.set(null);

  run(semaphore, result);

  task.queue();

  return result.get();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:66,代碼來源:CloudRuntimeTask.java

示例4: perform

import com.intellij.openapi.progress.Task; //導入方法依賴的package包/類
@Override
public ActionCallback perform(List<LibraryOrderEntry> orderEntriesContainingFile) {
  final ActionCallback callback = new ActionCallback();
  Task task = new Task.Backgroundable(myProject, "Downloading Sources", true) {
    @Override
    public void run(@NotNull final ProgressIndicator indicator) {
      final byte[] bytes;
      try {
        LOG.info("Downloading sources JAR: " + myUrl);
        indicator.checkCanceled();
        bytes = HttpRequests.request(myUrl).readBytes(indicator);
      }
      catch (IOException e) {
        LOG.warn(e);
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            new Notification(myMessageGroupId,
                             "Downloading failed",
                             "Failed to download sources: " + myUrl,
                             NotificationType.ERROR)
              .notify(getProject());

            callback.setDone();
          }
        });
        return;
      }

      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          AccessToken accessToken = WriteAction.start();
          try {
            storeFile(bytes);
          }
          finally {
            accessToken.finish();
            callback.setDone();
          }
        }
      });
    }

    @Override
    public void onCancel() {
      callback.setRejected();
    }
  };

  task.queue();

  return callback;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:55,代碼來源:AbstractAttachSourceProvider.java


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