當前位置: 首頁>>代碼示例>>Java>>正文


Java DiffPanelOptions類代碼示例

本文整理匯總了Java中com.intellij.openapi.diff.ex.DiffPanelOptions的典型用法代碼示例。如果您正苦於以下問題:Java DiffPanelOptions類的具體用法?Java DiffPanelOptions怎麽用?Java DiffPanelOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DiffPanelOptions類屬於com.intellij.openapi.diff.ex包,在下文中一共展示了DiffPanelOptions類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createCenterPanel

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
@Nullable
@Override
protected JComponent createCenterPanel() {
  final Project project = myOldMethod.getProject();
  final DiffPanelEx diffPanel = (DiffPanelEx)DiffManager.getInstance().createDiffPanel(null, project, getDisposable(), null);
  diffPanel.setComparisonPolicy(ComparisonPolicy.IGNORE_SPACE);
  diffPanel.setHighlightMode(HighlightMode.BY_WORD);
  DiffPanelOptions diffPanelOptions = diffPanel.getOptions();
  diffPanelOptions.setShowSourcePolicy(DiffPanelOptions.ShowSourcePolicy.OPEN_EDITOR);
  diffPanelOptions.setRequestFocusOnNewContent(false);
  SimpleDiffRequest request = new SimpleDiffRequest(project, null);
  final String oldContent = myOldMethod.getText() + "\n\n\nmethod call:\n " + myOldCall.getText();
  final String newContent = myNewMethod.getText() + "\n\n\nmethod call:\n " + myNewCall.getText();
  request.setContents(new SimpleContent(oldContent), new SimpleContent(newContent));
  request.setContentTitles("Before", "After");
  diffPanel.setDiffRequest(request);
  
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(diffPanel.getComponent(), BorderLayout.CENTER);
  panel.setBorder(IdeBorderFactory.createEmptyBorder(new Insets(5, 0, 0, 0)));
  return panel;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:ExtractMethodSignatureSuggester.java

示例2: createPanel

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
private DiffPanel createPanel(final boolean horizontal) {
  final DiffPanel diffPanel = new DiffPanelImpl(null, myProject, false, horizontal, SHORT_DIFF_DIVIDER_POLYGONS_OFFSET, null) {
    @Override
    protected DiffPanelState createDiffPanelState(@NotNull Disposable parentDisposable) {
      return new FragmentedDiffPanelState(this, myProject, getDiffDividerPolygonsOffset(), ! horizontal, parentDisposable);
    }
  };
  diffPanel.enableToolbar(false);
  diffPanel.removeStatusBar();
  DiffPanelOptions o = ((DiffPanelEx)diffPanel).getOptions();
  o.setRequestFocusOnNewContent(false);
  Disposer.register(this, diffPanel);
  return diffPanel;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:ChangesFragmentedDiffPanel.java

示例3: BinaryDiffDetailsPanel

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
private BinaryDiffDetailsPanel(Project project, BackgroundTaskQueue queue, final Change change) {
  super(project, "Loading change content", queue);
  myProject = project;
  myFilePath = ChangesUtil.getFilePath(change);
  myRequestFromChange = new BinaryDiffRequestFromChange(myProject);
  myChangeListManager = ChangeListManager.getInstance(myProject);

  myPanel = DiffManager.getInstance().createDiffPanel(null, myProject, this, BinaryDiffTool.INSTANCE);
  myPanel.enableToolbar(false);
  myPanel.removeStatusBar();
  DiffPanelOptions o = ((DiffPanelEx)myPanel).getOptions();
  o.setRequestFocusOnNewContent(false);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:VcsChangeDetailsManager.java

示例4: createDiffPanel

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
@Override
protected Pair<JComponent, Dimension> createDiffPanel(JPanel root, ExcludingTraversalPolicy traversalPolicy) {
  myDiffPanel = DiffManager.getInstance().createDiffPanel(getFrame(), myProject, this, null);
  DiffPanelOptions o = ((DiffPanelEx)myDiffPanel).getOptions();
  o.setRequestFocusOnNewContent(false);
  return Pair.create((JComponent)myDiffPanel.getComponent(), null);
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:8,代碼來源:FileHistoryDialog.java

示例5: createPanel

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
private DiffPanel createPanel(final boolean horizontal) {
  final DiffPanel diffPanel = new DiffPanelImpl(null, myProject, false, horizontal, SHORT_DIFF_DIVIDER_POLYGONS_OFFSET, null) {
    @Override
    protected DiffPanelState createDiffPanelState(@NotNull Disposable parentDisposable) {
      return new FragmentedDiffPanelState(this, myProject, ! horizontal, parentDisposable);
    }
  };
  diffPanel.enableToolbar(false);
  diffPanel.removeStatusBar();
  DiffPanelOptions o = ((DiffPanelEx)diffPanel).getOptions();
  o.setRequestFocusOnNewContent(false);
  Disposer.register(this, diffPanel);
  return diffPanel;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:15,代碼來源:ChangesFragmentedDiffPanel.java

示例6: DiffPanelImpl

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
public DiffPanelImpl(final Window owner,
                     @NotNull Project project,
                     boolean enableToolbar,
                     boolean horizontal,
                     int diffDividerPolygonsOffset,
                     DiffTool parentTool) {
  myProject = project;
  myIsHorizontal = horizontal;
  myParentTool = parentTool;
  myOptions = new DiffPanelOptions(this);
  myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null);
  myPanel.disableToolbar(!enableToolbar);
  if (enableToolbar) myPanel.resetToolbar();
  myOwnerWindow = owner;
  myIsSyncScroll = true;
  final boolean v = !horizontal;
  myLeftSide =  new DiffSideView(this, new CustomLineBorder(1, 0, v ? 0 : 1, v ? 0 : 1));
  myRightSide = new DiffSideView(this, new CustomLineBorder(v ? 0 : 1, v ? 0 : 1, 1, 0));
  myLeftSide.becomeMaster();
  myDiffUpdater = new Rediffers(this);

  myDiffDividerPolygonsOffset = diffDividerPolygonsOffset;

  myData = createDiffPanelState(this);

  if (horizontal) {
    mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(),
                                  new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData);
  }
  else {
    mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent());
  }

  myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel());
  myDataProvider = new MyGenericDataProvider(this);
  myPanel.setDataProvider(myDataProvider);

  ComparisonPolicy comparisonPolicy = getComparisonPolicy();
  if (comparisonPolicy != DiffManagerImpl.getInstanceEx().getComparisonPolicy()) {
    setComparisonPolicy(comparisonPolicy);
  }

  HighlightMode highlightMode = getHighlightMode();
  if (highlightMode != DiffManagerImpl.getInstanceEx().getHighlightMode()) {
    setHighlightMode(highlightMode);
  }

  myVisibleAreaListener = new VisibleAreaListener() {
    @Override
    public void visibleAreaChanged(VisibleAreaEvent e) {
      Editor editor1 = getEditor1();
      if (editor1 != null) {
        editor1.getComponent().repaint();
      }
      Editor editor2 = getEditor2();
      if (editor2 != null) {
        editor2.getComponent().repaint();
      }
    }
  };
  registerActions();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:63,代碼來源:DiffPanelImpl.java

示例7: getOptions

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
public DiffPanelOptions getOptions() {
  return myOptions;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:DiffPanelImpl.java

示例8: askReloadFromDisk

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
protected boolean askReloadFromDisk(final VirtualFile file, final Document document) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (!isDocumentUnsaved(document)) return true;

  String message = UIBundle.message("file.cache.conflict.message.text", file.getPresentableUrl());
  if (ApplicationManager.getApplication().isUnitTestMode()) throw new RuntimeException(message);
  final DialogBuilder builder = new DialogBuilder((Project)null);
  builder.setCenterPanel(new JLabel(message, Messages.getQuestionIcon(), SwingConstants.CENTER));
  builder.addOkAction().setText(UIBundle.message("file.cache.conflict.load.fs.changes.button"));
  builder.addCancelAction().setText(UIBundle.message("file.cache.conflict.keep.memory.changes.button"));
  builder.addAction(new AbstractAction(UIBundle.message("file.cache.conflict.show.difference.button")) {
    @Override
    public void actionPerformed(ActionEvent e) {
      String title = UIBundle.message("file.cache.conflict.for.file.dialog.title", file.getPresentableUrl());
      final ProjectEx project = (ProjectEx)ProjectLocator.getInstance().guessProjectForFile(file);

      SimpleDiffRequest request = new SimpleDiffRequest(project, title);
      FileType fileType = file.getFileType();
      String fsContent = LoadTextUtil.loadText(file).toString();
      request.setContents(new SimpleContent(fsContent, fileType),
                          new DocumentContent(project, document, fileType));
      request.setContentTitles(UIBundle.message("file.cache.conflict.diff.content.file.system.content"),
                               UIBundle.message("file.cache.conflict.diff.content.memory.content"));
      DialogBuilder diffBuilder = new DialogBuilder(project);
      DiffPanelImpl diffPanel = (DiffPanelImpl)DiffManager.getInstance().createDiffPanel(diffBuilder.getWindow(), project, diffBuilder, null);
      diffPanel.getOptions().setShowSourcePolicy(DiffPanelOptions.ShowSourcePolicy.DONT_SHOW);
      diffBuilder.setCenterPanel(diffPanel.getComponent());
      diffBuilder.setDimensionServiceKey("FileDocumentManager.FileCacheConflict");
      diffPanel.setDiffRequest(request);
      diffBuilder.addOkAction().setText(UIBundle.message("file.cache.conflict.save.changes.button"));
      diffBuilder.addCancelAction();
      diffBuilder.setTitle(title);
      if (diffBuilder.show() == DialogWrapper.OK_EXIT_CODE) {
        builder.getDialogWrapper().close(DialogWrapper.CANCEL_EXIT_CODE);
      }
    }
  });
  builder.setTitle(UIBundle.message("file.cache.conflict.dialog.title"));
  builder.setButtonsAlignment(SwingConstants.CENTER);
  builder.setHelpId("reference.dialogs.fileCacheConflict");
  return builder.show() == 0;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:43,代碼來源:FileDocumentManagerImpl.java

示例9: DiffPanelImpl

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
public DiffPanelImpl(final Window owner,
                     Project project,
                     boolean enableToolbar,
                     boolean horizontal,
                     int diffDividerPolygonsOffset,
                     DiffTool parentTool) {
  myProject = project;
  myIsHorizontal = horizontal;
  myParentTool = parentTool;
  myOptions = new DiffPanelOptions(this);
  myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null);
  myPanel.disableToolbar(!enableToolbar);
  if (enableToolbar) myPanel.resetToolbar();
  myOwnerWindow = owner;
  myIsSyncScroll = true;
  final boolean v = !horizontal;
  myLeftSide =  new DiffSideView(this, new CustomLineBorder(UIUtil.getBorderColor(), 1, 0, v ? 0 : 1, v ? 0 : 1));
  myRightSide = new DiffSideView(this, new CustomLineBorder(UIUtil.getBorderColor(), v ? 0 : 1, v ? 0 : 1, 1, 0));
  myLeftSide.becomeMaster();
  myDiffUpdater = new Rediffers(this);

  myData = createDiffPanelState(this);

  if (horizontal) {
    mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(),
                                  new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData);
  }
  else {
    mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent());
  }

  myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel());
  myDataProvider = new MyGenericDataProvider(this);
  myPanel.setDataProvider(myDataProvider);

  final ComparisonPolicy comparisonPolicy = getComparisonPolicy();
  final ComparisonPolicy defaultComparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy();

  if (defaultComparisonPolicy != null && comparisonPolicy != defaultComparisonPolicy) {
    setComparisonPolicy(defaultComparisonPolicy);
  }
  myVisibleAreaListener = new VisibleAreaListener() {
    @Override
    public void visibleAreaChanged(VisibleAreaEvent e) {
      Editor editor1 = getEditor1();
      if (editor1 != null) {
        editor1.getComponent().repaint();
      }
      Editor editor2 = getEditor2();
      if (editor2 != null) {
        editor2.getComponent().repaint();
      }
    }
  };
  registerActions();
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:57,代碼來源:DiffPanelImpl.java

