From 9df777e4120393be73dab723eb3189b1ec216965 Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Fri, 8 Mar 2013 09:52:57 +0000 Subject: [PATCH] fix bug on creation of the BundleRawPage git-svn-id: https://svn.argeo.org/slc/trunk@6106 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../ui/dist/editors/ArtifactsBrowserPage.java | 42 +++++++++---------- .../client/ui/dist/editors/BundleRawPage.java | 9 ++-- .../ui/dist/editors/GenericBundleEditor.java | 2 +- 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/ArtifactsBrowserPage.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/ArtifactsBrowserPage.java index f8979dea8..9f44f1611 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/ArtifactsBrowserPage.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/ArtifactsBrowserPage.java @@ -20,13 +20,9 @@ import java.text.SimpleDateFormat; import javax.jcr.Node; import javax.jcr.Property; -import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.Session; -import javax.jcr.Value; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.argeo.ArgeoException; import org.argeo.jcr.JcrUtils; import org.argeo.slc.client.ui.dist.DistConstants; @@ -62,8 +58,8 @@ import org.eclipse.ui.forms.widgets.ScrolledForm; public class ArtifactsBrowserPage extends FormPage implements DistConstants, RepoConstants { final static String PAGE_ID = "artifactsBrowserPage"; - private final static Log log = LogFactory - .getLog(ArtifactsBrowserPage.class); + // private final static Log log = LogFactory + // .getLog(ArtifactsBrowserPage.class); /* DEPENDENCY INJECTION */ private Session jcrSession; @@ -264,23 +260,23 @@ public class ArtifactsBrowserPage extends FormPage implements DistConstants, return null; } - private String formatValueAsString(Value value) { - // TODO enhance this method - try { - String strValue; - - if (value.getType() == PropertyType.BINARY) - strValue = ""; - else if (value.getType() == PropertyType.DATE) - strValue = timeFormatter.format(value.getDate().getTime()); - else - strValue = value.getString(); - return strValue; - } catch (RepositoryException e) { - throw new ArgeoException( - "unexpected error while formatting value", e); - } - } + // private String formatValueAsString(Value value) { + // // TODO enhance this method + // try { + // String strValue; + // + // if (value.getType() == PropertyType.BINARY) + // strValue = ""; + // else if (value.getType() == PropertyType.DATE) + // strValue = timeFormatter.format(value.getDate().getTime()); + // else + // strValue = value.getString(); + // return strValue; + // } catch (RepositoryException e) { + // throw new ArgeoException( + // "unexpected error while formatting value", e); + // } + // } } private class ArtifactTreeSelectionListener implements diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleRawPage.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleRawPage.java index 329adc890..d989cff93 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleRawPage.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleRawPage.java @@ -41,7 +41,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeColumn; import org.eclipse.ui.forms.IManagedForm; @@ -62,7 +61,6 @@ public class BundleRawPage extends FormPage implements SlcNames, SlcTypes { // This page widgets private TreeViewer complexTree; - private Text mavenSnippet; public BundleRawPage(FormEditor editor, String title, Node currentNode) { super(editor, "id", title); @@ -74,12 +72,11 @@ public class BundleRawPage extends FormPage implements SlcNames, SlcTypes { GridLayout layout = new GridLayout(1, false); layout.marginWidth = 5; form.getBody().setLayout(layout); - createViewer(form.getBody()); } private void createViewer(Composite parent) { - + // Create the viewer int style = SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION; Tree tree = new Tree(parent, style); @@ -91,6 +88,7 @@ public class BundleRawPage extends FormPage implements SlcNames, SlcTypes { createColumn(tree, "Value", SWT.LEFT, 200); tree.setLinesVisible(true); tree.setHeaderVisible(true); + complexTree = new TreeViewer(tree); // Configure complexTree.addDoubleClickListener(new GenericDoubleClickListener()); @@ -105,7 +103,6 @@ public class BundleRawPage extends FormPage implements SlcNames, SlcTypes { } - private static TreeColumn createColumn(Tree parent, String name, int style, int width) { TreeColumn result = new TreeColumn(parent, style); @@ -334,4 +331,4 @@ public class BundleRawPage extends FormPage implements SlcNames, SlcTypes { public void dispose() { } } -} +} \ No newline at end of file diff --git a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/GenericBundleEditor.java b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/GenericBundleEditor.java index 17e546aaf..1274f7c83 100644 --- a/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/GenericBundleEditor.java +++ b/plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/GenericBundleEditor.java @@ -56,7 +56,7 @@ public class GenericBundleEditor extends FormEditor { try { bundleDetailsPage = new BundleDetailsPage(this, "Main", bundleNode); addPage(bundleDetailsPage); - bundleRawPage = new BundleRawPage(this, "Main", bundleNode); + bundleRawPage = new BundleRawPage(this, "Raw info", bundleNode); addPage(bundleRawPage); } catch (PartInitException e) { throw new ArgeoException("Not able to add an empty page ", e); -- 2.39.2