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