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


Java VcsContext.getEditor方法代码示例

本文整理汇总了Java中com.intellij.openapi.vcs.actions.VcsContext.getEditor方法的典型用法代码示例。如果您正苦于以下问题:Java VcsContext.getEditor方法的具体用法?Java VcsContext.getEditor怎么用?Java VcsContext.getEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vcs.actions.VcsContext的用法示例。


在下文中一共展示了VcsContext.getEditor方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSelectionFromEditor

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Nullable
private static VcsSelection getSelectionFromEditor(VcsContext context) {
  Editor editor = context.getEditor();
  if (editor == null) return null;
  SelectionModel selectionModel = editor.getSelectionModel();
  if (!selectionModel.hasSelection()) {
    return null;
  }
  return new VcsSelection(editor.getDocument(), selectionModel);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:VcsSelectionUtil.java

示例2: getSelection

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Override
public VcsSelection getSelection(VcsContext context) {
  final Editor editor = context.getEditor();
    if (editor == null) return null;
    PsiElement psiElement = TargetElementUtil.findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED);
    if (psiElement == null || !psiElement.isValid()) {
      return null;
    }

    final String actionName;

    if (psiElement instanceof XmlTag) {
      actionName = VcsBundle.message("action.name.show.history.for.tag");
    }
    else if (psiElement instanceof XmlText) {
      actionName = VcsBundle.message("action.name.show.history.for.text");
    }
    else {
      return null;
    }

    TextRange textRange = psiElement.getTextRange();
    if (textRange == null) {
      return null;
    }

    VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
    if (virtualFile == null) {
      return null;
    }
    if (!virtualFile.isValid()) {
      return null;
    }

    Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
    return new VcsSelection(document, textRange, actionName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:XmlVcsSelectionProvider.java

示例3: getSelection

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
public VcsSelection getSelection(VcsContext context) {
  final Editor editor = context.getEditor();
    if (editor == null) return null;
    PsiElement psiElement = TargetElementUtilBase.findTargetElement(editor, TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
    if (psiElement == null || !psiElement.isValid()) {
      return null;
    }

    final String actionName;

    if (psiElement instanceof XmlTag) {
      actionName = VcsBundle.message("action.name.show.history.for.tag");
    }
    else if (psiElement instanceof XmlText) {
      actionName = VcsBundle.message("action.name.show.history.for.text");
    }
    else {
      return null;
    }

    TextRange textRange = psiElement.getTextRange();
    if (textRange == null) {
      return null;
    }

    VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
    if (virtualFile == null) {
      return null;
    }
    if (!virtualFile.isValid()) {
      return null;
    }

    Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
    return new VcsSelection(document, textRange, actionName);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:XmlVcsSelectionProvider.java

示例4: getSelection

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Nullable
public VcsSelection getSelection(final VcsContext context) {
  final Editor editor = context.getEditor();
  if (editor == null) return null;
  PsiElement psiElement = TargetElementUtil.findTargetElement(editor, TargetElementUtil.ELEMENT_NAME_ACCEPTED);
  if (psiElement == null) {
    return null;
  }
  if (!psiElement.isValid()) {
    return null;
  }
  if (psiElement instanceof PsiCompiledElement) {
    return null;
  }

  final String actionName;

  if (psiElement instanceof PsiClass) {
    actionName = VcsBundle.message("action.name.show.history.for.class");
  }
  else if (psiElement instanceof PsiField) {
    actionName = VcsBundle.message("action.name.show.history.for.field");
  }
  else if (psiElement instanceof PsiMethod) {
    actionName = VcsBundle.message("action.name.show.history.for.method");
  }
  else if (psiElement instanceof PsiCodeBlock) {
    actionName = VcsBundle.message("action.name.show.history.for.code.block");
  }
  else if (psiElement instanceof PsiStatement) {
    actionName = VcsBundle.message("action.name.show.history.for.statement");
  }
  else {
    return null;
  }

  TextRange textRange = psiElement.getTextRange();
  if (textRange == null) {
    return null;
  }

  VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
  if (virtualFile == null) {
    return null;
  }
  if (!virtualFile.isValid()) {
    return null;
  }

  Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
  return new VcsSelection(document, textRange, actionName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:53,代码来源:JavaVcsSelectionProvider.java

示例5: getSelection

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Nullable
public VcsSelection getSelection(final VcsContext context) {
  final Editor editor = context.getEditor();
  if (editor == null) return null;
  PsiElement psiElement = TargetElementUtilBase.findTargetElement(editor, TargetElementUtilBase.ELEMENT_NAME_ACCEPTED);
  if (psiElement == null) {
    return null;
  }
  if (!psiElement.isValid()) {
    return null;
  }
  if (psiElement instanceof PsiCompiledElement) {
    return null;
  }

  final String actionName;

  if (psiElement instanceof PsiClass) {
    actionName = VcsBundle.message("action.name.show.history.for.class");
  }
  else if (psiElement instanceof PsiField) {
    actionName = VcsBundle.message("action.name.show.history.for.field");
  }
  else if (psiElement instanceof PsiMethod) {
    actionName = VcsBundle.message("action.name.show.history.for.method");
  }
  else if (psiElement instanceof PsiCodeBlock) {
    actionName = VcsBundle.message("action.name.show.history.for.code.block");
  }
  else if (psiElement instanceof PsiStatement) {
    actionName = VcsBundle.message("action.name.show.history.for.statement");
  }
  else {
    return null;
  }

  TextRange textRange = psiElement.getTextRange();
  if (textRange == null) {
    return null;
  }

  VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
  if (virtualFile == null) {
    return null;
  }
  if (!virtualFile.isValid()) {
    return null;
  }

  Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
  return new VcsSelection(document, textRange, actionName);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:JavaVcsSelectionProvider.java

示例6: getSelection

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@RequiredDispatchThread
public VcsSelection getSelection(VcsContext context)
{
	final Editor editor = context.getEditor();
	if(editor == null)
	{
		return null;
	}
	PsiElement psiElement = TargetElementUtil.findTargetElement(editor, ContainerUtil.newHashSet(TargetElementUtilEx.ELEMENT_NAME_ACCEPTED));
	if(psiElement == null || !psiElement.isValid())
	{
		return null;
	}

	final String actionName;

	if(psiElement instanceof XmlTag)
	{
		actionName = VcsBundle.message("action.name.show.history.for.tag");
	}
	else if(psiElement instanceof XmlText)
	{
		actionName = VcsBundle.message("action.name.show.history.for.text");
	}
	else
	{
		return null;
	}

	TextRange textRange = psiElement.getTextRange();
	if(textRange == null)
	{
		return null;
	}

	VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
	if(virtualFile == null)
	{
		return null;
	}
	if(!virtualFile.isValid())
	{
		return null;
	}

	Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
	return new VcsSelection(document, textRange, actionName);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:49,代码来源:XmlVcsSelectionProvider.java

示例7: getSelection

import com.intellij.openapi.vcs.actions.VcsContext; //导入方法依赖的package包/类
@Nullable
@RequiredDispatchThread
public VcsSelection getSelection(final VcsContext context) {
  final Editor editor = context.getEditor();
  if (editor == null) return null;
  PsiElement psiElement = TargetElementUtil.findTargetElement(editor, ContainerUtil.newHashSet(TargetElementUtilEx.ELEMENT_NAME_ACCEPTED));
  if (psiElement == null) {
    return null;
  }
  if (!psiElement.isValid()) {
    return null;
  }
  if (psiElement instanceof PsiCompiledElement) {
    return null;
  }

  final String actionName;

  if (psiElement instanceof PsiClass) {
    actionName = VcsBundle.message("action.name.show.history.for.class");
  }
  else if (psiElement instanceof PsiField) {
    actionName = VcsBundle.message("action.name.show.history.for.field");
  }
  else if (psiElement instanceof PsiMethod) {
    actionName = VcsBundle.message("action.name.show.history.for.method");
  }
  else if (psiElement instanceof PsiCodeBlock) {
    actionName = VcsBundle.message("action.name.show.history.for.code.block");
  }
  else if (psiElement instanceof PsiStatement) {
    actionName = VcsBundle.message("action.name.show.history.for.statement");
  }
  else {
    return null;
  }

  TextRange textRange = psiElement.getTextRange();
  if (textRange == null) {
    return null;
  }

  VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
  if (virtualFile == null) {
    return null;
  }
  if (!virtualFile.isValid()) {
    return null;
  }

  Document document = FileDocumentManager.getInstance().getDocument(virtualFile);
  return new VcsSelection(document, textRange, actionName);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:54,代码来源:JavaVcsSelectionProvider.java


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