CPD Results
The following document contains the results of PMD's CPD 7.17.0.
Duplications
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
265 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
236 |
String[] extensions = new String[]{"pdf", "PDF"};
for (File file : fileList) {
fileSet.addAll(FileUtils.listFiles(file, extensions, isRecursiveSearched));
}
List<Future<?>> futures = new ArrayList<>();
totalFiles = fileSet.size();
updateProgress();
for (File file : fileSet) {
if (currentThread().isInterrupted()) {
return;
}
futures.add(executorService.submit(() -> {
if (currentThread().isInterrupted()) {
return null;
}
processFile(file);
incrementProcessedFiles();
return null;
}));
}
// Wait for all tasks to complete
for (Future<?> future : futures) {
try {
future.get();
} catch (InterruptedException e) {
logger.error("Search interrupted", e);
currentThread().interrupt(); // Restore interrupted status
return;
}
}
showResult();
} catch (Exception e) {
logger.error("Search failed", e);
SwingUtilities.invokeLater(() -> progressBar.setString("Search failed"));
} finally {
executorService.shutdown();
SwingUtilities.invokeLater(() -> {
statButton.setEnabled(true);
cancelButton.setEnabled(false);
});
}
}
private void incrementProcessedFiles() {
processedFiles.incrementAndGet();
updateProgress();
}
private void updateProgress() {
if (totalFiles > 0) {
SwingUtilities.invokeLater(() -> {
int processed = processedFiles.get();
int percentage = (int) (processed * 100.0 / totalFiles);
progressBar.setValue(percentage);
progressBar.setString(String.format("Processing: %d/%d files (%d%%)", processed, totalFiles, percentage));
});
}
}
}
} |
| File |
Line |
| edu\jiangxin\apktoolbox\file\checksum\panel\FileChecksumPanel.java |
113 |
| edu\jiangxin\apktoolbox\file\checksum\panel\StringHashPanel.java |
104 |
lastModifiedTimeOptionPanel.add(lastModifiedTimeTextField);
md5OptionPanel.setLayout(new BoxLayout(md5OptionPanel, BoxLayout.X_AXIS));
md5CheckBox = new JCheckBox("MD5 checksum:");
md5CheckBox.setSelected(true);
md5TextField = new JTextField();
md5OptionPanel.add(md5CheckBox);
md5OptionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
md5OptionPanel.add(md5TextField);
sha1OptionPanel.setLayout(new BoxLayout(sha1OptionPanel, BoxLayout.X_AXIS));
sha1CheckBox = new JCheckBox("SHA1 checksum:");
sha1TextField = new JTextField();
sha1OptionPanel.add(sha1CheckBox);
sha1OptionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
sha1OptionPanel.add(sha1TextField);
sha256OptionPanel.setLayout(new BoxLayout(sha256OptionPanel, BoxLayout.X_AXIS));
sha256CheckBox = new JCheckBox("SHA256 checksum:");
sha256TextField = new JTextField();
sha256OptionPanel.add(sha256CheckBox);
sha256OptionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
sha256OptionPanel.add(sha256TextField);
sha384OptionPanel.setLayout(new BoxLayout(sha384OptionPanel, BoxLayout.X_AXIS));
sha384CheckBox = new JCheckBox("SHA384 checksum:");
sha384TextField = new JTextField();
sha384OptionPanel.add(sha384CheckBox);
sha384OptionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
sha384OptionPanel.add(sha384TextField);
sha512OptionPanel.setLayout(new BoxLayout(sha512OptionPanel, BoxLayout.X_AXIS));
sha512CheckBox = new JCheckBox("SHA512 checksum:");
sha512TextField = new JTextField();
sha512OptionPanel.add(sha512CheckBox);
sha512OptionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
sha512OptionPanel.add(sha512TextField);
crc32OptionPanel.setLayout(new BoxLayout(crc32OptionPanel, BoxLayout.X_AXIS));
crc32CheckBox = new JCheckBox("CRC32 checksum:"); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\passwordremover\PdfPasswordRemoverPanel.java |
58 |
| edu\jiangxin\apktoolbox\pdf\pic2pdf\Pic2PdfPanel.java |
50 |
createProcessBarPanel();
}
private void createInputPanel() {
fileListPanel = new FileListPanel();
fileListPanel.initialize();
add(fileListPanel);
}
private void createOutputPanel() {
targetDirPanel = new FilePanel("Target Directory");
targetDirPanel.initialize();
targetDirPanel.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
add(targetDirPanel);
}
private void createOptionPanel() {
JPanel optionPanel = new JPanel();
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS));
optionPanel.setBorder(BorderFactory.createTitledBorder("Options"));
isRecursiveSearched = new JCheckBox("Recursive Search");
isRecursiveSearched.setSelected(true);
optionPanel.add(isRecursiveSearched);
optionPanel.add(Box.createHorizontalGlue());
add(optionPanel);
}
private void createOperationPanel() {
JPanel operationPanel = new JPanel();
operationPanel.setLayout(new BoxLayout(operationPanel, BoxLayout.X_AXIS));
operationPanel.setBorder(BorderFactory.createTitledBorder("Operations"));
startButton = new JButton("Start");
cancelButton = new JButton("Cancel");
cancelButton.setEnabled(false);
startButton.addActionListener(new OperationButtonActionListener());
cancelButton.addActionListener(new OperationButtonActionListener());
operationPanel.add(startButton);
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(cancelButton);
operationPanel.add(Box.createHorizontalGlue());
add(operationPanel);
}
private void createProcessBarPanel() { |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
150 |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
124 |
operationPanel.add(searchButton);
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(cancelButton);
operationPanel.add(Box.createHorizontalGlue());
progressBar = new JProgressBar();
progressBar.setStringPainted(true);
progressBar.setString("Ready");
mainPanel.add(fileListPanel);
mainPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
mainPanel.add(checkOptionPanel);
mainPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
mainPanel.add(searchOptionPanel);
mainPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
mainPanel.add(operationPanel);
mainPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
mainPanel.add(progressBar);
}
private void createResultPanel() {
resultPanel = new JPanel();
resultPanel.setLayout(new BoxLayout(resultPanel, BoxLayout.Y_AXIS));
resultTableModel = new PdfFilesTableModel(new Vector<>(), PdfFilesConstants.COLUMN_NAMES);
resultTable = new JTable(resultTableModel);
resultTable.setDefaultRenderer(Vector.class, new PdfFilesTableCellRenderer());
for (int i = 0; i < resultTable.getColumnCount(); i++) {
resultTable.getColumn(resultTable.getColumnName(i)).setCellRenderer(new PdfFilesTableCellRenderer());
}
resultTable.addMouseListener(new MyMouseListener()); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
196 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
168 |
statButton.setEnabled(false);
cancelButton.setEnabled(true);
searchThread = new SearchThread(isRecursiveSearched.isSelected());
searchThread.start();
} else if (source.equals(cancelButton)) {
statButton.setEnabled(true);
cancelButton.setEnabled(false);
if (searchThread.isAlive()) {
searchThread.interrupt();
searchThread.executorService.shutdownNow();
}
}
}
}
private void showResult() {
SwingUtilities.invokeLater(() -> {
int index = 0;
for (Vector<Object> file : resultFileList) {
file.add(0, ++index);
resultTableModel.addRow(file);
}
tabbedPane.setSelectedIndex(1);
statInfoLabel.setText("Page Count: " + totalPageCount.get() + ", Total Size: " + FileUtils.sizeOfInHumanFormat(totalFileSize.get()));
});
}
private Vector<Object> getRowVector(File file) {
Vector<Object> rowData = new Vector<>();
rowData.add(file.getParent());
rowData.add(file.getName());
totalFileSize.addAndGet(file.length());
rowData.add(FileUtils.sizeOfInHumanFormat(file));
rowData.add(DateUtils.millisecondToHumanFormat(file.lastModified()));
int pageCount = PdfUtils.getPageCount(file); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
375 |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
263 |
List<File> fileList = fileListPanel.getFileList();
Set<File> fileSet = new TreeSet<>();
String[] extensions = new String[]{"pdf", "PDF"};
for (File file : fileList) {
fileSet.addAll(FileUtils.listFiles(file, extensions, isRecursiveSearched));
}
List<Future<?>> futures = new ArrayList<>();
totalFiles = fileSet.size();
updateProgress();
for (File file : fileSet) {
if (currentThread().isInterrupted()) {
return;
}
futures.add(executorService.submit(() -> {
if (currentThread().isInterrupted()) {
return null;
}
processFile(file);
incrementProcessedFiles();
return null;
}));
}
// Wait for all tasks to complete
for (Future<?> future : futures) {
try {
future.get();
} catch (InterruptedException e) {
logger.error("Search interrupted", e);
currentThread().interrupt(); // Restore interrupted status
return;
}
}
showResult();
} catch (Exception e) {
logger.error("Search failed", e);
SwingUtilities.invokeLater(() -> progressBar.setString("Search failed"));
} finally {
executorService.shutdown();
SwingUtilities.invokeLater(() -> { |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
377 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
236 |
String[] extensions = new String[]{"pdf", "PDF"};
for (File file : fileList) {
fileSet.addAll(FileUtils.listFiles(file, extensions, isRecursiveSearched));
}
List<Future<?>> futures = new ArrayList<>();
totalFiles = fileSet.size();
updateProgress();
for (File file : fileSet) {
if (currentThread().isInterrupted()) {
return;
}
futures.add(executorService.submit(() -> {
if (currentThread().isInterrupted()) {
return null;
}
processFile(file);
incrementProcessedFiles();
return null;
}));
}
// Wait for all tasks to complete
for (Future<?> future : futures) {
try {
future.get();
} catch (InterruptedException e) {
logger.error("Search interrupted", e);
currentThread().interrupt(); // Restore interrupted status
return;
}
}
showResult();
} catch (Exception e) {
logger.error("Search failed", e);
SwingUtilities.invokeLater(() -> progressBar.setString("Search failed"));
} finally {
executorService.shutdown();
SwingUtilities.invokeLater(() -> { |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfFilesConstants.java |
6 |
| edu\jiangxin\apktoolbox\word\stat\WordFilesConstants.java |
6 |
public class PdfFilesConstants {
public static final String COLUMN_NAME_INDEX = "Index";
public static final String COLUMN_NAME_FILE_PARENT = "ParentPath";
public static final String COLUMN_NAME_FILE_NAME = "FileName";
public static final String COLUMN_NAME_FILE_SIZE = "FileSize";
public static final String COLUMN_NAME_MODIFY_TIME = "ModifyTime";
public static final String COLUMN_NAME_PAGE_COUNT = "PageCount";
public static final Vector<String> COLUMN_NAMES;
public static final Vector<Color> BACKGROUND;
static {
COLUMN_NAMES = new Vector<>();
COLUMN_NAMES.add(COLUMN_NAME_INDEX);
COLUMN_NAMES.add(COLUMN_NAME_FILE_PARENT);
COLUMN_NAMES.add(COLUMN_NAME_FILE_NAME);
COLUMN_NAMES.add(COLUMN_NAME_FILE_SIZE);
COLUMN_NAMES.add(COLUMN_NAME_MODIFY_TIME);
COLUMN_NAMES.add(COLUMN_NAME_PAGE_COUNT);
BACKGROUND = new Vector<>();
BACKGROUND.add(new Color(255, 182, 193, 30));
BACKGROUND.add(new Color(123, 104, 238, 30));
BACKGROUND.add(new Color(127, 255, 170, 30));
BACKGROUND.add(new Color(255, 255, 0, 30));
}
} |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
231 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
202 |
int pageCount = PdfUtils.getPageCount(file);
totalPageCount.addAndGet(pageCount);
rowData.add(pageCount);
return rowData;
}
class SearchThread extends Thread {
public final ExecutorService executorService;
private final AtomicInteger processedFiles = new AtomicInteger(0);
private int totalFiles = 0;
private final boolean isRecursiveSearched;
public SearchThread(boolean isRecursiveSearched) {
super();
this.isRecursiveSearched = isRecursiveSearched;
this.executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
resultFileList.clear();
totalFileSize.set(0);
totalPageCount.set(0);
SwingUtilities.invokeLater(() -> {
progressBar.setValue(0);
progressBar.setString("Starting search...");
resultTableModel.setRowCount(0);
statInfoLabel.setText("");
});
}
@Override
public void run() {
try {
List<File> fileList = fileListPanel.getFileList();
Set<File> fileSet = new TreeSet<>();
String[] extensions = new String[]{"pdf", "PDF"}; |
| File |
Line |
| edu\jiangxin\apktoolbox\file\duplicate\DuplicateSearchPanel.java |
120 |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
135 |
searchOptionPanel.add(suffixTextField);
searchOptionPanel.add(Box.createHorizontalGlue());
JPanel operationPanel = new JPanel();
operationPanel.setLayout(new BoxLayout(operationPanel, BoxLayout.X_AXIS));
operationPanel.setBorder(BorderFactory.createTitledBorder("Operations"));
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
searchButton = new JButton("Search");
cancelButton = new JButton("Cancel");
cancelButton.setEnabled(false);
searchButton.addActionListener(new OperationButtonActionListener());
cancelButton.addActionListener(new OperationButtonActionListener());
operationPanel.add(searchButton);
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(cancelButton);
operationPanel.add(Box.createHorizontalGlue());
progressBar = new JProgressBar();
progressBar.setStringPainted(true);
progressBar.setString("Ready"); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
42 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
39 |
private JCheckBox isRecursiveSearched;
private JPanel resultPanel;
private JTable resultTable;
private DefaultTableModel resultTableModel;
private JLabel statInfoLabel;
private JButton statButton;
private JButton cancelButton;
private JProgressBar progressBar;
private transient SearchThread searchThread;
private final AtomicLong totalFileSize = new AtomicLong(0);
private final AtomicInteger totalPageCount = new AtomicInteger(0);
private transient final List<Vector<Object>> resultFileList = new CopyOnWriteArrayList<>();
@Override
public void initUI() {
tabbedPane = new JTabbedPane();
add(tabbedPane);
createMainPanel();
tabbedPane.addTab("Option", null, mainPanel, "Show Stat Options");
createResultPanel();
tabbedPane.addTab("Result", null, resultPanel, "Show Stat Result");
}
private void createMainPanel() {
mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
fileListPanel = new FileListPanel();
fileListPanel.initialize();
JPanel checkOptionPanel = new JPanel(); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\passwordremover\PdfPasswordRemoverPanel.java |
159 |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
256 |
progressBar.setString("Starting remove process...");
});
}
@Override
public void run() {
try {
List<File> fileList = fileListPanel.getFileList();
Set<File> fileSet = new TreeSet<>();
String[] extensions = new String[]{"pdf", "PDF"};
for (File file : fileList) {
fileSet.addAll(FileUtils.listFiles(file, extensions, isRecursiveSearched));
}
List<Future<?>> futures = new ArrayList<>();
totalFiles = fileSet.size();
updateProgress();
for (File file : fileSet) {
if (currentThread().isInterrupted()) {
return;
}
futures.add(executorService.submit(() -> {
if (currentThread().isInterrupted()) {
return null;
}
processFile(file, targetDirPanel.getFile()); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
375 |
| edu\jiangxin\apktoolbox\pdf\passwordremover\PdfPasswordRemoverPanel.java |
166 |
List<File> fileList = fileListPanel.getFileList();
Set<File> fileSet = new TreeSet<>();
String[] extensions = new String[]{"pdf", "PDF"};
for (File file : fileList) {
fileSet.addAll(FileUtils.listFiles(file, extensions, isRecursiveSearched));
}
List<Future<?>> futures = new ArrayList<>();
totalFiles = fileSet.size();
updateProgress();
for (File file : fileSet) {
if (currentThread().isInterrupted()) {
return;
}
futures.add(executorService.submit(() -> {
if (currentThread().isInterrupted()) {
return null;
}
processFile(file); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
117 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
92 |
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
statButton = new JButton("Stat");
cancelButton = new JButton("Cancel");
cancelButton.setEnabled(false);
statButton.addActionListener(new OperationButtonActionListener());
cancelButton.addActionListener(new OperationButtonActionListener());
operationPanel.add(statButton);
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(cancelButton);
operationPanel.add(Box.createHorizontalGlue());
progressBar = new JProgressBar();
progressBar.setStringPainted(true);
progressBar.setString("Ready");
mainPanel.add(fileListPanel);
mainPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
mainPanel.add(checkOptionPanel); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
163 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
136 |
ExcelExporter.export(resultTableModel, "pdf_stat_export.xlsx", PdfStatPanel.this));
popupmenu.add(exportMenuItem);
popupmenu.show(e.getComponent(), e.getX(), e.getY());
}
}
});
JScrollPane scrollPane = new JScrollPane(resultTable);
JPanel statInfoPanel = new JPanel();
statInfoPanel.setLayout(new BoxLayout(statInfoPanel, BoxLayout.X_AXIS));
statInfoLabel = new JLabel("");
statInfoPanel.add(statInfoLabel);
statInfoPanel.add(Box.createHorizontalGlue());
resultPanel.add(scrollPane);
resultPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
resultPanel.add(statInfoPanel);
}
private void processFile(File file) { |
| File |
Line |
| edu\jiangxin\apktoolbox\file\checksum\panel\CompareFilesPanel.java |
82 |
| edu\jiangxin\apktoolbox\file\checksum\panel\VerifyChecksumPanel.java |
104 |
resultTextField.setText("File is different");
resultTextField.setForeground(Color.RED);
});
resultTextField = new JTextField("To be comparing");
resultTextField.setPreferredSize(new Dimension(100, 25));
resultTextField.setEditable(false);
resultTextField.setBorder(null);
Font font = new Font(null, Font.BOLD, 16);
resultTextField.setFont(font);
resultTextField.setForeground(Color.YELLOW);
operationPanel.setLayout(new BoxLayout(operationPanel, BoxLayout.X_AXIS));
operationPanel.add(compareButton);
operationPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
operationPanel.add(resultTextField);
operationPanel.add(Box.createHorizontalGlue());
} |
| File |
Line |
| edu\jiangxin\apktoolbox\file\checksum\panel\FileChecksumPanel.java |
87 |
| edu\jiangxin\apktoolbox\file\checksum\panel\StringHashPanel.java |
85 |
optionPanel.add(lastModifiedTimeOptionPanel);
optionPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
optionPanel.add(md5OptionPanel);
optionPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
optionPanel.add(sha1OptionPanel);
optionPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
optionPanel.add(sha256OptionPanel);
optionPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
optionPanel.add(sha384OptionPanel);
optionPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
optionPanel.add(sha512OptionPanel);
optionPanel.add(Box.createVerticalStrut(Constants.DEFAULT_Y_BORDER));
optionPanel.add(crc32OptionPanel); |
| File |
Line |
| edu\jiangxin\apktoolbox\file\duplicate\DuplicateSearchPanel.java |
450 |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
398 |
}
// Wait for all tasks to complete
for (Future<?> future : futures) {
try {
future.get();
} catch (InterruptedException e) {
logger.error("Search interrupted", e);
currentThread().interrupt(); // Restore interrupted status
return;
}
}
showResult();
} catch (Exception e) {
logger.error("Search failed", e);
SwingUtilities.invokeLater(() -> progressBar.setString("Search failed"));
} finally {
executorService.shutdown();
SwingUtilities.invokeLater(() -> {
searchButton.setEnabled(true);
cancelButton.setEnabled(false);
});
}
}
private void processFileGroup(List<File> files) { |
| File |
Line |
| edu\jiangxin\apktoolbox\android\monkey\MonkeyPanel.java |
683 |
| edu\jiangxin\apktoolbox\android\monkey\MonkeyPanel.java |
723 |
private void monitorMonkey(long time, String keyValue) {
if ((time - 1) % 120 == 0) {
logger.info("监控[" + keyValue + "]线程是否执行完毕---开始");
logger.info("每60秒监听一次,此时time的值:" + (time - 1));
String[] cmd = new String[] { CMD, "/c",
CMD_PS_A + comboBoxDevices.getSelectedItem() + CMD_PS_B };
logger.info("当前命令:" + cmd[2]);
executeCommand(cmd, keyValue);
logger.info("当前线程数:" + list.size());
if (list.size() == 0) { |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\passwordremover\PdfPasswordRemoverPanel.java |
111 |
| edu\jiangxin\apktoolbox\pdf\pic2pdf\Pic2PdfPanel.java |
95 |
add(progressBar);
}
private void processFile(File encryptedFile, File targetDir) {
try {
if (Thread.currentThread().isInterrupted()) {
return;
}
PdfUtils.removePasswordWithIText(encryptedFile, targetDir);
} catch (Throwable t) {
logger.error("Process file failed: {}", encryptedFile.getAbsolutePath(), t);
}
}
class OperationButtonActionListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Object source = e.getSource();
if (source.equals(startButton)) {
startButton.setEnabled(false);
cancelButton.setEnabled(true); |
| File |
Line |
| edu\jiangxin\apktoolbox\file\OsConvertPanel.java |
73 |
| edu\jiangxin\apktoolbox\file\zhconvert\ZhConvertPanel.java |
76 |
optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.X_AXIS));
JLabel suffixLabel = new JLabel("Suffix:");
suffixTextField = new JTextField();
suffixTextField.setToolTipText("an array of extensions, ex. {\"java\",\"xml\"}. If this parameter is empty, all files are returned.");
suffixTextField.setText(conf.getString("osconvert.suffix"));
optionPanel.add(suffixLabel);
optionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
optionPanel.add(suffixTextField);
optionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER));
recursiveCheckBox = new JCheckBox("Recursive");
recursiveCheckBox.setSelected(true);
optionPanel.add(recursiveCheckBox);
optionPanel.add(Box.createHorizontalStrut(Constants.DEFAULT_X_BORDER)); |
| File |
Line |
| edu\jiangxin\apktoolbox\file\EncodeConvertPanel.java |
138 |
| edu\jiangxin\apktoolbox\file\OsConvertPanel.java |
109 |
List<File> fileList = new ArrayList<>();
for (File file : srcPanel.getFileList()) {
String[] extensions = null;
if (StringUtils.isNotEmpty(suffixTextField.getText())) {
extensions = suffixTextField.getText().split(",");
}
fileList.addAll(FileUtils.listFiles(file, extensions, recursiveCheckBox.isSelected()));
}
Set<File> fileSet = new TreeSet<>(fileList);
fileList.clear();
fileList.addAll(fileSet); |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\finder\PdfFinderPanel.java |
418 |
| edu\jiangxin\apktoolbox\pdf\passwordremover\PdfPasswordRemoverPanel.java |
207 |
| edu\jiangxin\apktoolbox\pdf\stat\PdfStatPanel.java |
306 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
277 |
searchButton.setEnabled(true);
cancelButton.setEnabled(false);
});
}
}
private void incrementProcessedFiles() {
processedFiles.incrementAndGet();
updateProgress();
}
private void updateProgress() {
if (totalFiles > 0) {
SwingUtilities.invokeLater(() -> {
int processed = processedFiles.get();
int percentage = (int) (processed * 100.0 / totalFiles);
progressBar.setValue(percentage);
progressBar.setString(String.format("Processing: %d/%d files (%d%%)", processed, totalFiles, percentage));
});
}
}
} |
| File |
Line |
| edu\jiangxin\apktoolbox\pdf\passwordremover\PdfPasswordRemoverPanel.java |
168 |
| edu\jiangxin\apktoolbox\word\stat\WordStatPanel.java |
236 |
String[] extensions = new String[]{"pdf", "PDF"};
for (File file : fileList) {
fileSet.addAll(FileUtils.listFiles(file, extensions, isRecursiveSearched));
}
List<Future<?>> futures = new ArrayList<>();
totalFiles = fileSet.size();
updateProgress();
for (File file : fileSet) {
if (currentThread().isInterrupted()) {
return;
}
futures.add(executorService.submit(() -> {
if (currentThread().isInterrupted()) {
return null;
}
processFile(file, targetDirPanel.getFile()); |