Skip to content
Browse files

Add readme+rap demo.

  • Loading branch information...
1 parent 79d4385 commit 0de84109b9e876bd4cf3ed0672e6c72c0e1f714f @angelozerr angelozerr committed Aug 10, 2012
Showing with 359 additions and 135 deletions.
  1. +20 −11 com.mongodb.tools/src/com/mongodb/tools/driver/StatsHelper.java
  2. BIN fr.opensagres.mongodb.ide.core/bin/fr/opensagres/mongodb/ide/core/utils/StringUtils.class
  3. +19 −18 ...ensagres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/CollectionListStats.java
  4. +51 −48 fr.opensagres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/CollectionStats.java
  5. +7 −9 fr.opensagres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/IndexStats.java
  6. +4 −0 fr.opensagres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/utils/StringUtils.java
  7. +7 −0 fr.opensagres.mongodb.ide.demo/.classpath
  8. +28 −0 fr.opensagres.mongodb.ide.demo/.project
  9. +8 −0 fr.opensagres.mongodb.ide.demo/.settings/org.eclipse.jdt.core.prefs
  10. +13 −0 fr.opensagres.mongodb.ide.demo/META-INF/MANIFEST.MF
  11. +5 −0 fr.opensagres.mongodb.ide.demo/build.properties
  12. +12 −0 fr.opensagres.mongodb.ide.demo/plugin.properties
  13. +63 −0 fr.opensagres.mongodb.ide.demo/src/fr/opensagres/mongodb/ide/demo/internal/Activator.java
  14. BIN ...nsagres.mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/editors/collection/CollectionEditor.class
  15. BIN fr.opensagres.mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/internal/Messages.class
  16. +6 −1 fr.opensagres.mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/internal/Messages.properties
  17. +0 −6 ...ensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/collection/CollectionEditor.java
  18. +52 −1 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/collection/OverviewPage.java
  19. +0 −1 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/database/DatabaseEditor.java
  20. +2 −2 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/database/StatsPage.java
  21. +3 −1 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/internal/Messages.java
  22. +6 −1 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/internal/Messages.properties
  23. +4 −4 ...pensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/editor/GradientProgressBar.java
  24. +1 −1 ...res.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/editor/IProgressBarValueProvider.java
  25. +7 −5 ...mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsAvgObjColumnLabelProvider.java
  26. +7 −5 ....mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsCountColumnLabelProvider.java
  27. +8 −8 ...godb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsIndexSizeColumnLabelProvider.java
  28. +7 −5 ...ongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsPaddingColumnLabelProvider.java
  29. +5 −4 ...s.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsSizeColumnLabelProvider.java
  30. +5 −4 ...ongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsStorageColumnLabelProvider.java
  31. +9 −0 readme.md
