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


Java JBTable.getSelectedRow方法代码示例

本文整理汇总了Java中com.intellij.ui.table.JBTable.getSelectedRow方法的典型用法代码示例。如果您正苦于以下问题:Java JBTable.getSelectedRow方法的具体用法?Java JBTable.getSelectedRow怎么用?Java JBTable.getSelectedRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.table.JBTable的用法示例。


在下文中一共展示了JBTable.getSelectedRow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addPackageToPackages

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private static void addPackageToPackages(JBTable table, PackageEntryTable list) {
  int selected = table.getSelectedRow() + 1;
  if (selected < 0) {
    selected = list.getEntryCount();
  }
  PackageEntry entry = new PackageEntry(false, "", true);
  list.insertEntryAt(entry, selected);
  ImportLayoutPanel.refreshTableModel(selected, table);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PackagePanel.java

示例2: removeEntryFromPackages

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private static void removeEntryFromPackages(JBTable table, PackageEntryTable list) {
  int selected = table.getSelectedRow();
  if (selected < 0) return;
  TableUtil.stopEditing(table);
  list.removeEntryAt(selected);
  AbstractTableModel model = (AbstractTableModel)table.getModel();
  model.fireTableRowsDeleted(selected, selected);
  if (selected >= list.getEntryCount()) {
    selected--;
  }
  if (selected >= 0) {
    table.setRowSelectionInterval(selected, selected);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PackagePanel.java

示例3: addGeneralComment

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void addGeneralComment(@NotNull final Project project, DataContext dataContext) {
  final CommentForm commentForm = new CommentForm(project, true, myIsReply, null);
  commentForm.setReview(myReview);

  if (myIsReply) {
    final JBTable contextComponent = (JBTable)getContextComponent();
    final int selectedRow = contextComponent.getSelectedRow();
    if (selectedRow >= 0) {
      final Object parentComment = contextComponent.getValueAt(selectedRow, 0);
      if (parentComment instanceof Comment) {
        commentForm.setParentComment(((Comment)parentComment));
      }
    }
    else return;
  }

  final JBPopup balloon = CommentBalloonBuilder.getNewCommentBalloon(commentForm, myIsReply ? CrucibleBundle
    .message("crucible.new.reply.$0", commentForm.getParentComment().getPermId()) :
                                                                                  CrucibleBundle
                                                                                    .message("crucible.new.comment.$0",
                                                                                             myReview.getPermaId()));
  balloon.addListener(new JBPopupAdapter() {
    @Override
    public void onClosed(LightweightWindowEvent event) {
      if(!commentForm.getText().isEmpty()) { // do not try to save draft if text is empty
        commentForm.postComment();
      }
      final JComponent component = getContextComponent();
      if (component instanceof GeneralCommentsTree) {
        ((GeneralCommentsTree)component).refresh();
      }
    }
  });

  commentForm.setBalloon(balloon);
  balloon.showInBestPositionFor(dataContext);
  commentForm.requestFocus();
}
 
开发者ID:ktisha,项目名称:Crucible4IDEA,代码行数:39,代码来源:AddCommentAction.java

示例4: FocusTracesDialog

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public FocusTracesDialog(Project project, ArrayList<FocusRequestInfo> requests) {
  super(project);
  myRequests = requests;
  setTitle("Focus Traces");
  final String[][] data = new String[requests.size()][];
  for (int i = 0; i < data.length; i++) {
    final FocusRequestInfo r = requests.get(i);
    data[i] = new String[]{r.getDate(), String.valueOf(r.isForced()), String.valueOf(r.getComponent())};
  }
  setModal(false);
  myRequestsTable = new JBTable(new DefaultTableModel(data, COLUMNS) {
    @Override
    public boolean isCellEditable(int row, int column) {
      return false;
    }
  });
  final ListSelectionListener selectionListener = new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      final int index = myRequestsTable.getSelectedRow();
      if (-1 < index && index < myRequests.size()) {
        myStacktrace.setText(myRequests.get(index).getStackTrace());
        myStacktrace.setCaretPosition(0);
      }
      else {
        myStacktrace.setText("");
      }
    }
  };
  myRequestsTable.getSelectionModel().addListSelectionListener(selectionListener);
  final TableColumnModel columnModel = myRequestsTable.getColumnModel();
  columnModel.getColumn(0).setMinWidth(120);
  columnModel.getColumn(0).setMaxWidth(120);
  columnModel.getColumn(0).setPreferredWidth(120);
  columnModel.getColumn(1).setMinWidth(60);
  columnModel.getColumn(1).setMaxWidth(60);
  columnModel.getColumn(1).setPreferredWidth(60);
  myRequestsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myRequestsTable.changeSelection(0, 0, false, true);
  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:FocusTracesDialog.java


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