当前位置: 首页>>代码示例>>Java>>正文


Java AsyncResult.rejected方法代码示例

本文整理汇总了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);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:AbstractTreeBuilder.java

示例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");
}
 
开发者ID:consulo,项目名称:consulo,代码行数:30,代码来源:ProjectUtil.java

示例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();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:JavaProjectModelModificationServiceImpl.java

示例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();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:JavaProjectModelModificationServiceImpl.java

示例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();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:13,代码来源:ArrayAction.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:67,代码来源:XBreakpointUtil.java

示例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();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:71,代码来源:XBreakpointUtil.java


注:本文中的com.intellij.openapi.util.AsyncResult.rejected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。