summaryrefslogtreecommitdiff
path: root/Tools/Source/MigrationTools
diff options
context:
space:
mode:
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-31 01:06:09 +0000
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-31 01:06:09 +0000
commitb678aacaa9876e8a1f14c4e9e93df87d3d4977b2 (patch)
treec7379a7942b56a27631acc6754be8e5f6c7ba75b /Tools/Source/MigrationTools
parentb315127350595db18418a44033ad5afdd4a6d856 (diff)
downloadedk2-b678aacaa9876e8a1f14c4e9e93df87d3d4977b2.zip
edk2-b678aacaa9876e8a1f14c4e9e93df87d3d4977b2.tar.gz
edk2-b678aacaa9876e8a1f14c4e9e93df87d3d4977b2.tar.bz2
func name changed & modify common.todoall
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1412 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/MigrationTools')
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/Common.java57
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java2
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java6
3 files changed, 57 insertions, 8 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/Common.java b/Tools/Source/MigrationTools/org/tianocore/migration/Common.java
index 44b25e7..5b4d33a 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/Common.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/Common.java
@@ -60,7 +60,13 @@ public final class Common {
//-----------------------------------file&string---------------------------------------//
//--------------------------------------dir--------------------------------------------//
-
+ /*
+ public static final HashSet<String> walkDir(String path, int mode) throws Exception {
+ HashSet<String> pathlist = new HashSet<String>();
+ Common.toDoAll(path, Common.class.getMethod("walkDir", String.class), null, null, mode);
+ return pathlist;
+ }
+ */
public static final void ensureDir(String objFileWhole) {
File tempdir;
Matcher mtrseparate = ptnseparate.matcher(objFileWhole);
@@ -137,16 +143,21 @@ public final class Common {
}
}
- public static void toDoAll(String path, ForDoAll fda) throws Exception { // filter of file type can be done in toDo
+ public static void toDoAll(String path, ForDoAll fda, int type) throws Exception { // filter of file type can be done in toDo
String[] list = new File(path).list();
File test;
+ if (type == DIR || type == BOTH) {
+ fda.toDo(path);
+ }
for (int i = 0 ; i < list.length ; i++) {
test = new File(path + File.separator + list[i]);
if (test.isDirectory()) {
- toDoAll(path + File.separator + list[i], fda);
+ toDoAll(path + File.separator + list[i], fda, type);
} else {
- fda.toDo(path + File.separator + list[i]);
+ if (type == FILE || type == BOTH) {
+ fda.toDo(path + File.separator + list[i]);
+ }
}
}
}
@@ -154,4 +165,42 @@ public final class Common {
public static interface ForDoAll {
public void toDo(String filepath) throws Exception;
}
+ /*
+ // this PathIterator is based on HashSet, an thread implementation is required.
+ private final class PathIterator implements ForDoAll{
+ PathIterator(String path) throws Exception {
+ startpath = path;
+ Common.toDoAll(startpath, this, mode);
+ }
+ PathIterator(String path, int md) throws Exception {
+ startpath = path;
+ mode = md;
+ Common.toDoAll(startpath, this, mode);
+ }
+ private String startpath;
+ private int mode = Common.BOTH;
+ private HashSet<String> pathlist = new HashSet<String>();
+ private Iterator<String> it = pathlist.iterator();
+
+ public final void toDo(String path) throws Exception {
+ pathlist.add(path);
+ }
+
+ public final String next() {
+ return it.next();
+ }
+
+ public final boolean hasNext() {
+ return it.hasNext();
+ }
+
+ public final String toString() {
+ return pathlist.toString();
+ }
+ }
+
+ public final PathIterator getPathIterator(String path, int md) throws Exception {
+ return new PathIterator(path, md);
+ }
+ */
}
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
index fac874e..ce15570 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/FirstPanel.java
@@ -184,7 +184,7 @@ public final class FirstPanel extends JPanel implements ActionListener, ItemList
if ( e.getSource() == goButton ) {
try {
logfile = new PrintWriter(new BufferedWriter(new FileWriter(startpath.replaceAll(Common.strseparate, "$1") + File.separator + "migration.log")));
- MigrationTool.triger(startpath);
+ MigrationTool.startMigrateAll(startpath);
logfile.flush();
} catch (Exception en) {
println(en.getMessage());
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
index 04ab022..5c74ee0 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
@@ -13,7 +13,7 @@ public class MigrationTool {
public static boolean doCritic = false;
public static boolean defaultoutput = false;
- private static final void manipulate(ModuleInfo mi) throws Exception {
+ private static final void mainFlow(ModuleInfo mi) throws Exception {
ModuleReader.ModuleScan(mi);
//MigrationTool.ui.yesOrNo("go on replace?");
@@ -59,11 +59,11 @@ public class MigrationTool {
public static final void seekModule(String filepath) throws Exception {
if (ModuleInfo.isModule(filepath)) {
- manipulate(new ModuleInfo(filepath));
+ mainFlow(new ModuleInfo(filepath));
}
}
- public static final void triger(String path) throws Exception {
+ public static final void startMigrateAll(String path) throws Exception {
MigrationTool.ui.println("Project Migration");
MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");
Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);