示例10: DiffPanelImpl

import com.intellij.openapi.diff.ex.DiffPanelOptions; //導入依賴的package包/類
public DiffPanelImpl(final Window owner, @Nonnull Project project, boolean enableToolbar, boolean horizontal, int diffDividerPolygonsOffset, DiffTool parentTool) {
  myProject = project;
  myIsHorizontal = horizontal;
  myParentTool = parentTool;
  myOptions = new DiffPanelOptions(this);
  myPanel = new DiffPanelOuterComponent(TextDiffType.DIFF_TYPES, null);
  myPanel.disableToolbar(!enableToolbar);
  if (enableToolbar) myPanel.resetToolbar();
  myOwnerWindow = owner;
  myIsSyncScroll = true;
  final boolean v = !horizontal;
  myLeftSide = new DiffSideView(this, new CustomLineBorder(1, 0, v ? 0 : 1, v ? 0 : 1));
  myRightSide = new DiffSideView(this, new CustomLineBorder(v ? 0 : 1, v ? 0 : 1, 1, 0));
  myLeftSide.becomeMaster();
  myDiffUpdater = new Rediffers(this);

  myDiffDividerPolygonsOffset = diffDividerPolygonsOffset;

  myData = createDiffPanelState(this);

  if (horizontal) {
    mySplitter = new DiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent(), new DiffDividerPaint(this, FragmentSide.SIDE1, diffDividerPolygonsOffset), myData);
  }
  else {
    mySplitter = new HorizontalDiffSplitter(myLeftSide.getComponent(), myRightSide.getComponent());
  }

  myPanel.insertDiffComponent(mySplitter.getComponent(), new MyScrollingPanel());
  myDataProvider = new MyGenericDataProvider(this);
  myPanel.setDataProvider(myDataProvider);

  final ComparisonPolicy comparisonPolicy = getComparisonPolicy();
  final ComparisonPolicy defaultComparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy();
  final HighlightMode highlightMode = getHighlightMode();
  final HighlightMode defaultHighlightMode = DiffManagerImpl.getInstanceEx().getHighlightMode();

  if (defaultComparisonPolicy != null && comparisonPolicy != defaultComparisonPolicy) {
    setComparisonPolicy(defaultComparisonPolicy);
  }
  if (defaultHighlightMode != null && highlightMode != defaultHighlightMode) {
    setHighlightMode(defaultHighlightMode);
  }
  myVisibleAreaListener = new VisibleAreaListener() {
    @Override
    public void visibleAreaChanged(VisibleAreaEvent e) {
      Editor editor1 = getEditor1();
      if (editor1 != null) {
        editor1.getComponent().repaint();
      }
      Editor editor2 = getEditor2();
      if (editor2 != null) {
        editor2.getComponent().repaint();
      }
    }
  };
  registerActions();
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:58,代碼來源:DiffPanelImpl.java


注:本文中的com.intellij.openapi.diff.ex.DiffPanelOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。