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


Java UIBasedFileType类代码示例

本文整理汇总了Java中com.intellij.openapi.fileTypes.UIBasedFileType的典型用法代码示例。如果您正苦于以下问题:Java UIBasedFileType类的具体用法?Java UIBasedFileType怎么用?Java UIBasedFileType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: chooseTool

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
@Nullable
private DiffTool chooseTool(DiffRequest data) {
  final DiffContent[] contents = data.getContents();

  if (contents.length == 2) {
    final FileType type1 = contents[0].getContentType();
    final FileType type2 = contents[1].getContentType();
    if (type1 == type2 && type1 instanceof UIBasedFileType) {
      return BinaryDiffTool.INSTANCE;
    }

    //todo[kb] register or not this instance in common diff tools ?
    if (type1 == type2 && type1 instanceof ArchiveFileType) {
      return ArchiveDiffTool.INSTANCE;
    }
  }

  for (DiffTool tool : myTools) {
    if (tool.canShow(data)) return tool;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CompositeDiffTool.java

示例2: wantShowContent

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
@Override
public boolean wantShowContent(@NotNull DiffContent content, @NotNull DiffContext context) {
  if (content instanceof FileContent) {
    if (content.getContentType() == null) return false;
    if (content.getContentType().isBinary()) return true;
    if (content.getContentType() instanceof UIBasedFileType) return true;
    return false;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:BinaryEditorHolder.java

示例3: getFile

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
@Override
@Nullable
public VirtualFile getFile() {
  if (myFileType instanceof UIBasedFileType) {
    final VirtualFile file = findVirtualFile();
    if (file != null) {
      final LightVirtualFile lightFile = new LightVirtualFile(file, new String(myBytes), 1);
      lightFile.setOriginalFile(file);
      return lightFile;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:BinaryContent.java

示例4: getFile

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
@Nullable
public VirtualFile getFile() {
  if (myFileType instanceof UIBasedFileType) {
    final VirtualFile file = LocalFileSystem.getInstance().findFileByIoFile(new File(myFilePath));
    if (file != null) {
      final LightVirtualFile lightFile = new LightVirtualFile(file, new String(myBytes), 1);
      lightFile.setOriginalFile(file);
      return lightFile;
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:BinaryContent.java

示例5: wantShowContent

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
@Override
public boolean wantShowContent(@Nonnull DiffContent content, @Nonnull DiffContext context) {
  if (content instanceof FileContent) {
    if (content.getContentType() == null) return false;
    if (content.getContentType().isBinary()) return true;
    if (content.getContentType() instanceof UIBasedFileType) return true;
    return false;
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:BinaryEditorHolder.java

示例6: show

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
public void show(final DiffRequest data) {
  final DiffContent current = data.getContents()[0];
  final DiffContent upToDate = data.getContents()[1];

  final Project project = data.getProject();
  if ((current instanceof FileContent && upToDate instanceof FileContent)
      || (current.getContentType() instanceof UIBasedFileType && upToDate.getContentType() instanceof UIBasedFileType)) {
    final VirtualFile src = current.getFile();
    final VirtualFile trg = upToDate.getFile();
    if (src != null && trg != null) {
      final PanelCreator creator = new PanelCreator(data);
      if (creator.isCanCreatePanel()) {
        new DialogWrapper(data.getProject()) {
          public DiffPanel myPanel;
          {
            setModal(false);
            init();
          }

          @Override
          protected String getDimensionServiceKey() {
            return "BinaryDiffDialog";
          }

          @NotNull
          @Override
          protected Action[] createActions() {
            final Action close = getCancelAction();
            close.putValue(Action.NAME, "&Close");
            return new Action[]{close};
          }

          @Override
          protected JComponent createCenterPanel() {
            myPanel = creator.create(getWindow(), getDisposable(), BinaryDiffTool.this);
            return myPanel.getComponent();
          }
        }.show();
        return;
      } else {
        final DirDiffManager diffManager = DirDiffManager.getInstance(project);
        final DiffElement before = diffManager.createDiffElement(src);
        final DiffElement after  = diffManager.createDiffElement(trg);

        if (before != null && after != null && diffManager.canShow(after, before)) {
          diffManager.showDiff(before, after);
          return;
        }
      }
    }
  }
  try {
    final boolean equal = Arrays.equals(current.getBytes(), upToDate.getBytes());
    Messages.showMessageDialog(equal
                               ? DiffBundle.message("binary.files.are.identical.message")
                               : DiffBundle.message("binary.files.are.different.message"),
                               equal
                               ? DiffBundle.message("files.are.identical.dialog.title")
                               : DiffBundle.message("files.are.different.dialog.title"),
                               Messages.getInformationIcon());
  } catch (IOException e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:65,代码来源:BinaryDiffTool.java

示例7: show

import com.intellij.openapi.fileTypes.UIBasedFileType; //导入依赖的package包/类
public void show(final DiffRequest data) {
  final DiffContent current = data.getContents()[0];
  final DiffContent upToDate = data.getContents()[1];

  final Project project = data.getProject();
  if ((current instanceof FileContent && upToDate instanceof FileContent)
      || (current.getContentType() instanceof UIBasedFileType && upToDate.getContentType() instanceof UIBasedFileType)) {
    final VirtualFile src = current.getFile();
    final VirtualFile trg = upToDate.getFile();
    if (src != null && trg != null) {
      final PanelCreator creator = new PanelCreator(data);
      if (creator.isCanCreatePanel()) {
        new DialogWrapper(data.getProject()) {
          public DiffPanel myPanel;
          {
            setModal(false);
            init();
          }

          @Override
          protected String getDimensionServiceKey() {
            return "BinaryDiffDialog";
          }

          @Nonnull
          @Override
          protected Action[] createActions() {
            final Action close = getCancelAction();
            close.putValue(Action.NAME, "&Close");
            return new Action[]{close};
          }

          @Override
          protected JComponent createCenterPanel() {
            myPanel = creator.create(getWindow(), getDisposable(), BinaryDiffTool.this);
            return myPanel.getComponent();
          }
        }.show();
        return;
      } else {
        final DirDiffManager diffManager = DirDiffManager.getInstance(project);
        final DiffElement before = diffManager.createDiffElement(src);
        final DiffElement after  = diffManager.createDiffElement(trg);

        if (before != null && after != null && diffManager.canShow(after, before)) {
          diffManager.showDiff(before, after);
          return;
        }
      }
    }
  }
  try {
    final boolean equal = Arrays.equals(current.getBytes(), upToDate.getBytes());
    Messages.showMessageDialog(equal
                               ? DiffBundle.message("binary.files.are.identical.message")
                               : DiffBundle.message("binary.files.are.different.message"),
                               equal
                               ? DiffBundle.message("files.are.identical.dialog.title")
                               : DiffBundle.message("files.are.different.dialog.title"),
                               Messages.getInformationIcon());
  } catch (IOException e) {
    LOG.error(e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:65,代码来源:BinaryDiffTool.java


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