diff options
author | Jean Michel-Lemieux | 2003-12-11 02:17:21 +0000 |
---|---|---|
committer | Jean Michel-Lemieux | 2003-12-11 02:17:21 +0000 |
commit | f0eb5ff46e0cb66a459f239850ed56d5d84196bb (patch) | |
tree | bb0d18f04e0c6282b9157a441c9c473316e04c08 | |
parent | 2d6f81f2aa176032290820b394ad6a9755e4bfee (diff) | |
download | eclipse.platform.team-f0eb5ff46e0cb66a459f239850ed56d5d84196bb.tar.gz eclipse.platform.team-f0eb5ff46e0cb66a459f239850ed56d5d84196bb.tar.xz eclipse.platform.team-f0eb5ff46e0cb66a459f239850ed56d5d84196bb.zip |
*** empty log message ***
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java | 56 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/TODO-syncview.txt | 2 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java | 4 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java | 65 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/aa.java | 33 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/TeamSubscriberParticipantLabelProvider.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java) | 3 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/controls/IControlFactory.java | 1 | ||||
-rw-r--r-- | bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java | 14 |
8 files changed, 131 insertions, 47 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java index bf49ee284..83fa0e427 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/CVSSynchronizeViewPage.java @@ -16,7 +16,9 @@ import org.eclipse.core.resources.IResource; import org.eclipse.jface.action.Action; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.*; +import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; +import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ccvs.ui.CVSLightweightDecorator; import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; import org.eclipse.team.internal.ui.synchronize.sets.*; @@ -26,6 +28,7 @@ import org.eclipse.ui.IActionDelegate; public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implements ISyncSetChangedListener { private List delegates = new ArrayList(2); + private ILabelProvider oldLabelProvider; protected class CVSActionDelegate extends Action { private IActionDelegate delegate; @@ -90,24 +93,31 @@ public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implem * * @see org.eclipse.team.ui.synchronize.TeamSubscriberParticipantPage#getLabelProvider() */ - protected ILabelProvider getLabelProvider() { - return new TeamSubscriberParticipantLabelProvider() { - protected String decorateText(String input, Object resource) { - if (resource instanceof IResource) { - CVSLightweightDecorator.Decoration decoration = new CVSLightweightDecorator.Decoration(); - CVSLightweightDecorator.decorateTextLabel((IResource) resource, decoration, false, true); - StringBuffer output = new StringBuffer(25); - if(decoration.prefix != null) { - output.append(decoration.prefix); - } - output.append(input); - if(decoration.suffix != null) { - output.append(decoration.suffix); + protected ILabelProvider getLabelProvider(final ILabelProvider proxy) { + return new LabelProvider() { + public Image getImage(Object element) { + return proxy.getImage(element); + } + public String getText(Object element) { + String text = proxy.getText(element); + if (element instanceof ITeamSubscriberParticipantNode) { + SyncInfo info = ((ITeamSubscriberParticipantNode)element).getSyncInfo(); + if(info != null) { + IResource resource = info.getLocal(); + CVSLightweightDecorator.Decoration decoration = new CVSLightweightDecorator.Decoration(); + CVSLightweightDecorator.decorateTextLabel((IResource) resource, decoration, false, true); + StringBuffer output = new StringBuffer(25); + if(decoration.prefix != null) { + output.append(decoration.prefix); + } + output.append(text); + if(decoration.suffix != null) { + output.append(decoration.suffix); + } + return output.toString(); } - return output.toString(); - } else { - return input; } + return text; } }; } @@ -128,7 +138,19 @@ public class CVSSynchronizeViewPage extends TeamSubscriberParticipantPage implem */ public void createControl(Composite parent) { super.createControl(parent); + + // Sync changes are used to update the action state for the update/commit buttons. getInput().getFilteredSyncSet().addSyncSetChangedListener(this); - CVSUIPlugin.addPropertyChangeListener(this); + + // Listen for decorator changed to refresh the viewer's labels. + CVSUIPlugin.addPropertyChangeListener(this); + + // Add a CVS specific label decorator to show CVS information in the sync + // view. We aren't using the global adaptable decorators because we don't + // want all outgoing/repository icons in this view. Instead, we add + // CVS specific information that is useful in the synchronizing context. + StructuredViewer viewer = getChangesViewer(); + oldLabelProvider = (ILabelProvider)viewer.getLabelProvider(); + viewer.setLabelProvider(getLabelProvider(oldLabelProvider)); } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/TODO-syncview.txt b/bundles/org.eclipse.team.ui/TODO-syncview.txt index b537cdcdc..0a95c8145 100644 --- a/bundles/org.eclipse.team.ui/TODO-syncview.txt +++ b/bundles/org.eclipse.team.ui/TODO-syncview.txt @@ -6,5 +6,5 @@ - P1 end of refresh prompt should be a property change notice, and let the participant decide what to do! - P1 mode switching at the end of a refresh to ensure that changes are shown if available - P2 need an event for adding roots to a subscriber to update the list shown -- P1 support for table widget in changes page +- P2 support for table widget in changes page - remove duplicated tree/table viewers classes. the orignial ones simply have the INavigable behavior.
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java index 4190f373c..2ef66c553 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/ParticipantComposite.java @@ -28,6 +28,7 @@ public class ParticipantComposite extends Composite { private Image participantImage; private ISynchronizeView view; private IControlFactory factory; + private Composite participantComposite; public ParticipantComposite(Composite parent, IControlFactory factory, ISynchronizeParticipant participant, ISynchronizeView view, int style) { super(parent, style); @@ -85,7 +86,7 @@ public class ParticipantComposite extends Composite { gridLayout_1.marginWidth = 0; gridLayout_1.marginHeight = 0; composite_1.setLayout(gridLayout_1); - participant.createOverviewComposite(composite_1, factory, view); + participantComposite = participant.createOverviewComposite(composite_1, factory, view); } { final Composite composite_1 = factory.createComposite(composite, SWT.NONE); @@ -112,6 +113,7 @@ public class ParticipantComposite extends Composite { */ public void dispose() { super.dispose(); + participantComposite.dispose(); participantImage.dispose(); } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java index 8b25f0c31..0c0b04a3e 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/TeamSubscriberParticipantComposite.java @@ -14,10 +14,11 @@ import java.text.DateFormat; import java.util.Date; import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.jface.action.*; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.TableViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.layout.GridData; @@ -30,6 +31,7 @@ import org.eclipse.team.ui.controls.IControlFactory; import org.eclipse.team.ui.synchronize.ISynchronizeView; import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant; import org.eclipse.team.ui.synchronize.actions.SubscriberAction; +import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.model.WorkbenchLabelProvider; public class TeamSubscriberParticipantComposite extends Composite implements IPropertyChangeListener { @@ -41,14 +43,15 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr private Label lastSyncLabel; private Label scheduleLabel; private Label statusLabel; - private ListViewer rootsList; + private TableViewer rootsList; private IJobListener jobListener = new IJobListener() { public void started(QualifiedName jobType) { Display.getDefault().asyncExec(new Runnable() { public void run() { synchronized (this) { - statusLabel.setText("Working..."); + if(statusLabel != null && !statusLabel.isDisposed()) + statusLabel.setText("Working..."); } } }); @@ -57,7 +60,8 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr Display.getDefault().asyncExec(new Runnable() { public void run() { synchronized (this) { - statusLabel.setText("Idle"); + if(statusLabel != null && !statusLabel.isDisposed()) + statusLabel.setText("Idle"); } } }); @@ -94,6 +98,8 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr GridData gridData = new GridData(GridData.VERTICAL_ALIGN_FILL); final GridLayout gridLayout_1 = new GridLayout(); gridLayout_1.numColumns = 2; + gridLayout_1.marginHeight = 0; + gridLayout_1.marginWidth = 0; composite_1.setLayout(gridLayout_1); composite_1.setLayoutData(gridData); { @@ -129,15 +135,26 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr gridData.grabExcessHorizontalSpace = true; statusLabel.setLayoutData(gridData); } + } + { + final Composite composite_1 = factory.createComposite(area, SWT.NONE); + GridData gridData = new GridData(GridData.FILL_BOTH); + final GridLayout gridLayout_1 = new GridLayout(); + gridLayout_1.numColumns = 1; + gridLayout_1.marginHeight = 0; + gridLayout_1.marginWidth = 0; + composite_1.setLayout(gridLayout_1); + composite_1.setLayoutData(gridData); { - rootsList = new ListViewer(composite_1, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); + rootsList = new TableViewer(composite_1, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); gridData = new GridData(GridData.FILL_BOTH); - gridData.horizontalSpan = 2; - gridData.grabExcessHorizontalSpace = true; - rootsList.getList().setLayoutData(gridData); + gridData.heightHint = 80; + rootsList.getTable().setLayoutData(gridData); rootsList.setLabelProvider(new WorkbenchLabelProvider()); rootsList.setContentProvider(new ArrayContentProvider()); rootsList.setInput(participant.getInput().subscriberRoots()); + factory.paintBordersFor(rootsList.getTable()); + hookContextMenu(); } } return area; @@ -156,11 +173,14 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { - String property = event.getProperty(); - if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_LASTSYNC)) { - updateLastRefreshLabel(); - } else if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_STATUS)) { - updateStatusLabel(); + if(! isDisposed()) { + String property = event.getProperty(); + if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_LASTSYNC)) { + updateLastRefreshLabel(); + } else if(property.equals(TeamSubscriberParticipant.P_SYNCVIEWPAGE_STATUS)) { + updateStatusLabel(); + } + layout(true); } } @@ -183,4 +203,23 @@ public class TeamSubscriberParticipantComposite extends Composite implements IPr } }); } + + protected void hookContextMenu() { + if(rootsList != null) { + final MenuManager menuMgr = new MenuManager(participant.getId()); //$NON-NLS-1$ + menuMgr.setRemoveAllWhenShown(true); + menuMgr.addMenuListener(new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + setContextMenu(manager); + } + }); + Menu menu = menuMgr.createContextMenu(rootsList.getControl()); + rootsList.getControl().setMenu(menu); + view.getSite().registerContextMenu(participant.getId(), menuMgr, rootsList); + } + } + + protected void setContextMenu(IMenuManager manager) { + manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); + } }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/aa.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/aa.java index 5d86b839a..f085a8d8f 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/aa.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/aa.java @@ -9,6 +9,11 @@ package org.eclipse.team.internal.ui.synchronize; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.widgets.*; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.DisposeEvent; /** * @author Jean-Michel Lemieux @@ -23,10 +28,34 @@ public class aa extends Dialog { } protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); + area.setLayout(new GridLayout()); + { + final Table table = new Table(area, SWT.BORDER); + table.setToolTipText("asdasd"); + final GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.horizontalSpan = 4; + table.setLayoutData(gridData); + } + { + final ProgressBar progressBar = new ProgressBar(area, SWT.SMOOTH); + progressBar.setSelection(56); + } + { + final ToolBar toolBar = new ToolBar(area, SWT.FLAT); + { + final ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN); + toolItem.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + } + }); + toolItem.setText("New item"); + } + } + { + new Combo(area, SWT.NONE); + } return area; } protected void createButtonsForButtonBar(Composite parent) { - createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); - createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); } } diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/TeamSubscriberParticipantLabelProvider.java index e2280074e..23ade238e 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantLabelProvider.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/views/TeamSubscriberParticipantLabelProvider.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.synchronize; +package org.eclipse.team.internal.ui.synchronize.views; import java.util.*; @@ -26,7 +26,6 @@ import org.eclipse.team.internal.ui.*; import org.eclipse.team.internal.ui.jobs.IJobListener; import org.eclipse.team.internal.ui.jobs.JobStatusHandler; import org.eclipse.team.internal.ui.synchronize.sets.*; -import org.eclipse.team.internal.ui.synchronize.views.*; import org.eclipse.team.ui.ISharedImages; import org.eclipse.team.ui.synchronize.actions.SubscriberAction; import org.eclipse.ui.internal.WorkbenchColors; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/controls/IControlFactory.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/controls/IControlFactory.java index abc3adb7d..e4bfea398 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/controls/IControlFactory.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/controls/IControlFactory.java @@ -48,4 +48,5 @@ public interface IControlFactory { public abstract void setHyperlinkHoverColor(org.eclipse.swt.graphics.Color hoverColor); public abstract void setHyperlinkUnderlineMode(int newHyperlinkUnderlineMode); public abstract void turnIntoHyperlink(Control control, IHyperlinkListener listener); + public void paintBordersFor(Composite parent); }
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java index d04019ebe..775e34391 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/synchronize/TeamSubscriberParticipantPage.java @@ -26,6 +26,7 @@ import org.eclipse.team.internal.ui.jobs.JobBusyCursor; import org.eclipse.team.internal.ui.synchronize.*; import org.eclipse.team.internal.ui.synchronize.actions.*; import org.eclipse.team.internal.ui.synchronize.sets.SubscriberInput; +import org.eclipse.team.internal.ui.synchronize.views.*; import org.eclipse.team.internal.ui.widgets.ControlFactory; import org.eclipse.team.ui.synchronize.actions.INavigableControl; import org.eclipse.team.ui.synchronize.actions.SubscriberAction; @@ -152,11 +153,6 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper control.setLayoutData(gd); } - protected ILabelProvider getLabelProvider() { - return new TeamSubscriberParticipantLabelProvider(); - } - - protected StructuredViewer getChangesViewer() { return changesSection.getChangesViewer().getViewer(); } @@ -295,15 +291,11 @@ public class TeamSubscriberParticipantPage implements IPageBookViewPage, IProper public ISynchronizeView getSynchronizeView() { return view; } - - /** - * @param parent - * @return - */ + public SyncChangesViewer createChangesViewer(Composite parent) { SyncChangesViewer viewer = new SyncChangesTreeViewer(parent, getParticipant(), getSynchronizeView()); getSite().setSelectionProvider(viewer.getViewer()); - viewer.getViewer().setLabelProvider(getLabelProvider()); + viewer.getViewer().setLabelProvider(new TeamSubscriberParticipantLabelProvider()); return viewer; } }
\ No newline at end of file |