Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-12-12 22:40:46 -0500
committerJean Michel-Lemieux2003-12-12 22:40:46 -0500
commit28ea4399145c0aa72fae323df486ff56654849bb (patch)
tree562405a58789c81545657db1bcaca643a6e4b99e
parentef893e2535a0693244772a713a5edd77e6cfbe14 (diff)
downloadeclipse.platform.team-28ea4399145c0aa72fae323df486ff56654849bb.tar.gz
eclipse.platform.team-28ea4399145c0aa72fae323df486ff56654849bb.tar.xz
eclipse.platform.team-28ea4399145c0aa72fae323df486ff56654849bb.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java190
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java13
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncChangesStructuredViewer.java2
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java4
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java3
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java22
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/IChangePreviewViewer.java52
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/TextChangePreviewViewer.java87
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/ViewerPane.java73
10 files changed, 415 insertions, 37 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
index 72699db59..39b1bc2e3 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizard.java
@@ -30,7 +30,9 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.operations.ShareProjectOperation;
+import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
import org.eclipse.team.ui.IConfigurationWizard;
+import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.TeamSubscriberParticipant;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkingSet;
@@ -67,6 +69,7 @@ public class SharingWizard extends Wizard implements IConfigurationWizard {
setDialogSettings(section);
setNeedsProgressMonitor(true);
setWindowTitle(Policy.bind("SharingWizard.title")); //$NON-NLS-1$
+ //set
}
public void addPages() {
@@ -98,7 +101,8 @@ public class SharingWizard extends Wizard implements IConfigurationWizard {
modulePage = new ModuleSelectionPage("modulePage", Policy.bind("SharingWizard.enterModuleName"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
modulePage.setDescription(Policy.bind("SharingWizard.enterModuleNameDescription")); //$NON-NLS-1$
addPage(modulePage);
- finishPage = new SharingWizardFinishPage("finishPage", Policy.bind("SharingWizard.readyToFinish"), sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
+ WorkspaceSynchronizeParticipant p = (WorkspaceSynchronizeParticipant)TeamUI.getSynchronizeManager().find(WorkspaceSynchronizeParticipant.ID)[0];
+ finishPage = new SharingWizardFinishPage("finishPage", Policy.bind("SharingWizard.readyToFinish"), p, sharingImage); //$NON-NLS-1$ //$NON-NLS-2$
finishPage.setDescription(Policy.bind("SharingWizard.readyToFinishDescription")); //$NON-NLS-1$
addPage(finishPage);
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java
index 269f3ab74..5a8c816fa 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/SharingWizardFinishPage.java
@@ -11,34 +11,192 @@
package org.eclipse.team.internal.ccvs.ui.wizards;
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.team.internal.ccvs.ui.IHelpContextIds;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.subscribers.SyncInfo;
+import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant;
+import org.eclipse.team.internal.ui.synchronize.SyncChangesTreeViewer;
+import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoCompareInput;
+import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoDiffNode;
+import org.eclipse.team.internal.ui.synchronize.views.TeamSubscriberParticipantLabelProvider;
+import org.eclipse.team.internal.ui.widgets.*;
+import org.eclipse.team.ui.synchronize.ITeamSubscriberParticipantNode;
+import org.eclipse.team.ui.synchronize.SyncChangesViewer;
+import org.eclipse.ui.part.PageBook;
public class SharingWizardFinishPage extends CVSWizardPage {
- public SharingWizardFinishPage(String pageName, String title, ImageDescriptor titleImage) {
+ private WorkspaceSynchronizeParticipant participant;
+
+ public SharingWizardFinishPage(String pageName, String title, WorkspaceSynchronizeParticipant participant, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
+ this.participant = participant;
}
/*
* @see IDialogPage#createControl(Composite)
*/
public void createControl(Composite parent) {
- Composite composite = createComposite(parent, 1);
- // set F1 help
- WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARING_FINISH_PAGE);
- Label label = new Label(composite, SWT.LEFT | SWT.WRAP);
- label.setText(Policy.bind("SharingWizardFinishPage.message")); //$NON-NLS-1$
- GridData data = new GridData();
- data.widthHint = 350;
- label.setLayoutData(data);
- setControl(composite);
- Dialog.applyDialogFont(parent);
+// Composite composite = createComposite(parent, 1);
+// // set F1 help
+// WorkbenchHelp.setHelp(composite, IHelpContextIds.SHARING_FINISH_PAGE);
+// Label label = new Label(composite, SWT.LEFT | SWT.WRAP);
+// label.setText(Policy.bind("SharingWizardFinishPage.message")); //$NON-NLS-1$
+// GridData data = new GridData();
+// data.widthHint = 350;
+// label.setLayoutData(data);
+// setControl(composite);
+// Dialog.applyDialogFont(parent);
+
+ setControl(createCoolControl(parent));
+
+
+ }
+
+ private static class NullPreviewer implements IChangePreviewViewer {
+ private Label fLabel;
+ public void createControl(Composite parent) {
+ fLabel= new Label(parent, SWT.CENTER | SWT.FLAT);
+ fLabel.setText("No preview available"); //$NON-NLS-1$
+ }
+ public void refresh() {
+ }
+ public Control getControl() {
+ return fLabel;
+ }
+ public void setInput(Object input) throws CoreException {
+ }
+ }
+
+ private PageBook fPreviewContainer;
+ private IChangePreviewViewer fNullPreviewer;
+ private IChangePreviewViewer fChangePreviewViewer;
+ private IChangePreviewViewer fCurrentPreviewViewer;
+ private Viewer fTreeViewer;
+ private ITeamSubscriberParticipantNode fCurrentSelection = null;
+
+ public Composite createCoolControl(Composite parent) {
+ Composite result= new Composite(parent, SWT.NONE);
+ GridLayout layout= new GridLayout();
+ layout.marginHeight= 0; layout.marginWidth= 0;
+ result.setLayout(layout);
+
+ SashForm sashForm= new SashForm(result, SWT.VERTICAL);
+
+ ViewerPane pane= new ViewerPane(sashForm, SWT.BORDER | SWT.FLAT);
+ pane.setText("Synchronize Changes"); //$NON-NLS-1$
+ ToolBarManager tbm= pane.getToolBarManager();
+ //tbm.add(new NextChange());
+ //tbm.add(new PreviousChange());
+ //tbm.update(true);
+
+ fTreeViewer= createTreeViewer(pane);
+ //fTreeViewer.setContentProvider(createTreeContentProvider());
+ //fTreeViewer.setLabelProvider(createTreeLabelProvider());
+ fTreeViewer.addSelectionChangedListener(createSelectionChangedListener());
+ //fTreeViewer.addCheckStateListener(createCheckStateListener());
+ pane.setContent(fTreeViewer.getControl());
+ //setTreeViewerInput();
+
+ fPreviewContainer= new PageBook(sashForm, SWT.NONE);
+ fNullPreviewer= new NullPreviewer();
+ fNullPreviewer.createControl(fPreviewContainer);
+ fPreviewContainer.showPage(fNullPreviewer.getControl());
+ fCurrentPreviewViewer= fNullPreviewer;
+
+ sashForm.setWeights(new int[]{33, 67});
+ GridData gd= new GridData(GridData.FILL_BOTH);
+ gd.widthHint= convertWidthInCharsToPixels(80);
+ sashForm.setLayoutData(gd);
+ Dialog.applyDialogFont(result);
+
+ fChangePreviewViewer = new TextChangePreviewViewer();
+ fChangePreviewViewer.createControl(fPreviewContainer);
+
+ return result;
+ }
+
+ /**
+ * @param pane
+ * @return
+ */
+ private Viewer createTreeViewer(ViewerPane pane) {
+ SyncChangesViewer viewer = new SyncChangesTreeViewer(pane, this.participant, participant.getInput().getFilteredSyncSet());
+ viewer.getViewer().setLabelProvider(new TeamSubscriberParticipantLabelProvider());
+ return viewer.getViewer();
+ }
+
+ private ISelectionChangedListener createSelectionChangedListener() {
+ return new ISelectionChangedListener(){
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection sel= (IStructuredSelection) event.getSelection();
+ if (sel.size() == 1) {
+ ITeamSubscriberParticipantNode newSelection= (ITeamSubscriberParticipantNode)sel.getFirstElement();
+ if (newSelection != fCurrentSelection) {
+ fCurrentSelection= newSelection;
+ SyncInfo info = fCurrentSelection.getSyncInfo();
+ if(info != null && info.getLocal().getType() == IResource.FILE) {
+ SyncInfoDiffNode node = SyncInfoCompareInput.createSyncInfoDiffNode(participant, info);
+ fetchContents(node);
+ showPreview(node);
+ } else {
+ showPreview(null);
+ }
+ }
+ } else {
+ showPreview(null);
+ }
+ }
+ };
+ }
+
+ private void fetchContents(final SyncInfoDiffNode node) {
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ node.cacheContents(monitor);
+ } catch (TeamException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ // TODO Auto-generated catch block
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ }
+ }
+
+ private void showPreview(Object element) {
+ if (element == null) {
+ showNullPreviewer();
+ } else {
+ try {
+ fCurrentPreviewViewer = fChangePreviewViewer;
+ fCurrentPreviewViewer.setInput(element);
+ } catch (CoreException e) {
+ showNullPreviewer();
+ }
+ fPreviewContainer.showPage(fCurrentPreviewViewer.getControl());
+ }
+ }
+
+ private void showNullPreviewer() {
+ fCurrentPreviewViewer= fNullPreviewer;
+ fPreviewContainer.showPage(fCurrentPreviewViewer.getControl());
}
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
index 4a5c56ef2..2ec58ed3b 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java
@@ -17,7 +17,10 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.internal.ui.Policy;
import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
@@ -28,6 +31,13 @@ import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard;
* configuration that is necessary.
*/
public class ConfigureProjectAction extends TeamAction {
+ private static class ResizeWizardDialog extends WizardDialog {
+ public ResizeWizardDialog(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+ }
+
/*
* Method declared on IActionDelegate.
*/
@@ -38,7 +48,8 @@ public class ConfigureProjectAction extends TeamAction {
IProject project = getSelectedProjects()[0];
ConfigureProjectWizard wizard = new ConfigureProjectWizard();
wizard.init(null, project);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
+ WizardDialog dialog = new ResizeWizardDialog(getShell(), wizard);
+ //dialog.
dialog.open();
} catch (Exception e) {
throw new InvocationTargetException(e);
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncChangesStructuredViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncChangesStructuredViewer.java
index ec96a4d4a..bcf226e16 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncChangesStructuredViewer.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/SyncChangesStructuredViewer.java
@@ -59,7 +59,7 @@ public abstract class SyncChangesStructuredViewer extends SyncChangesViewer {
}
private void handleOpen(OpenEvent event) {
- //openWithActions.openInCompareEditor();
+ openWithActions.openInCompareEditor();
}
protected void fillContextMenu(IMenuManager manager) {
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
index f9aed9ebb..ebf244032 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/actions/OpenInCompareAction.java
@@ -26,6 +26,7 @@ import org.eclipse.team.core.sync.IRemoteResource;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoCompareInput;
+import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoDiffNode;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
import org.eclipse.team.ui.synchronize.ISynchronizeView;
import org.eclipse.ui.*;
@@ -126,7 +127,8 @@ public class OpenInCompareAction extends Action {
*/
private static SyncInfoCompareInput getCompareInput(ISynchronizeParticipant participant, SyncInfo info) {
if (info != null && info.getLocal() instanceof IFile) {
- return SyncInfoCompareInput.createInput(participant, info);
+ SyncInfoDiffNode node = SyncInfoCompareInput.createSyncInfoDiffNode(participant, info);
+ return new SyncInfoCompareInput(info, node);
}
return null;
}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
index fb55e15e7..b3f527a3c 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/RemoteResourceTypedElement.java
@@ -107,7 +107,6 @@ public class RemoteResourceTypedElement extends BufferedContent implements IType
* @param monitor
*/
public void cacheContents(IProgressMonitor monitor) throws TeamException {
- bufferedContents = remote.getBufferedStorage(monitor);
-
+ bufferedContents = remote.getBufferedStorage(monitor);
}
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java
index 928ca46d4..795c7b3fb 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/synchronize/compare/SyncInfoCompareInput.java
@@ -12,15 +12,9 @@ package org.eclipse.team.internal.ui.synchronize.compare;
import java.lang.reflect.InvocationTargetException;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.IContentChangeListener;
-import org.eclipse.compare.IContentChangeNotifier;
-import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.*;
import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.team.core.TeamException;
@@ -38,8 +32,7 @@ public class SyncInfoCompareInput extends CompareEditorInput {
private static Image titleImage;
private static ISynchronizeParticipant participant;
- public static SyncInfoCompareInput createInput(ISynchronizeParticipant participant, SyncInfo sync) {
-
+ public static SyncInfoDiffNode createSyncInfoDiffNode(ISynchronizeParticipant participant, SyncInfo sync) {
SyncInfoCompareInput.participant = participant;
// Create the local ITypedElement
ITypedElement localTypedElement = SyncInfoDiffNode.createTypeElement(sync.getLocal(), sync.getKind());
@@ -57,11 +50,10 @@ public class SyncInfoCompareInput extends CompareEditorInput {
if (baseResource != null) {
baseTypedElement = SyncInfoDiffNode.createTypeElement(baseResource);
}
-
- return new SyncInfoCompareInput(sync, new SyncInfoDiffNode(baseTypedElement, localTypedElement, remoteTypedElement, sync.getKind()));
- }
-
- private SyncInfoCompareInput(SyncInfo sync, SyncInfoDiffNode diffNode) {
+ return new SyncInfoDiffNode(baseTypedElement, localTypedElement, remoteTypedElement, sync.getKind());
+ }
+
+ public SyncInfoCompareInput(SyncInfo sync, SyncInfoDiffNode diffNode) {
super(new CompareConfiguration());
this.sync = sync;
this.node = diffNode;
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/IChangePreviewViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/IChangePreviewViewer.java
new file mode 100644
index 000000000..ad3c07da8
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/IChangePreviewViewer.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.internal.ui.widgets;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * Presents a preview of a <code>ChangeElement</code>
+ */
+public interface IChangePreviewViewer {
+
+ /**
+ * Creates the preview viewer's widget hierarchy. This method
+ * should only be called once. Method <code>getControl()</code>
+ * should be use retrieve the widget hierarchy.
+ *
+ * @param parent the parent for the widget hierarchy
+ *
+ * @see #getControl()
+ */
+ public void createControl(Composite parent);
+
+ /**
+ * Returns the preview viewer's SWT control.
+ *
+ * @return the preview viewer's SWT control
+ */
+ public Control getControl();
+
+ /**
+ * Sets the preview viewer's input element.
+ *
+ * @param input the input element
+ */
+ public void setInput(Object input) throws CoreException;
+
+ /**
+ * Refreshes the preview viewer.
+ */
+ public void refresh();
+}
+
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/TextChangePreviewViewer.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/TextChangePreviewViewer.java
new file mode 100644
index 000000000..f9efdc523
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/TextChangePreviewViewer.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2003 International Business Machines Corp. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ui.widgets;
+
+import org.eclipse.compare.*;
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.team.internal.ui.synchronize.compare.SyncInfoDiffNode;
+
+public class TextChangePreviewViewer implements IChangePreviewViewer {
+
+ private ComparePreviewer fViewer;
+
+
+ private static class ComparePreviewer extends CompareViewerSwitchingPane {
+ private CompareConfiguration fCompareConfiguration;
+ public ComparePreviewer(Composite parent) {
+ super(parent, SWT.BORDER | SWT.FLAT, true);
+ fCompareConfiguration= new CompareConfiguration();
+ fCompareConfiguration.setLeftEditable(false);
+ fCompareConfiguration.setLeftLabel("Local File"); //$NON-NLS-1$
+ fCompareConfiguration.setRightEditable(false);
+ fCompareConfiguration.setRightLabel("Remote File"); //$NON-NLS-1$
+ }
+ protected Viewer getViewer(Viewer oldViewer, Object input) {
+ String localText = "Local File:";
+ String remoteText = "Remote File:";
+ if(input instanceof SyncInfoDiffNode) {
+ }
+ return CompareUI.findContentViewer(oldViewer, (ICompareInput)input, this, fCompareConfiguration);
+ }
+ public void setText(String text) {
+ /*
+ Object input= getInput();
+ if (input instanceof CompareInput) {
+ CompareInput cInput= (CompareInput)input;
+ setImage(fLabelProvider.getImage(cInput.getChangeElement()));
+ super.setText(fLabelProvider.getText(cInput.getChangeElement()));
+ } else {
+ super.setText(text);
+ setImage(null);
+ }
+ */
+ super.setText(text);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.refactoring.IChangePreviewViewer#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ fViewer= new ComparePreviewer(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.refactoring.IChangePreviewViewer#getControl()
+ */
+ public Control getControl() {
+ return fViewer;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.refactoring.IChangePreviewViewer#setInput(org.eclipse.jdt.internal.ui.refactoring.ChangeElement)
+ */
+ public void setInput(Object input) throws CoreException {
+ fViewer.setInput(input);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.refactoring.IChangePreviewViewer#refresh()
+ */
+ public void refresh() {
+ fViewer.getViewer().refresh();
+ }
+}
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/ViewerPane.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/ViewerPane.java
new file mode 100644
index 000000000..911f5ee0b
--- /dev/null
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/widgets/ViewerPane.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * 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.widgets;
+
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.ViewForm;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ToolBar;
+
+/**
+ * A <code>ViewerPane</code> is a convenience class which installs a
+ * <code>CLabel</code> and a <code>Toolbar</code> in a <code>ViewForm</code>.
+ * <P>
+ */
+public class ViewerPane extends ViewForm {
+
+ private ToolBarManager fToolBarManager;
+
+ public ViewerPane(Composite parent, int style) {
+ super(parent, style);
+
+ marginWidth= 0;
+ marginHeight= 0;
+
+ CLabel label= new CLabel(this, SWT.NONE);
+ setTopLeft(label);
+
+ ToolBar tb= new ToolBar(this, SWT.FLAT);
+ setTopCenter(tb);
+ fToolBarManager= new ToolBarManager(tb);
+ }
+
+ /**
+ * Sets the receiver's title text.
+ */
+ public void setText(String label) {
+ CLabel cl= (CLabel) getTopLeft();
+ cl.setText(label);
+ }
+
+ public String getText() {
+ CLabel cl= (CLabel) getTopLeft();
+ return cl.getText();
+ }
+
+ /**
+ * Sets the receiver's title image.
+ */
+ public void setImage(Image image) {
+ CLabel cl= (CLabel) getTopLeft();
+ cl.setImage(image);
+ }
+
+ public Image getImage() {
+ CLabel cl= (CLabel) getTopLeft();
+ return cl.getImage();
+ }
+
+ public ToolBarManager getToolBarManager() {
+ return fToolBarManager;
+ }
+}

Back to the top