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


Java DiffContext类代码示例

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


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

示例1: update

import com.intellij.diff.DiffContext; //导入依赖的package包/类
@Override
public void update(@NotNull AnActionEvent e) {
  DiffRequest request = e.getData(DiffDataKeys.DIFF_REQUEST);
  DiffContext context = e.getData(DiffDataKeys.DIFF_CONTEXT);

  if (DiffUtil.isUserDataFlagSet(DiffUserDataKeys.GO_TO_SOURCE_DISABLE, request, context)) {
    e.getPresentation().setVisible(false);
    e.getPresentation().setEnabled(false);
  }

  if (e.getProject() == null) {
    e.getPresentation().setVisible(true);
    e.getPresentation().setEnabled(false);
    return;
  }

  if (getDescriptor(e.getDataContext()) == null) {
    e.getPresentation().setVisible(true);
    e.getPresentation().setEnabled(false);
    return;
  }

  e.getPresentation().setEnabledAndVisible(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:OpenInEditorAction.java

示例2: MyThreesideViewer

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public MyThreesideViewer(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
  super(context, request);

  myModifierProvider = new ModifierProvider();
  myUndoManager = getProject() != null ? UndoManager.getInstance(getProject()) : UndoManager.getGlobalInstance();

  DiffUtil.registerAction(new ApplySelectedChangesAction(Side.LEFT, true), myPanel);
  DiffUtil.registerAction(new ApplySelectedChangesAction(Side.RIGHT, true), myPanel);
  DiffUtil.registerAction(new IgnoreSelectedChangesAction(Side.LEFT, true), myPanel);
  DiffUtil.registerAction(new IgnoreSelectedChangesAction(Side.RIGHT, true), myPanel);

  if (myUndoManager != null) {
    new UndoRedoAction(true).register();
    new UndoRedoAction(false).register();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TextMergeTool.java

示例3: DiffPanelBase

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public DiffPanelBase(@Nullable Project project,
                     @NotNull DataProvider provider,
                     @NotNull DiffContext context) {
  super(new BorderLayout());
  myProject = project;
  myDataProvider = provider;
  myContext = context;

  myCardLayout = new CardLayout();
  myContentPanel = new JPanel(myCardLayout);

  myNotificationsPanel = new JPanel();
  myNotificationsPanel.setLayout(new BoxLayout(myNotificationsPanel, BoxLayout.Y_AXIS));

  myNorthPanel = new Wrapper();
  mySouthPanel = new Wrapper();

  add(myContentPanel, BorderLayout.CENTER);
  add(myNorthPanel, BorderLayout.NORTH);
  add(mySouthPanel, BorderLayout.SOUTH);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DiffPanelBase.java

示例4: checkForceReadOnly

import com.intellij.diff.DiffContext; //导入依赖的package包/类
@NotNull
public static boolean[] checkForceReadOnly(@NotNull DiffContext context, @NotNull ContentDiffRequest request) {
  int contentCount = request.getContents().size();
  boolean[] result = new boolean[contentCount];

  if (DiffUtil.isUserDataFlagSet(DiffUserDataKeys.FORCE_READ_ONLY, request, context)) {
    Arrays.fill(result, true);
    return result;
  }

  boolean[] data = request.getUserData(DiffUserDataKeys.FORCE_READ_ONLY_CONTENTS);
  if (data != null && data.length == contentCount) {
    return data;
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TextDiffViewerUtil.java

示例5: canShowRequest

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public static <T extends EditorHolder> boolean canShowRequest(@NotNull DiffContext context,
                                                              @NotNull DiffRequest request,
                                                              @NotNull EditorHolderFactory<T> factory) {
  if (!(request instanceof ContentDiffRequest)) return false;

  List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
  if (contents.size() != 2) return false;

  DiffContent content1 = contents.get(0);
  DiffContent content2 = contents.get(1);

  if (content1 instanceof EmptyContent) {
    return factory.canShowContent(content2, context) && factory.wantShowContent(content2, context);
  }
  if (content2 instanceof EmptyContent) {
    return factory.canShowContent(content1, context) && factory.wantShowContent(content1, context);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:OnesideDiffViewer.java

示例6: canShowRequest

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public static <T extends EditorHolder> boolean canShowRequest(@NotNull DiffContext context,
                                                              @NotNull DiffRequest request,
                                                              @NotNull EditorHolderFactory<T> factory) {
  if (!(request instanceof ContentDiffRequest)) return false;

  List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
  if (contents.size() != 2) return false;

  boolean canShow = true;
  boolean wantShow = false;
  for (DiffContent content : contents) {
    canShow &= factory.canShowContent(content, context);
    wantShow |= factory.wantShowContent(content, context);
  }
  return canShow && wantShow;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TwosideDiffViewer.java

示例7: canShowRequest

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public static <T extends EditorHolder> boolean canShowRequest(@NotNull DiffContext context,
                                                              @NotNull DiffRequest request,
                                                              @NotNull EditorHolderFactory<T> factory) {
  if (!(request instanceof ContentDiffRequest)) return false;

  List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
  if (contents.size() != 3) return false;

  boolean canShow = true;
  boolean wantShow = false;
  for (DiffContent content : contents) {
    canShow &= factory.canShowContent(content, context);
    wantShow |= factory.wantShowContent(content, context);
  }
  return canShow && wantShow;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ThreesideDiffViewer.java

示例8: getComponent

import com.intellij.diff.DiffContext; //导入依赖的package包/类
@NotNull
@Override
public JComponent getComponent(@NotNull final DiffContext context) {
  final SimpleColoredComponent label = new SimpleColoredComponent();
  label.append("Can't show diff for unknown file type. ",
               new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getInactiveTextColor()));
  if (myFileName != null) {
    label.append("Associate", SimpleTextAttributes.LINK_ATTRIBUTES, new Runnable() {
      @Override
      public void run() {
        DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
          @Override
          public void run() {
            FileType type = FileTypeChooser.associateFileType(myFileName);
            if (type != null) onSuccess(context);
          }
        });
      }
    });
    LinkMouseListenerBase.installSingleTagOn(label);
  }
  return DiffUtil.createMessagePanel(label);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:UnknownFileTypeDiffRequest.java

示例9: DiffPanelBase

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public DiffPanelBase(@Nullable Project project,
                     @Nonnull DataProvider provider,
                     @Nonnull DiffContext context) {
  super(new BorderLayout());
  myProject = project;
  myDataProvider = provider;
  myContext = context;

  myCardLayout = new CardLayout();
  myContentPanel = new JPanel(myCardLayout);

  myNotificationsPanel = new JPanel();
  myNotificationsPanel.setLayout(new BoxLayout(myNotificationsPanel, BoxLayout.Y_AXIS));

  myNorthPanel = new Wrapper();
  mySouthPanel = new Wrapper();

  add(myContentPanel, BorderLayout.CENTER);
  add(myNorthPanel, BorderLayout.NORTH);
  add(mySouthPanel, BorderLayout.SOUTH);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:DiffPanelBase.java

示例10: checkForceReadOnly

import com.intellij.diff.DiffContext; //导入依赖的package包/类
@Nonnull
public static boolean[] checkForceReadOnly(@Nonnull DiffContext context, @Nonnull ContentDiffRequest request) {
  int contentCount = request.getContents().size();
  boolean[] result = new boolean[contentCount];

  if (DiffUtil.isUserDataFlagSet(DiffUserDataKeys.FORCE_READ_ONLY, request, context)) {
    Arrays.fill(result, true);
    return result;
  }

  boolean[] data = request.getUserData(DiffUserDataKeys.FORCE_READ_ONLY_CONTENTS);
  if (data != null && data.length == contentCount) {
    return data;
  }

  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:TextDiffViewerUtil.java

示例11: TwosideTextDiffViewer

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public TwosideTextDiffViewer(@Nonnull DiffContext context, @Nonnull ContentDiffRequest request) {
  super(context, request, TextEditorHolder.TextEditorHolderFactory.INSTANCE);

  new MyFocusOppositePaneAction(true).install(myPanel);
  new MyFocusOppositePaneAction(false).install(myPanel);

  myEditorSettingsAction = new SetEditorSettingsAction(getTextSettings(), getEditors());
  myEditorSettingsAction.applyDefaults();

  new MyOpenInEditorWithMouseAction().install(getEditors());

  myEditableEditors = TextDiffViewerUtil.getEditableEditors(getEditors());

  TextDiffViewerUtil.checkDifferentDocuments(myRequest);

  boolean editable1 = DiffUtil.canMakeWritable(getContent1().getDocument());
  boolean editable2 = DiffUtil.canMakeWritable(getContent2().getDocument());
  if (editable1 ^ editable2) {
    ProxyUndoRedoAction.register(getProject(), editable1 ? getEditor1() : getEditor2(), myPanel);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:TwosideTextDiffViewer.java

示例12: canShowRequest

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public static <T extends EditorHolder> boolean canShowRequest(@Nonnull DiffContext context,
                                                              @Nonnull DiffRequest request,
                                                              @Nonnull EditorHolderFactory<T> factory) {
  if (!(request instanceof ContentDiffRequest)) return false;

  List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
  if (contents.size() != 2) return false;

  DiffContent content1 = contents.get(0);
  DiffContent content2 = contents.get(1);

  if (content1 instanceof EmptyContent) {
    return factory.canShowContent(content2, context) && factory.wantShowContent(content2, context);
  }
  if (content2 instanceof EmptyContent) {
    return factory.canShowContent(content1, context) && factory.wantShowContent(content1, context);
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:OnesideDiffViewer.java

示例13: canShowRequest

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public static <T extends EditorHolder> boolean canShowRequest(@Nonnull DiffContext context,
                                                              @Nonnull DiffRequest request,
                                                              @Nonnull EditorHolderFactory<T> factory) {
  if (!(request instanceof ContentDiffRequest)) return false;

  List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
  if (contents.size() != 2) return false;

  boolean canShow = true;
  boolean wantShow = false;
  for (DiffContent content : contents) {
    canShow &= factory.canShowContent(content, context);
    wantShow |= factory.wantShowContent(content, context);
  }
  return canShow && wantShow;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:TwosideDiffViewer.java

示例14: canShowRequest

import com.intellij.diff.DiffContext; //导入依赖的package包/类
public static <T extends EditorHolder> boolean canShowRequest(@Nonnull DiffContext context,
                                                              @Nonnull DiffRequest request,
                                                              @Nonnull EditorHolderFactory<T> factory) {
  if (!(request instanceof ContentDiffRequest)) return false;

  List<DiffContent> contents = ((ContentDiffRequest)request).getContents();
  if (contents.size() != 3) return false;

  boolean canShow = true;
  boolean wantShow = false;
  for (DiffContent content : contents) {
    canShow &= factory.canShowContent(content, context);
    wantShow |= factory.wantShowContent(content, context);
  }
  return canShow && wantShow;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ThreesideDiffViewer.java

示例15: getComponent

import com.intellij.diff.DiffContext; //导入依赖的package包/类
@Nonnull
@Override
public JComponent getComponent(@Nonnull final DiffContext context) {
  final SimpleColoredComponent label = new SimpleColoredComponent();
  label.setTextAlign(SwingConstants.CENTER);
  label.append("Can't show diff for unknown file type. ",
               new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getInactiveTextColor()));
  if (myFileName != null) {
    label.append("Associate", SimpleTextAttributes.LINK_ATTRIBUTES, new Runnable() {
      @Override
      public void run() {
        FileType type = FileTypeChooser.associateFileType(myFileName);
        if (type != null) onSuccess(context);
      }
    });
    LinkMouseListenerBase.installSingleTagOn(label);
  }
  return JBUI.Panels.simplePanel(label).withBorder(JBUI.Borders.empty(5));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:UnknownFileTypeDiffRequest.java


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