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


Java DirDiffOperation類代碼示例

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


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

示例1: update

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Override
public final void update(AnActionEvent e) {
  final DirDiffTableModel model = SetOperationToBase.getModel(e);
  final JTable table = SetOperationToBase.getTable(e);
  if (table != null && model != null) {
    for (DirDiffElementImpl element : model.getSelectedElements()) {
      if (element.getOperation() != DirDiffOperation.NONE) {
        e.getPresentation().setEnabled(true);
        return;
      }
    }
  }
  e.getPresentation().setEnabled(false);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:SetNoOperation.java

示例2: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@NotNull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.COPY_TO;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:SetCopyToRight.java

示例3: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@NotNull
protected abstract DirDiffOperation getOperation();
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:3,代碼來源:SetOperationToBase.java

示例4: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@NotNull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.COPY_FROM;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:SetCopyToLeft.java

示例5: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@NotNull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.DELETE;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:SetDelete.java

示例6: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@NotNull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.NONE;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:SetDefault.java

示例7: getTableCellRendererComponent

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Override
public Component getTableCellRendererComponent(final JTable table, Object value, boolean isSelected, boolean hasFocus, final int row, final int column) {
  final DirDiffTableModel model = (DirDiffTableModel)table.getModel();
  final DirDiffElementImpl element = model.getElementAt(row);
  if (element == null) return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  final int modelColumn = table.convertColumnIndexToModel(column);

  if (element.isSeparator()) {
    return new SimpleColoredComponent() {
      {
        setIcon(ObjectUtils.chooseNotNull(element.getSourceIcon(), element.getTargetIcon()));
        append(element.getName());
      }
      @Override
      protected void doPaint(Graphics2D g) {
        int offset = 0;
        int i = 0;
        final TableColumnModel columnModel = table.getColumnModel();
        while (i < column) {
          offset += columnModel.getColumn(i).getWidth();
          i++;
        }
        g.translate(-offset, 0);
        super.doPaint(g);
        g.translate(offset, 0);
      }
    };
  }
  final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  if (c instanceof JLabel) {
    final JLabel label = (JLabel)c;
    Border border = label.getBorder();
    if ((hasFocus || isSelected) && border != null) {
      label.setBorder(new EmptyBorder(border.getBorderInsets(label)));
    }
    label.setIcon(null);

    final DirDiffOperation op = element.getOperation();
    if (modelColumn == (table.getColumnCount() - 1) / 2) {
      label.setIcon(op.getIcon());
      label.setHorizontalAlignment(CENTER);
      return label;
    }

    Color fg = isSelected ? UIUtil.getTableSelectionForeground() : op.getTextColor();
    label.setForeground(fg);
    final String name = table.getColumnName(column);
    if (DirDiffTableModel.COLUMN_DATE.equals(name)) {
      label.setHorizontalAlignment(CENTER);
    } else if (DirDiffTableModel.COLUMN_SIZE.equals(name)) {
      label.setHorizontalAlignment(RIGHT);
    } else {
      label.setHorizontalAlignment(LEFT);
      final String text = label.getText();
      label.setText("  " + text);
      if (text != null && text.trim().length() > 0) {
        label.setIcon(modelColumn == 0 ? element.getSourceIcon() : element.getTargetIcon());
      }
    }
  }
  return c;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:63,代碼來源:DirDiffTableCellRenderer.java

示例8: getTableCellRendererComponent

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Override
public Component getTableCellRendererComponent(final JTable table, Object value, boolean isSelected, boolean hasFocus, final int row, final int column) {
  final DirDiffTableModel model = (DirDiffTableModel)table.getModel();
  final DirDiffElementImpl element = model.getElementAt(row);
  if (element == null) return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  final int modelColumn = table.convertColumnIndexToModel(column);

  if (element.isSeparator()) {
    return new SimpleColoredComponent() {
      {
        setIcon(ObjectUtils.chooseNotNull(element.getSourceIcon(), element.getTargetIcon()));
        append(element.getName());
      }
      @Override
      protected void doPaint(Graphics2D g) {
        int offset = 0;
        int i = 0;
        final TableColumnModel columnModel = table.getColumnModel();
        while (i < column) {
          offset += columnModel.getColumn(i).getWidth();
          i++;
        }
        g.translate(-offset, 0);
        super.doPaint(g);
        g.translate(offset, 0);
      }
    };
  }
  final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  if (c instanceof JLabel) {
    final JLabel label = (JLabel)c;
    if (hasFocus || isSelected) {
      label.setBorder(noFocusBorder);
    }
    label.setIcon(null);

    final DirDiffOperation op = element.getOperation();
    if (modelColumn == (table.getColumnCount() - 1) / 2) {
      label.setIcon(op.getIcon());
      label.setHorizontalAlignment(CENTER);
      return label;
    }

    Color fg = isSelected ? UIUtil.getTableSelectionForeground() : op.getTextColor();
    label.setForeground(fg);
    final String name = table.getColumnName(column);
    if (DirDiffTableModel.COLUMN_DATE.equals(name)) {
      label.setHorizontalAlignment(CENTER);
    } else if (DirDiffTableModel.COLUMN_SIZE.equals(name)) {
      label.setHorizontalAlignment(RIGHT);
    } else {
      label.setHorizontalAlignment(LEFT);
      final String text = label.getText();
      label.setText("  " + text);
      if (text != null && text.trim().length() > 0) {
        label.setIcon(modelColumn == 0 ? element.getSourceIcon() : element.getTargetIcon());
      }
    }
  }
  return c;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:62,代碼來源:DirDiffTableCellRenderer.java

示例9: getTableCellRendererComponent

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Override
public Component getTableCellRendererComponent(final JTable table, Object value, boolean isSelected, boolean hasFocus, final int row, final int column) {
  final DirDiffTableModel model = (DirDiffTableModel)table.getModel();
  final DirDiffElementImpl element = model.getElementAt(row);
  if (element == null) return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  final int modelColumn = table.convertColumnIndexToModel(column);

  if (element.isSeparator()) {
    return new SimpleColoredComponent() {
      {
        setIcon(ObjectUtil.chooseNotNull(element.getSourceIcon(), element.getTargetIcon()));
        append(element.getName());
      }
      @Override
      protected void doPaint(Graphics2D g) {
        int offset = 0;
        int i = 0;
        final TableColumnModel columnModel = table.getColumnModel();
        while (i < column) {
          offset += columnModel.getColumn(i).getWidth();
          i++;
        }
        g.translate(-offset, 0);
        super.doPaint(g);
        g.translate(offset, 0);
      }
    };
  }
  final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
  if (c instanceof JLabel) {
    final JLabel label = (JLabel)c;
    Border border = label.getBorder();
    if ((hasFocus || isSelected) && border != null) {
      label.setBorder(new EmptyBorder(border.getBorderInsets(label)));
    }
    label.setIcon(null);

    final DirDiffOperation op = element.getOperation();
    if (modelColumn == (table.getColumnCount() - 1) / 2) {
      label.setIcon(op.getIcon());
      label.setHorizontalAlignment(CENTER);
      return label;
    }

    Color fg = isSelected ? UIUtil.getTableSelectionForeground() : op.getTextColor();
    label.setForeground(fg);
    final String name = table.getColumnName(column);
    if (DirDiffTableModel.COLUMN_DATE.equals(name)) {
      label.setHorizontalAlignment(CENTER);
    } else if (DirDiffTableModel.COLUMN_SIZE.equals(name)) {
      label.setHorizontalAlignment(RIGHT);
    } else {
      label.setHorizontalAlignment(LEFT);
      final String text = label.getText();
      label.setText("  " + text);
      if (text != null && text.trim().length() > 0) {
        label.setIcon(modelColumn == 0 ? element.getSourceIcon() : element.getTargetIcon());
      }
    }
  }
  return c;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:63,代碼來源:DirDiffTableCellRenderer.java

示例10: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Nonnull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.COPY_TO;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:6,代碼來源:SetCopyToRight.java

示例11: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Nonnull
protected abstract DirDiffOperation getOperation();
 
開發者ID:consulo,項目名稱:consulo,代碼行數:3,代碼來源:SetOperationToBase.java

示例12: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Nonnull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.COPY_FROM;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:6,代碼來源:SetCopyToLeft.java

示例13: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Nonnull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.DELETE;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:6,代碼來源:SetDelete.java

示例14: getOperation

import com.intellij.ide.diff.DirDiffOperation; //導入依賴的package包/類
@Nonnull
@Override
protected DirDiffOperation getOperation() {
  return DirDiffOperation.NONE;
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:6,代碼來源:SetDefault.java


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