本文整理汇总了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();
}
}
}
示例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();
}
});
}
}
示例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();
}
示例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;
}