当前位置: 首页>>代码示例>>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;未经允许,请勿转载。