+ Add refresh command to anonymous distribution browser
authorBruno Sinou <bsinou@argeo.org>
Mon, 18 Mar 2013 17:15:00 +0000 (17:15 +0000)
committerBruno Sinou <bsinou@argeo.org>
Mon, 18 Mar 2013 17:15:00 +0000 (17:15 +0000)
+ Add a source available check box to the bundle details page
+ fix an hard coded reference in JcrExecutionModulesView

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

plugins/org.argeo.slc.client.ui.dist/plugin.xml
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/PublishWorkspace.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/RefreshDistributionsView.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/AnonymousDistributionsView.java
plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/editors/ProcessBuilderPage.java
plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/JcrExecutionModulesView.java

index f4626e4b5f86f38e99a12bd5d49bf1c804e06407..618e62263e465a6f7730a222e06ae9afbfa858e6 100644 (file)
             </command>
             -->
         </menuContribution>
+        <menuContribution
+               locationURI="toolbar:org.argeo.slc.client.ui.dist.anonymousDistributionsView">
+            <command
+               commandId="org.argeo.slc.client.ui.dist.refreshDistributionsView"
+                icon="icons/refresh.png"
+                label="Refresh"
+                tooltip="Refresh distributions view">
+            </command>
+        </menuContribution>
         <!-- Queries --> 
                <!-- <menuContribution
                 allPopups="false"
index 6ce124310fa291b5b286f3080abaa9cc87dc7929..db2d4ebc04d1468838109f9bbbfa174baf585b62 100644 (file)
@@ -79,6 +79,7 @@ public class PublishWorkspace extends AbstractHandler {
                                JcrUtils.addPrivilege(session, "/", publicRole,
                                                Privilege.JCR_READ);
                                session.save();
+
                                JcrUtils.logoutQuietly(session);
                                // CommandHelpers.callCommand(RefreshDistributionsView.ID);
                        }
index 12bd61409656799cf1e7e20177f0e342063ce90e..11e8a7b7dca618822dfb95a0c1ef458be70ff28a 100644 (file)
@@ -16,6 +16,7 @@
 package org.argeo.slc.client.ui.dist.commands;
 
 import org.argeo.slc.client.ui.dist.DistPlugin;
+import org.argeo.slc.client.ui.dist.views.AnonymousDistributionsView;
 import org.argeo.slc.client.ui.dist.views.DistributionsView;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -36,6 +37,8 @@ public class RefreshDistributionsView extends AbstractHandler {
                                .getActiveWorkbenchWindow().getActivePage().getActivePart();
                if (activePart instanceof DistributionsView)
                        ((DistributionsView) activePart).refresh();
+               else if (activePart instanceof AnonymousDistributionsView)
+                       ((AnonymousDistributionsView) activePart).refresh();
                return null;
        }
 }
index 38f53794161586fab44be6aad46174a4286d1ce1..01824b943a8710c1af4c65d36462203ed1f64c75 100644 (file)
@@ -31,6 +31,8 @@ import org.argeo.slc.client.ui.dist.DistImages;
 import org.argeo.slc.client.ui.dist.utils.AbstractHyperlinkListener;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
+import org.argeo.slc.repo.RepoConstants;
+import org.argeo.slc.repo.RepoUtils;
 import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITreeContentProvider;
@@ -44,6 +46,7 @@ import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.Text;
@@ -116,12 +119,26 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
                createField(details, "Symbolic name", SlcNames.SLC_SYMBOLIC_NAME);
                createField(details, "Version", SlcNames.SLC_BUNDLE_VERSION);
                createField(details, "Group Id", SlcNames.SLC_GROUP_ID);
-               // Single sourcing issue: this does not works with rap
                createHyperlink(details, "Licence", DistConstants.SLC_BUNDLE_LICENCE);
-               // createField(details, "Licence", DistConstants.SLC_BUNDLE_LICENCE);
-
                createField(details, "Vendor", DistConstants.SLC_BUNDLE_VENDOR);
