Revision: 6272
          http://sourceforge.net/p/jump-pilot/code/6272
Author:   ma15569
Date:     2020-05-31 06:59:29 +0000 (Sun, 31 May 2020)
Log Message:
-----------
Moved files to their folder

Added Paths:
-----------
    plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/FileChooser.java
    plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/MyFileFilter.java
    plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/TextFile.java

Added: plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/FileChooser.java
===================================================================
--- plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/FileChooser.java            
                (rev 0)
+++ plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/FileChooser.java    
2020-05-31 06:59:29 UTC (rev 6272)
@@ -0,0 +1,75 @@
+package com.cadplan.fileio;
+
+import java.awt.Component;
+import java.io.File;
+import java.util.Properties;
+import javax.swing.JFileChooser;
+
+public class FileChooser {
+   JFileChooser chooser;
+   public String fileName;
+   public String dirName;
+
+   public FileChooser(Component paramComponent, String paramString1, String 
paramString2, String[] paramArrayOfString, String paramString3, int paramInt) {
+      Properties properties = System.getProperties();
+      File file;
+      if (paramString1 == null) {
+         file = new File(properties.getProperty("user.dir"));
+      } else {
+         file = new File(String.valueOf(paramString1) + File.separator);
+      }
+
+      this.chooser = new JFileChooser();
+      this.chooser.setDialogType(paramInt);
+      MyFileFilter myFileFilter = new MyFileFilter(paramString3, 
paramArrayOfString);
+      this.chooser.setFileFilter(myFileFilter);
+      this.chooser.setCurrentDirectory(file);
+      if (paramString2 != null) {
+         this.chooser.setSelectedFile(new File(paramString2));
+      }
+
+      int i;
+      if (paramInt == 0) {
+         i = this.chooser.showOpenDialog(paramComponent);
+      } else {
+         i = this.chooser.showSaveDialog(paramComponent);
+      }
+
+      if (i == 0) {
+         this.fileName = this.chooser.getSelectedFile().getName();
+         if (paramInt == 1) {
+            this.fileName = this.addExtension(this.fileName, 
paramArrayOfString);
+         }
+
+         this.dirName = this.chooser.getCurrentDirectory().getPath();
+      } else {
+         this.fileName = null;
+      }
+
+   }
+
+   public String getFile() {
+      return this.fileName;
+   }
+
+   public String getDir() {
+      return this.dirName;
+   }
+
+   private String addExtension(String paramString, String[] 
paramArrayOfString) {
+      boolean bool = false;
+
+      for(byte b = 0; b < paramArrayOfString.length; ++b) {
+         String str = paramArrayOfString[b];
+         if (paramString.toLowerCase().endsWith("." + str)) {
+            bool = true;
+         }
+      }
+
+      if (!bool) {
+         paramString = String.valueOf(paramString) + "." + 
paramArrayOfString[0];
+      }
+
+      return paramString;
+   }
+}


Property changes on: 
plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/FileChooser.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/MyFileFilter.java
===================================================================
--- plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/MyFileFilter.java           
                (rev 0)
+++ plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/MyFileFilter.java   
2020-05-31 06:59:29 UTC (rev 6272)
@@ -0,0 +1,65 @@
+package com.cadplan.fileio;
+
+import java.io.File;
+import javax.swing.filechooser.FileFilter;
+
+class MyFileFilter extends FileFilter {
+   String description;
+   String[] extensions;
+   boolean acceptAll;
+
+   public MyFileFilter(String paramString1, String paramString2) {
+      this(paramString1, new String[]{paramString2});
+   }
+
+   public MyFileFilter(String paramString, String[] paramArrayOfString) {
+      this.acceptAll = false;
+      if (paramString == null) {
+         this.description = "Files like: " + paramArrayOfString[0];
+      } else {
+         this.description = paramString;
+      }
+
+      this.extensions = (String[])paramArrayOfString.clone();
+      this.toLower(this.extensions);
+
+      for(byte b = 0; b < this.extensions.length; ++b) {
+         if (this.extensions[b].equals("*")) {
+            this.acceptAll = true;
+         }
+      }
+
+   }
+
+   private void toLower(String[] paramArrayOfString) {
+      byte b = 0;
+
+      for(int i = paramArrayOfString.length; b < i; ++b) {
+         paramArrayOfString[b] = paramArrayOfString[b].toLowerCase();
+      }
+
+   }
+
+   public String getDescription() {
+      return this.description;
+   }
+
+   public boolean accept(File paramFile) {
+      if (paramFile.isDirectory()) {
+         return true;
+      } else if (this.acceptAll) {
+         return true;
+      } else {
+         String str = paramFile.getAbsolutePath().toLowerCase();
+
+         for(byte b = 0; b < this.extensions.length; ++b) {
+            String str1 = this.extensions[b];
+            if (str.endsWith(str1) && str.charAt(str.length() - str1.length() 
- 1) == '.') {
+               return true;
+            }
+         }
+
+         return false;
+      }
+   }
+}


Property changes on: 
plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/MyFileFilter.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/TextFile.java
===================================================================
--- plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/TextFile.java               
                (rev 0)
+++ plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/TextFile.java       
2020-05-31 06:59:29 UTC (rev 6272)
@@ -0,0 +1,101 @@
+package com.cadplan.fileio;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Properties;
+
+public class TextFile {
+   String fileName;
+   String dirName;
+   BufferedReader reader = null;
+   FileWriter writer = null;
+
+   public TextFile(String paramString1, String paramString2) {
+      this.dirName = paramString1;
+      Properties properties = System.getProperties();
+      if (paramString1 == null) {
+         this.dirName = properties.getProperty("user.dir");
+      }
+
+      this.fileName = paramString2;
+   }
+
+   public boolean exists() {
+      File file = new File(String.valueOf(this.dirName) + File.separator + 
this.fileName);
+      return file.exists();
+   }
+
+   public boolean openRead() {
+      File file = new File(String.valueOf(this.dirName) + File.separator + 
this.fileName);
+
+      try {
+         this.reader = new BufferedReader(new FileReader(file));
+         return true;
+      } catch (FileNotFoundException var3) {
+         return false;
+      }
+   }
+
+   public boolean openWrite() {
+      File file = new File(String.valueOf(this.dirName) + File.separator + 
this.fileName);
+
+      try {
+         this.writer = new FileWriter(file);
+         return true;
+      } catch (IOException var3) {
+         return false;
+      }
+   }
+
+   public String readLine() {
+      try {
+         return this.reader.readLine();
+      } catch (IOException var2) {
+         return null;
+      }
+   }
+
+   public String readAll() {
+      String str = "";
+      StringBuffer stringBuffer = new StringBuffer();
+
+      try {
+         while(str != null) {
+            str = this.reader.readLine();
+            if (str != null) {
+               stringBuffer.append(String.valueOf(str) + "\n");
+            }
+         }
+      } catch (IOException var4) {
+         return stringBuffer.toString();
+      }
+
+      return stringBuffer.toString();
+   }
+
+   public boolean write(String paramString) {
+      try {
+         this.writer.write(paramString);
+         return true;
+      } catch (IOException var3) {
+         return false;
+      }
+   }
+
+   public void close() {
+      try {
+         if (this.reader != null) {
+            this.reader.close();
+         } else if (this.writer != null) {
+            this.writer.flush();
+            this.writer.close();
+         }
+      } catch (IOException var2) {
+      }
+
+   }
+}


Property changes on: 
plug-ins/CadPlan_VertexSymbols/trunk/src/fileio/TextFile.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to