當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。