org.fife.ui.search.ReplaceInFilesTable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rtext Show documentation
Show all versions of rtext Show documentation
RText is a powerful, cross-platform programmer's text editor written in Java. It is designed
to be easy to use, highly customizable and flexible. Part of RText's design is for the source code
to be simple, easy to understand, and well documented, so that other programmers can look into its
inner-workings and figure out how RText ticks with ease. A good place to start (besides the source
code) is the Javadoc for all classes used in the project.
/*
* 9/19/2006
*
* ReplaceInFilesTable.java - A table listing replace results in a Replace
* in Files dialog.
* Copyright (C) 2006 Robert Futrell
* http://fifesoft.com/rtext
* Licensed under a modified BSD license.
* See the included license file for details.
*/
package org.fife.ui.search;
import java.util.ResourceBundle;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumnModel;
/**
* The table used to display search results in a
* ReplaceInFilesDialog
.
*
* @author Robert Futrell
* @version 1.0
*/
public class ReplaceInFilesTable extends FindInFilesTable {
/**
* Return the vector of data to display in the table for a
* match data instance.
*
* @param fileName The (relative) filename.
* @param data The match data.
* @return The vector.
*/
protected Vector createMatchDataVector(String fileName, MatchData data) {
Vector v = new Vector(2);
v.add(fileName);
v.add(data.getLineText());
return v;
}
/**
* Returns the table model to use.
*
* @param msg The resource bundle.
* @return The table model.
*/
protected DefaultTableModel createTableModel(ResourceBundle msg) {
DefaultTableModel model = new DefaultTableModel();
model.addColumn(msg.getString("FindInFiles.Column.File"));
model.addColumn(msg.getString("ReplaceInFiles.Column.Replacement"));
return model;
}
/**
* Initializes the column widths.
*/
protected void initColumnWidths() {
TableColumnModel columnModel = getColumnModel();
columnModel.getColumn(0).setPreferredWidth(100);
columnModel.getColumn(1).setPreferredWidth(60);
}
}