+               addSourceAvailableLabel(details);
+
+       }
+
+       // helper to check if sources are available
+       private void addSourceAvailableLabel(Composite parent) {
+               Button srcChk = toolkit.createButton(parent, "Sources available",
+                               SWT.CHECK);
+               srcChk.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
 
+               try {
+                       String srcPath = RepoUtils.relatedPdeSourcePath(
+                                       RepoConstants.DEFAULT_ARTIFACTS_BASE_PATH, currBundle);
+                       srcChk.setSelection(currBundle.getSession().nodeExists(srcPath));
+               } catch (RepositoryException e) {
+                       throw new SlcException("Unable to check sources", e);
+               }
+               srcChk.setEnabled(false);
        }
 
        // Workaround to add an artificial level to the export package browser
index 004e069574eaac0bb530f6a9d92002e3c2bd633c..ed57feccdd6d122eb784bca74e89b4211dc1d709 100644 (file)
@@ -38,7 +38,8 @@ public class AnonymousDistributionsView extends ViewPart implements SlcNames,
                ArgeoNames {
        // private final static Log log = LogFactory
        // .getLog(AnonymousDistributionsView.class);
-       public final static String ID = DistPlugin.ID + ".anonymousDistributionsView";
+       public final static String ID = DistPlugin.ID
+                       + ".anonymousDistributionsView";
 
        /* DEPENDENCY INJECTION */
        private ITreeContentProvider treeContentProvider;
@@ -73,8 +74,10 @@ public class AnonymousDistributionsView extends ViewPart implements SlcNames,
         * Force refresh of the whole view
         */
        public void refresh() {
+               Object[] ee = viewer.getExpandedElements();
                viewer.setInput(DistConstants.DEFAULT_PUBLIC_REPOSITORY_URI);
-               viewer.expandToLevel(2);
+               // viewer.expandToLevel(2);
+               viewer.setExpandedElements(ee);
        }
 
        @Override
index c3e07153c371d29f9dc197874f71996c045eb1c0..5209459771f83dc87232a666cbca32f9f5b899ab 100644 (file)
@@ -33,11 +33,9 @@ import javax.jcr.query.Query;
 import javax.jcr.query.QueryManager;
 
 import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.ErrorFeedback;
 import org.argeo.eclipse.ui.jcr.AsyncUiEventListener;
 import org.argeo.jcr.JcrUtils;
 import org.argeo.slc.SlcException;
-import org.argeo.slc.client.ui.ClientUiPlugin;
 import org.argeo.slc.client.ui.SlcImages;
 import org.argeo.slc.core.execution.PrimitiveAccessor;
 import org.argeo.slc.core.execution.PrimitiveUtils;
@@ -251,6 +249,8 @@ public class ProcessBuilderPage extends FormPage implements SlcNames {
                GridData valuedGd = new GridData(SWT.FILL, SWT.FILL, true, true);
                // valuedGd.widthHint = 200;
                valuesViewer.getTable().setLayoutData(valuedGd);
+               valuesViewer.getTable().setHeaderVisible(true);
+
                valuesViewer.setContentProvider(new ValuesContentProvider());
                initializeValuesViewer(valuesViewer);
                sashForm.setWeights(getWeights());
@@ -724,7 +724,7 @@ public class ProcessBuilderPage extends FormPage implements SlcNames {
                                }
                                return null;
                        } catch (RepositoryException e) {
-                               throw new SlcException("Cannot get celle editor", e);
+                               throw new SlcException("Cannot get cell editor", e);
                        }
                }
 
index 38336f4673e3cc7e7b471779154b075b92b6b15e..3aa59d693f9aeba03d7838459a6f58908a27ee17 100644 (file)
@@ -74,7 +74,8 @@ public class JcrExecutionModulesView extends ViewPart implements SlcTypes,
        private final static Log log = LogFactory
                        .getLog(JcrExecutionModulesView.class);
 
-       public static final String ID = "org.argeo.slc.client.ui.jcrExecutionModulesView";
+       public static final String ID = ClientUiPlugin.ID
+                       + ".jcrExecutionModulesView";
 
        private TreeViewer viewer;