[slf4j-dev] svn commit: r969 - slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter
ceki at slf4j.org
ceki at slf4j.org
Fri Feb 8 17:34:40 CET 2008
Author: ceki
Date: Fri Feb 8 17:34:40 2008
New Revision: 969
Added:
slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/XSelector.java
Modified:
slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/NewJFrame.java
Log:
- ow
Modified: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/NewJFrame.java
==============================================================================
--- slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/NewJFrame.java (original)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/NewJFrame.java Fri Feb 8 17:34:40 2008
@@ -1,6 +1,5 @@
package org.slf4j.converter;
-import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
@@ -59,6 +58,8 @@
private JCheckBox awareCheckBox;
private JLabel awareLabel;
+
+ private JLabel otherLabel;
JFileChooser fileChooser;
public static void main(String[] args) {
@@ -105,6 +106,9 @@
createAwareLabel();
createWarningLabel();
createFileChooser();
+
+ otherLabel = new JLabel();
+ otherLabel.setText("xxxx");
}
/**
@@ -134,6 +138,7 @@
slh.placeBelow(awareCheckBox, migrateButton, 0, BASIC_PADDING * 3);
+ slh.placeBelow(migrateButton, otherLabel, 0, BASIC_PADDING * 2);
}
private void addAllComponentsToContextPane() {
@@ -150,6 +155,8 @@
getContentPane().add(awareLabel);
getContentPane().add(warningLabel);
+
+ getContentPane().add(otherLabel);
}
private void createButtonGroup() {
@@ -243,6 +250,12 @@
if(errorList.size() > 0) {
showDialogBox(errorList);
} else {
+
+ XSelector xs = new XSelector();
+ xs.jlabel = otherLabel;
+ File folder = new File( folderTextField.getText());
+ xs.selectJavaFilesInFolder(folder);
+
System.out.println("do migration");
}
} else if (BROWSE_COMMAND.equals(e.getActionCommand())) {
Added: slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/XSelector.java
==============================================================================
--- (empty file)
+++ slf4j/trunk/slf4j-converter/src/main/java/org/slf4j/converter/XSelector.java Fri Feb 8 17:34:40 2008
@@ -0,0 +1,43 @@
+package org.slf4j.converter;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+public class XSelector {
+
+ private List<File> javaFileList = new ArrayList<File>();
+
+ javax.swing.JLabel jlabel;
+
+
+
+ public List<File> selectJavaFilesInFolder(File folder) {
+ if(folder.isDirectory()) {
+ selectFiles(folder);
+ return javaFileList;
+ } else {
+ throw new IllegalArgumentException("["+folder+"] is not a directory");
+ }
+ }
+
+ private void selectFiles(File file) {
+ System.out.println(file.getAbsolutePath());
+ if (file.isDirectory()) {
+ jlabel.setText(file.getAbsolutePath());
+
+ File[] files = file.listFiles();
+ if (files != null) {
+ for (int i = 0; i < files.length; i++) {
+ selectFiles(files[i]);
+ }
+ }
+ } else {
+ if (file.getName().endsWith(".java")) {
+ jlabel.setText(file.getAbsolutePath());
+ javaFileList.add(file);
+ }
+
+ }
+ }
+}
More information about the slf4j-dev
mailing list