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


Java RevisionItem类代码示例

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


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

示例1: RevisionsList

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
public RevisionsList(SelectionListener l) {
  table = new JBTable();
  table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap()));

  table.setTableHeader(null);
  table.setShowGrid(false);
  table.setRowMargin(0);
  table.getColumnModel().setColumnMargin(0);

  table.resetDefaultFocusTraversalKeys();

  table.setDefaultRenderer(Object.class, new MyCellRenderer(table));

  table.getEmptyText().setText(VcsBundle.message("history.empty"));

  addSelectionListener(l);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RevisionsList.java

示例2: updateData

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
public void updateData(HistoryDialogModel model) {
  Set<Long> sel = new THashSet<Long>();
  MyModel m = (MyModel)table.getModel();
  for (int i : table.getSelectedRows()) {
    if (i >= m.getRowCount()) continue;
    sel.add(m.getValueAt(i, 0).revision.getChangeSetId());
  }

  List<RevisionItem> newRevs = model.getRevisions();

  Date today = new Date();

  Map<RevisionItem, Period> periods = new THashMap<RevisionItem, Period>();
  for (int i = 0; i < newRevs.size(); i++) {
    RevisionItem each = newRevs.get(i);
    boolean recent = today.getTime() - each.revision.getTimestamp() < 1000 * 60 * 60 * RECENT_PERIOD;
    if (recent) {
      if (i == 0) {
        periods.put(each, Period.RECENT);
      }
    }
    else {
      periods.put(each, periods.isEmpty() ? Period.OLD : Period.OLDER);
      break;
    }
  }

  table.setModel(new MyModel(newRevs, periods));

  for (int i = 0; i < newRevs.size(); i++) {
    RevisionItem r = newRevs.get(i);
    if (sel.contains(r.revision.getChangeSetId())) {
      table.getSelectionModel().addSelectionInterval(i, i);
    }
  }
  if (table.getSelectionModel().isSelectionEmpty()) {
    table.getSelectionModel().addSelectionInterval(0, 0);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:RevisionsList.java

示例3: testRevisionsList

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
@Test
public void testRevisionsList() {
  List<RevisionItem> rr = m.getRevisions();

  assertEquals(3, rr.size());
  assertEquals("3", rr.get(0).revision.getChangeSetName());
  assertEquals("2", rr.get(1).revision.getChangeSetName());
  assertEquals("1", rr.get(2).revision.getChangeSetName());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HistoryDialogModelTest.java

示例4: findRevisionIndexToRevert

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
static int findRevisionIndexToRevert(@Nonnull HistoryDialogModel dirHistoryModel, @Nonnull LabelImpl label) {
  List<RevisionItem> revs = dirHistoryModel.getRevisions();
  for (int i = 0; i < revs.size(); i++) {
    final RevisionItem rev = revs.get(i);
    if (isLabelRevision(rev, label)) return i;
    //when lvcs model is not constructed yet or is empty then PutLabelChange is created but without label, so we need to scan revisions themselves
    if (isChangeWithId(rev.revision, label.getLabelChangeId())) return i;
  }
  return -1;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:LocalHistoryUtil.java

示例5: MyModel

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
public MyModel(List<RevisionItem> revisions, Map<RevisionItem, Period> periods) {
  myRevisions = revisions;
  myPeriods = periods;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RevisionsList.java

示例6: getValueAt

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
public RevisionItem getValueAt(int rowIndex, int columnIndex) {
  return myRevisions.get(rowIndex);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RevisionsList.java

示例7: getPeriod

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
public Period getPeriod(RevisionItem r) {
  return myPeriods.get(r);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:RevisionsList.java

示例8: getTableCellRendererComponent

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
  if (value == null) return myWrapperPanel; // null erroneously comes from JPanel.getAccessibleChild

  RevisionItem r = (RevisionItem)value;
  LabelsAndColor labelsAndColor = getLabelsAndColor(r);

  final Period p = ((MyModel)table.getModel()).getPeriod(r);
  if (p == null) {
    myPeriodLabel.setVisible(false);
  }
  else {
    myPeriodLabel.setVisible(true);
    myPeriodLabel.setCaption(p.getDisplayString());
  }

  myBorder.set(row == table.getModel().getRowCount() - 1);

  myDateLabel.setText(ensureString(DateFormatUtil.formatPrettyDateTime(r.revision.getTimestamp())));
  myFilesCountLabel.setText(ensureString(labelsAndColor.filesCount));

  myTitleLabel.setFont(myTitleLabel.getFont().deriveFont(labelsAndColor.isNamed ? Font.BOLD : Font.PLAIN));
  myTitleLabel.setText(ensureString(labelsAndColor.title));

  JComponent orig = (JComponent)myTemplate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);

  if (labelsAndColor.label == null) {
    myLabelPanel.setVisible(false);
  }
  else {
    myLabelPanel.setVisible(true);
    myLabelLabel.setBackground(labelsAndColor.label.second);
    myLabelContainer.set(labelsAndColor.label.second);
    myLabelLabel.setText(ensureString(labelsAndColor.label.first));
  }

  Color fg = orig.getForeground();
  Color bg = isSelected && !table.isFocusOwner() ? UIUtil.getListUnfocusedSelectionBackground() : orig.getBackground();

  myDateLabel.setForeground(isSelected ? fg : JBColor.GRAY);
  myFilesCountLabel.setForeground(myDateLabel.getForeground());
  myTitleLabel.setForeground(isSelected || labelsAndColor.isNamed ? fg : JBColor.DARK_GRAY);

  myItemPanel.setBackground(bg);

  myWrapperPanel.doLayout();
  int height = myWrapperPanel.getPreferredSize().height;
  //table.setRowHeight causes extra repaint of the table, so we try to avoid it.
  if (table.getRowHeight(row) != height && height > 0) {
    table.setRowHeight(row, height);
  }

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

示例9: isLabelRevision

import com.intellij.history.integration.ui.models.RevisionItem; //导入依赖的package包/类
static boolean isLabelRevision(@Nonnull RevisionItem rev, @Nonnull LabelImpl label) {
  final long targetChangeId = label.getLabelChangeId();
  return ContainerUtil.exists(rev.labels, revision -> isChangeWithId(revision, targetChangeId));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:LocalHistoryUtil.java


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