本文整理汇总了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);
}
示例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);
}
}
示例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();
}
示例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();
}