1414package net .sf .j2s .lib .providers ;
1515
1616import java .io .File ;
17+ import java .io .FileFilter ;
1718import java .io .IOException ;
1819import java .net .URL ;
19-
2020import net .sf .j2s .lib .LibPlugin ;
2121import net .sf .j2s .ui .resources .FileSystemUtils ;
2222import net .sf .j2s .ui .resources .IExternalResourceProvider ;
23-
2423import org .eclipse .core .runtime .Platform ;
2524
2625/**
@@ -84,7 +83,6 @@ public String[] getDescriptions() {
8483 }
8584
8685 public String [][] getResources () {
87- String [][] list = new String [CORE_RESOURCE_LIST .length ][];
8886 URL starterURL = LibPlugin .getDefault ().getBundle ()
8987 .getEntry ("/" + File .separator ); //$NON-NLS-1$
9088 String srcPath = "." ; //$NON-NLS-1$
@@ -94,13 +92,42 @@ public String[][] getResources() {
9492 e1 .printStackTrace ();
9593 }
9694 srcPath = srcPath .replace ('/' , File .separatorChar );
95+ /*
96+ String[][] list = new String[CORE_RESOURCE_LIST.length][];
9797 for (int i = 0; i < list.length; i++) {
9898 list[i] = new String[CORE_RESOURCE_LIST[i].length];
9999 for (int j = 0; j < CORE_RESOURCE_LIST[i].length; j++) {
100100 list[i][j] = "|" + new File(srcPath, "j2slib/" + CORE_RESOURCE_LIST[i][j]).getAbsolutePath();
101101 }
102102 }
103103 return list;
104+ */
105+ File folder = new File (srcPath , "j2slib" );
106+ File [] files = folder .listFiles (new FileFilter () {
107+ public boolean accept (File pathname ) {
108+ if (pathname .isFile () && pathname .getName ().endsWith (".j2x" )) {
109+ return true ;
110+ }
111+ return false ;
112+ }
113+ });
114+ /*
115+ for (int i = 0; i < files.length; i++) {
116+ Properties prop = new Properties();
117+ try {
118+ prop.load(new FileInputStream(files[i]));
119+ prop.getProperty("package.prefix");
120+ } catch (IOException e) {
121+ e.printStackTrace();
122+ }
123+ }
124+ */
125+ String [][] list = new String [1 ][];
126+ list [0 ] = new String [files .length ];
127+ for (int i = 0 ; i < files .length ; i ++) {
128+ list [0 ][i ] = "|" + files [i ].getAbsolutePath ();
129+ }
130+ return list ;
104131 }
105132
106133 public void copyResources (String key , String destPath ) {
0 commit comments