add file support for RAP.
authorBruno Sinou <bsinou@argeo.org>
Wed, 2 Mar 2011 14:29:06 +0000 (14:29 +0000)
committerBruno Sinou <bsinou@argeo.org>
Wed, 2 Mar 2011 14:29:06 +0000 (14:29 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@4269 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/runtime/org.argeo.eclipse.ui.rap/.classpath [new file with mode: 0644]
eclipse/runtime/org.argeo.eclipse.ui.rap/.project [new file with mode: 0644]
eclipse/runtime/org.argeo.eclipse.ui.rap/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
eclipse/runtime/org.argeo.eclipse.ui.rap/pom.xml
eclipse/runtime/org.argeo.eclipse.ui.rap/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java

diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rap/.classpath b/eclipse/runtime/org.argeo.eclipse.ui.rap/.classpath
new file mode 100644 (file)
index 0000000..8cf7f48
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry kind="src" path="src/main/java"/>
+       <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rap/.project b/eclipse/runtime/org.argeo.eclipse.ui.rap/.project
new file mode 100644 (file)
index 0000000..df496c2
--- /dev/null
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>org.argeo.eclipse.ui.rap</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.ManifestBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.pde.SchemaBuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.pde.PluginNature</nature>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rap/.settings/org.eclipse.jdt.core.prefs b/eclipse/runtime/org.argeo.eclipse.ui.rap/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..ffba01e
--- /dev/null
@@ -0,0 +1,8 @@
+#Wed Mar 02 13:27:08 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
index a0009ca93d74058ac2ac83eab71f1668c1dacb43..a852e57d13a9cb20084ec480ceb7f01f7cc06297 100644 (file)
@@ -36,6 +36,9 @@
                                                <Import-Package>
                                                        org.springframework.beans.factory,
                                                        org.springframework.core.io.support,
+                                                       org.apache.commons.io,
+                                                       org.argeo,
+                                                       org.argeo.eclipse.ui.dialogs,
                                                        !org.eclipse.core.runtime,
                                                        !org.eclipse.core.commands,
                                                        !org.eclipse.ui.plugin,
                        <artifactId>org.argeo.eclipse.ui</artifactId>
                        <version>0.2.3-SNAPSHOT</version>
                </dependency>
+               <dependency>
+                       <groupId>org.apache.commons</groupId>
+                       <artifactId>com.springsource.org.apache.commons.io</artifactId>
+               </dependency>
+
        </dependencies>
 </project>
index 8948e73c7a90a5b86d3e1a6a62b798a767b4707e..45905f6be240d3c0aa8faa57e586e6e3954912e4 100644 (file)
@@ -1,75 +1,22 @@
 package org.argeo.eclipse.ui.specific;
 
-import java.awt.Desktop;
-import java.io.BufferedInputStream;
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 
-import org.apache.commons.io.IOUtils;
-import org.argeo.ArgeoException;
-
-//import org.apache.commons.io;
+//import org.argeo.eclipse.ui.dialogs.Error;
 
 public class FileHandler {
 
-       private BufferedInputStream bis;
-
        public FileHandler() {
        }
 
-       public File createTmpFile(String fileName, String suffix, InputStream is) {
+       public void openFile(String fileName, InputStream is) {
+               // org.argeo.eclipse.ui.dialogs.Error.show("In Open File for RAP.");
+       }
+
+       private File createTmpFile(String prefix, String suffix, InputStream is) {
                File tmpFile = null;
-               OutputStream os = null;
-               try {
-                       tmpFile = File.createTempFile(fileName, suffix);
-                       os = new FileOutputStream(tmpFile);
-                       IOUtils.copy(is, os);
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot open file " + fileName, e);
-               } finally {
-                       IOUtils.closeQuietly(os);
-               }
                return tmpFile;
        }
 
-       public void openFile(String fileName, InputStream is) {
-       
-               String prefix ="", extension = "";
-               
-               if (fileName != null){
-                       int ind = fileName.
-                       if (true){
-                               }
-                       }
-                       
-               prefix = .substring(0,
-                               node.getName().lastIndexOf('.'));
-               extension = node.getName().substring(
-                               node.getName().lastIndexOf('.'));
-               try {
-                       Desktop desktop = null;
-                       if (Desktop.isDesktopSupported()) {
-                               desktop = Desktop.getDesktop();
-                       }
-                       desktop.open(file);
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot open file " + file.getName(), e);
-               }
-       }
-       
-       
-       public void openFile(File file) {
-               try {
-                       Desktop desktop = null;
-                       if (Desktop.isDesktopSupported()) {
-                               desktop = Desktop.getDesktop();
-                       }
-                       desktop.open(file);
-               } catch (IOException e) {
-                       throw new ArgeoException("Cannot open file " + file.getName(), e);
-               }
-       }
 }