本文整理汇总了Java中com.intellij.openapi.util.AsyncResult.done方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncResult.done方法的具体用法?Java AsyncResult.done怎么用?Java AsyncResult.done使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.AsyncResult
的用法示例。
在下文中一共展示了AsyncResult.done方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findDisposable
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
private static AsyncResult<Disposable> findDisposable(Disposable defaultValue, final Key<? extends Disposable> key) {
if (defaultValue == null) {
if (ApplicationManager.getApplication() != null) {
final AsyncResult<Disposable> result = new AsyncResult<>();
DataManager.getInstance().getDataContextFromFocus().doWhenDone(context -> {
Disposable disposable = context.getData(key);
if (disposable == null) {
disposable = Disposer.get("ui");
}
result.setDone(disposable);
});
return result;
}
else {
return null;
}
}
else {
return AsyncResult.done(defaultValue);
}
}
示例2: calculateEvaluationExpression
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
/**
* Asynchronously calculates expression which evaluates to the current value
*/
@Nonnull
public AsyncResult<XExpression> calculateEvaluationExpression() {
String expression = getEvaluationExpression();
XExpression res =
expression != null ? XDebuggerUtil.getInstance().createExpression(expression, null, null, EvaluationMode.EXPRESSION) : null;
return AsyncResult.done(res);
}
示例3: startRunProfile
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
protected static void startRunProfile(ExecutionEnvironment environment,
RunProfileState state,
ProgramRunner.Callback callback,
@Nullable RunProfileStarter starter) {
ThrowableComputable<AsyncResult<RunContentDescriptor>, ExecutionException> func = () -> {
AsyncResult<RunContentDescriptor> promise = starter == null ? AsyncResult.done(null) : starter.executeAsync(state, environment);
return promise.doWhenDone(it -> BaseProgramRunner.postProcess(environment, it, callback));
};
ExecutionManager.getInstance(environment.getProject()).startRunProfile(runProfileStarter(func), state, environment);
}
示例4: addExternalLibraryDependency
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
public AsyncResult<Void> addExternalLibraryDependency(@NotNull final Collection<Module> modules, @NotNull final ExternalLibraryDescriptor descriptor, @NotNull final DependencyScope scope)
{
List<String> defaultRoots = descriptor.getLibraryClassesRoots();
Module firstModule = ContainerUtil.getFirstItem(modules);
LOG.assertTrue(firstModule != null);
LocateLibraryDialog dialog = new LocateLibraryDialog(firstModule, defaultRoots, descriptor.getPresentableName());
List<String> classesRoots = dialog.showAndGetResult();
if(!classesRoots.isEmpty())
{
String libraryName = classesRoots.size() > 1 ? descriptor.getPresentableName() : null;
final List<String> urls = OrderEntryFix.refreshAndConvertToUrls(classesRoots);
if(modules.size() == 1)
{
ModuleRootModificationUtil.addModuleLibrary(firstModule, libraryName, urls, Collections.emptyList(), scope);
}
else
{
new WriteAction()
{
protected void run(@NotNull Result result)
{
Library library = LibraryUtil.createLibrary(LibraryTablesRegistrar.getInstance().getLibraryTable(myProject), descriptor.getPresentableName());
Library.ModifiableModel model = library.getModifiableModel();
for(String url : urls)
{
model.addRoot(url, OrderRootType.CLASSES);
}
model.commit();
for(Module module : modules)
{
ModuleRootModificationUtil.addDependency(module, library, scope, false);
}
}
}.execute();
}
}
return AsyncResult.done(null);
}
示例5: changeLanguageLevel
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
@RequiredReadAction
public AsyncResult<Void> changeLanguageLevel(@NotNull Module module, @NotNull LanguageLevel level)
{
if(JavaSdkUtil.isLanguageLevelAcceptable(myProject, module, level))
{
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
rootModel.getExtension(JavaMutableModuleExtension.class).getInheritableLanguageLevel().set(null, level);
rootModel.commit();
}
return AsyncResult.done(null);
}
示例6: createNewRenderer
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@NotNull
@Override
protected AsyncResult<ArrayRenderer> createNewRenderer(XValueNodeImpl node, ArrayRenderer original, @NotNull DebuggerContextImpl debuggerContext, String title)
{
ArrayRenderer clonedRenderer = original.clone();
clonedRenderer.setForced(true);
if(ShowSettingsUtil.getInstance().editConfigurable(debuggerContext.getProject(), new NamedArrayConfigurable(title, clonedRenderer)))
{
return AsyncResult.done(clonedRenderer);
}
return AsyncResult.rejected();
}
示例7: revalidateElement
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
public AsyncResult<Object> revalidateElement(Object element) {
return AsyncResult.done(element);
}
示例8: stopAsync
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Nonnull
public AsyncResult<Void> stopAsync() {
stop();
return AsyncResult.done(null);
}
示例9: calculateEvaluationExpression
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
@Nonnull
public AsyncResult<XExpression> calculateEvaluationExpression() {
return AsyncResult.done(myExpression);
}
示例10: addModuleDependency
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
public AsyncResult<Void> addModuleDependency(@NotNull Module from, @NotNull Module to, @NotNull DependencyScope scope)
{
ModuleRootModificationUtil.addDependency(from, to, scope, false);
return AsyncResult.done(null);
}
示例11: addLibraryDependency
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
public AsyncResult<Void> addLibraryDependency(@NotNull Module from, @NotNull Library library, @NotNull DependencyScope scope)
{
OrderEntryUtil.addLibraryToRoots(from, library);
return AsyncResult.done(null);
}
示例12: executeAsync
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
/**
* You should NOT throw exceptions in this method.
* Instead return {@link AsyncResult#done(Object)} (Throwable)} or call {@link AsyncResult#rejectWithThrowable(Throwable)}
*/
public AsyncResult<RunContentDescriptor> executeAsync(@Nonnull RunProfileState state, @Nonnull ExecutionEnvironment environment) throws ExecutionException {
return AsyncResult.done(execute(state, environment));
}