Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-09-12 10:09:13 -0400
committerJean Michel-Lemieux2003-09-12 10:09:13 -0400
commit47f1ae02d708b621d78bc04f3e303176dc507ff4 (patch)
treeca13d7319f541f86fa7ffb93c976608e3e68c0ac
parente1f8fee1dbd3c7a8c82a1c907894dec67ebc2063 (diff)
downloadeclipse.platform.team-47f1ae02d708b621d78bc04f3e303176dc507ff4.tar.gz
eclipse.platform.team-47f1ae02d708b621d78bc04f3e303176dc507ff4.tar.xz
eclipse.platform.team-47f1ae02d708b621d78bc04f3e303176dc507ff4.zip
Bug 42920 [Live Sync View] when resized too small remove direction names in overview bar
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java158
2 files changed, 96 insertions, 64 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
index 824cb9125..7aa73fde7 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties
@@ -407,6 +407,8 @@ StatisticsPanel.outgoing=Outgoing
StatisticsPanel.incoming=Incoming
StatisticsPanel.conflicting=Conflicting
StatisticsPanel.changeNumbers={0}/{1}
+StatisticsPanel.numbersTooltip=The number of ''{0}'' changes in the entire workspace.
+StatisticsPanel.numbersWorkingSetTooltip=The number of ''{0}'' changes in working set ''{1}'' versus those in the entire workspace.
SyncViewerPreferencePage.6=Synchronize view preferences
SyncViewerPreferencePage.7=Team Synchronize View settings:
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
index 46c6b22b9..68fdf0e16 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsPanel.java
@@ -15,9 +15,9 @@ import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -27,26 +27,63 @@ import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.sync.sets.SyncInfoStatistics;
import org.eclipse.team.ui.ISharedImages;
+import org.eclipse.ui.IWorkingSet;
/**
- * Composite that displays statistics relating to Synchronization information.
+ * Composite that displays statistics relating to Synchronization information. This panel displays the number of changes
+ * for the three change directions. The labels have smart resize behavior and when more space is available the labels
+ * are more verbose, whereas when the space is no longer available the labels are made less verbose.
*
* @since 3.0
*/
public class StatisticsPanel extends Composite {
- private ViewStatusInformation stats;
+ private class DirectionLabel {
+ public Image image;
+ public String descriptionText;
+ public Label descriptionLabel;
+ public Label valueLabel;
+ DirectionLabel(Composite parent, String description, String initialValue, Image image) {
+ Label label= new Label(parent, SWT.NONE);
+ if (image != null) {
+ this.image = image;
+ image.setBackground(label.getBackground());
+ label.setImage(image);
+ }
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ this.descriptionText = description;
+ descriptionLabel= new Label(parent, SWT.NONE);
+ descriptionLabel.setText(description);
+ descriptionLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ valueLabel= new Label(parent, SWT.NONE);
+ valueLabel.setText(initialValue);
+
+ valueLabel.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ valueLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
+ }
+
+ void updateTooltips() {
+ if(stats != null) {
+ IWorkingSet ws = stats.getSubscriberInput().getWorkingSet();
+ if(ws != null) {
+ valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", descriptionText, ws.getName())); //$NON-NLS-1$
+ valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersWorkingSetTooltip", descriptionText, ws.getName())); //$NON-NLS-1$
+ } else {
+ valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersTooltip", descriptionText)); //$NON-NLS-1$
+ valueLabel.setToolTipText(Policy.bind("StatisticsPanel.numbersTooltip", descriptionText)); //$NON-NLS-1$
+ }
+ }
+ }
+ }
- private Label nOutgoing;
- private Label nIncoming;
- private Label nConflicting;
+ private DirectionLabel outgoingDirectionLabel;
+ private DirectionLabel incomingDirectionLabel;
+ private DirectionLabel conflictingDirectionLabel;
- private final Image iOutgoing = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage();
- private final Image iIncoming = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage();
- private final Image iConflicting = TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage();
+ private ViewStatusInformation stats;
- private boolean showDirectionText = true;
-
public StatisticsPanel(Composite parent) {
super(parent, SWT.WRAP);
@@ -57,9 +94,9 @@ public class StatisticsPanel extends Composite {
gridLayout.marginHeight= 0;
setLayout(gridLayout);
- nConflicting = createLabel(Policy.bind("StatisticsPanel.conflicting"), iConflicting, "0/0"); //$NON-NLS-1$ //$NON-NLS-2$
- nIncoming = createLabel(Policy.bind("StatisticsPanel.incoming"), iIncoming, "0/0"); //$NON-NLS-1$ //$NON-NLS-2$
- nOutgoing = createLabel(Policy.bind("StatisticsPanel.outgoing"), iOutgoing, "0/0"); //$NON-NLS-1$ //$NON-NLS-2$
+ conflictingDirectionLabel = new DirectionLabel(this, Policy.bind("StatisticsPanel.conflicting"), "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_CONFLICTING).createImage()); //$NON-NLS-1$ //$NON-NLS-2$
+ incomingDirectionLabel = new DirectionLabel(this, Policy.bind("StatisticsPanel.incoming"), "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_INCOMING).createImage()); //$NON-NLS-1$ //$NON-NLS-2$
+ outgoingDirectionLabel = new DirectionLabel(this, Policy.bind("StatisticsPanel.outgoing"), "0", TeamUIPlugin.getImageDescriptor(ISharedImages.IMG_DLG_SYNC_OUTGOING).createImage()); //$NON-NLS-1$ //$NON-NLS-2$
addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -68,60 +105,41 @@ public class StatisticsPanel extends Composite {
});
addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
-// Point preferredSize = nOutgoing.computeSize(SWT.DEFAULT, SWT.DEFAULT);
-// Rectangle currentSize = nOutgoing.getBounds();
-// if(currentSize.width < preferredSize.y) {
-// for (Iterator it = descriptions.iterator(); it.hasNext();) {
-// Label element = (Label) it.next();
-// element.setText("");
-// }
-// } else {
-// for (Iterator it = descriptions.iterator(); it.hasNext();) {
-// Label element = (Label) it.next();
-// element.setText("lksjfdg lksjdglksdj glks jg");
-// }
-// }
-// layout(true);
-// redraw();
+ public void controlResized(ControlEvent e) {
+ fixLabelsOnResize();
}
});
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- paint(e);
- }
- });
-
setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
+ updateStats();
+ fixLabelsOnResize();
}
protected void disposeIcons() {
- iOutgoing.dispose();
- iIncoming.dispose();
- iConflicting.dispose();
+ outgoingDirectionLabel.image.dispose();
+ incomingDirectionLabel.image.dispose();
+ conflictingDirectionLabel.image.dispose();
}
- private Label createLabel(String name, Image image, String init) {
- Label label= new Label(this, SWT.NONE);
- if (image != null) {
- image.setBackground(label.getBackground());
- label.setImage(image);
+ private void fixLabelsOnResize() {
+ // setup all labels for initial calculation
+ outgoingDirectionLabel.descriptionLabel.setText(outgoingDirectionLabel.descriptionText);
+ incomingDirectionLabel.descriptionLabel.setText(incomingDirectionLabel.descriptionText);
+ conflictingDirectionLabel.descriptionLabel.setText(conflictingDirectionLabel.descriptionText);
+ layout(true);
+
+ Point preferredSize = outgoingDirectionLabel.valueLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle currentSize = outgoingDirectionLabel.valueLabel.getBounds();
+ if(currentSize.width < preferredSize.y && outgoingDirectionLabel.descriptionLabel.getText().length() != 0) {
+ outgoingDirectionLabel.descriptionLabel.setText(""); //$NON-NLS-1$
+ incomingDirectionLabel.descriptionLabel.setText(""); //$NON-NLS-1$
+ conflictingDirectionLabel.descriptionLabel.setText(""); //$NON-NLS-1$
+ } else if(outgoingDirectionLabel.descriptionLabel.getText().length() == 0){
+ outgoingDirectionLabel.descriptionLabel.setText(outgoingDirectionLabel.descriptionText);
+ incomingDirectionLabel.descriptionLabel.setText(incomingDirectionLabel.descriptionText);
+ conflictingDirectionLabel.descriptionLabel.setText(conflictingDirectionLabel.descriptionText);
}
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- label= new Label(this, SWT.NONE);
- label.setText(name);
- label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- Label value= new Label(this, SWT.NONE);
- value.setText(init);
-
- value.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING));
- return value;
- }
-
- private void paint(PaintEvent e) {
+ layout(true);
+ redraw();
}
public void update(ViewStatusInformation stats) {
@@ -142,14 +160,26 @@ public class StatisticsPanel extends Composite {
int workingSetOutgoing = (int)workingSetSetStats.countFor(SyncInfo.OUTGOING, SyncInfo.DIRECTION_MASK);
int workingSetIncoming = (int)workingSetSetStats.countFor(SyncInfo.INCOMING, SyncInfo.DIRECTION_MASK);
- nConflicting.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
- nIncoming.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
- nOutgoing.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
-
+ if(stats.getSubscriberInput().getWorkingSet() != null) {
+ conflictingDirectionLabel.valueLabel.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetConflicting).toString(), new Integer(workspaceConflicting).toString())); //$NON-NLS-1$
+ incomingDirectionLabel.valueLabel.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetIncoming).toString(), new Integer(workspaceIncoming).toString())); //$NON-NLS-1$
+ outgoingDirectionLabel.valueLabel.setText(Policy.bind("StatisticsPanel.changeNumbers", new Integer(workingSetOutgoing).toString(), new Integer(workspaceOutgoing).toString())); //$NON-NLS-1$
+ } else {
+ conflictingDirectionLabel.valueLabel.setText(new Integer(workspaceConflicting).toString()); //$NON-NLS-1$
+ incomingDirectionLabel.valueLabel.setText(new Integer(workspaceIncoming).toString()); //$NON-NLS-1$
+ outgoingDirectionLabel.valueLabel.setText(new Integer(workspaceOutgoing).toString()); //$NON-NLS-1$
+ }
+ updateTooltips();
redraw();
}
}
+ void updateTooltips() {
+ conflictingDirectionLabel.updateTooltips();
+ incomingDirectionLabel.updateTooltips();
+ outgoingDirectionLabel.updateTooltips();
+ }
+
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Widget#dispose()
*/

Back to the top