The following document contains the results of PMD's CPD 3.9.
File | Line |
---|---|
org/abstracthorizon/aequo/file/action/CopyToAction.java | 62 |
org/abstracthorizon/aequo/file/action/MoveToAction.java | 54 |
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); } } /** * Returns if selection is valid * @return <code>true</code> if selection is valid< */ public boolean isEnabled() { return (column >= 0) && isSelectionValid(); } /** * Moves files from one side to another * * @param e event * @param monitor monitor */ public void perform(ActionEvent e, ProgressMonitor monitor) { int failed = 0; StringWriter failedDetails = new StringWriter(); FilesModel model = getFilesModel(); int first = 0; int last = -1; FileCompareEntry[] entries = getPreselectedEntries(); if (entries.length > 0) { first = entries[0].getIndex(); int i = entries.length - 1; while ((i >= 0) && (last < 0)) { last = entries[i].getIndex(); i--; } } monitor.setMaximum(entries.length); ListSelectionModel selModel = model.getSelectionModel(); selModel.setValueIsAdjusting(true); try { int i = 0; while (i < entries.length) { FileCompareEntry entry = entries[i]; File[] data = entry.getData(); File fromFile = data[column]; File toFile = data[destColumn]; monitor.setNote(fromFile.getAbsolutePath() + " to " + toFile.getAbsolutePath()); if (fromFile.exists()) { if (fromFile.isDirectory()) { boolean err = false; if (toFile.exists() && !toFile.isDirectory() && !toFile.delete()) { failed = failed + 1; failedDetails.append("Failed to delete ").append(toFile.getAbsolutePath()); err = true; } if (!err && !toFile.exists()) { if (!toFile.mkdirs()) { failed = failed + 1; failedDetails.append("Failed to created folder ").append(toFile.getAbsolutePath()); } else { toFile.setLastModified(fromFile.lastModified()); } } else if (!err) { toFile.setLastModified(fromFile.lastModified()); } } else { if (!fromFile.renameTo(toFile)) { |
File | Line |
---|---|
org/abstracthorizon/aequo/file/action/CopyToAction.java | 64 |
org/abstracthorizon/aequo/file/action/TouchAction.java | 47 |
} /** * Returns if selection is valid * @return <code>true</code> if selection is valid< */ public boolean isEnabled() { return (column >= 0) && isSelectionValid(); } /** * Copies date from other side * @param e event * @param monitor monitor */ public void perform(ActionEvent e, ProgressMonitor monitor) { int failed = 0; StringWriter failedDetails = new StringWriter(); FilesModel model = getFilesModel(); int first = 0; int last = -1; FileCompareEntry[] entries = getPreselectedEntries(); if (entries.length > 0) { first = entries[0].getIndex(); int i = entries.length - 1; while ((i >= 0) && (last < 0)) { last = entries[i].getIndex(); i--; } } monitor.setMaximum(entries.length); ListSelectionModel selModel = model.getSelectionModel(); selModel.setValueIsAdjusting(true); try { int i = 0; while (i < entries.length) { FileCompareEntry entry = entries[i]; File[] data = entry.getData(); File fromFile = data[column]; File toFile = data[destColumn]; monitor.setNote(fromFile.getAbsolutePath() + " to " + toFile.getAbsolutePath()); if (fromFile.exists() && toFile.exists()) { |
File | Line |
---|---|
org/abstracthorizon/aequo/text/action/CopyAction.java | 54 |
org/abstracthorizon/aequo/text/action/CutAction.java | 68 |
deleteAction.setTextModel(textModel); } /** * Inovkes the action * @param e action event */ public void perform(ActionEvent e) { TextModel model = getTextModel(); StringBuffer text = new StringBuffer(); ListSelectionModel selModel = model.getSelectionModel(); int min = selModel.getMinSelectionIndex(); int max = selModel.getMaxSelectionIndex(); for (int i = min; i < max; i++) { CompareEntry<String> entry = model.get(i); text.append(entry.getData(column)).append('\n'); } final String copyText = text.toString(); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(new Transferable() { public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { if (!isDataFlavorSupported(flavor)) { throw new UnsupportedFlavorException(flavor); } return copyText.toString(); } public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[]{DataFlavor.stringFlavor}; } public boolean isDataFlavorSupported(DataFlavor flavor) { return DataFlavor.stringFlavor.equals(flavor); } }, null); |
File | Line |
---|---|
org/abstracthorizon/aequo/file/TableFileComparePanel.java | 787 |
org/abstracthorizon/aequo/gui/ListComparePanel.java | 180 |
int index = ((CompareList)e.getComponent()).locationToIndex(e.getPoint()); if (index >= 0) { if (e.isControlDown()) { if (!selModel.isSelectedIndex(index)) { selModel.addSelectionInterval(index, index); } } else { if (!selModel.isSelectedIndex(index)) { selModel.setSelectionInterval(index, index); } } } JPopupMenu popup = leftPopupMenu; if (e.getComponent() == rightList) { popup = rightPopupMenu; updateCachedActionsColumn(1); if (!rightList.hasFocus()) { rightList.grabFocus(); } } else { updateCachedActionsColumn(0); if (!leftList.hasFocus()) { leftList.grabFocus(); } } updateMenu(popup.getComponents()); popup.show(e.getComponent(), e.getX(), e.getY()); } } public void mouseReleased(MouseEvent e) { } } |
File | Line |
---|---|
org/abstracthorizon/aequo/file/action/BinaryComparisonAction.java | 59 |
org/abstracthorizon/aequo/file/action/TouchAction.java | 54 |
return (column >= 0) && isSelectionValid(); } /** * Copies files * @param e event * @param monitor monitor */ public void perform(ActionEvent e, ProgressMonitor monitor) { int failed = 0; StringWriter failedDetails = new StringWriter(); FilesModel model = getFilesModel(); int first = 0; int last = -1; FileCompareEntry[] entries = getPreselectedEntries(); if (entries.length > 0) { first = entries[0].getIndex(); int i = entries.length - 1; while ((i >= 0) && (last < 0)) { last = entries[i].getIndex(); i--; } } monitor.setMaximum(entries.length); ListSelectionModel selModel = model.getSelectionModel(); selModel.setValueIsAdjusting(true); try { int i = 0; while (i < entries.length) { FileCompareEntry entry = entries[i]; File[] data = entry.getData(); File fromFile = data[column]; |
File | Line |
---|---|
org/abstracthorizon/aequo/text/action/CopyToAction.java | 57 |
org/abstracthorizon/aequo/text/action/MoveToAction.java | 57 |
putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, ActionEvent.CTRL_MASK | ActionEvent.SHIFT_MASK)); } } /** * Moves lines from one side to another * @param e action event */ public void perform(ActionEvent e) { TextModel model = getTextModel(); ListSelectionModel selModel = model.getSelectionModel(); int min = selModel.getMinSelectionIndex(); int max = selModel.getMaxSelectionIndex(); selModel.setValueIsAdjusting(true); try { for (int i = max; i >= min; i--) { CompareEntry<String> entry = model.get(i); String source = entry.getData(column); String dest = entry.getData(destColumn); if ((source != dest) && ((source == null) || !source.equals(dest))) { entry.setData(destColumn, entry.getData(column)); |
File | Line |
---|---|
org/abstracthorizon/aequo/file/action/BinaryComparisonAction.java | 71 |
org/abstracthorizon/aequo/file/action/DeleteAction.java | 66 |
FilesModel model = getFilesModel(); int first = 0; int last = -1; FileCompareEntry[] entries = getPreselectedEntries(); if (entries.length > 0) { first = entries[0].getIndex(); int i = entries.length - 1; while ((i >= 0) && (last < 0)) { last = entries[i].getIndex(); i--; } } monitor.setMaximum(entries.length); ListSelectionModel selModel = model.getSelectionModel(); selModel.setValueIsAdjusting(true); try { int i = entries.length - 1; |
File | Line |
---|---|
org/abstracthorizon/aequo/text/action/DeleteAction.java | 62 |
org/abstracthorizon/aequo/text/action/PasteOverAction.java | 75 |
for (int i = max; i >= min; i--) { TextCompareEntry entry = model.get(i); String d = entry.getData(column); if (d != null) { int j = 0; Object[] data = entry.getData(); while ((j < data.length) && ((j == column) || (j != column) && (data[j] == null))) { j++; } // TODO UNDO if (j == data.length) { model.remove(i); |