本文整理汇总了Java中com.intellij.openapi.util.AsyncResult.rejected方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncResult.rejected方法的具体用法?Java AsyncResult.rejected怎么用?Java AsyncResult.rejected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.AsyncResult
的用法示例。
在下文中一共展示了AsyncResult.rejected方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: revalidateElement
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Nonnull
public AsyncResult<Object> revalidateElement(Object element) {
if (isDisposed()) return AsyncResult.rejected();
AbstractTreeStructure structure = getTreeStructure();
if (structure == null) return AsyncResult.rejected();
return structure.revalidateElement(element);
}
示例2: openAsync
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Nonnull
public static AsyncResult<Project> openAsync(@Nonnull String path, @Nullable Project projectToClose, boolean forceOpenInNewFrame, @Nonnull UIAccess uiAccess) {
final VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(path);
if (virtualFile == null) return AsyncResult.rejected("file path not find");
AsyncResult<Project> result = new AsyncResult<>();
ProjectOpenProcessor provider = ProjectOpenProcessors.getInstance().findProcessor(VfsUtilCore.virtualToIoFile(virtualFile));
if (provider != null) {
AppExecutorUtil.getAppExecutorService().execute(() -> {
result.doWhenDone((project) -> {
uiAccess.give(() -> {
if (!project.isDisposed()) {
final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
if (toolWindow != null) {
toolWindow.activate(null);
}
}
});
});
ApplicationManager.getApplication().runInWriteThreadAndWait(() -> provider.doOpenProjectAsync(result, virtualFile, projectToClose, forceOpenInNewFrame, uiAccess));
});
return result;
}
return AsyncResult.rejected("provider for file path is not find");
}
示例3: addDependency
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
public AsyncResult<Void> addDependency(@NotNull Module from, @NotNull Module to, @NotNull DependencyScope scope)
{
for(JavaProjectModelModifier modifier : getModelModifiers())
{
AsyncResult<Void> asyncResult = modifier.addModuleDependency(from, to, scope);
if(asyncResult != null)
{
return asyncResult;
}
}
return AsyncResult.rejected();
}
示例4: changeLanguageLevel
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
@Override
public AsyncResult<Void> changeLanguageLevel(@NotNull Module module, @NotNull LanguageLevel languageLevel)
{
for(JavaProjectModelModifier modifier : getModelModifiers())
{
AsyncResult<Void> asyncResult = modifier.changeLanguageLevel(module, languageLevel);
if(asyncResult != null)
{
return asyncResult;
}
}
return AsyncResult.rejected();
}
示例5: 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();
}
示例6: toggleLineBreakpoint
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
/**
* Toggle line breakpoint with editor support:
* - unfolds folded block on the line
* - if folded, checks if line breakpoints could be toggled inside folded text
*/
@NotNull
public static AsyncResult<XLineBreakpoint> toggleLineBreakpoint(@NotNull Project project,
@NotNull XSourcePosition position,
@Nullable Editor editor,
boolean temporary,
boolean moveCarret) {
int lineStart = position.getLine();
VirtualFile file = position.getFile();
// for folded text check each line and find out type with the biggest priority
int linesEnd = lineStart;
if (editor != null) {
FoldRegion region = FoldingUtil.findFoldRegionStartingAtLine(editor, lineStart);
if (region != null && !region.isExpanded()) {
linesEnd = region.getDocument().getLineNumber(region.getEndOffset());
}
}
final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
XLineBreakpointType<?>[] lineTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes();
XLineBreakpointType typeWinner = null;
int lineWinner = -1;
for (int line = lineStart; line <= linesEnd; line++) {
int maxPriority = 0;
for (XLineBreakpointType<?> type : lineTypes) {
maxPriority = Math.max(maxPriority, type.getPriority());
final XLineBreakpoint<? extends XBreakpointProperties> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line);
if (breakpoint != null && temporary && !breakpoint.isTemporary()) {
breakpoint.setTemporary(true);
}
else if (type.canPutAt(file, line, project) || breakpoint != null) {
if (typeWinner == null || type.getPriority() > typeWinner.getPriority()) {
typeWinner = type;
lineWinner = line;
}
}
}
// already found max priority type - stop
if (typeWinner != null && typeWinner.getPriority() == maxPriority) {
break;
}
}
if (typeWinner != null) {
XSourcePosition winPosition = (lineStart == lineWinner) ? position : XSourcePositionImpl.create(file, lineWinner);
if (winPosition != null) {
AsyncResult<XLineBreakpoint> res =
XDebuggerUtilImpl.toggleAndReturnLineBreakpoint(project, typeWinner, winPosition, temporary, editor);
if (editor != null && lineStart != lineWinner) {
int offset = editor.getDocument().getLineStartOffset(lineWinner);
ExpandRegionAction.expandRegionAtOffset(project, editor, offset);
if (moveCarret) {
editor.getCaretModel().moveToOffset(offset);
}
}
return res;
}
}
return AsyncResult.rejected();
}
示例7: toggleLineBreakpoint
import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
/**
* Toggle line breakpoint with editor support:
* - unfolds folded block on the line
* - if folded, checks if line breakpoints could be toggled inside folded text
*/
@Nonnull
public static AsyncResult<XLineBreakpoint> toggleLineBreakpoint(@Nonnull Project project,
@Nonnull XSourcePosition position,
@Nullable Editor editor,
boolean temporary,
boolean moveCaret) {
int lineStart = position.getLine();
VirtualFile file = position.getFile();
// for folded text check each line and find out type with the biggest priority
int linesEnd = lineStart;
if (editor != null) {
FoldRegion region = FoldingUtil.findFoldRegionStartingAtLine(editor, lineStart);
if (region != null && !region.isExpanded()) {
linesEnd = region.getDocument().getLineNumber(region.getEndOffset());
}
}
final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
XLineBreakpointType<?>[] lineTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes();
XLineBreakpointType<?> typeWinner = null;
int lineWinner = -1;
for (int line = lineStart; line <= linesEnd; line++) {
for (XLineBreakpointType<?> type : lineTypes) {
final XLineBreakpoint<? extends XBreakpointProperties> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line);
if (breakpoint != null && temporary && !breakpoint.isTemporary()) {
breakpoint.setTemporary(true);
}
else if(breakpoint != null) {
typeWinner = type;
lineWinner = line;
break;
}
}
XLineBreakpointType<?> breakpointType = XLineBreakpointResolverTypeExtension.INSTANCE.resolveBreakpointType(project, file, line);
if(breakpointType != null) {
typeWinner = breakpointType;
lineWinner = line;
}
// already found max priority type - stop
if (typeWinner != null) {
break;
}
}
if (typeWinner != null) {
XSourcePosition winPosition = (lineStart == lineWinner) ? position : XSourcePositionImpl.create(file, lineWinner);
if (winPosition != null) {
AsyncResult<XLineBreakpoint> res =
XDebuggerUtilImpl.toggleAndReturnLineBreakpoint(project, typeWinner, winPosition, temporary, editor);
if (editor != null && lineStart != lineWinner) {
int offset = editor.getDocument().getLineStartOffset(lineWinner);
ExpandRegionAction.expandRegionAtOffset(project, editor, offset);
if (moveCaret) {
editor.getCaretModel().moveToOffset(offset);
}
}
return res;
}
}
return AsyncResult.rejected();
}