Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.ui/src')
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java122
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/NewSynchronizeView.java8
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java216
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java1
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java9
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SynchronizeView.java42
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/INewSynchronizeView.java65
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java77
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/INavigableControl.java (renamed from bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java)2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/NavigateAction.java108
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenInCompareAction.java23
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenWithActionGroup.java14
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncViewerShowPreferencesAction.java35
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ToggleViewAction.java52
17 files changed, 388 insertions, 403 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java
deleted file mode 100644
index ff6d22750..000000000
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/NavigateAction.java
+++ /dev/null
@@ -1,122 +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.actions;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ICompareNavigator;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.team.core.subscribers.SyncInfo;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.sync.views.INavigableControl;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IKeyBindingService;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionContext;
-
-/**
- * Action to navigate the changes shown in the Synchronize View. This
- * will coordinate change browsing between the view and the compare
- * editors.
- *
- * @since 3.0
- */
-class NavigateAction extends Action {
- private final SyncViewerActions actions;
- private final SynchronizeView synchronizeView;
- private final int direction;
-
- public NavigateAction(SyncViewerActions actions, int direction) {
- this.actions = actions;
- this.synchronizeView = actions.getSyncView();
- this.direction = direction;
-
- IKeyBindingService kbs = synchronizeView.getSite().getKeyBindingService();
- if(direction == INavigableControl.NEXT) {
- Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$
- synchronizeView.getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.NEXT, this);
- } else {
- Utils.initAction(this, "action.navigatePrevious."); //$NON-NLS-1$
- synchronizeView.getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, this);
- }
- }
-
- public void run() {
- navigate();
- }
-
- private ISelection getSelection() {
- ActionContext context = actions.getContext();
- if (context == null) return null;
- return actions.getContext().getSelection();
- }
-
- private void navigate() {
- Viewer viewer = synchronizeView.getViewer();
-
- if(viewer instanceof INavigableControl) {
- SyncInfo info = getSyncInfoFromSelection();
-
- if(info == null) {
- if(((INavigableControl)viewer).gotoDifference(direction)) {
- return;
- } else {
- info = getSyncInfoFromSelection();
- if(info == null) return;
- }
- }
-
- if(info.getLocal().getType() != IResource.FILE) {
- if(! ((INavigableControl)viewer).gotoDifference(direction)) {
- info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(synchronizeView, info, true /* keep focus */);
- }
- return;
- }
-
- IEditorPart editor = OpenInCompareAction.findOpenCompareEditor(synchronizeView.getSite(), info.getLocal());
- boolean atEnd = false;
- CompareEditorInput input;
- ICompareNavigator navigator;
-
- if(editor != null) {
- // if an existing editor is open on the current selection, use it
- input = (CompareEditorInput)editor.getEditorInput();
- navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class);
- if(navigator != null) {
- if(navigator.selectChange(direction == INavigableControl.NEXT)) {
- if(! ((INavigableControl)viewer).gotoDifference(direction)) {
- info = getSyncInfoFromSelection();
- OpenInCompareAction.openCompareEditor(synchronizeView, info, true /* keep focus */);
- }
- }
- }
- } else {
- // otherwise, select the next change and open a compare editor which will automatically
- // show the first change.
- OpenInCompareAction.openCompareEditor(synchronizeView, info, true /* keep focus */);
- }
- }
- return;
- }
-
- private SyncInfo getSyncInfoFromSelection() {
- IStructuredSelection selection = ((IStructuredSelection)getSelection());
- if(selection == null) return null;
- Object obj = selection.getFirstElement();
- SyncInfo info = OpenInCompareAction.getSyncInfo(obj);
- return info;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
index ea26cac59..17784d42e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/SyncViewerActions.java
@@ -10,18 +10,13 @@
*******************************************************************************/
package org.eclipse.team.internal.ui.sync.actions;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
-import org.eclipse.team.internal.ui.sync.views.INavigableControl;
import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
@@ -59,8 +54,6 @@ public class SyncViewerActions extends SyncViewerActionGroup {
private Action toggleLayoutHierarchicalAction;
private ExpandAllAction expandAll;
private SelectAllAction selectAllAction;
- private NavigateAction gotoNext;
- private NavigateAction gotoPrevious;
/* (non-Javadoc)
* @see org.eclipse.ui.actions.ActionGroup#updateActionBars()
@@ -103,8 +96,6 @@ public class SyncViewerActions extends SyncViewerActionGroup {
expandAll = new ExpandAllAction(this);
- gotoNext = new NavigateAction(this, INavigableControl.NEXT);
- gotoPrevious = new NavigateAction(this, INavigableControl.PREVIOUS);
toggleLayoutFlatAction = new ToggleViewAction(getSyncView(), SynchronizeView.TABLE_VIEW);
toggleLayoutHierarchicalAction = new ToggleViewAction(getSyncView(), SynchronizeView.TREE_VIEW);
@@ -165,8 +156,6 @@ public class SyncViewerActions extends SyncViewerActionGroup {
directionsFilters.fillActionBars(actionBars);
manager.add(new Separator());
manager.add(collapseAll);
- manager.add(gotoNext);
- manager.add(gotoPrevious);
// Setup drop down menu
IMenuManager dropDownMenu = actionBars.getMenuManager();
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/NewSynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/NewSynchronizeView.java
index 5933bac7a..c37a15fb1 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/NewSynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/NewSynchronizeView.java
@@ -66,7 +66,7 @@ public class NewSynchronizeView extends PageBookView implements INewSynchronizeV
public void propertyChange(PropertyChangeEvent event) {
Object source = event.getSource();
if (source instanceof ISynchronizeViewPage && event.getProperty().equals(IBasicPropertyConstants.P_TEXT)) {
- if (source.equals(getSynchronizeTarget())) {
+ if (source.equals(getActivePage())) {
updateTitle();
}
}
@@ -83,7 +83,7 @@ public class NewSynchronizeView extends PageBookView implements INewSynchronizeV
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.console.IConsoleView#getConsole()
*/
- public ISynchronizeViewPage getSynchronizeTarget() {
+ public ISynchronizeViewPage getActivePage() {
return fActivePage;
}
@@ -100,7 +100,7 @@ public class NewSynchronizeView extends PageBookView implements INewSynchronizeV
* Updates the view title based on the active console
*/
protected void updateTitle() {
- ISynchronizeViewPage page = getSynchronizeTarget();
+ ISynchronizeViewPage page = getActivePage();
if (page == null) {
setTitle("Synchronize View");
} else {
@@ -199,7 +199,7 @@ public class NewSynchronizeView extends PageBookView implements INewSynchronizeV
if (part != null) {
partClosed(part);
}
- if (getSynchronizeTarget() == null) {
+ if (getActivePage() == null) {
ISynchronizeViewPage[] available = TeamUI.getSynchronizeManager().getSynchronizePages();
if (available.length > 0) {
display(available[available.length - 1]);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java
index b8de9de93..5e88864a9 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/ShowSynchronizeViewPage.java
@@ -22,7 +22,7 @@ public class ShowSynchronizeViewPage extends Action {
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
- if (!fPage.equals(fView.getSynchronizeTarget())) {
+ if (!fPage.equals(fView.getActivePage())) {
// only change if required (and un-pin the console if pinned)
fView.display(fPage);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java
index c7f97b2c8..92c9210b2 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SubscriberSynchronizeViewPage.java
@@ -4,34 +4,16 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.*;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.TeamSubscriber;
import org.eclipse.team.internal.ui.IPreferenceIds;
@@ -44,29 +26,11 @@ import org.eclipse.team.internal.ui.jobs.RefreshSubscriberInputJob;
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.internal.ui.sync.views.INavigableControl;
-import org.eclipse.team.internal.ui.sync.views.StatisticsPanel;
-import org.eclipse.team.internal.ui.sync.views.SyncSetContentProvider;
-import org.eclipse.team.internal.ui.sync.views.SyncSetTableContentProvider;
-import org.eclipse.team.internal.ui.sync.views.SyncTableViewer;
-import org.eclipse.team.internal.ui.sync.views.SyncTreeViewer;
-import org.eclipse.team.internal.ui.sync.views.SyncViewerLabelProvider;
-import org.eclipse.team.internal.ui.sync.views.SyncViewerSorter;
-import org.eclipse.team.internal.ui.sync.views.SyncViewerTableSorter;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.team.internal.ui.sync.views.ViewStatusInformation;
+import org.eclipse.team.internal.ui.sync.views.*;
import org.eclipse.team.ui.sync.INewSynchronizeView;
-import org.eclipse.team.ui.sync.actions.AndSyncInfoFilter;
-import org.eclipse.team.ui.sync.actions.OpenWithActionGroup;
-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.IWorkbenchPage;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PartInitException;
+import org.eclipse.team.ui.sync.SubscriberPage;
+import org.eclipse.team.ui.sync.actions.*;
+import org.eclipse.ui.*;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.part.IPageBookViewPage;
import org.eclipse.ui.part.IPageSite;
@@ -74,22 +38,7 @@ import org.eclipse.ui.part.IShowInSource;
import org.eclipse.ui.part.ShowInContext;
import org.eclipse.ui.views.navigator.ResourceSorter;
-public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSetChangedListener {
-
- public static final int PROP_VIEWTYPE = 1;
-
- /**
- * View type constant (value 0) indicating that the synchronize view will be shown
- * as a tree.
- */
- public static final int TREE_VIEW = 0;
-
- /**
- * View type constant (value 1) indicating that the synchronize view will be shown
- * as a table.
- */
- public static final int TABLE_VIEW = 1;
-
+public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSetChangedListener, IPropertyChangeListener {
// The viewer that is shown in the view. Currently this can be either a table or tree viewer.
private StructuredViewer viewer;
@@ -99,7 +48,7 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
private StatisticsPanel statsPanel;
// Viewer type constants
- private int currentViewType;
+ private int layout;
// Remembering the current input and the previous.
private SubscriberInput input = null;
@@ -110,25 +59,33 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
private JobBusyCursor busyCursor;
private INewSynchronizeView view;
+ private SubscriberPage page;
private IPageSite site;
- OpenWithActionGroup openWithActions;
+
+ // Actions
+ private OpenWithActionGroup openWithActions;
+ private NavigateAction gotoNext;
+ private NavigateAction gotoPrevious;
+ private Action toggleLayoutTree;
+ private Action toggleLayoutTable;
/**
* Constructs a new SynchronizeView.
*/
- public SubscriberSynchronizeViewPage(TeamSubscriber subscriber, INewSynchronizeView view) {
+ public SubscriberSynchronizeViewPage(SubscriberPage page, INewSynchronizeView view) {
+ this.page = page;
this.view = view;
- this.input = new SubscriberInput(subscriber);
- currentViewType = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TYPE);
- if (currentViewType != TREE_VIEW) {
- currentViewType = TABLE_VIEW;
+ this.input = new SubscriberInput(page.getSubscriber());
+ layout = getStore().getInt(IPreferenceIds.SYNCVIEW_VIEW_TYPE);
+ if (layout != SubscriberPage.TREE_LAYOUT) {
+ layout = SubscriberPage.TABLE_LAYOUT;
}
}
/* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
*/
- public void createPartControl(Composite parent) {
+ public void createControl(Composite parent) {
composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout= new GridLayout();
gridLayout.makeColumnsEqualWidth= false;
@@ -142,7 +99,14 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
updateStatusPanel();
updateTooltip();
- openWithActions = new OpenWithActionGroup(getSite());
+ // create actions
+ openWithActions = new OpenWithActionGroup(view);
+ gotoNext = new NavigateAction(view, this, INavigableControl.NEXT);
+ gotoPrevious = new NavigateAction(view, this, INavigableControl.PREVIOUS);
+
+ toggleLayoutTable = new ToggleViewAction(page, SubscriberPage.TABLE_LAYOUT);
+ toggleLayoutTree = new ToggleViewAction(page, SubscriberPage.TREE_LAYOUT);
+
initializeSubscriberInput(input);
}
@@ -151,6 +115,7 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
*/
public void init(IPageSite site) throws PartInitException {
this.site = site;
+ page.addPropertyChangeListener(this);
RefreshSubscriberInputJob refreshJob = TeamUIPlugin.getPlugin().getRefreshJob();
if(getStore().getBoolean(IPreferenceIds.SYNCVIEW_SCHEDULED_SYNC) && refreshJob.getState() == Job.NONE) {
refreshJob.setReschedule(true);
@@ -171,15 +136,13 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
updateStatusPanel();
}
- protected void hookContextMenu() {
+ private void hookContextMenu() {
if(getViewer() != null) {
MenuManager menuMgr = new MenuManager("#PopupMenu2"); //$NON-NLS-1$
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
- openWithActions.setContext(new ActionContext(viewer.getSelection()));
- openWithActions.fillContextMenu(manager);
- manager.add(new Separator("Additions"));
+ setContextMenu(manager);
}
});
Menu menu = menuMgr.createContextMenu(viewer.getControl());
@@ -188,18 +151,33 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
}
}
+ protected void setContextMenu(IMenuManager manager) {
+ openWithActions.setContext(new ActionContext(viewer.getSelection()));
+ openWithActions.fillContextMenu(manager);
+ manager.add(new Separator("SubscriberActionsGroup1")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup2")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup3")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup4")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup5")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup6")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup7")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup8")); //$NON-NLS-1$
+ manager.add(new Separator("SubscriberActionsGroup9")); //$NON-NLS-1$
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
/**
* Toggles between label/tree/table viewers.
*/
public void switchViewerType(int viewerType) {
- if(viewer == null || viewerType != currentViewType) {
+ if(viewer == null || viewerType != layout) {
if (composite == null || composite.isDisposed()) return;
IStructuredSelection oldSelection = null;
if(viewer != null) {
oldSelection = (IStructuredSelection)viewer.getSelection();
}
- currentViewType = viewerType;
- getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TYPE, currentViewType);
+ layout = viewerType;
+ getStore().setValue(IPreferenceIds.SYNCVIEW_VIEW_TYPE, layout);
disposeChildren(composite);
createViewer(composite);
composite.layout();
@@ -235,11 +213,11 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
protected void createViewer(Composite parent) {
statsPanel = new StatisticsPanel(parent);
- switch(currentViewType) {
- case TREE_VIEW:
+ switch(layout) {
+ case SubscriberPage.TREE_LAYOUT:
createTreeViewerPartControl(parent);
break;
- case TABLE_VIEW:
+ case SubscriberPage.TABLE_LAYOUT:
createTableViewerPartControl(parent);
break;
}
@@ -410,10 +388,6 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
busyCursor.dispose();
}
- public int getViewerType() {
- return currentViewType;
- }
-
/*
* Return the current input for the view.
*/
@@ -421,30 +395,6 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
return input;
}
- /*
- * Add the subscriber to the view. This method does not activate
- * the subscriber.
- */
- synchronized private void addSubscriber(final TeamSubscriber s) {
- this.input = new SubscriberInput(s);
- ActionContext context = new ActionContext(null);
- context.setInput(input);
- //actions.addContext(context);
- }
-
- synchronized public void removeSubscriber(TeamSubscriber s) {
- // notify that context is changing
- ActionContext context = new ActionContext(null);
- context.setInput(input);
- //actions.removeContext(context);
-
- // dispose of the input
- input.dispose();
-
- // de-register the subscriber with the platform
- s.cancel();
- }
-
public void collapseAll() {
if (viewer == null || !(viewer instanceof AbstractTreeViewer)) return;
viewer.getControl().setRedraw(false);
@@ -601,12 +551,8 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
}
}
- public int getCurrentViewType() {
- return currentViewType;
- }
-
public void selectAll() {
- if (getViewerType() == TABLE_VIEW) {
+ if (getLayout() == SubscriberPage.TABLE_LAYOUT) {
TableViewer table = (TableViewer)getViewer();
table.getTable().selectAll();
} else {
@@ -655,20 +601,6 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
}
}
- /**
- * Allows clients to change the active sync mode.
- */
- public void setMode(int mode) {
- //actions.setMode(mode);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- createPartControl(parent);
- }
-
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#getControl()
*/
@@ -680,8 +612,15 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
* @see org.eclipse.ui.part.IPage#setActionBars(org.eclipse.ui.IActionBars)
*/
public void setActionBars(IActionBars actionBars) {
- // TODO Auto-generated method stub
- //actions.fillActionBars(actionBars);
+ IToolBarManager manager = actionBars.getToolBarManager();
+ manager.add(gotoNext);
+ manager.add(gotoPrevious);
+ IMenuManager menu = actionBars.getMenuManager();
+ MenuManager layoutMenu = new MenuManager(Policy.bind("action.layout.label")); //$NON-NLS-1$
+ layoutMenu.add(toggleLayoutTable);
+ layoutMenu.add(toggleLayoutTree);
+ menu.add(layoutMenu);
+ page.setActionsBars(actionBars);
}
/* (non-Javadoc)
@@ -690,4 +629,21 @@ public class SubscriberSynchronizeViewPage implements IPageBookViewPage, ISyncSe
public IPageSite getSite() {
return this.site;
}
+
+ public int getMode() {
+ return 0;
+ }
+
+ public int getLayout() {
+ return layout;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getProperty().equals(SubscriberPage.P_SYNCVIEWPAGE_LAYOUT)) {
+ switchViewerType(((Integer)event.getNewValue()).intValue());
+ }
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java
index b4ce915b5..09ff9e7db 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/pages/SynchronizePageDropDownAction.java
@@ -78,7 +78,7 @@ public class SynchronizePageDropDownAction extends Action implements IMenuCreato
}
fMenu= new Menu(parent);
ISynchronizeViewPage[] pages = TeamUI.getSynchronizeManager().getSynchronizePages();
- ISynchronizeViewPage current = fView.getSynchronizeTarget();
+ ISynchronizeViewPage current = fView.getActivePage();
for (int i = 0; i < pages.length; i++) {
ISynchronizeViewPage page = pages[i];
Action action = new ShowSynchronizeViewPage(fView, page);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
index 19b06b1ea..110d238ac 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTableViewer.java
@@ -13,6 +13,7 @@ package org.eclipse.team.internal.ui.sync.views;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Table;
+import org.eclipse.team.ui.sync.actions.INavigableControl;
public class SyncTableViewer extends TableViewer implements INavigableControl {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
index e6bc3a2a0..6a169e26d 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/SyncTreeViewer.java
@@ -16,13 +16,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -30,6 +24,7 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.team.internal.ui.IPreferenceIds;
import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.ui.sync.actions.INavigableControl;
/**
* Subclass of TreeViewer which handles decorator events properly. We should not need to create
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 29c2528a0..20659c5a3 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
@@ -24,32 +24,12 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.*;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.core.subscribers.ITeamResourceChangeListener;
import org.eclipse.team.core.subscribers.TeamDelta;
@@ -68,22 +48,8 @@ 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.ISynchronizeView;
-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;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
+import org.eclipse.team.ui.sync.actions.*;
+import org.eclipse.ui.*;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.part.IShowInSource;
import org.eclipse.ui.part.ShowInContext;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/INewSynchronizeView.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/INewSynchronizeView.java
index 178d438c3..cfd85d906 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/INewSynchronizeView.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/INewSynchronizeView.java
@@ -10,10 +10,7 @@
*******************************************************************************/
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;
/**
* A view that displays synchronization targets that are registered with the
@@ -26,63 +23,7 @@ import org.eclipse.ui.IWorkingSet;
*/
public interface INewSynchronizeView 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.
- *
- * @param resources
- * the resources to select
- * @param viewType
- * the view configuration in which to select the resources
- */
- public void display(ISynchronizeViewPage synchronizeTarget);
-
- /**
- * Returns the synchronization target currently being displayed.
- *
- * @return the synchronize target currently being displayed, or <code>null</code>
- * if none
- */
- public ISynchronizeViewPage getSynchronizeTarget();
-
- /**
- * 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.
- */
- public int getCurrentViewType();
-
- /**
- * 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
- */
- public void setMode(int mode);
+ public void display(ISynchronizeViewPage page);
+
+ public ISynchronizeViewPage getActivePage();
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java
index 0ce77b72c..5d399e0d5 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/SubscriberPage.java
@@ -2,14 +2,46 @@ package org.eclipse.team.ui.sync;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.team.core.subscribers.TeamSubscriber;
-import org.eclipse.team.internal.ui.sync.pages.*;
+import org.eclipse.team.internal.ui.TeamUIPlugin;
+import org.eclipse.team.internal.ui.sync.pages.SubscriberSynchronizeViewPage;
import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.part.IPageBookViewPage;
public class SubscriberPage extends AbstractSynchronizeViewPage {
- private TeamSubscriber subscriber;
- private SubscriberSynchronizeViewPage page;
+ protected TeamSubscriber subscriber;
+ protected SubscriberSynchronizeViewPage page;
+
+ /**
+ * Property constant indicating the mode of a page has changed.
+ */
+ public static final String P_SYNCVIEWPAGE_MODE = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_MODE"; //$NON-NLS-1$
+
+ /**
+ * Modes are direction filters for the view
+ */
+ 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;
+
+ /**
+ * Property constant indicating the mode of a page has changed.
+ */
+ public static final String P_SYNCVIEWPAGE_LAYOUT = TeamUIPlugin.ID + ".P_SYNCVIEWPAGE_LAYOUT"; //$NON-NLS-1$
+
+ /**
+ * View type constant (value 0) indicating that the synchronize view will be shown
+ * as a tree.
+ */
+ public static final int TREE_LAYOUT = 0;
+
+ /**
+ * View type constant (value 1) indicating that the synchronize view will be shown
+ * as a table.
+ */
+ public static final int TABLE_LAYOUT = 1;
public SubscriberPage(TeamSubscriber subscriber, String name, ImageDescriptor imageDescriptor) {
super(name, imageDescriptor);
@@ -20,11 +52,48 @@ public class SubscriberPage extends AbstractSynchronizeViewPage {
* @see org.eclipse.team.ui.sync.ISynchronizeViewPage#createPage(org.eclipse.team.ui.sync.ISynchronizeView)
*/
public IPageBookViewPage createPage(INewSynchronizeView view) {
- this.page = new SubscriberSynchronizeViewPage(subscriber, view);
+ this.page = new SubscriberSynchronizeViewPage(this, view);
return page;
}
public SubscriberInput getInput() {
return page.getInput();
}
+
+ public void setMode(int mode) {
+ firePropertyChange(this, P_SYNCVIEWPAGE_MODE, new Integer(page.getMode()), new Integer(mode));
+ }
+
+ public int getMode() {
+ return page.getMode();
+ }
+
+ public void setLayout(int layout) {
+ firePropertyChange(this, P_SYNCVIEWPAGE_LAYOUT, new Integer(page.getLayout()), new Integer(layout));
+ }
+
+ public int getLayout() {
+ return page.getLayout();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#dispose()
+ */
+ protected void dispose() {
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.team.ui.sync.AbstractSynchronizeViewPage#init()
+ */
+ protected void init() {
+ super.init();
+ }
+
+ public TeamSubscriber getSubscriber() {
+ return subscriber;
+ }
+
+ public void setActionsBars(IActionBars actionBars) {
+ }
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/INavigableControl.java
index 1c5506c74..1f3a12e11 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/views/INavigableControl.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/INavigableControl.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.team.internal.ui.sync.views;
+package org.eclipse.team.ui.sync.actions;
public interface INavigableControl {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/NavigateAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/NavigateAction.java
new file mode 100644
index 000000000..ec83ae7e4
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/NavigateAction.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * 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.actions;
+
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.compare.ICompareNavigator;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.sync.pages.SubscriberSynchronizeViewPage;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IKeyBindingService;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+
+/**
+ * Action to navigate the changes shown in the Synchronize View. This
+ * will coordinate change browsing between the view and the compare
+ * editors.
+ *
+ * @since 3.0
+ */
+public class NavigateAction extends Action {
+ private final int direction;
+ private IViewPart part;
+ private SubscriberSynchronizeViewPage page;
+
+ public NavigateAction(IViewPart part, SubscriberSynchronizeViewPage page, int direction) {
+ this.page = page;
+ this.part = part;
+ this.direction = direction;
+
+ IKeyBindingService kbs = part.getSite().getKeyBindingService();
+ if(direction == INavigableControl.NEXT) {
+ Utils.initAction(this, "action.navigateNext."); //$NON-NLS-1$
+ part.getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.NEXT, this);
+ } else {
+ Utils.initAction(this, "action.navigatePrevious."); //$NON-NLS-1$
+ part.getViewSite().getActionBars().setGlobalActionHandler(IWorkbenchActionConstants.PREVIOUS, this);
+ }
+ }
+
+ public void run() {
+ navigate();
+ }
+
+ private void navigate() {
+ SyncInfo info = getSyncInfoFromSelection();
+ INavigableControl navigable = (INavigableControl)page.getViewer();
+ if(info == null) {
+ if(navigable.gotoDifference(direction)) {
+ return;
+ } else {
+ info = getSyncInfoFromSelection();
+ if(info == null) return;
+ }
+ }
+
+ if(info.getLocal().getType() != IResource.FILE) {
+ if(! navigable.gotoDifference(direction)) {
+ info = getSyncInfoFromSelection();
+ OpenInCompareAction.openCompareEditor(part, info, true /* keep focus */);
+ }
+ return;
+ }
+
+ IEditorPart editor = OpenInCompareAction.findOpenCompareEditor(part.getSite(), info.getLocal());
+ boolean atEnd = false;
+ CompareEditorInput input;
+ ICompareNavigator navigator;
+
+ if(editor != null) {
+ // if an existing editor is open on the current selection, use it
+ input = (CompareEditorInput)editor.getEditorInput();
+ navigator = (ICompareNavigator)input.getAdapter(ICompareNavigator.class);
+ if(navigator != null) {
+ if(navigator.selectChange(direction == INavigableControl.NEXT)) {
+ if(! navigable.gotoDifference(direction)) {
+ info = getSyncInfoFromSelection();
+ OpenInCompareAction.openCompareEditor(part, info, true /* keep focus */);
+ }
+ }
+ }
+ } else {
+ // otherwise, select the next change and open a compare editor which will automatically
+ // show the first change.
+ OpenInCompareAction.openCompareEditor(part, info, true /* keep focus */);
+ }
+ }
+
+ private SyncInfo getSyncInfoFromSelection() {
+ IStructuredSelection selection = (IStructuredSelection)part.getSite().getPage().getSelection();
+ if(selection == null) return null;
+ Object obj = selection.getFirstElement();
+ SyncInfo info = OpenInCompareAction.getSyncInfo(obj);
+ return info;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenInCompareAction.java
index 2105d9d2b..fac6a4f2e 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenInCompareAction.java
@@ -28,13 +28,7 @@ import org.eclipse.team.internal.ui.TeamUIPlugin;
import org.eclipse.team.internal.ui.Utils;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.sync.compare.SyncInfoCompareInput;
-import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.*;
/**
* Action to open a compare editor from a SyncInfo object.
@@ -44,25 +38,26 @@ import org.eclipse.ui.IWorkbenchPartSite;
*/
public class OpenInCompareAction extends Action {
- private IWorkbenchPage page;
+ private IViewPart part;
- public OpenInCompareAction(IWorkbenchPage page) {
- this.page = page;
+ public OpenInCompareAction(IViewPart part) {
+ this.part = part;
Utils.initAction(this, "action.openInCompareEditor."); //$NON-NLS-1$
}
public void run() {
- ISelection selection = page.getSelection();
+ ISelection selection = part.getSite().getPage().getSelection();
Object obj = ((IStructuredSelection)selection).getFirstElement();
SyncInfo info = getSyncInfo(obj);
if(info != null) {
- openCompareEditor(page, info, true /* keep focus */);
+ openCompareEditor(part, info, true /* keep focus */);
}
}
- public static SyncInfoCompareInput openCompareEditor(IWorkbenchPage page, SyncInfo info, boolean keepFocus) {
+ public static SyncInfoCompareInput openCompareEditor(IViewPart part, SyncInfo info, boolean keepFocus) {
SyncInfoCompareInput input = getCompareInput(info);
if(input != null) {
+ IWorkbenchPage page = part.getSite().getPage();
IEditorPart editor = findReusableCompareEditor(page);
if(editor != null) {
@@ -83,7 +78,7 @@ public class OpenInCompareAction extends Action {
}
if(keepFocus) {
- SynchronizeView.showInActivePage(page, false /* don't switch perspectives */);
+ page.activate(part);
}
return input;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenWithActionGroup.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenWithActionGroup.java
index 9db72be8d..8b0641c08 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenWithActionGroup.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/OpenWithActionGroup.java
@@ -16,7 +16,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.actions.OpenFileAction;
@@ -30,16 +30,16 @@ public class OpenWithActionGroup extends ActionGroup {
private OpenFileAction openFileAction;
private OpenInCompareAction openInCompareAction;
- private IWorkbenchSite site;
+ private IViewPart part;
- public OpenWithActionGroup(IWorkbenchSite site) {
- this.site = site;
+ public OpenWithActionGroup(IViewPart part) {
+ this.part = part;
makeActions();
}
protected void makeActions() {
- openFileAction = new OpenFileAction(site.getPage());
- openInCompareAction = new OpenInCompareAction(site.getPage());
+ openFileAction = new OpenFileAction(part.getSite().getPage());
+ openInCompareAction = new OpenInCompareAction(part);
}
public void fillContextMenu(IMenuManager menu) {
@@ -79,7 +79,7 @@ public class OpenWithActionGroup extends ActionGroup {
MenuManager submenu =
new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.openWith")); //$NON-NLS-1$
- submenu.add(new OpenWithMenu(site.getPage(), (IFile) resource));
+ submenu.add(new OpenWithMenu(part.getSite().getPage(), (IFile) resource));
menu.add(submenu);
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncViewerShowPreferencesAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncViewerShowPreferencesAction.java
new file mode 100644
index 000000000..fcda1c6e1
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/SyncViewerShowPreferencesAction.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.dialogs.PreferencePageContainerDialog;
+import org.eclipse.team.internal.ui.preferences.SyncViewerPreferencePage;
+
+public class SyncViewerShowPreferencesAction extends Action {
+ private final Shell shell;
+
+ public SyncViewerShowPreferencesAction(Shell shell) {
+ this.shell = shell;
+ Utils.initAction(this, "action.syncViewPreferences."); //$NON-NLS-1$
+ }
+
+ public void run() {
+ PreferencePage page = new SyncViewerPreferencePage();
+ Dialog dialog = new PreferencePageContainerDialog(shell, page);
+ dialog.setBlockOnOpen(true);
+ dialog.open();
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ToggleViewAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ToggleViewAction.java
new file mode 100644
index 000000000..8012175b2
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/ui/sync/actions/ToggleViewAction.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.team.internal.ui.Utils;
+import org.eclipse.team.internal.ui.sync.views.SynchronizeView;
+import org.eclipse.team.ui.sync.SubscriberPage;
+
+public class ToggleViewAction extends Action implements IPropertyChangeListener {
+ private int layout;
+ private SubscriberPage page;
+
+ public ToggleViewAction(SubscriberPage page, int layout) {
+ super(null, SWT.RADIO);
+ this.page = page;
+ this.layout = layout;
+ if(layout == SynchronizeView.TABLE_VIEW) {
+ Utils.initAction(this, "action.toggleViewFlat."); //$NON-NLS-1$
+ } else {
+ Utils.initAction(this, "action.toggleViewHierarchical."); //$NON-NLS-1$
+ }
+ setChecked(page.getLayout() == layout);
+ page.addPropertyChangeListener(this);
+ }
+
+ public void run() {
+ page.setLayout(layout);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ */
+ public void propertyChange(PropertyChangeEvent event) {
+ if(event.getProperty().equals(SubscriberPage.P_SYNCVIEWPAGE_LAYOUT)) {
+ Integer newLayout = (Integer)event.getNewValue();
+ setChecked(newLayout.intValue() == layout);
+ }
+
+ }
+} \ No newline at end of file

Back to the top