コード例 #1
0
 private void displayCurrentRoot() {
   try {
     setTitle(currentRoot.getURL());
     deleteAll();
     append(UPPER_DIR, null);
     Enumeration listOfDirs = currentRoot.list("*", false);
     while (listOfDirs.hasMoreElements()) {
       String currentDir = (String) listOfDirs.nextElement();
       if (currentDir.endsWith(FILE_SEPARATOR)) {
         append(currentDir, null);
       } else {
         append(currentDir, null);
       }
     }
   } catch (IOException e) {
   } catch (SecurityException e) {
   }
 }
コード例 #2
0
 private void openSelected() {
   int selectedIndex = getSelectedIndex();
   if (selectedIndex >= 0) {
     String selectedFile = getString(selectedIndex);
     if (selectedFile.endsWith(FILE_SEPARATOR)) {
       try {
         if (currentRoot == null) {
           currentRoot =
               (FileConnection) Connector.open("file:///" + selectedFile, Connector.READ);
         } else {
           currentRoot.setFileConnection(selectedFile);
         }
         displayCurrentRoot();
       } catch (IOException e) {
         System.out.println(e.getMessage());
       } catch (SecurityException e) {
         System.out.println(e.getMessage());
       }
     } else if (selectedFile.equals(UPPER_DIR)) {
       if (rootsList.contains(currentRoot.getPath() + currentRoot.getName())) {
         displayAllRoots();
       } else {
         try {
           currentRoot =
               (FileConnection) Connector.open("file://" + currentRoot.getPath(), Connector.READ);
           displayCurrentRoot();
         } catch (IOException e) {
           System.out.println(e.getMessage());
         }
       }
     } else {
       String url = currentRoot.getURL() + selectedFile;
       heartDiagApp.setSelectedFile(url);
       heartDiagApp.displayAndCalculate();
     }
   }
 }