-> Finalisation of file download for RAP
authorBruno Sinou <bsinou@argeo.org>
Wed, 9 Mar 2011 22:45:26 +0000 (22:45 +0000)
committerBruno Sinou <bsinou@argeo.org>
Wed, 9 Mar 2011 22:45:26 +0000 (22:45 +0000)
-> some little UI Bugs

git-svn-id: https://svn.argeo.org/commons/trunk@4277 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

eclipse/runtime/org.argeo.eclipse.ui.jcr/pom.xml
eclipse/runtime/org.argeo.eclipse.ui.rap/pom.xml
eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/FileHandler.java
eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/FileProvider.java [new file with mode: 0644]

index 5e42d87adc7b34d7764b160fc6041e8652a38709..b3aa8239b8e75413c072cdccf7c5361c6a38f2f3 100644 (file)
                                <configuration>
                                        <instructions>
                                                <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
+                                               <Require-Bundle>org.eclipse.ui;resolution:=optional,org.eclipse.rap.ui;resolution:=optional,org.eclipse.core.runtime</Require-Bundle>
                                                <Import-Package>
                                                        org.eclipse.swt,
                                                        org.argeo.eclipse.ui.specific,
                                                        *
                                                </Import-Package>
-                                               <Require-Bundle>org.eclipse.ui;resolution:=optional,org.eclipse.rap.ui;resolution:=optional,org.eclipse.core.runtime</Require-Bundle>
                                        </instructions>
                                </configuration>
                        </plugin>
@@ -94,6 +94,5 @@
                        <groupId>org.slf4j</groupId>
                        <artifactId>com.springsource.slf4j.org.apache.commons.logging</artifactId>
                </dependency>
-
        </dependencies>
 </project>
index 9a92853bdee1c96ab7e7d13f238974183aa56fc5..7dcb9622b1fd2c52979cfbd90deb22bc1a3efa00 100644 (file)
                                        <instructions>
                                                <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
                                                <Bundle-Activator>org.argeo.eclipse.ui.ArgeoUiPlugin</Bundle-Activator>
-                                               <Require-Bundle>org.eclipse.rap.ui,org.eclipse.core.runtime</Require-Bundle>
+                                               <Require-Bundle>org.eclipse.rap.ui,org.eclipse.rwt.widgets.upload,org.eclipse.core.runtime</Require-Bundle>
+                                               <!-- IMPORTANT : Note that we must exclude certain packages that are 
+                                                       provided by dependencies to be sure that packages used in the current workspace 
+                                                       are those provided by the require-bundles. Especially rwt.widgets.upload 
+                                                       by instance. -->
                                                <Import-Package>
                                                        org.apache.commons.io,
                                                        org.argeo,
                                                        org.springframework.beans.factory,
                                                        org.springframework.core.io.support,
+                                                       !org.eclipse.rwt.widgets,
                                                        !org.eclipse.core.runtime,
                                                        !org.eclipse.core.commands,
                                                        !org.eclipse.ui.plugin,
                        <version>${version.argeo-commons}</version>
                </dependency>
 
+               <dependency>
+                       <groupId>org.argeo.dep.rap</groupId>
+                       <artifactId>org.eclipse.rwt.widgets.upload</artifactId>
+               </dependency>
+
                <!-- Logging -->
                <dependency>
                        <groupId>org.slf4j</groupId>
index 93e9d9213e848834cfd9816d0472ac83016c2776..b9c4d31d3fcbe4a0bb74d5c4891f15becb963383 100644 (file)
@@ -17,10 +17,12 @@ import org.argeo.ArgeoException;
  */
 public class FileHandler {
 
-       public FileHandler() {
+       // unused file provider : collateral effects of single sourcing, this File
+       // provider is compulsory for RAP file handler
+       public FileHandler(FileProvider jfp) {
        }
 
-       public void openFile(String fileName, InputStream is) {
+       public void openFile(String fileName, String fileId, InputStream is) {
 
                String prefix = "", extension = "";
                if (fileName != null) {
@@ -44,7 +46,7 @@ public class FileHandler {
                }
        }
 
-       public void openFile(File file) {
+       private void openFile(File file) {
                try {
                        Desktop desktop = null;
                        if (Desktop.isDesktopSupported()) {
diff --git a/eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/FileProvider.java b/eclipse/runtime/org.argeo.eclipse.ui.rcp/src/main/java/org/argeo/eclipse/ui/specific/FileProvider.java
new file mode 100644 (file)
index 0000000..ba4946d
--- /dev/null
@@ -0,0 +1,14 @@
+package org.argeo.eclipse.ui.specific;
+
+/**
+ * Used for file download : subclasses must implement model specific methods to
+ * get a byte array representing a file given is ID.
+ * 
+ * @author bsinou
+ * 
+ */
+public interface FileProvider {
+
+       public byte[] getByteArrayFileFromId(String fileId);
+
+}