Massive Argeo APIs refactoring
[gpl/argeo-suite.git] / org.argeo.library.ui / src / org / argeo / library / ui / DocumentsFileComposite.java
index 10cf3bd14f492b60d7fc68c8238d534be040bcf2..c9f4889592f8ef66822a3858199f4c20934ac42d 100644 (file)
@@ -6,10 +6,8 @@ import java.nio.file.Path;
 import java.nio.file.spi.FileSystemProvider;
 
 import javax.jcr.Node;
-import javax.jcr.RepositoryException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.argeo.api.cms.CmsLog;
 import org.argeo.cms.fs.CmsFsUtils;
 import org.argeo.cms.ui.util.CmsUiUtils;
 import org.argeo.eclipse.ui.EclipseUiUtils;
@@ -30,15 +28,14 @@ import org.eclipse.swt.widgets.Label;
 public class DocumentsFileComposite extends Composite {
        private static final long serialVersionUID = -7567632342889241793L;
 
-       private final static Log log = LogFactory.getLog(DocumentsFileComposite.class);
+       private final static CmsLog log = CmsLog.getLog(DocumentsFileComposite.class);
 
        private final Node currentBaseContext;
 
        // UI Parts for the browser
        private Composite rightPannelCmp;
 
-       public DocumentsFileComposite(Composite parent, int style, Node context,
-                       FileSystemProvider fsp) {
+       public DocumentsFileComposite(Composite parent, int style, Node context, FileSystemProvider fsp) {
                super(parent, style);
                this.currentBaseContext = context;
                this.setLayout(EclipseUiUtils.noSpaceGridLayout());
@@ -61,19 +58,15 @@ public class DocumentsFileComposite extends Composite {
                // browser.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true,
                // true));
                browser.setLayoutData(EclipseUiUtils.fillAll());
-               try {
-                       // FIXME make it more robust
-                       String url = CmsUiUtils.getDataUrl(currentBaseContext, UiContext.getHttpRequest());
-                       // FIXME issue with the redirection to https
-                       if (url.startsWith("http://") && !url.startsWith("http://localhost"))
-                               url = "https://" + url.substring("http://".length(), url.length());
-                       if (log.isTraceEnabled())
-                               log.debug("Trying to display " + url);
-                       browser.setUrl(url);
-                       browser.layout(true, true);
-               } catch (RepositoryException re) {
-                       throw new IllegalStateException("Cannot open file at " + currentBaseContext, re);
-               }
+               // FIXME make it more robust
+               String url = CmsUiUtils.getDataUrl(currentBaseContext, UiContext.getHttpRequest());
+               // FIXME issue with the redirection to https
+               if (url.startsWith("http://") && !url.startsWith("http://localhost"))
+                       url = "https://" + url.substring("http://".length(), url.length());
+               if (log.isTraceEnabled())
+                       log.debug("Trying to display " + url);
+               browser.setUrl(url);
+               browser.layout(true, true);
        }
 
        /**
@@ -118,8 +111,8 @@ public class DocumentsFileComposite extends Composite {
        // Simplify UI implementation
        private void addProperty(Composite parent, String propName, String value) {
                Label propLbl = new Label(parent, SWT.NONE);
-               //propLbl.setText(ConnectUtils.replaceAmpersand(propName + ": " + value));
+               // propLbl.setText(ConnectUtils.replaceAmpersand(propName + ": " + value));
                propLbl.setText(value);
-               //CmsUiUtils.markup(propLbl);
+               // CmsUiUtils.markup(propLbl);
        }
 }