Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2016-11-04 17:37:48 +0000
committerAndrey Loskutov2016-11-04 20:18:45 +0000
commitbf7292ed40eab1e600437a7521a99864c98299ad (patch)
treef44347b408186df22740428859a2bbb4e29588a1 /bundles/org.eclipse.compare/compare
parentf60954ba88fb4b106af2fd6056f69c93a54110b6 (diff)
downloadeclipse.platform.team-I20161111-2000.tar.gz
eclipse.platform.team-I20161111-2000.tar.xz
eclipse.platform.team-I20161111-2000.zip
Change-Id: I2ed3512c294b06e85a63fab90a0934e611339e31 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'bundles/org.eclipse.compare/compare')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java18
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java70
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java72
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java72
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareContainer.java22
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareFilter.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareInputLabelProvider.java18
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContentExtension.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/INavigatable.java26
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ISharedDocumentAdapter.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java20
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java30
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/SharedDocumentAdapter.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java24
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java238
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IFlushable.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java862
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TokenComparator.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java38
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java26
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContainer.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java36
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java34
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareHandlerService.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java134
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java90
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java126
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceHandler.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ContentChangeNotifier.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java64
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java36
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IFlushable2.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IMergeViewerTestAdapter.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavingSaveable.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java28
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java148
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java54
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NavigationEndDialog.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OutlineViewerCreator.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java94
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java26
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java122
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StructureCreatorDescriptor.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java12
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkQueue.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java322
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/LineComparator.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java146
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java70
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchDiffNode.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchTargetPage.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java40
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizardDialog.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java128
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java100
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java14
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java32
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java42
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/IFilePatch.java20
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/WorkspacePatcherUI.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java10
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java40
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java98
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java46
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java24
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator2.java22
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/SharedDocumentAdapterWrapper.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java32
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java110
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureRootNode.java14
125 files changed, 2222 insertions, 2222 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
index 6e6e8b182..79922a0d9 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/BufferedContent.java
@@ -27,22 +27,22 @@ import org.eclipse.core.runtime.CoreException;
* (by means of <code>getContents</code>) and the <code>BufferedContent</code> is not modified (with
* <code>setContent</code>) no buffering takes place.
* Buffering starts when either method <code>getContent</code> or <code>setContent</code> is called.
- *
+ *
* @see IContentChangeNotifier
* @see IStreamContentAccessor
*/
public abstract class BufferedContent implements IContentChangeNotifier, IStreamContentAccessor {
-
+
byte[] fContent;
private ContentChangeNotifier fChangeNotifier;
-
+
/**
* Creates a buffered stream content accessor.
*/
protected BufferedContent() {
// empty implementation
}
-
+
/* (non-Javadoc)
* see IStreamContentAccessor.getContents
*/
@@ -62,7 +62,7 @@ public abstract class BufferedContent implements IContentChangeNotifier, IStream
* @exception CoreException if the contents could not be accessed
*/
protected abstract InputStream createStream() throws CoreException;
-
+
/**
* Sets the contents. Registered content change listeners are notified.
*
@@ -72,7 +72,7 @@ public abstract class BufferedContent implements IContentChangeNotifier, IStream
fContent= contents;
fireContentChanged();
}
-
+
/**
* Returns the contents as an array of bytes.
*
@@ -97,7 +97,7 @@ public abstract class BufferedContent implements IContentChangeNotifier, IStream
public void discardBuffer() {
fContent= null;
}
-
+
/* (non-Javadoc)
* see IContentChangeNotifier.addChangeListener
*/
@@ -106,7 +106,7 @@ public abstract class BufferedContent implements IContentChangeNotifier, IStream
fChangeNotifier= new ContentChangeNotifier(this);
fChangeNotifier.addContentChangeListener(listener);
}
-
+
/* (non-Javadoc)
* see IContentChangeNotifier.removeChangeListener
*/
@@ -117,7 +117,7 @@ public abstract class BufferedContent implements IContentChangeNotifier, IStream
fChangeNotifier= null;
}
}
-
+
/**
* Notifies all registered <code>IContentChangeListener</code>s of a content change.
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
index e2f3c154c..fb90e0ace 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -39,17 +39,17 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public final class CompareUI {
-
+
/**
* Compare Plug-in ID (value <code>"org.eclipse.compare"</code>).
* @since 2.0
*/
public static final String PLUGIN_ID= "org.eclipse.compare"; //$NON-NLS-1$
-
+
/**
* The id of the Compare Preference Page
* (value <code>"org.eclipse.compare.internal.ComparePreferencePage"</code>).
- *
+ *
* @since 3.1
*/
public static final String PREFERENCE_PAGE_ID= "org.eclipse.compare.internal.ComparePreferencePage"; //$NON-NLS-1$
@@ -69,7 +69,7 @@ public final class CompareUI {
* @since 2.0
*/
public static final ImageDescriptor DESC_ETOOL_NEXT= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.ETOOL_NEXT);
-
+
/**
* Image descriptor for the disabled icon of the 'Previous' tool bar button.
* @since 2.0
@@ -93,15 +93,15 @@ public final class CompareUI {
* title bar.
*/
public static final String COMPARE_VIEWER_TITLE= "org.eclipse.compare.CompareUI.CompareViewerTitle"; //$NON-NLS-1$
-
+
private CompareUI() {
// empty implementation
}
-
+
public static AbstractUIPlugin getPlugin() {
return CompareUIPlugin.getDefault();
}
-
+
/**
* Returns this plug-in's resource bundle.
*
@@ -110,7 +110,7 @@ public final class CompareUI {
public static ResourceBundle getResourceBundle() {
return CompareUIPlugin.getDefault().getResourceBundle();
}
-
+
/**
* Performs the comparison described by the given input and opens a
* compare editor on the result in the currently active workbench page.
@@ -120,11 +120,11 @@ public final class CompareUI {
public static void openCompareEditor(CompareEditorInput input) {
openCompareEditor(input, true);
}
-
+
/**
* Performs the comparison described by the given input and opens a compare
* editor on the result in the currently active workbench page.
- *
+ *
* @param input
* the input on which to open the compare editor
* @param activate
@@ -136,7 +136,7 @@ public final class CompareUI {
public static void openCompareEditor(CompareEditorInput input, boolean activate) {
openCompareEditorOnPage(input, null, activate);
}
-
+
/**
* Performs the comparison described by the given input and opens a
* compare editor on the result in the given workbench page.
@@ -148,11 +148,11 @@ public final class CompareUI {
public static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page) {
openCompareEditorOnPage(input, page, true);
}
-
+
/**
* Performs the comparison described by the given input and opens a compare
* editor on the result in the given workbench page.
- *
+ *
* @param input
* the input on which to open the compare editor
* @param page
@@ -167,7 +167,7 @@ public final class CompareUI {
if (plugin != null)
plugin.openCompareEditor(input, page, null, activate);
}
-
+
/**
* Performs the comparison described by the given input and
* shows the result in the given editor.
@@ -179,11 +179,11 @@ public final class CompareUI {
public static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor) {
reuseCompareEditor(input, editor, true);
}
-
+
/**
* Performs the comparison described by the given input and shows the result
* in the given editor.
- *
+ *
* @param input
* the input on which to open the compare editor
* @param editor
@@ -198,7 +198,7 @@ public final class CompareUI {
if (plugin != null)
plugin.openCompareEditor(input, null, editor, activate);
}
-
+
/**
* Performs the comparison described by the given input and opens a
* modal compare dialog on the result.
@@ -210,7 +210,7 @@ public final class CompareUI {
if (plugin != null)
plugin.openCompareDialog(input);
}
-
+
/**
* Registers an image descriptor for the given type.
*
@@ -220,7 +220,7 @@ public final class CompareUI {
public static void registerImageDescriptor(String type, ImageDescriptor descriptor) {
CompareUIPlugin.registerImageDescriptor(type, descriptor);
}
-
+
/**
* Returns a shared image for the given type, or a generic image if none
* has been registered for the given type.
@@ -236,7 +236,7 @@ public final class CompareUI {
public static Image getImage(String type) {
return CompareUIPlugin.getImage(type);
}
-
+
/**
* Registers the given image for being disposed when this plug-in is shutdown.
*
@@ -245,7 +245,7 @@ public final class CompareUI {
public static void disposeOnShutdown(Image image) {
CompareUIPlugin.disposeOnShutdown(image);
}
-
+
/**
* Returns a shared image for the given adaptable.
* This convenience method queries the given adaptable
@@ -263,8 +263,8 @@ public final class CompareUI {
public static Image getImage(IAdaptable adaptable) {
return CompareUIPlugin.getImage(adaptable);
}
-
-
+
+
/**
* Creates a stream merger for the given content type.
* If no stream merger is registered for the given content type <code>null</code> is returned.
@@ -272,7 +272,7 @@ public final class CompareUI {
* @param type the type for which to find a stream merger
* @return a stream merger for the given type, or <code>null</code> if no
* stream merger has been registered
- * @deprecated Clients should obtain an <code>org.eclipse.team.core.mapping.IStorageMerger</code> from the
+ * @deprecated Clients should obtain an <code>org.eclipse.team.core.mapping.IStorageMerger</code> from the
* <code>org.eclipse.team.core.Team#createMerger(IContentType)</code> method.
*/
public static IStreamMerger createStreamMerger(IContentType type) {
@@ -286,7 +286,7 @@ public final class CompareUI {
* @param type the type for which to find a stream merger
* @return a stream merger for the given type, or <code>null</code> if no
* stream merger has been registered
- * @deprecated Clients should obtain an <code>org.eclipse.team.core.mapping.IStorageMerger</code> from the
+ * @deprecated Clients should obtain an <code>org.eclipse.team.core.mapping.IStorageMerger</code> from the
* <code>org.eclipse.team.core.Team#createMerger(String)</code> method.
*/
public static IStreamMerger createStreamMerger(String type) {
@@ -311,7 +311,7 @@ public final class CompareUI {
return CompareUIPlugin.getDefault().findStructureViewer(oldViewer, input, parent, configuration);
}
-
+
/**
* Returns a content compare viewer based on an old viewer and an input object.
* If the old viewer is suitable for showing the input the old viewer
@@ -329,7 +329,7 @@ public final class CompareUI {
CompareConfiguration configuration) {
return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration);
}
-
+
/**
* Returns a content compare viewer based on an old viewer and an input
* object. If the old viewer is suitable for showing the input the old
@@ -350,7 +350,7 @@ public final class CompareUI {
*/
public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent,
CompareConfiguration configuration) {
-
+
return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration);
}
@@ -358,7 +358,7 @@ public final class CompareUI {
* Adds an alias for the given type. Subsequent calls to
* <code>findStructureViewer</code> treat alias as a synonym for type and
* return the same viewer.
- *
+ *
* @param type
* a type name for which a viewer has been registered
* @param alias
@@ -370,12 +370,12 @@ public final class CompareUI {
public static void addStructureViewerAlias(String type, String alias) {
CompareUIPlugin.getDefault().addStructureViewerAlias(type, alias);
}
-
+
/**
* Remove all aliases for the given type. This method does not affect the
* initial binding between type and viewer. If no aliases exist for the
* given type this method does nothing.
- *
+ *
* @param type
* the type name for which all synonyms are removed.
* @since 2.0
@@ -385,7 +385,7 @@ public final class CompareUI {
public static void removeAllStructureViewerAliases(String type) {
CompareUIPlugin.getDefault().removeAllStructureViewerAliases(type);
}
-
+
/**
* Retrieve a document for the given input or return <code>null</code> if
* no document has been registered for the input.
@@ -415,7 +415,7 @@ public final class CompareUI {
public static void unregisterDocument(IDocument document) {
DocumentManager.remove(document);
}
-
+
/**
* Create and return a structure creator for the given typed element.
* Return <code>null</code> if an appropriate structure creator could
@@ -431,6 +431,6 @@ public final class CompareUI {
}
return null;
}
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
index 7b362a4dc..fc040e1a7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerPane.java
@@ -48,10 +48,10 @@ import org.eclipse.swt.widgets.ToolItem;
* (if there is one).
* If more <code>Splitters</code> are nested maximizing walks up and
* maximizes to the outermost <code>Splitter</code>.
- *
+ *
* @since 2.0
*/
-public class CompareViewerPane extends ViewForm implements ISelectionProvider,
+public class CompareViewerPane extends ViewForm implements ISelectionProvider,
IDoubleClickListener, ISelectionChangedListener, IOpenListener, IAdaptable {
private ToolBarManager fToolBarManager;
private Object fInput;
@@ -72,16 +72,16 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
* @exception org.eclipse.swt.SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
- */
+ */
public CompareViewerPane(Composite container, int style) {
super(container, style);
-
+
marginWidth= 0;
marginHeight= 0;
-
+
Control topLeft = createTopLeft(this);
setTopLeft(topLeft);
-
+
MouseAdapter ml= new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
@@ -92,11 +92,11 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
if (parent instanceof Splitter)
((Splitter)parent).setMaximizedControl(CompareViewerPane.this);
}
- };
-
+ };
+
addMouseListener(ml);
getTopLeft().addMouseListener(ml);
-
+
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
@@ -110,7 +110,7 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
}
});
}
-
+
/**
* @param parent
* a widget which will be the parent of the control (cannot be
@@ -129,23 +129,23 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
};
return label;
}
-
+
/**
* Set the pane's title text.
* The value <code>null</code> clears it.
- *
+ *
* @param label the text to be displayed in the pane or null
*/
public void setText(String label) {
CLabel cl= (CLabel) getTopLeft();
if (cl != null && !cl.isDisposed())
- cl.setText(label);
+ cl.setText(label);
}
-
+
/**
* Set the pane's title Image.
* The value <code>null</code> clears it.
- *
+ *
* @param image the image to be displayed in the pane or null
*/
public void setImage(Image image) {
@@ -153,11 +153,11 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
if (cl != null)
cl.setImage(image);
}
-
+
/**
* Returns a <code>ToolBarManager</code> if the given parent is a
* <code>CompareViewerPane</code> or <code>null</code> otherwise.
- *
+ *
* @param parent a <code>Composite</code> or <code>null</code>
* @return a <code>ToolBarManager</code> if the given parent is a <code>CompareViewerPane</code> otherwise <code>null</code>
*/
@@ -171,7 +171,7 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
/**
* Clears tool items in the <code>CompareViewerPane</code>'s control bar.
- *
+ *
* @param parent a <code>Composite</code> or <code>null</code>
*/
public static void clearToolBar(Composite parent) {
@@ -181,9 +181,9 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
tbm.update(true);
}
}
-
+
//---- private stuff
-
+
private ToolBarManager getToolBarManager() {
if (fToolBarManager != null && fToolBarManager.getControl() == null)
return null;
@@ -208,29 +208,29 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
}
return fToolBarManager;
}
-
+
/**
* Returns the current input of this pane or null if the pane has no input.
- *
+ *
* @return an <code>Object</code> that is the input to this pane or null if the pane has no input.
- *
+ *
* @since 3.3
*/
public Object getInput() {
return fInput;
}
-
+
/**
- * Sets the input object of this pane.
- *
+ * Sets the input object of this pane.
+ *
* @param input the new input object or <code>null</code>
* @since 3.3
- */
+ */
public void setInput(Object input) {
if (fInput != input)
fInput= input;
}
-
+
@Override
public void addSelectionChangedListener(ISelectionChangedListener l) {
fSelectionListeners.add(l);
@@ -240,24 +240,24 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
public void removeSelectionChangedListener(ISelectionChangedListener l) {
fSelectionListeners.remove(l);
}
-
+
@Override
public ISelection getSelection() {
return null;
}
-
+
@Override
public void setSelection(ISelection s) {
// Default is to do nothing
}
-
+
@Override
public void selectionChanged(SelectionChangedEvent ev) {
for (ISelectionChangedListener listener : fSelectionListeners) {
listener.selectionChanged(ev);
}
}
-
+
@Override
public void doubleClick(DoubleClickEvent event) {
for (IDoubleClickListener listener : fDoubleClickListener) {
@@ -277,7 +277,7 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
}
/**
- * Remove a double-click listener. Removing a listener that is not
+ * Remove a double-click listener. Removing a listener that is not
* registered has no effect.
* @param listener the listener
* @since 3.3
@@ -298,7 +298,7 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
}
/**
- * Remove an open listener. Removing a listener that is not
+ * Remove an open listener. Removing a listener that is not
* registered has no effect.
* @param listener the listener
* @since 3.3
@@ -306,14 +306,14 @@ public class CompareViewerPane extends ViewForm implements ISelectionProvider,
public void removeOpenListener(IOpenListener listener) {
fOpenListener.remove(listener);
}
-
+
@Override
public void open(OpenEvent event) {
Object[] listeners= fOpenListener.getListeners();
for (int i= 0; i < listeners.length; i++)
((IOpenListener) listeners[i]).open(event);
}
-
+
@Override
public <T> T getAdapter(Class<T> adapter) {
return Platform.getAdapterManager().getAdapter(this, adapter);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
index eea4162c9..ceffe679a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareViewerSwitchingPane.java
@@ -31,7 +31,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* A custom <code>CompareViewerPane</code> that supports dynamic viewer switching.
- *
+ *
* <p>
* Clients must implement the viewer switching strategy by implementing
* the <code>getViewer(Viewer, Object)</code> method.
@@ -39,7 +39,7 @@ import com.ibm.icu.text.MessageFormat;
* If a property with the name <code>CompareUI.COMPARE_VIEWER_TITLE</code> is set
* on the top level SWT control of a viewer, it is used as a title in the <code>CompareViewerPane</code>'s
* title bar.
- *
+ *
* @since 2.0
*/
public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
@@ -47,7 +47,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
private boolean fControlVisibility;
private String fTitle;
private String fTitleArgument;
-
+
/**
* Creates a <code>CompareViewerSwitchingPane</code> as a child of the given parent and with the
* specified SWT style bits.
@@ -61,11 +61,11 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
* @exception org.eclipse.swt.SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
- */
+ */
public CompareViewerSwitchingPane(Composite parent, int style) {
this(parent, style, false);
}
-
+
/**
* Creates a <code>CompareViewerSwitchingPane</code> as a child of the given parent and with the
* specified SWT style bits.
@@ -80,14 +80,14 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
* @exception org.eclipse.swt.SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* </ul>
- */
+ */
public CompareViewerSwitchingPane(Composite parent, int style, boolean visibility) {
super(parent, style);
fControlVisibility= visibility;
-
+
setViewer(new NullViewer(this));
-
+
addDisposeListener(
new DisposeListener() {
@Override
@@ -104,25 +104,25 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
}
);
}
-
+
/**
* Returns the current viewer.
- *
+ *
* @return the current viewer
*/
public Viewer getViewer() {
return fViewer;
}
-
+
private void setViewer(Viewer newViewer) {
if (newViewer == fViewer)
return;
-
+
boolean oldEmpty= isEmpty();
if (fViewer != null) {
fViewer.removeSelectionChangedListener(this);
-
+
if (fViewer instanceof StructuredViewer) {
StructuredViewer sv= (StructuredViewer) fViewer;
sv.removeDoubleClickListener(this);
@@ -131,9 +131,9 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
Control content= getContent();
setContent(null);
-
+
fViewer.setInput(null);
-
+
if (content != null && !content.isDisposed())
content.dispose();
} else {
@@ -160,13 +160,13 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
sv.addDoubleClickListener(this);
sv.addOpenListener(this);
}
-
+
if (oldEmpty != newEmpty) { // re-layout my container
Composite parent= getParent();
if (parent instanceof Splitter)
((Splitter)parent).setVisible(this, fControlVisibility ? !newEmpty : true);
}
-
+
layout(true);
}
}
@@ -175,7 +175,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
* Returns the optional title argument that has been set with
* <code>setTitelArgument</code> or <code>null</code> if no optional title
* argument has been set.
- *
+ *
* @return the optional title argument or <code>null</code>
* @noreference This method is for internal use only. Clients should not
* call this method.
@@ -189,7 +189,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
/**
* Returns <code>true</code> if no viewer is installed or if the current viewer
* is a <code>NullViewer</code>.
- *
+ *
* @return <code>true</code> if no viewer is installed or if the current viewer is a <code>NullViewer</code>
*/
public boolean isEmpty() {
@@ -208,7 +208,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
if (fViewer != null)
fViewer.setSelection(s);
}
-
+
private boolean hasFocus2() {
// do we have focus?
Display display= getDisplay();
@@ -218,7 +218,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
return true;
return false;
}
-
+
/**
* @param input the input
* @return true, if the input is considered as changed
@@ -229,9 +229,9 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
protected boolean inputChanged(Object input) {
return getInput() != input;
}
-
+
/**
- * Sets the input object of this pane.
+ * Sets the input object of this pane.
* For this input object a suitable viewer is determined by calling the abstract
* method <code>getViewer(Viewer, Object)</code>.
* If the returned viewer differs from the current one, the old viewer
@@ -241,16 +241,16 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
* <code>setInput(Object)</code> is called.
* If the input is <code>null</code> the pane is cleared,
* that is the current viewer is disposed.
- *
+ *
* @param input the new input object or <code>null</code>
- */
+ */
@Override
public void setInput(Object input) {
if (!inputChanged(input))
return;
boolean hadFocus = hasFocus2();
-
+
super.setInput(input);
// viewer switching
@@ -263,7 +263,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
return;
newViewer= new NullViewer(this);
}
-
+
setViewer(newViewer);
// set input
@@ -276,8 +276,8 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
if (!(fViewer instanceof NullViewer) && input instanceof ICompareInput)
image= ((ICompareInput)input).getImage();
setImage(image);
-
- String title= null;
+
+ String title= null;
if (fViewer != null) {
Control c= fViewer.getControl();
if (c != null) {
@@ -286,16 +286,16 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
title= (String) data;
if (hadFocus)
c.setFocus();
- }
+ }
}
-
+
fTitle= title;
updateTitle();
}
-
+
/**
* Sets an additional and optional argument for the pane's title.
- *
+ *
* @param argument
* an optional argument for the pane's title
* @noreference This method is for internal use only. Clients should not
@@ -311,11 +311,11 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
private void updateTitle() {
if (fTitle != null) {
if (fTitleArgument != null) {
- String format= CompareMessages.CompareViewerSwitchingPane_Titleformat;
+ String format= CompareMessages.CompareViewerSwitchingPane_Titleformat;
String t= MessageFormat.format(format, fTitle, fTitleArgument);
setText(t);
} else
- setText(fTitle);
+ setText(fTitle);
} else {
setText(""); //$NON-NLS-1$
}
@@ -355,7 +355,7 @@ public abstract class CompareViewerSwitchingPane extends CompareViewerPane {
}
return super.getAdapter(adapter);
}
-
+
@Override
public boolean setFocus() {
Viewer v= getViewer();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
index 7e35a3595..71bf31e97 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/HistoryItem.java
@@ -34,9 +34,9 @@ import org.eclipse.core.runtime.IPath;
* @noextend This class is not intended to be subclassed by clients.
*/
public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate, IResourceProvider {
-
+
private ITypedElement fBase;
- private IFileState fFileState;
+ private IFileState fFileState;
/**
* Creates a <code>HistoryItem</code> object which combines the given <code>IFileState</code>
@@ -50,21 +50,21 @@ public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement
fBase= base;
fFileState= fileState;
}
-
+
/* (non-Javadoc)
* see ITypedElement.getName
*/
public String getName() {
return fBase.getName();
}
-
+
/* (non-Javadoc)
* see ITypedElement.getImage
*/
public Image getImage() {
return fBase.getImage();
}
-
+
/* (non-Javadoc)
* see ITypedElement.getType
*/
@@ -78,7 +78,7 @@ public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement
public long getModificationDate() {
return fFileState.getModificationTime();
}
-
+
/* (non-Javadoc)
* see IStreamContentAccessor.getContents
*/
@@ -90,7 +90,7 @@ public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement
* @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset()
*/
public String getCharset() throws CoreException {
- String charset= fFileState.getCharset();
+ String charset= fFileState.getCharset();
if (charset == null) {
IResource resource= getResource();
if (resource instanceof IEncodedStorage)
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareContainer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareContainer.java
index cde491841..67497d179 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareContainer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareContainer.java
@@ -27,17 +27,17 @@ import org.eclipse.ui.services.IServiceLocator;
* @since 3.3
*/
public interface ICompareContainer extends IRunnableContext{
-
+
/**
* Register for change events for the given compare input. Although clients can register
- * with the compare input directly, registering through the container allows for
- * deterministic and optimized behavior in some cases. Registering multiple times for the
+ * with the compare input directly, registering through the container allows for
+ * deterministic and optimized behavior in some cases. Registering multiple times for the
* same compare input has no effect.
* @param input the compare input
* @param listener the compare input change listener
*/
public void addCompareInputChangeListener(ICompareInput input, ICompareInputChangeListener listener);
-
+
/**
* Remove the change listener from the given compare input. Removing a listener that is not
* registered has no effect.
@@ -55,20 +55,20 @@ public interface ICompareContainer extends IRunnableContext{
* @param selectionProvider the selection provider
*/
public void registerContextMenu(MenuManager menu, ISelectionProvider selectionProvider);
-
+
/**
* Set the status message displayed by the container to the given message
* @param message the status message
*/
public void setStatusMessage(String message);
-
+
/**
* Return the action bars for the container or <code>null</code> if the container
* does not have an action bars.
* @return the action bars for the container or <code>null</code>
*/
public IActionBars getActionBars();
-
+
/**
* Return the service locator for the container or <code>null</code> if the container
* does not have one.
@@ -82,7 +82,7 @@ public interface ICompareContainer extends IRunnableContext{
* @return the {@link ICompareNavigator} associated with this container or <code>null</code>
*/
public ICompareNavigator getNavigator();
-
+
/**
* Queue the given task to be run asynchronously. If the given runnable was
* previously queued to run asynchronously and it has not yet run, the task
@@ -91,11 +91,11 @@ public interface ICompareContainer extends IRunnableContext{
* to the end of the queue.
* <p>
* This method should be treated as a request to run the given task asynchronously.
- * However, clients should not assume that the code will be run asynchronously.
+ * However, clients should not assume that the code will be run asynchronously.
* Depending on the container implementation, a call to this method may or may
* not block the caller until the task is completed. Also, the task may be executed
* in a modal or non-modal fashion.
- *
+ *
* @param runnable the task to be performed
*/
public void runAsynchronously(IRunnableWithProgress runnable);
@@ -107,5 +107,5 @@ public interface ICompareContainer extends IRunnableContext{
* <code>null</code>
*/
public IWorkbenchPart getWorkbenchPart();
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareFilter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareFilter.java
index 0c34ae6a8..7de9324ae 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareFilter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareFilter.java
@@ -19,7 +19,7 @@ import org.eclipse.jface.text.IRegion;
* A filter that can be applied during the comparison of documents that can be
* used to customize the detection of text differences via the compareFilter
* extension point. Filters are exposed as toggle actions in the compare viewer.
- *
+ *
* @noreference This interface is not intended to be referenced by clients
* @since 3.6
*/
@@ -50,7 +50,7 @@ public interface ICompareFilter {
/**
* Forwards the current input objects of the compare
- *
+ *
* @param input
* the merge viewer input
* @param ancestor
@@ -66,7 +66,7 @@ public interface ICompareFilter {
/**
* Identifies the regions of a line of text in a comparison that should be
* ignored for comparison purposes.
- *
+ *
* @param lineComparison
* contains values for the keys <CODE>THIS_LINE</CODE>,
* <CODE>THIS_CONTRIBUTOR</CODE>, <CODE>OTHER_LINE</CODE> and
@@ -78,7 +78,7 @@ public interface ICompareFilter {
/**
* Returns whether the filter should be enabled when first initialized
- *
+ *
* @return default enablement
*/
public boolean isEnabledInitially();
@@ -90,7 +90,7 @@ public interface ICompareFilter {
* line will be the same regardless of what line it is being compared to,
* returning <code>true</code> to this method will cause the ignored region
* calculations to be re-used and improve the performance of the comparison.
- *
+ *
* @return ignored region results can be cached
*/
public boolean canCacheFilteredRegions();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareInputLabelProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareInputLabelProvider.java
index 1f5fc6344..f1aa7cf85 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareInputLabelProvider.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareInputLabelProvider.java
@@ -14,11 +14,11 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.graphics.Image;
/**
- * A label provider that provides the label and image for the left, right and
+ * A label provider that provides the label and image for the left, right and
* ancestor sides for a compare input being shown in compare/merge viewers.
* <p>
* This interface may be implemented by clients.
- *
+ *
* @since 3.3
*/
public interface ICompareInputLabelProvider extends ILabelProvider {
@@ -31,16 +31,16 @@ public interface ICompareInputLabelProvider extends ILabelProvider {
* @return the label for the ancestor side or <code>null</code>
*/
String getAncestorLabel(Object input);
-
+
/**
* Returns the image for the ancestor side of compare/merge viewers.
* This image is typically shown in the title of the ancestor area in a compare viewer.
*
* @param input the input object of a compare/merge viewer or <code>null</code>
* @return the image for the ancestor side or <code>null</code>
- */
+ */
Image getAncestorImage(Object input);
-
+
/**
* Returns the label for the left hand side of compare/merge viewers.
* This label is typically shown in the title of the left side of a compare viewer.
@@ -49,16 +49,16 @@ public interface ICompareInputLabelProvider extends ILabelProvider {
* @return the label for the left hand side or <code>null</code>
*/
String getLeftLabel(Object input);
-
+
/**
* Returns the image for the left hand side of compare/merge viewers.
* This image is typically shown in the title of the left side of a compare viewer.
*
* @param input the input object of a compare/merge viewer or <code>null</code>
* @return the image for the left hand side or <code>null</code>
- */
+ */
Image getLeftImage(Object input);
-
+
/**
* Returns the label for the right hand side of compare/merge viewers.
* This label is typically shown in the title of the right side of a compare viewer.
@@ -67,7 +67,7 @@ public interface ICompareInputLabelProvider extends ILabelProvider {
* @return the label for the right hand side or <code>null</code>
*/
String getRightLabel(Object input);
-
+
/**
* Returns the image for the right hand side of compare/merge viewers.
* This image is typically shown in the title of the right side of a compare viewer.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
index 1a8da9779..955078c53 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ICompareNavigator.java
@@ -21,15 +21,15 @@ package org.eclipse.compare;
* <p>
* Although it is legal for clients to implement this interface, it is better
* to subclass {@link CompareNavigator}.
- *
+ *
* @since 3.0
*/
public interface ICompareNavigator {
-
+
/**
* Starting from the current selection <code>selectChange</code> selects and reveals the next (previous) change.
* If the end (or beginning) is reached, the method returns <code>true</code>.
- *
+ *
* @param next if <code>true</code> the next change is selected, otherwise the previous change
* @return returns <code>true</code> if end (beginning) is reached, <code>false</code> otherwise
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
index c45997d57..146a4ba84 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeListener.java
@@ -11,7 +11,7 @@
package org.eclipse.compare;
/**
- * An <code>IContentChangeListener</code> is informed about content changes of a
+ * An <code>IContentChangeListener</code> is informed about content changes of a
* <code>IContentChangeNotifier</code>.
* <p>
* Clients may implement this interface.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
index f63f9705d..28a3940dd 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IContentChangeNotifier.java
@@ -20,7 +20,7 @@ package org.eclipse.compare;
* @see IContentChangeListener
*/
public interface IContentChangeNotifier {
-
+
/**
* Adds a content change listener to this notifier.
* Has no effect if an identical listener is already registered.
@@ -28,7 +28,7 @@ public interface IContentChangeNotifier {
* @param listener a content changed listener
*/
void addContentChangeListener(IContentChangeListener listener);
-
+
/**
* Removes the given content changed listener from this notifier.
* Has no effect if the listener is not registered.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
index 24adf799c..4b38d76a5 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContent.java
@@ -24,26 +24,26 @@ package org.eclipse.compare;
* @see IStreamContentAccessor
*/
public interface IEditableContent {
-
+
/**
* Returns <code>true</code> if this object can be modified.
* If it returns <code>false</code> the other methods of this API must not be called.
- *
+ *
* @return <code>true</code> if this object can be modified
*/
boolean isEditable();
-
+
/**
* Replaces the current content with the given new bytes.
- *
+ *
* @param newContent this new contents replaces the old contents
*/
- void setContent(byte[] newContent);
+ void setContent(byte[] newContent);
/**
* This method is called on a parent to add or remove a child,
* or to copy the contents of a child.
- *
+ *
* What to do is encoded in the two arguments as follows:
* <TABLE>
* <TR>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContentExtension.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContentExtension.java
index d5af8b953..13a0be4cf 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContentExtension.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEditableContentExtension.java
@@ -25,7 +25,7 @@ import org.eclipse.ui.texteditor.IDocumentProviderExtension;
* @since 3.3
*/
public interface IEditableContentExtension {
-
+
/**
* Return whether the typed element being displayed
* is read-only. a read-only element will require a
@@ -33,13 +33,13 @@ public interface IEditableContentExtension {
* @return whether the typed element is read-only
*/
boolean isReadOnly();
-
+
/**
* If the element is read-only, this method should be called
* to attempt to make it writable.
* @param shell a shell used to prompt the user if required.
- * @return a status object that is <code>OK</code> if things are fine,
- * otherwise a status describing reasons why modifying the given files is not
+ * @return a status object that is <code>OK</code> if things are fine,
+ * otherwise a status describing reasons why modifying the given files is not
* reasonable. A status with a severity of <code>CANCEL</code> is returned
* if the validation was canceled, indicating the edit should not proceed.
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
index e11acb1b4..33a4b5d3a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IEncodedStreamContentAccessor.java
@@ -15,22 +15,22 @@ import org.eclipse.core.runtime.CoreException;
/**
* Extension for <code>IStreamContentAccessor</code>. Extends the original
* concept of a <code>IStreamContentAccessor</code> to answer the Charset (encoding) used for the stream.
- *
+ *
* @since 3.0
*/
public interface IEncodedStreamContentAccessor extends IStreamContentAccessor {
-
+
/**
- * Returns the name of a charset encoding to be used when decoding this
- * stream accessor's contents into characters. Returns <code>null</code> if a proper
+ * Returns the name of a charset encoding to be used when decoding this
+ * stream accessor's contents into characters. Returns <code>null</code> if a proper
* encoding cannot be determined.
* <p>
* <b>Note</b>: this method does not check whether the result is a supported
- * charset name. Callers should be prepared to handle
- * <code>UnsupportedEncodingException</code> where this charset is used.
+ * charset name. Callers should be prepared to handle
+ * <code>UnsupportedEncodingException</code> where this charset is used.
* </p>
* @return the name of a charset, or <code>null</code>
- * @exception CoreException if an error happens while determining
+ * @exception CoreException if an error happens while determining
* the charset. See any refinements for more information.
* @see IStreamContentAccessor#getContents
* @since 3.0
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
index a1ebef254..34b85a22e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IModificationDate.java
@@ -18,7 +18,7 @@ package org.eclipse.compare;
* </p>
*/
public interface IModificationDate {
-
+
/**
* Returns the modification time of this object.
* <p>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/INavigatable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/INavigatable.java
index 7f5edf650..dfbcc7e31 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/INavigatable.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/INavigatable.java
@@ -21,54 +21,54 @@ import org.eclipse.swt.widgets.Widget;
* @see ICompareNavigator
*/
public interface INavigatable {
-
+
/**
- * Property key that can be used to associate an instance of this interface with
- * an SWT widget using {@link Widget#setData(String, Object)}.
+ * Property key that can be used to associate an instance of this interface with
+ * an SWT widget using {@link Widget#setData(String, Object)}.
*/
static final String NAVIGATOR_PROPERTY= "org.eclipse.compare.internal.Navigator"; //$NON-NLS-1$
-
+
/**
* Change flag used to navigate to the next change.
* @see #selectChange(int)
*/
static final int NEXT_CHANGE= 1;
-
+
/**
* Change flag used to navigate to the previous change.
* @see #selectChange(int)
*/
static final int PREVIOUS_CHANGE= 2;
-
+
/**
* Change flag used to navigate to the first change.
* @see #selectChange(int)
*/
static final int FIRST_CHANGE= 3;
-
+
/**
* Change flag used to navigate to the last change.
* @see #selectChange(int)
*/
static final int LAST_CHANGE= 4;
-
+
/**
* Return the input of the compare pane being navigated or <code>null</code>
- * if the pane does not have an input.
+ * if the pane does not have an input.
* @return the input of the compare pane being navigated or <code>null</code>
*/
Object getInput();
-
+
/**
* Starting from the current selection <code>selectChange</code> selects and reveals the specified change.
* If the end (or beginning) is reached, the method returns <code>true</code>.
- *
+ *
* @param changeFlag the change to be selected. One of <code>NEXT_CHANGE</code>, <code>PREVIOUS_CHANGE</code>,
* <code>FIRST_CHANGE</code> or <code>LAST_CHANGE</code>.
* @return returns <code>true</code> if end (beginning) is reached, <code>false</code> otherwise
*/
boolean selectChange(int changeFlag);
-
+
/**
* Return whether a call to {@link #selectChange(int)} with the same parameter
* would succeed.
@@ -77,7 +77,7 @@ public interface INavigatable {
* would succeed.
*/
boolean hasChange(int changeFlag);
-
+
/**
* Request that the currently selected change be opened. Return <code>true</code>
* if the request resulted in the change being opened and <code>false</code> if the
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
index 60ca94ef6..a609a959f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IPropertyChangeNotifier.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.util.IPropertyChangeListener;
* @see org.eclipse.jface.util.IPropertyChangeListener
*/
public interface IPropertyChangeNotifier {
-
+
/**
* Adds a listener for property changes to this notifier.
* Has no effect if an identical listener is already registered.
@@ -30,7 +30,7 @@ public interface IPropertyChangeNotifier {
* @param listener a property change listener
*/
void addPropertyChangeListener(IPropertyChangeListener listener);
-
+
/**
* Removes the given content change listener from this notifier.
* Has no effect if the identical listener is not registered.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ISharedDocumentAdapter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ISharedDocumentAdapter.java
index 56e8b645f..47e0c88e5 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ISharedDocumentAdapter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ISharedDocumentAdapter.java
@@ -20,7 +20,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
/**
* An <code>ISharedDocumentAdapter</code> is used to map an
* {@link ITypedElement} to a shared document for the purposes of editing.
- *
+ *
* @noimplement Clients are not expected to implement this interface but instead
* should subclass {@link SharedDocumentAdapter} or
* {@link SharedDocumentAdapterWrapper}.
@@ -34,14 +34,14 @@ public interface ISharedDocumentAdapter {
* <code>DocumentProviderRegistry</code> and for obtaining the shared
* {@link IDocument} from the document provider. Returns <code>null</code>
* if the element does not have a shared document.
- *
+ *
* @param element
* the element being queried for a shared document
* @return the object that acts as the key to obtain a document provider and
* document or <code>null</code>
*/
IEditorInput getDocumentKey(Object element);
-
+
/**
* Connect the given element to its document provider. All connections must be performed
* through this adapter so that the adapter can track whether it is connected or not.
@@ -51,17 +51,17 @@ public interface ISharedDocumentAdapter {
* @see IDocumentProvider#connect(Object)
*/
void connect(IDocumentProvider provider, IEditorInput documentKey) throws CoreException;
-
+
/**
* Disconnect the element from the document provider. All connects and
- * disconnects must occur through the adapter so that the adapter can
+ * disconnects must occur through the adapter so that the adapter can
* track whether it is connected or not.
* @param provider the document provider
* @param documentKey the element's key returned from {@link #getDocumentKey(Object)}
* @see IDocumentProvider#disconnect(Object)
*/
void disconnect(IDocumentProvider provider, IEditorInput documentKey);
-
+
/**
* A helper disconnect method that looks up the appropriate key (using {@link #getDocumentKey(Object)}
* and the appropriate provider and calls {@link #disconnect(IDocumentProvider, IEditorInput)}.
@@ -69,14 +69,14 @@ public interface ISharedDocumentAdapter {
* @see IDocumentProvider#disconnect(Object)
*/
void disconnect(Object element);
-
+
/**
* Flush the contents of the given document into the typed element that provided the
* document. This method is invoked by the Compare framework classes
* when a request to flush the viewers has been made. It is up to the implementor to decide
* whether the changes in the buffer should be saved to disk at the time of the flush or
* buffered to be saved at a later time.
- *
+ *
* @param provider the document provider
* @param documentKey the element's key returned from {@link #getDocumentKey(Object)}
* @param document the document
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
index a59dd743f..aaa6eb4c0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
@@ -32,24 +32,24 @@ public interface IStreamMerger {
* Indicates the successful completion of the merge operation (value <code>IStatus.OK</code>)
*/
public static final int OK= IStatus.OK;
-
+
/**
* Indicates that a change conflict prevented the merge from successful completion (value <code>1</code>)
*/
public static final int CONFLICT= 1;
-
+
/**
* Status code describing an internal error (value <code>2</code>)
*/
public static final int INTERNAL_ERROR= 2;
-
+
/**
* Performs a merge operation on the given input streams and writes the merge result to the output stream.
- * On success a status <code>IStatus.OK</code> is returned, on error a status <code>IStatus.ERROR</code>.
+ * On success a status <code>IStatus.OK</code> is returned, on error a status <code>IStatus.ERROR</code>.
* If the merge operation cannot deal with conflicts, the code of the error status has the value <code>IStreamMerger.CONFLICT</code>.
* For text oriented mergers the encoding for the input and output streams is honored.
- * It is the responsibility of callers to close input and output streams.
- *
+ * It is the responsibility of callers to close input and output streams.
+ *
* @param output the byte stream to which the merge result is written; the merger will not close the stream
* @param outputEncoding the encoding to use when writing to the output stream
* @param ancestor the byte stream from which the common ancestor is read
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
index 1f7eeef98..a1e2983ff 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
@@ -31,11 +31,11 @@ import org.eclipse.compare.internal.Utilities;
* @noextend This class is not intended to be subclassed by clients.
*/
public class NavigationAction extends Action {
-
+
private boolean fNext;
private CompareEditorInput fCompareEditorInput;
-
-
+
+
/**
* Creates a <code>NavigationAction</code>.
*
@@ -64,7 +64,7 @@ public class NavigationAction extends Action {
boolean atEnd= ((ICompareNavigator)adapter).selectChange(fNext);
Shell shell= CompareUIPlugin.getShell();
if (atEnd && shell != null) {
-
+
Display display= shell.getDisplay();
if (display != null)
display.beep();
@@ -72,21 +72,21 @@ public class NavigationAction extends Action {
String title;
String message;
if (fNext) {
- title= CompareMessages.CompareNavigator_atEnd_title;
- message= CompareMessages.CompareNavigator_atEnd_message;
+ title= CompareMessages.CompareNavigator_atEnd_title;
+ message= CompareMessages.CompareNavigator_atEnd_message;
} else {
- title= CompareMessages.CompareNavigator_atBeginning_title;
- message= CompareMessages.CompareNavigator_atBeginning_message;
+ title= CompareMessages.CompareNavigator_atBeginning_title;
+ message= CompareMessages.CompareNavigator_atBeginning_message;
}
MessageDialog.openInformation(shell, title, message);
}
}
}
}
-
+
/**
* Sets the <code>CompareEditorInput</code> on which this action operates.
- *
+ *
* @param input the <code>CompareEditorInput</code> on which this action operates; if <code>null</code> action does nothing
*/
public void setCompareEditorInput(CompareEditorInput input) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
index 568ce5d42..f0badb491 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ResourceNode.java
@@ -32,11 +32,11 @@ import org.eclipse.swt.widgets.Shell;
public class ResourceNode extends BufferedContent
implements IEncodedStreamContentAccessor, IStructureComparator, ITypedElement,
IEditableContent, IModificationDate, IResourceProvider, IEditableContentExtension {
-
+
private IResource fResource;
private ArrayList fChildren;
-
-
+
+
/**
* Creates a <code>ResourceNode</code> for the given resource.
*
@@ -46,7 +46,7 @@ public class ResourceNode extends BufferedContent
fResource= resource;
Assert.isNotNull(resource);
}
-
+
/**
* Returns the corresponding resource for this object.
*
@@ -55,7 +55,7 @@ public class ResourceNode extends BufferedContent
public IResource getResource() {
return fResource;
}
-
+
/* (non Javadoc)
* see IStreamContentAccessor.getContents
*/
@@ -64,14 +64,14 @@ public class ResourceNode extends BufferedContent
return super.getContents();
return null;
}
-
+
/* (non Javadoc)
* see IModificationDate.getModificationDate
*/
public long getModificationDate() {
return fResource.getLocalTimeStamp();
}
-
+
/* (non Javadoc)
* see ITypedElement.getName
*/
@@ -80,7 +80,7 @@ public class ResourceNode extends BufferedContent
return fResource.getName();
return null;
}
-
+
/* (non Javadoc)
* see ITypedElement.getType
*/
@@ -94,7 +94,7 @@ public class ResourceNode extends BufferedContent
}
return ITypedElement.UNKNOWN_TYPE;
}
-
+
/* (non Javadoc)
* see ITypedElement.getImage
*/
@@ -113,7 +113,7 @@ public class ResourceNode extends BufferedContent
}
return super.equals(other);
}
-
+
/**
* Returns the hash code of the name.
* @return a hash code value for this object.
@@ -121,7 +121,7 @@ public class ResourceNode extends BufferedContent
public int hashCode() {
return getName().hashCode();
}
-
+
/* (non Javadoc)
* see IStructureComparator.getChildren
*/
@@ -143,7 +143,7 @@ public class ResourceNode extends BufferedContent
}
return fChildren.toArray();
}
-
+
/**
* This hook method is called from <code>getChildren</code> once for every
* member of a container resource. This implementation
@@ -157,7 +157,7 @@ public class ResourceNode extends BufferedContent
protected IStructureComparator createChild(IResource child) {
return new ResourceNode(child);
}
-
+
/**
* Returns an open stream if the corresponding resource implements the
* <code>IStorage</code> interface. Otherwise the value <code>null</code> is returned.
@@ -183,14 +183,14 @@ public class ResourceNode extends BufferedContent
}
return null;
}
-
+
/* (non Javadoc)
* see IEditableContent.isEditable
*/
public boolean isEditable() {
return true;
}
-
+
/* (non Javadoc)
* see IEditableContent.replace
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/SharedDocumentAdapter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/SharedDocumentAdapter.java
index 9dade75ab..4fb836fbd 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/SharedDocumentAdapter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/SharedDocumentAdapter.java
@@ -39,7 +39,7 @@ public abstract class SharedDocumentAdapter implements ISharedDocumentAdapter {
public static IDocumentProvider getDocumentProvider(IEditorInput input) {
return DocumentProviderRegistry.getDefault().getDocumentProvider(input);
}
-
+
@Override
public void connect(IDocumentProvider provider, IEditorInput documentKey)
throws CoreException {
@@ -52,7 +52,7 @@ public abstract class SharedDocumentAdapter implements ISharedDocumentAdapter {
}
/**
- * Default implementation of {@link #getDocumentKey(Object)} that returns a
+ * Default implementation of {@link #getDocumentKey(Object)} that returns a
* {@link FileEditorInput} for the element if the element adapts to {@link IFile}.
* @see org.eclipse.compare.ISharedDocumentAdapter#getDocumentKey(java.lang.Object)
*/
@@ -64,7 +64,7 @@ public abstract class SharedDocumentAdapter implements ISharedDocumentAdapter {
}
return null;
}
-
+
private IFile getFile(Object element) {
if (element instanceof IResourceProvider) {
IResourceProvider rp = (IResourceProvider) element;
@@ -86,7 +86,7 @@ public abstract class SharedDocumentAdapter implements ISharedDocumentAdapter {
/**
* A helper method to save a document.
- *
+ *
* @param provider the document provider
* @param documentKey the document key
* @param document the document
@@ -105,7 +105,7 @@ public abstract class SharedDocumentAdapter implements ISharedDocumentAdapter {
provider.changed(documentKey);
}
}
-
+
@Override
public void disconnect(Object element) {
IEditorInput input = getDocumentKey(element);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
index ca19ffdb6..57988e425 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/Splitter.java
@@ -23,13 +23,13 @@ import org.eclipse.swt.custom.SashForm;
* is the last child to become invisible or the first to become visible.</LI>
* <LI>maximizing a child makes it as large as the topmost enclosing Splitter</LI>
* </UL>
- *
+ *
* @since 2.1
*/
public class Splitter extends SashForm {
-
+
private static final String VISIBILITY= "org.eclipse.compare.internal.visibility"; //$NON-NLS-1$
-
+
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
@@ -56,7 +56,7 @@ public class Splitter extends SashForm {
public Splitter(Composite parent, int style) {
super(parent, style);
}
-
+
/**
* Sets the visibility of the given child in this Splitter. If this change
* affects the visibility state of the whole Splitter, and if the Splitter
@@ -67,12 +67,12 @@ public class Splitter extends SashForm {
* @param visible the new visibility state
*/
public void setVisible(Control child, boolean visible) {
-
+
boolean wasEmpty= isEmpty();
-
+
child.setVisible(visible);
child.setData(VISIBILITY, Boolean.valueOf(visible));
-
+
if (wasEmpty != isEmpty()) {
// recursively walk up
Composite parent= getParent();
@@ -114,7 +114,7 @@ public class Splitter extends SashForm {
return false;
return true;
}
-
+
/* (non-Javadoc)
* Returns the visibility state of the given child control. If the
* control is a Sash, this method always returns false.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
index 763cc62dd..8319535b1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
@@ -147,7 +147,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
public Object[] getChildren() {
return null;
}
-
+
public InputStream getContents() {
if (fContents == null)
fContents= new byte[0];
@@ -175,7 +175,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
}
}
}
-
+
private String fTitle;
/**
@@ -184,7 +184,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
public ZipFileStructureCreator() {
this(Utilities.getString("ZipStructureCreator.name")); //$NON-NLS-1$
}
-
+
/**
* Create a new ZipFileStructureCreator with the given title.
* The title is returned by the method <code>getName()</code>.
@@ -201,7 +201,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
public IStructureComparator getStructure(Object input) {
InputStream is= null;
-
+
if (input instanceof IStreamContentAccessor) {
IStreamContentAccessor sca= (IStreamContentAccessor) input;
try {
@@ -228,16 +228,16 @@ public class ZipFileStructureCreator implements IStructureCreator {
if (length >= 0) {
byte[] buffer= new byte[length];
int offset= 0;
-
+
do {
int n= zip.read(buffer, offset, length);
offset += n;
length -= n;
} while (length > 0);
-
+
ze.setBytes(buffer);
} else {
- byte[] buffer= new byte[1024];
+ byte[] buffer= new byte[1024];
int n;
do {
n= zip.read(buffer, 0, 1024);
@@ -293,29 +293,29 @@ public class ZipFileStructureCreator implements IStructureCreator {
public void save(IStructureComparator structure, Object input) {
Assert.isTrue(false); // Cannot update zip archive
}
-
+
public IStructureComparator locate(Object path, Object source) {
return null;
}
-
+
/**
* Returns <code>false</code> since this <code>IStructureCreator</code>
* cannot rewrite the diff tree in order to fold certain combinations of
* additions and deletions.
* <p>
- * Note: this method is for internal use only. Clients should not call this method.
+ * Note: this method is for internal use only. Clients should not call this method.
* @return <code>false</code>
*/
public boolean canRewriteTree() {
return false;
}
-
+
/**
* Empty implementation since this <code>IStructureCreator</code>
* cannot rewrite the diff tree in order to fold certain combinations of
* additions and deletions.
* <p>
- * Note: this method is for internal use only. Clients should not call this method.
+ * Note: this method is for internal use only. Clients should not call this method.
* @param differencer
* @param root
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
index 1b150e318..b6048edeb 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ContentMergeViewer.java
@@ -107,7 +107,7 @@ import org.eclipse.ui.Saveable;
* <p>
* Clients may wish to use the standard concrete subclass <code>TextMergeViewer</code>,
* or define their own subclass.
- *
+ *
* @see IMergeViewerContentProvider
* @see TextMergeViewer
*/
@@ -115,16 +115,16 @@ public abstract class ContentMergeViewer extends ContentViewer
implements IPropertyChangeNotifier, IFlushable, IFlushable2 {
/* package */ static final int HORIZONTAL= 1;
/* package */ static final int VERTICAL= 2;
-
+
static final double HSPLIT= 0.5;
static final double VSPLIT= 0.3;
-
+
private class ContentMergeViewerLayout extends Layout {
@Override
public Point computeSize(Composite c, int w, int h, boolean force) {
return new Point(100, 100);
}
-
+
@Override
public void layout(Composite composite, boolean force) {
if (fLeftLabel == null) {
@@ -154,11 +154,11 @@ public abstract class ContentMergeViewer extends ContentViewer
// determine some derived sizes
int headerHeight= fLeftLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y;
Rectangle r= composite.getClientArea();
-
+
int centerWidth= getCenterWidth();
int width1= (int)((r.width-centerWidth)*getHorizontalSplitRatio());
int width2= r.width-width1-centerWidth;
-
+
int height1= 0;
int height2= 0;
if (fIsThreeWay && fAncestorVisible) {
@@ -168,9 +168,9 @@ public abstract class ContentMergeViewer extends ContentViewer
height1= 0;
height2= r.height-headerHeight;
}
-
+
int y= 0;
-
+
if (fIsThreeWay && fAncestorVisible) {
fAncestorLabel.setBounds(0, y, r.width, headerHeight);
fAncestorLabel.setVisible(true);
@@ -181,9 +181,9 @@ public abstract class ContentMergeViewer extends ContentViewer
fAncestorLabel.setVisible(false);
handleResizeAncestor(0, 0, 0, 0);
}
-
+
fLeftLabel.getSize(); // without this resizing would not always work
-
+
if (centerWidth > 3) {
fLeftLabel.setBounds(0, y, width1+1, headerHeight);
fDirectionLabel.setVisible(true);
@@ -194,12 +194,12 @@ public abstract class ContentMergeViewer extends ContentViewer
fDirectionLabel.setVisible(false);
fRightLabel.setBounds(width1, y, r.width-width1, headerHeight);
}
-
+
y+= headerHeight;
-
+
if (fCenter != null && !fCenter.isDisposed())
fCenter.setBounds(width1, y, centerWidth, height2);
-
+
handleResizeLeftRight(0, y, width1, centerWidth, width2, height2);
}
@@ -220,7 +220,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
class Resizer extends MouseAdapter implements MouseMoveListener {
-
+
Control fControl;
int fX, fY;
int fWidth1, fWidth2;
@@ -228,7 +228,7 @@ public abstract class ContentMergeViewer extends ContentViewer
int fDirection;
boolean fLiveResize;
boolean fIsDown;
-
+
public Resizer(Control c, int dir) {
fDirection= dir;
fControl= c;
@@ -245,7 +245,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
);
}
-
+
@Override
public void mouseDoubleClick(MouseEvent e) {
if ((fDirection & HORIZONTAL) != 0)
@@ -254,43 +254,43 @@ public abstract class ContentMergeViewer extends ContentViewer
fVSplit= VSPLIT;
fComposite.layout(true);
}
-
+
@Override
public void mouseDown(MouseEvent e) {
Composite parent= fControl.getParent();
-
+
Point s= parent.getSize();
Point as= fAncestorLabel.getSize();
Point ys= fLeftLabel.getSize();
Point ms= fRightLabel.getSize();
-
+
fWidth1= ys.x;
fWidth2= ms.x;
fHeight1= fLeftLabel.getLocation().y-as.y;
fHeight2= s.y-(fLeftLabel.getLocation().y+ys.y);
-
+
fX= e.x;
fY= e.y;
fIsDown= true;
}
-
+
@Override
public void mouseUp(MouseEvent e) {
fIsDown= false;
if (!fLiveResize)
resize(e);
}
-
+
@Override
public void mouseMove(MouseEvent e) {
if (fIsDown && fLiveResize)
resize(e);
}
-
+
private void resize(MouseEvent e) {
int dx= e.x-fX;
int dy= e.y-fY;
-
+
int centerWidth= fCenter.getSize().x;
if (fWidth1 + dx > centerWidth && fWidth2 - dx > centerWidth) {
@@ -319,14 +319,14 @@ public abstract class ContentMergeViewer extends ContentViewer
private ICompareInputChangeListener fCompareInputChangeListener;
private ListenerList<IPropertyChangeListener> fListenerList;
boolean fConfirmSave= true;
-
+
private double fHSplit= -1; // width ratio of left and right panes
private double fVSplit= VSPLIT; // height ratio of ancestor and bottom panes
-
+
private boolean fIsThreeWay; // whether their is an ancestor
private boolean fAncestorVisible; // whether the ancestor pane is visible
private ActionContributionItem fAncestorItem;
-
+
private ActionContributionItem copyLeftToRightItem; // copy from left to right
private ActionContributionItem copyRightToLeftItem; // copy from right to left
@@ -343,11 +343,11 @@ public abstract class ContentMergeViewer extends ContentViewer
private CLabel fAncestorLabel;
private CLabel fLeftLabel;
- private boolean fLeftLabelSet= false; // needed for debug output for bug 449558
+ private boolean fLeftLabelSet= false; // needed for debug output for bug 449558
private CLabel fRightLabel;
/* package */ CLabel fDirectionLabel;
/* package */ Control fCenter;
-
+
//---- SWT resources to be disposed
private Image fRightArrow;
private Image fLeftArrow;
@@ -370,17 +370,17 @@ public abstract class ContentMergeViewer extends ContentViewer
};
//---- end
-
+
/**
* Creates a new content merge viewer and initializes with a resource bundle and a
* configuration.
- *
+ *
* @param style SWT style bits
* @param bundle the resource bundle
* @param cc the configuration object
*/
protected ContentMergeViewer(int style, ResourceBundle bundle, CompareConfiguration cc) {
-
+
if (Policy.debugContentMergeViewer) {
logTrace("constructed (fLeftLabel == null)"); //$NON-NLS-1$
logStackTrace();
@@ -388,12 +388,12 @@ public abstract class ContentMergeViewer extends ContentViewer
fStyles= style & ~(SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); // remove BIDI direction bits
fBundle= bundle;
-
+
fAncestorVisible= Utilities.getBoolean(cc, ICompareUIConstants.PROP_ANCESTOR_VISIBLE, fAncestorVisible);
fConfirmSave= Utilities.getBoolean(cc, CompareEditor.CONFIRM_SAVE_PROPERTY, fConfirmSave);
-
+
fCompareInputChangeListener = (input) -> { if (input == getInput()) handleCompareInputChange(); };
-
+
// Make sure the compare configuration is not null
fCompareConfiguration = cc != null ? cc : new CompareConfiguration();
fPropertyChangeListener = (event) -> handlePropertyChangeEvent(event);
@@ -401,7 +401,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fDefaultContentProvider = new MergeViewerContentProvider(fCompareConfiguration);
updateContentProvider();
-
+
fIsLeftDirty = false;
fIsRightDirty = false;
}
@@ -413,7 +413,7 @@ public abstract class ContentMergeViewer extends ContentViewer
private void logTrace(String string) {
System.out.println("ContentMergeViewer " + System.identityHashCode(this) + ": " + string); //$NON-NLS-1$//$NON-NLS-2$
}
-
+
//---- hooks ---------------------
@@ -425,7 +425,7 @@ public abstract class ContentMergeViewer extends ContentViewer
public String getTitle() {
return Utilities.getString(getResourceBundle(), "title"); //$NON-NLS-1$
}
-
+
/**
* Creates the SWT controls for the ancestor, left, and right
* content areas of this compare viewer.
@@ -448,7 +448,7 @@ public abstract class ContentMergeViewer extends ContentViewer
* @param height the height of the ancestor area
*/
abstract protected void handleResizeAncestor(int x, int y, int width, int height);
-
+
/**
* Lays out the left and right areas of the compare viewer.
* It is called whenever the viewer is resized or when the sashes between
@@ -485,11 +485,11 @@ public abstract class ContentMergeViewer extends ContentViewer
* @param right the input for the right area
*/
abstract protected void updateContent(Object ancestor, Object left, Object right);
-
+
/**
* Copies the content of one side to the other side.
* Called from the (internal) actions for copying the sides of the viewer's input object.
- *
+ *
* @param leftToRight if <code>true</code>, the left side is copied to the right side;
* if <code>false</code>, the right side is copied to the left side
*/
@@ -506,7 +506,7 @@ public abstract class ContentMergeViewer extends ContentViewer
abstract protected byte[] getContents(boolean left);
//----------------------------
-
+
/**
* Returns the resource bundle of this viewer.
*
@@ -515,7 +515,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected ResourceBundle getResourceBundle() {
return fBundle;
}
-
+
/**
* Returns the compare configuration of this viewer.
*
@@ -524,7 +524,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected CompareConfiguration getCompareConfiguration() {
return fCompareConfiguration;
}
-
+
/**
* The <code>ContentMergeViewer</code> implementation of this
* <code>ContentViewer</code> method
@@ -561,7 +561,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
};
}
-
+
/**
* The <code>ContentMergeViewer</code> implementation of this
* <code>Viewer</code> method does nothing. Subclasses may reimplement.
@@ -584,14 +584,14 @@ public abstract class ContentMergeViewer extends ContentViewer
if (key.equals(ICompareUIConstants.PROP_ANCESTOR_VISIBLE)) {
fAncestorVisible= Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_ANCESTOR_VISIBLE, fAncestorVisible);
fComposite.layout(true);
-
+
updateCursor(fLeftLabel, VERTICAL);
updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL);
updateCursor(fRightLabel, VERTICAL);
-
+
return;
}
-
+
if (key.equals(ICompareUIConstants.PROP_IGNORE_ANCESTOR)) {
setAncestorVisibility(false, !Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false));
return;
@@ -604,7 +604,7 @@ public abstract class ContentMergeViewer extends ContentViewer
return;
}
}
-
+
void updateCursor(Control c, int dir) {
if (!(c instanceof Sash)) {
Cursor cursor= null;
@@ -649,7 +649,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
//---- input
-
+
/**
* Return whether the input is a three-way comparison.
* @return whether the input is a three-way comparison
@@ -658,7 +658,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected boolean isThreeWay() {
return fIsThreeWay;
}
-
+
/**
* Internal hook method called when the input to this viewer is
* initially set or subsequently changed.
@@ -677,25 +677,25 @@ public abstract class ContentMergeViewer extends ContentViewer
if (lp != null)
lp.removeListener(labelChangeListener);
}
-
+
if (input != oldInput && oldInput instanceof ICompareInput) {
ICompareContainer container = getCompareConfiguration().getContainer();
container.removeCompareInputChangeListener((ICompareInput)oldInput, fCompareInputChangeListener);
}
-
+
boolean success= doSave(input, oldInput);
-
+
if (input != oldInput && input instanceof ICompareInput) {
ICompareContainer container = getCompareConfiguration().getContainer();
container.addCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener);
}
-
+
if (input != oldInput && input != null) {
ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider();
if (lp != null)
lp.addListener(labelChangeListener);
}
-
+
if (success) {
setLeftDirty(false);
setRightDirty(false);
@@ -704,7 +704,7 @@ public abstract class ContentMergeViewer extends ContentViewer
if (input != oldInput)
internalRefresh(input);
}
-
+
/**
* This method is called from the <code>Viewer</code> method <code>inputChanged</code>
* to save any unsaved changes of the old input.
@@ -721,11 +721,11 @@ public abstract class ContentMergeViewer extends ContentViewer
* @since 2.0
*/
protected boolean doSave(Object newInput, Object oldInput) {
-
+
// before setting the new input we have to save the old
if (isLeftDirty() || isRightDirty()) {
-
-
+
+
if (Utilities.RUNNING_TESTS) {
if (Utilities.TESTING_FLUSH_ON_COMPARE_INPUT_CHANGE) {
flushContent(oldInput, null);
@@ -733,7 +733,7 @@ public abstract class ContentMergeViewer extends ContentViewer
} else if (fConfirmSave) {
// post alert
Shell shell= fComposite.getShell();
-
+
MessageDialog dialog= new MessageDialog(shell,
Utilities.getString(getResourceBundle(), "saveDialog.title"), //$NON-NLS-1$
null, // accept the default window icon
@@ -744,7 +744,7 @@ public abstract class ContentMergeViewer extends ContentViewer
IDialogConstants.NO_LABEL,
},
0); // default button index
-
+
switch (dialog.open()) { // open returns index of pressed button
case 0:
flushContent(oldInput, null);
@@ -762,7 +762,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
return false;
}
-
+
/**
* Controls whether <code>doSave(Object, Object)</code> asks for confirmation before saving
* the old input with <code>saveContent(Object)</code>.
@@ -777,7 +777,7 @@ public abstract class ContentMergeViewer extends ContentViewer
public void refresh() {
internalRefresh(getInput());
}
-
+
private void internalRefresh(Object input) {
IMergeViewerContentProvider content= getMergeContentProvider();
if (content != null) {
@@ -789,18 +789,18 @@ public abstract class ContentMergeViewer extends ContentViewer
fIsThreeWay= (((ICompareInput)input).getKind() & Differencer.DIRECTION_MASK) != 0;
else
fIsThreeWay= ancestor != null;
-
+
if (fAncestorItem != null)
fAncestorItem.setVisible(fIsThreeWay);
-
+
if (fAncestorVisible && oldFlag != fIsThreeWay)
fComposite.layout(true);
-
-
+
+
Object left= content.getLeftContent(input);
Object right= content.getRightContent(input);
updateContent(ancestor, left, right);
-
+
updateHeader();
if (Utilities.okToUse(fComposite) && Utilities.okToUse(fComposite.getParent())) {
ToolBarManager tbm = (ToolBarManager) getToolBarManager(fComposite.getParent());
@@ -812,7 +812,7 @@ public abstract class ContentMergeViewer extends ContentViewer
}
}
}
-
+
@Override
protected void hookControl(Control control) {
if (Policy.debugContentMergeViewer) {
@@ -820,9 +820,9 @@ public abstract class ContentMergeViewer extends ContentViewer
}
super.hookControl(control);
}
-
+
//---- layout & SWT control creation
-
+
/**
* Builds the SWT controls for the three areas of a compare/merge viewer.
* <p>
@@ -845,14 +845,14 @@ public abstract class ContentMergeViewer extends ContentViewer
fComposite.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
hookControl(fComposite); // hook help & dispose listener
-
+
fComposite.setLayout(new ContentMergeViewerLayout());
if (Policy.debugContentMergeViewer) {
logTrace("Created composite " + System.identityHashCode(fComposite) + " with layout " //$NON-NLS-1$//$NON-NLS-2$
+ System.identityHashCode(fComposite.getLayout()));
logStackTrace();
}
-
+
int style= SWT.SHADOW_OUT;
fAncestorLabel= new CLabel(fComposite, style | Window.getDefaultOrientation());
@@ -861,36 +861,36 @@ public abstract class ContentMergeViewer extends ContentViewer
logTrace("fLeftLabel initialized"); //$NON-NLS-1$
logStackTrace();
}
-
+
fLeftLabelSet= true;
new Resizer(fLeftLabel, VERTICAL);
-
+
fDirectionLabel= new CLabel(fComposite, style);
fDirectionLabel.setAlignment(SWT.CENTER);
new Resizer(fDirectionLabel, HORIZONTAL | VERTICAL);
-
+
fRightLabel= new CLabel(fComposite, style | Window.getDefaultOrientation());
new Resizer(fRightLabel, VERTICAL);
-
+
if (fCenter == null || fCenter.isDisposed())
fCenter= createCenterControl(fComposite);
-
+
createControls(fComposite);
-
+
fHandlerService= CompareHandlerService.createFor(getCompareConfiguration().getContainer(), fComposite.getShell());
-
+
initializeToolbars(parent);
-
+
return fComposite;
}
/**
* Returns the toolbar manager for this viewer.
- *
+ *
* Subclasses may extend this method and use either the toolbar manager
* provided by the inherited method by calling
* super.getToolBarManager(parent) or provide an alternate toolbar manager.
- *
+ *
* @param parent
* a <code>Composite</code> or <code>null</code>
* @return a <code>IToolBarManager</code>
@@ -899,12 +899,12 @@ public abstract class ContentMergeViewer extends ContentViewer
protected IToolBarManager getToolBarManager(Composite parent) {
return CompareViewerPane.getToolBarManager(parent);
}
-
+
private void initializeToolbars(Composite parent) {
ToolBarManager tbm = (ToolBarManager) getToolBarManager(parent);
if (tbm != null) {
tbm.removeAll();
-
+
// define groups
tbm.add(new Separator("modes")); //$NON-NLS-1$
tbm.add(new Separator("merge")); //$NON-NLS-1$
@@ -936,7 +936,7 @@ public abstract class ContentMergeViewer extends ContentViewer
};
Utilities.initAction(fSwitchLeftAndRight, getResourceBundle(), "action.SwitchLeftAndRight."); //$NON-NLS-1$
tbm.appendToGroup("modes", fSwitchLeftAndRight); //$NON-NLS-1$
-
+
final ChangePropertyAction a= new ChangePropertyAction(fBundle, getCompareConfiguration(), "action.EnableAncestor.", ICompareUIConstants.PROP_ANCESTOR_VISIBLE); //$NON-NLS-1$
a.setChecked(fAncestorVisible);
fAncestorItem= new ActionContributionItem(a);
@@ -946,7 +946,7 @@ public abstract class ContentMergeViewer extends ContentViewer
createToolItems(tbm);
updateToolItems();
-
+
tbm.update(true);
}
}
@@ -970,7 +970,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected boolean handleSetFocus() {
return false;
}
-
+
/**
* Return the desired width of the center control. This width is used
* to calculate the values used to layout the ancestor, left and right sides.
@@ -982,7 +982,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected int getCenterWidth() {
return 3;
}
-
+
/**
* Return whether the ancestor pane is visible or not.
* @return whether the ancestor pane is visible or not
@@ -991,7 +991,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected boolean isAncestorVisible() {
return fAncestorVisible;
}
-
+
/**
* Create the control that divides the left and right sides of the merge viewer.
* @param parent the parent composite
@@ -1003,7 +1003,7 @@ public abstract class ContentMergeViewer extends ContentViewer
new Resizer(sash, HORIZONTAL);
return sash;
}
-
+
/**
* Return the center control that divides the left and right sides of the merge viewer.
* This method returns the control that was created by calling {@link #createCenterControl(Composite)}.
@@ -1019,7 +1019,7 @@ public abstract class ContentMergeViewer extends ContentViewer
public Control getControl() {
return fComposite;
}
-
+
/**
* Called on the viewer disposal.
* Unregisters from the compare configuration.
@@ -1030,7 +1030,7 @@ public abstract class ContentMergeViewer extends ContentViewer
protected void handleDispose(DisposeEvent event) {
if (fHandlerService != null)
fHandlerService.dispose();
-
+
Object input= getInput();
if (input instanceof ICompareInput) {
ICompareContainer container = getCompareConfiguration().getContainer();
@@ -1041,7 +1041,7 @@ public abstract class ContentMergeViewer extends ContentViewer
if (lp != null)
lp.removeListener(labelChangeListener);
}
-
+
if (fPropertyChangeListener != null) {
fCompareConfiguration.removePropertyChangeListener(fPropertyChangeListener);
fPropertyChangeListener= null;
@@ -1056,7 +1056,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fDirectionLabel= null;
fRightLabel= null;
fCenter= null;
-
+
if (fRightArrow != null) {
fRightArrow.dispose();
fRightArrow= null;
@@ -1086,10 +1086,10 @@ public abstract class ContentMergeViewer extends ContentViewer
fHVSashCursor.dispose();
fHVSashCursor= null;
}
-
+
super.handleDispose(event);
}
-
+
/**
* Updates the enabled state of the toolbar items.
* <p>
@@ -1098,17 +1098,17 @@ public abstract class ContentMergeViewer extends ContentViewer
* Subclasses may extend this method, although this is generally not required.
*/
protected void updateToolItems() {
-
+
IMergeViewerContentProvider content= getMergeContentProvider();
-
+
Object input= getInput();
-
+
if (copyLeftToRightItem != null) {
boolean rightEditable = content.isRightEditable(input);
copyLeftToRightItem.setVisible(rightEditable);
copyLeftToRightItem.getAction().setEnabled(rightEditable);
}
-
+
if (copyRightToLeftItem != null) {
boolean leftEditable = content.isLeftEditable(input);
copyRightToLeftItem.setVisible(leftEditable);
@@ -1119,7 +1119,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fSwitchLeftAndRight.setChecked(getCompareConfiguration().isMirrored());
}
}
-
+
/**
* Updates the headers of the three areas
* by querying the content provider for a name and image for
@@ -1130,7 +1130,7 @@ public abstract class ContentMergeViewer extends ContentViewer
* Subclasses may extend this method, although this is generally not required.
*/
protected void updateHeader() {
-
+
IMergeViewerContentProvider content= getMergeContentProvider();
Object input= getInput();
@@ -1160,7 +1160,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fRightLabel.setText(LegacyActionTools.escapeMnemonics(rightLabel));
}
}
-
+
/*
* Calculates the height of the header.
*/
@@ -1169,16 +1169,16 @@ public abstract class ContentMergeViewer extends ContentViewer
headerHeight= Math.max(headerHeight, fDirectionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y);
return headerHeight;
}
-
+
//---- dirty state & saving state
-
+
@Override
public void addPropertyChangeListener(IPropertyChangeListener listener) {
if (fListenerList == null)
fListenerList= new ListenerList<>();
fListenerList.add(listener);
}
-
+
@Override
public void removePropertyChangeListener(IPropertyChangeListener listener) {
if (fListenerList != null) {
@@ -1187,11 +1187,11 @@ public abstract class ContentMergeViewer extends ContentViewer
fListenerList= null;
}
}
-
+
private void fireDirtyState(boolean state) {
Utilities.firePropertyChange(fListenerList, this, CompareEditorInput.DIRTY_STATE, null, Boolean.valueOf(state));
}
-
+
/**
* Sets the dirty state of the left side of this viewer.
* If the new value differs from the old
@@ -1208,7 +1208,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fireDirtyState(dirty);
}
}
-
+
/**
* Sets the dirty state of the right side of this viewer.
* If the new value differs from the old
@@ -1225,7 +1225,7 @@ public abstract class ContentMergeViewer extends ContentViewer
fireDirtyState(dirty);
}
}
-
+
/**
* Method from the old internal <code>ISavable</code> interface
* Save the viewers's content.
@@ -1238,7 +1238,7 @@ public abstract class ContentMergeViewer extends ContentViewer
public void save(IProgressMonitor monitor) throws CoreException {
flush(monitor);
}
-
+
/**
* Flush any modifications made in the viewer into the compare input. This method
* calls {@link #flushContent(Object, IProgressMonitor)} with the compare input
@@ -1360,7 +1360,7 @@ public abstract class ContentMergeViewer extends ContentViewer
// before setting the new input we have to save the old
Object input = getInput();
if (!isSaving() && (isLeftDirty() || isRightDirty())) {
-
+
if (Utilities.RUNNING_TESTS) {
if (Utilities.TESTING_FLUSH_ON_COMPARE_INPUT_CHANGE) {
flushContent(input, null);
@@ -1368,7 +1368,7 @@ public abstract class ContentMergeViewer extends ContentViewer
} else {
// post alert
Shell shell= fComposite.getShell();
-
+
MessageDialog dialog= new MessageDialog(shell,
CompareMessages.ContentMergeViewer_resource_changed_title,
null, // accept the default window icon
@@ -1379,7 +1379,7 @@ public abstract class ContentMergeViewer extends ContentViewer
IDialogConstants.NO_LABEL, // 1
},
0); // default button index
-
+
switch (dialog.open()) { // open returns index of pressed button
case 0:
flushContent(input, null);
@@ -1426,11 +1426,11 @@ public abstract class ContentMergeViewer extends ContentViewer
}
}
return false;
- }
+ }
/**
* If the inputs are mirrored, this asks the right model value.
- *
+ *
* @return true if the left viewer is editable.
* @since 3.7
*/
@@ -1440,7 +1440,7 @@ public abstract class ContentMergeViewer extends ContentViewer
/**
* If the inputs are mirrored, this asks the left model value.
- *
+ *
* @return true if the right viewer is editable.
* @since 3.7
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
index a58518f35..f659bdbbf 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IDocumentRange.java
@@ -29,7 +29,7 @@ import org.eclipse.jface.text.IDocument;
* @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode
*/
public interface IDocumentRange {
-
+
/**
* The position category typically used for an <code>IDocumentRange</code> position
* (value <code>"DocumentRangeCategory"</code>).
@@ -39,15 +39,15 @@ public interface IDocumentRange {
/**
* Returns the underlying document.
- *
+ *
* @return the underlying document
*/
IDocument getDocument();
-
+
/**
* Returns a position that specifies a subrange in the underlying document,
* or <code>null</code> if this document range spans the whole underlying document.
- *
+ *
* @return a position that specifies a subrange in the underlying document, or <code>null</code>
*/
Position getRange();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IFlushable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IFlushable.java
index 3b65924eb..3516471df 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IFlushable.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IFlushable.java
@@ -21,15 +21,15 @@ import org.eclipse.jface.text.IDocument;
* <p>
* This interface may be implemented by clients.
* </p>
- *
+ *
* @since 3.3
*/
public interface IFlushable {
-
+
/**
* Request that the view contents be flushed to the underlying compare input.
* Depending on the type of input, this may result in the contents being written
- * into the underlying model (e.g. file) as well.
+ * into the underlying model (e.g. file) as well.
* @param monitor a progress monitor or <code>null</code> if progress reporting is not desired
*/
void flush(IProgressMonitor monitor);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
index 3953afc36..6461ac9de 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/IMergeViewerContentProvider.java
@@ -14,17 +14,17 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.viewers.IContentProvider;
-/**
+/**
* A content provider that mediates between a <code>ContentMergeViewer</code>'s model
* and the viewer itself.
* <p>
* Clients may implement this interface.
* </p>
- *
+ *
* @see ContentMergeViewer
*/
public interface IMergeViewerContentProvider extends IContentProvider {
-
+
//---- ancestor side
/**
@@ -60,7 +60,7 @@ public interface IMergeViewerContentProvider extends IContentProvider {
* @return <code>true</code> if the ancestor side of the given input element should be shown
*/
boolean showAncestor(Object input);
-
+
//---- left side
/**
@@ -94,7 +94,7 @@ public interface IMergeViewerContentProvider extends IContentProvider {
* Returns whether the left side is editable.
*
* @param input the input object of the <code>ContentMergeViewer</code>
- * @return <code>true</code> if the left side of a <code>ContentMergeViewer</code> is editable
+ * @return <code>true</code> if the left side of a <code>ContentMergeViewer</code> is editable
*/
boolean isLeftEditable(Object input);
@@ -139,7 +139,7 @@ public interface IMergeViewerContentProvider extends IContentProvider {
* Returns whether the right side is editable.
*
* @param input the input object of the <code>ContentMergeViewer</code>
- * @return <code>true</code> if the right side of a <code>ContentMergeViewer</code> is editable
+ * @return <code>true</code> if the right side of a <code>ContentMergeViewer</code> is editable
*/
boolean isRightEditable(Object input);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
index 97c0d726c..1f3fb2185 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/ITokenComparator.java
@@ -20,7 +20,7 @@ import org.eclipse.compare.rangedifferencer.IRangeComparator;
* <p>
* <code>TextMergeViewer</code> activates the token compare when navigating into
* a range of differing lines. At first the lines are selected as a block.
- * When navigating into this block the token compare shows for every line
+ * When navigating into this block the token compare shows for every line
* the differing token by selecting them.
* <p>
* <code>TextMergeViewer</code>'s default token comparator works on characters separated
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
index 9b4db1530..fb265eb7d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java
@@ -251,7 +251,7 @@ import com.ibm.icu.text.MessageFormat;
* In 3.5 a new API has been introduced to let clients provide their own source
* viewers implementation with an option to configure them basing on a
* corresponding editor input.
- *
+ *
* @see org.eclipse.compare.rangedifferencer.RangeDifferencer
* @see org.eclipse.jface.text.TextViewer
* @see ITokenComparator
@@ -264,13 +264,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private static final char ANCESTOR_CONTRIBUTOR = MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR;
private static final char RIGHT_CONTRIBUTOR = MergeViewerContentProvider.RIGHT_CONTRIBUTOR;
private static final char LEFT_CONTRIBUTOR = MergeViewerContentProvider.LEFT_CONTRIBUTOR;
-
+
private static final String DIFF_RANGE_CATEGORY = CompareUIPlugin.PLUGIN_ID + ".DIFF_RANGE_CATEGORY"; //$NON-NLS-1$
static final boolean DEBUG= false;
-
+
private static final boolean FIX_47640= true;
-
+
private static final String[] GLOBAL_ACTIONS= {
ActionFactory.UNDO.getId(),
ActionFactory.REDO.getId(),
@@ -293,15 +293,15 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
MergeSourceViewer.FIND_ID,
MergeSourceViewer.GOTO_LINE_ID
};
-
+
private static final String BUNDLE_NAME= "org.eclipse.compare.contentmergeviewer.TextMergeViewerResources"; //$NON-NLS-1$
-
+
// the following symbolic constants must match the IDs in Compare's plugin.xml
private static final String INCOMING_COLOR= "INCOMING_COLOR"; //$NON-NLS-1$
private static final String OUTGOING_COLOR= "OUTGOING_COLOR"; //$NON-NLS-1$
private static final String CONFLICTING_COLOR= "CONFLICTING_COLOR"; //$NON-NLS-1$
private static final String RESOLVED_COLOR= "RESOLVED_COLOR"; //$NON-NLS-1$
-
+
// constants
/** Width of left and right vertical bar */
private static final int MARGIN_WIDTH= 6;
@@ -316,62 +316,62 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
/** line width of change borders */
private static final int LW= 1;
-
+
private boolean fShowCurrentOnly= false;
private boolean fShowCurrentOnly2= false;
private int fMarginWidth= MARGIN_WIDTH;
private int fTopInset;
-
+
// Colors
private RGB fBackground;
private RGB fForeground;
private boolean fIsUsingSystemForeground= true;
private boolean fIsUsingSystemBackground= true;
-
+
private RGB SELECTED_INCOMING;
private RGB INCOMING;
private RGB INCOMING_FILL;
private RGB INCOMING_TEXT_FILL;
-
+
private RGB SELECTED_CONFLICT;
private RGB CONFLICT;
private RGB CONFLICT_FILL;
private RGB CONFLICT_TEXT_FILL;
-
+
private RGB SELECTED_OUTGOING;
private RGB OUTGOING;
private RGB OUTGOING_FILL;
private RGB OUTGOING_TEXT_FILL;
-
+
private RGB RESOLVED;
-
+
private IPreferenceStore fPreferenceStore;
private IPropertyChangeListener fPreferenceChangeListener;
-
+
private HashMap<Object, Position> fNewAncestorRanges= new HashMap<>();
private HashMap<Object, Position> fNewLeftRanges= new HashMap<>();
private HashMap<Object, Position> fNewRightRanges= new HashMap<>();
-
+
private MergeSourceViewer fAncestor;
private MergeSourceViewer fLeft;
private MergeSourceViewer fRight;
-
+
private int fLeftLineCount;
private int fRightLineCount;
-
+
private boolean fInScrolling;
-
+
private int fPts[]= new int[8]; // scratch area for polygon drawing
-
+
private int fInheritedDirection; // inherited direction
private int fTextDirection; // requested direction for embedded SourceViewer
-
+
private ActionContributionItem fIgnoreAncestorItem;
private boolean fHighlightRanges;
-
+
private boolean fShowPseudoConflicts= false;
-
+
private boolean fUseSplines= true;
private boolean fUseSingleLine= true;
private boolean fHighlightTokenChanges = false;
@@ -382,21 +382,21 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private ActionContributionItem fPreviousDiff; // goto previous difference
private ActionContributionItem fCopyDiffLeftToRightItem;
private ActionContributionItem fCopyDiffRightToLeftItem;
-
+
private CompareHandlerService fHandlerService;
-
+
private boolean fSynchronizedScrolling= true;
-
+
private MergeSourceViewer fFocusPart;
-
+
private boolean fSubDoc= true;
private IPositionUpdater fPositionUpdater;
private boolean fIsMotif;
private boolean fIsCarbon;
private boolean fIsMac;
-
+
private boolean fHasErrors;
-
+
// SWT widgets
private BufferedCanvas fAncestorCanvas;
@@ -407,14 +407,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private Canvas fBirdsEyeCanvas;
private Canvas fSummaryHeader;
private HeaderPainter fHeaderPainter;
-
+
// SWT resources to be disposed
private Map<RGB, Color> fColors;
private Cursor fBirdsEyeCursor;
-
+
// points for center curves
private double[] fBasicCenterCurve;
-
+
private Button fLeftToRightButton;
private Button fRightToLeftButton;
private Diff fButtonDiff;
@@ -450,7 +450,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* Preference key for highlight color of current line.
*/
private final static String CURRENT_LINE_COLOR= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
-
+
private List<SourceViewerDecorationSupport> fSourceViewerDecorationSupport = new ArrayList<>(3);
// whether enhanced viewer configuration has been done
private boolean isConfigured = false;
@@ -473,10 +473,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
});
v.addSelectionChangedListener(this);
}
-
+
return v;
}
-
+
@Override
public boolean hasViewerFor(Object input) {
return true;
@@ -506,7 +506,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
private Diff findDiff(Position p, boolean left) {
for (Iterator<?> iterator = fMerger.rangesIterator(); iterator.hasNext();) {
Diff diff = (Diff) iterator.next();
@@ -551,7 +551,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private int fTopIndex = -1;
private boolean fNeedsValidation = false;
private MergeSourceViewer fSourceViewer;
-
+
public ContributorInfo(TextMergeViewer viewer, Object element, char leg) {
fViewer = viewer;
fElement = element;
@@ -630,7 +630,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fEncoding == null)
fEncoding = otherContributor.fEncoding;
}
-
+
public IDocument getDocument() {
if (fDocumentProvider != null) {
IDocument document = fDocumentProvider.getDocument(getDocumentKey());
@@ -645,7 +645,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return DocumentManager.get(fElement);
return null;
}
-
+
public void setDocument(MergeSourceViewer viewer, boolean isEditable) {
// Ensure that this method is only called once
Assert.isTrue(fSourceViewer == null);
@@ -664,15 +664,15 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
viewer.getSourceViewer().getTextWidget().addVerifyListener(this);
}
}
-
+
/*
* Returns true if a new Document could be installed.
*/
private boolean internalSetDocument(MergeSourceViewer tp) {
-
+
if (tp == null)
return false;
-
+
IDocument newDocument = null;
Position range= null;
@@ -684,7 +684,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
} else if (fElement instanceof IDocument) {
newDocument= (IDocument) fElement;
setupDocument(newDocument);
-
+
} else if (fElement instanceof IStreamContentAccessor) {
newDocument= DocumentManager.get(fElement);
if (newDocument == null) {
@@ -696,9 +696,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
connectToSharedDocument();
}
} else if (fElement == null) { // deletion on one side
-
+
ITypedElement parent= this.fViewer.getParent(fLeg); // we try to find an insertion position within the deletion's parent
-
+
if (parent instanceof IDocumentRange) {
newDocument= ((IDocumentRange)parent).getDocument();
newDocument.addPositionCategory(DIFF_RANGE_CATEGORY);
@@ -730,7 +730,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
newDocument= new Document(""); //$NON-NLS-1$
enabled= false;
}
-
+
// Update the viewer document or range
IDocument oldDoc= tp.getSourceViewer().getDocument();
if (newDocument != oldDoc) {
@@ -739,7 +739,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
updateViewerDocumentRange(tp, range);
}
newDocument.addDocumentListener(this);
-
+
tp.setEnabled(enabled);
return enabled;
@@ -767,7 +767,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
unsetDocument(tp);
if (document == null)
return;
-
+
connectPositionUpdater(document);
// install new document
@@ -796,7 +796,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
document.removePositionUpdater(this.fViewer.fPositionUpdater);
document.addPositionUpdater(this.fViewer.fPositionUpdater);
}
-
+
private void unsetDocument(MergeSourceViewer tp) {
IDocument oldDoc= internalGetDocument(tp);
if (oldDoc != null) {
@@ -811,12 +811,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
oldDoc.removeDocumentListener(this);
}
}
-
+
private IDocument createDocument() {
// If the content provider is a text content provider, attempt to obtain
// a shared document (i.e. file buffer)
IDocument newDoc = connectToSharedDocument();
-
+
if (newDoc == null) {
IStreamContentAccessor sca= (IStreamContentAccessor) fElement;
String s= null;
@@ -863,7 +863,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
private void connect(IDocumentProvider documentProvider, IEditorInput input) throws CoreException {
final ISharedDocumentAdapter sda = Adapters.adapt(fElement, ISharedDocumentAdapter.class);
if (sda != null) {
@@ -872,7 +872,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
documentProvider.connect(input);
}
}
-
+
private void disconnect(IDocumentProvider provider, IEditorInput input) {
final ISharedDocumentAdapter sda = Adapters.adapt(fElement, ISharedDocumentAdapter.class);
if (sda != null) {
@@ -888,7 +888,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fDocumentProvider = documentProvider;
documentProvider.addElementStateListener(this);
}
-
+
public void disconnect() {
IDocumentProvider provider = null;
IEditorInput input = getDocumentKey();
@@ -926,7 +926,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (doc != null)
DocumentManager.remove(doc);
}
-
+
private IDocument internalGetDocument(MergeSourceViewer tp) {
IDocument oldDoc= tp.getSourceViewer().getDocument();
if (oldDoc == null) {
@@ -934,7 +934,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return oldDoc;
}
-
+
/**
* Return the document key used to obtain a shared document. A <code>null</code>
* is returned in the following cases:
@@ -956,7 +956,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
private IDocumentProvider getDocumentProvider() {
if (fDocumentProvider != null)
return fDocumentProvider;
@@ -973,17 +973,17 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private boolean isUsingDefaultContentProvider() {
return fViewer.isUsingDefaultContentProvider();
}
-
+
private boolean canHaveSharedDocument() {
return fViewer.canHaveSharedDocument();
}
-
+
boolean hasSharedDocument(Object object) {
return (fElement == object &&
fDocumentProvider != null
&& fDocumentProvider.getDocument(getDocumentKey()) != null);
}
-
+
public boolean flush() throws CoreException {
if (fDocumentProvider != null) {
IEditorInput input = getDocumentKey();
@@ -1005,7 +1005,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return false;
}
-
+
@Override
public void elementMoved(Object originalElement, Object movedElement) {
IEditorInput input = getDocumentKey();
@@ -1106,7 +1106,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fTopIndex = oldContributor.fTopIndex;
fEncoding = oldContributor.fEncoding;
}
-
+
}
public boolean validateChange() {
@@ -1148,12 +1148,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
e.doit= false;
}
}
-
+
@Override
public void documentAboutToBeChanged(DocumentEvent e) {
// nothing to do
}
-
+
@Override
public void documentChanged(DocumentEvent e) {
boolean dirty = true;
@@ -1168,17 +1168,17 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
class HeaderPainter implements PaintListener {
private static final int INSET= BIRDS_EYE_VIEW_INSET;
private RGB fIndicatorColor;
private Color fSeparatorColor;
-
+
public HeaderPainter() {
fSeparatorColor= fSummaryHeader.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
}
-
+
/*
* Returns true on color change
*/
@@ -1191,21 +1191,21 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return !color.equals(oldColor);
return true;
}
-
+
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);
}
-
+
@Override
public void paintControl(PaintEvent e) {
Point s= fSummaryHeader.getSize();
-
+
if (fIndicatorColor != null) {
Display d= fSummaryHeader.getDisplay();
e.gc.setBackground(getColor(d, fIndicatorColor));
@@ -1233,7 +1233,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
protected ChildPositionUpdater(String category) {
super(category);
}
-
+
/*
* Child document ranges cannot be deleted other then by calling
* freeChildDocument.
@@ -1242,7 +1242,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
protected boolean notDeleted() {
return true;
}
-
+
/*
* If an insertion happens at a child document's start offset, the
* position is extended rather than shifted. Also, if something is added
@@ -1255,14 +1255,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
int myStart= fPosition.offset;
int myEnd= fPosition.offset + fPosition.length;
myEnd= Math.max(myStart, myEnd);
-
+
int yoursStart= fOffset;
int yoursEnd= fOffset + fReplaceLength -1;
yoursEnd= Math.max(yoursStart, yoursEnd);
-
+
if (myEnd < yoursStart)
return;
-
+
if (myStart <= yoursStart)
fPosition.length += fReplaceLength;
else
@@ -1272,7 +1272,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
private class ChangeHighlighter implements ITextPresentationListener {
private final MergeSourceViewer viewer;
@@ -1314,10 +1314,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
if (length < 0)
return null;
-
+
return new StyleRange(start, length, null, cTextFill);
}
-
+
private RGB getTextFillColor(Diff diff) {
if (isThreeWay() && !isIgnoreAncestor()) {
switch (diff.getKind()) {
@@ -1335,7 +1335,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return OUTGOING_TEXT_FILL;
}
}
-
+
private class FindReplaceTarget implements IFindReplaceTarget, IFindReplaceTargetExtension, IFindReplaceTargetExtension2, IFindReplaceTargetExtension3 {
@Override
public boolean canPerformFind() {
@@ -1374,7 +1374,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (findReplaceTarget instanceof IFindReplaceTargetExtension3) {
return ((IFindReplaceTargetExtension3) findReplaceTarget).findAndSelect(offset, findString, searchForward, caseSensitive, wholeWord, regExSearch);
}
-
+
// fallback like in org.eclipse.ui.texteditor.FindReplaceTarget
if (!regExSearch && findReplaceTarget != null)
return findReplaceTarget.findAndSelect(offset, findString, searchForward, caseSensitive, wholeWord);
@@ -1388,7 +1388,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
((IFindReplaceTargetExtension3) findReplaceTarget).replaceSelection(text, regExReplace);
return;
}
-
+
// fallback like in org.eclipse.ui.texteditor.FindReplaceTarget
if (!regExReplace && findReplaceTarget != null)
findReplaceTarget.replaceSelection(text);
@@ -1468,11 +1468,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
((IFindReplaceTargetExtension) findReplaceTarget).setReplaceAllMode(replaceAll);
}
}
-
+
}
//---- MergeTextViewer
-
+
/**
* Creates a text merge viewer under the given parent control.
*
@@ -1482,7 +1482,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
public TextMergeViewer(Composite parent, CompareConfiguration configuration) {
this(parent, SWT.NULL, configuration);
}
-
+
/**
* Creates a text merge viewer under the given parent control.
*
@@ -1568,7 +1568,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return TextMergeViewer.this.isPatchHunkOk();
}
});
-
+
int inheritedStyle= parent.getStyle();
if ((inheritedStyle & SWT.LEFT_TO_RIGHT) != 0)
fInheritedDirection= SWT.LEFT_TO_RIGHT;
@@ -1576,23 +1576,23 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fInheritedDirection= SWT.RIGHT_TO_LEFT;
else
fInheritedDirection= SWT.NONE;
-
+
if ((style & SWT.LEFT_TO_RIGHT) != 0)
fTextDirection= SWT.LEFT_TO_RIGHT;
else if ((style & SWT.RIGHT_TO_LEFT) != 0)
fTextDirection= SWT.RIGHT_TO_LEFT;
else
fTextDirection= SWT.NONE;
-
+
fSymbolicFontName= getSymbolicFontName();
-
+
fIsMotif= Util.isMotif();
fIsCarbon= Util.isCarbon();
fIsMac= Util.isMac();
-
+
if (fIsMotif)
fMarginWidth= 0;
-
+
fPreferenceChangeListener= new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
@@ -1603,7 +1603,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fPreferenceStore= createChainedPreferenceStore();
if (fPreferenceStore != null) {
fPreferenceStore.addPropertyChangeListener(fPreferenceChangeListener);
-
+
fSynchronizedScrolling= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
//fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
@@ -1611,9 +1611,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fHighlightTokenChanges= fPreferenceStore.getBoolean(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES);
//fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
}
-
+
buildControl(parent);
-
+
setColors();
INavigatable nav= new INavigatable() {
@@ -1639,14 +1639,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
};
fComposite.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
+
fBirdsEyeCursor= new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
-
+
JFaceResources.getFontRegistry().addListener(fPreferenceChangeListener);
JFaceResources.getColorRegistry().addListener(fPreferenceChangeListener);
updateFont();
}
-
+
private static class LineNumberRulerToggleAction extends TextEditorPropertyAction {
public LineNumberRulerToggleAction(String label, MergeSourceViewer[] viewers, String preferenceKey) {
super(label, viewers, preferenceKey);
@@ -1664,7 +1664,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
stores.add(EditorsUI.getPreferenceStore());
return new ChainedPreferenceStore(stores.toArray(new IPreferenceStore[stores.size()]));
}
-
+
/**
* Creates a color from the information stored in the given preference store.
* Returns <code>null</code> if there is no such information available.
@@ -1703,7 +1703,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
// use text compare font if no font has been registered for subclass
return getClass().getName();
}
-
+
private void updateFont() {
Font f= JFaceResources.getFont(fSymbolicFontName);
if (f != null) {
@@ -1715,7 +1715,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fRight.setFont(f);
}
}
-
+
private void checkForColorUpdate(Display display) {
if (fIsUsingSystemBackground) {
RGB bg= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
@@ -1724,7 +1724,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
/**
* Sets the viewer's background color to the given RGB value.
* If the value is <code>null</code> the system's default background color is used.
@@ -1736,7 +1736,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fBackground= background;
updateColors(null);
}
-
+
private RGB getBackground(Display display) {
if (fBackground != null)
return fBackground;
@@ -1746,7 +1746,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
}
-
+
/**
* Sets the viewer's foreground color to the given RGB value.
* If the value is <code>null</code> the system's default foreground color is used.
@@ -1758,9 +1758,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fForeground= foreground;
updateColors(null);
}
-
+
private void updateColors(Display display) {
-
+
if (display == null)
display = fComposite.getDisplay();
@@ -1785,9 +1785,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fLeft.setForegroundColor(fgColor);
if (fRight != null)
fRight.setForegroundColor(fgColor);
-
+
ColorRegistry registry= JFaceResources.getColorRegistry();
-
+
RGB bg= getBackground(display);
SELECTED_INCOMING= registry.getRGB(INCOMING_COLOR);
if (SELECTED_INCOMING == null)
@@ -1802,18 +1802,18 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
OUTGOING= interpolate(SELECTED_OUTGOING, bg, 0.6);
OUTGOING_FILL= interpolate(SELECTED_OUTGOING, bg, 0.97);
OUTGOING_TEXT_FILL= interpolate(SELECTED_OUTGOING, bg, 0.85);
-
+
SELECTED_CONFLICT= registry.getRGB(CONFLICTING_COLOR);
if (SELECTED_CONFLICT == null)
SELECTED_CONFLICT= new RGB(255, 0, 0); // RED
CONFLICT= interpolate(SELECTED_CONFLICT, bg, 0.6);
CONFLICT_FILL= interpolate(SELECTED_CONFLICT, bg, 0.97);
CONFLICT_TEXT_FILL= interpolate(SELECTED_CONFLICT, bg, 0.85);
-
+
RESOLVED= registry.getRGB(RESOLVED_COLOR);
if (RESOLVED == null)
RESOLVED= new RGB(0, 255, 0); // GREEN
-
+
updatePresentation();
}
@@ -1822,7 +1822,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
invalidateLines();
invalidateTextPresentation();
}
-
+
/**
* Invalidates the current presentation by invalidating the three text viewers.
* @since 2.0
@@ -1835,7 +1835,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fRight != null)
fRight.getSourceViewer().invalidateTextPresentation();
}
-
+
/**
* Configures the passed text viewer. This method is called after the three
* text viewers have been created for the content areas. The
@@ -1843,7 +1843,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* configure the viewer with a {@link SourceViewerConfiguration}.
* Subclasses may reimplement to provide a specific configuration for the
* text viewer.
- *
+ *
* @param textViewer
* the text viewer to configure
*/
@@ -1867,7 +1867,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
protected ITokenComparator createTokenComparator(String line) {
return new TokenComparator(line);
}
-
+
/**
* Setup the given document for use with this viewer. By default,
* the partitioner returned from {@link #getDocumentPartitioner()}
@@ -1876,7 +1876,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* {@link #getDocumentPartitioning()} if they wish to be able to use shared
* documents (i.e. file buffers).
* @param document the document to be set up
- *
+ *
* @since 3.3
*/
protected void setupDocument(IDocument document) {
@@ -1900,7 +1900,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
/**
* Returns a document partitioner which is suitable for the underlying content type.
* This method is only called if the input provided by the content provider is a
@@ -1918,7 +1918,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
protected IDocumentPartitioner getDocumentPartitioner() {
return null;
}
-
+
/**
* Return the partitioning to which the partitioner returned from
* {@link #getDocumentPartitioner()} is to be associated. Return <code>null</code>
@@ -1929,13 +1929,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* will not be able to use shared documents.
* @see IDocumentExtension3
* @return a partitioning
- *
+ *
* @since 3.3
*/
protected String getDocumentPartitioning() {
return null;
}
-
+
/**
* Called on the viewer disposal.
* Unregisters from the compare configuration.
@@ -1948,12 +1948,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fHandlerService != null)
fHandlerService.dispose();
-
+
Object input= getInput();
removeFromDocumentManager(ANCESTOR_CONTRIBUTOR, input);
removeFromDocumentManager(LEFT_CONTRIBUTOR, input);
removeFromDocumentManager(RIGHT_CONTRIBUTOR, input);
-
+
if (DEBUG)
DocumentManager.dump();
@@ -1964,7 +1964,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fPreferenceStore.removePropertyChangeListener(fPreferenceChangeListener);
fPreferenceChangeListener= null;
}
-
+
fLeftCanvas= null;
fRightCanvas= null;
fVScrollBar= null;
@@ -1974,22 +1974,22 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fAncestorContributor.unsetDocument(fAncestor);
fLeftContributor.unsetDocument(fLeft);
fRightContributor.unsetDocument(fRight);
-
+
disconnect(fLeftContributor);
disconnect(fRightContributor);
disconnect(fAncestorContributor);
-
+
if (fBirdsEyeCursor != null) {
fBirdsEyeCursor.dispose();
fBirdsEyeCursor= null;
}
-
+
if (showWhitespaceAction != null)
showWhitespaceAction.dispose();
-
+
if (toggleLineNumbersAction != null)
toggleLineNumbersAction.dispose();
-
+
if (fIgnoreWhitespace != null)
fIgnoreWhitespace.dispose();
@@ -2005,7 +2005,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fSourceViewerDecorationSupport = null;
}
-
+
if (fAncestor != null)
fAncestor.dispose();
fAncestor = null;
@@ -2025,10 +2025,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
fColors= null;
}
- // don't add anything here, disposing colors should be done last
+ // don't add anything here, disposing colors should be done last
super.handleDispose(event);
}
-
+
private void disconnect(ContributorInfo legInfo) {
if (legInfo != null)
legInfo.disconnect();
@@ -2037,7 +2037,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
//-------------------------------------------------------------------------------------------------------------
//--- internal ------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------
-
+
/*
* Creates the specific SWT controls for the content areas.
* Clients must not call or override this method.
@@ -2045,7 +2045,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
@Override
protected void createControls(Composite composite) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICompareContextIds.TEXT_MERGE_VIEW);
-
+
// 1st row
if (fMarginWidth > 0) {
fAncestorCanvas= new BufferedCanvas(composite, SWT.NONE) {
@@ -2063,7 +2063,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
);
}
-
+
fAncestor= createPart(composite);
setEditable(fAncestor.getSourceViewer(), false);
fAncestor.getSourceViewer().getTextWidget().getAccessible().addAccessibleListener(new AccessibleAdapter() {
@@ -2073,12 +2073,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
});
fAncestor.getSourceViewer().addTextPresentationListener(new ChangeHighlighter(fAncestor));
-
+
fSummaryHeader= new Canvas(composite, SWT.NONE);
fHeaderPainter= new HeaderPainter();
fSummaryHeader.addPaintListener(fHeaderPainter);
updateResolveStatus();
-
+
// 2nd row
if (fMarginWidth > 0) {
fLeftCanvas= new BufferedCanvas(composite, SWT.NONE) {
@@ -2096,7 +2096,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
);
}
-
+
fLeft= createPart(composite);
fLeft.getSourceViewer().getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fLeft.getSourceViewer().getTextWidget().getAccessible().addAccessibleListener(new AccessibleAdapter() {
@@ -2106,7 +2106,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
});
fLeft.getSourceViewer().addTextPresentationListener(new ChangeHighlighter(fLeft));
-
+
fRight= createPart(composite);
fRight.getSourceViewer().getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fRight.getSourceViewer().getTextWidget().getAccessible().addAccessibleListener(new AccessibleAdapter() {
@@ -2116,7 +2116,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
});
fRight.getSourceViewer().addTextPresentationListener(new ChangeHighlighter(fRight));
-
+
IWorkbenchPart part = getCompareConfiguration().getContainer().getWorkbenchPart();
// part is not available for contexts different than editor
if (part != null) {
@@ -2127,7 +2127,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
cesp.setViewers(new SourceViewer[] { fLeft.getSourceViewer(), fRight.getSourceViewer(), fAncestor.getSourceViewer() }, focusSourceViewer);
}
}
-
+
hsynchViewport(fAncestor.getSourceViewer(), fLeft.getSourceViewer(), fRight.getSourceViewer());
hsynchViewport(fLeft.getSourceViewer(), fAncestor.getSourceViewer(), fRight.getSourceViewer());
hsynchViewport(fRight.getSourceViewer(), fAncestor.getSourceViewer(), fLeft.getSourceViewer());
@@ -2148,11 +2148,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
);
}
-
+
fScrollCanvas= new Canvas(composite, SWT.V_SCROLL);
Rectangle trim= fLeft.getSourceViewer().getTextWidget().computeTrim(0, 0, 0, 0);
fTopInset= trim.y;
-
+
fVScrollBar= fScrollCanvas.getVerticalBar();
fVScrollBar.setIncrement(1);
fVScrollBar.setVisible(true);
@@ -2165,7 +2165,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
);
-
+
fBirdsEyeCanvas= new BufferedCanvas(composite, SWT.NONE) {
@Override
public void doPaint(GC gc) {
@@ -2183,7 +2183,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fBirdsEyeCanvas.addMouseMoveListener(
new MouseMoveListener() {
private Cursor fLastCursor;
-
+
@Override
public void mouseMove(MouseEvent e) {
Cursor cursor= null;
@@ -2206,7 +2206,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
private void hsynchViewport(final TextViewer tv1, final TextViewer tv2, final TextViewer tv3) {
final StyledText st1= tv1.getTextWidget();
final StyledText st2= tv2.getTextWidget();
@@ -2232,7 +2232,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
setCurrentDiff(diff, reveal);
}
}
-
+
private Diff handleMouseInSides(Canvas canvas, MergeSourceViewer tp, int my) {
int lineHeight= tp.getSourceViewer().getTextWidget().getLineHeight();
@@ -2262,14 +2262,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
continue;
if (y >= visibleHeight)
break;
-
+
if (my >= y && my < y+h)
return diff;
}
}
return null;
}
-
+
private Diff getDiffUnderMouse(Canvas canvas, int mx, int my, Rectangle r) {
if (! fSynchronizedScrolling)
@@ -2331,33 +2331,33 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private Diff handlemouseInBirdsEyeView(Canvas canvas, int my) {
return fMerger.findDiff(getViewportHeight(), fSynchronizedScrolling, canvas.getSize(), my);
}
-
+
private void paintBirdsEyeView(Canvas canvas, GC gc) {
-
+
Color c;
Rectangle r= new Rectangle(0, 0, 0, 0);
int yy, hh;
-
+
Point size= canvas.getSize();
-
+
int virtualHeight= fSynchronizedScrolling ? fMerger.getVirtualHeight() : fMerger.getRightHeight();
if (virtualHeight < getViewportHeight())
return;
-
+
Display display= canvas.getDisplay();
int y= 0;
for (Iterator<?> iterator = fMerger.rangesIterator(); iterator.hasNext();) {
Diff diff = (Diff) iterator.next();
int h= fSynchronizedScrolling ? diff.getMaxDiffHeight()
: diff.getRightHeight();
-
+
if (fMerger.useChange(diff)) {
-
+
yy= (y*size.y)/virtualHeight;
hh= (h*size.y)/virtualHeight;
if (hh < 3)
hh= 3;
-
+
c= getColor(display, getFillColor(diff));
if (c != null) {
gc.setBackground(c);
@@ -2382,16 +2382,16 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
gc.drawRectangle(r);
}
}
-
+
y+= h;
}
}
-
+
private void refreshBirdsEyeView() {
if (fBirdsEyeCanvas != null)
fBirdsEyeCanvas.redraw();
}
-
+
/**
* Override to give focus to the pane that previously had focus or to a suitable
* default pane.
@@ -2427,8 +2427,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return false; // could not set focus
}
-
-
+
+
class HoverResizer extends Resizer {
Canvas fCanvas;
public HoverResizer(Canvas c, int dir) {
@@ -2442,7 +2442,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
super.mouseMove(e);
}
}
-
+
@Override
protected final Control createCenterControl(Composite parent) {
if (fSynchronizedScrolling) {
@@ -2488,7 +2488,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
);
-
+
return canvas;
}
return super.createCenterControl(parent);
@@ -2549,7 +2549,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return fButtonDiff != null;
}
-
+
@Override
protected final int getCenterWidth() {
if (fSynchronizedScrolling)
@@ -2577,7 +2577,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* Clients may implement to provide their own type of source viewers. The
* viewer is not expected to be configured with a source viewer
* configuration.
- *
+ *
* @param parent
* the parent of the viewer's control
* @param textOrientation
@@ -2589,10 +2589,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
protected SourceViewer createSourceViewer(Composite parent, int textOrientation) {
return new SourceViewer(parent, new CompositeRuler(), textOrientation | SWT.H_SCROLL | SWT.V_SCROLL);
}
-
+
/**
* Tells whether the given text viewer is backed by an editor.
- *
+ *
* @param textViewer the text viewer to check
* @return <code>true</code> if the viewer is backed by an editor
* @since 3.5
@@ -2605,12 +2605,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* Returns an editor input for the given source viewer. The method returns
* <code>null</code> when no input is available, for example when the input
* for the merge viewer has not been set yet.
- *
+ *
* @param sourceViewer
* the source viewer to get input for
* @return input for the given viewer or <code>null</code> when no input is
* available
- *
+ *
* @since 3.5
*/
protected IEditorInput getEditorInput(ISourceViewer sourceViewer) {
@@ -2626,7 +2626,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return fAncestorContributor.getDocumentKey();
return null;
}
-
+
/*
* Creates and initializes a text part.
*/
@@ -2635,10 +2635,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
createSourceViewer(parent, getDirection()),
getResourceBundle(), getCompareConfiguration().getContainer());
final StyledText te= viewer.getSourceViewer().getTextWidget();
-
+
if (!fConfirmSave)
viewer.hideSaveAction();
-
+
te.addPaintListener(
new PaintListener() {
@Override
@@ -2664,7 +2664,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
);
-
+
te.addFocusListener(
new FocusAdapter() {
@Override
@@ -2677,7 +2677,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
);
-
+
viewer.getSourceViewer().addViewportListener(
new IViewportListener() {
@Override
@@ -2686,14 +2686,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
);
-
+
Font font= JFaceResources.getFont(fSymbolicFontName);
if (font != null)
te.setFont(font);
-
+
if (fBackground != null) // not default
te.setBackground(getColor(parent.getDisplay(), fBackground));
-
+
// Add the find action to the popup menu of the viewer
contributeFindAction(viewer);
@@ -2733,7 +2733,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
action.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
viewer.addAction(MergeSourceViewer.FIND_ID, action);
}
-
+
private void contributeGotoLineAction(MergeSourceViewer viewer) {
IAction action = new GotoLineAction((ITextEditor) viewer.getAdapter(ITextEditor.class));
action.setActionDefinitionId(ITextEditorActionDefinitionIds.LINE_GOTO);
@@ -2744,7 +2744,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
IAction action = new ChangeEncodingAction(getTextEditorAdapter());
viewer.addAction(MergeSourceViewer.CHANGE_ENCODING_ID, action);
}
-
+
private void contributeDiffBackgroundListener(final MergeSourceViewer viewer) {
viewer.getSourceViewer().getTextWidget().addLineBackgroundListener(
new LineBackgroundListener() {
@@ -2827,7 +2827,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* The default implementation does nothing, but clients should override to properly react to
* viewers switching.
* </p>
- *
+ *
* @param sourceViewer the source viewer
* @param state <code>true</code> if activated
* @since 3.5
@@ -2861,34 +2861,34 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
// The document is not associated with the input of the viewer so try to find the document
return Utilities.getDocument(type, element, isUsingDefaultContentProvider(), canHaveSharedDocument());
}
-
+
private boolean isUsingDefaultContentProvider() {
return getContentProvider() instanceof MergeViewerContentProvider;
}
-
+
private boolean canHaveSharedDocument() {
return getDocumentPartitioning() != null
|| getDocumentPartitioner() == null;
}
-
+
private IDocument getDocument(ITypedElement te, ContributorInfo info) {
if (info != null && info.getElement() == te)
return info.getDocument();
return null;
}
-
+
IDocument getDocument(char type, Object input) {
IDocument doc= getElementDocument(type, input);
if (doc != null)
return doc;
-
+
if (input instanceof IDiffElement) {
IDiffContainer parent= ((IDiffElement)input).getParent();
return getElementDocument(type, parent);
}
return null;
}
-
+
/*
* Returns true if the given inputs map to the same documents
*/
@@ -2897,7 +2897,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
IDocument oldDoc= getDocument(type, oldInput);
return newDoc == oldDoc;
}
-
+
/**
* Overridden to prevent save confirmation if new input is sub document of current input.
* @param newInput the new input of this viewer, or <code>null</code> if there is no new input
@@ -2917,25 +2917,25 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return false;
}
}
-
+
if (DEBUG) System.out.println("***** New docs !!!!"); //$NON-NLS-1$
-
+
removeFromDocumentManager(ANCESTOR_CONTRIBUTOR, oldInput);
removeFromDocumentManager(LEFT_CONTRIBUTOR, oldInput);
removeFromDocumentManager(RIGHT_CONTRIBUTOR, oldInput);
-
+
if (DEBUG)
DocumentManager.dump();
-
+
return super.doSave(newInput, oldInput);
}
-
+
private void removeFromDocumentManager(char leg, Object oldInput) {
IDocument document= getDocument(leg, oldInput);
if (document != null)
DocumentManager.remove(document);
}
-
+
private ITypedElement getParent(char type) {
Object input= getInput();
if (input instanceof IDiffElement) {
@@ -2944,7 +2944,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
/*
* Initializes the text viewers of the three content areas with the given input objects.
* Subclasses may extend.
@@ -2959,23 +2959,23 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
Position leftRange= null;
Position rightRange= null;
-
+
// if one side is empty use container
if (FIX_47640 && !emptyInput && (left == null || right == null)) {
if (input instanceof IDiffElement) {
IDiffContainer parent= ((IDiffElement)input).getParent();
if (parent instanceof ICompareInput) {
ICompareInput ci= (ICompareInput) parent;
-
+
if (ci.getAncestor() instanceof IDocumentRange
|| ci.getLeft() instanceof IDocumentRange
|| ci.getRight() instanceof IDocumentRange) {
-
+
if (left instanceof IDocumentRange)
leftRange= ((IDocumentRange)left).getRange();
if (right instanceof IDocumentRange)
rightRange= ((IDocumentRange)right).getRange();
-
+
ancestor= ci.getAncestor();
left= getCompareConfiguration().isMirrored() ? ci.getRight() : ci.getLeft();
right= getCompareConfiguration().isMirrored() ? ci.getLeft() : ci.getRight();
@@ -2985,12 +2985,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
fHighlightRanges= left != null && right != null;
-
+
resetDiffs();
fHasErrors= false; // start with no errors
-
+
IMergeViewerContentProvider cp= getMergeContentProvider();
-
+
if (cp instanceof MergeViewerContentProvider) {
MergeViewerContentProvider mcp= (MergeViewerContentProvider) cp;
mcp.setAncestorError(null);
@@ -3003,21 +3003,21 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
ContributorInfo oldLeftContributor = fLeftContributor;
ContributorInfo oldRightContributor = fRightContributor;
ContributorInfo oldAncestorContributor = fAncestorContributor;
-
+
// Create the new contributor
fLeftContributor = createLegInfoFor(left, LEFT_CONTRIBUTOR);
fRightContributor = createLegInfoFor(right, RIGHT_CONTRIBUTOR);
fAncestorContributor = createLegInfoFor(ancestor, ANCESTOR_CONTRIBUTOR);
-
+
fLeftContributor.transferContributorStateFrom(oldLeftContributor);
fRightContributor.transferContributorStateFrom(oldRightContributor);
fAncestorContributor.transferContributorStateFrom(oldAncestorContributor);
-
+
// Now disconnect the old ones
disconnect(oldLeftContributor);
disconnect(oldRightContributor);
disconnect(oldAncestorContributor);
-
+
// Get encodings from streams. If an encoding is null, abide by the other one
// Defaults to workbench encoding only if both encodings are null
fLeftContributor.setEncodingIfAbsent(fRightContributor);
@@ -3029,21 +3029,21 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
configureSourceViewer(fLeft.getSourceViewer(), isLeftEditable() && cp.isLeftEditable(input), fLeftContributor);
configureSourceViewer(fRight.getSourceViewer(), isRightEditable() && cp.isRightEditable(input), fRightContributor);
isConfigured = true; // configure once
- }
+ }
// set new documents
fLeftContributor.setDocument(fLeft, isLeftEditable() && cp.isLeftEditable(input));
fLeftLineCount= fLeft.getLineCount();
-
+
fRightContributor.setDocument(fRight, isRightEditable() && cp.isRightEditable(input));
fRightLineCount= fRight.getLineCount();
-
+
fAncestorContributor.setDocument(fAncestor, false);
setSyncScrolling(fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING));
-
+
update(false);
-
+
if (!fHasErrors && !emptyInput && !fComposite.isDisposed()) {
if (isRefreshing()) {
fLeftContributor.updateSelection(fLeft, !fSynchronizedScrolling);
@@ -3073,7 +3073,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
}
private void configureSourceViewer(SourceViewer sourceViewer, boolean editable, ContributorInfo contributor) {
@@ -3102,7 +3102,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
/**
* Sets the editable state of the given source viewer.
- *
+ *
* @param sourceViewer
* the source viewer
* @param state
@@ -3120,7 +3120,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private ContributorInfo createLegInfoFor(Object element, char leg) {
return new ContributorInfo(this, element, leg);
}
-
+
private boolean updateDiffBackground(Diff diff) {
if (!fHighlightRanges)
@@ -3142,7 +3142,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
*/
private void documentChanged(DocumentEvent e, boolean dirty) {
final IDocument doc= e.getDocument();
-
+
if (doc == fLeft.getSourceViewer().getDocument()) {
setLeftDirty(dirty);
} else if (doc == fRight.getSourceViewer().getDocument()) {
@@ -3173,8 +3173,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
updateLines(doc);
}
}
-
-
+
+
private void saveDiff() {
fSavedDiff = fCurrentDiff;
}
@@ -3185,8 +3185,8 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return fSavedDiff;
}
-
-
+
+
private Diff findNewDiff(Diff oldDiff) {
if (oldDiff == null)
return null;
@@ -3210,7 +3210,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return fMerger.findDiff(type, offset, offset + length);
}
-
+
/*
* This method is called if a range of text on one side is copied into an empty sub-document
* on the other side. The method returns the position where the sub-document is placed into the base document.
@@ -3224,10 +3224,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* @since 2.0
*/
protected int findInsertionPosition(char type, ICompareInput input) {
-
+
ITypedElement other= null;
char otherType= 0;
-
+
switch (type) {
case ANCESTOR_CONTRIBUTOR:
other= input.getLeft();
@@ -3256,7 +3256,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
default:
break;
}
-
+
if (other instanceof IDocumentRange) {
IDocumentRange dr= (IDocumentRange) other;
Position p= dr.getRange();
@@ -3265,7 +3265,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return 0;
}
-
+
private void setError(char type, String message) {
IMergeViewerContentProvider cp= getMergeContentProvider();
if (cp instanceof MergeViewerContentProvider) {
@@ -3303,7 +3303,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* is false. _In most cases_ this means that save has taken place
* outside compare editor. Ask to redo diff calculation when the
* editor gets focus.
- *
+ *
* However, undoing all the changes made in another editor would
* result in asking for redo diff as well. In this case, we set the
* flag back to false, see
@@ -3325,7 +3325,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return null;
}
}
-
+
private void addNewRange(char type, Object input, Position range) {
switch (type) {
case ANCESTOR_CONTRIBUTOR:
@@ -3341,10 +3341,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
break;
}
}
-
+
/**
* Returns the contents of the underlying document as an array of bytes using the current workbench encoding.
- *
+ *
* @param left if <code>true</code> the contents of the left side is returned; otherwise the right side
* @return the contents of the left or right document or null
*/
@@ -3369,29 +3369,29 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
private IRegion normalizeDocumentRegion(IDocument doc, IRegion region) {
-
+
if (region == null || doc == null)
return region;
-
+
int maxLength= doc.getLength();
-
+
int start= region.getOffset();
if (start < 0)
start= 0;
else if (start > maxLength)
start= maxLength;
-
+
int length= region.getLength();
if (length < 0)
length= 0;
else if (start + length > maxLength)
length= maxLength - start;
-
+
return new Region(start, length);
}
-
+
@Override
protected final void handleResizeAncestor(int x, int y, int width, int height) {
if (width > 0) {
@@ -3401,7 +3401,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fAncestorCanvas.setVisible(true);
if (fAncestor.isControlOkToUse())
fAncestor.getSourceViewer().getTextWidget().setVisible(true);
-
+
if (fAncestorCanvas != null) {
fAncestorCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
x+= fMarginWidth;
@@ -3427,7 +3427,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
protected final void handleResizeLeftRight(int x, int y, int width1, int centerWidth, int width2, int height) {
if (fBirdsEyeCanvas != null)
width2-= BIRDS_EYE_VIEW_WIDTH;
-
+
Rectangle trim= fLeft.getSourceViewer().getTextWidget().computeTrim(0, 0, 0, 0);
int scrollbarHeight= trim.height + trim.x;
@@ -3439,15 +3439,15 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
x+= fMarginWidth;
leftTextWidth-= fMarginWidth;
}
-
+
fLeft.setBounds(x, y, leftTextWidth, height);
x+= leftTextWidth;
-
+
if (fCenter == null || fCenter.isDisposed())
fCenter= createCenterControl(composite);
fCenter.setBounds(x, y, centerWidth, height-scrollbarHeight);
x+= centerWidth;
-
+
if (!fSynchronizedScrolling) { // canvas is to the left of text
if (fRightCanvas != null) {
fRightCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
@@ -3456,7 +3456,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
// we draw the canvas to the left of the text widget
}
-
+
int scrollbarWidth= 0;
if (fSynchronizedScrolling && fScrollCanvas != null) {
trim= fLeft.getSourceViewer().getTextWidget().computeTrim(0, 0, 0, 0);
@@ -3468,7 +3468,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
rightTextWidth-= fMarginWidth;
fRight.setBounds(x, y, rightTextWidth, height);
x+= rightTextWidth;
-
+
if (fSynchronizedScrolling) {
if (fRightCanvas != null) { // canvas is to the right of the text
fRightCanvas.setBounds(x, y, fMarginWidth, height-scrollbarHeight);
@@ -3477,7 +3477,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fScrollCanvas != null)
fScrollCanvas.setBounds(x, y, scrollbarWidth, height-scrollbarHeight);
}
-
+
if (fBirdsEyeCanvas != null) {
int verticalScrollbarButtonHeight= scrollbarWidth;
int horizontalScrollbarButtonHeight= scrollbarHeight;
@@ -3490,12 +3490,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
y+= verticalScrollbarButtonHeight;
fBirdsEyeCanvas.setBounds(x+scrollbarWidth, y, BIRDS_EYE_VIEW_WIDTH, height-(2*verticalScrollbarButtonHeight+horizontalScrollbarButtonHeight));
}
-
+
// doesn't work since TextEditors don't have their correct size yet.
updateVScrollBar();
refreshBirdsEyeView();
}
-
+
/*
* Track selection changes to update the current Diff.
*/
@@ -3511,9 +3511,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return new Region(position.getOffset(), position.getLength());
return null;
}
-
+
//---- the differencing
-
+
/**
* Perform a two level 2- or 3-way diff.
* The first level is based on line comparison, the second level on token comparison.
@@ -3539,7 +3539,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
invalidateTextPresentation();
}
-
+
private Diff findDiff(char type, int pos) {
try {
return fMerger.findDiff(type, pos);
@@ -3551,7 +3551,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return null;
}
}
-
+
private void resetPositions(IDocument doc) {
if (doc == null)
return;
@@ -3562,16 +3562,16 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
doc.addPositionCategory(DIFF_RANGE_CATEGORY);
}
-
+
//---- update UI stuff
-
+
private void updateControls() {
if (getControl().isDisposed())
return;
boolean leftToRight= false;
boolean rightToLeft= false;
-
+
updateStatus(fCurrentDiff);
updateResolveStatus();
@@ -3584,7 +3584,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
if (fDirectionLabel != null) {
if (fHighlightRanges && fCurrentDiff != null && isThreeWay() && !isIgnoreAncestor()) {
fDirectionLabel.setImage(fCurrentDiff.getImage());
@@ -3592,7 +3592,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fDirectionLabel.setImage(null);
}
}
-
+
if (fCopyDiffLeftToRightItem != null)
fCopyDiffLeftToRightItem.getAction().setEnabled(leftToRight);
if (fCopyDiffRightToLeftItem != null)
@@ -3631,11 +3631,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
Assert.isTrue(false);
return false;
}
-
+
private void updateResolveStatus() {
-
+
RGB rgb= null;
-
+
if (showResolveUI()) {
// we only show red or green if there is at least one incoming or conflicting change
int unresolvedIncoming= 0;
@@ -3653,7 +3653,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
if (unresolvedConflicting > 0)
rgb= SELECTED_CONFLICT;
else if (unresolvedIncoming > 0)
@@ -3661,22 +3661,22 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
else
rgb= RESOLVED;
}
-
+
if (fHeaderPainter.setColor(rgb))
fSummaryHeader.redraw();
}
private void updateStatus(Diff diff) {
-
+
String diffDescription;
-
+
if (diff == null) {
diffDescription= CompareMessages.TextMergeViewer_diffDescription_noDiff_format;
} else {
-
+
if (diff.isToken()) // we don't show special info for token diffs
diff= diff.getParent();
-
+
String format= CompareMessages.TextMergeViewer_diffDescription_diff_format;
diffDescription= MessageFormat.format(format,
getDiffType(diff), // 0: diff type
@@ -3685,14 +3685,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
getDiffRange(fRight, diff.getPosition(RIGHT_CONTRIBUTOR)) // 3: left end line
);
}
-
+
String format= CompareMessages.TextMergeViewer_statusLine_format;
String s= MessageFormat.format(format,
getCursorPosition(fLeft), // 0: left column
getCursorPosition(fRight), // 1: right column
diffDescription // 2: diff description
);
-
+
getCompareConfiguration().getContainer().setStatusMessage(s);
}
@@ -3718,7 +3718,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
String format= CompareMessages.TextMergeViewer_diffType_format;
return MessageFormat.format(format, s, diff.changeType());
}
-
+
private String getDiffNumber(Diff diff) {
// find the diff's number
int diffNumber= 0;
@@ -3732,12 +3732,12 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return Integer.toString(diffNumber);
}
-
+
private String getDiffRange(MergeSourceViewer v, Position pos) {
Point p= v.getLineRange(pos, new Point(0, 0));
int startLine= p.x+1;
int endLine= p.x+p.y;
-
+
String format;
if (endLine < startLine)
format= CompareMessages.TextMergeViewer_beforeLine_format;
@@ -3745,33 +3745,33 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
format= CompareMessages.TextMergeViewer_range_format;
return MessageFormat.format(format, Integer.toString(startLine), Integer.toString(endLine));
}
-
+
/*
* Returns a description of the cursor position.
- *
+ *
* @return a description of the cursor position
*/
private String getCursorPosition(MergeSourceViewer v) {
if (v != null) {
StyledText styledText= v.getSourceViewer().getTextWidget();
-
+
IDocument document= v.getSourceViewer().getDocument();
if (document != null) {
int offset= v.getSourceViewer().getVisibleRegion().getOffset();
int caret= offset + styledText.getCaretOffset();
-
+
try {
int line=document.getLineOfOffset(caret);
-
+
int lineOffset= document.getLineOffset(line);
int occurrences= 0;
for (int i= lineOffset; i < caret; i++)
if ('\t' == document.getChar(i))
++ occurrences;
-
+
int tabWidth= styledText.getTabs();
int column= caret - lineOffset + (tabWidth -1) * occurrences;
-
+
String format= CompareMessages.TextMergeViewer_cursorPosition_format;
return MessageFormat.format(format,
Integer.toString(line + 1), Integer.toString(column + 1) );
@@ -3786,7 +3786,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
@Override
protected void updateHeader() {
super.updateHeader();
-
+
updateControls();
}
@@ -3797,7 +3797,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
@Override
protected void createToolItems(ToolBarManager tbm) {
fHandlerService= CompareHandlerService.createFor(getCompareConfiguration().getContainer(), fLeft.getSourceViewer().getControl().getShell());
-
+
final String ignoreAncestorActionKey= "action.IgnoreAncestor."; //$NON-NLS-1$
Action ignoreAncestorAction= new Action() {
@Override
@@ -3813,13 +3813,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
ignoreAncestorAction.setChecked(isIgnoreAncestor());
Utilities.initAction(ignoreAncestorAction, getResourceBundle(), ignoreAncestorActionKey);
Utilities.initToggleAction(ignoreAncestorAction, getResourceBundle(), ignoreAncestorActionKey, isIgnoreAncestor());
-
+
fIgnoreAncestorItem= new ActionContributionItem(ignoreAncestorAction);
fIgnoreAncestorItem.setVisible(false);
tbm.appendToGroup("modes", fIgnoreAncestorItem); //$NON-NLS-1$
tbm.add(new Separator());
-
+
Action a= new Action() {
@Override
public void run() {
@@ -3832,7 +3832,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fNextDiff= new ActionContributionItem(a);
tbm.appendToGroup("navigation", fNextDiff); //$NON-NLS-1$
// Don't register this action since it is probably registered by the container
-
+
a= new Action() {
@Override
public void run() {
@@ -3845,7 +3845,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fPreviousDiff= new ActionContributionItem(a);
tbm.appendToGroup("navigation", fPreviousDiff); //$NON-NLS-1$
// Don't register this action since it is probably registered by the container
-
+
a= new Action() {
@Override
public void run() {
@@ -3858,7 +3858,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fNextChange= new ActionContributionItem(a);
tbm.appendToGroup("navigation", fNextChange); //$NON-NLS-1$
fHandlerService.registerAction(a, "org.eclipse.compare.selectNextChange"); //$NON-NLS-1$
-
+
a= new Action() {
@Override
public void run() {
@@ -3883,7 +3883,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fCopyDiffLeftToRightItem.setVisible(isRightEditable());
tbm.appendToGroup("merge", fCopyDiffLeftToRightItem); //$NON-NLS-1$
fHandlerService.registerAction(a, "org.eclipse.compare.copyLeftToRight"); //$NON-NLS-1$
-
+
a= new Action() {
@Override
public void run() {
@@ -3895,14 +3895,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fCopyDiffRightToLeftItem.setVisible(isLeftEditable());
tbm.appendToGroup("merge", fCopyDiffRightToLeftItem); //$NON-NLS-1$
fHandlerService.registerAction(a, "org.eclipse.compare.copyRightToLeft"); //$NON-NLS-1$
-
+
fIgnoreWhitespace= ChangePropertyAction.createIgnoreWhiteSpaceAction(getResourceBundle(), getCompareConfiguration());
fIgnoreWhitespace.setActionDefinitionId(ICompareUIConstants.COMMAND_IGNORE_WHITESPACE);
fLeft.addTextAction(fIgnoreWhitespace);
fRight.addTextAction(fIgnoreWhitespace);
fAncestor.addTextAction(fIgnoreWhitespace);
fHandlerService.registerAction(fIgnoreWhitespace, fIgnoreWhitespace.getActionDefinitionId());
-
+
boolean needsLeftPainter= !isEditorBacked(fLeft.getSourceViewer());
boolean needsRightPainter= !isEditorBacked(fLeft.getSourceViewer());
boolean needsAncestorPainter= !isEditorBacked(fAncestor.getSourceViewer());
@@ -3910,13 +3910,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
new MergeSourceViewer[] {fLeft, fRight, fAncestor},
new boolean[] {needsLeftPainter, needsRightPainter, needsAncestorPainter });
fHandlerService.registerAction(showWhitespaceAction, ITextEditorActionDefinitionIds.SHOW_WHITESPACE_CHARACTERS);
-
+
toggleLineNumbersAction = new LineNumberRulerToggleAction(CompareMessages.TextMergeViewer_16,
new MergeSourceViewer[] { fLeft, fRight, fAncestor },
AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER);
fHandlerService.registerAction(toggleLineNumbersAction, ITextEditorActionDefinitionIds.LINENUMBER_TOGGLE);
}
-
+
private void configureCompareFilterActions(Object input, Object ancestor,
Object left, Object right) {
if (getCompareConfiguration() != null) {
@@ -4055,20 +4055,20 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
@Override
protected void handlePropertyChangeEvent(PropertyChangeEvent event) {
String key= event.getProperty();
-
+
if (key.equals(CompareConfiguration.IGNORE_WHITESPACE)
|| key.equals(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS)
|| (key.equals(ChangeCompareFilterPropertyAction.COMPARE_FILTERS) && getCompareConfiguration()
.getProperty(
ChangeCompareFilterPropertyAction.COMPARE_FILTERS_INITIALIZING) == null)) {
-
+
fShowPseudoConflicts= fPreferenceStore.getBoolean(ComparePreferencePage.SHOW_PSEUDO_CONFLICTS);
-
+
update(true);
// selectFirstDiff(true);
if (fFocusPart != null)
handleSelectionChanged(fFocusPart);
-
+
// } else if (key.equals(ComparePreferencePage.USE_SPLINES)) {
// fUseSplines= fPreferenceStore.getBoolean(ComparePreferencePage.USE_SPLINES);
// invalidateLines();
@@ -4079,17 +4079,17 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fBasicCenterCurve= null;
updateControls();
invalidateLines();
-
+
} else if (key.equals(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES)) {
fHighlightTokenChanges= fPreferenceStore.getBoolean(ComparePreferencePage.HIGHLIGHT_TOKEN_CHANGES);
updateControls();
updatePresentation();
-
+
// } else if (key.equals(ComparePreferencePage.USE_RESOLVE_UI)) {
// fUseResolveUI= fPreferenceStore.getBoolean(ComparePreferencePage.USE_RESOLVE_UI);
// updateResolveStatus();
// invalidateLines();
-
+
} else if (key.equals(fSymbolicFontName)) {
updateFont();
invalidateLines();
@@ -4098,11 +4098,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
updateColors(null);
invalidateLines();
invalidateTextPresentation();
-
+
} else if (key.equals(ComparePreferencePage.SYNCHRONIZE_SCROLLING)) {
boolean b= fPreferenceStore.getBoolean(ComparePreferencePage.SYNCHRONIZE_SCROLLING);
setSyncScrolling(b);
-
+
} else if (key.equals(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND)) {
if (!fIsUsingSystemBackground) {
setBackgroundColor(createColor(fPreferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND));
@@ -4136,23 +4136,23 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
} else {
super.handlePropertyChangeEvent(event);
-
+
if (key.equals(ICompareUIConstants.PROP_IGNORE_ANCESTOR)) {
update(true);
selectFirstDiff(true);
}
}
}
-
+
private void selectFirstDiff(boolean first) {
-
+
if (fLeft == null || fRight == null) {
return;
}
if (fLeft.getSourceViewer().getDocument() == null || fRight.getSourceViewer().getDocument() == null) {
return;
}
-
+
Diff firstDiff= null;
if (first)
firstDiff= findNext(fRight, -1, -1, false);
@@ -4160,27 +4160,27 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
firstDiff= findPrev(fRight, 9999999, 9999999, false);
setCurrentDiff(firstDiff, true);
}
-
-
-
+
+
+
private void setSyncScrolling(boolean newMode) {
if (fSynchronizedScrolling != newMode) {
fSynchronizedScrolling= newMode;
-
+
scrollVertical(0, 0, 0, null);
-
+
// throw away central control (Sash or Canvas)
Control center= getCenterControl();
if (center != null && !center.isDisposed())
center.dispose();
-
+
fLeft.getSourceViewer().getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
fRight.getSourceViewer().getTextWidget().getVerticalBar().setVisible(!fSynchronizedScrolling);
-
+
fComposite.layout(true);
}
}
-
+
@Override
protected void updateToolItems() {
if (fCopyDiffLeftToRightItem != null) {
@@ -4195,7 +4195,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (!isPatchHunk()){
if (fIgnoreAncestorItem != null)
fIgnoreAncestorItem.setVisible(isThreeWay());
-
+
if (fCopyDiffLeftToRightItem != null) {
IAction a= fCopyDiffLeftToRightItem.getAction();
if (a != null)
@@ -4209,13 +4209,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
super.updateToolItems();
}
-
+
//---- painting lines
-
+
private void updateLines(IDocument d) {
boolean left= false;
boolean right= false;
-
+
// FIXME: this optimization is incorrect because
// it doesn't take replace operations into account where
// the old and new line count does not differ
@@ -4228,7 +4228,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
right= fRightLineCount != l;
fRightLineCount= l;
}
-
+
if (left || right) {
if (left) {
if (fLeftCanvas != null)
@@ -4245,7 +4245,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
refreshBirdsEyeView();
}
}
-
+
private void invalidateLines() {
if (isThreeWay() && isAncestorVisible()) {
if (Utilities.okToUse(fAncestorCanvas))
@@ -4253,23 +4253,23 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fAncestor != null && fAncestor.isControlOkToUse())
fAncestor.getSourceViewer().getTextWidget().redraw();
}
-
+
if (Utilities.okToUse(fLeftCanvas))
fLeftCanvas.redraw();
-
+
if (fLeft != null && fLeft.isControlOkToUse())
fLeft.getSourceViewer().getTextWidget().redraw();
-
+
if (Utilities.okToUse(getCenterControl()))
getCenterControl().redraw();
-
+
if (fRight != null && fRight.isControlOkToUse())
fRight.getSourceViewer().getTextWidget().redraw();
-
+
if (Utilities.okToUse(fRightCanvas))
fRightCanvas.redraw();
}
-
+
private boolean showResolveUI() {
if (!isThreeWay() || isIgnoreAncestor())
return false;
@@ -4280,13 +4280,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
// we only enable the new resolve UI if exactly one side is editable
return isLeftEditable() || isRightEditable();
}
-
+
private void paintCenter(Canvas canvas, GC g) {
-
+
Display display= canvas.getDisplay();
-
+
checkForColorUpdate(display);
-
+
if (! fSynchronizedScrolling)
return;
@@ -4297,53 +4297,53 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
Point size= canvas.getSize();
int x= 0;
int w= size.x;
-
+
g.setBackground(canvas.getBackground());
g.fillRectangle(x+1, 0, w-2, size.y);
-
+
if (!fIsMotif) {
// draw thin line between center ruler and both texts
g.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
g.fillRectangle(0, 0, 1, size.y);
g.fillRectangle(w-1, 0, 1, size.y);
}
-
+
if (! fHighlightRanges)
return;
if (fMerger.hasChanges()) {
int lshift= fLeft.getVerticalScrollOffset();
int rshift= fRight.getVerticalScrollOffset();
-
+
Point region= new Point(0, 0);
-
+
for (Iterator<?> iterator = fMerger.changesIterator(); iterator.hasNext();) {
Diff diff = (Diff) iterator.next();
if (diff.isDeleted())
continue;
-
+
if (fShowCurrentOnly2 && !isCurrentDiff(diff))
continue;
fLeft.getLineRange(diff.getPosition(LEFT_CONTRIBUTOR), region);
int ly= (region.x * lineHeightLeft) + lshift;
int lh= region.y * lineHeightLeft;
-
+
fRight.getLineRange(diff.getPosition(RIGHT_CONTRIBUTOR), region);
int ry= (region.x * lineHeightRight) + rshift;
int rh= region.y * lineHeightRight;
-
+
if (Math.max(ly+lh, ry+rh) < 0)
continue;
if (Math.min(ly, ry) >= visibleHeight)
break;
-
+
fPts[0]= x; fPts[1]= ly; fPts[2]= w; fPts[3]= ry;
fPts[6]= x; fPts[7]= ly+lh; fPts[4]= w; fPts[5]= ry+rh;
-
+
Color fillColor= getColor(display, getFillColor(diff));
Color strokeColor= getColor(display, getStrokeColor(diff));
-
+
if (fUseSingleLine) {
int w2= 3;
@@ -4392,22 +4392,22 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
g.drawLine(fPts[6], fPts[7], fPts[4], fPts[5]);
}
}
-
+
if (fUseSingleLine && isAnySideEditable()) {
// draw resolve state
int cx= (w-RESOLVE_SIZE)/2;
int cy= ((ly+lh/2) + (ry+rh/2) - RESOLVE_SIZE)/2;
-
+
g.setBackground(fillColor);
g.fillRectangle(cx, cy, RESOLVE_SIZE, RESOLVE_SIZE);
-
+
g.setForeground(strokeColor);
g.drawRectangle(cx, cy, RESOLVE_SIZE, RESOLVE_SIZE);
}
}
}
}
-
+
private int[] getCenterCurvePoints(int startx, int starty, int endx, int endy) {
if (fBasicCenterCurve == null)
buildBaseCenterCurve(endx-startx);
@@ -4431,9 +4431,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
private void paintSides(GC g, MergeSourceViewer tp, Canvas canvas, boolean right) {
-
+
Display display= canvas.getDisplay();
-
+
int lineHeight= tp.getSourceViewer().getTextWidget().getLineHeight();
int visibleHeight= tp.getViewportHeight();
@@ -4441,7 +4441,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
int x= 0;
int w= fMarginWidth;
int w2= w/2;
-
+
g.setBackground(canvas.getBackground());
g.fillRectangle(x, 0, w, size.y);
@@ -4459,32 +4459,32 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fMerger.hasChanges()) {
int shift= tp.getVerticalScrollOffset() + (2-LW);
-
+
Point region= new Point(0, 0);
char leg = getLeg(tp);
for (Iterator<?> iterator = fMerger.changesIterator(); iterator.hasNext();) {
Diff diff = (Diff) iterator.next();
if (diff.isDeleted())
continue;
-
+
if (fShowCurrentOnly2 && !isCurrentDiff(diff))
continue;
tp.getLineRange(diff.getPosition(leg), region);
int y= (region.x * lineHeight) + shift;
int h= region.y * lineHeight;
-
+
if (y+h < 0)
continue;
if (y >= visibleHeight)
break;
-
+
g.setBackground(getColor(display, getFillColor(diff)));
if (right)
g.fillRectangle(x, y, w2, h);
else
g.fillRectangle(x+w2, y, w2, h);
-
+
g.setLineWidth(0 /* LW */);
g.setForeground(getColor(display, getStrokeColor(diff)));
if (right)
@@ -4494,9 +4494,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
private void paint(PaintEvent event, MergeSourceViewer tp) {
-
+
if (! fHighlightRanges)
return;
if (!fMerger.hasChanges())
@@ -4504,37 +4504,37 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
Control canvas= (Control) event.widget;
GC g= event.gc;
-
+
Display display= canvas.getDisplay();
-
+
int lineHeight= tp.getSourceViewer().getTextWidget().getLineHeight();
int w= canvas.getSize().x;
int shift= tp.getVerticalScrollOffset() + (2-LW);
int maxh= event.y+event.height; // visibleHeight
-
+
//if (fIsMotif)
shift+= fTopInset;
-
+
Point range= new Point(0, 0);
-
+
char leg = getLeg(tp);
for (Iterator<?> iterator = fMerger.changesIterator(); iterator.hasNext();) {
Diff diff = (Diff) iterator.next();
if (diff.isDeleted())
continue;
-
+
if (fShowCurrentOnly && !isCurrentDiff(diff))
continue;
tp.getLineRange(diff.getPosition(leg), range);
int y= (range.x * lineHeight) + shift;
int h= range.y * lineHeight;
-
+
if (y+h < event.y)
continue;
if (y > maxh)
break;
-
+
g.setBackground(getColor(display, getStrokeColor(diff)));
g.fillRectangle(0, y-1, w, LW);
g.fillRectangle(0, y+h-1, w, LW);
@@ -4563,10 +4563,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return selected ? selected_fill : OUTGOING_FILL;
}
-
+
private RGB getStrokeColor(Diff diff) {
boolean selected= fCurrentDiff != null && fCurrentDiff.getParent() == diff;
-
+
if (isThreeWay() && !isIgnoreAncestor()) {
switch (diff.getKind()) {
case RangeDifference.RIGHT:
@@ -4586,7 +4586,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return selected ? SELECTED_OUTGOING : OUTGOING;
}
-
+
private Color getColor(Display display, RGB rgb) {
if (rgb == null)
return null;
@@ -4599,7 +4599,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return c;
}
-
+
static RGB interpolate(RGB fg, RGB bg, double scale) {
if (fg != null && bg != null)
return new RGB(
@@ -4613,9 +4613,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return bg;
return new RGB(128, 128, 128); // a gray
}
-
+
//---- Navigating and resolving Diffs
-
+
private Diff getNextVisibleDiff(boolean down, boolean deep) {
Diff diff= null;
MergeSourceViewer part= getNavigationPart();
@@ -4637,7 +4637,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return diff;
}
-
+
private Diff internalGetNextDiff(boolean down, boolean deep, MergeSourceViewer part, Point s) {
if (fMerger.hasChanges()) {
if (down)
@@ -4646,7 +4646,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
private MergeSourceViewer getNavigationPart() {
MergeSourceViewer part= fFocusPart;
if (part == null)
@@ -4657,7 +4657,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private Diff getWrappedDiff(Diff diff, boolean down) {
return fMerger.getWrappedDiff(diff, down);
}
-
+
/*
* Returns true if end (or beginning) of document reached.
*/
@@ -4682,14 +4682,14 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return diff == null;
}
-
+
private void endOfDocumentReached(boolean down) {
Control c= getControl();
if (Utilities.okToUse(c)) {
handleEndOfDocumentReached(c.getShell(), down);
}
}
-
+
private void handleEndOfDocumentReached(Shell shell, boolean next) {
IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
String value = store.getString(ICompareUIConstants.PREF_NAVIGATION_END_ACTION);
@@ -4735,7 +4735,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
private void performEndOfDocumentAction(Shell shell, IPreferenceStore store, String key, boolean next) {
String value = store.getString(key);
if (value.equals(ICompareUIConstants.PREF_VALUE_DO_NOTHING)) {
@@ -4751,7 +4751,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
selectFirstDiff(next);
}
}
-
+
private boolean hasNextElement(boolean down) {
ICompareNavigator navigator = getCompareConfiguration().getContainer().getNavigator();
if (navigator instanceof CompareNavigator) {
@@ -4770,11 +4770,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
char contributor = getLeg(tp);
return fMerger.findDiff(contributor, rangeStart, rangeEnd);
}
-
+
private Diff findNext(MergeSourceViewer tp, int start, int end, boolean deep) {
return fMerger.findNext(getLeg(tp), start, end, deep);
}
-
+
private Diff findPrev(MergeSourceViewer tp, int start, int end, boolean deep) {
return fMerger.findPrev(getLeg(tp), start, end, deep);
}
@@ -4787,7 +4787,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private void setCurrentDiff(Diff d, boolean revealAndSelect) {
setCurrentDiff(d, revealAndSelect, false);
}
-
+
/*
* Set the currently active Diff and update the toolbars controls and lines.
* If <code>revealAndSelect</code> is <code>true</code> the Diff is revealed and
@@ -4805,7 +4805,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fRightToLeftButton.setVisible(false);
if (d != null && revealAndSelect) {
-
+
// before we set fCurrentDiff we change the selection
// so that the paint code uses the old background colors
// otherwise selection isn't drawn correctly
@@ -4820,7 +4820,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fLeft.setSelection(new Position(d.getPosition(LEFT_CONTRIBUTOR).offset, 0));
fRight.setSelection(new Position(d.getPosition(RIGHT_CONTRIBUTOR).offset, 0));
}
-
+
// now switch diffs
saveDiff();
fCurrentDiff= d;
@@ -4840,7 +4840,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* Smart determines whether
*/
private void revealDiff(Diff d, boolean smart) {
-
+
boolean ancestorIsVisible= false;
boolean leftIsVisible= false;
boolean rightIsVisible= false;
@@ -4850,7 +4850,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
// find the starting line of the diff in all text widgets
int ls= fLeft.getLineRange(d.getPosition(LEFT_CONTRIBUTOR), region).x;
int rs= fRight.getLineRange(d.getPosition(RIGHT_CONTRIBUTOR), region).x;
-
+
if (isThreeWay() && !isIgnoreAncestor()) {
int as= fAncestor.getLineRange(d.getPosition(ANCESTOR_CONTRIBUTOR), region).x;
if (as >= fAncestor.getSourceViewer().getTopIndex() && as <= fAncestor.getSourceViewer().getBottomIndex())
@@ -4867,7 +4867,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
// vertical scrolling
if (!leftIsVisible || !rightIsVisible) {
int avpos= 0, lvpos= 0, rvpos= 0;
-
+
MergeSourceViewer allButThis= null;
if (leftIsVisible) {
avpos= lvpos= rvpos= realToVirtualPosition(LEFT_CONTRIBUTOR, fLeft.getSourceViewer().getTopIndex());
@@ -4905,13 +4905,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (rvpos < 0)
rvpos= 0;
}
-
+
scrollVertical(avpos, lvpos, rvpos, allButThis);
-
+
if (fVScrollBar != null)
fVScrollBar.setSelection(avpos);
}
-
+
// horizontal scrolling
if (d.isToken()) {
// we only scroll horizontally for token diffs
@@ -4925,7 +4925,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
hscroll(fRight);
}
}
-
+
private static void reveal(MergeSourceViewer v, Position p) {
if (v != null && p != null) {
StyledText st= v.getSourceViewer().getTextWidget();
@@ -4936,7 +4936,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
private static void hscroll(MergeSourceViewer v) {
if (v != null) {
StyledText st= v.getSourceViewer().getTextWidget();
@@ -4944,9 +4944,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
st.setHorizontalIndex(0);
}
}
-
+
//--------------------------------------------------------------------------------
-
+
void copyAllUnresolved(boolean leftToRight) {
if (fMerger.hasChanges() && isThreeWay() && !isIgnoreAncestor()) {
IRewriteTarget target= leftToRight ? fRight.getSourceViewer().getRewriteTarget() : fLeft.getSourceViewer().getRewriteTarget();
@@ -4984,7 +4984,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
}
}
-
+
/*
* Copy whole document from one side to the other.
*/
@@ -5055,7 +5055,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private void copyDiffRightToLeft() {
copy(fCurrentDiff, false, false);
}
-
+
/*
* Copy the contents of the given diff from one side to the other.
*/
@@ -5076,7 +5076,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* Returns true if copy was successful.
*/
private boolean copy(Diff diff, boolean leftToRight) {
-
+
if (diff != null) {
if (!validateChange(!leftToRight))
return false;
@@ -5099,34 +5099,34 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
info = fLeftContributor;
else
info = fRightContributor;
-
+
return info.validateChange();
}
//---- scrolling
-
+
/*
* The height of the TextEditors in lines.
*/
private int getViewportHeight() {
StyledText te= fLeft.getSourceViewer().getTextWidget();
-
+
int vh= te.getClientArea().height;
if (vh == 0) {
Rectangle trim= te.computeTrim(0, 0, 0, 0);
int scrollbarHeight= trim.height;
-
+
int headerHeight= getHeaderHeight();
-
+
Composite composite= (Composite) getControl();
Rectangle r= composite.getClientArea();
-
+
vh= r.height-headerHeight-scrollbarHeight;
}
return vh / te.getLineHeight();
}
-
+
/*
* Returns the virtual position for the given view position.
*/
@@ -5135,11 +5135,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return vpos;
return fMerger.realToVirtualPosition(contributor, vpos);
}
-
+
private void scrollVertical(int avpos, int lvpos, int rvpos, MergeSourceViewer allBut) {
-
+
int s= 0;
-
+
if (fSynchronizedScrolling) {
s= fMerger.getVirtualHeight() - rvpos;
int height= fRight.getViewportLines()/4;
@@ -5150,7 +5150,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
fInScrolling= true;
-
+
if (isThreeWay() && allBut != fAncestor) {
if (fSynchronizedScrolling || allBut == null) {
int y= virtualToRealPosition(ANCESTOR_CONTRIBUTOR, avpos+s)-s;
@@ -5171,38 +5171,38 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
fRight.vscroll(y);
}
}
-
+
fInScrolling= false;
-
+
if (isThreeWay() && fAncestorCanvas != null)
fAncestorCanvas.repaint();
-
+
if (fLeftCanvas != null)
fLeftCanvas.repaint();
-
+
Control center= getCenterControl();
if (center instanceof BufferedCanvas)
((BufferedCanvas)center).repaint();
-
+
if (fRightCanvas != null)
fRightCanvas.repaint();
}
-
+
/*
* Updates Scrollbars with viewports.
*/
private void syncViewport(MergeSourceViewer w) {
-
+
if (fInScrolling)
return;
int ix= w.getSourceViewer().getTopIndex();
int ix2= w.getDocumentRegionOffset();
-
+
int viewPosition= realToVirtualPosition(getLeg(w), ix-ix2);
-
+
scrollVertical(viewPosition, viewPosition, viewPosition, w); // scroll all but the given views
-
+
if (fVScrollBar != null) {
int value= Math.max(0, Math.min(viewPosition, fMerger.getVirtualHeight() - getViewportHeight()));
fVScrollBar.setSelection(value);
@@ -5213,19 +5213,19 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
/**
*/
private void updateVScrollBar() {
-
+
if (Utilities.okToUse(fVScrollBar) && fSynchronizedScrolling) {
int virtualHeight= fMerger.getVirtualHeight();
int viewPortHeight= getViewportHeight();
int pageIncrement= viewPortHeight-1;
int thumb= (viewPortHeight > virtualHeight) ? virtualHeight : viewPortHeight;
-
+
fVScrollBar.setPageIncrement(pageIncrement);
fVScrollBar.setMaximum(virtualHeight);
fVScrollBar.setThumb(thumb);
}
}
-
+
/*
* maps given virtual position into a real view position of this view.
*/
@@ -5234,29 +5234,29 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return v;
return fMerger.virtualToRealPosition(contributor, v);
}
-
+
@Override
void flushLeftSide(Object oldInput, IProgressMonitor monitor){
IMergeViewerContentProvider content= getMergeContentProvider();
Object leftContent = content.getLeftContent(oldInput);
-
+
if (leftContent != null && getCompareConfiguration().isLeftEditable() && isLeftDirty()) {
if (fLeftContributor.hasSharedDocument(leftContent)) {
if (flush(fLeftContributor))
setLeftDirty(false);
}
}
-
+
if (!(content instanceof MergeViewerContentProvider) || isLeftDirty()) {
super.flushLeftSide(oldInput, monitor);
}
}
-
+
@Override
void flushRightSide(Object oldInput, IProgressMonitor monitor){
IMergeViewerContentProvider content= getMergeContentProvider();
Object rightContent = content.getRightContent(oldInput);
-
+
if (rightContent != null && getCompareConfiguration().isRightEditable() && isRightDirty()) {
if (fRightContributor.hasSharedDocument(rightContent)) {
if (flush(fRightContributor))
@@ -5268,7 +5268,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
super.flushRightSide(oldInput, monitor);
}
}
-
+
@Override
protected void flushContent(Object oldInput, IProgressMonitor monitor) {
flushLeftSide(oldInput, monitor);
@@ -5280,7 +5280,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
super.flushContent(oldInput, monitor);
}
}
-
+
private boolean flush(final ContributorInfo info) {
try {
return info.flush();
@@ -5353,7 +5353,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return null;
}
-
+
@Override
protected void handleCompareInputChange() {
try {
@@ -5372,9 +5372,9 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
if (fSynchronizedScrolling) {
fSynchronziedScrollPosition = fVScrollBar.getSelection();
}
-
+
}
-
+
private void endRefresh() {
isRefreshing--;
fLeftContributor.cacheSelection(null);
@@ -5386,11 +5386,11 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private void synchronizedScrollVertical(int vpos) {
scrollVertical(vpos, vpos, vpos, null);
}
-
+
private boolean isIgnoreAncestor() {
return Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false);
}
-
+
/* package */ void update(boolean includeControls) {
if (getControl().isDisposed())
return;
@@ -5399,10 +5399,10 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
} else {
doDiff();
}
-
+
if (includeControls)
updateControls();
-
+
updateVScrollBar();
updatePresentation();
}
@@ -5420,13 +5420,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
private boolean isPatchHunk() {
return Utilities.isHunk(getInput());
}
-
+
private boolean isPatchHunkOk() {
if (isPatchHunk())
return Utilities.isHunkOk(getInput());
return false;
}
-
+
/**
* Return the provided start position of the hunk in the target file.
* @return the provided start position of the hunk in the target file
@@ -5449,13 +5449,13 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
}
return 0;
}
-
+
private IFindReplaceTarget getFindReplaceTarget() {
if (fFindReplaceTarget == null)
fFindReplaceTarget= new FindReplaceTarget();
return fFindReplaceTarget;
}
-
+
/* package */ char getLeg(MergeSourceViewer w) {
if (w == fLeft)
return LEFT_CONTRIBUTOR;
@@ -5465,7 +5465,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return ANCESTOR_CONTRIBUTOR;
return ANCESTOR_CONTRIBUTOR;
}
-
+
private boolean isCurrentDiff(Diff diff) {
if (diff == null)
return false;
@@ -5475,7 +5475,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
return true;
return false;
}
-
+
private boolean isNavigationPossible() {
if (fCurrentDiff == null && fMerger.hasChanges())
return true;
@@ -5493,7 +5493,7 @@ public class TextMergeViewer extends ContentMergeViewer implements IAdaptable {
* {@link ChangeEncodingAction}. It provides implementation of methods that
* are used by the action by delegating them to {@link ContributorInfo} that
* corresponds to the side that has focus.
- *
+ *
* @return the text editor adapter
*/
private ITextEditor getTextEditorAdapter() {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TokenComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TokenComparator.java
index e1a30b403..1ceed1234 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TokenComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TokenComparator.java
@@ -35,20 +35,20 @@ public class TokenComparator implements ITokenComparator {
* @param text the string that is split into token
*/
public TokenComparator(String text) {
-
+
Assert.isNotNull(text);
fText= text;
-
+
int length= fText.length();
fStarts= new int[length]; // pessimistic assumption!
fLengths= new int[length];
fCount= 0;
-
+
char lastCategory= 0; // 0: no category
for (int i= 0; i < length; i++) {
char c= fText.charAt(i);
-
+
char category= '?'; // unspecified category
if (Character.isWhitespace(c))
category= ' '; // white space category
@@ -58,7 +58,7 @@ public class TokenComparator implements ITokenComparator {
category= 'a'; // letters
else if (c == '\"' || c == '\'')
category= '\"'; // quotes (see bug 198671)
-
+
if (category != lastCategory) {
// start a new token
fStarts[fCount++]= i;
@@ -92,7 +92,7 @@ public class TokenComparator implements ITokenComparator {
return fLengths[index];
return 0;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.rangedifferencer.IRangeComparator#rangesEqual(int, org.eclipse.compare.rangedifferencer.IRangeComparator, int)
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
index 95a739ea0..24f7ea9df 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AbstractViewer.java
@@ -21,19 +21,19 @@ public abstract class AbstractViewer extends Viewer {
public void setInput(Object input) {
// empty default implementation
}
-
+
public Object getInput() {
return null;
}
-
+
public ISelection getSelection() {
return StructuredSelection.EMPTY;
}
-
+
public void setSelection(ISelection s, boolean reveal) {
// empty default implementation
}
-
+
public void refresh() {
// empty default implementation
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
index 1ee887caa..3215be92f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryAction.java
@@ -25,33 +25,33 @@ import org.eclipse.core.runtime.*;
public class AddFromHistoryAction extends BaseCompareAction {
-
+
private static final String BUNDLE_NAME= "org.eclipse.compare.internal.AddFromHistoryAction"; //$NON-NLS-1$
public AddFromHistoryAction() {
// empty default implementation
}
-
+
protected boolean isEnabled(ISelection selection) {
return Utilities.getResources(selection).length == 1;
}
protected void run(ISelection selection) {
-
+
ResourceBundle bundle= ResourceBundle.getBundle(BUNDLE_NAME);
String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
+
Shell parentShell= CompareUIPlugin.getShell();
AddFromHistoryDialog dialog= null;
Object[] s= Utilities.getResources(selection);
-
+
for (int i= 0; i < s.length; i++) {
Object o= s[i];
if (o instanceof IContainer) {
IContainer container= (IContainer) o;
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(parentShell);
+
+ ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(parentShell);
IProgressMonitor pm= pmdialog.getProgressMonitor();
IFile[] states= null;
try {
@@ -59,24 +59,24 @@ public class AddFromHistoryAction extends BaseCompareAction {
} catch (CoreException ex) {
pm.done();
}
-
+
// There could be a recently deleted file at the same path as
// the container. If such a file is the only one to restore, we
// should not suggest to restore it, so set states to null.
if (states.length == 1 && states[0].getFullPath().equals(container.getFullPath()))
states = null;
-
+
if (states == null || states.length <= 0) {
String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
MessageDialog.openInformation(parentShell, title, msg);
return;
}
-
+
if (dialog == null) {
dialog= new AddFromHistoryDialog(parentShell, bundle);
dialog.setHelpContextId(ICompareContextIds.ADD_FROM_HISTORY_DIALOG);
}
-
+
if (dialog.select(container, states)) {
AddFromHistoryDialog.HistoryInput[] selected = dialog
.getSelected();
@@ -96,7 +96,7 @@ public class AddFromHistoryAction extends BaseCompareAction {
}
}
}
-
+
void createContainers(IResource resource) throws CoreException {
IContainer container= resource.getParent();
if (container instanceof IFolder) {
@@ -107,22 +107,22 @@ public class AddFromHistoryAction extends BaseCompareAction {
}
}
}
-
+
private void updateWorkspace(final ResourceBundle bundle, Shell shell,
final AddFromHistoryDialog.HistoryInput[] selected)
throws InvocationTargetException, InterruptedException {
-
+
WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
public void execute(IProgressMonitor pm) throws InvocationTargetException {
try {
String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$
pm.beginTask(taskName, selected.length);
-
+
for (int i= 0; i < selected.length; i++) {
IFile file= selected[i].fFile;
IFileState fileState= selected[i].fFileState;
createContainers(file);
-
+
SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 1);
try {
file.create(fileState.getContents(), false, subMonitor);
@@ -137,8 +137,8 @@ public class AddFromHistoryAction extends BaseCompareAction {
}
}
};
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
+
+ ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
+ pmdialog.run(false, true, operation);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
index 7be81d377..beaff9d30 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BaseCompareAction.java
@@ -18,7 +18,7 @@ import org.eclipse.ui.IActionDelegate;
public abstract class BaseCompareAction implements IActionDelegate {
private ISelection fSelection;
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
@@ -34,10 +34,10 @@ public abstract class BaseCompareAction implements IActionDelegate {
if (action != null)
action.setEnabled(isEnabled(fSelection));
}
-
+
protected boolean isEnabled(ISelection selection) {
return false;
}
-
+
abstract protected void run(ISelection selection);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
index 54becc37b..c730b9768 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BinaryCompareViewer.java
@@ -37,7 +37,7 @@ import com.ibm.icu.text.MessageFormat;
public class BinaryCompareViewer extends AbstractViewer {
private static final String BUNDLE_NAME = "org.eclipse.compare.internal.BinaryCompareViewerResources"; //$NON-NLS-1$
-
+
private static final int EOF = -1;
private ICompareInput fInput;
private ResourceBundle fBundle;
@@ -45,13 +45,13 @@ public class BinaryCompareViewer extends AbstractViewer {
private Composite fComposite;
private Label fMessage;
private CompareConfiguration compareConfiguration;
-
+
public BinaryCompareViewer(Composite parent, final CompareConfiguration cc) {
-
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICompareContextIds.BINARY_COMPARE_VIEW);
fBundle= ResourceBundle.getBundle(BUNDLE_NAME);
-
+
fComposite= new Composite(parent, SWT.NONE);
RowLayout rowLayout = new RowLayout();
rowLayout.type = SWT.VERTICAL;
@@ -59,7 +59,7 @@ public class BinaryCompareViewer extends AbstractViewer {
fMessage= new Label(fComposite, SWT.WRAP);
fComposite.setData(CompareUI.COMPARE_VIEWER_TITLE, Utilities.getString(fBundle, "title")); //$NON-NLS-1$
-
+
compareConfiguration = cc != null ? cc : new CompareConfiguration();
if (compareConfiguration.getContainer() instanceof CompareEditorInput) {
@@ -80,12 +80,12 @@ public class BinaryCompareViewer extends AbstractViewer {
InputStream left= null;
InputStream right= null;
-
+
String message= null;
try {
left= getStream(fInput.getLeft());
right= getStream(fInput.getRight());
-
+
if (left != null && right != null) {
int pos= 0;
while (true) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
index 2b3da3a4e..aea48782b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedCanvas.java
@@ -22,7 +22,7 @@ public abstract class BufferedCanvas extends Canvas {
//private static final boolean USE_DOUBLE_BUFFER= !"carbon".equals(SWT.getPlatform()); //$NON-NLS-1$
private static final boolean USE_DOUBLE_BUFFER= true;
-
+
/** The drawable for double buffering */
Image fBuffer;
@@ -61,7 +61,7 @@ public abstract class BufferedCanvas extends Canvas {
* Double buffer drawing.
*/
void doubleBufferPaint(GC dest) {
-
+
if (!USE_DOUBLE_BUFFER) {
doPaint(dest);
return;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
index cf9afd304..582aa099d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/BufferedResourceNode.java
@@ -21,10 +21,10 @@ import org.eclipse.compare.structuremergeviewer.IStructureComparator;
* A buffer for a workspace resource.
*/
public class BufferedResourceNode extends ResourceNode {
-
+
private boolean fDirty= false;
private IFile fDeleteFile;
-
+
/**
* Creates a <code>ResourceNode</code> for the given resource.
*
@@ -33,34 +33,34 @@ public class BufferedResourceNode extends ResourceNode {
public BufferedResourceNode(IResource resource) {
super(resource);
}
-
+
/*
* Returns <code>true</code> if buffer contains uncommitted changes.
*/
public boolean isDirty() {
return fDirty;
}
-
+
protected IStructureComparator createChild(IResource child) {
return new BufferedResourceNode(child);
}
-
+
public void setContent(byte[] contents) {
fDirty= true;
super.setContent(contents);
- }
+ }
/*
* Commits buffered contents to resource.
*/
public void commit(IProgressMonitor pm) throws CoreException {
if (fDirty) {
-
+
if (fDeleteFile != null) {
fDeleteFile.delete(true, true, pm);
return;
}
-
+
IResource resource= getResource();
if (resource instanceof IFile) {
@@ -84,9 +84,9 @@ public class BufferedResourceNode extends ResourceNode {
}
}
}
-
+
public ITypedElement replace(ITypedElement child, ITypedElement other) {
-
+
if (child == null) { // add resource
// create a node without a resource behind it!
IResource resource= getResource();
@@ -96,7 +96,7 @@ public class BufferedResourceNode extends ResourceNode {
child= new BufferedResourceNode(file);
}
}
-
+
if (other == null) { // delete resource
IResource resource= getResource();
if (resource instanceof IFolder) {
@@ -109,10 +109,10 @@ public class BufferedResourceNode extends ResourceNode {
}
return null;
}
-
+
if (other instanceof IStreamContentAccessor && child instanceof IEditableContent) {
IEditableContent dst= (IEditableContent) child;
-
+
try {
InputStream is= ((IStreamContentAccessor)other).getContents();
byte[] bytes= Utilities.readBytes(is);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
index 7efc7b371..bdea732b0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ChangePropertyAction.java
@@ -56,7 +56,7 @@ public class ChangePropertyAction extends Action implements IPropertyChangeListe
super.setChecked(state);
Utilities.initToggleAction(this, fBundle, fPrefix, state);
}
-
+
public void setCompareConfiguration(CompareConfiguration cc) {
if (fCompareConfiguration != null)
fCompareConfiguration.removePropertyChangeListener(this);
@@ -71,12 +71,12 @@ public class ChangePropertyAction extends Action implements IPropertyChangeListe
setChecked(Utilities.getBoolean(fCompareConfiguration, fPropertyKey, false));
}
}
-
+
public void dispose(){
if (fCompareConfiguration != null)
fCompareConfiguration.removePropertyChangeListener(this);
}
-
+
public void widgetDisposed(DisposeEvent e) {
dispose();
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
index b9a557f3c..54c30e356 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java
@@ -50,10 +50,10 @@ public class CompareAction extends BaseCompareAction implements IObjectActionDel
// buffered merge mode: don't ask for confirmation
// when switching between modified resources
cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, Boolean.FALSE);
-
+
// uncomment following line to have separate outline view
//cc.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, Boolean.TRUE);
-
+
fInput= new ResourceCompareInput(cc);
}
return fInput.isEnabled(selection);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContainer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContainer.java
index ba9ea7baa..59c19608d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContainer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareContainer.java
@@ -23,7 +23,7 @@ import org.eclipse.ui.*;
import org.eclipse.ui.services.IServiceLocator;
public class CompareContainer implements ICompareContainer {
-
+
private WorkerJob worker;
/* (non-Javadoc)
@@ -32,7 +32,7 @@ public class CompareContainer implements ICompareContainer {
public void setStatusMessage(String message) {
// Do nothing, by default
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#addCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
*/
@@ -40,7 +40,7 @@ public class CompareContainer implements ICompareContainer {
ICompareInputChangeListener listener) {
input.addCompareInputChangeListener(listener);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#removeCompareInputChangeListener(org.eclipse.compare.structuremergeviewer.ICompareInput, org.eclipse.compare.structuremergeviewer.ICompareInputChangeListener)
*/
@@ -48,7 +48,7 @@ public class CompareContainer implements ICompareContainer {
ICompareInputChangeListener listener) {
input.removeCompareInputChangeListener(listener);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#registerContextMenu(org.eclipse.jface.action.MenuManager, org.eclipse.jface.viewers.ISelectionProvider)
*/
@@ -56,14 +56,14 @@ public class CompareContainer implements ICompareContainer {
ISelectionProvider selectionProvider) {
// Nothing to do
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#getServiceLocator()
*/
public IServiceLocator getServiceLocator() {
return null;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#getActionBars()
*/
@@ -79,7 +79,7 @@ public class CompareContainer implements ICompareContainer {
throws InvocationTargetException, InterruptedException {
PlatformUI.getWorkbench().getProgressService().run(fork, cancelable, runnable);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#getNavigator()
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
index cf303c42d..aff33c041 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareDialog.java
@@ -36,19 +36,19 @@ import org.eclipse.ui.PlatformUI;
* This is a dialog that can host a {@link CompareEditorInput}.
* <p>
* This class can be used as is or can be subclassed.
- *
+ *
* @since 3.3
*/
public class CompareDialog extends TrayDialog implements IPropertyChangeListener {
-
+
private final CompareEditorInput fCompareEditorInput;
private Button fCommitButton;
private Label statusLabel;
boolean hasSettings = true;
private final DialogCompareContainer fContainer = new DialogCompareContainer();
-
+
private class DialogCompareContainer extends CompareContainer {
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)
*/
@@ -58,7 +58,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
dialog.run(fork, cancelable, runnable);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareContainer#setStatusMessage(java.lang.String)
*/
@@ -72,7 +72,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
}
}
}
-
+
/**
* Create a dialog to host the given input.
* @param shell a shell
@@ -84,7 +84,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
Assert.isNotNull(input);
fCompareEditorInput= input;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.internal.ResizableDialog#close()
*/
@@ -96,7 +96,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
}
return false;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
@@ -134,7 +134,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
* @see CompareConfiguration#isRightEditable()
*/
protected boolean isInputEditable() {
- return fCompareEditorInput.getCompareConfiguration().isLeftEditable()
+ return fCompareEditorInput.getCompareConfiguration().isLeftEditable()
|| fCompareEditorInput.getCompareConfiguration().isRightEditable();
}
@@ -160,7 +160,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
return getSelectedElement() != null;
return true;
}
-
+
private Object getSelectedElement() {
return fCompareEditorInput.getSelectedEdition();
}
@@ -169,22 +169,22 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
* @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
*/
protected Control createDialogArea(Composite parent2) {
-
+
Composite parent= (Composite) super.createDialogArea(parent2);
Control c= fCompareEditorInput.createContents(parent);
c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
statusLabel = new Label(parent, SWT.NONE);
statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
Shell shell= c.getShell();
shell.setText(fCompareEditorInput.getTitle());
shell.setImage(fCompareEditorInput.getTitleImage());
applyDialogFont(parent);
return parent;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.window.Window#open()
*/
@@ -195,7 +195,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
fCompareEditorInput.setContainer(fContainer);
return super.open();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
@@ -222,7 +222,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
}
return dialogSettings;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.internal.ResizableDialog#configureShell(org.eclipse.swt.widgets.Shell)
*/
@@ -241,7 +241,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
public String getHelpContextId() {
return ICompareContextIds.COMPARE_DIALOG;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
*/
@@ -255,7 +255,7 @@ public class CompareDialog extends TrayDialog implements IPropertyChangeListener
/**
* If we don't have settings we need to come up with a reasonable default
- * since we can't depend on the compare editor input layout returning a
+ * since we can't depend on the compare editor input layout returning a
* good default size.
* @return the default size of the dialog
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
index 10de7cef5..2c8fe0ede 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
@@ -34,7 +34,7 @@ import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
public class CompareEditorContributor extends EditorActionBarContributor {
-
+
public final static String FILTER_SEPARATOR = "compare.filters"; //$NON-NLS-1$
public final static String BUILTIN_SEPARATOR = "compare.builtin"; //$NON-NLS-1$
@@ -43,27 +43,27 @@ public class CompareEditorContributor extends EditorActionBarContributor {
private ChangePropertyAction fIgnoreWhitespace;
private NavigationAction fNext;
private NavigationAction fPrevious;
-
+
private NavigationAction fToolbarNext;
private NavigationAction fToolbarPrevious;
public CompareEditorContributor() {
ResourceBundle bundle= CompareUI.getResourceBundle();
-
+
IWorkbenchHelpSystem helpSystem= PlatformUI.getWorkbench().getHelpSystem();
-
+
fIgnoreWhitespace= ChangePropertyAction.createIgnoreWhiteSpaceAction(bundle, null);
helpSystem.setHelp(fIgnoreWhitespace, ICompareContextIds.IGNORE_WHITESPACE_ACTION);
-
+
fNext= new NavigationAction(bundle, true);
helpSystem.setHelp(fNext, ICompareContextIds.GLOBAL_NEXT_DIFF_ACTION);
-
+
fPrevious= new NavigationAction(bundle, false);
helpSystem.setHelp(fPrevious, ICompareContextIds.GLOBAL_PREVIOUS_DIFF_ACTION);
-
+
fToolbarNext= new NavigationAction(bundle, true);
helpSystem.setHelp(fToolbarNext, ICompareContextIds.NEXT_DIFF_ACTION);
-
+
fToolbarPrevious= new NavigationAction(bundle, false);
helpSystem.setHelp(fToolbarPrevious, ICompareContextIds.PREVIOUS_DIFF_ACTION);
}
@@ -78,7 +78,7 @@ public class CompareEditorContributor extends EditorActionBarContributor {
tbm.appendToGroup(BUILTIN_SEPARATOR, fToolbarNext);
tbm.appendToGroup(BUILTIN_SEPARATOR, fToolbarPrevious);
}
-
+
/*
* @see EditorActionBarContributor#contributeToMenu(IMenuManager)
*/
@@ -87,12 +87,12 @@ public class CompareEditorContributor extends EditorActionBarContributor {
}
public void setActiveEditor(IEditorPart targetEditor) {
-
+
if (fActiveEditorPart == targetEditor)
return;
-
+
fActiveEditorPart= targetEditor;
-
+
if (fActiveEditorPart != null) {
IEditorInput input= fActiveEditorPart.getEditorInput();
if (input instanceof CompareEditorInput) {
@@ -105,19 +105,19 @@ public class CompareEditorContributor extends EditorActionBarContributor {
// End fix http://bugs.eclipse.org/bugs/show_bug.cgi?id=20105
}
}
-
+
if (targetEditor instanceof CompareEditor) {
IActionBars actionBars= getActionBars();
-
+
CompareEditor editor= (CompareEditor) targetEditor;
editor.setActionBars(actionBars);
-
+
actionBars.setGlobalActionHandler(ActionFactory.NEXT.getId(), fNext);
actionBars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), fPrevious);
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNext);
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPrevious);
-
+
CompareConfiguration cc= editor.getCompareConfiguration();
fIgnoreWhitespace.setCompareConfiguration(cc);
@@ -181,7 +181,7 @@ public class CompareEditorContributor extends EditorActionBarContributor {
actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, null);
}
}
-
+
public void dispose() {
setActiveEditor(null);
super.dispose();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java
index 5a4162591..07c8c9e3f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorInputNavigator.java
@@ -25,7 +25,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
// Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
private boolean fNextFirstTime= true;
private Object[] fPanes;
-
+
/**
* Create a navigator for navigating the given panes
* @param panes the panes to navigate.
@@ -33,7 +33,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
public CompareEditorInputNavigator(Object[] panes) {
fPanes= panes;
}
-
+
/**
* Return the set of panes that this navigator is navigating.
* The {@link INavigatable} is obtain from each pane using the
@@ -43,7 +43,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
public Object[] getPanes() {
return fPanes;
}
-
+
protected INavigatable[] getNavigatables() {
List result = new ArrayList();
Object[] panes = getPanes();
@@ -55,7 +55,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
}
return (INavigatable[]) result.toArray(new INavigatable[result.size()]);
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.ICompareNavigator#selectChange(boolean)
*/
@@ -68,7 +68,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
}
return super.selectChange(next);
}
-
+
/*
* Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
*/
@@ -84,7 +84,7 @@ public class CompareEditorInputNavigator extends CompareNavigator {
}
return true;
}
-
+
/*
* Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java
index 7f45f1e3f..1d71169d7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorSelectionProvider.java
@@ -33,7 +33,7 @@ import org.eclipse.jface.text.TextViewer;
/**
* A selection provider for view parts with more that one viewer. Tracks the
* focus of the viewers to provide the correct selection.
- *
+ *
* This is a modified version of
* org.eclipse.jdt.internal.ui.viewsupport.SelectionProviderMediator
*/
@@ -82,7 +82,7 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
fPostSelectionChangedListeners = new ListenerList();
// nothing more to do here, Compare Editor is initializing
}
-
+
/**
* @param viewers All viewers that can provide a selection
* @param viewerInFocus the viewer currently in focus or <code>null</code>
@@ -92,7 +92,7 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
fViewers= viewers;
InternalListener listener= new InternalListener();
fViewerInFocus= viewerInFocus;
-
+
for (int i= 0; i < fViewers.length; i++) {
TextViewer viewer= fViewers[i];
viewer.addSelectionChangedListener(listener);
@@ -110,7 +110,7 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
}
}
}
-
+
final void doPostSelectionChanged(SelectionChangedEvent event) {
ISelectionProvider provider= event.getSelectionProvider();
if (provider == fViewerInFocus) {
@@ -213,7 +213,7 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
/**
* Resets the visible region for all text viewers of this selection provider.
- *
+ *
* @since 3.6
*/
private void resetVisibleRegion() {
@@ -226,7 +226,7 @@ public class CompareEditorSelectionProvider implements IPostSelectionProvider {
/**
* Tells whether the given selection is inside the text viewer's visible region.
- *
+ *
* @param textViewer the text viewer
* @param selection the selection
* @return <code>true</code> if the selection is inside the text viewer's visible region
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareHandlerService.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareHandlerService.java
index a3b4d4fcc..085ebd839 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareHandlerService.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareHandlerService.java
@@ -24,7 +24,7 @@ import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.services.IServiceLocator;
public class CompareHandlerService {
-
+
private final List fActivations = new ArrayList();
private final Expression fExpression;
private ICompareContainer fContainer;
@@ -49,14 +49,14 @@ public class CompareHandlerService {
}
return new CompareHandlerService(null, null);
}
-
+
private CompareHandlerService(ICompareContainer container,
Expression expression) {
fContainer = container;
fExpression = expression;
initialize();
}
-
+
public void registerAction(IAction action, String commandId) {
IHandlerService handlerService = getHandlerService();
if (handlerService == null)
@@ -72,7 +72,7 @@ public class CompareHandlerService {
fActivations .add(activation);
}
}
-
+
private IHandlerService getHandlerService() {
if (fDisposed)
return null;
@@ -114,7 +114,7 @@ public class CompareHandlerService {
if (actionHandler != null)
actionHandler.setActionDefinitionId(null);
}
-
+
private void updateActionBars() {
IActionBars bars = getActionBars();
if (bars != null)
@@ -130,7 +130,7 @@ public class CompareHandlerService {
}
}
}
-
+
private IActionBars getActionBars() {
return fContainer.getActionBars();
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
index dafaef4f3..cfbfe4330 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareOutlinePage.java
@@ -33,7 +33,7 @@ public class CompareOutlinePage extends Page implements IContentOutlinePage, IPr
private Control fControl;
private CompareViewerSwitchingPane fStructurePane;
private OutlineViewerCreator fCreator;
-
+
CompareOutlinePage(CompareEditor editor) {
fCompareEditor= editor;
}
@@ -56,7 +56,7 @@ public class CompareOutlinePage extends Page implements IContentOutlinePage, IPr
h.layout();
reset();
}
-
+
private Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
OutlineViewerCreator creator = getCreator();
if (creator != null)
@@ -103,7 +103,7 @@ public class CompareOutlinePage extends Page implements IContentOutlinePage, IPr
if (fStructurePane != null)
fStructurePane.setSelection(selection);
}
-
+
private void setInput(Object input) {
if (fStructurePane != null) {
fStructurePane.setInput(input);
@@ -127,7 +127,7 @@ public class CompareOutlinePage extends Page implements IContentOutlinePage, IPr
((Splitter)fControl).layout();
}
}
-
+
@Override
public void dispose() {
super.dispose();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
index cd262b46e..ec37c74c3 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ComparePreferencePage.java
@@ -60,11 +60,11 @@ import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
public class ComparePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
+
class FakeInput implements ITypedElement, IEncodedStreamContentAccessor {
static final String UTF_16= "UTF-16"; //$NON-NLS-1$
String fContent;
-
+
FakeInput(String name) {
fContent= loadPreviewContentFromFile(name);
}
@@ -93,7 +93,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
public static final String INITIALLY_SHOW_ANCESTOR_PANE= PREFIX + "InitiallyShowAncestorPane"; //$NON-NLS-1$
public static final String PREF_SAVE_ALL_EDITORS= PREFIX + "SaveAllEditors"; //$NON-NLS-1$
public static final String IGNORE_WHITESPACE= PREFIX + "IgnoreWhitespace"; //$NON-NLS-1$
-
+
//public static final String USE_SPLINES= PREFIX + "UseSplines"; //$NON-NLS-1$
public static final String USE_SINGLE_LINE= PREFIX + "UseSingleLine"; //$NON-NLS-1$
public static final String HIGHLIGHT_TOKEN_CHANGES= PREFIX + "HighlightTokenChanges"; //$NON-NLS-1$
@@ -103,7 +103,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
public static final String ADDED_LINES_REGEX= PREFIX + "AddedLinesRegex"; //$NON-NLS-1$
public static final String REMOVED_LINES_REGEX= PREFIX + "RemovedLinesRegex"; //$NON-NLS-1$
public static final String SWAPPED = PREFIX + "Swapped"; //$NON-NLS-1$
-
+
private TextMergeViewer fPreviewViewer;
private IPropertyChangeListener fPreferenceChangeListener;
@@ -116,7 +116,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
private SelectionListener fCheckBoxListener;
- public final OverlayPreferenceStore.OverlayKey[] fKeys= new OverlayPreferenceStore.OverlayKey[] {
+ public final OverlayPreferenceStore.OverlayKey[] fKeys= new OverlayPreferenceStore.OverlayKey[] {
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, OPEN_STRUCTURE_COMPARE),
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_OUTLINE_VIEW),
new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SYNCHRONIZE_SCROLLING),
@@ -139,8 +139,8 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
private List<FieldEditor> editors = new ArrayList<>();
private TabItem fTextCompareTab;
private Button fDisableCappingCheckBox;
-
-
+
+
public static void initDefaults(IPreferenceStore store) {
store.setDefault(OPEN_STRUCTURE_COMPARE, true);
store.setDefault(USE_OUTLINE_VIEW, false);
@@ -163,11 +163,11 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
}
public ComparePreferencePage() {
-
+
//setDescription(Utilities.getString("ComparePreferencePage.description")); //$NON-NLS-1$
-
+
setPreferenceStore(CompareUIPlugin.getDefault().getPreferenceStore());
-
+
fOverlayStore= new OverlayPreferenceStore(getPreferenceStore(), fKeys);
fPreferenceChangeListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -182,13 +182,13 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
};
fOverlayStore.addPropertyChangeListener(fPreferenceChangeListener);
}
-
+
/*
* @see IWorkbenchPreferencePage#init()
*/
public void init(IWorkbench workbench) {
// empty
- }
+ }
/*
* @see PreferencePage#performOk()
@@ -205,23 +205,23 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
ComparePreferencePage.CAPPING_DISABLED));
return true;
}
-
+
/*
* @see PreferencePage#performDefaults()
*/
protected void performDefaults() {
-
+
fOverlayStore.loadDefaults();
initializeFields();
super.performDefaults();
}
-
+
/*
* @see DialogPage#dispose()
*/
public void dispose() {
-
+
if (fOverlayStore != null) {
if (fPreferenceChangeListener != null) {
fOverlayStore.removePropertyChangeListener(fPreferenceChangeListener);
@@ -230,7 +230,7 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
fOverlayStore.stop();
fOverlayStore= null;
}
-
+
super.dispose();
}
@@ -238,52 +238,52 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
return store.getBoolean(PREF_SAVE_ALL_EDITORS);
}
-
+
static public void setSaveAllEditors(boolean value) {
IPreferenceStore store= CompareUIPlugin.getDefault().getPreferenceStore();
store.setValue(PREF_SAVE_ALL_EDITORS, value);
- }
+ }
/*
* @see PreferencePage#createContents(Composite)
*/
protected Control createContents(Composite parent) {
-
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICompareContextIds.COMPARE_PREFERENCE_PAGE);
-
+
fOverlayStore.load();
fOverlayStore.start();
-
+
TabFolder folder= new TabFolder(parent, SWT.NONE);
- folder.setLayout(new TabFolderLayout());
+ folder.setLayout(new TabFolderLayout());
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
TabItem item= new TabItem(folder, SWT.NONE);
item.setText(Utilities.getString("ComparePreferencePage.generalTab.label")); //$NON-NLS-1$
//item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
item.setControl(createGeneralPage(folder));
-
+
item= new TabItem(folder, SWT.NONE);
item.setText(Utilities.getString("ComparePreferencePage.textCompareTab.label")); //$NON-NLS-1$
//item.setImage(JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CFILE));
item.setControl(createTextComparePage(folder));
fTextCompareTab = item;
-
+
initializeFields();
Dialog.applyDialogFont(folder);
return folder;
}
-
+
private Control createGeneralPage(Composite parent) {
Composite composite= new Composite(parent, SWT.NULL);
GridLayout layout= new GridLayout();
layout.numColumns= 1;
composite.setLayout(layout);
-
+
addCheckBox(composite, "ComparePreferencePage.structureCompare.label", OPEN_STRUCTURE_COMPARE, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.structureOutline.label", USE_OUTLINE_VIEW, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.ignoreWhitespace.label", IGNORE_WHITESPACE, 0); //$NON-NLS-1$
-
+
// a spacer
new Label(composite, SWT.NONE);
@@ -291,22 +291,22 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
// a spacer
new Label(composite, SWT.NONE);
-
+
Label l= new Label(composite, SWT.WRAP);
l.setText(Utilities.getString("ComparePreferencePage.regex.description")); //$NON-NLS-1$
-
+
Composite c2= new Composite(composite, SWT.NONE);
c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
layout= new GridLayout(2, false);
layout.marginWidth= 0;
c2.setLayout(layout);
-
+
l= new Label(c2, SWT.NONE);
l.setText(Utilities.getString("ComparePreferencePage.regexAdded.label")); //$NON-NLS-1$
addedLinesRegex = new Text(c2, SWT.BORDER);
addedLinesRegex.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
addedLinesRegex.setText(fOverlayStore.getString(ADDED_LINES_REGEX));
-
+
l= new Label(c2, SWT.NONE);
l.setText(Utilities.getString("ComparePreferencePage.regexRemoved.label")); //$NON-NLS-1$
removedLinesRegex = new Text(c2, SWT.BORDER);
@@ -315,19 +315,19 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
// a spacer
new Label(composite, SWT.NONE);
-
+
l= new Label(composite, SWT.WRAP);
l.setText(Utilities.getString("ComparePreferencePage.filter.description")); //$NON-NLS-1$
-
+
Composite c3= new Composite(composite, SWT.NONE);
c3.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
layout= new GridLayout(2, false);
layout.marginWidth= 0;
c3.setLayout(layout);
-
+
l= new Label(c3, SWT.NONE);
l.setText(Utilities.getString("ComparePreferencePage.filter.label")); //$NON-NLS-1$
-
+
fFilters= new Text(c3, SWT.BORDER);
fFilters.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
fFilters.setText(fOverlayStore.getString(PATH_FILTER));
@@ -343,28 +343,28 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
}
}
);
-
+
return composite;
}
-
+
private Control createTextComparePage(Composite parent) {
-
+
Composite composite= new Composite(parent, SWT.NULL);
GridLayout layout= new GridLayout();
layout.numColumns= 1;
composite.setLayout(layout);
-
+
addCheckBox(composite, "ComparePreferencePage.synchronizeScrolling.label", SYNCHRONIZE_SCROLLING, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.initiallyShowAncestorPane.label", INITIALLY_SHOW_ANCESTOR_PANE, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.showPseudoConflicts.label", SHOW_PSEUDO_CONFLICTS, 0); //$NON-NLS-1$
-
+
//addCheckBox(composite, "ComparePreferencePage.useSplines.label", USE_SPLINES, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.useSingleLine.label", USE_SINGLE_LINE, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.highlightTokenChanges.label", HIGHLIGHT_TOKEN_CHANGES, 0); //$NON-NLS-1$
//addCheckBox(composite, "ComparePreferencePage.useResolveUI.label", USE_RESOLVE_UI, 0); //$NON-NLS-1$
fDisableCappingCheckBox = addCheckBox(composite, "ComparePreferencePage.disableCapping.label", CAPPING_DISABLED, 0); //$NON-NLS-1$
addCheckBox(composite, "ComparePreferencePage.swapped.label", SWAPPED, 0); //$NON-NLS-1$
-
+
Composite radioGroup = new Composite(composite, SWT.NULL);
radioGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
RadioGroupFieldEditor editor = new RadioGroupFieldEditor(
@@ -380,43 +380,43 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
editor.setPreferenceStore(fOverlayStore);
editor.fillIntoGrid(radioGroup, 1);
editors.add(editor);
-
+
// a spacer
Label separator= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
separator.setVisible(false);
-
+
Label previewLabel= new Label(composite, SWT.NULL);
previewLabel.setText(Utilities.getString("ComparePreferencePage.preview.label")); //$NON-NLS-1$
-
+
Control previewer= createPreviewer(composite);
GridData gd= new GridData(GridData.FILL_BOTH);
gd.widthHint= convertWidthInCharsToPixels(60);
gd.heightHint= convertHeightInCharsToPixels(13);
previewer.setLayoutData(gd);
-
+
PreferenceLinkArea area = new PreferenceLinkArea(composite, SWT.NONE,
"org.eclipse.ui.preferencePages.ColorsAndFonts", Utilities.getString("ComparePreferencePage.colorAndFontLink"), //$NON-NLS-1$ //$NON-NLS-2$
(IWorkbenchPreferenceContainer)getContainer(), "selectCategory:org.eclipse.compare.contentmergeviewer.TextMergeViewer"); //$NON-NLS-1$
GridData data= new GridData(SWT.FILL, SWT.CENTER, false, false);
area.getControl().setLayoutData(data);
-
+
return composite;
}
-
+
private Control createPreviewer(Composite parent) {
-
+
fCompareConfiguration= new CompareConfiguration(fOverlayStore);
fCompareConfiguration.setAncestorLabel(Utilities.getString("ComparePreferencePage.ancestor.label")); //$NON-NLS-1$
-
+
fCompareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.left.label")); //$NON-NLS-1$
fCompareConfiguration.setLeftEditable(false);
-
+
fCompareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$
fCompareConfiguration.setRightEditable(false);
-
+
fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration);
-
+
fPreviewViewer.setInput(
new DiffNode(Differencer.CONFLICTING,
new FakeInput("ComparePreferencePage.previewAncestor"), //$NON-NLS-1$
@@ -432,42 +432,42 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
fCompareConfiguration.dispose();
}
});
-
+
return c;
}
-
+
private void initializeFields() {
-
+
Iterator<Button> e = fCheckBoxes.keySet().iterator();
while (e.hasNext()) {
Button b = e.next();
String key= fCheckBoxes.get(b);
b.setSelection(fOverlayStore.getBoolean(key));
}
-
+
if (fFilters != null)
fFilters.setText(fOverlayStore.getString(PATH_FILTER));
if (addedLinesRegex != null)
addedLinesRegex.setText(fOverlayStore.getString(ADDED_LINES_REGEX));
if (removedLinesRegex != null)
removedLinesRegex.setText(fOverlayStore.getString(REMOVED_LINES_REGEX));
-
+
editors.forEach(editor -> editor.load());
}
// overlay stuff
-
+
private Button addCheckBox(Composite parent, String labelKey, String key, int indentation) {
-
+
String label= Utilities.getString(labelKey);
-
+
Button checkBox= new Button(parent, SWT.CHECK);
checkBox.setText(label);
-
+
GridData gd= new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalIndent= indentation;
checkBox.setLayoutData(gd);
-
+
if (fCheckBoxListener == null) {
fCheckBoxListener= new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
@@ -477,14 +477,14 @@ public class ComparePreferencePage extends PreferencePage implements IWorkbenchP
};
}
checkBox.addSelectionListener(fCheckBoxListener);
-
+
fCheckBoxes.put(checkBox, key);
-
+
return checkBox;
}
private String loadPreviewContentFromFile(String key) {
-
+
String preview= Utilities.getString(key);
String separator= System.getProperty("line.separator"); //$NON-NLS-1$
StringBuffer buffer= new StringBuffer();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
index eb5529f5e..38dc8fa42 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareResourceFilter.java
@@ -22,11 +22,11 @@ import com.ibm.icu.text.MessageFormat;
public class CompareResourceFilter {
private static final char[][] NO_CHAR_CHAR= new char[0][];
-
+
private char[][] fExtraResourceFileFilters;
private String[] fExtraResourceFolderFilters;
-
+
public CompareResourceFilter() {
// nothing to do
}
@@ -61,14 +61,14 @@ public class CompareResourceFilter {
resourceType= IResource.FOLDER;
}
IStatus status= workspace.validateName(fileName, resourceType);
- if (status.matches(IStatus.ERROR)) {
+ if (status.matches(IStatus.ERROR)) {
String format= Utilities.getString("ComparePreferencePage.filter.invalidsegment.error"); //$NON-NLS-1$
return MessageFormat.format(format, status.getMessage());
}
}
return null;
}
-
+
public void setFilters(String filterSequence) {
char[][] filters= filterSequence != null && filterSequence.length() > 0
? splitAndTrimOn(',', filterSequence.toCharArray())
@@ -102,7 +102,7 @@ public class CompareResourceFilter {
}
/////////
-
+
private static String[] getTokens(String text, String separator) {
StringTokenizer tok= new StringTokenizer(text, separator);
int nTokens= tok.countTokens();
@@ -110,43 +110,43 @@ public class CompareResourceFilter {
for (int i= 0; i < res.length; i++)
res[i]= tok.nextToken().trim();
return res;
- }
-
+ }
+
/**
* Answers true if the pattern matches the given name, false otherwise.
* This char[] pattern matching accepts wild-cards '*' and '?'.
- *
+ *
* When not case sensitive, the pattern is assumed to already be
* lowercased, the name will be lowercased character per character as
* comparing. If name is null, the answer is false. If pattern is null, the
* answer is true if name is not null. <br><br>For example:
* <ol>
* <li>
- *
+ *
* <pre>
* pattern = { '?', 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => true
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* pattern = { '?', 'b', '?' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* pattern = { 'b', '*' } name = { 'a', 'b', 'c' , 'd' } isCaseSensitive = true result => false
* </pre>
- *
- *
+ *
+ *
* </li>
* </ol>
- *
+ *
* @param pattern
* the given pattern
* @param name
@@ -174,23 +174,23 @@ public class CompareResourceFilter {
* character as comparing. <br><br>For example:
* <ol>
* <li>
- *
+ *
* <pre>
* pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 3 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 4 isCaseSensitive = true result => true
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* pattern = { '?', 'b', '*' } patternStart = 1 patternEnd = 2 name = { 'a', 'b', 'c' , 'd' } nameStart = 1 nameEnd = 2 isCaseSensitive = true result => false
* </pre>
- *
- *
+ *
+ *
* </li>
* </ol>
- *
+ *
* @param pattern
* the given pattern
* @param patternStart
@@ -273,39 +273,39 @@ public class CompareResourceFilter {
* <br><br>For example:
* <ol>
* <li>
- *
+ *
* <pre>
* divider = 'b' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* divider = 'c' array = { 'a' , 'b', 'b', 'a', 'b', 'a' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* divider = 'b' array = { 'a' , ' ', 'b', 'b', 'a', 'b', 'a' } result => { { 'a' }, { }, { 'a' }, { 'a' } }
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* divider = 'c' array = { ' ', ' ', 'a' , 'b', 'b', 'a', 'b', 'a', ' ' } result => { { 'a', 'b', 'b', 'a', 'b', 'a' } }
* </pre>
- *
- *
+ *
+ *
* </li>
* </ol>
- *
+ *
* @param divider
* the given divider
* @param array
@@ -355,23 +355,23 @@ public class CompareResourceFilter {
* <br><br>For example:
* <ol>
* <li>
- *
+ *
* <pre>
* array = { 'a' , 'b' } start = 0 end = 1 result => { 'a' }
* </pre>
- *
- *
+ *
+ *
* </li>
* <li>
- *
+ *
* <pre>
* array = { 'a', 'b' } start = 0 end = -1 result => { 'a' , 'b' }
* </pre>
- *
- *
+ *
+ *
* </li>
* </ol>
- *
+ *
* @param array
* the given array
* @param start
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java
index 5f2564a63..eb4fbe73e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareStructureViewerSwitchingPane.java
@@ -122,7 +122,7 @@ public class CompareStructureViewerSwitchingPane extends
});
return composite;
}
-
+
protected boolean inputChanged(Object input) {
return getInput() != input
|| fCompareEditorInput.getStructureViewerDescriptor() != fSelectedViewerDescriptor;
@@ -144,7 +144,7 @@ public class CompareStructureViewerSwitchingPane extends
private void showMenu() {
if (!(getInput() instanceof ICompareInput))
return;
-
+
ViewerDescriptor[] vd = CompareUIPlugin.getDefault()
.findStructureViewerDescriptor(getViewer(),
(ICompareInput) getInput(), getCompareConfiguration());
@@ -160,7 +160,7 @@ public class CompareStructureViewerSwitchingPane extends
defaultItem.setSelection(fSelectedViewerDescriptor == null);
new MenuItem(menu, SWT.SEPARATOR);
-
+
// add others
for (int i = 0; i < vd.length; i++) {
final ViewerDescriptor vdi = vd[i];
@@ -177,14 +177,14 @@ public class CompareStructureViewerSwitchingPane extends
item.addSelectionListener(createSelectionListener(vdi));
item.setSelection(vdi == fSelectedViewerDescriptor);
}
-
+
// 2. show
Rectangle bounds = toolBar.getItem(0).getBounds();
Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
topLeft = toolBar.toDisplay(topLeft);
menu.setLocation(topLeft.x, topLeft.y);
menu.setVisible(true);
-
+
// 3. dispose on close
menu.addMenuListener(new MenuAdapter() {
public void menuHidden(MenuEvent e) {
@@ -242,7 +242,7 @@ public class CompareStructureViewerSwitchingPane extends
}
}
}
-
+
public void addMouseListener(MouseListener listener) {
Composite c = (Composite) getTopLeft();
Control[] children = c.getChildren();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
index 0d0abb819..0cc84dcd1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithEditionAction.java
@@ -11,7 +11,7 @@
package org.eclipse.compare.internal;
public class CompareWithEditionAction extends EditionAction {
-
+
public CompareWithEditionAction() {
super(false, "org.eclipse.compare.internal.CompareWithEditionAction"); //$NON-NLS-1$
this.fHelpContextId= ICompareContextIds.COMPARE_WITH_EDITION_DIALOG;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java
index f322b95da..fb20ee888 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java
@@ -16,7 +16,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
/**
* The "Compare with other resource" action.
- *
+ *
* @deprecated Temporarily replaced by CompareWithOtherResourceHandler. See bug
* 264498.
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
index 635b31866..533ada409 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java
@@ -69,7 +69,7 @@ import org.eclipse.ui.part.ResourceTransfer;
* This is a dialog that can invoke the compare editor on chosen files.
*/
public class CompareWithOtherResourceDialog extends TitleAreaDialog {
-
+
private int MIN_WIDTH = 320;
private int MIN_HEIGHT_WITH_ANCESTOR = 320;
private int MIN_HEIGHT_WITHOUT_ANCESTOR = 238;
@@ -169,28 +169,28 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
}
}
-
+
private abstract class ContentTypeElement {
-
+
private Button radioButton;
protected Button mainButton;
protected Text text;
private String type;
protected InternalSection section;
private IResource resource;
-
+
public ContentTypeElement(Composite parent, String type, InternalSection section) {
this.type = type;
this.section = section;
createContents(parent);
}
-
+
private void createContents(Composite parent) {
createRadioButton(parent);
createText(parent);
createMainButton(parent);
}
-
+
private void createRadioButton(Composite parent) {
radioButton = new Button(parent, SWT.RADIO);
radioButton.setText(type);
@@ -201,30 +201,30 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
text.setEditable(false);
}
-
+
protected void createMainButton(Composite parent) {
mainButton = new Button(parent, SWT.PUSH);
mainButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
}
-
+
protected Button getRadioButton() {
return radioButton;
}
-
+
protected String getText() {
return text.getText();
}
-
+
protected void setText(String string) {
text.setText(string);
}
-
+
protected void setEnabled(boolean enabled) {
radioButton.setSelection(enabled);
mainButton.setEnabled(enabled);
text.setEnabled(enabled);
}
-
+
protected void setResource(IResource resource) {
this.resource = resource;
section.setResource(resource);
@@ -233,32 +233,32 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
public IResource getResource() {
return resource;
}
-
+
void clearResource() {
resource = null;
text.setText(""); //$NON-NLS-1$
}
-
+
}
-
+
private class WorkspaceContent extends ContentTypeElement {
-
+
public WorkspaceContent(Composite parent, InternalSection section) {
super(parent, CompareMessages.CompareWithOtherResourceDialog_workspaceRadioButton, section);
}
-
+
protected void createMainButton(Composite parent) {
super.createMainButton(parent);
mainButton.setText(CompareMessages.CompareWithOtherResourceDialog_workspaceMainButton);
// temporarily hide this button. For more information about supporting for browsing workspace see bug 243744.
mainButton.setVisible(false);
}
-
+
protected void createText(Composite parent) {
-
+
super.createText(parent);
text.setEditable(true);
-
+
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
section.setResource(text.getText());
@@ -275,7 +275,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
updateErrorInfo();
}
});
-
+
initDrag();
initDrop();
}
@@ -302,15 +302,15 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
target.setTransfer(types);
target.addDropListener(new FileTextDropListener(this));
}
-
+
}
-
+
private class ExternalFileContent extends ContentTypeElement {
-
+
public ExternalFileContent(Composite parent, InternalSection section) {
super(parent, CompareMessages.CompareWithOtherResourceDialog_externalFileRadioButton, section);
}
-
+
protected void createMainButton(Composite parent) {
super.createMainButton(parent);
mainButton.setText(CompareMessages.CompareWithOtherResourceDialog_externalFileMainButton);
@@ -320,7 +320,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
}
public void widgetSelected(SelectionEvent e) {
IResource r = tmpProject.getExternalFile();
- if (r == null)
+ if (r == null)
return;
setResource(r);
}
@@ -331,15 +331,15 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
super.setResource(resource);
text.setText(resource.getLocation().toOSString());
}
-
+
}
-
+
private class ExternalFolderContent extends ContentTypeElement {
-
+
public ExternalFolderContent(Composite parent, InternalSection section) {
super(parent, CompareMessages.CompareWithOtherResourceDialog_externalFolderRadioButton, section);
}
-
+
protected void createMainButton(Composite parent) {
super.createMainButton(parent);
mainButton.setText(CompareMessages.CompareWithOtherResourceDialog_externalFolderMainButton);
@@ -360,11 +360,11 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
super.setResource(resource);
text.setText(resource.getLocation().toOSString());
}
-
+
}
private abstract class InternalSection {
-
+
// there is no "enum" support in Java 1.4. Sigh...
public static final int WORKSPACE = 0;
public static final int EXTERNAL_FILE = 1;
@@ -372,11 +372,11 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
protected Group group;
private IResource resource;
-
+
ExternalFileContent externalFileContent;
ExternalFolderContent externalFolderContent;
WorkspaceContent workspaceContent;
-
+
private InternalSection() {
// not to instantiate
}
@@ -386,16 +386,16 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
group = new Group(parent, SWT.NONE);
group.setLayout(new GridLayout(3, false));
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
+
workspaceContent = new WorkspaceContent(group, this);
externalFileContent = new ExternalFileContent(group, this);
externalFolderContent = new ExternalFolderContent(group, this);
-
+
addListenersToRadioButtons();
}
-
+
private void addListenersToRadioButtons() {
- final ContentTypeElement[] elements = new ContentTypeElement[] { workspaceContent,
+ final ContentTypeElement[] elements = new ContentTypeElement[] { workspaceContent,
externalFileContent, externalFolderContent };
for (int i = 0; i < elements.length; i++) {
elements[i].getRadioButton().addListener(SWT.Selection, new Listener() {
@@ -425,9 +425,9 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
protected void setResource(String s) {
IResource tmp = ResourcesPlugin.getWorkspace().getRoot()
.findMember(s);
- if (tmp instanceof IWorkspaceRoot)
+ if (tmp instanceof IWorkspaceRoot)
resource = null;
- else
+ else
resource = tmp;
updateErrorInfo();
}
@@ -439,10 +439,10 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
externalFolderContent.clearResource();
updateErrorInfo();
}
-
+
protected void setContentType(int type) {
switch(type) {
- case WORKSPACE:
+ case WORKSPACE:
workspaceContent.setEnabled(true);
externalFileContent.setEnabled(false);
externalFolderContent.setEnabled(false);
@@ -521,15 +521,15 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
expandable.setLayoutData(layoutData);
}
}
-
+
private class ExternalResourcesProject {
-
+
// Implementation based on org.eclipse.jdt.internal.core.ExternalFoldersManager
-
+
private int counter = 0;
-
+
private static final String TMP_PROJECT_NAME = ".org.eclipse.compare.tmp"; //$NON-NLS-1$
-
+
private final static String TMP_PROJECT_FILE = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$
+ "<projectDescription>\n" //$NON-NLS-1$
+ "\t<name>" + TMP_PROJECT_NAME + "\t</name>\n" //$NON-NLS-1$ //$NON-NLS-2$
@@ -540,13 +540,13 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
+ "\t</buildSpec>\n" //$NON-NLS-1$
+ "\t<natures>\n" + "\t</natures>\n" //$NON-NLS-1$//$NON-NLS-2$
+ "</projectDescription>"; //$NON-NLS-1$
-
+
private final static String TMP_FOLDER_NAME = "tmpFolder"; //$NON-NLS-1$
-
+
private ExternalResourcesProject() {
// nothing to do here
}
-
+
private IProject createTmpProject() throws CoreException {
IProject project = getTmpProject();
if (!project.isAccessible()) {
@@ -582,14 +582,14 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
project.setHidden(true);
return project;
}
-
+
private IFolder getTmpFolder(IProject project) throws CoreException {
IFolder folder = project.getFolder(TMP_FOLDER_NAME);
if (!folder.exists())
folder.create(IResource.NONE, true, null);
return folder;
}
-
+
private IFile getExternalFile() {
FileDialog dialog = new FileDialog(getShell());
String path = dialog.open();
@@ -605,7 +605,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
return (IFolder) linkResource(new Path(path));
return null;
}
-
+
private IResource linkResource(IPath path) {
IResource r = null;
String resourceName = path.lastSegment();
@@ -617,7 +617,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
r = getTmpFolder(project).getFile(resourceName);
if (r.exists()) { // add a number to file's name when there already is a file with that name in a folder
String extension = path.getFileExtension();
- String fileName = path.removeFileExtension().lastSegment();
+ String fileName = path.removeFileExtension().lastSegment();
r = getTmpFolder(project).getFile(getName(fileName, extension));
}
((IFile)r).createLink(path, IResource.REPLACE, null);
@@ -636,11 +636,11 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
}
return r;
}
-
+
/**
* This method is used to prevent duplicating names of linked resources.
* It adds a suffix based on the <code>counter</code> value.
- *
+ *
* @param name
* @param extension optional
* @return
@@ -658,13 +658,13 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
// don't change the name if counter equals 0
return name;
}
-
+
private IProject getTmpProject() {
return ResourcesPlugin.getWorkspace().getRoot().getProject(
TMP_PROJECT_NAME);
}
}
-
+
private Button okButton;
private InternalGroup rightPanel, leftPanel;
private InternalExpandable ancestorPanel;
@@ -673,7 +673,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
/**
* Creates the dialog.
- *
+ *
* @param shell
* a shell
* @param selection
@@ -689,7 +689,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
* .Composite)
@@ -730,7 +730,7 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse
* .swt.widgets.Composite)
@@ -800,13 +800,13 @@ public class CompareWithOtherResourceDialog extends TitleAreaDialog {
}
}
}
-
+
/**
* Returns table with selected resources. If any resource wasn't chosen in
* the ancestor panel, table has only two elements -- resources chosen in
* left and right panel. In the other case table contains all three
* resources.
- *
+ *
* @return table with selected resources
*/
public IResource[] getResult() {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceHandler.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceHandler.java
index 74a57deb1..35508b697 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceHandler.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceHandler.java
@@ -26,16 +26,16 @@ import org.eclipse.ui.handlers.HandlerUtil;
* available from "Compare With > Other Resource...". See bug 264498.
*/
public class CompareWithOtherResourceHandler extends AbstractHandler {
-
+
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
IWorkbenchPage workbenchPage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
-
+
// CompareAction#isEnabled(ISelection)
CompareConfiguration cc = new CompareConfiguration();
cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, Boolean.FALSE);
ResourceCompareInput input = new ResourceCompareInput(cc);
-
+
int selectionSize = 0;
if (selection instanceof IStructuredSelection) {
selectionSize = ((IStructuredSelection) selection).toArray().length;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ContentChangeNotifier.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ContentChangeNotifier.java
index d598889d1..bfcb297f8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ContentChangeNotifier.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ContentChangeNotifier.java
@@ -24,7 +24,7 @@ public class ContentChangeNotifier implements IContentChangeNotifier {
private ListenerList fListenerList;
private final IContentChangeNotifier element;
-
+
public ContentChangeNotifier(IContentChangeNotifier element) {
this.element = element;
}
@@ -37,7 +37,7 @@ public class ContentChangeNotifier implements IContentChangeNotifier {
fListenerList= new ListenerList();
fListenerList.add(listener);
}
-
+
/* (non-Javadoc)
* see IContentChangeNotifier.removeChangeListener
*/
@@ -48,7 +48,7 @@ public class ContentChangeNotifier implements IContentChangeNotifier {
fListenerList= null;
}
}
-
+
/**
* Notifies all registered <code>IContentChangeListener</code>s of a content change.
*/
@@ -82,7 +82,7 @@ public class ContentChangeNotifier implements IContentChangeNotifier {
/**
* Return whether this notifier is empty (i.e. has no listeners).
- * @return whether this notifier is empty
+ * @return whether this notifier is empty
*/
public boolean isEmpty() {
return fListenerList == null || fListenerList.isEmpty();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java
index b602b8f75..3f21ad964 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DiffImageDescriptor.java
@@ -53,7 +53,7 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
}
return h1 + h2 + fWidth;
}
-
+
private int calculateHash(ImageData baseImageData) {
byte[] data = baseImageData.data;
int hash = baseImageData.width + baseImageData.height;
@@ -80,7 +80,7 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
if (fBaseImageData != null) {
drawImage(fBaseImageData, fWidth - fBaseImageData.width, 0);
}
-
+
if (fOverlayImage != null) {
ImageData overlay= fOverlayImage.getImageData();
if (overlay == null)
@@ -91,7 +91,7 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
if (fBaseImageData != null) {
drawImage(fBaseImageData, 0, 0);
}
-
+
if (fOverlayImage != null) {
ImageData overlay= fOverlayImage.getImageData();
if (overlay == null)
@@ -100,7 +100,7 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
}
}
}
-
+
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@@ -118,13 +118,13 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
DiffImageDescriptor other = (DiffImageDescriptor) obj;
return (other.hashCode == hashCode
&& isEqual(other.fOverlayImage, fOverlayImage)
- && other.fWidth == fWidth
+ && other.fWidth == fWidth
&& other.fLeft == fLeft
&& isEqual(other.fBaseImageData, fBaseImageData));
}
return false;
}
-
+
private boolean isEqual(ImageData i1, ImageData i2) {
if (isEqual((Object) i1, (Object) i2)) {
return true;
@@ -143,7 +143,7 @@ public class DiffImageDescriptor extends CompositeImageDescriptor {
&& equals(i1.data,i2.data) && equals(i1.maskData, i2.maskData)
&& equals(i1.alphaData, i2.alphaData));
}
-
+
private boolean equals(byte[] data, byte[] data2) {
if (isEqual(data, data2))
return true;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
index c0a4e1abd..1ceaf7444 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocLineComparator.java
@@ -56,7 +56,7 @@ public class DocLineComparator implements ITokenComparator {
* ignoreWhiteSpace controls whether comparing lines (in method
* <code>rangesEqual<code>) should ignore whitespace. Compare filters may be used
* to affect the detection of line differences.
- *
+ *
* @param document
* the document from which the lines are taken
* @param region
@@ -181,7 +181,7 @@ public class DocLineComparator implements ITokenComparator {
/**
* Aborts the comparison if the number of tokens is too large.
- *
+ *
* @param length a number on which to base the decision whether to return
* <code>true</code> or <code>false</code>
* @param maxLength another number on which to base the decision whether to return
@@ -192,9 +192,9 @@ public class DocLineComparator implements ITokenComparator {
public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other) {
return false;
}
-
+
//---- private methods
-
+
private String[] extract(int thisIndex, int otherIndex,
DocLineComparator other, boolean includeSeparator) {
@@ -268,9 +268,9 @@ public class DocLineComparator implements ITokenComparator {
int l2= s2.length();
int c1= 0, c2= 0;
int i1= 0, i2= 0;
-
+
while (c1 != -1) {
-
+
c1= -1;
while (i1 < l1) {
char c= s1.charAt(i1++);
@@ -279,7 +279,7 @@ public class DocLineComparator implements ITokenComparator {
break;
}
}
-
+
c2= -1;
while (i2 < l2) {
char c= s2.charAt(i2++);
@@ -288,7 +288,7 @@ public class DocLineComparator implements ITokenComparator {
break;
}
}
-
+
if (c1 != c2)
return false;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
index 15ce8915e..3fc20f1c1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/DocumentManager.java
@@ -18,21 +18,21 @@ import org.eclipse.jface.text.IDocument;
* No API yet.
*/
public class DocumentManager {
-
+
private static final boolean DEBUG= false;
-
+
private static ArrayList fgKeys= new ArrayList();
private static ArrayList fgValues= new ArrayList();
-
+
public static IDocument get(Object o) {
-
+
for (int i= 0; i < fgKeys.size(); i++) {
if (fgKeys.get(i) == o)
return (IDocument) fgValues.get(i);
}
return null;
}
-
+
public static void put(Object o, IDocument document) {
if (DEBUG) System.out.println("DocumentManager.put: " + document); //$NON-NLS-1$
for (int i= 0; i < fgKeys.size(); i++) {
@@ -42,9 +42,9 @@ public class DocumentManager {
}
}
fgKeys.add(o);
- fgValues.add(document);
+ fgValues.add(document);
}
-
+
public static void remove(IDocument document) {
if (document != null) {
if (DEBUG) System.out.println("DocumentManager.remove: " + document); //$NON-NLS-1$
@@ -58,7 +58,7 @@ public class DocumentManager {
if (DEBUG) System.out.println("DocumentManager.remove: not found"); //$NON-NLS-1$
}
}
-
+
public static void dump() {
if (DEBUG) System.out.println("DocumentManager: managed docs:" + fgValues.size()); //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
index 08fbe6286..fd91e95e9 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/EditionAction.java
@@ -48,24 +48,24 @@ public class EditionAction extends BaseCompareAction {
private static final String UTF_16= "UTF-16"; //$NON-NLS-1$
private IDocument fDocument;
private IFile fFile;
-
+
DocumentBufferNode(IDocument document, IFile file) {
fDocument= document;
fFile= file;
}
-
+
public String getName() {
return fFile.getName();
}
-
+
public String getType() {
return fFile.getFileExtension();
}
-
+
public Image getImage() {
return null;
}
-
+
public InputStream getContents() {
return new ByteArrayInputStream(Utilities.getBytes(fDocument.get(), UTF_16));
}
@@ -79,7 +79,7 @@ public class EditionAction extends BaseCompareAction {
private boolean fReplaceMode;
protected boolean fPrevious= false;
protected String fHelpContextId;
-
+
EditionAction(boolean replaceMode, String bundleName) {
fReplaceMode= replaceMode;
fBundleName= bundleName;
@@ -96,33 +96,33 @@ public class EditionAction extends BaseCompareAction {
}
private void doFromHistory(final IFile file) {
-
+
ResourceBundle bundle= ResourceBundle.getBundle(fBundleName);
String title= Utilities.getString(bundle, "title"); //$NON-NLS-1$
-
+
Shell parentShell= CompareUIPlugin.getShell();
-
+
IFileState states[]= null;
try {
states= file.getHistory(null);
- } catch (CoreException ex) {
+ } catch (CoreException ex) {
MessageDialog.openError(parentShell, title, ex.getMessage());
return;
}
-
+
if (states == null || states.length <= 0) {
String msg= Utilities.getString(bundle, "noLocalHistoryError"); //$NON-NLS-1$
MessageDialog.openInformation(parentShell, title, msg);
return;
}
-
+
ITypedElement base= new ResourceNode(file);
-
+
IDocument document= getDocument(file);
ITypedElement target= base;
if (document != null)
target= new DocumentBufferNode(document, file);
-
+
ITypedElement[] editions= new ITypedElement[states.length+1];
editions[0]= base;
for (int i= 0; i < states.length; i++)
@@ -134,29 +134,29 @@ public class EditionAction extends BaseCompareAction {
//d.setHideIdenticalEntries(false);
if (fHelpContextId != null)
d.setHelpContextId(fHelpContextId);
-
+
if (fReplaceMode) {
-
+
ITypedElement ti= null;
if (fPrevious)
ti= d.selectPreviousEdition(target, editions, null);
else
ti= d.selectEdition(target, editions, null);
-
+
if (ti instanceof IStreamContentAccessor) {
IStreamContentAccessor sa= (IStreamContentAccessor)ti;
-
+
if (Utilities.validateResource(file, parentShell, title)) {
try {
-
+
if (document != null)
- updateDocument(document, sa);
+ updateDocument(document, sa);
else
updateWorkspace(bundle, parentShell, sa, file);
-
+
} catch (InterruptedException x) {
// Do nothing. Operation has been canceled by user.
-
+
} catch (InvocationTargetException x) {
String reason= x.getTargetException().getMessage();
MessageDialog.openError(parentShell, title, Utilities.getFormattedString(bundle, "replaceError", reason)); //$NON-NLS-1$
@@ -166,13 +166,13 @@ public class EditionAction extends BaseCompareAction {
} else {
d.setCompareMode(true);
- d.selectEdition(target, editions, null);
+ d.selectEdition(target, editions, null);
}
}
-
+
private void updateWorkspace(final ResourceBundle bundle, Shell shell,
final IStreamContentAccessor sa, final IFile file)
- throws InvocationTargetException, InterruptedException {
+ throws InvocationTargetException, InterruptedException {
WorkspaceModifyOperation operation= new WorkspaceModifyOperation() {
public void execute(IProgressMonitor pm) throws InvocationTargetException {
try {
@@ -186,11 +186,11 @@ public class EditionAction extends BaseCompareAction {
}
}
};
-
- ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
- pmdialog.run(false, true, operation);
+
+ ProgressMonitorDialog pmdialog= new ProgressMonitorDialog(shell);
+ pmdialog.run(false, true, operation);
}
-
+
private void updateDocument(IDocument document, IStreamContentAccessor sa) throws InvocationTargetException {
try {
String text= Utilities.readString(sa);
@@ -201,7 +201,7 @@ public class EditionAction extends BaseCompareAction {
throw new InvocationTargetException(e);
}
}
-
+
private IDocument getDocument(IFile file) {
IWorkbench wb= PlatformUI.getWorkbench();
if (wb == null)
@@ -209,9 +209,9 @@ public class EditionAction extends BaseCompareAction {
IWorkbenchWindow[] ws= wb.getWorkbenchWindows();
if (ws == null)
return null;
-
+
FileEditorInput test= new FileEditorInput(file);
-
+
for (int i= 0; i < ws.length; i++) {
IWorkbenchWindow w= ws[i];
IWorkbenchPage[] wps= w.getPages();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
index e8c81e2e0..a9390209e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ExceptionHandler.java
@@ -32,20 +32,20 @@ import org.eclipse.jface.dialogs.MessageDialog;
public class ExceptionHandler {
private static ExceptionHandler fgInstance= new ExceptionHandler();
-
+
/*
* Logs the given exception using the platform's logging mechanism. The exception is
* logged as an error with the error code <code>JavaStatusConstants.INTERNAL_ERROR</code>.
*/
public static void log(Throwable t, String message) {
- CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(),
+ CompareUIPlugin.log(new Status(IStatus.ERROR, CompareUIPlugin.getPluginId(),
CompareUIPlugin.INTERNAL_ERROR, message, t));
}
-
+
/**
* Handles the given <code>CoreException</code>. The workbench shell is used as a parent
* for the dialog window.
- *
+ *
* @param e the <code>CoreException</code> to be handled
* @param title the dialog window's window title
* @param message message to be displayed by the dialog window
@@ -53,10 +53,10 @@ public class ExceptionHandler {
public static void handle(CoreException e, String title, String message) {
handle(e, CompareUIPlugin.getShell(), title, message);
}
-
+
/**
- * Handles the given <code>CoreException</code>.
- *
+ * Handles the given <code>CoreException</code>.
+ *
* @param e the <code>CoreException</code> to be handled
* @param parent the dialog window's parent shell
* @param title the dialog window's window title
@@ -65,11 +65,11 @@ public class ExceptionHandler {
public static void handle(CoreException e, Shell parent, String title, String message) {
fgInstance.perform(e, parent, title, message);
}
-
+
/**
- * Handles the given <code>InvocationTargetException</code>. The workbench shell is used
+ * Handles the given <code>InvocationTargetException</code>. The workbench shell is used
* as a parent for the dialog window.
- *
+ *
* @param e the <code>InvocationTargetException</code> to be handled
* @param title the dialog window's window title
* @param message message to be displayed by the dialog window
@@ -77,10 +77,10 @@ public class ExceptionHandler {
public static void handle(InvocationTargetException e, String title, String message) {
handle(e, CompareUIPlugin.getShell(), title, message);
}
-
+
/**
- * Handles the given <code>InvocationTargetException</code>.
- *
+ * Handles the given <code>InvocationTargetException</code>.
+ *
* @param e the <code>InvocationTargetException</code> to be handled
* @param parent the dialog window's parent shell
* @param title the dialog window's window title
@@ -91,7 +91,7 @@ public class ExceptionHandler {
}
//---- Hooks for subclasses to control exception handling ------------------------------------
-
+
protected void perform(CoreException e, Shell shell, String title, String message) {
CompareUIPlugin.log(e);
IStatus status= e.getStatus();
@@ -117,7 +117,7 @@ public class ExceptionHandler {
}
//---- Helper methods -----------------------------------------------------------------------
-
+
private void displayMessageDialog(Throwable t, String exceptionMessage, Shell shell, String title, String message) {
StringWriter msg= new StringWriter();
if (message != null) {
@@ -125,9 +125,9 @@ public class ExceptionHandler {
msg.write("\n\n"); //$NON-NLS-1$
}
if (exceptionMessage == null || exceptionMessage.length() == 0)
- msg.write(CompareMessages.ExceptionDialog_seeErrorLogMessage);
+ msg.write(CompareMessages.ExceptionDialog_seeErrorLogMessage);
else
msg.write(exceptionMessage);
- MessageDialog.openError(shell, title, msg.toString());
- }
+ MessageDialog.openError(shell, title, msg.toString());
+ }
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
index 804e72023..ae2047f7d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ICompareContextIds.java
@@ -18,12 +18,12 @@ import org.eclipse.compare.CompareUI;
* This interface contains constants only; it is not intended to be implemented
* or extended.
* </p>
- *
+ *
*/
public interface ICompareContextIds {
-
+
public static final String PREFIX= CompareUI.PLUGIN_ID + '.';
-
+
// Dialogs
public static final String EDITION_DIALOG= PREFIX + "edition_dialog_context"; //$NON-NLS-1$
@@ -34,13 +34,13 @@ public interface ICompareContextIds {
public static final String COMPARE_DIALOG= PREFIX + "compare_dialog_context"; //$NON-NLS-1$
public static final String COMPARE_WITH_EDITION_DIALOG= PREFIX + "compare_with_edition_dialog_context"; //$NON-NLS-1$
public static final String REPLACE_WITH_EDITION_DIALOG= PREFIX + "replace_with_edition_dialog_context"; //$NON-NLS-1$
-
+
// Viewer
public static final String TEXT_MERGE_VIEW= PREFIX + "text_merge_view_context"; //$NON-NLS-1$
public static final String IMAGE_COMPARE_VIEW= PREFIX + "image_compare_view_context"; //$NON-NLS-1$
public static final String BINARY_COMPARE_VIEW= PREFIX + "binary_compare_view_context"; //$NON-NLS-1$
public static final String DIFF_VIEW= PREFIX + "diff_view_context"; //$NON-NLS-1$
-
+
// Actions
public static final String GLOBAL_NEXT_DIFF_ACTION= PREFIX + "global_next_diff_action_context"; //$NON-NLS-1$
public static final String GLOBAL_PREVIOUS_DIFF_ACTION= PREFIX + "global_previous_diff_action_context"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IFlushable2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IFlushable2.java
index 8439d4e3c..d86c37505 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IFlushable2.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IFlushable2.java
@@ -16,9 +16,9 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* Interface which provides the ability to flush the contents from the specified
* side of the viewer.
- *
+ *
* @see IFlushable
- *
+ *
* @since 3.7
*/
public interface IFlushable2 {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IMergeViewerTestAdapter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IMergeViewerTestAdapter.java
index bccb14d82..6617fe0f7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IMergeViewerTestAdapter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/IMergeViewerTestAdapter.java
@@ -27,7 +27,7 @@ public interface IMergeViewerTestAdapter {
/**
* Returns the number of changes in merge viewer
- *
+ *
* @return the number of changes
*/
public int getChangesCount();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavingSaveable.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavingSaveable.java
index 851cd3101..6cee06265 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavingSaveable.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ISavingSaveable.java
@@ -15,7 +15,7 @@ import org.eclipse.ui.Saveable;
/**
* Interface defines API for checking if an object, preferably an instance of
* {@link Saveable}, is being saved.
- *
+ *
* @since 3.7
*/
public interface ISavingSaveable {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
index 6f45898a9..e05912347 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ImageMergeViewer.java
@@ -28,17 +28,17 @@ import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
/**
*/
public class ImageMergeViewer extends ContentMergeViewer {
-
+
private static final String BUNDLE_NAME= "org.eclipse.compare.internal.ImageMergeViewerResources"; //$NON-NLS-1$
-
+
private Object fLeftImage;
private Object fRightImage;
private ImageCanvas fAncestor;
private ImageCanvas fLeft;
private ImageCanvas fRight;
-
-
+
+
public ImageMergeViewer(Composite parent, int styles, CompareConfiguration mp) {
super(styles, ResourceBundle.getBundle(BUNDLE_NAME), mp);
@@ -50,23 +50,23 @@ public class ImageMergeViewer extends ContentMergeViewer {
}
protected void updateContent(Object ancestor, Object left, Object right) {
-
+
setInput(fAncestor, ancestor);
-
+
fLeftImage= left;
setInput(fLeft, left);
-
+
fRightImage= right;
setInput(fRight, right);
}
-
+
/*
* We can't modify the contents of either side we just return null.
*/
protected byte[] getContents(boolean left) {
return null;
}
-
+
public void createControls(Composite composite) {
fAncestor= new ImageCanvas(composite, SWT.NO_FOCUS);
fLeft= new ImageCanvas(composite, SWT.NO_FOCUS);
@@ -87,8 +87,8 @@ public class ImageMergeViewer extends ContentMergeViewer {
}
}
}
-
- Image image= null;
+
+ Image image= null;
Display display= canvas.getDisplay();
if (stream != null) {
try {
@@ -104,7 +104,7 @@ public class ImageMergeViewer extends ContentMergeViewer {
} else {
canvas.setBackground(null);
}
-
+
if (stream != null) {
try {
stream.close();
@@ -114,7 +114,7 @@ public class ImageMergeViewer extends ContentMergeViewer {
}
}
}
-
+
protected void handleResizeAncestor(int x, int y, int width, int height) {
if (width > 0) {
fAncestor.setVisible(true);
@@ -128,7 +128,7 @@ public class ImageMergeViewer extends ContentMergeViewer {
fLeft.setBounds(x, y, width1, height);
fRight.setBounds(x+width1+centerWidth, y, width2, height);
}
-
+
protected void copy(boolean leftToRight) {
if (leftToRight) {
fRightImage= fLeftImage;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
index 10a3c6717..7ffc504f9 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ListContentProvider.java
@@ -15,16 +15,16 @@ import java.util.List;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
-/**
+/**
* A specialized content provider to show a list of editor parts.
- */
+ */
public class ListContentProvider implements IStructuredContentProvider {
- List fContents;
+ List fContents;
public ListContentProvider() {
// nothing to do
}
-
+
public Object[] getElements(Object input) {
if (fContents != null && fContents == input)
return fContents.toArray();
@@ -32,7 +32,7 @@ public class ListContentProvider implements IStructuredContentProvider {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof List)
+ if (newInput instanceof List)
fContents= (List)newInput;
else
fContents= null;
@@ -42,7 +42,7 @@ public class ListContentProvider implements IStructuredContentProvider {
public void dispose() {
// empty default implementation
}
-
+
public boolean isDeleted(Object o) {
return fContents != null && !fContents.contains(o);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
index 7fe0365c6..d923936e0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeSourceViewer.java
@@ -105,7 +105,7 @@ import org.eclipse.compare.ICompareContainer;
*/
public class MergeSourceViewer implements ISelectionChangedListener,
ITextListener, IMenuListener, IOperationHistoryListener, IAdaptable {
-
+
public static final String UNDO_ID= "undo"; //$NON-NLS-1$
public static final String REDO_ID= "redo"; //$NON-NLS-1$
public static final String CUT_ID= "cut"; //$NON-NLS-1$
@@ -118,13 +118,13 @@ public class MergeSourceViewer implements ISelectionChangedListener,
public static final String CHANGE_ENCODING_ID= "changeEncoding"; //$NON-NLS-1$
class TextOperationAction extends MergeViewerAction {
-
+
private int fOperationCode;
-
+
TextOperationAction(int operationCode, boolean mutable, boolean selection, boolean content) {
this(operationCode, null, mutable, selection, content);
}
-
+
public TextOperationAction(int operationCode, String actionDefinitionId, boolean mutable, boolean selection, boolean content) {
super(mutable, selection, content);
if (actionDefinitionId != null)
@@ -141,7 +141,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
public boolean isEnabled() {
return fOperationCode != -1 && getSourceViewer().canDoOperation(fOperationCode);
}
-
+
public void update() {
setEnabled(isEnabled());
}
@@ -153,7 +153,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
* embedded TextEditor in a similar way JDT has it done for Java compare.
*/
class TextEditorAdapter implements ITextEditor {
-
+
public void close(boolean save) {
// defining interface method
}
@@ -266,7 +266,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
public void selectAndReveal(int start, int length) {
selectAndReveal(start, length, start, length);
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#selectAndReveal(int, int, int, int)
*/
@@ -298,7 +298,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
private void markInNavigationHistory() {
getSite().getPage().getNavigationHistory().markLocation(this);
}
-
+
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#adjustHighlightRange(int, int)
*/
@@ -438,10 +438,10 @@ public class MergeSourceViewer implements ISelectionChangedListener,
private boolean fEnabled= true;
private HashMap fActions= new HashMap();
private IDocument fRememberedDocument;
-
+
private boolean fAddSaveAction= true;
private boolean isConfigured = false;
-
+
// line number ruler support
private IPropertyChangeListener fPreferenceChangeListener;
private boolean fShowLineNumber=false;
@@ -454,14 +454,14 @@ public class MergeSourceViewer implements ISelectionChangedListener,
fSourceViewer= sourceViewer;
fResourceBundle= bundle;
fContainer = container;
-
+
MenuManager menu= new MenuManager();
menu.setRemoveAllWhenShown(true);
menu.addMenuListener(this);
StyledText te= getSourceViewer().getTextWidget();
te.setMenu(menu.createContextMenu(te));
fContainer.registerContextMenu(menu, getSourceViewer());
-
+
// for listening to editor show/hide line number preference value
fPreferenceChangeListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
@@ -473,7 +473,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
if(fShowLineNumber){
updateLineNumberRuler();
}
-
+
IOperationHistory history = getHistory();
if (history != null)
history.addOperationHistoryListener(this);
@@ -481,22 +481,22 @@ public class MergeSourceViewer implements ISelectionChangedListener,
// don't add save when in a dialog, IWorkbenchPart is null in dialog containers
fAddSaveAction = fContainer.getWorkbenchPart() != null;
}
-
+
public void rememberDocument(IDocument doc) {
// if (doc != null && fRememberedDocument != null) {
// System.err.println("MergeSourceViewer.rememberDocument: fRememberedDocument != null: shouldn't happen"); //$NON-NLS-1$
// }
fRememberedDocument= doc;
}
-
+
public IDocument getRememberedDocument() {
return fRememberedDocument;
}
-
+
public void hideSaveAction() {
fAddSaveAction= false;
}
-
+
public void setFont(Font font) {
StyledText te= getSourceViewer().getTextWidget();
if (te != null)
@@ -506,7 +506,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
layoutViewer();
}
}
-
+
public void setBackgroundColor(Color color) {
StyledText te= getSourceViewer().getTextWidget();
if (te != null)
@@ -514,13 +514,13 @@ public class MergeSourceViewer implements ISelectionChangedListener,
if (fLineNumberColumn != null)
fLineNumberColumn.setBackground(color);
}
-
+
public void setForegroundColor(Color color) {
StyledText te= getSourceViewer().getTextWidget();
if (te != null)
te.setForeground(color);
}
-
+
public void setEnabled(boolean enabled) {
if (enabled != fEnabled) {
fEnabled= enabled;
@@ -532,7 +532,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
}
}
-
+
public boolean getEnabled() {
return fEnabled;
}
@@ -540,29 +540,29 @@ public class MergeSourceViewer implements ISelectionChangedListener,
public void setRegion(Position region) {
fRegion= region;
}
-
+
public Position getRegion() {
return fRegion;
}
-
+
public boolean isControlOkToUse() {
StyledText t= getSourceViewer().getTextWidget();
return t != null && !t.isDisposed();
}
-
+
public void setSelection(Position position) {
if (position != null)
getSourceViewer().setSelectedRange(position.getOffset(), position.getLength());
}
-
+
public void setLineBackground(Position position, Color c) {
StyledText t= getSourceViewer().getTextWidget();
if (t != null && !t.isDisposed()) {
Point region= new Point(0, 0);
getLineRange(position, region);
-
+
region.x-= getDocumentRegionOffset();
-
+
try {
t.setLineBackground(region.x, region.y, c);
} catch (IllegalArgumentException ex) {
@@ -570,7 +570,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
}
}
-
+
public void resetLineBackground() {
StyledText t= getSourceViewer().getTextWidget();
if (t != null && !t.isDisposed()) {
@@ -578,7 +578,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
t.setLineBackground(0, lines, null);
}
}
-
+
/*
* Returns number of lines in document region.
*/
@@ -588,7 +588,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
int length= region.getLength();
if (length == 0)
return 0;
-
+
IDocument doc= getSourceViewer().getDocument();
int startLine= 0;
int endLine= 0;
@@ -604,10 +604,10 @@ public class MergeSourceViewer implements ISelectionChangedListener,
} catch(BadLocationException ex) {
// silently ignored
}
-
+
return endLine-startLine+1;
}
-
+
public int getViewportLines() {
StyledText te= getSourceViewer().getTextWidget();
Rectangle clArea= te.getClientArea();
@@ -623,7 +623,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
return clArea.height;
return 0;
}
-
+
/*
* Returns lines
*/
@@ -639,7 +639,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
return 0;
}
-
+
public int getVerticalScrollOffset() {
StyledText st= getSourceViewer().getTextWidget();
int lineHeight= st.getLineHeight();
@@ -651,27 +651,27 @@ public class MergeSourceViewer implements ISelectionChangedListener,
* Starting line number is 0 based.
*/
public Point getLineRange(Position p, Point region) {
-
+
IDocument doc= getSourceViewer().getDocument();
-
+
if (p == null || doc == null) {
region.x= 0;
region.y= 0;
return region;
}
-
+
int start= p.getOffset();
int length= p.getLength();
-
+
int startLine= 0;
try {
startLine= doc.getLineOfOffset(start);
} catch (BadLocationException e) {
// silently ignored
}
-
+
int lineCount= 0;
-
+
if (length == 0) {
// // if range length is 0 and if range starts a new line
// try {
@@ -681,7 +681,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
// } catch (BadLocationException e) {
// lines--;
// }
-
+
} else {
int endLine= 0;
try {
@@ -691,12 +691,12 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
lineCount= endLine-startLine+1;
}
-
+
region.x= startLine;
region.y= lineCount;
return region;
}
-
+
/*
* Scroll TextPart to the given line.
*/
@@ -715,11 +715,11 @@ public class MergeSourceViewer implements ISelectionChangedListener,
getSourceViewer().setTopIndex(line + getDocumentRegionOffset());
}
}
-
+
public void addAction(String actionId, MergeViewerAction action) {
fActions.put(actionId, action);
}
-
+
public IAction getAction(String actionId) {
IAction action= (IAction) fActions.get(actionId);
if (action == null) {
@@ -732,11 +732,11 @@ public class MergeSourceViewer implements ISelectionChangedListener,
getSourceViewer().addTextListener(this);
if (mva.isSelectionDependent())
getSourceViewer().addSelectionChangedListener(this);
-
+
Utilities.initAction(action, fResourceBundle, "action." + actionId + "."); //$NON-NLS-1$ //$NON-NLS-2$
}
addAction(actionId, action);
-
+
}
if (action instanceof MergeViewerAction) {
MergeViewerAction mva = (MergeViewerAction) action;
@@ -745,7 +745,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
return action;
}
-
+
protected IAction createAction(String actionId) {
if (UNDO_ID.equals(actionId))
return new TextOperationAction(ITextOperationTarget.UNDO, IWorkbenchCommandConstants.EDIT_UNDO, true, false, true);
@@ -763,7 +763,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
return new TextOperationAction(ITextOperationTarget.SELECT_ALL, IWorkbenchCommandConstants.EDIT_SELECT_ALL, false, false, false);
return null;
}
-
+
public void selectionChanged(SelectionChangedEvent event) {
Iterator e= fActions.values().iterator();
while (e.hasNext()) {
@@ -775,7 +775,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
}
}
-
+
public void textChanged(TextEvent event) {
updateContentDependantActions();
}
@@ -791,12 +791,12 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
}
}
-
+
/*
* Allows the viewer to add menus and/or tools to the context menu.
*/
public void menuAboutToShow(IMenuManager menu) {
-
+
menu.add(new Separator("undo")); //$NON-NLS-1$
addMenu(menu, UNDO_ID);
addMenu(menu, REDO_ID);
@@ -804,7 +804,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
if (fAddSaveAction)
addSave(menu);
menu.add(new Separator("file")); //$NON-NLS-1$
-
+
menu.add(new Separator("ccp")); //$NON-NLS-1$
addMenu(menu, CUT_ID);
addMenu(menu, COPY_ID);
@@ -816,32 +816,32 @@ public class MergeSourceViewer implements ISelectionChangedListener,
addMenu(menu, CHANGE_ENCODING_ID);
menu.add(new Separator("find")); //$NON-NLS-1$
addMenu(menu, FIND_ID);
-
+
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
+
menu.add(new Separator("text")); //$NON-NLS-1$
for (Iterator iterator = textActions.iterator(); iterator.hasNext();) {
IAction action = (IAction) iterator.next();
menu.add(action);
}
-
+
menu.add(new Separator("rest")); //$NON-NLS-1$
-
+
// update all actions
// to get undo redo right
updateActions();
}
-
+
private void addMenu(IMenuManager menu, String actionId) {
IAction action= getAction(actionId);
if (action != null)
menu.add(action);
}
-
+
private void addSave(IMenuManager menu) {
ICommandService commandService = fContainer.getWorkbenchPart().getSite().getService(ICommandService.class);
final Command command= commandService.getCommand(IWorkbenchCommandConstants.FILE_SAVE);
-
+
final IHandler handler = command.getHandler();
if (handler != null) {
if (fSaveContributionItem == null) {
@@ -867,12 +867,12 @@ public class MergeSourceViewer implements ISelectionChangedListener,
getSourceViewer().removeTextListener(this);
getSourceViewer().removeSelectionChangedListener(this);
EditorsUI.getPreferenceStore().removePropertyChangeListener(fPreferenceChangeListener);
-
+
IOperationHistory history = getHistory();
if (history != null)
history.removeOperationHistoryListener(this);
}
-
+
/**
* update all actions independent of their type
*
@@ -893,14 +893,14 @@ public class MergeSourceViewer implements ISelectionChangedListener,
}
}
}
-
+
public void configure(SourceViewerConfiguration configuration) {
if (isConfigured )
getSourceViewer().unconfigure();
isConfigured = true;
getSourceViewer().configure(configuration);
}
-
+
/**
* specific implementation to support a vertical ruler
* @param x
@@ -915,15 +915,15 @@ public class MergeSourceViewer implements ISelectionChangedListener,
getSourceViewer().getTextWidget().setBounds(x, y, width, height);
}
}
-
+
/**
* handle show/hide line numbers from editor preferences
* @param event
*/
protected void handlePropertyChangeEvent(PropertyChangeEvent event) {
-
+
String key= event.getProperty();
-
+
if(key.equals(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER)){
boolean b= EditorsUI.getPreferenceStore().getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER);
if (b != fShowLineNumber){
@@ -963,17 +963,17 @@ public class MergeSourceViewer implements ISelectionChangedListener,
fLineNumberColumn.redraw();
}
}
-
+
private void layoutViewer() {
Control parent= getSourceViewer().getControl();
if (parent instanceof Composite && !parent.isDisposed())
((Composite) parent).layout(true);
}
-
+
private ISharedTextColors getSharedColors() {
return EditorsUI.getSharedTextColors();
}
-
+
private RGB getColorFromStore(IPreferenceStore store, String key) {
RGB rgb= null;
if (store.contains(key)) {
@@ -991,7 +991,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
private void toggleLineNumberRuler()
{
fShowLineNumber=!fShowLineNumber;
-
+
updateLineNumberRuler();
}
@@ -1006,7 +1006,7 @@ public class MergeSourceViewer implements ISelectionChangedListener,
public void addAction(String id, IAction action) {
fActions.put(id, action);
}
-
+
private IOperationHistory getHistory() {
if (PlatformUI.getWorkbench() == null) {
return null;
@@ -1034,14 +1034,14 @@ public class MergeSourceViewer implements ISelectionChangedListener,
return ((IUndoManagerExtension)undoManager).getUndoContext();
return null;
}
-
+
/**
* @return the wrapped viewer
*/
public SourceViewer getSourceViewer() {
return fSourceViewer;
}
-
+
public Object getAdapter(Class adapter) {
if (adapter == ITextEditor.class) {
return new TextEditorAdapter();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
index 0ffcebb0e..99f9c8410 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerAction.java
@@ -15,11 +15,11 @@ import org.eclipse.jface.action.Action;
public abstract class MergeViewerAction extends Action implements IUpdate {
-
+
private boolean fMutable;
private boolean fSelection;
private boolean fContent;
-
+
public MergeViewerAction(boolean mutable, boolean selection, boolean content) {
fMutable= mutable;
fSelection= selection;
@@ -29,15 +29,15 @@ public abstract class MergeViewerAction extends Action implements IUpdate {
public boolean isSelectionDependent() {
return fSelection;
}
-
+
public boolean isContentDependent() {
return fContent;
}
-
+
public boolean isEditableDependent() {
return fMutable;
}
-
+
public void update() {
// empty default implementation
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
index 66d55b4c7..4a90f1906 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java
@@ -21,56 +21,56 @@ import org.eclipse.swt.graphics.Image;
* e.g. a <code>DiffNode</code>.
*/
public class MergeViewerContentProvider implements IMergeViewerContentProvider {
-
+
public static final char ANCESTOR_CONTRIBUTOR = 'A';
public static final char RIGHT_CONTRIBUTOR = 'R';
public static final char LEFT_CONTRIBUTOR = 'L';
-
+
private CompareConfiguration fCompareConfiguration;
private String fAncestorError;
private String fLeftError;
private String fRightError;
-
+
public MergeViewerContentProvider(CompareConfiguration cc) {
fCompareConfiguration= cc;
}
-
+
private boolean hasError() {
return fAncestorError != null || fLeftError != null || fRightError != null;
}
-
+
public void dispose() {
// empty default implementation
}
-
+
public void inputChanged(Viewer v, Object o1, Object o2) {
// we are not interested since we have no state
}
-
+
//---- ancestor
-
+
public void setAncestorError(String errorMessage) {
fAncestorError= errorMessage;
}
-
+
public String getAncestorLabel(Object element) {
if (fAncestorError != null)
return fAncestorError;
return fCompareConfiguration.getAncestorLabel(element);
}
-
+
public Image getAncestorImage(Object element) {
if (fAncestorError != null)
return null;
return fCompareConfiguration.getAncestorImage(element);
}
-
+
public Object getAncestorContent(Object element) {
if (element instanceof ICompareInput)
return ((ICompareInput) element).getAncestor();
return null;
}
-
+
public boolean showAncestor(Object element) {
if (element instanceof ICompareInput)
return true; // fix for #45239: Show ancestor for incoming and outgoing changes
@@ -79,29 +79,29 @@ public class MergeViewerContentProvider implements IMergeViewerContentProvider {
}
//---- left
-
+
public void setLeftError(String errorMessage) {
fLeftError= errorMessage;
}
-
+
public String getLeftLabel(Object element) {
if (fLeftError != null)
return fLeftError;
return fCompareConfiguration.getLeftLabel(element);
}
-
+
public Image getLeftImage(Object element) {
if (fLeftError != null)
return null;
return fCompareConfiguration.getLeftImage(element);
}
-
- public Object getLeftContent(Object element) {
+
+ public Object getLeftContent(Object element) {
if (element instanceof ICompareInput)
return ((ICompareInput) element).getLeft();
return null;
}
-
+
public boolean isLeftEditable(Object element) {
if (hasError())
return false;
@@ -134,34 +134,34 @@ public class MergeViewerContentProvider implements IMergeViewerContentProvider {
((ResourceCompareInput.MyDiffNode)node).fireChange();
} else {
node.copy(false);
- }
+ }
}
}
-
+
//---- right
-
+
public void setRightError(String errorMessage) {
fRightError= errorMessage;
}
-
+
public String getRightLabel(Object element) {
if (fRightError != null)
return fRightError;
return fCompareConfiguration.getRightLabel(element);
}
-
+
public Image getRightImage(Object element) {
if (fRightError != null)
return null;
return fCompareConfiguration.getRightImage(element);
}
-
+
public Object getRightContent(Object element) {
if (element instanceof ICompareInput)
return ((ICompareInput) element).getRight();
return null;
}
-
+
public boolean isRightEditable(Object element) {
if (hasError())
return false;
@@ -177,7 +177,7 @@ public class MergeViewerContentProvider implements IMergeViewerContentProvider {
}
return false;
}
-
+
public void saveRightContent(Object element, byte[] bytes) {
if (element instanceof ICompareInput) {
ICompareInput node= (ICompareInput) element;
@@ -194,7 +194,7 @@ public class MergeViewerContentProvider implements IMergeViewerContentProvider {
((ResourceCompareInput.MyDiffNode)node).fireChange();
} else {
node.copy(true);
- }
+ }
}
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NavigationEndDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NavigationEndDialog.java
index af56d2a98..0cb023fad 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NavigationEndDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/NavigationEndDialog.java
@@ -16,7 +16,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.*;
public class NavigationEndDialog extends MessageDialogWithToggle {
-
+
private final String[][] labelsAndValues;
private RadioGroupFieldEditor editor;
@@ -27,7 +27,7 @@ public class NavigationEndDialog extends MessageDialogWithToggle {
CompareMessages.NavigationEndDialog_0, false);
this.labelsAndValues = labelsAndValues;
}
-
+
protected Control createCustomArea(Composite parent) {
editor = new RadioGroupFieldEditor(ICompareUIConstants.PREF_NAVIGATION_END_ACTION_LOCAL, CompareMessages.NavigationEndDialog_1, 1,
labelsAndValues,
@@ -37,7 +37,7 @@ public class NavigationEndDialog extends MessageDialogWithToggle {
editor.load();
return parent;
}
-
+
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
editor.store();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OutlineViewerCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OutlineViewerCreator.java
index bdb26d0fd..a81ef156a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OutlineViewerCreator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OutlineViewerCreator.java
@@ -19,7 +19,7 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Composite;
/**
- * Class which allows content merge viewer to provide a structure viewer that can be used in the outline
+ * Class which allows content merge viewer to provide a structure viewer that can be used in the outline
* view.
*/
public abstract class OutlineViewerCreator {
@@ -28,9 +28,9 @@ public abstract class OutlineViewerCreator {
* Property constant that identifies the input of the outline view.
*/
public static final String PROP_INPUT = "org.eclipse.compare.OutlineInput"; //$NON-NLS-1$
-
+
private ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
-
+
/**
* Method called by the editor to create a structure viewer for the current content merge viewer.
* @param oldViewer the current viewer that is being used to show the structure
@@ -41,9 +41,9 @@ public abstract class OutlineViewerCreator {
*/
public abstract Viewer findStructureViewer(Viewer oldViewer, ICompareInput input,
Composite parent, CompareConfiguration configuration);
-
+
public abstract boolean hasViewerFor(Object input);
-
+
public void addPropertyChangeListener(IPropertyChangeListener listener) {
listeners.add(listener);
}
@@ -51,7 +51,7 @@ public abstract class OutlineViewerCreator {
public void removePropertyChangeListener(IPropertyChangeListener listener) {
listeners.remove(listener);
}
-
+
public void fireInputChange(Object oldInput, Object newInput) {
Object[] list = listeners.getListeners();
final PropertyChangeEvent event = new PropertyChangeEvent(this, PROP_INPUT, oldInput, newInput);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
index f0e7320a2..afc30e194 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/OverlayPreferenceStore.java
@@ -19,58 +19,58 @@ import org.eclipse.jface.util.PropertyChangeEvent;
* An overlaying preference store.
*/
public class OverlayPreferenceStore implements IPreferenceStore {
-
-
+
+
public static final class TypeDescriptor {
private TypeDescriptor() {
// nothing to do
}
}
-
+
public static final TypeDescriptor BOOLEAN= new TypeDescriptor();
public static final TypeDescriptor DOUBLE= new TypeDescriptor();
public static final TypeDescriptor FLOAT= new TypeDescriptor();
public static final TypeDescriptor INT= new TypeDescriptor();
public static final TypeDescriptor LONG= new TypeDescriptor();
public static final TypeDescriptor STRING= new TypeDescriptor();
-
+
public static class OverlayKey {
-
+
TypeDescriptor fDescriptor;
String fKey;
-
+
public OverlayKey(TypeDescriptor descriptor, String key) {
fDescriptor= descriptor;
fKey= key;
}
}
-
+
private class PropertyListener implements IPropertyChangeListener {
-
+
/*
* @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
*/
public void propertyChange(PropertyChangeEvent event) {
OverlayKey key= findOverlayKey(event.getProperty());
if (key != null)
- propagateProperty(fParent, key, fStore);
+ propagateProperty(fParent, key, fStore);
}
}
-
-
+
+
private IPreferenceStore fParent;
private IPreferenceStore fStore;
private OverlayKey[] fOverlayKeys;
-
+
private PropertyListener fPropertyListener;
-
-
+
+
public OverlayPreferenceStore(IPreferenceStore parent, OverlayKey[] overlayKeys) {
fParent= parent;
fOverlayKeys= overlayKeys;
fStore= new PreferenceStore();
}
-
+
private OverlayKey findOverlayKey(String key) {
for (int i= 0; i < fOverlayKeys.length; i++) {
if (fOverlayKeys[i].fKey.equals(key))
@@ -78,41 +78,41 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
return null;
}
-
+
private boolean covers(String key) {
return (findOverlayKey(key) != null);
}
-
+
private void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {
-
+
if (orgin.isDefault(key.fKey)) {
if (!target.isDefault(key.fKey))
target.setToDefault(key.fKey);
return;
}
-
+
TypeDescriptor d= key.fDescriptor;
if (BOOLEAN == d) {
-
+
boolean originValue= orgin.getBoolean(key.fKey);
boolean targetValue= target.getBoolean(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
-
+
} else if (DOUBLE == d) {
-
+
double originValue= orgin.getDouble(key.fKey);
double targetValue= target.getDouble(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
-
+
} else if (FLOAT == d) {
-
+
float originValue= orgin.getFloat(key.fKey);
float targetValue= target.getFloat(key.fKey);
if (targetValue != originValue)
target.setValue(key.fKey, originValue);
-
+
} else if (INT == d) {
int originValue= orgin.getInt(key.fKey);
@@ -136,97 +136,97 @@ public class OverlayPreferenceStore implements IPreferenceStore {
}
}
-
+
public void propagate() {
for (int i= 0; i < fOverlayKeys.length; i++)
propagateProperty(fStore, fOverlayKeys[i], fParent);
}
-
+
private void loadProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target, boolean forceInitialization) {
TypeDescriptor d= key.fDescriptor;
if (BOOLEAN == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, true);
target.setValue(key.fKey, orgin.getBoolean(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultBoolean(key.fKey));
-
+
} else if (DOUBLE == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1.0D);
target.setValue(key.fKey, orgin.getDouble(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultDouble(key.fKey));
-
+
} else if (FLOAT == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1.0F);
target.setValue(key.fKey, orgin.getFloat(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultFloat(key.fKey));
-
+
} else if (INT == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1);
target.setValue(key.fKey, orgin.getInt(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultInt(key.fKey));
-
+
} else if (LONG == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, 1L);
target.setValue(key.fKey, orgin.getLong(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultLong(key.fKey));
-
+
} else if (STRING == d) {
-
+
if (forceInitialization)
target.setValue(key.fKey, "1"); //$NON-NLS-1$
target.setValue(key.fKey, orgin.getString(key.fKey));
target.setDefault(key.fKey, orgin.getDefaultString(key.fKey));
-
+
}
}
-
+
public void load() {
for (int i= 0; i < fOverlayKeys.length; i++)
loadProperty(fParent, fOverlayKeys[i], fStore, true);
}
-
+
public void loadDefaults() {
for (int i= 0; i < fOverlayKeys.length; i++)
setToDefault(fOverlayKeys[i].fKey);
}
-
+
public void start() {
if (fPropertyListener == null) {
fPropertyListener= new PropertyListener();
fParent.addPropertyChangeListener(fPropertyListener);
}
}
-
+
public void stop() {
if (fPropertyListener != null) {
fParent.removePropertyChangeListener(fPropertyListener);
fPropertyListener= null;
}
}
-
+
/*
* @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener)
*/
public void addPropertyChangeListener(IPropertyChangeListener listener) {
fStore.addPropertyChangeListener(listener);
}
-
+
/*
* @see IPreferenceStore#removePropertyChangeListener(IPropertyChangeListener)
*/
public void removePropertyChangeListener(IPropertyChangeListener listener) {
fStore.removePropertyChangeListener(listener);
}
-
+
/*
* @see IPreferenceStore#firePropertyChangeEvent(String, Object, Object)
*/
@@ -240,7 +240,7 @@ public class OverlayPreferenceStore implements IPreferenceStore {
public boolean contains(String name) {
return fStore.contains(name);
}
-
+
/*
* @see IPreferenceStore#getBoolean(String)
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
index 3c4277f15..306e591cc 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithEditionAction.java
@@ -12,7 +12,7 @@ package org.eclipse.compare.internal;
public class ReplaceWithEditionAction extends EditionAction {
-
+
public ReplaceWithEditionAction() {
super(true, "org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$
fHelpContextId= ICompareContextIds.REPLACE_WITH_EDITION_DIALOG;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
index 67ecb9783..73b112404 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ReplaceWithPreviousEditionAction.java
@@ -12,7 +12,7 @@ package org.eclipse.compare.internal;
public class ReplaceWithPreviousEditionAction extends EditionAction {
-
+
public ReplaceWithPreviousEditionAction() {
super(true,
"org.eclipse.compare.internal.ReplaceWithEditionAction"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
index e65639195..f5dfa9f9a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResizableDialog.java
@@ -33,7 +33,7 @@ public abstract class ResizableDialog extends Dialog {
private static final String Y= "y"; //$NON-NLS-1$
private static final String WIDTH= "width"; //$NON-NLS-1$
private static final String HEIGHT= "height"; //$NON-NLS-1$
-
+
protected ResourceBundle fBundle;
private Rectangle fNewBounds;
private IDialogSettings fSettings;
@@ -43,12 +43,12 @@ public abstract class ResizableDialog extends Dialog {
public ResizableDialog(Shell parent, ResourceBundle bundle) {
super(parent);
setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX);
-
+
fBundle= bundle;
-
+
fSettings= CompareUIPlugin.getDefault().getDialogSettings();
}
-
+
public void setHelpContextId(String contextId) {
fContextId= contextId;
}
@@ -61,12 +61,12 @@ public abstract class ResizableDialog extends Dialog {
if (fContextId != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, fContextId);
}
-
+
protected Point getInitialSize() {
-
+
int width= 0;
int height= 0;
-
+
final Shell s= getShell();
if (s != null) {
s.addControlListener(
@@ -80,7 +80,7 @@ public abstract class ResizableDialog extends Dialog {
}
);
}
-
+
IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY);
if (bounds == null) {
if (fBundle != null) {
@@ -117,14 +117,14 @@ public abstract class ResizableDialog extends Dialog {
} catch (NumberFormatException e) {
height= 500;
}
- }
-
+ }
+
return new Point(width, height);
}
-
+
protected Point getInitialLocation(Point initialSize) {
Point loc= super.getInitialLocation(initialSize);
-
+
IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY);
if (bounds != null) {
try {
@@ -140,7 +140,7 @@ public abstract class ResizableDialog extends Dialog {
}
return loc;
}
-
+
public boolean close() {
boolean closed= super.close();
if (closed && fNewBounds != null)
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
index 8c0807f2f..c6ebbf8b4 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
@@ -60,9 +60,9 @@ import com.ibm.icu.text.MessageFormat;
* A two-way or three-way compare for arbitrary IResources.
*/
class ResourceCompareInput extends CompareEditorInput {
-
+
private static final boolean NORMALIZE_CASE= true;
-
+
private boolean fThreeWay= false;
private Object fRoot;
private IStructureComparator fAncestor;
@@ -73,14 +73,14 @@ class ResourceCompareInput extends CompareEditorInput {
private IResource fRightResource;
private DiffTreeViewer fDiffViewer;
private IAction fOpenAction;
-
+
class MyDiffNode extends DiffNode {
-
+
private boolean fDirty= false;
private ITypedElement fLastId;
private String fLastName;
-
-
+
+
public MyDiffNode(IDiffContainer parent, int description, ITypedElement ancestor, ITypedElement left, ITypedElement right) {
super(parent, description, ancestor, left, right);
}
@@ -101,7 +101,7 @@ class ResourceCompareInput extends CompareEditorInput {
return '<' + fLastName + '>';
return fLastName;
}
-
+
public ITypedElement getId() {
ITypedElement id= super.getId();
if (id == null)
@@ -110,7 +110,7 @@ class ResourceCompareInput extends CompareEditorInput {
return id;
}
}
-
+
static class FilteredBufferedResourceNode extends BufferedResourceNode {
FilteredBufferedResourceNode(IResource resource) {
super(resource);
@@ -122,18 +122,18 @@ class ResourceCompareInput extends CompareEditorInput {
return new FilteredBufferedResourceNode(child);
}
}
-
+
/*
* Creates an compare editor input for the given selection.
*/
ResourceCompareInput(CompareConfiguration config) {
super(config);
}
-
+
public Viewer createDiffViewer(Composite parent) {
fDiffViewer= new DiffTreeViewer(parent, getCompareConfiguration()) {
protected void fillContextMenu(IMenuManager manager) {
-
+
if (fOpenAction == null) {
fOpenAction= new Action() {
public void run() {
@@ -142,7 +142,7 @@ class ResourceCompareInput extends CompareEditorInput {
};
Utilities.initAction(fOpenAction, getBundle(), "action.CompareContents."); //$NON-NLS-1$
}
-
+
boolean enable= false;
ISelection selection= getSelection();
if (selection instanceof IStructuredSelection) {
@@ -158,9 +158,9 @@ class ResourceCompareInput extends CompareEditorInput {
}
}
fOpenAction.setEnabled(enable);
-
+
manager.add(fOpenAction);
-
+
super.fillContextMenu(manager);
}
};
@@ -172,9 +172,9 @@ class ResourceCompareInput extends CompareEditorInput {
IResource ancestorResource;
IResource leftResource;
IResource rightResource;
-
+
private Button[] buttons;
-
+
public SelectAncestorDialog(Shell parentShell, IResource[] theResources) {
super(parentShell, CompareMessages.SelectAncestorDialog_title,
null, CompareMessages.SelectAncestorDialog_message,
@@ -183,7 +183,7 @@ class ResourceCompareInput extends CompareEditorInput {
IDialogConstants.CANCEL_LABEL }, 0);
this.theResources = theResources;
}
-
+
protected Control createCustomArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
@@ -206,7 +206,7 @@ class ResourceCompareInput extends CompareEditorInput {
leftResource = theResources[i == 0 ? 1 : 0];
rightResource = theResources[i == 2 ? 1 : 2];
}
-
+
private SelectionListener selectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Button selectedButton = (Button) e.widget;
@@ -231,14 +231,14 @@ class ResourceCompareInput extends CompareEditorInput {
IResource[] selection= Utilities.getResources(s);
fThreeWay= selection.length == 3;
-
+
if (fThreeWay) {
SelectAncestorDialog dialog =
new SelectAncestorDialog(shell, selection);
int code = dialog.open();
if (code != Window.OK)
return false;
-
+
fAncestorResource= dialog.ancestorResource;
fAncestor= getStructure(fAncestorResource);
fLeftResource= dialog.leftResource;
@@ -290,23 +290,23 @@ class ResourceCompareInput extends CompareEditorInput {
* Returns true if compare can be executed for the given selection.
*/
public boolean isEnabled(ISelection s) {
-
+
IResource[] selection= Utilities.getResources(s);
if (selection.length < 2 || selection.length > 3)
return false;
boolean threeWay= selection.length == 3;
-
+
if (threeWay)
// It only makes sense if they're all mutually comparable.
// If not, the user should compare two of them.
return comparable(selection[0], selection[1])
&& comparable(selection[0], selection[2])
&& comparable(selection[1], selection[2]);
-
+
return comparable(selection[0], selection[1]);
}
-
+
/**
* Initializes the images in the compare configuration.
*/
@@ -320,27 +320,27 @@ class ResourceCompareInput extends CompareEditorInput {
cc.setRightLabel(buildLabel(fRightResource));
cc.setRightImage(CompareUIPlugin.getImage(fRightResource));
}
- if (fThreeWay && fAncestorResource != null) {
+ if (fThreeWay && fAncestorResource != null) {
cc.setAncestorLabel(buildLabel(fAncestorResource));
cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource));
}
}
-
+
/*
* Returns true if both resources are either structured or unstructured.
*/
private boolean comparable(IResource c1, IResource c2) {
return hasStructure(c1) == hasStructure(c2);
}
-
+
/*
* Returns true if the given argument has a structure.
*/
private boolean hasStructure(IResource input) {
-
+
if (input instanceof IContainer)
return true;
-
+
if (input instanceof IFile) {
IFile file= (IFile) input;
String type= file.getFileExtension();
@@ -349,20 +349,20 @@ class ResourceCompareInput extends CompareEditorInput {
return "JAR".equals(type) || "ZIP".equals(type); //$NON-NLS-2$ //$NON-NLS-1$
}
}
-
+
return false;
}
-
+
/*
* Creates a <code>IStructureComparator</code> for the given input.
* Returns <code>null</code> if no <code>IStructureComparator</code>
* can be found for the <code>IResource</code>.
*/
private IStructureComparator getStructure(IResource input) {
-
+
if (input instanceof IContainer)
return new FilteredBufferedResourceNode(input);
-
+
if (input instanceof IFile) {
IStructureComparator rn= new FilteredBufferedResourceNode(input);
IFile file= (IFile) input;
@@ -373,57 +373,57 @@ class ResourceCompareInput extends CompareEditorInput {
}
return null;
}
-
+
/*
* Performs a two-way or three-way diff on the current selection.
*/
public Object prepareInput(IProgressMonitor pm) throws InvocationTargetException {
-
+
try {
- // fix for PR 1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty
+ // fix for PR 1GFMLFB: ITPUI:WIN2000 - files that are out of sync with the file system appear as empty
fLeftResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
fRightResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
if (fThreeWay && fAncestorResource != null)
fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm);
- // end fix
-
+ // end fix
+
pm.beginTask(Utilities.getString("ResourceCompare.taskName"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
String leftLabel= fLeftResource.getName();
String rightLabel= fRightResource.getName();
-
+
String title;
- if (fThreeWay) {
+ if (fThreeWay) {
String format= Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$
String ancestorLabel= fAncestorResource.getName();
- title= MessageFormat.format(format, ancestorLabel, leftLabel, rightLabel);
+ title= MessageFormat.format(format, ancestorLabel, leftLabel, rightLabel);
} else {
String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$
title= MessageFormat.format(format, leftLabel, rightLabel);
}
setTitle(title);
-
+
Differencer d= new Differencer() {
protected Object visit(Object parent, int description, Object ancestor, Object left, Object right) {
return new MyDiffNode((IDiffContainer) parent, description, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
}
};
-
+
fRoot= d.findDifferences(fThreeWay, pm, null, fAncestor, fLeft, fRight);
return fRoot;
-
+
} catch (CoreException ex) {
throw new InvocationTargetException(ex);
} finally {
pm.done();
}
}
-
+
public String getToolTipText() {
if (fLeftResource != null && fRightResource != null) {
String leftLabel= fLeftResource.getFullPath().makeRelative().toString();
- String rightLabel= fRightResource.getFullPath().makeRelative().toString();
- if (fThreeWay) {
+ String rightLabel= fRightResource.getFullPath().makeRelative().toString();
+ if (fThreeWay) {
String format= Utilities.getString("ResourceCompare.threeWay.tooltip"); //$NON-NLS-1$
String ancestorLabel= fAncestorResource.getFullPath().makeRelative().toString();
return MessageFormat.format(format, ancestorLabel, leftLabel, rightLabel);
@@ -434,7 +434,7 @@ class ResourceCompareInput extends CompareEditorInput {
// fall back
return super.getToolTipText();
}
-
+
private String buildLabel(IResource r) {
// for a linked resource in a hidden project use its local file system location
if (r.isLinked() && r.getProject().isHidden())
@@ -444,7 +444,7 @@ class ResourceCompareInput extends CompareEditorInput {
return n.substring(1);
return n;
}
-
+
public void saveChanges(IProgressMonitor pm) throws CoreException {
super.saveChanges(pm);
if (fRoot instanceof DiffNode) {
@@ -452,24 +452,24 @@ class ResourceCompareInput extends CompareEditorInput {
commit(pm, (DiffNode) fRoot);
} finally {
if (fDiffViewer != null)
- fDiffViewer.refresh();
+ fDiffViewer.refresh();
setDirty(false);
}
}
}
-
+
/*
* Recursively walks the diff tree and commits all changes.
*/
private static void commit(IProgressMonitor pm, DiffNode node) throws CoreException {
-
- if (node instanceof MyDiffNode)
+
+ if (node instanceof MyDiffNode)
((MyDiffNode)node).clearDirty();
-
+
ITypedElement left= node.getLeft();
if (left instanceof BufferedResourceNode)
((BufferedResourceNode) left).commit(pm);
-
+
ITypedElement right= node.getRight();
if (right instanceof BufferedResourceNode)
((BufferedResourceNode) right).commit(pm);
@@ -483,7 +483,7 @@ class ResourceCompareInput extends CompareEditorInput {
}
}
}
-
+
/* (non Javadoc)
* see IAdaptable.getAdapter
*/
@@ -504,11 +504,11 @@ class ResourceCompareInput extends CompareEditorInput {
}
return super.getAdapter(adapter);
}
-
+
private void collectDirtyResources(Object o, Set collector) {
if (o instanceof DiffNode) {
DiffNode node= (DiffNode) o;
-
+
ITypedElement left= node.getLeft();
if (left instanceof BufferedResourceNode) {
BufferedResourceNode bn= (BufferedResourceNode) left;
@@ -528,7 +528,7 @@ class ResourceCompareInput extends CompareEditorInput {
collector.add(resource);
}
}
-
+
IDiffElement[] children= node.getChildren();
if (children != null) {
for (int i= 0; i < children.length; i++) {
@@ -539,13 +539,13 @@ class ResourceCompareInput extends CompareEditorInput {
}
}
}
-
+
private static String normalizeCase(String s) {
if (NORMALIZE_CASE && s != null)
return s.toUpperCase();
return s;
}
-
+
public boolean canRunAsJob() {
return true;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java
index 02ce74f42..ff56bd8e5 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ShowWhitespaceAction.java
@@ -58,7 +58,7 @@ public class ShowWhitespaceAction extends TextEditorPropertyAction {
fNeedsPainters = needsPainters;
synchronizeWithPreference();
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.compare.internal.TextEditorPropertyAction#synchronizeWithPreference()
@@ -115,13 +115,13 @@ public class ShowWhitespaceAction extends TextEditorPropertyAction {
}
return true;
}
-
+
private synchronized Map getPainters() {
if (fPainters == null)
fPainters = new HashMap();
return fPainters;
}
-
+
private void showWhitespace() {
if (isWhitespaceShowing)
return;
@@ -147,7 +147,7 @@ public class ShowWhitespaceAction extends TextEditorPropertyAction {
isWhitespaceShowing = true;
}
}
-
+
private void hideWhitespace() {
Map painters = getPainters();
for (Iterator iterator = painters.keySet().iterator(); iterator.hasNext();) {
@@ -161,5 +161,5 @@ public class ShowWhitespaceAction extends TextEditorPropertyAction {
painters.clear();
isWhitespaceShowing = false;
}
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
index 12f86fc1b..64d4c6da7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/SimpleTextViewer.java
@@ -23,20 +23,20 @@ import org.eclipse.compare.structuremergeviewer.ICompareInput;
public class SimpleTextViewer extends AbstractViewer {
-
+
private SourceViewer fSourceViewer;
private ICompareInput fInput;
-
-
+
+
SimpleTextViewer(Composite parent) {
fSourceViewer= new SourceViewer(parent, null, SWT.H_SCROLL | SWT.V_SCROLL);
fSourceViewer.setEditable(false);
}
-
+
public Control getControl() {
return fSourceViewer.getTextWidget();
}
-
+
public void setInput(Object input) {
if (input instanceof IStreamContentAccessor) {
fSourceViewer.setDocument(new Document(getString(input)));
@@ -46,13 +46,13 @@ public class SimpleTextViewer extends AbstractViewer {
fSourceViewer.setDocument(new Document(getString(left)));
}
}
-
+
public Object getInput() {
return fInput;
}
-
+
private String getString(Object input) {
-
+
if (input instanceof IStreamContentAccessor) {
try {
return Utilities.readString((IStreamContentAccessor) input);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StructureCreatorDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StructureCreatorDescriptor.java
index 3b6a1944a..551a2532a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StructureCreatorDescriptor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/StructureCreatorDescriptor.java
@@ -19,12 +19,12 @@ import org.eclipse.compare.structuremergeviewer.IStructureCreator;
* A factory proxy for creating a StructureCreator.
*/
public class StructureCreatorDescriptor {
-
+
private final static String CLASS_ATTRIBUTE= "class"; //$NON-NLS-1$
private final static String EXTENSIONS_ATTRIBUTE= "extensions"; //$NON-NLS-1$
-
+
private IConfigurationElement fElement;
-
+
/*
* Creates a new sorter node with the given configuration element.
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
index 07ed78ab0..166621276 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TabFolderLayout.java
@@ -22,7 +22,7 @@ public class TabFolderLayout extends Layout {
protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
return new Point(wHint, hHint);
-
+
Control [] children = composite.getChildren ();
int count = children.length;
int maxWidth = 0, maxHeight = 0;
@@ -32,19 +32,19 @@ public class TabFolderLayout extends Layout {
maxWidth = Math.max (maxWidth, pt.x);
maxHeight = Math.max (maxHeight, pt.y);
}
-
+
if (wHint != SWT.DEFAULT)
maxWidth= wHint;
if (hHint != SWT.DEFAULT)
maxHeight= hHint;
-
- return new Point(maxWidth, maxHeight);
-
+
+ return new Point(maxWidth, maxHeight);
+
}
-
+
protected void layout (Composite composite, boolean flushCache) {
Rectangle rect= composite.getClientArea();
-
+
Control[] children = composite.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].setBounds(rect);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java
index bf83fd27a..2d4b97189 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/TextEditorPropertyAction.java
@@ -22,7 +22,7 @@ public class TextEditorPropertyAction extends Action implements IPropertyChangeL
private final MergeSourceViewer[] viewers;
private final String preferenceKey;
private IPreferenceStore store;
-
+
public TextEditorPropertyAction(String label, MergeSourceViewer[] viewers, String preferenceKey) {
super(label, IAction.AS_CHECK_BOX);
this.viewers = viewers;
@@ -44,13 +44,13 @@ public class TextEditorPropertyAction extends Action implements IPropertyChangeL
public MergeSourceViewer[] getViewers() {
return viewers;
}
-
+
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(getPreferenceKey())) {
synchronizeWithPreference();
}
}
-
+
protected void synchronizeWithPreference() {
boolean checked = false;
if (store != null) {
@@ -65,18 +65,18 @@ public class TextEditorPropertyAction extends Action implements IPropertyChangeL
public String getPreferenceKey() {
return preferenceKey;
}
-
+
public void run() {
toggleState(isChecked());
if (store != null)
store.setValue(getPreferenceKey(), isChecked());
}
-
+
public void dispose() {
if (store != null)
store.removePropertyChangeListener(this);
}
-
+
/**
* @param checked
* new state
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
index 5145ef68d..9c6b04971 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ViewerDescriptor.java
@@ -40,7 +40,7 @@ public class ViewerDescriptor implements IViewerDescriptor {
//System.out.println("reused viewer: " + currentViewer.getClass().getName());
return currentViewer;
}
-
+
if (fViewerCreator == null) {
try {
fViewerCreator= (IViewerCreator) fConfiguration.createExecutableExtension(CLASS_ATTRIBUTE);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkQueue.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkQueue.java
index 43670e2e6..55b3a07fe 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkQueue.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkQueue.java
@@ -21,7 +21,7 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
* previous location and aded to the end of the queue.
*/
public class WorkQueue {
-
+
private List runnables = new ArrayList();
public boolean add(IRunnableWithProgress runnable) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java
index 3582c1b31..614ac02be 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Worker.java
@@ -34,7 +34,7 @@ public class Worker implements IRunnableWithProgress {
private WorkProgressMonitor currentMonitor;
private IRunnableWithProgress currentTask;
private final String taskName;
-
+
/**
* Progress monitor that supports local cancellation of a task.
*/
@@ -54,11 +54,11 @@ public class Worker implements IRunnableWithProgress {
return localCancel || super.isCanceled();
}
}
-
+
public Worker(String taskName) {
this.taskName = taskName;
}
-
+
@Override
public void run(IProgressMonitor monitor) {
errors.clear();
@@ -98,7 +98,7 @@ public class Worker implements IRunnableWithProgress {
private void handleError(Throwable targetException) {
errors.add(targetException);
}
-
+
public Throwable[] getErrors() {
return errors.toArray(new Throwable[errors.size()]);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java
index 04f107e9a..d25e52e7a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/WorkerJob.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
public class WorkerJob extends Job {
private final Worker worker;
-
+
public WorkerJob(String name) {
super(name);
worker = new Worker(name);
@@ -33,7 +33,7 @@ public class WorkerJob extends Job {
schedule();
return result;
}
-
+
private IStatus getResult(Worker w) {
Throwable[] errors = w.getErrors();
if (errors.length == 0)
@@ -47,11 +47,11 @@ public class WorkerJob extends Job {
}
return new MultiStatus(CompareUIPlugin.PLUGIN_ID, 0, (IStatus[]) statii.toArray(new IStatus[statii.size()]), CompareMessages.WorkerJob_0, null);
}
-
+
public boolean shouldRun() {
return worker.hasWork();
}
-
+
public void add(IRunnableWithProgress runnable) {
worker.add(runnable);
schedule();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
index 43738a7a9..40c0fc6e7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/DocumentMerger.java
@@ -55,27 +55,27 @@ import org.eclipse.compare.structuremergeviewer.Differencer;
/**
* A document merger manages the differences between two documents
- * for either a 2-way or 3-way comparison.
+ * for either a 2-way or 3-way comparison.
* <p>
* This class should not have any UI dependencies.
*/
public class DocumentMerger {
private static final String DIFF_RANGE_CATEGORY = CompareUIPlugin.PLUGIN_ID + ".DIFF_RANGE_CATEGORY"; //$NON-NLS-1$
-
+
/** Selects between smartTokenDiff and mergingTokenDiff */
private static final boolean USE_MERGING_TOKEN_DIFF= false;
-
+
/** if true copying conflicts from one side to other concatenates both sides */
private static final boolean APPEND_CONFLICT= true;
-
+
/** All diffs for calculating scrolling position (includes line ranges without changes) */
private ArrayList fAllDiffs;
/** Subset of above: just real differences. */
private ArrayList fChangeDiffs;
-
+
private IDocumentMergerInput fInput;
-
+
/**
* Interface that defines that input to the document merge process
*/
@@ -92,7 +92,7 @@ public class DocumentMerger {
CompareConfiguration getCompareConfiguration();
ITokenComparator createTokenComparator(String s);
-
+
boolean isHunkOnLeft();
int getHunkStart();
@@ -103,7 +103,7 @@ public class DocumentMerger {
boolean isPatchHunkOk();
}
-
+
public class Diff {
/** character range in ancestor document */
Position fAncestorPos;
@@ -112,7 +112,7 @@ public class DocumentMerger {
/** character range in right document */
Position fRightPos;
/** if this is a TokenDiff fParent points to the enclosing LineDiff */
- Diff fParent;
+ Diff fParent;
/** if Diff has been resolved */
boolean fResolved;
int fDirection;
@@ -129,13 +129,13 @@ public class DocumentMerger {
IDocument rightDoc, Position rRange, int rightStart, int rightEnd) {
fParent= parent != null ? parent : this;
fDirection= dir;
-
+
fLeftPos= createPosition(leftDoc, lRange, leftStart, leftEnd);
fRightPos= createPosition(rightDoc, rRange, rightStart, rightEnd);
if (ancestorDoc != null)
fAncestorPos= createPosition(ancestorDoc, aRange, ancestorStart, ancestorEnd);
}
-
+
public Position getPosition(char type) {
switch (type) {
case MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR:
@@ -147,30 +147,30 @@ public class DocumentMerger {
}
return null;
}
-
+
boolean isInRange(char type, int pos) {
Position p= getPosition(type);
return (pos >= p.offset) && (pos < (p.offset+p.length));
}
-
+
public String changeType() {
boolean leftEmpty= fLeftPos.length == 0;
boolean rightEmpty= fRightPos.length == 0;
-
+
if (fDirection == RangeDifference.LEFT) {
if (!leftEmpty && rightEmpty)
- return CompareMessages.TextMergeViewer_changeType_addition;
+ return CompareMessages.TextMergeViewer_changeType_addition;
if (leftEmpty && !rightEmpty)
- return CompareMessages.TextMergeViewer_changeType_deletion;
+ return CompareMessages.TextMergeViewer_changeType_deletion;
} else {
if (leftEmpty && !rightEmpty)
- return CompareMessages.TextMergeViewer_changeType_addition;
+ return CompareMessages.TextMergeViewer_changeType_addition;
if (!leftEmpty && rightEmpty)
- return CompareMessages.TextMergeViewer_changeType_deletion;
+ return CompareMessages.TextMergeViewer_changeType_deletion;
}
- return CompareMessages.TextMergeViewer_changeType_change;
+ return CompareMessages.TextMergeViewer_changeType_change;
}
-
+
public Image getImage() {
int code= Differencer.CHANGE;
switch (fDirection) {
@@ -189,27 +189,27 @@ public class DocumentMerger {
return getCompareConfiguration().getImage(code);
return null;
}
-
+
Position createPosition(IDocument doc, Position range, int start, int end) {
try {
int l= end-start;
if (range != null) {
int dl= range.length;
if (l > dl)
- l= dl;
+ l= dl;
} else {
int dl= doc.getLength();
if (start+l > dl)
l= dl-start;
}
-
+
Position p= null;
try {
p= new Position(start, l);
} catch (RuntimeException ex) {
p= new Position(0, 0);
}
-
+
try {
doc.addPosition(DIFF_RANGE_CATEGORY, p);
} catch (BadPositionCategoryException ex) {
@@ -227,13 +227,13 @@ public class DocumentMerger {
fDiffs= new ArrayList<>();
fDiffs.add(d);
}
-
+
public boolean isDeleted() {
if (fAncestorPos != null && fAncestorPos.isDeleted())
return true;
return fLeftPos.isDeleted() || fRightPos.isDeleted();
}
-
+
void setResolved(boolean r) {
fResolved= r;
if (r)
@@ -252,7 +252,7 @@ public class DocumentMerger {
}
return fResolved;
}
-
+
Position getPosition(int contributor) {
if (contributor == MergeViewerContentProvider.LEFT_CONTRIBUTOR)
return fLeftPos;
@@ -262,7 +262,7 @@ public class DocumentMerger {
return fAncestorPos;
return null;
}
-
+
/*
* Returns true if given character range overlaps with this Diff.
*/
@@ -278,7 +278,7 @@ public class DocumentMerger {
}
return false;
}
-
+
public int getMaxDiffHeight() {
Point region= new Point(0, 0);
int h= getLineRange(getDocument(MergeViewerContentProvider.LEFT_CONTRIBUTOR), fLeftPos, region).y;
@@ -286,19 +286,19 @@ public class DocumentMerger {
h= Math.max(h, getLineRange(getDocument(MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR), fAncestorPos, region).y);
return Math.max(h, getLineRange(getDocument(MergeViewerContentProvider.RIGHT_CONTRIBUTOR), fRightPos, region).y);
}
-
+
public int getAncestorHeight() {
- Point region= new Point(0, 0);
+ Point region= new Point(0, 0);
return getLineRange(getDocument(MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR), fAncestorPos, region).y;
}
public int getLeftHeight() {
- Point region= new Point(0, 0);
+ Point region= new Point(0, 0);
return getLineRange(getDocument(MergeViewerContentProvider.LEFT_CONTRIBUTOR), fLeftPos, region).y;
}
public int getRightHeight() {
- Point region= new Point(0, 0);
+ Point region= new Point(0, 0);
return getLineRange(getDocument(MergeViewerContentProvider.RIGHT_CONTRIBUTOR), fRightPos, region).y;
}
@@ -345,40 +345,40 @@ public class DocumentMerger {
return fDiffs.iterator();
}
}
-
+
public DocumentMerger(IDocumentMergerInput input) {
this.fInput = input;
}
-
+
/**
* Perform a two level 2- or 3-way diff.
* The first level is based on line comparison, the second level on token comparison.
- * @throws CoreException
+ * @throws CoreException
*/
public void doDiff() throws CoreException {
-
+
fChangeDiffs= new ArrayList();
IDocument lDoc = getDocument(MergeViewerContentProvider.LEFT_CONTRIBUTOR);
IDocument rDoc = getDocument(MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
-
+
if (lDoc == null || rDoc == null)
return;
-
+
Position lRegion= getRegion(MergeViewerContentProvider.LEFT_CONTRIBUTOR);
Position rRegion= getRegion(MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
-
+
IDocument aDoc = null;
Position aRegion= null;
if (isThreeWay() && !isIgnoreAncestor()) {
aDoc= getDocument(MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR);
aRegion= getRegion(MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR);
}
-
+
resetPositions(lDoc);
resetPositions(rDoc);
resetPositions(aDoc);
-
- boolean ignoreWhiteSpace= isIgnoreWhitespace();
+
+ boolean ignoreWhiteSpace= isIgnoreWhitespace();
ICompareFilter[] compareFilters = getCompareFilters();
DocLineComparator sright = new DocLineComparator(rDoc,
@@ -418,7 +418,7 @@ public class DocumentMerger {
monitor.done();
}
};
-
+
RangeDifference[] e= null;
try {
getCompareConfiguration().getContainer().run(true, true, runnable);
@@ -428,8 +428,8 @@ public class DocumentMerger {
Diff diff= new Diff(null, RangeDifference.NOCHANGE,
aDoc, aRegion, 0, aDoc != null ? aDoc.getLength() : 0,
lDoc, lRegion, 0, lDoc.getLength(),
- rDoc, rRegion, 0, rDoc.getLength());
-
+ rDoc, rRegion, 0, rDoc.getLength());
+
fAllDiffs = new ArrayList();
fAllDiffs.add(diff);
throw new CoreException(new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, CompareMessages.DocumentMerger_1, ex.getTargetException()));
@@ -438,8 +438,8 @@ public class DocumentMerger {
Diff diff= new Diff(null, RangeDifference.NOCHANGE,
aDoc, aRegion, 0, aDoc != null ? aDoc.getLength() : 0,
lDoc, lRegion, 0, lDoc.getLength(),
- rDoc, rRegion, 0, rDoc.getLength());
-
+ rDoc, rRegion, 0, rDoc.getLength());
+
fAllDiffs = new ArrayList();
fAllDiffs.add(diff);
return;
@@ -457,17 +457,17 @@ public class DocumentMerger {
ArrayList newAllDiffs = new ArrayList();
for (int i= 0; i < e.length; i++) {
RangeDifference es= e[i];
-
+
int ancestorStart= 0;
int ancestorEnd= 0;
if (sancestor != null) {
ancestorStart= sancestor.getTokenStart(es.ancestorStart());
ancestorEnd= getTokenEnd2(sancestor, es.ancestorStart(), es.ancestorLength());
}
-
+
int leftStart= sleft.getTokenStart(es.leftStart());
int leftEnd= getTokenEnd2(sleft, es.leftStart(), es.leftLength());
-
+
int rightStart= sright.getTokenStart(es.rightStart());
int rightEnd= getTokenEnd2(sright, es.rightStart(), es.rightLength());
@@ -482,32 +482,32 @@ public class DocumentMerger {
Diff diff= new Diff(null, es.kind(),
aDoc, aRegion, ancestorStart, ancestorEnd,
lDoc, lRegion, leftStart, leftEnd,
- rDoc, rRegion, rightStart, rightEnd);
-
+ rDoc, rRegion, rightStart, rightEnd);
+
newAllDiffs.add(diff); // remember all range diffs for scrolling
-
+
if (isPatchHunk()) {
if (useChange(diff)) {
recordChangeDiff(diff);
}
} else {
if (ignoreWhiteSpace || useChange(es.kind())) {
-
+
// Extract the string for each contributor.
String a= null;
if (sancestor != null)
a= extract2(aDoc, sancestor, es.ancestorStart(), es.ancestorLength());
String s= extract2(lDoc, sleft, es.leftStart(), es.leftLength());
String d= extract2(rDoc, sright, es.rightStart(), es.rightLength());
-
+
// Indicate whether all contributors are whitespace
- if (ignoreWhiteSpace
- && (a == null || a.trim().length() == 0)
- && s.trim().length() == 0
+ if (ignoreWhiteSpace
+ && (a == null || a.trim().length() == 0)
+ && s.trim().length() == 0
&& d.trim().length() == 0) {
diff.fIsWhitespace= true;
}
-
+
// If the diff is of interest, record it and generate the token diffs
if (useChange(diff)) {
recordChangeDiff(diff);
@@ -541,31 +541,31 @@ public class DocumentMerger {
}
public Diff findDiff(char type, int pos) throws CoreException {
-
+
IDocument aDoc= null;
IDocument lDoc= getDocument(MergeViewerContentProvider.LEFT_CONTRIBUTOR);
IDocument rDoc= getDocument(MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
if (lDoc == null || rDoc == null)
return null;
-
+
Position aRegion= null;
Position lRegion= null;
Position rRegion= null;
-
+
boolean threeWay= isThreeWay();
-
+
if (threeWay && !isIgnoreAncestor())
aDoc= getDocument(MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR);
boolean ignoreWhiteSpace= isIgnoreWhitespace();
ICompareFilter[] compareFilters = getCompareFilters();
- DocLineComparator sright= new DocLineComparator(rDoc, toRegion(rRegion), ignoreWhiteSpace, compareFilters, MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
+ DocLineComparator sright= new DocLineComparator(rDoc, toRegion(rRegion), ignoreWhiteSpace, compareFilters, MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
DocLineComparator sleft= new DocLineComparator(lDoc, toRegion(lRegion), ignoreWhiteSpace, compareFilters, MergeViewerContentProvider.LEFT_CONTRIBUTOR);
DocLineComparator sancestor= null;
if (aDoc != null)
sancestor= new DocLineComparator(aDoc, toRegion(aRegion), ignoreWhiteSpace, compareFilters, MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR);
-
+
final Object[] result= new Object[1];
final DocLineComparator sa= sancestor, sl= sleft, sr= sright;
IRunnableWithProgress runnable= new IRunnableWithProgress() {
@@ -584,7 +584,7 @@ public class DocumentMerger {
}
};
IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
-
+
RangeDifference[] e= null;
try {
progressService.run(true, true, runnable);
@@ -592,45 +592,45 @@ public class DocumentMerger {
} catch (InvocationTargetException ex) {
throw new CoreException(new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, CompareMessages.DocumentMerger_3, ex.getTargetException()));
} catch (InterruptedException ex) {
- //
+ //
}
-
+
if (e != null) {
for (int i= 0; i < e.length; i++) {
RangeDifference es= e[i];
-
+
int kind= es.kind();
-
+
int ancestorStart= 0;
int ancestorEnd= 0;
if (sancestor != null) {
ancestorStart= sancestor.getTokenStart(es.ancestorStart());
ancestorEnd= getTokenEnd2(sancestor, es.ancestorStart(), es.ancestorLength());
}
-
+
int leftStart= sleft.getTokenStart(es.leftStart());
int leftEnd= getTokenEnd2(sleft, es.leftStart(), es.leftLength());
-
+
int rightStart= sright.getTokenStart(es.rightStart());
int rightEnd= getTokenEnd2(sright, es.rightStart(), es.rightLength());
-
+
Diff diff= new Diff(null, kind,
aDoc, aRegion, ancestorStart, ancestorEnd,
lDoc, lRegion, leftStart, leftEnd,
- rDoc, rRegion, rightStart, rightEnd);
+ rDoc, rRegion, rightStart, rightEnd);
if (diff.isInRange(type, pos))
return diff;
}
}
-
+
return null;
}
-
+
private void recordChangeDiff(Diff diff) {
fChangeDiffs.add(diff); // here we remember only the real diffs
}
-
+
/*private boolean isHunkOnLeft() {
return fInput.isHunkOnLeft();
}
@@ -678,7 +678,7 @@ public class DocumentMerger {
public CompareConfiguration getCompareConfiguration() {
return fInput.getCompareConfiguration();
}
-
+
/*
* Returns true if kind of change should be shown.
*/
@@ -698,18 +698,18 @@ public class DocumentMerger {
return fInput.isShowPseudoConflicts();
return true;
}
-
+
private int getTokenEnd(ITokenComparator tc, int start, int count) {
if (count <= 0)
return tc.getTokenStart(start);
int index= start + count - 1;
return tc.getTokenStart(index) + tc.getTokenLength(index);
}
-
+
private static int getTokenEnd2(ITokenComparator tc, int start, int length) {
return tc.getTokenStart(start + length);
}
-
+
/**
* Returns the content of lines in the specified range as a String.
* This includes the line separators.
@@ -722,19 +722,19 @@ public class DocumentMerger {
private String extract2(IDocument doc, ITokenComparator tc, int start, int length) {
int count= tc.getRangeCount();
if (length > 0 && count > 0) {
-
-//
+
+//
// int startPos= tc.getTokenStart(start);
// int endPos= startPos;
-//
+//
// if (length > 1)
// endPos= tc.getTokenStart(start + (length-1));
// endPos+= tc.getTokenLength(start + (length-1));
-//
+//
int startPos= tc.getTokenStart(start);
int endPos;
-
+
if (length == 1) {
endPos= startPos + tc.getTokenLength(start);
} else {
@@ -750,18 +750,18 @@ public class DocumentMerger {
}
return ""; //$NON-NLS-1$
}
-
+
private static IRegion toRegion(Position position) {
if (position != null)
return new Region(position.getOffset(), position.getLength());
return null;
}
-
+
/*
* Performs a "smart" token based 3-way diff on the character range specified by the given baseDiff.
* It is "smart" because it tries to minimize the number of token diffs by merging them.
*/
- private void mergingTokenDiff(Diff baseDiff,
+ private void mergingTokenDiff(Diff baseDiff,
IDocument ancestorDoc, String a,
IDocument rightDoc, String d,
IDocument leftDoc, String s) {
@@ -771,13 +771,13 @@ public class DocumentMerger {
sa= createTokenComparator(a);
ancestorStart= baseDiff.fAncestorPos.getOffset();
}
-
- int rightStart= baseDiff.fRightPos.getOffset();
+
+ int rightStart= baseDiff.fRightPos.getOffset();
ITokenComparator sm= createTokenComparator(d);
-
+
int leftStart= baseDiff.fLeftPos.getOffset();
ITokenComparator sy= createTokenComparator(s);
-
+
RangeDifference[] r= RangeDifferencer.findRanges(sa, sy, sm);
for (int i= 0; i < r.length; i++) {
RangeDifference es= r[i];
@@ -804,7 +804,7 @@ public class DocumentMerger {
}
}
int end= i;
-
+
// find first diff from left
RangeDifference first= null;
for (int ii= start; ii < end; ii++) {
@@ -814,7 +814,7 @@ public class DocumentMerger {
break;
}
}
-
+
// find first diff from mine
RangeDifference last= null;
for (int ii= end-1; ii >= start; ii--) {
@@ -824,31 +824,31 @@ public class DocumentMerger {
break;
}
}
-
+
if (first != null && last != null) {
-
+
int ancestorStart2= 0;
int ancestorEnd2= 0;
if (ancestorDoc != null) {
ancestorStart2= ancestorStart+sa.getTokenStart(first.ancestorStart());
ancestorEnd2= ancestorStart+getTokenEnd(sa, last.ancestorStart(), last.ancestorLength());
}
-
+
int leftStart2= leftStart+sy.getTokenStart(first.leftStart());
int leftEnd2= leftStart+getTokenEnd(sy, last.leftStart(), last.leftLength());
-
+
int rightStart2= rightStart+sm.getTokenStart(first.rightStart());
int rightEnd2= rightStart+getTokenEnd(sm, last.rightStart(), last.rightLength());
Diff diff= new Diff(baseDiff, first.kind(),
ancestorDoc, null, ancestorStart2, ancestorEnd2,
leftDoc, null, leftStart2, leftEnd2,
- rightDoc, null, rightStart2, rightEnd2);
+ rightDoc, null, rightStart2, rightEnd2);
diff.fIsToken= true;
baseDiff.add(diff);
}
}
}
-
+
/*
* Performs a token based 3-way diff on the character range specified by the given baseDiff.
*/
@@ -863,37 +863,37 @@ public class DocumentMerger {
ancestorStart= baseDiff.fAncestorPos.getOffset();
sa= createTokenComparator(a);
}
-
- int rightStart= baseDiff.fRightPos.getOffset();
+
+ int rightStart= baseDiff.fRightPos.getOffset();
ITokenComparator sm= createTokenComparator(d);
-
+
int leftStart= baseDiff.fLeftPos.getOffset();
ITokenComparator sy= createTokenComparator(s);
-
+
RangeDifference[] e= RangeDifferencer.findRanges(sa, sy, sm);
for (int i= 0; i < e.length; i++) {
RangeDifference es= e[i];
int kind= es.kind();
if (kind != RangeDifference.NOCHANGE) {
-
+
int ancestorStart2= ancestorStart;
int ancestorEnd2= ancestorStart;
if (ancestorDoc != null) {
ancestorStart2 += sa.getTokenStart(es.ancestorStart());
ancestorEnd2 += getTokenEnd(sa, es.ancestorStart(), es.ancestorLength());
}
-
+
int leftStart2= leftStart + sy.getTokenStart(es.leftStart());
int leftEnd2= leftStart + getTokenEnd(sy, es.leftStart(), es.leftLength());
-
+
int rightStart2= rightStart + sm.getTokenStart(es.rightStart());
int rightEnd2= rightStart + getTokenEnd(sm, es.rightStart(), es.rightLength());
-
+
Diff diff= new Diff(baseDiff, kind,
ancestorDoc, null, ancestorStart2, ancestorEnd2,
leftDoc, null, leftStart2, leftEnd2,
rightDoc, null, rightStart2, rightEnd2);
-
+
// ensure that token diff is smaller than basediff
int leftS= baseDiff.fLeftPos.offset;
int leftE= baseDiff.fLeftPos.offset+baseDiff.fLeftPos.length;
@@ -908,11 +908,11 @@ public class DocumentMerger {
}
}
}
-
+
private ITokenComparator createTokenComparator(String s) {
return fInput.createTokenComparator(s);
}
-
+
private static int maxWork(IRangeComparator a, IRangeComparator l, IRangeComparator r) {
int ln= l.getRangeCount();
int rn= r.getRangeCount();
@@ -922,7 +922,7 @@ public class DocumentMerger {
}
return 2 * Math.max(ln, rn);
}
-
+
private void resetPositions(IDocument doc) {
if (doc == null)
return;
@@ -939,25 +939,25 @@ public class DocumentMerger {
* Starting line number is 0 based.
*/
protected Point getLineRange(IDocument doc, Position p, Point region) {
-
+
if (p == null || doc == null) {
region.x= 0;
region.y= 0;
return region;
}
-
+
int start= p.getOffset();
int length= p.getLength();
-
+
int startLine= 0;
try {
startLine= doc.getLineOfOffset(start);
} catch (BadLocationException e) {
// silently ignored
}
-
+
int lineCount= 0;
-
+
if (length == 0) {
// // if range length is 0 and if range starts a new line
// try {
@@ -967,7 +967,7 @@ public class DocumentMerger {
// } catch (BadLocationException e) {
// lines--;
// }
-
+
} else {
int endLine= 0;
try {
@@ -977,12 +977,12 @@ public class DocumentMerger {
}
lineCount= endLine-startLine+1;
}
-
+
region.x= startLine;
region.y= lineCount;
return region;
}
-
+
public Diff findDiff(Position p, boolean left) {
for (Iterator iterator = fAllDiffs.iterator(); iterator.hasNext();) {
Diff diff = (Diff) iterator.next();
@@ -1006,7 +1006,7 @@ public class DocumentMerger {
fChangeDiffs= null;
fAllDiffs= null;
}
-
+
/**
* Returns the virtual position for the given view position.
* @param contributor
@@ -1017,11 +1017,11 @@ public class DocumentMerger {
if (fAllDiffs == null)
return vpos;
-
+
int viewPos= 0; // real view position
int virtualPos= 0; // virtual position
Point region= new Point(0, 0);
-
+
Iterator e= fAllDiffs.iterator();
while (e.hasNext()) {
Diff diff= (Diff) e.next();
@@ -1043,22 +1043,22 @@ public class DocumentMerger {
}
return virtualPos;
}
-
+
/**
- * maps given virtual position into a real view position of this view.
+ * maps given virtual position into a real view position of this view.
* @param contributor
* @param v
* @return the real view position
*/
public int virtualToRealPosition(char contributor, int v) {
-
+
if (fAllDiffs == null)
return v;
-
+
int virtualPos= 0;
int viewPos= 0;
Point region= new Point(0, 0);
-
+
Iterator e= fAllDiffs.iterator();
while (e.hasNext()) {
Diff diff= (Diff) e.next();
@@ -1079,7 +1079,7 @@ public class DocumentMerger {
}
return viewPos;
}
-
+
/*
* Calculates virtual height (in lines) of views by adding the maximum of corresponding diffs.
*/
@@ -1094,7 +1094,7 @@ public class DocumentMerger {
}
return h;
}
-
+
/*
* Calculates height (in lines) of right view by adding the height of the right diffs.
*/
@@ -1109,7 +1109,7 @@ public class DocumentMerger {
}
return h;
}
-
+
public int findInsertionPoint(Diff diff, char type) {
if (diff != null) {
switch (type) {
@@ -1129,7 +1129,7 @@ public class DocumentMerger {
}
return 0;
}
-
+
public Diff[] getChangeDiffs(char contributor, IRegion region) {
if (fChangeDiffs == null)
return new Diff[0];
@@ -1144,12 +1144,12 @@ public class DocumentMerger {
}
return (Diff[]) intersectingDiffs.toArray(new Diff[intersectingDiffs.size()]);
}
-
+
public Diff findDiff(int viewportHeight, boolean synchronizedScrolling, Point size, int my) {
- int virtualHeight= synchronizedScrolling ? getVirtualHeight() : getRightHeight();
+ int virtualHeight= synchronizedScrolling ? getVirtualHeight() : getRightHeight();
if (virtualHeight < viewportHeight)
return null;
-
+
int yy, hh;
int y= 0;
if (fAllDiffs != null) {
@@ -1159,12 +1159,12 @@ public class DocumentMerger {
int h= synchronizedScrolling ? diff.getMaxDiffHeight()
: diff.getRightHeight();
if (useChange(diff.getKind()) && !diff.fIsWhitespace) {
-
+
yy= (y*size.y)/virtualHeight;
hh= (h*size.y)/virtualHeight;
if (hh < 3)
hh= 3;
-
+
if (my >= yy && my < yy+hh)
return diff;
}
@@ -1177,19 +1177,19 @@ public class DocumentMerger {
public boolean hasChanges() {
return fChangeDiffs != null && !fChangeDiffs.isEmpty();
}
-
+
public Iterator changesIterator() {
if (fChangeDiffs == null)
return new ArrayList().iterator();
return fChangeDiffs.iterator();
}
-
+
public Iterator rangesIterator() {
if (fAllDiffs == null)
return new ArrayList().iterator();
return fAllDiffs.iterator();
}
-
+
public boolean isFirstChildDiff(char contributor, int childStart, Diff diff) {
if (!diff.hasChildren())
return false;
@@ -1197,7 +1197,7 @@ public class DocumentMerger {
Position p= d.getPosition(contributor);
return (p.getOffset() >= childStart);
}
-
+
public Diff getWrappedDiff(Diff diff, boolean down) {
if (fChangeDiffs != null && fChangeDiffs.size() > 0) {
if (down)
@@ -1206,14 +1206,14 @@ public class DocumentMerger {
}
return null;
}
-
+
/*
* Copy the contents of the given diff from one side to the other but
* doesn't reveal anything.
* Returns true if copy was successful.
*/
public boolean copy(Diff diff, boolean leftToRight) {
-
+
if (diff != null) {
Position fromPos= null;
Position toPos= null;
@@ -1231,18 +1231,18 @@ public class DocumentMerger {
fromDoc= getDocument(MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
toDoc= getDocument(MergeViewerContentProvider.LEFT_CONTRIBUTOR);
}
-
+
if (fromDoc != null) {
-
+
int fromStart= fromPos.getOffset();
int fromLen= fromPos.getLength();
-
+
int toStart= toPos.getOffset();
int toLen= toPos.getLength();
try {
String s= null;
-
+
switch (diff.getKind()) {
case RangeDifference.RIGHT:
case RangeDifference.LEFT:
@@ -1262,16 +1262,16 @@ public class DocumentMerger {
break;
}
if (s != null) {
- toDoc.replace(toStart, toLen, s);
+ toDoc.replace(toStart, toLen, s);
toPos.setOffset(toStart);
toPos.setLength(s.length());
- }
-
+ }
+
} catch (BadLocationException e) {
// silently ignored
}
}
-
+
diff.setResolved(true);
return true;
}
@@ -1283,7 +1283,7 @@ public class DocumentMerger {
return 0;
return fChangeDiffs.size();
}
-
+
public Diff findDiff(char contributor, int rangeStart, int rangeEnd) {
if (hasChanges()) {
for (Iterator iterator = changesIterator(); iterator.hasNext();) {
@@ -1296,17 +1296,17 @@ public class DocumentMerger {
}
return null;
}
-
+
public Diff findDiff(char contributor, Position range) {
int start= range.getOffset();
int end= start + range.getLength();
return findDiff(contributor, start, end);
}
-
+
public Diff findNext(char contributor, int start, int end, boolean deep) {
return findNext(contributor, fChangeDiffs, start, end, deep);
}
-
+
private Diff findNext(char contributor, List v, int start, int end, boolean deep) {
if (v == null)
return null;
@@ -1332,11 +1332,11 @@ public class DocumentMerger {
}
return null;
}
-
+
public Diff findPrev(char contributor, int start, int end, boolean deep) {
return findPrev(contributor, fChangeDiffs, start, end, deep);
}
-
+
private Diff findPrev(char contributor, List v, int start, int end, boolean deep) {
if (v == null)
return null;
@@ -1359,7 +1359,7 @@ public class DocumentMerger {
// A whole diff is selected so we'll fall through
// and go the the last change in the previous diff
} else if (start >= startOffset) {
- // If we are at or before the first diff, select the
+ // If we are at or before the first diff, select the
// entire diff so next and previous are symmetrical
if (isFirstChildDiff(contributor, start, diff)) {
return diff;
@@ -1373,5 +1373,5 @@ public class DocumentMerger {
}
return null;
}
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/LineComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/LineComparator.java
index 7fb8c4331..c5fd8ba24 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/LineComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/LineComparator.java
@@ -22,7 +22,7 @@ class LineComparator implements IRangeComparator {
private String[] fLines;
public LineComparator(InputStream is, String encoding) throws IOException {
-
+
BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding));
String line;
ArrayList ar = new ArrayList();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java
index 7f91e2150..0616aaef4 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/merge/TextStreamMerger.java
@@ -29,7 +29,7 @@ public class TextStreamMerger implements IStreamMerger {
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.internal.merge.IAutoMerger#automerge(java.io.OutputStream,
* org.eclipse.core.resources.IEncodedStorage,
* org.eclipse.core.resources.IEncodedStorage,
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java
index 325b1f97d..75cfe7582 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/DecoratorOverlayIcon.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -34,7 +34,7 @@ class DecoratorOverlayIcon extends CompositeImageDescriptor {
/**
* OverlayIcon constructor.
- *
+ *
* @param baseImage the base image
* @param overlaysArray the overlay images
* @param sizeValue the size
@@ -112,7 +112,7 @@ class DecoratorOverlayIcon extends CompositeImageDescriptor {
protected Point getSize() {
return size;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.jface.resource.CompositeImageDescriptor#getTransparentPixel()
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java
index 871fd0b94..e8e873a10 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/FilePatch.java
@@ -27,7 +27,7 @@ public class FilePatch extends FilePatch2 implements IFilePatch {
/*
* (non-Javadoc)
- *
+ *
* @see
* org.eclipse.compare.patch.IFilePatch#apply(org.eclipse.core.resources
* .IStorage, org.eclipse.compare.patch.PatchConfiguration,
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java
index 9e892a772..805306116 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkDiffNode.java
@@ -23,11 +23,11 @@ public class HunkDiffNode extends PatchDiffNode {
public static HunkDiffNode createDiffNode(PatchFileDiffNode parent, HunkResult result, boolean fullContext) {
return createDiffNode(parent, result, fullContext, fullContext, fullContext);
}
-
+
public static HunkDiffNode createDiffNode(PatchFileDiffNode parent, HunkResult result, boolean ancestorFullContext, boolean leftFullContext, boolean rightFullContext) {
return new HunkDiffNode(result, parent, Differencer.CHANGE, getAncestorElement(result, ancestorFullContext), getLeftElement(result, leftFullContext), getRightElement(result, rightFullContext));
}
-
+
public static ITypedElement getRightElement(HunkResult result, boolean fullContext) {
return new HunkTypedElement(result, true /* isResult */, fullContext);
}
@@ -72,11 +72,11 @@ public class HunkDiffNode extends PatchDiffNode {
}
return false;
}
-
+
public boolean isFuzzUsed() {
return result.getFuzz() > 0;
}
-
+
public boolean isAllContextIgnored() {
int fuzz = result.getFuzz();
if (fuzz > 0) {
@@ -97,7 +97,7 @@ public class HunkDiffNode extends PatchDiffNode {
if (contextLines > 0 && fuzz >= contextLines) {
return true;
}
-
+
}
return false;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
index 07b35c4e1..65eb612c8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
@@ -54,7 +54,7 @@ public class HunkTypedElement implements ITypedElement, IEncodedStreamContentAcc
public static Image getHunkErrorImage(Image baseImage, LocalResourceManager imageCache, boolean onLeft) {
return getHunkOverlayImage(baseImage, imageCache, ICompareUIConstants.ERROR_OVERLAY, onLeft);
}
-
+
private static Image getHunkOverlayImage(Image baseImage, LocalResourceManager imageCache, String path, boolean onLeft) {
ImageDescriptor desc = new DiffImageDescriptor(baseImage, CompareUIPlugin.getImageDescriptor(path), ICompareUIConstants.COMPARE_IMAGE_WIDTH, onLeft);
Image image = imageCache.createImage(desc);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
index 73b8d60c6..f3d822485 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/InputPatchPage.java
@@ -85,14 +85,14 @@ public class InputPatchPage extends WizardPage {
// constants
protected static final int SIZING_TEXT_FIELD_WIDTH= 250;
protected static final int COMBO_HISTORY_LENGTH= 5;
-
+
// dialog store id constants
- private final static String PAGE_NAME= "PatchWizardPage1"; //$NON-NLS-1$
+ private final static String PAGE_NAME= "PatchWizardPage1"; //$NON-NLS-1$
private final static String STORE_PATCH_FILES_ID= PAGE_NAME+".PATCH_FILES"; //$NON-NLS-1$
private final static String STORE_PATCH_URLS_ID= PAGE_NAME+".PATCH_URLS"; //$NON-NLS-1$
private final static String STORE_INPUT_METHOD_ID= PAGE_NAME+".INPUT_METHOD"; //$NON-NLS-1$
private final static String STORE_WORKSPACE_PATH_ID= PAGE_NAME+".WORKSPACE_PATH"; //$NON-NLS-1$
-
+
//patch input constants
protected final static int CLIPBOARD= 1;
protected final static int FILE= 2;
@@ -119,7 +119,7 @@ public class InputPatchPage extends WizardPage {
private Combo fPatchURLField;
private Label fWorkspaceSelectLabel;
private TreeViewer fTreeViewer;
-
+
class ActivationListener extends ShellAdapter {
public void shellActivated(ShellEvent e) {
// allow error messages if the selected input actually has something selected in it
@@ -138,13 +138,13 @@ public class InputPatchPage extends WizardPage {
updateWidgetEnablements();
}
}
-
+
public InputPatchPage(PatchWizard pw) {
super(INPUTPATCHPAGE_NAME, PatchMessages.InputPatchPage_title, null);
fPatchWizard= pw;
setMessage(PatchMessages.InputPatchPage_message);
}
-
+
/*
* Get a path from the supplied text widget.
* @return org.eclipse.core.runtime.IPath
@@ -158,34 +158,34 @@ public class InputPatchPage extends WizardPage {
return PatchMessages.InputPatchPage_Clipboard;
return getPatchFilePath();
}
-
+
public void createControl(Composite parent) {
-
+
Composite composite= new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
setControl(composite);
initializeDialogUnits(parent);
-
+
buildPatchFileGroup(composite);
-
- // by default, whatever was used last was selected or
+
+ // by default, whatever was used last was selected or
// default to File if nothing has been selected
restoreWidgetValues();
-
+
// see if there are any better options presently selected (i.e workspace
// or clipboard or URL from clipboard)
adjustToCurrentTarget();
-
+
// No error for dialog opening
fShowError= false;
clearErrorMessage();
updateWidgetEnablements();
-
+
Shell shell= getShell();
shell.addShellListener(fActivationListener);
-
+
Dialog.applyDialogFont(composite);
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICompareContextIds.PATCH_INPUT_WIZARD_PAGE);
}
@@ -194,7 +194,7 @@ public class InputPatchPage extends WizardPage {
* Returns the next page depending on what type of patch is being applied:
* i) If the patch is a Workspace patch then it will proceed right to the PreviewPatchPage
* ii) If the patch is a single project patch then it will proceed to the PatchTargetPage, which
- * allows the user to specify where to root the patch
+ * allows the user to specify where to root the patch
* @return PreviewPatchPage if multi-project patch, PatchTargetPage if single project patch
*/
public IWizardPage getNextPage() {
@@ -202,13 +202,13 @@ public class InputPatchPage extends WizardPage {
return this;
WorkspacePatcher patcher= ((PatchWizard) getWizard()).getPatcher();
-
+
// guess prefix count
int guess= 0; // guessPrefix(diffs);
patcher.setStripPrefixSegments(guess);
- // If this is a workspace patch we don't need to set a target as the targets will be figured out from
- // all of the projects that make up the patch and continue on to final preview page
+ // If this is a workspace patch we don't need to set a target as the targets will be figured out from
+ // all of the projects that make up the patch and continue on to final preview page
if (patcher.isWorkspacePatch()) {
// skip 'Patch Target' page
IWizardPage page = super.getNextPage();
@@ -276,8 +276,8 @@ public class InputPatchPage extends WizardPage {
reader= new FileReader(patchFilePath);
} catch (FileNotFoundException ex) {
MessageDialog.openError(null,
- PatchMessages.InputPatchPage_PatchErrorDialog_title,
- PatchMessages.InputPatchPage_PatchFileNotFound_message);
+ PatchMessages.InputPatchPage_PatchErrorDialog_title,
+ PatchMessages.InputPatchPage_PatchFileNotFound_message);
}
}
fPatchSource= PatchMessages.InputPatchPage_PatchFile_title;
@@ -313,7 +313,7 @@ public class InputPatchPage extends WizardPage {
}
fPatchSource= PatchMessages.InputPatchPage_WorkspacePatch_title;
}
-
+
// parse the input
if (reader != null) {
try {
@@ -345,7 +345,7 @@ public class InputPatchPage extends WizardPage {
// the next page is quite expensive. So we say yes if the page is complete.
return isPageComplete();
}
-
+
private void setEnablePatchFile(boolean enable) {
fPatchFileNameField.setEnabled(enable);
fPatchFileBrowseButton.setEnabled(enable);
@@ -417,7 +417,7 @@ public class InputPatchPage extends WizardPage {
public void widgetSelected(SelectionEvent e) {
if (!fUseClipboardButton.getSelection())
return;
-
+
clearErrorMessage();
fShowError= true;
int state= getInputMethod();
@@ -425,10 +425,10 @@ public class InputPatchPage extends WizardPage {
setEnableURLPatch(state == URL);
setEnableWorkspacePatch(state == WORKSPACE);
updateWidgetEnablements();
- fPatchRead = false;
+ fPatchRead = false;
}
});
-
+
fUsePatchFileButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!fUsePatchFileButton.getSelection())
@@ -441,7 +441,7 @@ public class InputPatchPage extends WizardPage {
setEnableURLPatch(state == URL);
setEnableWorkspacePatch(state == WORKSPACE);
updateWidgetEnablements();
- fPatchRead = false;
+ fPatchRead = false;
}
});
fPatchFileNameField.addSelectionListener(new SelectionAdapter() {
@@ -496,7 +496,7 @@ public class InputPatchPage extends WizardPage {
setEnableURLPatch(state == URL);
setEnableWorkspacePatch(state == WORKSPACE);
updateWidgetEnablements();
- fPatchRead = false;
+ fPatchRead = false;
}
});
@@ -506,7 +506,7 @@ public class InputPatchPage extends WizardPage {
updateWidgetEnablements();
}
});
-
+
fTreeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
ISelection selection= event.getSelection();
@@ -534,10 +534,10 @@ public class InputPatchPage extends WizardPage {
layout.marginLeft= 16; // align w/ lable of check button
newComp.setLayout(layout);
newComp.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
fWorkspaceSelectLabel= new Label(newComp, SWT.LEFT);
fWorkspaceSelectLabel.setText(PatchMessages.InputPatchPage_WorkspaceSelectPatch_text);
-
+
fTreeViewer= new TreeViewer(newComp, SWT.BORDER);
fTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -552,7 +552,7 @@ public class InputPatchPage extends WizardPage {
* Updates the enable state of this page's controls.
*/
private void updateWidgetEnablements() {
-
+
String error= null;
boolean gotPatch= false;
@@ -568,9 +568,9 @@ public class InputPatchPage extends WizardPage {
if (s.length() > 0)
gotPatch= true;
else
- error= PatchMessages.InputPatchPage_ClipboardIsEmpty_message;
+ error= PatchMessages.InputPatchPage_ClipboardIsEmpty_message;
} else
- error= PatchMessages.InputPatchPage_NoTextInClipboard_message;
+ error= PatchMessages.InputPatchPage_NoTextInClipboard_message;
} else
error= PatchMessages.InputPatchPage_CouldNotReadClipboard_message;
} else if (inputMethod==FILE) {
@@ -579,9 +579,9 @@ public class InputPatchPage extends WizardPage {
File file= new File(path);
gotPatch= file.exists() && file.isFile() && file.length() > 0;
if (!gotPatch)
- error= PatchMessages.InputPatchPage_CannotLocatePatch_message + path;
+ error= PatchMessages.InputPatchPage_CannotLocatePatch_message + path;
} else {
- error= PatchMessages.InputPatchPage_NoFileName_message;
+ error= PatchMessages.InputPatchPage_NoFileName_message;
}
} else if (inputMethod == URL) {
String urlText = fPatchURLField.getText();
@@ -623,10 +623,10 @@ public class InputPatchPage extends WizardPage {
if (fShowError)
setErrorMessage(error);
}
-
+
protected void handlePatchFileBrowseButtonPressed() {
FileDialog dialog= new FileDialog(getShell(), SWT.NONE);
- dialog.setText(PatchMessages.InputPatchPage_SelectPatchFileDialog_title);
+ dialog.setText(PatchMessages.InputPatchPage_SelectPatchFileDialog_title);
String patchFilePath= getPatchFilePath();
if (patchFilePath != null) {
int lastSegment= patchFilePath.lastIndexOf(SEPARATOR);
@@ -638,17 +638,17 @@ public class InputPatchPage extends WizardPage {
String res= dialog.open();
if (res == null)
return;
-
+
patchFilePath= dialog.getFileName();
IPath filterPath= new Path(dialog.getFilterPath());
- IPath path= filterPath.append(patchFilePath).makeAbsolute();
+ IPath path= filterPath.append(patchFilePath).makeAbsolute();
patchFilePath= path.toOSString();
//fDialogSettings.put(IUIConstants.DIALOGSTORE_LASTEXTJAR, filterPath.toOSString());
-
+
fPatchFileNameField.setText(patchFilePath);
//setSourceName(patchFilePath);
}
-
+
/**
* Sets the source name of the import to be the supplied path.
* Adds the name of the path to the list of items in the
@@ -657,15 +657,15 @@ public class InputPatchPage extends WizardPage {
* @param path the path to be added
*/
protected void setSourceName(String path) {
-
+
if (path.length() > 0) {
-
+
String[] currentItems= fPatchFileNameField.getItems();
int selectionIndex= -1;
for (int i= 0; i < currentItems.length; i++)
if (currentItems[i].equals(path))
selectionIndex= i;
-
+
if (selectionIndex < 0) { // not found in history
int oldLength= currentItems.length;
String[] newItems= new String[oldLength + 1];
@@ -675,11 +675,11 @@ public class InputPatchPage extends WizardPage {
selectionIndex= oldLength;
}
fPatchFileNameField.select(selectionIndex);
-
+
//resetSelection();
}
}
-
+
/**
* The Finish button was pressed. Try to do the required work now and answer
* a boolean indicating success. If false is returned then the wizard will
@@ -690,30 +690,30 @@ public class InputPatchPage extends WizardPage {
public boolean finish() {
// if (!ensureSourceIsValid())
// return false;
-
+
saveWidgetValues();
-
+
// Iterator resourcesEnum= getSelectedResources().iterator();
// List fileSystemObjects= new ArrayList();
// while (resourcesEnum.hasNext()) {
// fileSystemObjects.add(
// ((FileSystemElement) resourcesEnum.next()).getFileSystemObject());
// }
-//
+//
// if (fileSystemObjects.size() > 0)
// return importResources(fileSystemObjects);
-//
+//
// MessageDialog
// .openInformation(
// getContainer().getShell(),
// DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
// DataTransferMessages.getString("FileImport.noneSelected")); //$NON-NLS-1$
-//
+//
// return false;
return true;
}
-
+
/**
* Use the dialog store to restore widget values to the values that they held
* last time this wizard was used to completion
@@ -737,12 +737,12 @@ public class InputPatchPage extends WizardPage {
for (int i= 0; i < sourceNames.length; i++)
if (sourceNames[i] != null && sourceNames[i].length() > 0)
fPatchFileNameField.add(sourceNames[i]);
-
+
// set patch file path
String patchFilePath= settings.get(STORE_PATCH_FILES_ID);
if (patchFilePath != null)
setSourceName(patchFilePath);
-
+
// set URLs history
String[] sourceURLs= settings.getArray(STORE_PATCH_URLS_ID);
if (sourceURLs != null)
@@ -758,7 +758,7 @@ public class InputPatchPage extends WizardPage {
inputMethod= FILE;
fPatchFileNameField.deselectAll();
}
-
+
//set the workspace patch selection
String workspaceSetting= settings.get(STORE_WORKSPACE_PATH_ID);
if (workspaceSetting != null && workspaceSetting.length() > 0) {
@@ -772,10 +772,10 @@ public class InputPatchPage extends WizardPage {
}
} catch (RuntimeException e) {
// Ignore. The setting was invalid
- }
+ }
} else {
//check to see if the current input is set to workspace - if it is switch it
- //back to clipboard since there is no corresponding element to go along with
+ //back to clipboard since there is no corresponding element to go along with
//the tree viewer
if (inputMethod == WORKSPACE)
inputMethod= FILE;
@@ -785,7 +785,7 @@ public class InputPatchPage extends WizardPage {
// set radio buttons state
setInputButtonState(inputMethod);
}
-
+
/**
* Since Finish was pressed, write widget values to the dialog store so that they
* will persist into the next invocation of this wizard page
@@ -796,15 +796,15 @@ public class InputPatchPage extends WizardPage {
settings.put(STORE_INPUT_METHOD_ID, getInputMethod());
settings.put(STORE_PATCH_FILES_ID, getPatchFilePath());
-
+
// update source names history
String[] sourceNames= settings.getArray(STORE_PATCH_FILES_ID);
if (sourceNames == null)
sourceNames= new String[0];
-
+
sourceNames= addToHistory(sourceNames, getPatchFilePath());
settings.put(STORE_PATCH_FILES_ID, sourceNames);
-
+
// update source URLs history
String[] sourceURLs= settings.getArray(STORE_PATCH_URLS_ID);
if (sourceURLs == null)
@@ -815,10 +815,10 @@ public class InputPatchPage extends WizardPage {
// save the workspace selection
settings.put(STORE_WORKSPACE_PATH_ID, getWorkspacePath());
-
+
}
}
-
+
private String getWorkspacePath() {
if (fTreeViewer != null){
IResource[] resources= Utilities.getResources(fTreeViewer.getSelection());
@@ -826,7 +826,7 @@ public class InputPatchPage extends WizardPage {
IResource patchFile= resources[0];
return patchFile.getFullPath().toString();
}
-
+
}
return ""; //$NON-NLS-1$
}
@@ -836,7 +836,7 @@ public class InputPatchPage extends WizardPage {
/**
* Checks to see if the file that has been selected for Apply Patch is
* actually a patch
- *
+ *
* @return true if the file selected to run Apply Patch on in the workspace
* is a patch file or if the clipboard contains a patch or if the
* clipboard contains an URL (we assume it points to a patch )
@@ -874,7 +874,7 @@ public class InputPatchPage extends WizardPage {
}
}
}
- }
+ }
// check out clipboard contents
Reader reader = null;
Control c = getControl();
@@ -910,7 +910,7 @@ public class InputPatchPage extends WizardPage {
}
}
return false;
- }
+ }
private boolean isPatchFile(Reader reader) {
WorkspacePatcher patcher= ((PatchWizard) getWizard()).getPatcher();
@@ -926,14 +926,14 @@ public class InputPatchPage extends WizardPage {
return false;
return true;
}
-
+
/*
* Clears the dialog message box
*/
private void clearErrorMessage(){
setErrorMessage(null);
}
-
+
private void setInputButtonState(int state) {
switch (state) {
@@ -985,7 +985,7 @@ public class InputPatchPage extends WizardPage {
if (fPatchFileNameField != null)
return fPatchFileNameField.getText();
return ""; //$NON-NLS-1$
- }
+ }
/*
* Adds an entry to a history, while taking care of duplicate history items
@@ -1000,12 +1000,12 @@ public class InputPatchPage extends WizardPage {
l.remove(newEntry);
l.add(0,newEntry);
-
+
// since only one new item was added, we can be over the limit
// by at most one item
if (l.size() > COMBO_HISTORY_LENGTH)
l.remove(COMBO_HISTORY_LENGTH);
-
+
return (String[]) l.toArray(new String[l.size()]);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
index 578c0e187..9a14edafd 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/LineReader.java
@@ -82,7 +82,7 @@ public class LineReader {
LineReader lr = new LineReader(reader);
if (!Platform.WS_CARBON.equals(Platform.getWS()))
// Don't treat single CRs as line feeds to be consistent with command line patch
- lr.ignoreSingleCR();
+ lr.ignoreSingleCR();
lines = lr.readLines();
return lines;
}
@@ -151,7 +151,7 @@ public class LineReader {
* Reads a line of text. A line is considered to be terminated by any one of
* a line feed ('\n'), a carriage return ('\r'), or a carriage return
* followed immediately by a line-feed.
- *
+ *
* @return A string containing the contents of the line including the
* line-termination characters, or <code>null</code> if the end of
* the stream has been reached
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
index 185e5e034..4ce115d03 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchCompareEditorInput.java
@@ -58,21 +58,21 @@ import org.eclipse.swt.widgets.Composite;
public abstract class PatchCompareEditorInput extends CompareEditorInput {
private static final String IMAGE_CACHE_KEY = "IMAGE_CACHE"; //$NON-NLS-1$
-
+
public static ImageDescriptor createOverlay(Image baseImage, ImageDescriptor overlayImage, int quadrant) {
return new DecoratorOverlayIcon(baseImage, createArrayFrom(overlayImage, quadrant), new Point(Math.max(baseImage.getBounds().width, 16), Math.max(baseImage.getBounds().height, 16)));
}
-
+
private static ImageDescriptor[] createArrayFrom(
ImageDescriptor overlayImage, int quadrant) {
ImageDescriptor[] descs = new ImageDescriptor[] { null, null, null, null, null };
descs[quadrant] = overlayImage;
return descs;
}
-
+
class PatcherCompareEditorLabelProvider extends LabelProvider {
private ILabelProvider wrappedProvider;
-
+
public PatcherCompareEditorLabelProvider(ILabelProvider labelProvider) {
wrappedProvider = labelProvider;
}
@@ -88,7 +88,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
}
}
if (!node.isEnabled()) {
- return NLS.bind(PatchMessages.Diff_2Args,
+ return NLS.bind(PatchMessages.Diff_2Args,
new String[]{text, PatchMessages.PatcherCompareEditorInput_NotIncluded});
}
if (node instanceof PatchFileDiffNode) {
@@ -107,19 +107,19 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
}
if (hunkNode.isFuzzUsed()) {
text = NLS.bind(PatchMessages.Diff_2Args,
- new String[] { text,
+ new String[] { text,
NLS.bind(hunkNode.isAllContextIgnored() ? PatchMessages.PreviewPatchPage_AllContextIgnored : PatchMessages.PreviewPatchPage_FuzzUsed,
new String[] { hunkNode.getHunkResult().getFuzz() + ""}) }); //$NON-NLS-1$
}
}
- if (getPatcher().isRetargeted(node.getPatchElement()))
- return NLS.bind(PatchMessages.Diff_2Args,
+ if (getPatcher().isRetargeted(node.getPatchElement()))
+ return NLS.bind(PatchMessages.Diff_2Args,
new String[]{getPatcher().getOriginalPath(node.getPatchElement()).toString(),
NLS.bind(PatchMessages.PreviewPatchPage_Target, new String[]{node.getName()})});
}
return text;
}
-
+
public Image getImage(Object element) {
Image image = wrappedProvider.getImage(element);
if (element instanceof PatchDiffNode){
@@ -139,17 +139,17 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
return image;
}
}
-
+
private final DiffNode root;
private final WorkspacePatcher patcher;
private TreeViewer viewer;
private boolean fShowAll;
private boolean showMatched = false;
-
+
/**
* Creates a new PatchCompareEditorInput and makes use of the passed in CompareConfiguration
* to configure the UI elements.
- * @param patcher
+ * @param patcher
* @param configuration
*/
public PatchCompareEditorInput(WorkspacePatcher patcher, CompareConfiguration configuration) {
@@ -167,13 +167,13 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
private void initializeImageCache() {
initializeImageCache(patcher.getConfiguration());
}
-
+
private static LocalResourceManager initializeImageCache(PatchConfiguration patchConfiguration) {
LocalResourceManager imageCache = new LocalResourceManager(JFaceResources.getResources());
patchConfiguration.setProperty(IMAGE_CACHE_KEY, imageCache);
return imageCache;
}
-
+
protected void handleDispose() {
super.handleDispose();
getImageCache(getPatcher().getConfiguration()).dispose();
@@ -191,7 +191,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
initLabels();
return root;
}
-
+
private void initLabels() {
CompareConfiguration cc = getCompareConfiguration();
// set left editable so that unmatched hunks can be edited
@@ -211,34 +211,34 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
if (getViewer() != null && !getViewer().getControl().isDisposed())
getViewer().refresh(true);
}
-
+
/**
* Build the diff tree.
*/
protected void buildTree(){
-
+
// Reset the input node so it is empty
if (getRoot().hasChildren()) {
resetRoot();
}
// Reset the input of the viewer so the old state is no longer used
getViewer().setInput(getRoot());
-
+
// Refresh the patcher state
getPatcher().refresh();
-
+
// Build the diff tree
if (getPatcher().isWorkspacePatch()){
processProjects(getPatcher().getDiffProjects());
} else {
processDiffs(getPatcher().getDiffs());
}
-
+
// Refresh the viewer
getViewer().refresh();
}
-
- private void processDiffs(FilePatch2[] diffs) {
+
+ private void processDiffs(FilePatch2[] diffs) {
for (int i = 0; i < diffs.length; i++) {
processDiff(diffs[i], getRoot());
}
@@ -290,7 +290,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
PatchCompareEditorInput.this.fillContextMenu(manager);
}
};
-
+
viewer.setLabelProvider(new PatcherCompareEditorLabelProvider((ILabelProvider)viewer.getLabelProvider()));
viewer.getTree().setData(CompareUI.COMPARE_VIEWER_TITLE, PatchMessages.PatcherCompareEditorInput_PatchContents);
viewer.addOpenListener(new IOpenListener() {
@@ -310,13 +310,13 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
getCompareConfiguration().setRightLabel(PatchMessages.PatcherCompareEditorInput_AfterPatch);
}
}
-
+
});
viewer.setFilters(getFilters());
viewer.setInput(root);
return viewer;
}
-
+
private ViewerFilter[] getFilters() {
return new ViewerFilter[] { new ViewerFilter() {
public boolean select(Viewer v, Object parentElement, Object element) {
@@ -332,7 +332,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
protected boolean isShowAll() {
return fShowAll;
}
-
+
protected void setShowAll(boolean show) {
fShowAll = show;
}
@@ -349,25 +349,25 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
ToolBarManager tbm= CompareViewerPane.getToolBarManager(viewer.getControl().getParent());
if (tbm != null) {
tbm.removeAll();
-
+
tbm.add(new Separator("contributed")); //$NON-NLS-1$
-
+
for (int i = 0; i < actions.length; i++) {
tbm.appendToGroup("contributed", actions[i]); //$NON-NLS-1$
}
-
+
tbm.update(true);
}
}
-
+
public TreeViewer getViewer() {
return viewer;
}
-
+
public DiffNode getRoot() {
return root;
}
-
+
public void resetRoot() {
IDiffElement[] children = root.getChildren();
for (int i = 0; i < children.length; i++) {
@@ -379,7 +379,7 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
public WorkspacePatcher getPatcher() {
return patcher;
}
-
+
public boolean confirmRebuild(String message) {
if (getPatcher().hasCachedContents()) {
if (promptToDiscardCachedChanges(message)) {
@@ -422,9 +422,9 @@ public abstract class PatchCompareEditorInput extends CompareEditorInput {
}
return false;
}
-
+
protected abstract void fillContextMenu(IMenuManager manager);
-
+
public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input,
Composite parent) {
if (org.eclipse.compare.internal.Utilities.isHunk(input))
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchDiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchDiffNode.java
index c6ce4ee9b..76722c7b8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchDiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchDiffNode.java
@@ -49,7 +49,7 @@ public abstract class PatchDiffNode extends DiffNode implements IResourceProvide
}
protected abstract PatchConfiguration getConfiguration();
-
+
public boolean equals(Object other) {
if (other instanceof PatchDiffNode) {
PatchDiffNode node = (PatchDiffNode) other;
@@ -57,7 +57,7 @@ public abstract class PatchDiffNode extends DiffNode implements IResourceProvide
}
return super.equals(other);
}
-
+
public int hashCode() {
return getPatchElement().hashCode();
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
index 652b2c360..896d9186b 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchErrorDialog.java
@@ -11,9 +11,9 @@
package org.eclipse.compare.internal.patch;
public class PatchErrorDialog {
-
+
private PatchErrorDialog() {
// no instance.
}
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java
index 0f2ed66e5..0705d804c 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileDiffNode.java
@@ -29,7 +29,7 @@ public class PatchFileDiffNode extends PatchDiffNode implements IContentChangeLi
public static PatchFileDiffNode createDiffNode(DiffNode parent, FileDiffResult result) {
return new PatchFileDiffNode(result, parent, getKind(result), getAncestorElement(result), getLeftElement(result), getRightElement(result));
}
-
+
public static int getKind(FileDiffResult result) {
if (!result.hasMatches())
return Differencer.NO_CHANGE;
@@ -78,11 +78,11 @@ public class PatchFileDiffNode extends PatchDiffNode implements IContentChangeLi
public FileDiffResult getDiffResult() {
return result;
}
-
+
protected PatchConfiguration getConfiguration() {
return result.getConfiguration();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.structuremergeviewer.DiffContainer#add(org.eclipse.compare.structuremergeviewer.IDiffElement)
*/
@@ -105,7 +105,7 @@ public class PatchFileDiffNode extends PatchDiffNode implements IContentChangeLi
public void contentChanged(IContentChangeNotifier source) {
fireChange();
}
-
+
public int getKind() {
int kind = super.getKind();
if (kind == Differencer.NO_CHANGE && getPatcher().hasCachedContents(getDiffResult().getDiff())) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java
index ed468befa..06c7ad733 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchFileTypedElement.java
@@ -73,7 +73,7 @@ public class PatchFileTypedElement implements ITypedElement,
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.ITypedElement#getName()
*/
@Override
@@ -83,7 +83,7 @@ public class PatchFileTypedElement implements ITypedElement,
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.compare.ITypedElement#getType()
*/
@Override
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java
index 5e41aafcf..e2f56404c 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchProjectDiffNode.java
@@ -32,14 +32,14 @@ public class PatchProjectDiffNode extends PatchDiffNode {
this.project = project;
this.configuration = configuration;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.structuremergeviewer.DiffNode#getName()
*/
public String getName() {
return project.getName();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.structuremergeviewer.DiffNode#getImage()
*/
@@ -71,7 +71,7 @@ public class PatchProjectDiffNode extends PatchDiffNode {
public String getType() {
return ITypedElement.FOLDER_TYPE;
}
-
+
protected PatchConfiguration getConfiguration() {
return configuration;
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchTargetPage.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchTargetPage.java
index 44688f292..78a50f9da 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchTargetPage.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchTargetPage.java
@@ -81,17 +81,17 @@ public class PatchTargetPage extends WizardPage {
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
setControl(composite);
-
- useWorkspaceAsTarget = createRadioButton(composite, PatchMessages.PatchTargetPage_0, 1);
- selectTarget = createRadioButton(composite, PatchMessages.InputPatchPage_SelectInput, 1);
-
+
+ useWorkspaceAsTarget = createRadioButton(composite, PatchMessages.PatchTargetPage_0, 1);
+ selectTarget = createRadioButton(composite, PatchMessages.InputPatchPage_SelectInput, 1);
+
buildInputGroup(composite);
updateWidgetEnablements();
Dialog.applyDialogFont(composite);
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICompareContextIds.PATCH_INPUT_WIZARD_PAGE);
-
+
useWorkspaceAsTarget.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
fShowError = true;
@@ -124,7 +124,7 @@ public class PatchTargetPage extends WizardPage {
button.setLayoutData(data);
return button;
}
-
+
/* (non-JavaDoc)
* Method declared in IWizardPage.
*/
@@ -177,7 +177,7 @@ public class PatchTargetPage extends WizardPage {
fPatchTargets.setContentProvider(new WorkbenchContentProvider());
fPatchTargets.setComparator(new ResourceComparator(ResourceComparator.NAME));
fPatchTargets.setInput(ResourcesPlugin.getWorkspace().getRoot());
-
+
IResource target = fPatcher.getTarget();
if (target != null && !(target instanceof IWorkspaceRoot)) {
fPatchTargets.expandToLevel(target, 0);
@@ -192,7 +192,7 @@ public class PatchTargetPage extends WizardPage {
updateWidgetEnablements();
}
});
-
+
fPatchTargets.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
((PatchWizard)getWizard()).showPage(getNextPage());
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
index 1daddd07e..31efd3795 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizard.java
@@ -43,18 +43,18 @@ public class PatchWizard extends Wizard {
private final static String DIALOG_SETTINGS_KEY= "PatchWizard"; //$NON-NLS-1$
private boolean fHasNewDialogSettings;
-
+
protected InputPatchPage fPatchWizardPage;
protected PatchTargetPage fPatchTargetPage;
protected PreviewPatchPage2 fPreviewPage2;
-
+
private final WorkspacePatcher fPatcher;
-
+
private CompareConfiguration fConfiguration;
private IStorage patch;
private boolean patchReadIn = false;
-
+
public PatchWizard(IStorage patch, IResource target, CompareConfiguration configuration) {
Assert.isNotNull(configuration);
this.fConfiguration = configuration;
@@ -69,16 +69,16 @@ public class PatchWizard extends Wizard {
patchReadIn = true;
} catch (IOException e) {
MessageDialog.openError(null,
- PatchMessages.InputPatchPage_PatchErrorDialog_title,
- PatchMessages.InputPatchPage_ParseError_message);
+ PatchMessages.InputPatchPage_PatchErrorDialog_title,
+ PatchMessages.InputPatchPage_ParseError_message);
} catch (CoreException e) {
ErrorDialog.openError(getShell(),
- PatchMessages.InputPatchPage_PatchErrorDialog_title,
+ PatchMessages.InputPatchPage_PatchErrorDialog_title,
PatchMessages.InputPatchPage_PatchFileNotFound_message, e.getStatus());
}
}
}
-
+
private void initializeDialogSettings() {
IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings();
IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY);
@@ -101,7 +101,7 @@ public class PatchWizard extends Wizard {
IResource getTarget() {
return fPatcher.getTarget();
}
-
+
/* (non-Javadoc)
* Method declared on IWizard.
*/
@@ -115,24 +115,24 @@ public class PatchWizard extends Wizard {
fPreviewPage2 = new PreviewPatchPage2(fPatcher, fConfiguration);
addPage(fPreviewPage2);
}
-
+
/* (non-Javadoc)
* Method declared on IWizard.
*/
public boolean performFinish() {
-
+
IWizardPage currentPage = getContainer().getCurrentPage();
if (currentPage.getName().equals(PreviewPatchPage2.PREVIEWPATCHPAGE_NAME)){
PreviewPatchPage2 previewPage = (PreviewPatchPage2) currentPage;
previewPage.ensureContentsSaved();
}
-
+
if (fPatchWizardPage != null){
// make sure that the patch has been read
if (!fPatchWizardPage.isPatchRead())
fPatchWizardPage.readInPatch();
fPatcher.refresh();
-
+
// make sure that the patch is not invalid
if (!fPatchWizardPage.checkPageComplete())
return false;
@@ -143,18 +143,18 @@ public class PatchWizard extends Wizard {
//make sure that the patch has been read in
Assert.isTrue(patchReadIn);
}
-
+
if (!currentPage.getName().equals(PreviewPatchPage2.PREVIEWPATCHPAGE_NAME) && fPatcher.hasRejects()){
if (!MessageDialog.openConfirm(getShell(), PatchMessages.PatchWizard_0, PatchMessages.PatchWizard_1)) {
return false;
}
}
-
+
try {
// create scheduling rule based on the type of patch - single or workspace
ISchedulingRule scheduleRule = null;
if (fPatcher.isWorkspacePatch()) {
- // workspace patch
+ // workspace patch
ISchedulingRule[] projectRules = fPatcher.getTargetProjects();
scheduleRule = new MultiRule(projectRules);
} else {
@@ -206,7 +206,7 @@ public class PatchWizard extends Wizard {
public void showPage(IWizardPage page) {
getContainer().showPage(page);
}
-
+
public IWizardPage getNextPage(IWizardPage page) {
//no patch has been read in yet, input patch page
if (!patchReadIn)
@@ -225,7 +225,7 @@ public class PatchWizard extends Wizard {
/**
* Used to report that the patch has
- *
+ *
*/
protected void patchReadIn() {
patchReadIn = true;
@@ -234,7 +234,7 @@ public class PatchWizard extends Wizard {
public CompareConfiguration getCompareConfiguration() {
return fConfiguration;
}
-
+
public boolean canFinish() {
IWizardPage currentPage = getContainer().getCurrentPage();
if (currentPage.getName().equals(PreviewPatchPage2.PREVIEWPATCHPAGE_NAME)){
@@ -242,5 +242,5 @@ public class PatchWizard extends Wizard {
}
return super.canFinish();
}
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizardDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizardDialog.java
index 9979f6f31..8273a1c43 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizardDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PatchWizardDialog.java
@@ -22,17 +22,17 @@ public class PatchWizardDialog extends WizardDialog {
public PatchWizardDialog(Shell parent, IWizard wizard) {
super(parent, wizard);
-
+
setShellStyle(getShellStyle() | SWT.RESIZE);
setMinimumPageSize(700, 500);
}
-
+
protected IDialogSettings getDialogBoundsSettings() {
IDialogSettings settings = CompareUIPlugin.getDefault().getDialogSettings();
IDialogSettings section = settings.getSection(PATCH_WIZARD_SETTINGS_SECTION);
if (section == null) {
section = settings.addNewSection(PATCH_WIZARD_SETTINGS_SECTION);
- }
+ }
return section;
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
index 17d5afac0..1477cc21f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/Patcher.java
@@ -58,7 +58,7 @@ import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.text.TextUtilities;
/**
- * A Patcher
+ * A Patcher
* - knows how to parse various patch file formats into some in-memory structure,
* - holds onto the parsed data and the options to use when applying the patches,
* - knows how to apply the patches to files and folders.
@@ -73,7 +73,7 @@ public class Patcher implements IHunkFilter {
* Property used to associate a patcher with a {@link PatchConfiguration}
*/
public static final String PROP_PATCHER = "org.eclipse.compare.patcher"; //$NON-NLS-1$
-
+
public interface IFileValidator {
boolean validateResources(IFile[] array);
}
@@ -83,7 +83,7 @@ public class Patcher implements IHunkFilter {
// private static final int ED= 1;
// private static final int NORMAL= 2;
// private static final int UNIFIED= 3;
-
+
private FilePatch2[] fDiffs;
private IResource fTarget;
// patch options
@@ -94,13 +94,13 @@ public class Patcher implements IHunkFilter {
private final PatchConfiguration configuration;
private boolean fGenerateRejectFile = false;
-
+
public Patcher() {
configuration = new PatchConfiguration();
configuration.setProperty(PROP_PATCHER, this);
configuration.addHunkFilter(this);
}
-
+
/*
* Returns an array of Diffs after a successful call to <code>parse</code>.
* If <code>parse</code> hasn't been called returns <code>null</code>.
@@ -110,7 +110,7 @@ public class Patcher implements IHunkFilter {
return new FilePatch2[0];
return fDiffs;
}
-
+
public IPath getPath(FilePatch2 diff) {
return diff.getStrippedPath(getStripPrefixSegments(), isReversed());
}
@@ -125,11 +125,11 @@ public class Patcher implements IHunkFilter {
}
return false;
}
-
+
int getStripPrefixSegments() {
return getConfiguration().getPrefixSegmentStripCount();
}
-
+
/*
* Returns <code>true</code> if new value differs from old.
*/
@@ -140,11 +140,11 @@ public class Patcher implements IHunkFilter {
}
return false;
}
-
+
public int getFuzz(){
return getConfiguration().getFuzz();
}
-
+
/*
* Returns <code>true</code> if new value differs from old.
*/
@@ -155,11 +155,11 @@ public class Patcher implements IHunkFilter {
}
return false;
}
-
+
public boolean isIgnoreWhitespace() {
return getConfiguration().isIgnoreWhitespace();
}
-
+
public boolean isGenerateRejectFile() {
return fGenerateRejectFile;
}
@@ -167,7 +167,7 @@ public class Patcher implements IHunkFilter {
public void setGenerateRejectFile(boolean generateRejectFile) {
fGenerateRejectFile = generateRejectFile;
}
-
+
//---- parsing patch files
public void parse(IStorage storage) throws IOException, CoreException {
@@ -181,7 +181,7 @@ public class Patcher implements IHunkFilter {
}
}
}
-
+
public void parse(BufferedReader reader) throws IOException {
PatchReader patchReader = new PatchReader() {
@Override
@@ -197,7 +197,7 @@ public class Patcher implements IHunkFilter {
protected void patchParsed(PatchReader patchReader) {
fDiffs = patchReader.getDiffs();
}
-
+
public void countLines() {
FilePatch2[] fileDiffs = getDiffs();
for (int i = 0; i < fileDiffs.length; i++) {
@@ -223,13 +223,13 @@ public class Patcher implements IHunkFilter {
fileDiff.setRemovedLines(removedLines);
}
}
-
+
//---- applying a patch file
public void applyAll(IProgressMonitor pm, IFileValidator validator) throws CoreException {
-
+
int i;
-
+
IFile singleFile= null; // file to be patched
IContainer container= null;
if (fTarget instanceof IContainer)
@@ -240,7 +240,7 @@ public class Patcher implements IHunkFilter {
} else {
Assert.isTrue(false);
}
-
+
// get all files to be modified in order to call validateEdit
List list= new ArrayList();
if (singleFile != null)
@@ -260,30 +260,30 @@ public class Patcher implements IHunkFilter {
if (! validator.validateResources((IFile[])list.toArray(new IFile[list.size()]))) {
return;
}
-
+
final int WORK_UNIT= 10;
if (pm != null) {
- String message= Messages.Patcher_0;
+ String message= Messages.Patcher_0;
pm.beginTask(message, fDiffs.length*WORK_UNIT);
}
-
+
for (i= 0; i < fDiffs.length; i++) {
-
+
int workTicks= WORK_UNIT;
-
+
FilePatch2 diff= fDiffs[i];
if (isEnabled(diff)) {
-
+
IPath path= getPath(diff);
if (pm != null)
pm.subTask(path.toString());
-
+
IFile file= singleFile != null
? singleFile
: createPath(container, path);
-
+
List failed= new ArrayList();
-
+
int type= diff.getDiffType(isReversed());
switch (type) {
case FilePatch2.ADDITION:
@@ -313,7 +313,7 @@ public class Patcher implements IHunkFilter {
store(getRejected(failed), file, pm);
try {
IMarker marker= file.createMarker(MARKER_TYPE);
- marker.setAttribute(IMarker.MESSAGE, Messages.Patcher_1);
+ marker.setAttribute(IMarker.MESSAGE, Messages.Patcher_1);
marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
} catch (CoreException ex) {
// NeedWork
@@ -321,7 +321,7 @@ public class Patcher implements IHunkFilter {
}
}
}
-
+
if (pm != null) {
if (pm.isCanceled())
break;
@@ -340,7 +340,7 @@ public class Patcher implements IHunkFilter {
pp= new Path(path.lastSegment() + REJECT_FILE_EXTENSION);
return pp;
}
-
+
List apply(FilePatch2 diff, IFile file, boolean create, List failedHunks) {
FileDiffResult result = getDiffResult(diff);
List<String> lines = LineReader.load(file, create);
@@ -355,7 +355,7 @@ public class Patcher implements IHunkFilter {
}
return result.getLines();
}
-
+
/*
* Converts the string into bytes and stores them in the given file.
*/
@@ -380,7 +380,7 @@ public class Patcher implements IHunkFilter {
// uses default encoding
bytes= contents.getBytes();
}
-
+
store(bytes,file, pm);
}
@@ -423,7 +423,7 @@ public class Patcher implements IHunkFilter {
public static String getRejected(List failedHunks) {
if (failedHunks.size() <= 0)
return null;
-
+
String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$
StringBuffer sb= new StringBuffer();
Iterator iter= failedHunks.iterator();
@@ -435,7 +435,7 @@ public class Patcher implements IHunkFilter {
}
return sb.toString();
}
-
+
/*
* Ensures that a file with the given path exists in
* the given container. Folder are created as necessary.
@@ -469,16 +469,16 @@ public class Patcher implements IHunkFilter {
public void setTarget(IResource target) {
fTarget= target;
}
-
+
public IFile getTargetFile(FilePatch2 diff) {
IPath path = diff.getStrippedPath(getStripPrefixSegments(), isReversed());
return existsInTarget(path);
}
-
+
/**
* Iterates through all of the resources contained in the Patch Wizard target
- * and looks to for a match to the passed in file
+ * and looks to for a match to the passed in file
* @param path
* @return IFile which matches the passed in path or null if none found
*/
@@ -497,8 +497,8 @@ public class Patcher implements IHunkFilter {
/**
* Returns true if path completely matches the end of fullpath
- * @param fullpath
- * @param path
+ * @param fullpath
+ * @param path
* @return true if path matches, false otherwise
*/
private boolean matches(IPath fullpath, IPath path) {
@@ -523,14 +523,14 @@ public class Patcher implements IHunkFilter {
}
return length;
}
-
+
public void addDiff(FilePatch2 newDiff){
FilePatch2[] temp = new FilePatch2[fDiffs.length + 1];
System.arraycopy(fDiffs,0, temp, 0, fDiffs.length);
temp[fDiffs.length] = newDiff;
fDiffs = temp;
}
-
+
public void removeDiff(FilePatch2 diffToRemove){
FilePatch2[] temp = new FilePatch2[fDiffs.length - 1];
int counter = 0;
@@ -541,23 +541,23 @@ public class Patcher implements IHunkFilter {
}
fDiffs = temp;
}
-
+
public void setEnabled(Object element, boolean enabled) {
- if (element instanceof DiffProject)
+ if (element instanceof DiffProject)
setEnabledProject((DiffProject) element, enabled);
- if (element instanceof FilePatch2)
+ if (element instanceof FilePatch2)
setEnabledFile((FilePatch2)element, enabled);
- if (element instanceof Hunk)
+ if (element instanceof Hunk)
setEnabledHunk((Hunk) element, enabled);
}
-
+
private void setEnabledProject(DiffProject projectDiff, boolean enabled) {
FilePatch2[] diffFiles = projectDiff.getFileDiffs();
for (int i = 0; i < diffFiles.length; i++) {
setEnabledFile(diffFiles[i], enabled);
}
}
-
+
private void setEnabledFile(FilePatch2 fileDiff, boolean enabled) {
IHunk[] hunks = fileDiff.getHunks();
for (int i = 0; i < hunks.length; i++) {
@@ -588,7 +588,7 @@ public class Patcher implements IHunkFilter {
}
public boolean isEnabled(Object element) {
- if (disabledElements.contains(element))
+ if (disabledElements.contains(element))
return false;
Object parent = getElementParent(element);
if (parent == null)
@@ -603,7 +603,7 @@ public class Patcher implements IHunkFilter {
}
return null;
}
-
+
/**
* Calculate the fuzz factor that will allow the most hunks to be matched.
* @param monitor a progress monitor
@@ -632,12 +632,12 @@ public class Patcher implements IHunkFilter {
monitor.done();
}
}
-
+
public void refresh() {
diffResults.clear();
refresh(getDiffs());
}
-
+
public void refresh(FilePatch2[] diffs) {
for (int i = 0; i < diffs.length; i++) {
FilePatch2 diff = diffs[i];
@@ -645,7 +645,7 @@ public class Patcher implements IHunkFilter {
((WorkspaceFileDiffResult)result).refresh();
}
}
-
+
public FileDiffResult getDiffResult(FilePatch2 diff) {
FileDiffResult result = (FileDiffResult)diffResults.get(diff);
if (result == null) {
@@ -680,15 +680,15 @@ public class Patcher implements IHunkFilter {
}
return false;
}
-
+
public boolean isReversed() {
return getConfiguration().isReversed();
}
-
+
/**
* Cache the contents for the given file diff. These contents
* will be used for the diff when the patch is applied. When the
- * patch is applied, it is assumed that the provided contents
+ * patch is applied, it is assumed that the provided contents
* already have all relevant hunks applied.
* @param diff the file diff
* @param contents the contents for the file diff
@@ -696,9 +696,9 @@ public class Patcher implements IHunkFilter {
public void cacheContents(FilePatch2 diff, byte[] contents) {
contentCache.put(diff, contents);
}
-
+
/**
- * Return whether contents have been cached for the
+ * Return whether contents have been cached for the
* given file diff.
* @param diff the file diff
* @return whether contents have been cached for the file diff
@@ -709,7 +709,7 @@ public class Patcher implements IHunkFilter {
}
/**
- * Return the content lines that are cached for the given
+ * Return the content lines that are cached for the given
* file diff.
* @param diff the file diff
* @return the content lines that are cached for the file diff
@@ -733,7 +733,7 @@ public class Patcher implements IHunkFilter {
public byte[] getCachedContents(FilePatch2 diff) {
return (byte[])contentCache.get(diff);
}
-
+
/**
* Return whether the patcher has any cached contents.
* @return whether the patcher has any cached contents
@@ -749,11 +749,11 @@ public class Patcher implements IHunkFilter {
contentCache.clear();
mergedHunks.clear();
}
-
+
public void setProperty(String key, Object value) {
getConfiguration().setProperty(key, value);
}
-
+
public Object getProperty(String key) {
return getConfiguration().getProperty(key);
}
@@ -765,7 +765,7 @@ public class Patcher implements IHunkFilter {
public void setManuallyMerged(Hunk hunk, boolean merged) {
if (merged)
mergedHunks.add(hunk);
- else
+ else
mergedHunks.remove(hunk);
}
@@ -784,7 +784,7 @@ public class Patcher implements IHunkFilter {
public static Patcher getPatcher(PatchConfiguration configuration) {
return (Patcher)configuration.getProperty(PROP_PATCHER);
}
-
+
public boolean hasRejects() {
for (Iterator iterator = diffResults.values().iterator(); iterator.hasNext();) {
FileDiffResult result = (FileDiffResult) iterator.next();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
index 5d03024fb..3028911d0 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/PreviewPatchPage2.java
@@ -76,28 +76,28 @@ public class PreviewPatchPage2 extends WizardPage {
private static final String EXPAND_PATCH_OPTIONS = "expandPatchOptions"; //$NON-NLS-1$
private static final String GENERATE_REJECTS = "generateRejects"; //$NON-NLS-1$
-
+
final WorkspacePatcher fPatcher;
private final CompareConfiguration fConfiguration;
private PatchCompareEditorInput fInput;
-
+
private Combo fStripPrefixSegments;
private Text fFuzzField;
private Label addedRemovedLines;
-
+
private Action fExcludeAction;
private Action fIncludeAction;
private Action fIgnoreWhiteSpace;
private Action fReversePatch;
private Action fMoveAction;
-
+
protected boolean pageRecalculate= true;
private IDialogSettings settings;
private ExpandableComposite patchOptions;
private Button generateRejects;
private FormToolkit fToolkit;
-
+
public PreviewPatchPage2(WorkspacePatcher patcher, CompareConfiguration configuration) {
super(PREVIEWPATCHPAGE_NAME, PatchMessages.PreviewPatchPage_title, null);
setDescription(PatchMessages.PreviewPatchPage2_8);
@@ -117,13 +117,13 @@ public class PreviewPatchPage2 extends WizardPage {
public void createControl(Composite parent) {
fToolkit = new FormToolkit(parent.getDisplay());
fToolkit.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
-
+
final Form form = fToolkit.createForm(parent);
Composite composite = form.getBody();
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
initializeDialogUnits(parent);
-
+
fInput = new PatchCompareEditorInput(getPatcher(), getCompareConfiguration()) {
protected void fillContextMenu(IMenuManager manager) {
if (isShowAll()) {
@@ -134,16 +134,16 @@ public class PreviewPatchPage2 extends WizardPage {
manager.add(fMoveAction);
}
};
-
+
buildPatchOptionsGroup(form);
-
+
// Initialize the input
try {
fInput.run(null);
} catch (InterruptedException e) {//ignore
} catch (InvocationTargetException e) {//ignore
}
-
+
Label label = new Label(composite, SWT.NONE);
label.setText(PatchMessages.PreviewPatchPage2_9);
Control c = fInput.createContents(composite);
@@ -161,18 +161,18 @@ public class PreviewPatchPage2 extends WizardPage {
}});
c.setLayoutData(new GridData(GridData.FILL_BOTH));
-
+
addedRemovedLines = new Label(composite, SWT.NONE);
addedRemovedLines.setLayoutData(new GridData(GridData.FILL_HORIZONTAL
| GridData.VERTICAL_ALIGN_BEGINNING));
-
+
setControl(composite);
-
+
restoreWidgetValues();
-
+
Dialog.applyDialogFont(composite);
}
-
+
private void updateActions(IStructuredSelection ss) {
fExcludeAction.setEnabled(false);
fIncludeAction.setEnabled(false);
@@ -187,7 +187,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
}
}
-
+
/**
* Makes sure that at least one hunk is checked off in the tree before
* allowing the patch to be applied.
@@ -198,13 +198,13 @@ public class PreviewPatchPage2 extends WizardPage {
atLeastOneIsEnabled = fInput.hasResultToApply();
setPageComplete(atLeastOneIsEnabled);
}
-
+
private Action[] getContributedActions() {
return new Action[]{ fIgnoreWhiteSpace };
}
private void initializeActions() {
-
+
fMoveAction = new Action(PatchMessages.PreviewPatchPage2_RetargetAction, null) {
public void run() {
Shell shell = getShell();
@@ -244,7 +244,7 @@ public class PreviewPatchPage2 extends WizardPage {
fMoveAction.setEnabled(enable);
}
});
-
+
fExcludeAction = new Action(PatchMessages.PreviewPatchPage2_0) {
public void run() {
ISelection selection = fInput.getViewer().getSelection();
@@ -257,7 +257,7 @@ public class PreviewPatchPage2 extends WizardPage {
PatchDiffNode node = ((PatchDiffNode) obj);
node.setEnabled(false);
// TODO: This may require a rebuild if matched hunks are shown
- }
+ }
}
updateActions(treeSelection);
}
@@ -265,7 +265,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
};
fExcludeAction.setEnabled(true);
-
+
fIncludeAction = new Action(PatchMessages.PreviewPatchPage2_1) {
public void run() {
ISelection selection = fInput.getViewer().getSelection();
@@ -278,7 +278,7 @@ public class PreviewPatchPage2 extends WizardPage {
PatchDiffNode node = ((PatchDiffNode) obj);
node.setEnabled(true);
// TODO: This may require a rebuild if matched hunks are shown
- }
+ }
}
updateActions(treeSelection);
}
@@ -286,7 +286,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
};
fIncludeAction.setEnabled(true);
-
+
fIgnoreWhiteSpace = new Action(PatchMessages.PreviewPatchPage2_IgnoreWSAction, CompareUIPlugin.getImageDescriptor(ICompareUIConstants.IGNORE_WHITESPACE_ENABLED)){
public void run(){
try {
@@ -313,7 +313,7 @@ public class PreviewPatchPage2 extends WizardPage {
fIgnoreWhiteSpace.setChecked(false);
fIgnoreWhiteSpace.setToolTipText(PatchMessages.PreviewPatchPage2_IgnoreWSTooltip);
fIgnoreWhiteSpace.setDisabledImageDescriptor(CompareUIPlugin.getImageDescriptor(ICompareUIConstants.IGNORE_WHITESPACE_DISABLED));
-
+
fReversePatch = new Action(PatchMessages.PreviewPatchPage_ReversePatch_text){
public void run(){
try {
@@ -335,14 +335,14 @@ public class PreviewPatchPage2 extends WizardPage {
} catch (InvocationTargetException e) { //ignore
} catch (InterruptedException e) { //ignore
}
-
+
}
-
+
};
fReversePatch.setChecked(false);
fReversePatch.setToolTipText(PatchMessages.PreviewPatchPage_ReversePatch_text);
}
-
+
public void setVisible(boolean visible) {
super.setVisible(visible);
//Need to handle input and rebuild tree only when becoming visible
@@ -363,7 +363,7 @@ public class PreviewPatchPage2 extends WizardPage {
getShell().getDefaultButton().setFocus();
}
}
-
+
private boolean promptToRebuild(final String promptToConfirm){
final Control ctrl = getControl();
final boolean[] result = new boolean[] { false };
@@ -388,7 +388,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
return result[0];
}
-
+
private void rebuildTree(){
final Control ctrl = getControl();
if (ctrl != null && !ctrl.isDisposed()){
@@ -434,7 +434,7 @@ public class PreviewPatchPage2 extends WizardPage {
*/
private void buildPatchOptionsGroup(final Form form) {
Composite parent = form.getBody();
-
+
patchOptions = fToolkit.createExpandableComposite(parent, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
patchOptions.setText(PatchMessages.PreviewPatchPage_PatchOptions_title);
patchOptions.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT));
@@ -477,7 +477,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
}
);
-
+
fFuzzField.addModifyListener(
new ModifyListener() {
@@ -522,7 +522,7 @@ public class PreviewPatchPage2 extends WizardPage {
// Reset the fuzz. We don't use HunkResult.MAXIMUM_FUZZ_FACTOR on purpose here,
// in order to refresh the tree the result of the calculation needs to be different
// than the fuzz set in the configuration (see fFuzzField modify listener).
- patcher.setFuzz(-1);
+ patcher.setFuzz(-1);
int fuzz= guessFuzzFactor(patcher);
if (fuzz>=0)
fFuzzField.setText(Integer.toString(fuzz));
@@ -533,7 +533,7 @@ public class PreviewPatchPage2 extends WizardPage {
gd= new GridData(GridData.VERTICAL_ALIGN_CENTER);
int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
Point minSize = b.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- gd.widthHint = Math.max(widthHint, minSize.x);
+ gd.widthHint = Math.max(widthHint, minSize.x);
b.setLayoutData(gd);
}
@@ -552,7 +552,7 @@ public class PreviewPatchPage2 extends WizardPage {
generateRejects.setSelection(false);
generateRejects.setLayoutData(gd);
}
-
+
private void createShowRemovedToggle(Composite pair) {
final Button showRemoved = new Button(pair, SWT.CHECK);
showRemoved.setText(PatchMessages.PreviewPatchPage2_7);
@@ -568,7 +568,7 @@ public class PreviewPatchPage2 extends WizardPage {
showRemoved.setSelection(fInput.isShowAll());
showRemoved.setLayoutData(gd);
}
-
+
private void createReversePatchToggle(Composite pair) {
final Button reversePatch = new Button(pair, SWT.CHECK);
reversePatch.setText(PatchMessages.PreviewPatchPage_ReversePatch_text);
@@ -592,7 +592,7 @@ public class PreviewPatchPage2 extends WizardPage {
private void createStripSegmentCombo(Composite parent) {
final WorkspacePatcher patcher= getPatcher();
-
+
Composite pair= new Composite(parent, SWT.NONE);
GridLayout gl= new GridLayout(); gl.numColumns= 2; gl.marginHeight= gl.marginWidth= 0;
pair.setLayout(gl);
@@ -612,7 +612,7 @@ public class PreviewPatchPage2 extends WizardPage {
gd= new GridData(GridData.VERTICAL_ALIGN_CENTER|GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL);
fStripPrefixSegments.setLayoutData(gd);
}
-
+
private void createShowMatchedToggle(Composite parent) {
final Button showMatched = new Button(parent, SWT.CHECK);
showMatched.setText(PatchMessages.PreviewPatchPage2_ShowMatched);
@@ -628,7 +628,7 @@ public class PreviewPatchPage2 extends WizardPage {
showMatched.setSelection(fInput.isShowMatched());
showMatched.setLayoutData(gd);
}
-
+
public int getFuzzFactor() {
int fuzzFactor= 0;
if (fFuzzField!=null) {
@@ -641,7 +641,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
return fuzzFactor;
}
-
+
public int getStripPrefixSegments() {
int stripPrefixSegments= 0;
if (fStripPrefixSegments!=null) {
@@ -654,7 +654,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
return stripPrefixSegments;
}
-
+
private int guessFuzzFactor(final WorkspacePatcher patcher) {
final int[] result= new int[] { -1 };
try {
@@ -672,7 +672,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
return result[0];
}
-
+
public void ensureContentsSaved() {
try {
fInput.saveChanges(new NullProgressMonitor());
@@ -688,7 +688,7 @@ public class PreviewPatchPage2 extends WizardPage {
public CompareConfiguration getCompareConfiguration() {
return fConfiguration;
}
-
+
private void restoreWidgetValues() {
IDialogSettings dialogSettings = CompareUI.getPlugin().getDialogSettings();
settings = dialogSettings.getSection(PREVIEWPATCHPAGE_NAME);
@@ -703,30 +703,30 @@ public class PreviewPatchPage2 extends WizardPage {
getPatcher().setGenerateRejectFile(generateRejects.getSelection());
}
}
- }
-
+ }
+
void saveWidgetValues() {
settings.put(EXPAND_PATCH_OPTIONS, patchOptions.isExpanded());
settings.put(GENERATE_REJECTS, generateRejects.getSelection());
}
-
+
private String countLines() {
int added = 0, removed = 0;
-
+
IPreferenceStore store = CompareUIPlugin.getDefault().getPreferenceStore();
String addedLinesRegex = store.getString(ComparePreferencePage.ADDED_LINES_REGEX);
String removedLinesRegex = store.getString(ComparePreferencePage.REMOVED_LINES_REGEX);
-
+
if ((addedLinesRegex == null || "".equals(addedLinesRegex)) //$NON-NLS-1$
&& (removedLinesRegex == null || "".equals(removedLinesRegex))) { //$NON-NLS-1$
-
+
fPatcher.countLines();
FilePatch2[] fileDiffs = fPatcher.getDiffs();
for (int i = 0; i < fileDiffs.length; i++) {
added += fileDiffs[i].getAddedLines();
removed += fileDiffs[i].getRemovedLines();
}
-
+
} else {
Pattern addedPattern = Pattern.compile(addedLinesRegex);
@@ -747,7 +747,7 @@ public class PreviewPatchPage2 extends WizardPage {
}
}
}
-
+
return NLS.bind(PatchMessages.PreviewPatchPage2_AddedRemovedLines,
new String[] { added + "", removed + "" }); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
index e2cd72814..425aa0b2e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/RetargetPatchElementDialog.java
@@ -31,7 +31,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
class RetargetPatchElementDialog extends Dialog {
-
+
private static class RetargetPatchContentProvider extends BaseWorkbenchContentProvider {
private final PatchDiffNode node;
public RetargetPatchContentProvider(PatchDiffNode node) {
@@ -56,12 +56,12 @@ class RetargetPatchElementDialog extends Dialog {
return super.getChildren(element);
}
}
-
+
private final PatchDiffNode fSelectedNode;
private final WorkspacePatcher fPatcher;
private TreeViewer fViewer;
private IResource fSelectedResource;
-
+
public RetargetPatchElementDialog(Shell shell, WorkspacePatcher patcher, PatchDiffNode node) {
super(shell);
Assert.isNotNull(patcher);
@@ -77,7 +77,7 @@ class RetargetPatchElementDialog extends Dialog {
okButton.setEnabled(false);
return control;
}
-
+
protected Control createDialogArea(Composite parent) {
Composite composite= (Composite) super.createDialogArea(parent);
@@ -88,7 +88,7 @@ class RetargetPatchElementDialog extends Dialog {
GridLayout layout= new GridLayout();
layout.numColumns= 1;
layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
composite.setLayout(layout);
final GridData data= new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(data);
@@ -124,7 +124,7 @@ class RetargetPatchElementDialog extends Dialog {
return ResourcesPlugin.getWorkspace().getRoot();
return fPatcher.getTarget();
}
-
+
private IResource getInitialSelection() {
if (fSelectedNode instanceof PatchFileDiffNode) {
PatchFileDiffNode node = (PatchFileDiffNode) fSelectedNode;
@@ -174,7 +174,7 @@ class RetargetPatchElementDialog extends Dialog {
fPatcher.retargetHunk(node.getHunkResult().getHunk(), (IFile)fSelectedResource);
}
}
- super.okPressed();
+ super.okPressed();
}
void setupListeners() {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java
index a4923b4c0..6efb9f35d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/UnmatchedHunkTypedElement.java
@@ -30,7 +30,7 @@ import org.eclipse.core.runtime.CoreException;
public class UnmatchedHunkTypedElement extends HunkTypedElement implements IContentChangeNotifier, IEditableContent {
private ContentChangeNotifier changeNotifier;
-
+
public UnmatchedHunkTypedElement(HunkResult result) {
// An unmatched hunk element is always used for the before state and is full context
super(result, false, true);
@@ -86,7 +86,7 @@ public class UnmatchedHunkTypedElement extends HunkTypedElement implements ICont
private Patcher getPatcher() {
return Patcher.getPatcher(getConfiguration());
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.internal.patch.HunkTypedElement#getContents()
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
index 2c95ff86b..659e8b833 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspaceFileDiffResult.java
@@ -27,17 +27,17 @@ public class WorkspaceFileDiffResult extends FileDiffResult {
PatchConfiguration configuration) {
super(diff, configuration);
}
-
+
protected boolean canCreateTarget(IStorage storage) {
IProject project = getPatcher().getTargetProject(getDiff());
return project != null && project.isAccessible();
}
-
+
protected boolean targetExists(IStorage storage) {
IFile file= (IFile)storage;
return file != null && file.isAccessible();
}
-
+
protected List getLines(IStorage storage, boolean create) {
IFile file= getTargetFile();
List lines = LineReader.load(file, create);
@@ -51,7 +51,7 @@ public class WorkspaceFileDiffResult extends FileDiffResult {
public IFile getTargetFile() {
return getPatcher().getTargetFile(getDiff());
}
-
+
public void refresh() {
refresh(Utilities.getReaderCreator(getTargetFile()), null);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
index d63a246dc..611a7aaa6 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/WorkspacePatcher.java
@@ -39,7 +39,7 @@ import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.MultiRule;
/**
- * A Patcher
+ * A Patcher
* - knows how to parse various patch file formats into some in-memory structure,
* - holds onto the parsed data and the options to use when applying the patches,
* - knows how to apply the patches to files and folders.
@@ -58,14 +58,14 @@ public class WorkspacePatcher extends Patcher {
public WorkspacePatcher(IResource target) {
setTarget(target);
}
-
+
protected void patchParsed(PatchReader patchReader) {
super.patchParsed(patchReader);
fDiffProjects = patchReader.getDiffProjects();
fIsWorkspacePatch = patchReader.isWorkspacePatch();
fIsGitPatch = patchReader.isGitPatch() && calculateStripGitPrefixSegments() > -1;
}
-
+
public DiffProject[] getDiffProjects() {
return fDiffProjects;
}
@@ -172,15 +172,15 @@ public class WorkspacePatcher extends Patcher {
}
}
}
-
+
private boolean isAccessible(FilePatch2 diff) {
return isEnabled(diff) && Utilities.getProject(diff.getProject()).isAccessible();
}
/**
- * Returns the target files of all the Diffs contained by this
+ * Returns the target files of all the Diffs contained by this
* DiffProject.
- * @param project
+ * @param project
* @return An array of IFiles that are targeted by the Diffs
*/
public IFile[] getTargetFiles(DiffProject project) {
@@ -202,7 +202,7 @@ public class WorkspacePatcher extends Patcher {
return Utilities.getProject(project).getFile(path);
return super.getTargetFile(diff);
}
-
+
private IPath getFullPath(FilePatch2 diff) {
IPath path = diff.getStrippedPath(getStripPrefixSegments(), isReversed());
DiffProject project = getProject(diff);
@@ -214,7 +214,7 @@ public class WorkspacePatcher extends Patcher {
public ISchedulingRule[] getTargetProjects() {
List projects= new ArrayList();
IResourceRuleFactory ruleFactory= ResourcesPlugin.getWorkspace().getRuleFactory();
- // Determine the appropriate scheduling rules
+ // Determine the appropriate scheduling rules
for (int i= 0; i < fDiffProjects.length; i++) {
IProject tempProject= Utilities.getProject(fDiffProjects[i]);
// The goal here is to lock as little of the workspace as necessary
@@ -226,7 +226,7 @@ public class WorkspacePatcher extends Patcher {
MultiRule multiRule= new MultiRule(new ISchedulingRule[] { scheduleRule, tempProject } );
projects.add(multiRule);
}
-
+
return (ISchedulingRule[]) projects.toArray(new ISchedulingRule[projects.size()]);
}
@@ -244,8 +244,8 @@ public class WorkspacePatcher extends Patcher {
}
}
fDiffProjects = temp;
- }
-
+ }
+
protected Object getElementParent(Object element) {
if (element instanceof FilePatch2 && fDiffProjects != null) {
FilePatch2 diff = (FilePatch2) element;
@@ -261,7 +261,7 @@ public class WorkspacePatcher extends Patcher {
public boolean isRetargeted(Object object) {
return retargetedDiffs.containsKey(object);
}
-
+
public IPath getOriginalPath(Object object) {
return (IPath)retargetedDiffs.get(object);
}
@@ -269,7 +269,7 @@ public class WorkspacePatcher extends Patcher {
public void retargetDiff(FilePatch2 diff, IFile file) {
retargetedDiffs.put(diff, diff.getPath(false));
IHunk[] hunks = diff.getHunks();
-
+
if (isWorkspacePatch()){
//since the diff has no more hunks to apply, remove it from the parent and the patcher
diff.getProject().remove(diff);
@@ -310,7 +310,7 @@ public class WorkspacePatcher extends Patcher {
return fileDiff;
}
}
-
+
// Create a new diff for the file
IPath path = getDiffPath(file);
FilePatch2 newDiff = new FilePatch2(path, 0, path, 0);
@@ -361,7 +361,7 @@ public class WorkspacePatcher extends Patcher {
// Since the project has been retargeted, remove it from the patcher
removeProject(project);
}
-
+
/**
* Return the diff project for the given project
* or <code>null</code> if the diff project doesn't exist
@@ -380,7 +380,7 @@ public class WorkspacePatcher extends Patcher {
}
return null;
}
-
+
public int getStripPrefixSegments() {
// Segments are never stripped from a workspace patch
if (isWorkspacePatch())
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java
index 6623f007d..3d7bf3751 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/ApplyPatchOperation.java
@@ -43,42 +43,42 @@ import org.eclipse.ui.ide.IDE;
* user can also supply a title and image to override the default ones provided by the Apply Patch Wizard.
* Note that the Apply Patch Wizard does not require any particular set of inputs, and in the absence of
* any user supplied values, it will work in default mode.
- *
+ *
* @since 3.3
*
*/
public class ApplyPatchOperation implements Runnable {
private IWorkbenchPart part;
-
+
/**
* Used for the Preview Patch page.
*/
private CompareConfiguration configuration;
-
+
/**
* The patch to use as an input into the Apply Patch wizard
*/
private IStorage patch;
-
+
/**
* Specific <code>IResource</code> target to patch.
*/
private IResource target;
-
+
/**
* An optional image for the patch wizard
*/
private ImageDescriptor patchWizardImage;
-
-
+
+
/**
* An optional title for the patchWizard
*/
private String patchWizardTitle;
private boolean saveAllEditors = true;
-
+
/**
* Return whether the given storage contains a patch.
* @param storage the storage
@@ -88,7 +88,7 @@ public class ApplyPatchOperation implements Runnable {
public static boolean isPatch(IStorage storage) throws CoreException {
return internalParsePatch(storage).length > 0;
}
-
+
/**
* Parse the given patch and return the set of file patches that it contains.
* @param storage the storage that contains the patch
@@ -98,19 +98,19 @@ public class ApplyPatchOperation implements Runnable {
public static IFilePatch[] parsePatch(IStorage storage) throws CoreException {
return internalParsePatch(storage);
}
-
+
/**
* Creates a new ApplyPatchOperation with the supplied compare configuration, patch and target.
* The behaviour of the Apply Patch wizard is controlled by the number of parameters supplied:
* <ul>
* <li>If a patch is supplied, the initial input page is skipped. If a patch is not supplied the wizard
* will open on the input page.</li>
- * <li>If the patch is a workspace patch, the target selection page is skipped and the preview page is
+ * <li>If the patch is a workspace patch, the target selection page is skipped and the preview page is
* displayed.</li>
* <li>If the patch is not a workspace patch and the target is specified, the target page is still
* shown with the target selected.</li>
- * </ul>
- *
+ * </ul>
+ *
* @param part an IWorkbenchPart or <code>null</code>
* @param patch an IStorage containing a patch in unified diff format or <code>null</code>
* @param target an IResource which the patch is to be applied to or <code>null</code>
@@ -123,7 +123,7 @@ public class ApplyPatchOperation implements Runnable {
this.target = target;
this.configuration = configuration;
}
-
+
/**
* Create an operation for the given part and resource. This method is a convenience
* method that calls {@link #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration)}
@@ -142,7 +142,7 @@ public class ApplyPatchOperation implements Runnable {
*/
public void openWizard() {
saveAllEditors();
-
+
if (saveAllEditors) {
PatchWizard wizard = new PatchWizard(patch, target, configuration);
if (patchWizardImage != null)
@@ -166,7 +166,7 @@ public class ApplyPatchOperation implements Runnable {
return CompareUIPlugin.getShell();
return part.getSite().getShell();
}
-
+
/**
* This method will save all dirty editors. It will prompt the user if the Compare preference to save
* dirty editors before viewing a patch is <code>false</code>. Clients can use this or provide their own
@@ -175,7 +175,7 @@ public class ApplyPatchOperation implements Runnable {
protected void saveAllEditors(){
saveAllEditors = IDE.saveAllEditors(new IResource[]{ResourcesPlugin.getWorkspace().getRoot()}, !ComparePreferencePage.getSaveAllEditors());
}
-
+
/**
* Sets the title of the patch wizard. Needs to be set before {@link #openWizard()} is called.
* @param title a string to display in the title bar
@@ -183,7 +183,7 @@ public class ApplyPatchOperation implements Runnable {
public void setPatchWizardTitle(String title){
this.patchWizardTitle = title;
}
-
+
/**
* Sets the image descriptor to use in the patch wizard. Needs to be set before {@link #openWizard()} is called.
* @param descriptor an image descriptor
@@ -191,14 +191,14 @@ public class ApplyPatchOperation implements Runnable {
public void setPatchWizardImageDescriptor(ImageDescriptor descriptor){
this.patchWizardImage = descriptor;
}
-
+
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
openWizard();
}
-
+
private static IFilePatch[] internalParsePatch(IStorage storage)
throws CoreException {
BufferedReader reader = Utilities.createReader(storage);
@@ -230,5 +230,5 @@ public class ApplyPatchOperation implements Runnable {
}
}
-
+
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/IFilePatch.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/IFilePatch.java
index dbbe84cc5..e2f8b8964 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/IFilePatch.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/IFilePatch.java
@@ -16,7 +16,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
/**
* A representation of a file patch that can be applied to an input stream.
- *
+ *
* @see ApplyPatchOperation#parsePatch(org.eclipse.core.resources.IStorage)
* @since 3.3
* @noimplement This interface is not intended to be implemented by clients.
@@ -24,20 +24,20 @@ import org.eclipse.core.runtime.IProgressMonitor;
* {@link ApplyPatchOperation#parsePatch(org.eclipse.core.resources.IStorage)}.
*/
public interface IFilePatch extends IFilePatch2 {
-
+
/**
* Special constant that will be returned from get getBeforeDate() or
* getAfterDate() if the date is unknown. Equal to Midnight, Jan 1, 1970
* GMT.
- *
+ *
* @since 3.4
*/
public static long DATE_UNKNOWN = 0;
-
+
/**
* Return the target path for this patch. The target path may differ
* depending on whether the patch is being reversed or not.
- *
+ *
* @param configuration the patch configuration
* @return the target path for this patch
* @see PatchConfiguration#isReversed()
@@ -48,7 +48,7 @@ public interface IFilePatch extends IFilePatch2 {
* Apply this patch to the given file contents. The result provides the
* original and patch contents and also indicates whether some portions of
* the patch (called hunks) failed to apply.
- *
+ *
* @param contents the file contents
* @param configuration the patch configuration
* @param monitor a progress monitor
@@ -56,7 +56,7 @@ public interface IFilePatch extends IFilePatch2 {
*/
public IFilePatchResult apply(IStorage contents,
PatchConfiguration configuration, IProgressMonitor monitor);
-
+
/**
* Return the header information of the patch or
* <code>null</code> if there was no header text.
@@ -65,11 +65,11 @@ public interface IFilePatch extends IFilePatch2 {
* <code>null</code>
*/
public String getHeader();
-
+
/**
* Returns the milliseconds time value of the before date from the patch, or
* DATE_UNKNOWN if the date is unknown.
- *
+ *
* @return milliseconds time value of the before date from the patch
* @since 3.4
*/
@@ -78,7 +78,7 @@ public interface IFilePatch extends IFilePatch2 {
/**
* Returns the milliseconds time value of the after date from the patch, or
* DATE_UNKNOWN if the date is unknown.
- *
+ *
* @return milliseconds time value of the after date from the patch
* @since 3.4
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/WorkspacePatcherUI.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/WorkspacePatcherUI.java
index 8ea92b713..ce7d47b3f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/WorkspacePatcherUI.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/patch/WorkspacePatcherUI.java
@@ -21,7 +21,7 @@ import org.eclipse.core.resources.IProject;
*/
public class WorkspacePatcherUI {
/**
- * Returns a string that must be the first line of a workspace patch (a multi-project patch
+ * Returns a string that must be the first line of a workspace patch (a multi-project patch
* that is understood by the Apply Patch wizard). Each project to be included in the patch
* must be prefixed by the line obtained from the <code>getWorkspacePatchProjectHeader()</code>.
* This snippet outlines how the a workspace patch is to be created:
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
index 95a14d3f7..23455904d 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffContainer.java
@@ -21,9 +21,9 @@ import java.util.ArrayList;
public abstract class DiffContainer extends DiffElement implements IDiffContainer {
private static IDiffElement[] fgEmptyArray= new IDiffElement[0];
private ArrayList<IDiffElement> fChildren;
-
+
/**
- * Creates a new container with the specified kind under the given parent.
+ * Creates a new container with the specified kind under the given parent.
*
* @param parent under which the new container is added as a child or <code>null</code>.
* @param kind of difference (defined in <code>Differencer</code>).
@@ -31,11 +31,11 @@ public abstract class DiffContainer extends DiffElement implements IDiffContaine
public DiffContainer(IDiffContainer parent, int kind) {
super(parent, kind);
}
-
+
/**
* Tries to find the child with the given name.
* Returns <code>null</code> if no such child exists.
- *
+ *
* @param name of the child to find
* @return the first element with a matching name
*/
@@ -81,7 +81,7 @@ public abstract class DiffContainer extends DiffElement implements IDiffContaine
child.setParent(null);
}
}
-
+
@Override
public boolean hasChildren() {
return fChildren != null && fChildren.size() > 0;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
index 4f6d3316e..513feaa72 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DiffNode.java
@@ -29,7 +29,7 @@ import com.ibm.icu.text.MessageFormat;
* a compare with the <code>Differencer</code>.
* <p>
* Clients typically use this class as is, but may subclass if required.
- *
+ *
* @see DiffTreeViewer
* @see Differencer
*/
@@ -40,7 +40,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
private boolean fDontExpand;
private ListenerList<ICompareInputChangeListener> fListener;
private boolean fSwapSides;
-
+
/**
* Creates a new <code>DiffNode</code> and initializes with the given values.
*
@@ -111,7 +111,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
fListener= new ListenerList<>();
fListener.add(listener);
}
-
+
/**
* Unregisters a <code>ICompareInput</code> listener.
* Has no effect if listener is not registered.
@@ -126,7 +126,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
fListener= null;
}
}
-
+
/**
* Sends out notification that a change has occurred on the <code>ICompareInput</code>.
*/
@@ -204,10 +204,10 @@ public class DiffNode extends DiffContainer implements ICompareInput {
if (right.equals(left))
return right;
-
+
String s1;
String s2;
-
+
if (fSwapSides) {
s1= left;
s2= right;
@@ -215,15 +215,15 @@ public class DiffNode extends DiffContainer implements ICompareInput {
s1= right;
s2= left;
}
-
+
String fmt= Utilities.getString("DiffNode.nameFormat"); //$NON-NLS-1$
return MessageFormat.format(fmt, s1, s2);
}
-
+
void swapSides(boolean swap) {
fSwapSides= swap;
}
-
+
/* (non Javadoc)
* see ITypedElement.getImage
*/
@@ -255,7 +255,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
public void setAncestor(ITypedElement ancestor) {
fAncestor= ancestor;
}
-
+
/* (non Javadoc)
* see ICompareInput.getAncestor
*/
@@ -263,7 +263,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
public ITypedElement getAncestor() {
return fAncestor;
}
-
+
/**
* Sets the left input to the given value.
*
@@ -272,7 +272,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
public void setLeft(ITypedElement left) {
fLeft= left;
}
-
+
/* (non Javadoc)
* see ICompareInput.getLeft
*/
@@ -289,7 +289,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
public void setRight(ITypedElement right) {
fRight= right;
}
-
+
/* (non Javadoc)
* see ICompareInput.getRight
*/
@@ -304,12 +304,12 @@ public class DiffNode extends DiffContainer implements ICompareInput {
@Override
public void copy(boolean leftToRight) {
//System.out.println("DiffNode.copy: " + leftToRight);
-
+
IDiffContainer pa= getParent();
if (pa instanceof ICompareInput) {
ICompareInput parent= (ICompareInput) pa;
Object dstParent= leftToRight ? parent.getRight() : parent.getLeft();
-
+
if (dstParent instanceof IEditableContent) {
ITypedElement dst= leftToRight ? getRight() : getLeft();
ITypedElement src= leftToRight ? getLeft() : getRight();
@@ -318,14 +318,14 @@ public class DiffNode extends DiffContainer implements ICompareInput {
setRight(dst);
else
setLeft(dst);
-
+
//setKind(Differencer.NO_CHANGE);
-
+
fireChange();
}
}
}
-
+
/* (non Javadoc)
* see Object.hashCode
*/
@@ -339,7 +339,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
}
return hashCode;
}
-
+
/* (non Javadoc)
* see Object.equals
*/
@@ -357,7 +357,7 @@ public class DiffNode extends DiffContainer implements ICompareInput {
}
return super.equals(other);
}
-
+
private static String[] getPath(ITypedElement el, int level) {
String[] path= null;
if (el instanceof IDiffContainer) {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
index e42185a4c..57ecdefe9 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/Differencer.java
@@ -41,7 +41,7 @@ import com.ibm.icu.text.MessageFormat;
* <LI><code>contentsEqual</code>: for comparing the content of leaf objects, that is, objects without children,
* <LI><code>visit</code>: for every pair of compared object the compare result is passed in.
* </UL>
- * Clients may use as is, or subclass to provide a custom implementation for the three hooks.
+ * Clients may use as is, or subclass to provide a custom implementation for the three hooks.
* However the default implementation already deals with the typical case:
* <UL>
* <LI><code>getChildren</code>: tries to apply the <code>IStructureComparator</code>
@@ -85,12 +85,12 @@ public class Differencer {
* Three-way change constant (value 4) indicating a change on left side.
*/
public static final int LEFT= 4;
-
+
/**
* Three-way change constant (value 8) indicating a change on right side.
*/
public static final int RIGHT= 8;
-
+
/**
* Three-way change constant (value 12) indicating a change on left and
* right sides.
@@ -103,19 +103,19 @@ public class Differencer {
public static final int DIRECTION_MASK= 12;
/**
- * Constant (value 16) indicating a change on left and
+ * Constant (value 16) indicating a change on left and
* right side (with respect to ancestor) but left and right are identical.
*/
public static final int PSEUDO_CONFLICT= 16;
-
+
static class Node {
List<Node> fChildren;
int fCode;
Object fAncestor;
Object fLeft;
Object fRight;
-
+
Node() {
// nothing to do
}
@@ -156,10 +156,10 @@ public class Differencer {
// name= ((ITypedElement)fRight).getName();
// if (name == null)
// name= "???"; //$NON-NLS-1$
-//
+//
// for (int i= 0; i < level; i++)
// System.out.print(" "); //$NON-NLS-1$
-//
+//
// System.out.println(getDiffType(fCode) + name);
// }
@@ -190,17 +190,17 @@ public class Differencer {
// }
// return dir + change + " "; //$NON-NLS-1$
// }
- }
-
+ }
+
/**
* Creates a new differencing engine.
*/
public Differencer() {
// nothing to do
}
-
+
/**
- * Starts the differencing engine on the three input objects. If threeWay is <code>true</code> a
+ * Starts the differencing engine on the three input objects. If threeWay is <code>true</code> a
* three-way comparison is performed, otherwise a two-way compare (in the latter case the ancestor argument is ignored).
* The progress monitor is passed to the method <code>updateProgress</code> which is called for every node or
* leaf compare. The method returns the object that was returned from the top-most call to method <code>visit</code>.
@@ -210,16 +210,16 @@ public class Differencer {
* @param pm a progress monitor which is passed to method <code>updateProgress</code>
* @param data a client data that is passed to the top-level call to <code>visit</code>
* @param ancestor the ancestor object of the compare (may be <code>null</code>)
- * @param left the left object of the compare
+ * @param left the left object of the compare
* @param right the right object of the compare
* @return the object returned from the top most call to method <code>visit</code>,
* possibly <code>null</code>
*/
public Object findDifferences(boolean threeWay, IProgressMonitor pm, Object data, Object ancestor, Object left, Object right) {
Node root= new Node();
-
+
int code= traverse(threeWay, root, pm, threeWay ? ancestor : null, left, right);
-
+
if (code != NO_CHANGE) {
List<Node> l= root.fChildren;
if (!l.isEmpty()) {
@@ -229,7 +229,7 @@ public class Differencer {
}
return null;
}
-
+
/*
* Traverse tree in postorder.
*/
@@ -238,23 +238,23 @@ public class Differencer {
Object[] ancestorChildren= getChildren(ancestor);
Object[] rightChildren= getChildren(right);
Object[] leftChildren= getChildren(left);
-
+
int code= NO_CHANGE;
-
+
Node node= new Node(parent, ancestor, left, right);
-
+
boolean content= true; // we reset this if we have at least one child
-
+
if (((threeWay && ancestorChildren != null) || !threeWay)
&& rightChildren != null && leftChildren != null) {
// we only recurse down if no leg is null
// a node
-
+
Set<Object> allSet= new HashSet<>(20);
Map<Object, Object> ancestorSet= null;
Map<Object, Object> rightSet= null;
Map<Object, Object> leftSet= null;
-
+
if (ancestorChildren != null) {
ancestorSet= new HashMap<>(10);
for (int i= 0; i < ancestorChildren.length; i++) {
@@ -281,21 +281,21 @@ public class Differencer {
allSet.add(leftChild);
}
}
-
+
for (Object keyChild : allSet) {
if (pm != null) {
if (pm.isCanceled())
throw new OperationCanceledException();
-
+
updateProgress(pm, keyChild);
}
-
+
Object ancestorChild= ancestorSet != null ? ancestorSet.get(keyChild) : null;
Object leftChild= leftSet != null ? leftSet.get(keyChild) : null;
Object rightChild= rightSet != null ? rightSet.get(keyChild) : null;
-
+
int c= traverse(threeWay, node, pm, ancestorChild, leftChild, rightChild);
-
+
if ((c & CHANGE_TYPE_MASK) != NO_CHANGE) {
code|= CHANGE; // deletions and additions of child result in a change of the container
code|= (c & DIRECTION_MASK); // incoming & outgoing are just ored
@@ -306,12 +306,12 @@ public class Differencer {
if (content) // a leaf
code= compare(threeWay, ancestor, left, right);
-
+
node.fCode= code;
-
+
return code;
}
-
+
/**
* Called for every node or leaf comparison.
* The differencing engine passes in the input objects of the compare and the result of the compare.
@@ -333,15 +333,15 @@ public class Differencer {
protected Object visit(Object data, int result, Object ancestor, Object left, Object right) {
return new DiffNode((IDiffContainer) data, result, (ITypedElement)ancestor, (ITypedElement)left, (ITypedElement)right);
}
-
+
/*
* Performs a 2-way or 3-way compare of the given leaf elements and returns an integer
* describing the kind of difference.
*/
private int compare(boolean threeway, Object ancestor, Object left, Object right) {
-
+
int description= NO_CHANGE;
-
+
if (threeway) {
if (ancestor == null) {
if (left == null) {
@@ -368,18 +368,18 @@ public class Differencer {
if (contentsEqual(ancestor, MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR, right, MergeViewerContentProvider.RIGHT_CONTRIBUTOR))
description= LEFT | DELETION;
else
- description= CONFLICTING | CHANGE;
+ description= CONFLICTING | CHANGE;
}
} else {
if (right == null) {
if (contentsEqual(ancestor, MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR, left, MergeViewerContentProvider.LEFT_CONTRIBUTOR))
description= RIGHT | DELETION;
else
- description= CONFLICTING | CHANGE;
+ description= CONFLICTING | CHANGE;
} else {
boolean ay= contentsEqual(ancestor, MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR, left, MergeViewerContentProvider.LEFT_CONTRIBUTOR);
boolean am= contentsEqual(ancestor, MergeViewerContentProvider.ANCESTOR_CONTRIBUTOR, right, MergeViewerContentProvider.RIGHT_CONTRIBUTOR);
-
+
if (ay && am) {
// empty
} else if (ay && !am) {
@@ -411,7 +411,7 @@ public class Differencer {
}
}
}
-
+
return description;
}
@@ -422,7 +422,7 @@ public class Differencer {
* <code>contentsEqual(Object input1, Object input2)</code>. Subclasses may
* override to implement a different content compare on the given inputs.
* </p>
- *
+ *
* @param input1
* first input to contents compare
* @param contributor1
@@ -445,7 +445,7 @@ public class Differencer {
* <p>
* The <code>Differencer</code> implementation
* returns <code>true</code> if both inputs implement <code>IStreamContentAccessor</code>
- * and their byte contents is identical. Subclasses may override to implement
+ * and their byte contents is identical. Subclasses may override to implement
* a different content compare on the given inputs.
* </p>
*
@@ -454,20 +454,20 @@ public class Differencer {
* @return <code>true</code> if content is equal
*/
protected boolean contentsEqual(Object input1, Object input2) {
-
+
if (input1 == input2)
return true;
-
+
InputStream is1= getStream(input1);
InputStream is2= getStream(input2);
-
+
if (is1 == null && is2 == null) // no byte contents
return true;
-
+
try {
if (is1 == null || is2 == null) // only one has contents
return false;
-
+
while (true) {
int c1= is1.read();
int c2= is2.read();
@@ -475,7 +475,7 @@ public class Differencer {
return true;
if (c1 != c2)
break;
-
+
}
} catch (IOException ex) {
// NeedWork
@@ -497,7 +497,7 @@ public class Differencer {
}
return false;
}
-
+
/*
* Tries to return an InputStream for the given object.
* Returns <code>null</code> if the object not an IStreamContentAccessor
@@ -513,11 +513,11 @@ public class Differencer {
}
return null;
}
-
+
/**
* Returns the children of the given input or <code>null</code> if there are no children.
* <p>
- * The <code>Differencer</code> implementation checks whether the input
+ * The <code>Differencer</code> implementation checks whether the input
* implements the <code>IStructureComparator</code> interface. If yes it is used
* to return an array containing all children. Otherwise <code>null</code> is returned.
* Subclasses may override to implement a different strategy to enumerate children.
@@ -531,7 +531,7 @@ public class Differencer {
return ((IStructureComparator) input).getChildren();
return null;
}
-
+
/**
* Called for every leaf or node compare to update progress information.
* <p>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
index 5a0601cc6..85add5438 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/DocumentRangeNode.java
@@ -50,20 +50,20 @@ import org.eclipse.swt.widgets.Shell;
* to character ranges within the document.
* <p>
* Clients need to be aware that this node registers position updaters with the document
- * using {@link IDocument#addPosition(String, Position)} with the category set to
- * {@link IDocumentRange#RANGE_CATEGORY}. The {@link StructureDiffViewer} will
+ * using {@link IDocument#addPosition(String, Position)} with the category set to
+ * {@link IDocumentRange#RANGE_CATEGORY}. The {@link StructureDiffViewer} will
* remove the category when the nodes are no longer being used. Other clients
* must do the same.
* <p>
* Subclasses may add additional state collected while parsing the document.
- * </p>
+ * </p>
* @see Differencer
*/
public class DocumentRangeNode
implements IDocumentRange, IStructureComparator, IEditableContent,
IEncodedStreamContentAccessor, IAdaptable, IEditableContentExtension {
private static final String UTF_16= "UTF-16"; //$NON-NLS-1$
-
+
private IDocument fBaseDocument;
private Position fRange; // the range in the base document
private int fTypeCode;
@@ -75,7 +75,7 @@ public class DocumentRangeNode
/**
* Creates a new <code>DocumentRangeNode</code> for the given range within the specified
* document. The <code>typeCode</code> is uninterpreted client data. The ID is used when comparing
- * two nodes with each other: i.e. the differencing engine performs a content compare
+ * two nodes with each other: i.e. the differencing engine performs a content compare
* on two nodes if their IDs are equal.
*
* @param typeCode a type code for this node
@@ -87,13 +87,13 @@ public class DocumentRangeNode
public DocumentRangeNode(int typeCode, String id, IDocument document, int start, int length) {
this(null, typeCode, id, document, start, length);
}
-
+
/**
* Creates a new <code>DocumentRangeNode</code> for the given range within the specified
* document. The <code>typeCode</code> is uninterpreted client data. The ID is used when comparing
- * two nodes with each other: i.e. the differencing engine performs a content compare
+ * two nodes with each other: i.e. the differencing engine performs a content compare
* on two nodes if their IDs are equal.
- *
+ *
* @param parent the parent node
* @param typeCode a type code for this node
* @param id an identifier for this node
@@ -129,7 +129,7 @@ public class DocumentRangeNode
public IDocument getDocument() {
return fBaseDocument;
}
-
+
/* (non Javadoc)
* see IDocumentRange.getRange
*/
@@ -137,7 +137,7 @@ public class DocumentRangeNode
public Position getRange() {
return fRange;
}
-
+
/**
* Returns the type code of this node.
* The type code is uninterpreted client data which can be set in the constructor.
@@ -147,7 +147,7 @@ public class DocumentRangeNode
public int getTypeCode() {
return fTypeCode;
}
-
+
/**
* Returns this node's id.
* It is used in <code>equals</code> and <code>hashcode</code>.
@@ -182,7 +182,7 @@ public class DocumentRangeNode
@Override
public Object[] getChildren() {
if (fChildren != null)
- return fChildren.toArray();
+ return fChildren.toArray();
return new Object[0];
}
@@ -335,7 +335,7 @@ public class DocumentRangeNode
}
}
}
-
+
/* (non Javadoc)
* see IStreamContentAccessor.getContents
*/
@@ -346,7 +346,7 @@ public class DocumentRangeNode
s= fBaseDocument.get(fRange.getOffset(), fRange.getLength());
} catch (BadLocationException ex) {
s= ""; //$NON-NLS-1$
- }
+ }
return new ByteArrayInputStream(Utilities.getBytes(s, UTF_16));
}
@@ -362,7 +362,7 @@ public class DocumentRangeNode
return fParent.isEditable();
return true;
}
-
+
@Override
public ITypedElement replace(ITypedElement child, ITypedElement other) {
if (fParent == null) {
@@ -371,10 +371,10 @@ public class DocumentRangeNode
// since all the subclasses that have been converted overrode the method anyway
DocumentRangeNode src= null;
String srcContents= ""; //$NON-NLS-1$
-
+
if (other != null) {
src= (DocumentRangeNode) child;
-
+
if (other instanceof IStreamContentAccessor) {
try {
srcContents= Utilities.readString((IStreamContentAccessor)other);
@@ -384,14 +384,14 @@ public class DocumentRangeNode
}
}
}
-
+
if (child == null) // no destination: we have to add the contents into the parent
add(srcContents, null, src);
}
nodeChanged(this);
return child;
}
-
+
/**
* Default implementation that calls {@link #internalSetContents(byte[])}
* and then {@link #nodeChanged(DocumentRangeNode)}. Subclasses
@@ -407,7 +407,7 @@ public class DocumentRangeNode
/**
* Method that is invoked from {@link #setContent(byte[])}. By default,
- * this method does nothing. Subclasses may override.
+ * this method does nothing. Subclasses may override.
* @param content the new content
* @since 3.3
*/
@@ -419,7 +419,7 @@ public class DocumentRangeNode
public String getCharset() {
return UTF_16;
}
-
+
/**
* Method that should be invoked whenever the contents of this node are
* changed. the change is propagated to the parent if there is one.
@@ -430,7 +430,7 @@ public class DocumentRangeNode
if (fParent != null)
fParent.nodeChanged(node);
}
-
+
/**
* Implement {@link IAdaptable#getAdapter(Class)} in order to provide
* an {@link ISharedDocumentAdapter} that provides the proper look up key based
@@ -446,7 +446,7 @@ public class DocumentRangeNode
public <T> T getAdapter(Class<T> adapter) {
if (adapter == ISharedDocumentAdapter.class && fParent != null)
return fParent.getAdapter(adapter);
-
+
return Platform.getAdapterManager().getAdapter(this, adapter);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
index d95c35525..49ed4f4ee 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInput.java
@@ -31,12 +31,12 @@ import org.eclipse.swt.graphics.Image;
* the (non-<code>null</code>) left side of an <code>ICompareInput</code>
* is copied to the right side by means of method <code>copy</code>.
* This should trigger a call to <code>compareInputChanged</code> of registered
- * <code>ICompareInputChangeListener</code>s.
+ * <code>ICompareInputChangeListener</code>s.
* <p>
- * Clients can implement this interface, or use the convenience implementation
+ * Clients can implement this interface, or use the convenience implementation
* <code>DiffNode</code>.
* </p>
- *
+ *
* @see StructureDiffViewer
* @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer
* @see DiffNode
@@ -52,7 +52,7 @@ public interface ICompareInput {
* @return name of input
*/
String getName();
-
+
/**
* Returns an image representing this input.
* This image is typically displayed when this input is shown in a viewer.
@@ -73,7 +73,7 @@ public interface ICompareInput {
* @return kind of difference (see <code>Differencer</code>)
*/
int getKind();
-
+
/**
* Returns the ancestor side of this input.
* Returns <code>null</code> if this input has no ancestor
@@ -82,7 +82,7 @@ public interface ICompareInput {
* @return the ancestor of this input, or <code>null</code>
*/
ITypedElement getAncestor();
-
+
/**
* Returns the left side of this input.
* Returns <code>null</code> if there is no left side (deletion or addition).
@@ -90,7 +90,7 @@ public interface ICompareInput {
* @return the left side of this input, or <code>null</code>
*/
ITypedElement getLeft();
-
+
/**
* Returns the right side of this input.
* Returns <code>null</code> if there is no right side (deletion or addition).
@@ -98,7 +98,7 @@ public interface ICompareInput {
* @return the right side of this input, or <code>null</code>
*/
ITypedElement getRight();
-
+
/**
* Registers the given listener for notification.
* If the identical listener is already registered the method has no effect.
@@ -106,7 +106,7 @@ public interface ICompareInput {
* @param listener the listener to register for changes of this input
*/
void addCompareInputChangeListener(ICompareInputChangeListener listener);
-
+
/**
* Unregisters the given listener.
* If the identical listener is not registered the method has no effect.
@@ -114,9 +114,9 @@ public interface ICompareInput {
* @param listener the listener to unregister
*/
void removeCompareInputChangeListener(ICompareInputChangeListener listener);
-
+
/**
- * Copy one side (source) to the other side (destination) depending on the
+ * Copy one side (source) to the other side (destination) depending on the
* value of <code>leftToRight</code>. This method is called from
* a merge viewer if a corresponding action ("take left" or "take right")
* has been pressed.
@@ -133,7 +133,7 @@ public interface ICompareInput {
* </UL>
* In addition the implementation should send out notification to the registered
* <code>ICompareInputChangeListener</code>.
- *
+ *
* @param leftToRight if <code>true</code> the left side is copied to the right side.
* If <code>false</code> the right side is copied to the left side
*/
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
index 9906af285..b20603d00 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/ICompareInputChangeListener.java
@@ -18,18 +18,18 @@ package org.eclipse.compare.structuremergeviewer;
* the (non-null) left side of an <code>ICompareInput</code>
* is copied to the right side (which was <code>null</code>).
* This triggers a call to <code>compareInputChanged</code> of registered
- * <code>ICompareInputChangeListener</code>.
+ * <code>ICompareInputChangeListener</code>.
* <p>
* Note however, that listener are not informed if the content of one of the sides changes.
* <p>
- * Clients may implement this interface. It is also implemented by viewers that take
+ * Clients may implement this interface. It is also implemented by viewers that take
* an <code>ICompareInput</code> as input.
* </p>
*/
public interface ICompareInputChangeListener {
-
+
/**
- * Called whenever the value (not the content) of one or more of the three sides
+ * Called whenever the value (not the content) of one or more of the three sides
* of a <code>ICompareInput</code> has changed.
*
* @param source the <code>ICompareInput</code> that has changed
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
index e7ec0fbba..633e30a06 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffContainer.java
@@ -30,15 +30,15 @@ public interface IDiffContainer extends IDiffElement {
* Returns whether this container has at least one child.
* In some cases this methods avoids having to call the
* potential more costly <code>getChildren</code> method.
- *
- * @return <code>true</code> if this container has at least one child
+ *
+ * @return <code>true</code> if this container has at least one child
*/
boolean hasChildren();
/**
* Returns the children of this container.
* If this container has no children an empty array is returned (not <code>null</code>).
- *
+ *
* @return the children of this container as an array
*/
IDiffElement[] getChildren();
@@ -50,7 +50,7 @@ public interface IDiffContainer extends IDiffElement {
* @param child the child to be added to this container
*/
void add(IDiffElement child);
-
+
/**
* Removes the given child from this container.
* If the container becomes empty it is removed from its container.
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
index 3577d1cfe..02023e1e7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IDiffElement.java
@@ -35,7 +35,7 @@ import org.eclipse.compare.ITypedElement;
* @see DiffNode
*/
public interface IDiffElement extends ITypedElement {
-
+
/**
* Returns the kind of difference as defined in <code>Differencer</code>.
*
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
index bbfd40dee..7d5423bf5 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureComparator.java
@@ -14,7 +14,7 @@ package org.eclipse.compare.structuremergeviewer;
* Interface used to compare hierarchical structures.
* It is used by the differencing engine.
* <p>
- * Clients typically implement this interface in an adaptor class which
+ * Clients typically implement this interface in an adaptor class which
* wrappers the objects to be compared.
*
* @see org.eclipse.compare.ResourceNode
@@ -33,7 +33,7 @@ public interface IStructureComparator {
* Returns whether some other object is "equal to" this one
* with respect to a structural comparison. For example, when comparing
* Java class methods, <code>equals</code> would return <code>true</code>
- * if two methods have the same signature (the argument names and the
+ * if two methods have the same signature (the argument names and the
* method body might differ).
*
* @param other the reference object with which to compare
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator2.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator2.java
index 60f6f8a97..e30053fe8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator2.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/IStructureCreator2.java
@@ -25,7 +25,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @since 3.3
*/
public interface IStructureCreator2 extends IStructureCreator {
-
+
/**
* Creates a tree structure consisting of <code>IStructureComparator</code>s
* from the given object and returns its root object. Implementing this
@@ -33,19 +33,19 @@ public interface IStructureCreator2 extends IStructureCreator {
* (e.g. a parsing error) the value <code>null</code> is returned.
* <p>
* This method is equivalent to
- * {@link IStructureCreator#getStructure(Object)} with the exception that
+ * {@link IStructureCreator#getStructure(Object)} with the exception that
* the {@link #destroy(Object)} method must be called with the returned
* comparator as a parameter when the comparator is no longer
* needed. This is done to allow structure creators
* to make use of shared resources such a file buffer.
* <p>
- * Also, the node returned from this method should adapt to an
- * {@link ISharedDocumentAdapter} if the provided input has
- * a shared document adapter and it is being used by the
+ * Also, the node returned from this method should adapt to an
+ * {@link ISharedDocumentAdapter} if the provided input has
+ * a shared document adapter and it is being used by the
* this creator. The convenience class {@link SharedDocumentAdapterWrapper}
* is provided to allow the creator to wrap the adapter of the input
* so that the proper key can be returned.
- *
+ *
* @param input
* the object from which to create the tree of
* <code>IStructureComparator</code>
@@ -57,16 +57,16 @@ public interface IStructureCreator2 extends IStructureCreator {
* @see #destroy(Object)
*/
IStructureComparator createStructure(Object input, IProgressMonitor monitor) throws CoreException;
-
+
/**
* Creates the single node specified by path from the given input object.
* This method is equivalent to
- * {@link IStructureCreator#locate(Object, Object)} with the exception that
+ * {@link IStructureCreator#locate(Object, Object)} with the exception that
* the {@link #destroy(Object)} method must be called with the returned
* element as a parameter when the element is no longer
* needed. This is done to allow structure creators
* to make use of shared resources such a file buffer.
- *
+ *
* @param element specifies a sub object within the input object
* @param input the object from which to create the
* <code>ITypedElement</code>
@@ -74,12 +74,12 @@ public interface IStructureCreator2 extends IStructureCreator {
* @return the single node specified by <code>path</code> or
* <code>null</code>
* @throws CoreException if an error occurs while parsing the input
- *
+ *
* @see IStructureCreator#locate(Object, Object)
* @see #destroy(Object)
*/
ITypedElement createElement(Object element, Object input, IProgressMonitor monitor) throws CoreException;
-
+
/**
* Release any resources associated with the given object.
* This method must be called for objects returned from either
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/SharedDocumentAdapterWrapper.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/SharedDocumentAdapterWrapper.java
index f5e322302..fdac1f88a 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/SharedDocumentAdapterWrapper.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/SharedDocumentAdapterWrapper.java
@@ -28,18 +28,18 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
*/
public class SharedDocumentAdapterWrapper implements ISharedDocumentAdapter {
private ISharedDocumentAdapter wrappedAdapter;
-
+
/**
* Helper method that returns the shared document adapter for the
* given typed element or <code>null</code> if there isn't one.
* @param element the typed element
- * @return the shared document adapter for the given typed element
+ * @return the shared document adapter for the given typed element
* or <code>null</code>
*/
public static ISharedDocumentAdapter getAdapter(Object element) {
return Adapters.adapt(element, ISharedDocumentAdapter.class);
}
-
+
/**
* Creates a shared document adapter that wraps the given adapter.
* @param wrappedAdapter the wrapped adapter
@@ -48,7 +48,7 @@ public class SharedDocumentAdapterWrapper implements ISharedDocumentAdapter {
super();
this.wrappedAdapter = wrappedAdapter;
}
-
+
@Override
public void connect(IDocumentProvider provider, IEditorInput documentKey)
throws CoreException {
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java
index e7fd54315..71be84ba7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureCreator.java
@@ -45,7 +45,7 @@ import org.eclipse.ui.texteditor.IDocumentProvider;
* <p>
* Clients may subclass this class.
* </p>
- *
+ *
* @since 3.3
*/
public abstract class StructureCreator implements IStructureCreator2 {
@@ -64,16 +64,16 @@ public abstract class StructureCreator implements IStructureCreator2 {
return null;
}
}
-
+
if (contents == null) {
// Node has no contents
return null;
}
-
+
doc= new Document(contents);
setupDocument(doc);
}
-
+
try {
return createStructureComparator(input, doc, null, null);
} catch (CoreException e) {
@@ -126,7 +126,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
}
return getStructure(element);
}
-
+
/**
* Creates an {@link IStructureComparator} for the given element using the
* contents available in the given document. If the provided
@@ -150,7 +150,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
* document was obtained or <code>null</code> if the document
* is not shared.
* @param monitor a progress monitor or <code>null</code> if progress is not required
- *
+ *
* @return a structure comparator
* @throws CoreException
*/
@@ -186,7 +186,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
}
}
}
-
+
/**
* Returns the partitioner to be associated with the document or
* <code>null</code> is partitioning is not needed or if the subclass
@@ -208,7 +208,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
protected String getDocumentPartitioning() {
return null;
}
-
+
/**
* Default implementation of save that extracts the contents from
* the document of an {@link IDocumentRange} and sets it on the
@@ -271,7 +271,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
}
return false;
}
-
+
/**
* Create an {@link ISharedDocumentAdapter} that will provide the document key for the given input
* object for any {@link DocumentRangeNode} instances whose document is the same as the
@@ -299,7 +299,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
}
};
}
-
+
/**
* Default implementation of {@link #createElement(Object, Object, IProgressMonitor)}
* that uses {@link #getPath(Object, Object)} to determine the
@@ -329,11 +329,11 @@ public abstract class StructureCreator implements IStructureCreator2 {
IStructureComparator structure= createStructure(input, monitor);
if (structure == null) // we couldn't parse the structure
return null; // so we can't find anything
-
+
// find the path in the tree
return findElement(structure, path);
}
-
+
/**
* Default implementation of {@link #locate(Object, Object)} that
* uses {@link #getPath(Object, Object)} to determine the
@@ -353,11 +353,11 @@ public abstract class StructureCreator implements IStructureCreator2 {
IStructureComparator structure= getStructure(input);
if (structure == null) // we couldn't parse the structure
return null; // so we can't find anything
-
+
// find the path in the tree
return (IStructureComparator)findElement(structure, path);
}
-
+
/**
* Finds the element at the given path in the given structure.
* This method is invoked from the {@link #createElement(Object, Object, IProgressMonitor)}
@@ -400,7 +400,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
}
return null;
}
-
+
/**
* Returns the path of the element in the structure of it's containing input
* or <code>null</code> if the element is not contained in the input. This method is
@@ -439,7 +439,7 @@ public abstract class StructureCreator implements IStructureCreator2 {
* Returns true if the two nodes are equal for comparison purposes. If
* <code>compareFilters</code> is not empty, the filters are applied to each
* line of each node's text representation.
- *
+ *
* @param node1
* @param contributor1
* either 'A', 'L', or 'R' for ancestor, left or right
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
index a6520ec3d..0155bd5fe 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureDiffViewer.java
@@ -55,21 +55,21 @@ import org.eclipse.ui.services.IDisposable;
* @see ICompareInput
* @noextend This class is not intended to be subclassed by clients.
*/
-
+
public class StructureDiffViewer extends DiffTreeViewer {
private Differencer fDifferencer;
private boolean fThreeWay= false;
-
+
private StructureInfo fAncestorStructure = new StructureInfo();
private StructureInfo fLeftStructure = new StructureInfo();
private StructureInfo fRightStructure = new StructureInfo();
-
+
private IStructureCreator fStructureCreator;
private IDiffContainer fRoot;
private IContentChangeListener fContentChangedListener;
private CompareViewerSwitchingPane fParent;
private ICompareInputChangeListener fCompareInputChangeListener;
-
+
/*
* A set of background tasks for updating the structure
*/
@@ -82,7 +82,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
monitor.done();
}
};
-
+
private IRunnableWithProgress inputChangedTask = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException,
@@ -93,7 +93,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
monitor.done();
}
};
-
+
/*
* A helper class for holding the input and generated structure
* for the ancestor, left and right inputs.
@@ -108,7 +108,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
refresh(monitor);
}
};
-
+
public boolean setInput(ITypedElement newInput, boolean force, IProgressMonitor monitor) {
boolean changed = false;
if (force || newInput != fInput) {
@@ -142,7 +142,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
}
}
}
-
+
public IStructureComparator getStructureComparator() {
return fStructureComparator;
}
@@ -151,7 +151,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
IStructureComparator oldComparator = fStructureComparator;
fStructureComparator= createStructure(monitor);
// Dispose of the old one after in case they are using a shared document
- // (i.e. disposing it after will hold on to a reference to the document
+ // (i.e. disposing it after will hold on to a reference to the document
// so it doesn't get freed and reloaded)
if (oldComparator instanceof IDisposable) {
IDisposable disposable = (IDisposable) oldComparator;
@@ -162,7 +162,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
public Object getInput() {
return fInput;
}
-
+
private IStructureComparator createStructure(IProgressMonitor monitor) {
// Defend against concurrent disposal
Object input = fInput;
@@ -190,7 +190,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
return refreshTask;
}
}
-
+
/**
* Creates a new viewer for the given SWT tree control with the specified configuration.
*
@@ -204,7 +204,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
fParent= (CompareViewerSwitchingPane) c;
initialize();
}
-
+
/**
* Creates a new viewer under the given SWT parent with the specified configuration.
*
@@ -217,11 +217,11 @@ public class StructureDiffViewer extends DiffTreeViewer {
fParent= (CompareViewerSwitchingPane) parent;
initialize();
}
-
+
private void initialize() {
-
+
setAutoExpandLevel(3);
-
+
fContentChangedListener= new IContentChangeListener() {
@Override
public void contentChanged(IContentChangeNotifier changed) {
@@ -235,7 +235,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
}
};
}
-
+
/**
* Configures the <code>StructureDiffViewer</code> with a structure creator.
* The structure creator is used to create a hierarchical structure
@@ -251,7 +251,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle());
}
}
-
+
/**
* Returns the structure creator or <code>null</code> if no
* structure creator has been set with <code>setStructureCreator</code>.
@@ -261,7 +261,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
public IStructureCreator getStructureCreator() {
return fStructureCreator;
}
-
+
/**
* Reimplemented to get the descriptive title for this viewer from the <code>IStructureCreator</code>.
* @return the viewer's name
@@ -272,18 +272,18 @@ public class StructureDiffViewer extends DiffTreeViewer {
return fStructureCreator.getName();
return super.getTitle();
}
-
+
/**
* Overridden because the input of this viewer is not identical to the root of the tree.
* The tree's root is a IDiffContainer that was returned from the method <code>diff</code>.
- *
+ *
* @return the root of the diff tree produced by method <code>diff</code>
*/
@Override
protected Object getRoot() {
return fRoot;
}
-
+
/*
* (non-Javadoc) Method declared on StructuredViewer.
* Overridden to create the comparable structures from the input object
@@ -304,7 +304,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
initialSelection();
}
}
-
+
@Override
protected void initialSelection() {
expandToLevel(2);
@@ -324,7 +324,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
fContentChangedListener= null;
super.handleDispose(event);
}
-
+
/**
* Recreates the comparable structures for the input sides.
* @param input this viewer's new input
@@ -332,7 +332,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void compareInputChanged(ICompareInput input) {
compareInputChanged(input, false);
}
-
+
/* package */ void compareInputChanged(final ICompareInput input, final boolean force) {
if (input == null) {
// When closing, we don't need a progress monitor to handle the input change
@@ -360,7 +360,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
/* package */ void compareInputChanged(ICompareInput input, boolean force, IProgressMonitor monitor) {
ITypedElement t= null;
boolean changed= false;
-
+
if (input != null)
t= input.getAncestor();
fThreeWay= (t != null);
@@ -368,17 +368,17 @@ public class StructureDiffViewer extends DiffTreeViewer {
try {
if (fAncestorStructure.setInput(t, force, subMonitor(monitor, 100)))
changed = true;
-
+
if (input != null)
t= input.getLeft();
if (fLeftStructure.setInput(t, force, subMonitor(monitor, 100)))
changed = true;
-
+
if (input != null)
t= input.getRight();
if (fRightStructure.setInput(t, force, subMonitor(monitor, 100)))
changed = true;
-
+
// The compare configuration is nulled when the viewer is disposed
CompareConfiguration cc = getCompareConfiguration();
if (changed && cc != null)
@@ -387,7 +387,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
endWork(monitor);
}
}
-
+
private void endWork(IProgressMonitor monitor) {
if (monitor != null)
monitor.done();
@@ -414,7 +414,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void contentChanged(final IContentChangeNotifier changed) {
if (fStructureCreator == null)
return;
-
+
if (changed == null) {
getCompareConfiguration().getContainer().runAsynchronously(fAncestorStructure.getRefreshTask());
getCompareConfiguration().getContainer().runAsynchronously(fLeftStructure.getRefreshTask());
@@ -436,7 +436,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
* difference tree is being built. Clients may override this method to
* perform their own pre-processing. This default implementation does
* nothing.
- *
+ *
* @param ancestor the ancestor input to the differencing operation
* @param left the left input to the differencing operation
* @param right the right input to the differencing operation
@@ -448,7 +448,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) {
// we do nothing here
}
-
+
/**
* This method is called from within {@link #diff(IProgressMonitor)} before
* the difference tree is being built. This method may be called from a
@@ -458,7 +458,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
* {@link #preDiffHook(IStructureComparator, IStructureComparator, IStructureComparator)}
* from the UI thread. Clients should override this method even if they
* don't perform pre-processing to avoid the call to the UI thread.
- *
+ *
* @param ancestor the ancestor input to the differencing operation
* @param left the left input to the differencing operation
* @param right the right input to the differencing operation
@@ -482,22 +482,22 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void diff(IProgressMonitor monitor) {
try {
beginWork(monitor, 150);
-
+
IStructureComparator ancestorComparator = fAncestorStructure.getStructureComparator();
IStructureComparator leftComparator = fLeftStructure.getStructureComparator();
IStructureComparator rightComparator = fRightStructure.getStructureComparator();
-
- preDiffHook(ancestorComparator,
- leftComparator,
+
+ preDiffHook(ancestorComparator,
+ leftComparator,
rightComparator,
subMonitor(monitor, 25));
-
+
String message= null;
-
+
if ((fThreeWay && ancestorComparator == null) || leftComparator == null || rightComparator == null) {
// could not get structure of one (or more) of the legs
fRoot= null;
- message= CompareMessages.StructureDiffViewer_StructureError;
+ message= CompareMessages.StructureDiffViewer_StructureError;
} else { // calculate difference of the two (or three) structures
if (fDifferencer == null)
fDifferencer= new Differencer() {
@@ -515,17 +515,17 @@ public class StructureDiffViewer extends DiffTreeViewer {
return o;
}
};
-
+
fRoot= (IDiffContainer) fDifferencer.findDifferences(fThreeWay, subMonitor(monitor, 100), null,
ancestorComparator, leftComparator, rightComparator);
-
+
if (fRoot == null || fRoot.getChildren().length == 0) {
- message= CompareMessages.StructureDiffViewer_NoStructuralDifferences;
+ message= CompareMessages.StructureDiffViewer_NoStructuralDifferences;
} else {
postDiffHook(fDifferencer, fRoot, subMonitor(monitor, 25));
}
}
-
+
if (Display.getCurrent() != null) {
refreshAfterDiff(message);
} else {
@@ -547,12 +547,12 @@ public class StructureDiffViewer extends DiffTreeViewer {
return;
if (fParent != null)
fParent.setTitleArgument(message);
-
+
refresh(getRoot());
// Setting the auto-expand level doesn't do anything for refreshes
expandToLevel(3);
}
-
+
/**
* Runs the difference engine and refreshes the tree.
*/
@@ -579,7 +579,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
handleFailedRefresh(CompareMessages.StructureDiffViewer_3);
}
}
-
+
private void handleFailedRefresh(final String message) {
Runnable runnable = new Runnable() {
@Override
@@ -601,7 +601,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
* difference tree has been built. Clients may override this method to
* perform their own post-processing. This default implementation does
* nothing.
- *
+ *
* @param differencer the differencer used to perform the differencing
* @param root the non-<code>null</code> root node of the difference tree
* @since 2.0
@@ -613,7 +613,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
protected void postDiffHook(Differencer differencer, IDiffContainer root) {
// we do nothing here
}
-
+
/**
* This method is called from within {@link #diff(IProgressMonitor)} after
* the difference tree has been built. This method may be called from a
@@ -623,7 +623,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
* {@link #postDiffHook(Differencer, IDiffContainer)} from the UI thread.
* Clients should override this method even if they don't perform post
* processing to avoid the call to the UI thread.
- *
+ *
* @param differencer the differencer used to perform the differencing
* @param root the non-<code>null</code> root node of the difference tree
* @param monitor a progress monitor or <code>null</code> if progress is
@@ -638,7 +638,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
}
});
}
-
+
/*
* Performs a byte compare on the given objects.
* Called from the difference engine.
@@ -668,7 +668,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
}
return false;
}
-
+
/**
* Tracks property changes of the configuration object.
* Clients may override to track their own property changes.
@@ -702,7 +702,7 @@ public class StructureDiffViewer extends DiffTreeViewer {
super.propertyChange(event);
}
}
-
+
/**
* Overridden to call the <code>save</code> method on the structure creator after
* nodes have been copied from one side to the other side of an input object.
@@ -713,14 +713,14 @@ public class StructureDiffViewer extends DiffTreeViewer {
@Override
protected void copySelected(boolean leftToRight) {
super.copySelected(leftToRight);
-
+
if (fStructureCreator != null) {
fStructureCreator.save(
leftToRight ? fRightStructure.getStructureComparator() : fLeftStructure.getStructureComparator(),
leftToRight ? fRightStructure.getInput() : fLeftStructure.getInput());
}
}
-
+
private void syncExec(final Runnable runnable) {
if (getControl().isDisposed())
return;
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureRootNode.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureRootNode.java
index 57056b617..c2d773630 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureRootNode.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/structuremergeviewer/StructureRootNode.java
@@ -42,7 +42,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
* @see #getTypeCode()
*/
public static final int ROOT_TYPE = 0;
-
+
/**
* The string constant (value <code>"root"</code>) that is used as the id of the root node.
* @see #getId()
@@ -52,7 +52,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
private final Object fInput;
private final StructureCreator fCreator;
private ISharedDocumentAdapter fAdapter;
-
+
/**
* Create the structure root node.
* @param document the document
@@ -67,7 +67,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
fCreator = creator;
fAdapter = adapter;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.ui.services.IDisposable#dispose()
*/
@@ -94,7 +94,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
}
return super.getAdapter(adapter);
}
-
+
/**
* Override in order to invoke {@link IStructureCreator#save(IStructureComparator, Object)} when the
* contents of a node have changed.
@@ -104,7 +104,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
protected void nodeChanged(DocumentRangeNode node) {
fCreator.save(this, fInput);
}
-
+
@Override
public ITypedElement replace(ITypedElement child, ITypedElement other) {
// TODO: I believe the parent implementation is flawed but didn't to remove
@@ -136,7 +136,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
public String getType() {
return FOLDER_TYPE;
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode#isReadOnly()
*/
@@ -148,7 +148,7 @@ public class StructureRootNode extends DocumentRangeNode implements IDisposable,
}
return super.isReadOnly();
}
-
+
/* (non-Javadoc)
* @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode#validateEdit(org.eclipse.swt.widgets.Shell)
*/

Back to the top