diff options
author | Jean Michel-Lemieux | 2003-10-10 17:57:35 +0000 |
---|---|---|
committer | Jean Michel-Lemieux | 2003-10-10 17:57:35 +0000 |
commit | 5eb6420b3e29781b4784f79a5894945da01b830e (patch) | |
tree | a6e3fad082df4ded4b0d55670383721ea4a8a4e8 /bundles/org.eclipse.team.ui/src | |
parent | 6a5d0f2ed060036f5d8da6d1c626008df7b0658e (diff) | |
download | eclipse.platform.team-5eb6420b3e29781b4784f79a5894945da01b830e.tar.gz eclipse.platform.team-5eb6420b3e29781b4784f79a5894945da01b830e.tar.xz eclipse.platform.team-5eb6420b3e29781b4784f79a5894945da01b830e.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.team.ui/src')
22 files changed, 291 insertions, 580 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java index ee1455f31..558a21a29 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/RefreshAction.java @@ -29,7 +29,7 @@ import org.eclipse.team.internal.ui.jobs.JobStatusHandler; import org.eclipse.team.internal.ui.jobs.RefreshSubscriberJob; import org.eclipse.team.internal.ui.sync.sets.SubscriberInput; import org.eclipse.team.internal.ui.sync.views.SynchronizeView; -import org.eclipse.team.ui.sync.SubscriberAction; +import org.eclipse.team.ui.sync.actions.SubscriberAction; import org.eclipse.ui.actions.ActionContext; public class RefreshAction extends Action { diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java index badc3430d..e702eda50 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberEventHandler.java @@ -21,7 +21,7 @@ import org.eclipse.team.core.subscribers.BackgroundEventHandler; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ui.Policy; import org.eclipse.team.internal.ui.jobs.JobStatusHandler; -import org.eclipse.team.ui.sync.SubscriberAction; +import org.eclipse.team.ui.sync.actions.SubscriberAction; /** * This handler collects changes and removals to resources and calculates their diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java index 93845f5c9..9d5726dad 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SubscriberInput.java @@ -26,7 +26,7 @@ import org.eclipse.team.core.subscribers.TeamSubscriber; import org.eclipse.team.internal.core.Assert; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.ui.TeamUI; -import org.eclipse.team.ui.sync.SyncInfoFilter; +import org.eclipse.team.ui.sync.actions.SyncInfoFilter; import org.eclipse.ui.IWorkingSet; /** diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java index 47fcd91a7..5d7365d07 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncInfoWorkingSetFilter.java @@ -22,7 +22,7 @@ import org.eclipse.team.core.TeamException; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.core.subscribers.TeamSubscriber; import org.eclipse.team.internal.ui.TeamUIPlugin; -import org.eclipse.team.ui.sync.SyncInfoFilter; +import org.eclipse.team.ui.sync.actions.SyncInfoFilter; import org.eclipse.ui.IWorkingSet; /** diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java index 6bade21b9..f51b4c704 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/sets/SyncSetInput.java @@ -14,7 +14,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.team.core.TeamException; import org.eclipse.team.core.subscribers.SyncInfo; -import org.eclipse.team.ui.sync.SyncInfoFilter; +import org.eclipse.team.ui.sync.actions.SyncInfoFilter; /** * This is the superclass for all SyncSet input providers diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java deleted file mode 100644 index ca42c58b2..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/StatisticsCounterBar.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ui.sync.views; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ControlAdapter; -import org.eclipse.swt.events.ControlEvent; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseMoveListener; -import org.eclipse.swt.events.PaintEvent; -import org.eclipse.swt.events.PaintListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Canvas; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * A progress bar with a red/green indication for success or failure. - */ -public class StatisticsCounterBar extends Canvas { - private static final int DEFAULT_WIDTH = 160; - private static final int DEFAULT_HEIGHT = 20; - - private int outgoingCount = 0; - private int incomingCount = 0; - private int conflicCount = 0; - - private int totalCount = 0; - - private int fColorBarWidth = 0; - - private Color outgoingColor; - private Color incomingColor; - private Color conflictColor; - - private int activeMode = SyncInfo.IN_SYNC; - - private final Cursor counterBarCursor = new Cursor(getDisplay(), SWT.CURSOR_HAND); - - public StatisticsCounterBar(Composite parent, int cSpan) { - super(parent, SWT.NONE); - - addControlListener(new ControlAdapter() { - public void controlResized(ControlEvent e) { - redraw(); - } - }); - addPaintListener(new PaintListener() { - public void paintControl(PaintEvent e) { - paint(e); - } - }); - - addMouseMoveListener( - new MouseMoveListener() { - private Cursor fLastCursor; - public void mouseMove(MouseEvent e) { - Cursor cursor= null; - int mode = handlemouseInCounterBar(e.x, e.y); - if (mode != SyncInfo.IN_SYNC) - cursor= counterBarCursor; - if (fLastCursor != cursor) { - setCursor(cursor); - fLastCursor= cursor; - } - } - } - ); - - addMouseListener( - new MouseAdapter() { - public void mouseDown(MouseEvent e) { - int mode = handlemouseInCounterBar(e.x, e.y); - if(mode != activeMode) { - activeMode = mode; - redraw(); - } - } - } - ); - - Display display= parent.getDisplay(); - conflictColor = new Color(display, 204, 51, 51); - incomingColor = new Color(display, 51, 102, 204); - outgoingColor = new Color(display, 102, 102, 102); - - GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); - data.horizontalSpan = cSpan; - setLayoutData(data); - } - - protected int handlemouseInCounterBar(int x, int y) { - int nextX = 1; - int sizeX = 0; - if(conflicCount > 0) { - sizeX = scale(conflicCount); - if(x >= nextX && x <= sizeX) return SyncInfo.CONFLICTING; - nextX = (sizeX - 1); - } - if(incomingCount > 0) { - sizeX = scale(incomingCount) + nextX; - if(x >= nextX && x <= sizeX) return SyncInfo.INCOMING; - nextX = (sizeX - 1); - } - if(outgoingCount > 0) { - sizeX = scale(outgoingCount) + nextX; - if(x >= nextX && x <= sizeX) return SyncInfo.OUTGOING; - } - return SyncInfo.IN_SYNC; - } - - public void reset() { - conflicCount = 0; - incomingCount = 0; - outgoingCount = 0; - fColorBarWidth = 0; - redraw(); - } - - private void paintStep(int startX, int endX, int direction) { - GC gc = new GC(this); - setStatusColor(gc, direction); - Rectangle rect= getClientArea(); - startX= Math.max(1, startX); - gc.fillRectangle(startX, 1, endX, rect.height-2); - gc.dispose(); - } - - public void dispose() { - super.dispose(); - conflictColor.dispose(); - outgoingColor.dispose(); - incomingColor.dispose(); - } - - private void setStatusColor(GC gc, int direction) { - switch(direction) { - case SyncInfo.OUTGOING: - gc.setBackground(outgoingColor); break; - case SyncInfo.INCOMING: - gc.setBackground(incomingColor); break; - case SyncInfo.CONFLICTING: - gc.setBackground(conflictColor); break; - } - } - - private int scale(int value) { - if (totalCount > 0) { - Rectangle r= getClientArea(); - if (r.width != 0) - return Math.max(0, value*(r.width-2)/totalCount); - } - return value; - } - - private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) { - gc.setForeground(topleft); - gc.drawLine(x, y, x+w-1, y); - gc.drawLine(x, y, x, y+h-1); - - gc.setForeground(bottomright); - gc.drawLine(x+w, y, x+w, y+h); - gc.drawLine(x, y+h, x+w, y+h); - } - - private void paint(PaintEvent event) { - GC gc = event.gc; - Display disp= getDisplay(); - - Rectangle rect= getClientArea(); - gc.fillRectangle(rect); - drawBevelRect(gc, rect.x, rect.y, rect.width-1, rect.height-1, - disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW), - disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); - - int nextX = 1; - int sizeX = 0; - if(conflicCount > 0) { - sizeX = scale(conflicCount); - paintStep(nextX, sizeX, SyncInfo.CONFLICTING); - if(activeMode == SyncInfo.CONFLICTING) { - drawBorder(gc, rect, nextX, sizeX); - } - nextX = (sizeX - 1); - } - if(incomingCount > 0) { - sizeX = scale(incomingCount) + nextX; - paintStep(nextX, sizeX, SyncInfo.INCOMING); - if(activeMode == SyncInfo.INCOMING) { - drawBorder(gc, rect, nextX, sizeX); - } - nextX = (sizeX - 1); - } - if(outgoingCount > 0) { - sizeX = scale(outgoingCount) + nextX; - paintStep(nextX, sizeX, SyncInfo.OUTGOING); - if(activeMode == SyncInfo.OUTGOING) { - drawBorder(gc, rect, nextX, sizeX); - } - } - } - - private void drawBorder(GC gc, Rectangle rect, int nextX, int sizeX) { - int lineWidth = 3; - gc.setLineWidth(lineWidth); - gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_YELLOW)); - gc.drawRectangle(nextX, 0, (sizeX - lineWidth) + 1, rect.height - lineWidth); - } - - public Point computeSize(int wHint, int hHint, boolean changed) { - checkWidget(); - Point size= new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT); - if (wHint != SWT.DEFAULT) size.x= wHint; - if (hHint != SWT.DEFAULT) size.y= hHint; - return size; - } - - public void update(int conflicts, int outgoing, int incoming) { - totalCount = conflicts + outgoing + incoming; - conflicCount = conflicts; - incomingCount = incoming; - outgoingCount = outgoing; - redraw(); - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java index 515089df8..27778a51c 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java @@ -67,13 +67,14 @@ import org.eclipse.team.internal.ui.sync.actions.SyncViewerActions; import org.eclipse.team.internal.ui.sync.sets.ISyncSetChangedListener; import org.eclipse.team.internal.ui.sync.sets.SubscriberInput; import org.eclipse.team.internal.ui.sync.sets.SyncSetChangedEvent; -import org.eclipse.team.ui.sync.AndSyncInfoFilter; +import org.eclipse.team.ui.sync.ISynchronizeTarget; import org.eclipse.team.ui.sync.ISynchronizeView; -import org.eclipse.team.ui.sync.PseudoConflictFilter; -import org.eclipse.team.ui.sync.SubscriberAction; -import org.eclipse.team.ui.sync.SyncInfoChangeTypeFilter; -import org.eclipse.team.ui.sync.SyncInfoDirectionFilter; -import org.eclipse.team.ui.sync.SyncInfoFilter; +import org.eclipse.team.ui.sync.actions.AndSyncInfoFilter; +import org.eclipse.team.ui.sync.actions.PseudoConflictFilter; +import org.eclipse.team.ui.sync.actions.SubscriberAction; +import org.eclipse.team.ui.sync.actions.SyncInfoChangeTypeFilter; +import org.eclipse.team.ui.sync.actions.SyncInfoDirectionFilter; +import org.eclipse.team.ui.sync.actions.SyncInfoFilter; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IMemento; import org.eclipse.ui.IViewSite; @@ -86,14 +87,14 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.actions.ActionContext; import org.eclipse.ui.part.IShowInSource; +import org.eclipse.ui.part.PageBookView; import org.eclipse.ui.part.ShowInContext; -import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.views.navigator.ResourceSorter; /** * The Team Synchronization view. */ -public class SynchronizeView extends ViewPart implements ITeamResourceChangeListener, ISyncSetChangedListener, ISynchronizeView { +public class SynchronizeView extends PageBookView implements ITeamResourceChangeListener, ISyncSetChangedListener, ISynchronizeView { // The property id for <code>getCurrentViewType</code>. public static final int PROP_VIEWTYPE = 1; @@ -720,8 +721,8 @@ public class SynchronizeView extends ViewPart implements ITeamResourceChangeList } } - public void selectSubscriber(TeamSubscriber subscriber) { - activateSubscriber(subscriber); + public void display(ISynchronizeTarget synchronizeTarget) { + activateSubscriber(synchronizeTarget); } /** diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java deleted file mode 100644 index c815dc6f1..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AndSyncInfoFilter.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * Selects SyncInfo which match all child filters - */ -public class AndSyncInfoFilter extends CompoundSyncInfoFilter { - public AndSyncInfoFilter(SyncInfoFilter[] filters) { - super(filters); - } - /* (non-Javadoc) - * @see org.eclipse.team.ccvs.syncviews.views.SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo) - */ - public boolean select(SyncInfo info) { - for (int i = 0; i < filters.length; i++) { - SyncInfoFilter filter = filters[i]; - if (!filter.select(info)) { - return false; - } - } - return true; - } - -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java deleted file mode 100644 index 6c7929772..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/CompoundSyncInfoFilter.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -public abstract class CompoundSyncInfoFilter extends SyncInfoFilter { - protected SyncInfoFilter[] filters; - public CompoundSyncInfoFilter(SyncInfoFilter[] filters) { - this.filters = filters; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTarget.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTarget.java new file mode 100644 index 000000000..96920a627 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTarget.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.ui.sync; + +import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.part.IPageBookViewPage; + +/** + * A synchronization target provides synchronization between local resources and a + * remote location that is used to share those resources. The Synchronize View + * displays synchronize targets. + * + * @since 3.0 + */ +public interface ISynchronizeTarget { + /** + * Returns the name of this synchronize target. + * + * @return the name of this synchronize target + */ + public String getName(); + + /** + * Returns an image descriptor for this synchronize target, or <code>null</code> + * if none. + * + * @return an image descriptor for this synchronize target, or <code>null</code> + * if none + */ + public ImageDescriptor getImageDescriptor(); + + /** + * Creates and returns a new page for this synchronize target. The page is displayed + * for this synchronize target in the given synchronize view. + * + * @param view the view in which the page is to be created + * @return a page book view page representation of this synchronize target + */ + public IPageBookViewPage createPage(ISynchronizeView view); + + /** + * Adds a listener for changes to properties of this synchronize target. + * Has no effect if an identical listener is already registered. + * <p> + * The changes supported by the synchronize view are as follows: + * <ul> + * <li><code>IBasicPropertyConstants.P_TEXT</code> - indicates the name + * of a synchronize target has changed</li> + * <li><code>IBasicPropertyConstants.P_IMAGE</code> - indicates the image + * of a synchronize target has changed</li> + * </ul> + * </p> + * <p> + * Clients may define additional properties as required. + * </p> + * + * @param listener a property change listener + */ + public void addPropertyChangeListener(IPropertyChangeListener listener); + + /** + * Removes the given property listener from this synchronize target. + * Has no effect if an identical listener is not alread registered. + * + * @param listener a property listener + */ + public void removePropertyChangeListener(IPropertyChangeListener listener); +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTargetListener.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTargetListener.java new file mode 100644 index 000000000..6d63f37bd --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTargetListener.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.ui.sync; + +/** + * A console listener is notified when consoles are added or removed from + * the console manager. + * <p> + * Clients may implement this interface. + * </p> + * @since 3.0 + */ +public interface ISynchronizeTargetListener { + + /** + * Notification the given consoles have been added to the console + * manager. + * + * @param consoles added consoles + */ + public void consolesAdded(ISynchronizeTarget[] synchronizeTargets); + + /** + * Notification the given consoles have been removed from the + * console manager. + * + * @param consoles removed consoles + */ + public void consolesRemoved(ISynchronizeTarget[] synchronizeTargets); + +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTargetManager.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTargetManager.java new file mode 100644 index 000000000..c2f985b11 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeTargetManager.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.team.ui.sync; + +/** + * Manages synchronization targets. + * <p> + * Clients are not intended to implement this interface. + * </p> + * @since 3.0 + */ +public interface ISynchronizeTargetManager { + + /** + * Registers the given listener for console notifications. Has + * no effect if an identical listener is already registered. + * + * @param listener listener to register + */ + public void addConsoleListener(ISynchronizeTargetListener listener); + + /** + * Deregisters the given listener for console notifications. Has + * no effect if an identical listener is not already registered. + * + * @param listener listener to deregister + */ + public void removeConsoleListener(ISynchronizeTargetListener listener); + + /** + * Adds the given consoles to the console manager. Has no effect for + * equivalent consoles already registered. The consoles will be added + * to any existing console views. + * + * @param consoles consoles to add + */ + public void addConsoles(ISynchronizeTarget[] consoles); + + /** + * Removes the given consoles from the console manager. If the consoles are + * being displayed in any console views, the associated pages will be closed. + * + * @param consoles consoles to remove + */ + public void removeConsoles(ISynchronizeTarget[] consoles); + + /** + * Returns a collection of consoles registered with the console manager. + * + * @return a collection of consoles registered with the console manager + */ + public ISynchronizeTarget[] getConsoles(); +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java index 93368a08f..2f394c713 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/ISynchronizeView.java @@ -12,40 +12,64 @@ package org.eclipse.team.ui.sync; import org.eclipse.core.resources.IResource; import org.eclipse.team.core.subscribers.TeamSubscriber; +import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkingSet; -public interface ISynchronizeView { +/** + * A view that displays synchronization targets that are registered with the + * synchronize view manager. + * <p> + * Clients are not intended to implement this interface. + * </p> + * + * @since 3.0 + */ +public interface ISynchronizeView extends IViewPart { + + // TODO: I would like to make modes an optional + // part of the synchronize targets and allow them to configure their uses. public final static int INCOMING_MODE = 1; public final static int OUTGOING_MODE = 2; public final static int BOTH_MODE = 3; public final static int CONFLICTING_MODE = 4; /** - * Called to set the current selection in the sync viewer for the given subscriber. The viewType - * parameter determines in which configuration of the view the selection should be made in. If - * there are no resources passed in the given subscriber is activate. + * Called to set the current selection in the sync viewer for the given + * subscriber. The viewType parameter determines in which configuration of + * the view the selection should be made in. If there are no resources + * passed in the given subscriber is activate. + * + * @param resources + * the resources to select + * @param viewType + * the view configuration in which to select the resources + */ + public void display(ISynchronizeTarget synchronizeTarget); + + /** + * Returns the synchronization target currently being displayed. * - * @param resources the resources to select - * @param viewType the view configuration in which to select the resources + * @return the synchronize target currently being displayed, or <code>null</code> + * if none */ - public void selectSubscriber(TeamSubscriber subscriber); - + public ISynchronizeTarget getSynchronizeTarget(); + /** - * Refreshes the resources from the specified subscriber. The working set or filters applied - * to the synchronize view are ignored. + * Refreshes the resources from the specified subscriber. The working set + * or filters applied to the synchronize view are ignored. */ public void refreshWithRemote(TeamSubscriber subscriber, IResource[] resources); /** * Refreshes the resources in the current input for the given subscriber. - */ + */ public void refreshWithRemote(TeamSubscriber subscriber); - + /** * Refreshes the active subscriber. - */ + */ public void refreshWithRemote(); - + /** * Returns the current view configuration. */ @@ -55,11 +79,10 @@ public interface ISynchronizeView { * Sets the working set used by the view to the given working set */ public void setWorkingSet(IWorkingSet workingSet); - + /** * Sets the current mode shown in the sync view. Valid modes are: - * INCOMING_MODE, OUTGOING_MODE, BOTH_MODE, - * CONFLICTING_MODE + * INCOMING_MODE, OUTGOING_MODE, BOTH_MODE, CONFLICTING_MODE */ public void setMode(int mode); -} +}
\ No newline at end of file diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java deleted file mode 100644 index 1ec79b327..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoDirectionFilter.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import org.eclipse.team.core.subscribers.SyncInfo; - -/** - * Filter the SyncInfo by a set of directions (incoming, outgoing, conflict) - */ -public class SyncInfoDirectionFilter extends SyncInfoFilter { - - int[] directionFilters = new int[] {SyncInfo.OUTGOING, SyncInfo.INCOMING, SyncInfo.CONFLICTING}; - - public SyncInfoDirectionFilter(int[] directionFilters) { - this.directionFilters = directionFilters; - } - - public SyncInfoDirectionFilter(int direction) { - this(new int[] { direction }); - } - - /* (non-Javadoc) - * @see SyncSetFilter#select(org.eclipse.team.core.sync.SyncInfo) - */ - public boolean select(SyncInfo info) { - int syncKind = info.getKind(); - for (int i = 0; i < directionFilters.length; i++) { - int filter = directionFilters[i]; - if ((syncKind & SyncInfo.DIRECTION_MASK) == filter) - return true; - } - return false; - } -} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java deleted file mode 100644 index b6daf1ce5..000000000 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSet.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.ui.sync; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.team.core.subscribers.SyncInfo; - -public class SyncInfoSet { - - Set set = new HashSet(); - - public SyncInfoSet(SyncInfo[] resources) { - set.addAll(Arrays.asList(resources)); - } - /** - * Returns true if there are any conflicting nodes in the set, and - * false otherwise. - */ - public boolean hasConflicts() { - return hasNodes(new SyncInfoDirectionFilter(SyncInfo.CONFLICTING)); - } - - /** - * Returns true if this sync set has incoming changes. - * Note that conflicts are not considered to be incoming changes. - */ - public boolean hasIncomingChanges() { - return hasNodes(new SyncInfoDirectionFilter(SyncInfo.INCOMING)); - } - - /** - * Returns true if this sync set has outgoing changes. - * Note that conflicts are not considered to be outgoing changes. - */ - public boolean hasOutgoingChanges() { - return hasNodes(new SyncInfoDirectionFilter(SyncInfo.OUTGOING)); - } - - /** - * Returns true if this sync set has auto-mergeable conflicts. - */ - public boolean hasAutoMergeableConflicts() { - return hasNodes(new AutomergableFilter()); - } - - /** - * Removes all conflicting nodes from this set. - */ - public void removeConflictingNodes() { - rejectNodes(new SyncInfoDirectionFilter(SyncInfo.CONFLICTING)); - } - /** - * Removes all outgoing nodes from this set. - */ - public void removeOutgoingNodes() { - rejectNodes(new SyncInfoDirectionFilter(SyncInfo.OUTGOING)); - } - /** - * Removes all incoming nodes from this set. - */ - public void removeIncomingNodes() { - rejectNodes(new SyncInfoDirectionFilter(SyncInfo.INCOMING)); - } - - /** - * Removes all nodes from this set that are not auto-mergeable conflicts - */ - public void removeNonMergeableNodes() { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo node = (SyncInfo)it.next(); - if ((node.getKind() & SyncInfo.MANUAL_CONFLICT) != 0) { - it.remove(); - } else if ((node.getKind() & SyncInfo.DIRECTION_MASK) != SyncInfo.CONFLICTING) { - it.remove(); - } - } - } - - /** - * Indicate whether the set has nodes matching the given filter - */ - public boolean hasNodes(SyncInfoFilter filter) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info != null && filter.select(info)) { - return true; - } - } - return false; - } - - /** - * Removes all nodes from this set that do not match the given filter - */ - public void selectNodes(SyncInfoFilter filter) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info == null || !filter.select(info)) { - it.remove(); - } - } - } - - /** - * Removes all nodes from this set that match the given filter - */ - public void rejectNodes(SyncInfoFilter filter) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info != null && filter.select(info)) { - it.remove(); - } - } - } - - /** - * Return all nodes in this set that match the given filter - */ - public SyncInfo[] getNodes(SyncInfoFilter filter) { - List result = new ArrayList(); - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo info = (SyncInfo)it.next(); - if (info != null && filter.select(info)) { - result.add(info); - } - } - return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]); - } - - public SyncInfo[] getSyncInfos() { - return (SyncInfo[]) set.toArray(new SyncInfo[set.size()]); - } - - /** - * Returns the resources from all the nodes in this set. - */ - public IResource[] getResources() { - SyncInfo[] changed = getSyncInfos(); - IResource[] resources = new IResource[changed.length]; - for (int i = 0; i < changed.length; i++) { - resources[i] = changed[i].getLocal(); - } - return resources; - } - - public boolean isEmpty() { - return set.isEmpty(); - } - - public void removeResources(IResource[] resources) { - for (int i = 0; i < resources.length; i++) { - IResource resource = resources[i]; - removeResource(resource); - } - } - - private void removeResource(IResource resource) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo node = (SyncInfo)it.next(); - if (node.getLocal().equals(resource)) { - it.remove(); - // short-circuit the operation once a match is found - return; - } - } - } - - public int size() { - return set.size(); - } - - public SyncInfo getNodeFor(IResource resource) { - for (Iterator it = set.iterator(); it.hasNext();) { - SyncInfo node = (SyncInfo)it.next(); - if (node.getLocal().equals(resource)) { - return node; - } - } - return null; - } - - public void addAll(SyncInfoSet set) { - SyncInfo[] resources = set.getSyncInfos(); - for (int i = 0; i < resources.length; i++) { - SyncInfo resource = resources[i]; - this.set.add(resource); - } - - } -} - diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSynchronizeTarget.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSynchronizeTarget.java new file mode 100644 index 000000000..c3d8fb829 --- /dev/null +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoSynchronizeTarget.java @@ -0,0 +1,50 @@ +package org.eclipse.team.ui.sync; + +import org.eclipse.core.runtime.Preferences.IPropertyChangeListener; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.part.IPageBookViewPage; + + +public class SyncInfoSynchronizeTarget implements ISynchronizeTarget { + + /* (non-Javadoc) + * @see org.eclipse.team.ui.sync.ISynchronizeTarget#getName() + */ + public String getName() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.sync.ISynchronizeTarget#getImageDescriptor() + */ + public ImageDescriptor getImageDescriptor() { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.sync.ISynchronizeTarget#createPage(org.eclipse.team.ui.sync.ISynchronizeView) + */ + public IPageBookViewPage createPage(ISynchronizeView view) { + // TODO Auto-generated method stub + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.sync.ISynchronizeTarget#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) + */ + public void addPropertyChangeListener(IPropertyChangeListener listener) { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.eclipse.team.ui.sync.ISynchronizeTarget#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) + */ + public void removePropertyChangeListener(IPropertyChangeListener listener) { + // TODO Auto-generated method stub + + } + +} diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/AutomergableFilter.java index af4f9296e..00b331460 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/AutomergableFilter.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/AutomergableFilter.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.sync; +package org.eclipse.team.ui.sync.actions; import org.eclipse.team.core.subscribers.SyncInfo; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OrSyncInfoFilter.java index b6424afea..4f936ff26 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/OrSyncInfoFilter.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OrSyncInfoFilter.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.sync; +package org.eclipse.team.ui.sync.actions; import org.eclipse.team.core.subscribers.SyncInfo; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/PseudoConflictFilter.java index a8a9068c1..abbb68e23 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/PseudoConflictFilter.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/PseudoConflictFilter.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.sync; +package org.eclipse.team.ui.sync.actions; import org.eclipse.team.core.subscribers.SyncInfo; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SubscriberAction.java index daf4df22a..364950c43 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberAction.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SubscriberAction.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.sync; +package org.eclipse.team.ui.sync.actions; import java.util.ArrayList; import java.util.Arrays; @@ -23,6 +23,7 @@ import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.actions.TeamAction; import org.eclipse.team.internal.ui.jobs.JobStatusHandler; +import org.eclipse.team.ui.sync.ISynchronizeViewNode; /** * This is the abstract superclass for actions associated with a subscriber. diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncInfoChangeTypeFilter.java index de133060d..2b9f4c7e2 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoChangeTypeFilter.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncInfoChangeTypeFilter.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.sync; +package org.eclipse.team.ui.sync.actions; import org.eclipse.team.core.subscribers.SyncInfo; import org.eclipse.team.core.sync.IRemoteSyncElement; diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncInfoFilter.java index 92f16cfd5..5f6b4ebb7 100644 --- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SyncInfoFilter.java +++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncInfoFilter.java @@ -8,7 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.team.ui.sync; +package org.eclipse.team.ui.sync.actions; import org.eclipse.team.core.subscribers.SyncInfo; |