View
31 com.mongodb.tools/src/com/mongodb/tools/driver/StatsHelper.java
@@ -12,32 +12,41 @@
private static final String PADDING = "paddingFactor";
private static final String INDEX_SIZES = "indexSizes";
- public static double getSize(CommandResult stats) {
- return stats.getDouble(SIZE);
+ public static Integer getSize(CommandResult stats) {
+ return getInteger(stats, SIZE);
}
- public static double getCount(CommandResult stats) {
- return stats.getDouble(COUNT);
+ public static Integer getCount(CommandResult stats) {
+ return getInteger(stats, COUNT);
}
- public static double getStorage(CommandResult stats) {
- return stats.getDouble(STORAGE);
+ public static Integer getStorage(CommandResult stats) {
+ return getInteger(stats, STORAGE);
}
- public static double getAvgObj(CommandResult stats) {
- return stats.getDouble(AVG_OBJ);
+ public static Integer getAvgObj(CommandResult stats) {
+ return getInteger(stats, AVG_OBJ);
}
- public static double getPadding(CommandResult stats) {
- return stats.getDouble(PADDING);
+ public static Integer getPadding(CommandResult stats) {
+ return getInteger(stats, PADDING);
}
public static BasicDBObject getIndexSizes(CommandResult stats) {
return (BasicDBObject) stats.get(INDEX_SIZES);
}
- public static String formatAsBytes(double value) {
+ public static String formatAsBytes(Integer value) {
+ if (value == null) {
+ return "";
+ }
return String.valueOf(value);
}
+ public static Integer getInteger(CommandResult stats, String key) {
+ if (stats.containsField(key)) {
+ return stats.getInt(key);
+ }
+ return null;
+ }
}
View
BIN fr.opensagres.mongodb.ide.core/bin/fr/opensagres/mongodb/ide/core/utils/StringUtils.class
Binary file not shown.
View
37 ....mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/CollectionListStats.java
@@ -9,12 +9,12 @@
public class CollectionListStats extends ArrayList<CollectionStats> {
- private double totalSize;
- private double totalCount;
- private double totalStorage;
- private double totalAvgObj;
- private double totalPadding;
- private double totalIndexSize;
+ private Integer totalSize;
+ private Integer totalCount;
+ private Integer totalStorage;
+ private Integer totalAvgObj;
+ private Integer totalPadding;
+ private Integer totalIndexSize;
public CollectionListStats(int size) {
super(size);
@@ -24,36 +24,37 @@ public CollectionListStats(int size) {
@Override
public boolean add(CollectionStats stats) {
- totalSize += stats.getSize();
- totalCount += stats.getCount();
- totalStorage += stats.getStorage();
- totalAvgObj += stats.getAvgObj();
- totalPadding += stats.getPadding();
- totalIndexSize += stats.getTotalIndexSize();
+ totalSize = CollectionStats.add(totalSize, stats.getSize());
+ totalCount = CollectionStats.add(totalCount, stats.getCount());
+ totalStorage = CollectionStats.add(totalStorage, stats.getStorage());
+ totalAvgObj = CollectionStats.add(totalAvgObj, stats.getAvgObj());
+ totalPadding = CollectionStats.add(totalPadding, stats.getPadding());
+ totalIndexSize = CollectionStats.add(totalIndexSize,
+ stats.getTotalIndexSize());
return super.add(stats);
}
- public double getTotalSize() {
+ public Integer getTotalSize() {
return totalSize;
}
- public double getTotalCount() {
+ public Integer getTotalCount() {
return totalCount;
}
- public double getTotalStorage() {
+ public Integer getTotalStorage() {
return totalStorage;
}
- public double getTotalAvgObj() {
+ public Integer getTotalAvgObj() {
return totalAvgObj;
}
- public double getTotalPadding() {
+ public Integer getTotalPadding() {
return totalPadding;
}
- public double getTotalIndexSize() {
+ public Integer getTotalIndexSize() {
return totalIndexSize;
}
View
99 ...gres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/CollectionStats.java
@@ -23,12 +23,12 @@
private final CollectionListStats listStats;
private final Collection collection;
- private double count;
- private double size;
- private double storage;
- private double totalIndexSize;
- private double avgObj;
- private double padding;
+ private Integer count;
+ private Integer size;
+ private Integer storage;
+ private Integer totalIndexSize;
+ private Integer avgObj;
+ private Integer padding;
public CollectionStats(CollectionListStats listStats, Collection collection)
throws UnknownHostException, MongoException {
@@ -59,78 +59,63 @@ public String getName() {
return collection.getName();
}
- public double getCount() {
+ public Integer getCount() {
return count;
}
- public double getPercentCount() {
- double totalCount = listStats.getTotalCount();
- if (count == 0) {
- return 0;
- }
- return (count / totalCount) * 100;
+ public Integer getPercentCount() {
+ Integer totalCount = listStats.getTotalCount();
+ return getPercent(count, totalCount);
}
- public double getSize() {
+ public Integer getSize() {
return size;
}
- public double getPercentSize() {
- double totalSize = listStats.getTotalSize();
- if (size == 0) {
- return 0;
- }
- return (size / totalSize) * 100;
+ public Integer getPercentSize() {
+ Integer totalSize = listStats.getTotalSize();
+ return getPercent(size, totalSize);
}
- public double getStorage() {
+ public Integer getStorage() {
return storage;
}
- public double getPercentStorage() {
- double totalStorage = listStats.getTotalStorage();
- if (storage == 0) {
- return 0;
- }
- return (storage / totalStorage) * 100;
+ public Integer getPercentStorage() {
+ Integer totalStorage = listStats.getTotalStorage();
+ return getPercent(storage, totalStorage);
}
- public double getAvgObj() {
+ public Integer getAvgObj() {
return avgObj;
}
- public double getPercentAvgObj() {
- double totalAvgObj = listStats.getTotalAvgObj();
- if (avgObj == 0) {
- return 0;
- }
- return (avgObj / totalAvgObj) * 100;
+ public Integer getPercentAvgObj() {
+ Integer totalAvgObj = listStats.getTotalAvgObj();
+ return getPercent(avgObj, totalAvgObj);
}
- public double getPadding() {
+ public Integer getPadding() {
return padding;
}
- public double getPercentPadding() {
- double totalPadding = listStats.getTotalPadding();
- if (padding == 0) {
- return 0;
- }
- return (padding / totalPadding) * 100;
+ public Integer getPercentPadding() {
+ Integer totalPadding = listStats.getTotalPadding();
+ return getPercent(padding, totalPadding);
}
@Override
public boolean add(IndexStats stats) {
- double size = stats.getIndexSize();
- totalIndexSize += size;
+ Integer size = stats.getIndexSize();
+ totalIndexSize = add(totalIndexSize, size);
return super.add(stats);
}
- public double getTotalIndexSize() {
+ public Integer getTotalIndexSize() {
return totalIndexSize;
}
- public void addIndex(String id, double indexSize)
+ public void addIndex(String id, Integer indexSize)
throws UnknownHostException, MongoException {
add(new IndexStats(this, id, indexSize));
}
@@ -139,8 +124,26 @@ public CollectionListStats getListStats() {
return listStats;
}
- public double getPercentIndexSize() {
- double totalSize = listStats.getTotalIndexSize();
- return (totalIndexSize / totalSize) * 100;
+ public Integer getPercentIndexSize() {
+ Integer totalSize = listStats.getTotalIndexSize();
+ return getPercent(totalIndexSize, totalSize);
+ }
+
+ public static Integer getPercent(Integer value, Integer totalValue) {
+ if (value == null || totalValue == null) {
+ return null;
+ }
+ double d = ((double) value / (double) totalValue) * 100;
+ return (int) Math.floor(d);
+ }
+
+ public static Integer add(Integer total, Integer value) {
+ if (value == null) {
+ return total;
+ }
+ if (total == null) {
+ return value;
+ }
+ return total + value;
}
}
View
16 ...pensagres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/IndexStats.java
@@ -4,9 +4,10 @@
private final CollectionStats collectionStats;
private final String id;
- private final double indexSize;
+ private final Integer indexSize;
- public IndexStats(CollectionStats collectionStats, String id, double indexSize) {
+ public IndexStats(CollectionStats collectionStats, String id,
+ Integer indexSize) {
this.collectionStats = collectionStats;
this.id = id;
this.indexSize = indexSize;
@@ -16,15 +17,12 @@ public String getId() {
return id;
}
- public double getIndexSize() {
+ public Integer getIndexSize() {
return indexSize;
}
- public double getPercentIndexSize() {
- double totalSize = collectionStats.getListStats().getTotalIndexSize();
- if (indexSize == 0) {
- return 0;
- }
- return (indexSize / totalSize) * 100;
+ public Integer getPercentIndexSize() {
+ Integer totalSize = collectionStats.getListStats().getTotalIndexSize();
+ return CollectionStats.getPercent(indexSize, totalSize);
}
}
View
4 fr.opensagres.mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/utils/StringUtils.java
@@ -43,4 +43,8 @@ public static boolean isEmpty(String str) {
public static boolean isNotEmpty(String str) {
return str != null && str.length() > 0;
}
+
+ public static String getValue(Integer value) {
+ return value != null ? String.valueOf(value) : "";
+ }
}
View
7 fr.opensagres.mongodb.ide.demo/.classpath
@@ -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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
View
28 fr.opensagres.mongodb.ide.demo/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>fr.opensagres.mongodb.ide.demo</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>
View
8 fr.opensagres.mongodb.ide.demo/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Aug 03 07:57:20 CEST 2012
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
View
13 fr.opensagres.mongodb.ide.demo/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-SymbolicName: fr.opensagres.mongodb.ide.demo
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: fr.opensagres.mongodb.ide.demo.internal.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ fr.opensagres.mongodb.ide.core;bundle-version="1.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: com.mongodb
View
5 fr.opensagres.mongodb.ide.demo/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties
View
12 fr.opensagres.mongodb.ide.demo/plugin.properties
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2012 Angelo Zerr and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Angelo Zerr <angelo.zerr@gmail.com> - Initial API and implementation
+###############################################################################
+pluginName=MongoDB IDE Demo
+providerName=Opensagres
View
63 fr.opensagres.mongodb.ide.demo/src/fr/opensagres/mongodb/ide/demo/internal/Activator.java
@@ -0,0 +1,63 @@
+package fr.opensagres.mongodb.ide.demo.internal;
+
+import java.util.List;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import com.mongodb.MongoURI;
+
+import fr.opensagres.mongodb.ide.core.Platform;
+import fr.opensagres.mongodb.ide.core.model.Server;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ private Server server;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ if (!hasMongoHQServer()) {
+ server = new Server("MongoHQ", new MongoURI(
+ "mongodb://a:a@staff.mongohq.com:10093/testangelo"));
+ Platform.getServerManager().addServer(server);
+ }
+ }
+
+ private boolean hasMongoHQServer() {
+ List<Server> servers = Platform.getServerManager().getServers();
+ for (Server server : servers) {
+ if ("MongoHQ".equals(server.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ if (server != null) {
+ Platform.getServerManager().removeServer(server);
+ server = null;
+ }
+ Activator.context = null;
+ }
+
+}
View
BIN ...mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/editors/collection/CollectionEditor.class
Binary file not shown.
View
BIN fr.opensagres.mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/internal/Messages.class
Binary file not shown.
View
7 fr.opensagres.mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/internal/Messages.properties
@@ -81,7 +81,6 @@ DatabaseEditor_OverviewPage_DatabaseContent_content=<form>\
<p>The content of the Mongo database is made up of several sections:</p>\
<li style="image" value="stats_page" bindent="5"><a href="stats">Stats</a>: list of collection and indexes stats.</li>\
<li style="image" value="users_page" bindent="5"><a href="users">Users</a>: list the users.</li>\
-<li style="image" value="indexes_page" bindent="5"><a href="indexes">Indexes</a>: list the indexes.</li>\
</form>
StatsPage_title=Stats
UsersPage_title=Users
@@ -94,6 +93,12 @@ IndexesPage_title=Indexes
# Collection editor
DocumentsPage_title=Documents
+CollectionEditor_OverviewPage_CollectionContent_title=Collection content
+CollectionEditor_OverviewPage_CollectionContent_content=<form>\
+<p>The content of the Mongo collection is made up of several sections:</p>\
+<li style="image" value="documents_page" bindent="5"><a href="documents">Documents</a>: list of documents of this collection.</li>\
+<li style="image" value="indexes_page" bindent="5"><a href="indexes">Indexes</a>: list the indexes.</li>\
+</form>
# Document editor
JSONTextPage_title=JSON
View
6 ....mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/collection/CollectionEditor.java
@@ -29,12 +29,6 @@ protected String getOverridePartName() {
}
@Override
- protected String getActivePageIdOnLoad() {
- // select "Documents" tab.
- return DocumentsPage.ID;
- }
-
- @Override
protected void onSave(IProgressMonitor monitor) {
}
View
53 ...gres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/collection/OverviewPage.java
@@ -1,26 +1,34 @@
package fr.opensagres.mongodb.ide.ui.editors.collection;
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.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.forms.widgets.TableWrapData;
+import fr.opensagres.mongodb.ide.core.Platform;
import fr.opensagres.mongodb.ide.core.model.Collection;
import fr.opensagres.mongodb.ide.core.model.Database;
import fr.opensagres.mongodb.ide.core.model.Server;
import fr.opensagres.mongodb.ide.ui.FormLayoutFactory;
+import fr.opensagres.mongodb.ide.ui.dialogs.StackTraceErrorDialog;
import fr.opensagres.mongodb.ide.ui.editors.AbstractToolbarFormPage;
import fr.opensagres.mongodb.ide.ui.editors.UIFieldsFactory;
+import fr.opensagres.mongodb.ide.ui.internal.ImageResources;
import fr.opensagres.mongodb.ide.ui.internal.Messages;
import fr.opensagres.mongodb.ide.ui.singlesourcing.SingleSourcingUtils;
-public class OverviewPage extends AbstractToolbarFormPage {
+public class OverviewPage extends AbstractToolbarFormPage implements
+ IHyperlinkListener {
public static final String ID = "overview";
private Label serverLabel;
@@ -32,6 +40,11 @@ public OverviewPage(CollectionEditor editor) {
}
@Override
+ protected Image getFormTitleImage() {
+ return ImageResources.getImage(ImageResources.IMG_COLLECTION_16);
+ }
+
+ @Override
protected void fillBody(IManagedForm managedForm, FormToolkit toolkit) {
Composite body = managedForm.getForm().getBody();
body.setLayout(FormLayoutFactory.createFormTableWrapLayout(true, 2));
@@ -49,6 +62,8 @@ protected void fillBody(IManagedForm managedForm, FormToolkit toolkit) {
right.setLayout(FormLayoutFactory.createFormPaneTableWrapLayout(false,
1));
right.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ // Content section
+ createContentSection(toolkit, right);
// createTimeoutSection(right, toolkit);
@@ -95,6 +110,30 @@ protected void createGeneralInfoSection(Composite left, FormToolkit toolkit) {
}
+ private void createContentSection(FormToolkit toolkit, Composite parent) {
+ Section section = toolkit.createSection(parent, Section.TITLE_BAR);
+ section.setText(Messages.CollectionEditor_OverviewPage_CollectionContent_title);
+ TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
+ section.setLayoutData(data);
+
+ Composite sbody = toolkit.createComposite(section);
+ section.setClient(sbody);
+
+ Composite container = createStaticSectionClient(toolkit, section);
+
+ FormText text = createClient(
+ container,
+ Messages.CollectionEditor_OverviewPage_CollectionContent_content,
+ toolkit, this);
+ text.setImage("documents_page",
+ ImageResources.getImage(ImageResources.IMG_DOCUMENT_16));
+ text.setImage("indexes_page",
+ ImageResources.getImage(ImageResources.IMG_INDEX_16));
+ section.setClient(container);
+
+ SingleSourcingUtils.FormToolkit_paintBordersFor(toolkit, sbody);
+ }
+
private void initialize() {
Collection collection = ((CollectionEditor) getEditor())
@@ -106,4 +145,16 @@ private void initialize() {
nameText.setText(collection.getName());
}
+ public void linkActivated(HyperlinkEvent e) {
+ String href = (String) e.getHref();
+ getEditor().setActivePage(href);
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+ // Do nothing
+ }
+
+ public void linkExited(HyperlinkEvent e) {
+ // Do nothing
+ }
}
View
1 ...gres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/database/DatabaseEditor.java
@@ -5,7 +5,6 @@
import fr.opensagres.mongodb.ide.core.model.Database;
import fr.opensagres.mongodb.ide.ui.editors.BasicModelFormEditor;
-import fr.opensagres.mongodb.ide.ui.editors.collection.IndexesPage;
public class DatabaseEditor extends
BasicModelFormEditor<DatabaseEditorInput, Database> {
View
4 ...pensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/editors/database/StatsPage.java
@@ -120,7 +120,7 @@ private static void createColumns(final TreeViewer viewer) {
CollectionStats.SIZE_PROPERTY);
// Storage column
- ViewerHelper.createColumn(viewer, Messages.columnStorage, 50,
+ ViewerHelper.createColumn(viewer, Messages.columnStorage, 60,
StatsStorageColumnLabelProvider.getInstance(),
CollectionStats.STORAGE_PROPERTY);
@@ -135,7 +135,7 @@ private static void createColumns(final TreeViewer viewer) {
CollectionStats.AVGOBJ_PROPERTY);
// Padding column
- ViewerHelper.createColumn(viewer, Messages.columnPadding, 50,
+ ViewerHelper.createColumn(viewer, Messages.columnPadding, 60,
StatsPaddingColumnLabelProvider.getInstance(),
CollectionStats.PADDING_PROPERTY);
View
4 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/internal/Messages.java
@@ -92,7 +92,9 @@
// Collection Editor
public static String DocumentsPage_title;
-
+ public static String CollectionEditor_OverviewPage_CollectionContent_title;
+ public static String CollectionEditor_OverviewPage_CollectionContent_content;
+
// Document Editor
public static String JSONTextPage_title;
View
7 fr.opensagres.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/internal/Messages.properties
@@ -81,7 +81,6 @@ DatabaseEditor_OverviewPage_DatabaseContent_content=<form>\
<p>The content of the Mongo database is made up of several sections:</p>\
<li style="image" value="stats_page" bindent="5"><a href="stats">Stats</a>: list of collection and indexes stats.</li>\
<li style="image" value="users_page" bindent="5"><a href="users">Users</a>: list the users.</li>\
-<li style="image" value="indexes_page" bindent="5"><a href="indexes">Indexes</a>: list the indexes.</li>\
</form>
StatsPage_title=Stats
UsersPage_title=Users
@@ -94,6 +93,12 @@ IndexesPage_title=Indexes
# Collection editor
DocumentsPage_title=Documents
+CollectionEditor_OverviewPage_CollectionContent_title=Collection content
+CollectionEditor_OverviewPage_CollectionContent_content=<form>\
+<p>The content of the Mongo collection is made up of several sections:</p>\
+<li style="image" value="documents_page" bindent="5"><a href="documents">Documents</a>: list of documents of this collection.</li>\
+<li style="image" value="indexes_page" bindent="5"><a href="indexes">Indexes</a>: list the indexes.</li>\
+</form>
# Document editor
JSONTextPage_title=JSON
View
8 ...s.mongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/editor/GradientProgressBar.java
@@ -14,13 +14,13 @@
public class GradientProgressBar extends Canvas {
private final IWidthProvider widthProvider;
- private double value;
+ private int value;
private String text;
private Color cf;
private Color cg;
public GradientProgressBar(Composite parent, int style, Color background,
- IWidthProvider widthProvider, double value, String text) {
+ IWidthProvider widthProvider, int value, String text) {
super(parent, style);
this.widthProvider = widthProvider;
this.value = value;
@@ -51,7 +51,7 @@ private void onPaint(PaintEvent e) {
gc.setForeground(cg);
gc.setBackground(cf);
int totalWidth = widthProvider.getWidth();
- int width = totalWidth * (int) value / 100;
+ int width = totalWidth * value / 100;
gc.fillGradientRectangle(x, y, width, height, true);
Rectangle rect2 = new Rectangle(x, y, width - 1, height - 1);
gc.drawRectangle(rect2);
@@ -67,7 +67,7 @@ public double getValue() {
return value;
}
- public void setValue(double value) {
+ public void setValue(int value) {
this.value = value;
}
View
2 ...odb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/editor/IProgressBarValueProvider.java
@@ -2,5 +2,5 @@
public interface IProgressBarValueProvider {
- double getProgressBarValue(Object element);
+ int getProgressBarValue(Object element);
}
View
12 ...ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsAvgObjColumnLabelProvider.java
@@ -1,6 +1,7 @@
package fr.opensagres.mongodb.ide.ui.viewers.stats;
import fr.opensagres.mongodb.ide.core.model.stats.CollectionStats;
+import fr.opensagres.mongodb.ide.core.utils.StringUtils;
import fr.opensagres.mongodb.ide.ui.viewers.editor.GradientProgressBarColumnLabelProvider;
public class StatsAvgObjColumnLabelProvider extends
@@ -20,8 +21,8 @@ public static StatsAvgObjColumnLabelProvider getInstance() {
@Override
public String getText(Object element) {
if (element instanceof CollectionStats) {
- double avgObj = ((CollectionStats) element).getAvgObj();
- return String.valueOf(avgObj);
+ Integer avgObj = ((CollectionStats) element).getAvgObj();
+ return StringUtils.getValue(avgObj);
}
return "";
}
@@ -33,11 +34,12 @@ public String getText(Object element) {
* fr.opensagres.mongodb.ide.ui.viewers.editor.IProgressBarValueProvider
* #getProgressBarValue(java.lang.Object)
*/
- public double getProgressBarValue(Object element) {
+ public int getProgressBarValue(Object element) {
+ Integer value = null;
if (element instanceof CollectionStats) {
CollectionStats stats = (CollectionStats) element;
- return Math.round(stats.getPercentAvgObj());
+ value = stats.getPercentAvgObj();
}
- return 0;
+ return value != null ? value : 0;
}
}
View
12 ....ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsCountColumnLabelProvider.java
@@ -1,6 +1,7 @@
package fr.opensagres.mongodb.ide.ui.viewers.stats;
import fr.opensagres.mongodb.ide.core.model.stats.CollectionStats;
+import fr.opensagres.mongodb.ide.core.utils.StringUtils;
import fr.opensagres.mongodb.ide.ui.viewers.editor.GradientProgressBarColumnLabelProvider;
public class StatsCountColumnLabelProvider extends
@@ -20,8 +21,8 @@ public static StatsCountColumnLabelProvider getInstance() {
@Override
public String getText(Object element) {
if (element instanceof CollectionStats) {
- double count = ((CollectionStats) element).getCount();
- return String.valueOf(count);
+ Integer count = ((CollectionStats) element).getCount();
+ return StringUtils.getValue(count);
}
return "";
}
@@ -33,11 +34,12 @@ public String getText(Object element) {
* fr.opensagres.mongodb.ide.ui.viewers.editor.IProgressBarValueProvider
* #getProgressBarValue(java.lang.Object)
*/
- public double getProgressBarValue(Object element) {
+ public int getProgressBarValue(Object element) {
+ Integer value = null;
if (element instanceof CollectionStats) {
CollectionStats stats = (CollectionStats) element;
- return Math.round(stats.getPercentCount());
+ value = stats.getPercentCount();
}
- return 0;
+ return value != null ? value : 0;
}
}
View
16 ....ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsIndexSizeColumnLabelProvider.java
@@ -23,11 +23,11 @@ public static StatsIndexSizeColumnLabelProvider getInstance() {
@Override
public String getText(Object element) {
if (element instanceof CollectionStats) {
- double size = ((CollectionStats) element).getTotalIndexSize();
+ Integer size = ((CollectionStats) element).getTotalIndexSize();
return StatsHelper.formatAsBytes(size);
}
if (element instanceof IndexStats) {
- double size = ((IndexStats) element).getIndexSize();
+ Integer size = ((IndexStats) element).getIndexSize();
return StatsHelper.formatAsBytes(size);
}
return "";
@@ -40,15 +40,15 @@ public String getText(Object element) {
* fr.opensagres.mongodb.ide.ui.viewers.editor.IProgressBarValueProvider
* #getProgressBarValue(java.lang.Object)
*/
- public double getProgressBarValue(Object element) {
+ public int getProgressBarValue(Object element) {
+ Integer value = null;
if (element instanceof CollectionStats) {
CollectionStats stats = (CollectionStats) element;
- return Math.round(stats.getPercentIndexSize());
- }
- if (element instanceof IndexStats) {
+ value = stats.getPercentIndexSize();
+ } else if (element instanceof IndexStats) {
IndexStats stats = (IndexStats) element;
- return Math.round(stats.getPercentIndexSize());
+ value = stats.getPercentIndexSize();
}
- return 0;
+ return value != null ? value : 0;
}
}
View
12 ...de.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsPaddingColumnLabelProvider.java
@@ -1,6 +1,7 @@
package fr.opensagres.mongodb.ide.ui.viewers.stats;
import fr.opensagres.mongodb.ide.core.model.stats.CollectionStats;
+import fr.opensagres.mongodb.ide.core.utils.StringUtils;
import fr.opensagres.mongodb.ide.ui.viewers.editor.GradientProgressBarColumnLabelProvider;
public class StatsPaddingColumnLabelProvider extends
@@ -20,8 +21,8 @@ public static StatsPaddingColumnLabelProvider getInstance() {
@Override
public String getText(Object element) {
if (element instanceof CollectionStats) {
- double padding = ((CollectionStats) element).getPadding();
- return String.valueOf(padding);
+ Integer padding = ((CollectionStats) element).getPadding();
+ return StringUtils.getValue(padding);
}
return "";
}
@@ -33,11 +34,12 @@ public String getText(Object element) {
* fr.opensagres.mongodb.ide.ui.viewers.editor.IProgressBarValueProvider
* #getProgressBarValue(java.lang.Object)
*/
- public double getProgressBarValue(Object element) {
+ public int getProgressBarValue(Object element) {
+ Integer value = null;
if (element instanceof CollectionStats) {
CollectionStats stats = (CollectionStats) element;
- return Math.round(stats.getPercentPadding());
+ value = stats.getPercentPadding();
}
- return 0;
+ return value != null ? value : 0;
}
}
View
9 ...b.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsSizeColumnLabelProvider.java
@@ -22,7 +22,7 @@ public static StatsSizeColumnLabelProvider getInstance() {
@Override
public String getText(Object element) {
if (element instanceof CollectionStats) {
- double size = ((CollectionStats) element).getSize();
+ Integer size = ((CollectionStats) element).getSize();
return StatsHelper.formatAsBytes(size);
}
return "";
@@ -35,11 +35,12 @@ public String getText(Object element) {
* fr.opensagres.mongodb.ide.ui.viewers.editor.IProgressBarValueProvider
* #getProgressBarValue(java.lang.Object)
*/
- public double getProgressBarValue(Object element) {
+ public int getProgressBarValue(Object element) {
+ Integer value = null;
if (element instanceof CollectionStats) {
CollectionStats stats = (CollectionStats) element;
- return Math.round(stats.getPercentSize());
+ value = stats.getPercentSize();
}
- return 0;
+ return value != null ? value : 0;
}
}
View
9 ...de.ui/src/fr/opensagres/mongodb/ide/ui/viewers/stats/StatsStorageColumnLabelProvider.java
@@ -22,7 +22,7 @@ public static StatsStorageColumnLabelProvider getInstance() {
@Override
public String getText(Object element) {
if (element instanceof CollectionStats) {
- double storage = ((CollectionStats) element).getStorage();
+ Integer storage = ((CollectionStats) element).getStorage();
return StatsHelper.formatAsBytes(storage);
}
return "";
@@ -35,11 +35,12 @@ public String getText(Object element) {
* fr.opensagres.mongodb.ide.ui.viewers.editor.IProgressBarValueProvider
* #getProgressBarValue(java.lang.Object)
*/
- public double getProgressBarValue(Object element) {
+ public int getProgressBarValue(Object element) {
+ Integer value = null;
if (element instanceof CollectionStats) {
CollectionStats stats = (CollectionStats) element;
- return Math.round(stats.getPercentStorage());
+ value = stats.getPercentStorage();
}
- return 0;
+ return value != null ? value : 0;
}
}
View
9 readme.md
@@ -0,0 +1,9 @@
+MongoDB IDE is Eclipse Plug-ins to manage [MongoDB](http://www.mongodb.org/) database. Those Plug-ins work on several context:
+
+* Eclipse IDE
+* Eclipse RCP (Fat client)
+* Eclipse RAP (WEB). You can see online demo at [http://mongodb-ide.opensagres.cloudbees.net/mongodb-ide](http://mongodb-ide.opensagres.cloudbees.net/mongodb-ide)
+
+![MongoDB IDE Overview](https://github.com/opensagres/mongodb-ide/wiki/images/MongoIDE_Overview.png)
+
+For more information, please read the [MongoDB IDE wiki] (https://github.com/opensagres/mongodb-ide/wiki).

0 comments on commit 0de8410

Please sign in to comment.
Something went wrong with that request. Please try again.