-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start progressbar with percent to display stats.
- Loading branch information
1 parent
0b4033f
commit 2c57472
Showing
16 changed files
with
381 additions
and
53 deletions.
There are no files selected for viewing
Binary file modified
BIN
-78 Bytes
(99%)
fr.opensagres.mongodb.ide.core/bin/fr/opensagres/mongodb/ide/core/model/Database.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
....mongodb.ide.core/src/fr/opensagres/mongodb/ide/core/model/stats/CollectionListStats.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,42 @@ | ||
package fr.opensagres.mongodb.ide.core.model.stats; | ||
|
||
import java.net.UnknownHostException; | ||
import java.util.ArrayList; | ||
|
||
import com.mongodb.MongoException; | ||
|
||
import fr.opensagres.mongodb.ide.core.model.Collection; | ||
|
||
public class CollectionListStats extends ArrayList<CollectionStats> { | ||
|
||
private double totalSize; | ||
private double totalCount; | ||
|
||
public CollectionListStats(int size) { | ||
super(size); | ||
this.totalSize = 0; | ||
} | ||
|
||
@Override | ||
public boolean add(CollectionStats stats) { | ||
double size = stats.getSize(); | ||
totalSize += size; | ||
double count = stats.getCount(); | ||
totalCount += count; | ||
return super.add(stats); | ||
} | ||
|
||
public double getTotalSize() { | ||
return totalSize; | ||
} | ||
|
||
public void addCollection(Collection collection) | ||
throws UnknownHostException, MongoException { | ||
add(new CollectionStats(this, collection)); | ||
} | ||
|
||
public double getTotalCount() { | ||
return totalCount; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+22 Bytes
(100%)
fr.opensagres.mongodb.ide.ui/bin/fr/opensagres/mongodb/ide/ui/internal/Messages.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...ongodb.ide.ui/src/fr/opensagres/mongodb/ide/ui/viewers/StatsCountColumnLabelProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package fr.opensagres.mongodb.ide.ui.viewers; | ||
|
||
import org.eclipse.swt.graphics.Image; | ||
|
||
import fr.opensagres.mongodb.ide.core.model.stats.CollectionStats; | ||
import fr.opensagres.mongodb.ide.ui.viewers.editor.GradientProgressBarColumnLabelProvider; | ||
|
||
public class StatsCountColumnLabelProvider extends | ||
GradientProgressBarColumnLabelProvider { | ||
|
||
private static StatsCountColumnLabelProvider instance; | ||
|
||
public static StatsCountColumnLabelProvider getInstance() { | ||
synchronized (StatsCountColumnLabelProvider.class) { | ||
if (instance == null) { | ||
instance = new StatsCountColumnLabelProvider(); | ||
} | ||
return instance; | ||
} | ||
} | ||
|
||
@Override | ||
public String getText(Object element) { | ||
if (element instanceof CollectionStats) { | ||
double count = ((CollectionStats) element).getCount(); | ||
return String.valueOf(count); | ||
} | ||
return super.getText(element); | ||
} | ||
|
||
@Override | ||
public Image getImage(Object element) { | ||
return super.getImage(element); | ||
} | ||
|
||
@Override | ||
protected long getPercent(Object element) { | ||
if (element instanceof CollectionStats) { | ||
CollectionStats stats = (CollectionStats) element; | ||
return Math.round(stats.getPercentSize()); | ||
|
||
} | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.