You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(80) |
Oct
(12) |
Nov
(237) |
Dec
(210) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(344) |
Feb
(311) |
Mar
(239) |
Apr
(72) |
May
(8) |
Jun
|
Jul
(73) |
Aug
(88) |
Sep
(235) |
Oct
(111) |
Nov
(325) |
Dec
(220) |
| 2006 |
Jan
(108) |
Feb
(64) |
Mar
(381) |
Apr
(98) |
May
(38) |
Jun
(16) |
Jul
(34) |
Aug
(70) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2007 |
Jan
(22) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(12) |
| 2010 |
Jan
(49) |
Feb
(9) |
Mar
(2) |
Apr
(17) |
May
(10) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:27
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/icons/full/wizban In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/icons/full/wizban Added Files: applypatch_wizban.png Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: applypatch_wizban.png --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/schema In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/schema Added Files: streamMergers.exsd contentViewers.exsd contentMergeViewers.exsd structureCreators.exsd structureMergeViewers.exsd Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: structureMergeViewers.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.eclipse.compare"> <annotation> <appInfo> <meta.schema plugin="org.eclipse.compare" id="structureMergeViewers" name="StructureMerge Viewers"/> </appInfo> <documentation> This extension point allows a plug-in to register compare/merge viewers for structural content types. The viewer is expected to extend <samp>org.eclipse.jface.viewers.Viewer</samp>. However, since viewers don't have a default constructor, the extension point must implement the factory interface for viewers <samp>org.eclipse.compare.IViewerCreator</samp>. </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/> <element ref="contentTypeBinding" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> a fully qualified identifier of the target extension point </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> an optional identifier of the extension instance </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> an optional name of the extension instance </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="viewer"> <complexType> <attribute name="id" type="string" use="required"> <annotation> <documentation> a unique identifier that can be used to reference the viewer </documentation> </annotation> </attribute> <attribute name="class" type="string" use="required"> <annotation> <documentation> a fully qualified name of a class that implements a factory for the structure merge viewer and implements <samp>org.eclipse.compare.IViewerCreator</samp> </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/> </appInfo> </annotation> </attribute> <attribute name="extensions" type="string" use="required"> <annotation> <documentation> a comma separated list of file extensions e.g. "zip, jar" </documentation> </annotation> </attribute> </complexType> </element> <element name="contentTypeBinding"> <complexType> <attribute name="contentTypeId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="structureMergeViewerId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> The following is an example of compare/merge viewer for zip files (extension "zip"): <p> <pre> <extension point = "org.eclipse.compare.structureMergeViewers"> <viewer id="org.eclipse.compare.ZipCompareViewer" class="org.eclipse.compare.ZipCompareViewerCreator" extensions="zip" /> </extension> </pre> </p> </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> The contributed class must implement <code>org.eclipse.compare.IViewerCreator</code> </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> The Compare UI plugin defines a structure compare viewer for zip archives. </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> Copyright (c) 2000, 2004 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> </documentation> </annotation> </schema> --- NEW FILE: contentMergeViewers.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.eclipse.compare"> <annotation> <appInfo> <meta.schema plugin="org.eclipse.compare" id="contentMergeViewers" name="ContentMerge Viewers"/> </appInfo> <documentation> This extension point allows a plug-in to register compare/merge viewers for specific content types. The viewer is expected to extend <samp>org.eclipse.jface.viewers.Viewer</samp>. However, since viewers don't have a default constructor, the extension point must implement the factory interface for viewers <samp>org.eclipse.compare.IViewerCreator</samp>. </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/> <element ref="contentTypeBinding" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> a fully qualified identifier of the target extension point </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> an optional identifier of the extension instance </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> an optional name of the extension instance </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="viewer"> <complexType> <attribute name="id" type="string" use="required"> <annotation> <documentation> a unique identifier that can be used to reference the viewer </documentation> </annotation> </attribute> <attribute name="class" type="string" use="required"> <annotation> <documentation> a fully qualified name of a class that implements a factory for the content merge viewer and implements <samp>org.eclipse.compare.IViewerCreator</samp> </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/> </appInfo> </annotation> </attribute> <attribute name="extensions" type="string"> <annotation> <documentation> a comma separated list of file extensions e.g. "java, gif" </documentation> </annotation> </attribute> </complexType> </element> <element name="contentTypeBinding"> <complexType> <attribute name="contentTypeId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="contentMergeViewerId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> The following is an example of a compare/merge viewer for text files (extension "txt"): <p> <pre> <extension point = "org.eclipse.compare.contentMergeViewers"> <viewer id="org.eclipse.compare.contentmergeviewer.TextMergeViewer" class="org.eclipse.compare.internal.TextMergeViewerCreator" extensions="txt" /> </extension> </pre> </p> </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> The contributed class must implement <code>org.eclipse.compare.IViewerCreator</code> </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> The Compare UI plugin defines content viewers for text, binary contents, and images. </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> Copyright (c) 2000, 2004 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> </documentation> </annotation> </schema> --- NEW FILE: structureCreators.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.eclipse.compare"> <annotation> <appInfo> <meta.schema plugin="org.eclipse.compare" id="structureCreators" name="Structure Creators"/> </appInfo> <documentation> This extension point allows a plug-in to register a structure creator for specific content types. The structure creator is expected to create a tree of <samp>IStructureComparator</samp>s for a given content. This tree is used as the input for the structural compare. The extension point must implement the interface <samp>org.eclipse.compare.structuremergeviewer.IStructureCreator</samp>. </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="structureCreator" minOccurs="0" maxOccurs="unbounded"/> <element ref="contentTypeBinding" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> a fully qualified identifier of the target extension point </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> an optional identifier of the extension instance </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> an optional name of the extension instance </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="structureCreator"> <complexType> <attribute name="id" type="string" use="required"> <annotation> <documentation> a unique identifier that can be used to reference the structure creator </documentation> </annotation> </attribute> <attribute name="class" type="string" use="required"> <annotation> <documentation> a fully qualified name of a class that implements <samp>org.eclipse.compare.structuremergeviewer.IStructureCreator</samp> </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.eclipse.compare.structuremergeviewer.IStructureComparator"/> </appInfo> </annotation> </attribute> <attribute name="extensions" type="string"> <annotation> <documentation> a comma separated list of file extensions e.g. "java, properties" </documentation> </annotation> </attribute> </complexType> </element> <element name="contentTypeBinding"> <complexType> <attribute name="contentTypeId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="structureCreatorId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> The following is an example of a structure creator for java files (extension "java"): <p> <pre> <extension point = "org.eclipse.compare.structureCreators"> <structureCreator id="org.eclipse.compare.JavaStructureCreator" class="org.eclipse.compare.JavaStructureCreator" extensions="java" /> </extension> </pre> </p> </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> The contributed class must implement <code>org.eclipse.compare.structuremergeviewer.IStructureCreator</code> </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> The Compare UI plugin defines a structure creator for zip archives. </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> Copyright (c) 2000, 2004 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> </documentation> </annotation> </schema> --- NEW FILE: streamMergers.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.eclipse.compare"> <annotation> <appInfo> <meta.schema plugin="org.eclipse.compare" id="streamMergers" name="Stream Merger"/> </appInfo> <documentation> This extension point allows a plug-in to register a stream merger for specific content types. The stream merger is expected to perform a three-way merge on three input streams and writes the result to an output stream. The extension point must implement the interface <samp>org.eclipse.compare.IStreamMerger</samp>. </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="streamMerger" minOccurs="0" maxOccurs="unbounded"/> <element ref="contentTypeBinding" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> a fully qualified identifier of the target extension point </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> an optional identifier of the extension instance </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> an optional name of the extension instance </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="streamMerger"> <complexType> <attribute name="id" type="string" use="required"> <annotation> <documentation> a unique identifier that can be used to reference the stream merger </documentation> </annotation> </attribute> <attribute name="class" type="string" use="required"> <annotation> <documentation> a fully qualified name of a class that implements <samp>org.eclipse.compare.IStreamMerger</samp> </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.eclipse.compare.IStreamMerger"/> </appInfo> </annotation> </attribute> <attribute name="extensions" type="string"> <annotation> <documentation> a comma separated list of file extensions e.g. "java, properties" </documentation> </annotation> </attribute> </complexType> </element> <element name="contentTypeBinding"> <complexType> <attribute name="contentTypeId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="streamMergerId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="since"/> </appInfo> <documentation> 3.0 </documentation> </annotation> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> The following is an example of a stream merger for property files (extension "properties"): <p> <pre> <extension point = "org.eclipse.compare.streamMergers"> <streamMerger id="org.eclipse.compare.internal.merge.TextStreamMerger" class="org.eclipse.compare.internal.merge.TextStreamMerger" extensions="properties" /> </extension> </pre> </p> </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> The contributed class must implement <code>org.eclipse.compare.IStreamMerger</code> </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> The Compare UI plugin defines a stream merger for line oriented text files. </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> Copyright (c) 2000, 2004 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> </documentation> </annotation> </schema> --- NEW FILE: contentViewers.exsd --- <?xml version='1.0' encoding='UTF-8'?> <!-- Schema file written by PDE --> <schema targetNamespace="org.eclipse.compare"> <annotation> <appInfo> <meta.schema plugin="org.eclipse.compare" id="contentViewers" name="Content Viewers"/> </appInfo> <documentation> This extension point allows a plug-in to register viewers for specific content types. These viewers are used in the <samp>EditionSelectionDialog</samp> when presenting an edition of a resource or a subsection thereof. The viewer is expected to extend <samp>org.eclipse.jface.viewers.Viewer</samp>. However since viewers don't have a default constructor the extension point must implement the factory interface for viewers <samp>org.eclipse.compare.IViewerCreator</samp>. </documentation> </annotation> <element name="extension"> <complexType> <sequence> <element ref="viewer" minOccurs="0" maxOccurs="unbounded"/> <element ref="contentTypeBinding" minOccurs="0" maxOccurs="unbounded"/> </sequence> <attribute name="point" type="string" use="required"> <annotation> <documentation> a fully qualified identifier of the target extension point </documentation> </annotation> </attribute> <attribute name="id" type="string"> <annotation> <documentation> an optional identifier of the extension instance </documentation> </annotation> </attribute> <attribute name="name" type="string"> <annotation> <documentation> an optional name of the extension instance </documentation> <appInfo> <meta.attribute translatable="true"/> </appInfo> </annotation> </attribute> </complexType> </element> <element name="viewer"> <complexType> <attribute name="id" type="string" use="required"> <annotation> <documentation> a unique identifier that can be used to reference the viewer </documentation> </annotation> </attribute> <attribute name="class" type="string" use="required"> <annotation> <documentation> a fully qualified name of a class that implements a factory for the content viewer and implements <samp>org.eclipse.compare.IViewerCreator</samp> </documentation> <appInfo> <meta.attribute kind="java" basedOn="org.eclipse.jface.viewers.Viewer:org.eclipse.compare.IViewerCreator"/> </appInfo> </annotation> </attribute> <attribute name="extensions" type="string"> <annotation> <documentation> a comma separated list of file extensions e.g. "java, gif" </documentation> </annotation> </attribute> </complexType> </element> <element name="contentTypeBinding"> <complexType> <attribute name="contentTypeId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> <attribute name="contentViewerId" type="string" use="required"> <annotation> <documentation> </documentation> </annotation> </attribute> </complexType> </element> <annotation> <appInfo> <meta.section type="examples"/> </appInfo> <documentation> The following is an example of a viewer for text files (extension "txt"): <p> <pre> <extension point = "org.eclipse.compare.contentViewers"> <viewer id="org.eclipse.compare.internal.TextViewer" class="org.eclipse.compare.internal.TextViewerCreator" extensions="txt" /> </extension> </pre> </p> </documentation> </annotation> <annotation> <appInfo> <meta.section type="apiInfo"/> </appInfo> <documentation> The contributed class must implement <code>org.eclipse.compare.IViewerCreator</code> </documentation> </annotation> <annotation> <appInfo> <meta.section type="implementation"/> </appInfo> <documentation> The Compare UI plugin defines content viewers for text and images. </documentation> </annotation> <annotation> <appInfo> <meta.section type="copyright"/> </appInfo> <documentation> Copyright (c) 2000, 2004 IBM Corporation and others.<br> All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> </documentation> </annotation> </schema> |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:27
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/scripts Added Files: exportplugin.xml Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: exportplugin.xml --- <project name="org.eclipse.compare" default="export" basedir=".."> <target name="init"> <tstamp/> <property name="destdir" value="../../plugin-export" /> <property name="plugin" value="org.eclipse.compare" /> <property name="qualifier" value="zzz${DSTAMP}-${TSTAMP}" /> <property name="plugin_version" value="_3.2.0.${qualifier}" /> <property name="dest" value="${destdir}/${plugin}${plugin_version}" /> <property name="destjar" value="${destdir}/${plugin}${plugin_version}.jar" /> </target> <target name="build" depends="init"> <eclipse.incrementalBuild project="${plugin}" kind="incr"/> </target> <target name="export" depends="build"> <mkdir dir="${destdir}" /> <delete dir="${dest}" /> <mkdir dir="${dest}" /> <copy todir="${dest}/META-INF"> <fileset dir="META-INF" /> </copy> <replaceregexp file="${dest}/META-INF/MANIFEST.MF" match="Bundle-Version: ((\d)+\.(\d)+\.(\d)+\.)qualifier" replace="Bundle-Version: \1${qualifier}" byline="true" /> <delete file="${destjar}" /> <zip zipfile="${destjar}"> <fileset dir="."> <include name="plugin.xml" /> <include name="plugin.properties" /> <include name="icons/**" /> <include name=".options" /> <include name="schema/**" /> <include name="src/**" /> </fileset> <fileset dir="bin" /> <fileset dir="${dest}"> <include name="META-INF/**" /> </fileset> </zip> <delete dir="${dest}" /> </target> </project> |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:26
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/ui/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/ui/model Added Files: WorkbenchContentProvider.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: WorkbenchContentProvider.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.ui.model; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IResourceChangeListener; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IWorkspace; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.widgets.Control; /** * Tree content provider for resource objects that can be adapted to the * interface {@link org.eclipse.ui.model.IWorkbenchAdapter IWorkbenchAdapter}. * This provider will listen for resource changes within the workspace and * update the viewer as necessary. * <p> * This class may be instantiated, or subclassed by clients. * </p> */ public class WorkbenchContentProvider extends BaseWorkbenchContentProvider implements IResourceChangeListener { private Viewer viewer; /** * Creates the resource content provider. */ public WorkbenchContentProvider() { super(); } /* * (non-Javadoc) Method declared on IContentProvider. */ public void dispose() { if (viewer != null) { IWorkspace workspace = null; Object obj = viewer.getInput(); if (obj instanceof IWorkspace) { workspace = (IWorkspace) obj; } else if (obj instanceof IContainer) { workspace = ((IContainer) obj).getWorkspace(); } if (workspace != null) { workspace.removeResourceChangeListener(this); } } super.dispose(); } /* * (non-Javadoc) Method declared on IContentProvider. */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { super.inputChanged(viewer, oldInput, newInput); this.viewer = viewer; IWorkspace oldWorkspace = null; IWorkspace newWorkspace = null; if (oldInput instanceof IWorkspace) { oldWorkspace = (IWorkspace) oldInput; } else if (oldInput instanceof IContainer) { oldWorkspace = ((IContainer) oldInput).getWorkspace(); } if (newInput instanceof IWorkspace) { newWorkspace = (IWorkspace) newInput; } else if (newInput instanceof IContainer) { newWorkspace = ((IContainer) newInput).getWorkspace(); } if (oldWorkspace != newWorkspace) { if (oldWorkspace != null) { oldWorkspace.removeResourceChangeListener(this); } if (newWorkspace != null) { newWorkspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE); } } } /* * (non-Javadoc) Method declared on IResourceChangeListener. */ public final void resourceChanged(final IResourceChangeEvent event) { processDelta(event.getDelta()); } /** * Process the resource delta. * * @param delta */ protected void processDelta(IResourceDelta delta) { Control ctrl = viewer.getControl(); if (ctrl == null || ctrl.isDisposed()) return; final Collection runnables = new ArrayList(); processDelta(delta, runnables); if (runnables.isEmpty()) return; //Are we in the UIThread? If so spin it until we are done if (ctrl.getDisplay().getThread() == Thread.currentThread()) { runUpdates(runnables); } else { ctrl.getDisplay().asyncExec(new Runnable(){ /* (non-Javadoc) * @see java.lang.Runnable#run() */ public void run() { //Abort if this happens after disposes Control ctrl = viewer.getControl(); if (ctrl == null || ctrl.isDisposed()) return; runUpdates(runnables); } }); } } /** * Run all of the runnables that are the widget updates * @param runnables */ private void runUpdates(Collection runnables) { Iterator runnableIterator = runnables.iterator(); while(runnableIterator.hasNext()){ ((Runnable)runnableIterator.next()).run(); } } /** * Process a resource delta. Add any runnables */ private void processDelta(IResourceDelta delta, Collection runnables) { //he widget may have been destroyed // by the time this is run. Check for this and do nothing if so. Control ctrl = viewer.getControl(); if (ctrl == null || ctrl.isDisposed()) return; // Get the affected resource final IResource resource = delta.getResource(); // If any children have changed type, just do a full refresh of this // parent, // since a simple update on such children won't work, // and trying to map the change to a remove and add is too dicey. // The case is: folder A renamed to existing file B, answering yes to // overwrite B. IResourceDelta[] affectedChildren = delta .getAffectedChildren(IResourceDelta.CHANGED); for (int i = 0; i < affectedChildren.length; i++) { if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) { runnables.add(getRefreshRunnable(resource)); return; } } // Opening a project just affects icon, but we need to refresh when // a project is closed because if child items have not yet been created // in the tree we still need to update the item's children int changeFlags = delta.getFlags(); if ((changeFlags & IResourceDelta.OPEN) != 0) { if (resource.isAccessible()) { runnables.add(getUpdateRunnable(resource)); } else { runnables.add(getRefreshRunnable(resource)); return; } } // Check the flags for changes the Navigator cares about. // See ResourceLabelProvider for the aspects it cares about. // Notice we don't care about F_CONTENT or F_MARKERS currently. if ((changeFlags & (IResourceDelta.SYNC | IResourceDelta.TYPE | IResourceDelta.DESCRIPTION)) != 0) { runnables.add(getUpdateRunnable(resource)); } // Replacing a resource may affect its label and its children if ((changeFlags & IResourceDelta.REPLACED) != 0) { runnables.add(getRefreshRunnable(resource)); return; } // Handle changed children . for (int i = 0; i < affectedChildren.length; i++) { processDelta(affectedChildren[i], runnables); } // @issue several problems here: // - should process removals before additions, to avoid multiple equal // elements in viewer // - Kim: processing removals before additions was the indirect cause of // 44081 and its varients // - Nick: no delta should have an add and a remove on the same element, // so processing adds first is probably OK // - using setRedraw will cause extra flashiness // - setRedraw is used even for simple changes // - to avoid seeing a rename in two stages, should turn redraw on/off // around combined removal and addition // - Kim: done, and only in the case of a rename (both remove and add // changes in one delta). IResourceDelta[] addedChildren = delta .getAffectedChildren(IResourceDelta.ADDED); IResourceDelta[] removedChildren = delta .getAffectedChildren(IResourceDelta.REMOVED); if (addedChildren.length == 0 && removedChildren.length == 0) return; final Object[] addedObjects; final Object[] removedObjects; // Process additions before removals as to not cause selection // preservation prior to new objects being added // Handle added children. Issue one update for all insertions. int numMovedFrom = 0; int numMovedTo = 0; if (addedChildren.length > 0) { addedObjects = new Object[addedChildren.length]; for (int i = 0; i < addedChildren.length; i++) { addedObjects[i] = addedChildren[i].getResource(); if ((addedChildren[i].getFlags() & IResourceDelta.MOVED_FROM) != 0) { ++numMovedFrom; } } } else addedObjects = new Object[0]; // Handle removed children. Issue one update for all removals. if (removedChildren.length > 0) { removedObjects = new Object[removedChildren.length]; for (int i = 0; i < removedChildren.length; i++) { removedObjects[i] = removedChildren[i].getResource(); if ((removedChildren[i].getFlags() & IResourceDelta.MOVED_TO) != 0) { ++numMovedTo; } } } else { removedObjects = new Object[0]; } // heuristic test for items moving within same folder (i.e. renames) final boolean hasRename = numMovedFrom > 0 && numMovedTo > 0; Runnable addAndRemove = new Runnable(){ public void run() { if (viewer instanceof AbstractTreeViewer) { AbstractTreeViewer treeViewer = (AbstractTreeViewer) viewer; // Disable redraw until the operation is finished so we don't // get a flash of both the new and old item (in the case of // rename) // Only do this if we're both adding and removing files (the // rename case) if (hasRename) { treeViewer.getControl().setRedraw(false); } try { if (addedObjects.length > 0) treeViewer.add(resource, addedObjects); if (removedObjects.length > 0) treeViewer.remove(removedObjects); } finally { if (hasRename) { treeViewer.getControl().setRedraw(true); } } } else { ((StructuredViewer) viewer).refresh(resource); } } }; runnables.add(addAndRemove); } /** * Return a runnable for refreshing a resource. * @param resource * @return Runnable */ private Runnable getRefreshRunnable(final IResource resource) { return new Runnable(){ public void run() { ((StructuredViewer) viewer).refresh(resource); } }; } /** * Return a runnable for refreshing a resource. * @param resource * @return Runnable */ private Runnable getUpdateRunnable(final IResource resource) { return new Runnable(){ public void run() { ((StructuredViewer) viewer).update(resource, null); } }; } } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:26
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/icons/full/dlcl16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/icons/full/dlcl16 Added Files: copycont_r_co.gif ancestorpane_co.gif syncpane_co.gif prev_nav.gif twowaycompare_co.gif copy_r_co.gif copy_l_co.gif smartmode_co.gif copycont_l_co.gif next_nav.gif Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: copy_r_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: copy_l_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: copycont_r_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: prev_nav.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: smartmode_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: next_nav.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: syncpane_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ancestorpane_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: copycont_l_co.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: twowaycompare_co.gif --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/structuremergeviewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/structuremergeviewer Added Files: DiffTreeViewer.java ICompareInputChangeListener.java Differencer.java DiffTreeViewerResources.properties ICompareInput.java package.html IDiffElement.java IStructureComparator.java IStructureCreator.java DiffElement.java DiffNode.java DocumentRangeNode.java StructureDiffViewer.java DiffContainer.java IDiffContainer.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: ICompareInput.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.structuremergeviewer; import org.eclipse.compare.ITypedElement; import org.eclipse.swt.graphics.Image; /** * Interface for objects used as input to a two-way or three-way compare viewer. * It defines API for accessing the three sides for the compare, * and a name and image which is used when displaying the three way input * in the UI, for example, in a title bar. * <p> * Note: at most two sides of an <code>ICompareInput</code> can be <code>null</code>, * (as it is normal for additions or deletions) but not all three. * <p> * <code>ICompareInput</code> provides methods for registering * <code>ICompareInputChangeListener</code>s * that get informed if one (or more) * of the three sides of an <code>ICompareInput</code> object changes its value. * <p> * For example when accepting an incoming addition * 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. * <p> * Clients can implement this interface, or use the convenience implementation * <code>DiffNode</code>. * </p> * * @see StructureDiffViewer * @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer * @see DiffNode */ public interface ICompareInput { /** * Returns name of input. * This name is displayed when this input is shown in a viewer. * In many cases this name is the name of one of the non-<code>null</code> sides or a combination * thereof. * * @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. * In many cases this image is the image of one of the non-<code>null</code> sides. * * @return image representing this input, or <code>null</code> if no icon should be shown */ Image getImage(); /** * Returns the kind of difference between the * three sides ancestor, left and right. * This field is only meaningful if the <code>ICompareInput</code> * is the result of another compare. In this case it is used * together with <code>getImage</code> to compose a icon * which reflects the kind of difference between the two or three elements. * * @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 * or in the two-way compare case. * * @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). * * @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). * * @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. * * @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. * * @param listener the listener to unregister */ void removeCompareInputChangeListener(ICompareInputChangeListener listener); /** * 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. * <p> * The implementation should handle the following cases: * <UL> * <LI> * if the source side is <code>null</code> the destination must be deleted, * <LI> * if the destination is <code>null</code> the destination must be created * and filled with the contents from the source, * <LI> * if both sides are non-<code>null</code> the contents of source must be copied to destination. * </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 */ void copy(boolean leftToRight); } --- NEW FILE: DiffContainer.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.structuremergeviewer; import java.util.ArrayList; /** * The standard implementation of a diff container element. * <p> * This class may be instantiated, or further subclassed. * </p> */ public abstract class DiffContainer extends DiffElement implements IDiffContainer { private static IDiffElement[] fgEmptyArray= new IDiffElement[0]; private ArrayList fChildren; /** * 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>). */ 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 */ public IDiffElement findChild(String name) { Object[] children= getChildren(); for (int i= 0; i < children.length; i++) { IDiffElement child= (IDiffElement) children[i]; if (name.equals(child.getName())) return child; } return null; } /* (non Javadoc) * see IDiffContainer.add */ public void add(IDiffElement diff) { if (fChildren == null) fChildren= new ArrayList(); fChildren.add(diff); diff.setParent(this); } /* * Removes the given child from this container. * If the container becomes empty it is removed from its container. */ public void removeToRoot(IDiffElement child) { if (fChildren != null) { fChildren.remove(child); child.setParent(null); if (fChildren.size() == 0) { IDiffContainer p= getParent(); if (p != null) p.removeToRoot(this); } } } /** * Removes the given child (non-recursively) from this container. * * @param child to remove */ public void remove(IDiffElement child) { if (fChildren != null) { fChildren.remove(child); child.setParent(null); } } /* (non Javadoc) * see IDiffContainer.hasChildren */ public boolean hasChildren() { return fChildren != null && fChildren.size() > 0; } /* (non Javadoc) * see IDiffContainer.getChildren */ public IDiffElement[] getChildren() { if (fChildren != null) return (IDiffElement[]) fChildren.toArray(fgEmptyArray); return fgEmptyArray; } } --- NEW FILE: StructureDiffViewer.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.structuremergeviewer; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.widgets.*; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.compare.*; import org.eclipse.compare.internal.*; /** * A diff tree viewer that can be configured with a <code>IStructureCreator</code> * to retrieve a hierarchical structure from the input object (an <code>ICompareInput</code>) * and perform a two-way or three-way compare on it. * <p> * This class may be instantiated; it is not intended to be subclassed outside * this package. * </p> * * @see IStructureCreator * @see ICompareInput */ public class StructureDiffViewer extends DiffTreeViewer { private Differencer fDifferencer; private boolean fThreeWay= false; private ITypedElement fAncestorInput; private ITypedElement fLeftInput; private ITypedElement fRightInput; private IStructureComparator fAncestorStructure; private IStructureComparator fLeftStructure; private IStructureComparator fRightStructure; private IStructureCreator fStructureCreator; private IDiffContainer fRoot; private IContentChangeListener fContentChangedListener; private CompareViewerSwitchingPane fParent; /** * Creates a new viewer for the given SWT tree control with the specified configuration. * * @param tree the tree control * @param configuration the configuration for this viewer */ public StructureDiffViewer(Tree tree, CompareConfiguration configuration) { super(tree, configuration); Composite c= tree.getParent(); if (c instanceof CompareViewerSwitchingPane) fParent= (CompareViewerSwitchingPane) c; initialize(); } /** * Creates a new viewer under the given SWT parent with the specified configuration. * * @param parent the SWT control under which to create the viewer * @param configuration the configuration for this viewer */ public StructureDiffViewer(Composite parent, CompareConfiguration configuration) { super(parent, configuration); if (parent instanceof CompareViewerSwitchingPane) fParent= (CompareViewerSwitchingPane) parent; initialize(); } private void initialize() { setAutoExpandLevel(3); fContentChangedListener= new IContentChangeListener() { public void contentChanged(IContentChangeNotifier changed) { StructureDiffViewer.this.contentChanged(changed); } }; new ICompareInputChangeListener() { public void compareInputChanged(ICompareInput input) { StructureDiffViewer.this.compareInputChanged(input); } }; } /** * Configures the <code>StructureDiffViewer</code> with a structure creator. * The structure creator is used to create a hierarchical structure * for each side of the viewer's input element of type <code>ICompareInput</code>. * * @param structureCreator the new structure creator */ public void setStructureCreator(IStructureCreator structureCreator) { if (fStructureCreator != structureCreator) { fStructureCreator= structureCreator; Control tree= getControl(); if (tree != null && !tree.isDisposed()) 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>. * * @return the structure creator or <code>null</code> */ public IStructureCreator getStructureCreator() { return fStructureCreator; } /** * Reimplemented to get the descriptive title for this viewer from the <code>IStructureCreator</code>. * @return the viewer's name */ public String getTitle() { if (fStructureCreator != null) 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> */ protected Object getRoot() { return fRoot; } /* * (non-Javadoc) Method declared on StructuredViewer. * Overridden to create the comparable structures from the input object * and to feed them through the differencing engine. Note: for this viewer * the value from <code>getInput</code> is not identical to <code>getRoot</code>. */ protected void inputChanged(Object input, Object oldInput) { if (input instanceof ICompareInput) { compareInputChanged((ICompareInput) input); if (input != oldInput) initialSelection(); } } protected void initialSelection() { expandToLevel(2); } /* (non Javadoc) * Overridden to unregister all listeners. */ protected void handleDispose(DisposeEvent event) { compareInputChanged(null); fContentChangedListener= null; super.handleDispose(event); } /** * Recreates the comparable structures for the input sides. * @param input this viewer's new input */ protected void compareInputChanged(ICompareInput input) { ITypedElement t= null; boolean changed= false; if (input != null) t= input.getAncestor(); fThreeWay= (t != null); if (t != fAncestorInput) { if (fAncestorInput instanceof IContentChangeNotifier) ((IContentChangeNotifier)fAncestorInput).removeContentChangeListener(fContentChangedListener); fAncestorInput= t; if (fAncestorInput != null) { fAncestorStructure= fStructureCreator.getStructure(fAncestorInput); changed= true; } else fAncestorStructure= null; if (fAncestorInput instanceof IContentChangeNotifier) ((IContentChangeNotifier)fAncestorInput).addContentChangeListener(fContentChangedListener); } if (input != null) t= input.getLeft(); if (t != fLeftInput) { if (fLeftInput instanceof IContentChangeNotifier) ((IContentChangeNotifier)fLeftInput).removeContentChangeListener(fContentChangedListener); fLeftInput= t; if (fLeftInput != null) { fLeftStructure= fStructureCreator.getStructure(fLeftInput); changed= true; } else fLeftStructure= null; if (fLeftInput instanceof IContentChangeNotifier) ((IContentChangeNotifier)fLeftInput).addContentChangeListener(fContentChangedListener); } if (input != null) t= input.getRight(); if (t != fRightInput) { if (fRightInput instanceof IContentChangeNotifier) ((IContentChangeNotifier)fRightInput).removeContentChangeListener(fContentChangedListener); fRightInput= t; if (fRightInput != null) { fRightStructure= fStructureCreator.getStructure(fRightInput); changed= true; } else fRightStructure= null; if (fRightInput instanceof IContentChangeNotifier) ((IContentChangeNotifier)fRightInput).addContentChangeListener(fContentChangedListener); } if (changed) diff(); } /** * Calls <code>diff</code> whenever the byte contents changes. * @param changed the object that sent out the notification */ protected void contentChanged(IContentChangeNotifier changed) { if (fStructureCreator == null) return; if (changed != null) { if (changed == fAncestorInput) { fAncestorStructure= fStructureCreator.getStructure(fAncestorInput); } else if (changed == fLeftInput) { fLeftStructure= fStructureCreator.getStructure(fLeftInput); } else if (changed == fRightInput) { fRightStructure= fStructureCreator.getStructure(fRightInput); } else return; } else { fAncestorStructure= fStructureCreator.getStructure(fAncestorInput); fLeftStructure= fStructureCreator.getStructure(fLeftInput); fRightStructure= fStructureCreator.getStructure(fRightInput); } diff(); } /** * This method is called from within <code>diff()</code> before the 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 * @since 2.0 */ protected void preDiffHook(IStructureComparator ancestor, IStructureComparator left, IStructureComparator right) { // we do nothing here } /** * Runs the difference engine and refreshes the tree. */ protected void diff() { preDiffHook(fAncestorStructure, fLeftStructure, fRightStructure); String message= null; if ((fThreeWay && fAncestorStructure == null) || fLeftStructure == null || fRightStructure == null) { // could not get structure of one (or more) of the legs fRoot= null; message= CompareMessages.StructureDiffViewer_StructureError; } else { // calculate difference of the two (or three) structures if (fDifferencer == null) fDifferencer= new Differencer() { protected boolean contentsEqual(Object o1, Object o2) { return StructureDiffViewer.this.contentsEqual(o1, o2); } protected Object visit(Object data, int result, Object ancestor, Object left, Object right) { Object o= super.visit(data, result, ancestor, left, right); if (fLeftIsLocal && o instanceof DiffNode) ((DiffNode)o).swapSides(fLeftIsLocal); return o; } }; fRoot= (IDiffContainer) fDifferencer.findDifferences(fThreeWay, null, null, fAncestorStructure, fLeftStructure, fRightStructure); if (fRoot == null || fRoot.getChildren().length == 0) { message= CompareMessages.StructureDiffViewer_NoStructuralDifferences; } else { postDiffHook(fDifferencer, fRoot); } } if (fParent != null) fParent.setTitleArgument(message); refresh(getRoot()); } /** * This method is called from within <code>diff()</code> after the 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 */ protected void postDiffHook(Differencer differencer, IDiffContainer root) { // we do nothing here } /* * Performs a byte compare on the given objects. * Called from the difference engine. * Returns <code>null</code> if no structure creator has been set. */ private boolean contentsEqual(Object o1, Object o2) { if (fStructureCreator != null) { boolean ignoreWhiteSpace= Utilities.getBoolean(getCompareConfiguration(), CompareConfiguration.IGNORE_WHITESPACE, false); String s1= fStructureCreator.getContents(o1, ignoreWhiteSpace); String s2= fStructureCreator.getContents(o2, ignoreWhiteSpace); if (s1 == null || s2 == null) return false; return s1.equals(s2); } return false; } /** * Tracks property changes of the configuration object. * Clients may override to track their own property changes. * In this case they must call the inherited method. * @param event the property changed event that triggered the call to this method */ protected void propertyChange(PropertyChangeEvent event) { String key= event.getProperty(); if (key.equals(CompareConfiguration.IGNORE_WHITESPACE)) diff(); else 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. * * @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 */ protected void copySelected(boolean leftToRight) { super.copySelected(leftToRight); if (fStructureCreator != null) fStructureCreator.save( leftToRight ? fRightStructure : fLeftStructure, leftToRight ? fRightInput : fLeftInput); } } --- NEW FILE: DiffElement.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.structuremergeviewer; import org.eclipse.swt.graphics.Image; import org.eclipse.compare.ITypedElement; /** * An abstract base implementation of the <code>IDiffElement</code> interface. * <p> * Subclasses may add behavior and state, and may override <code>getImage</code> * and <code>getType</code> to suit. * </p> */ public abstract class DiffElement implements IDiffElement { private int fKind; private IDiffContainer fParent; /** * Creates a new <code>DiffElement</code> as a child of the given parent. * If parent is not <code>null</code> the new element is added to the parent. * * @param parent the parent of this child; if not <code>null</code> this element is automatically added as a child * @param kind the kind of change */ public DiffElement(IDiffContainer parent, int kind) { fParent= parent; fKind= kind; if (parent != null) parent.add(this); } /** * The <code>DiffElement</code> implementation of this <code>ITypedInput</code> * method returns <code>null</code>. Subclasses may re-implement to provide * an image for this element. * @return <code>null</code>. */ public Image getImage() { return null; } /** * The <code>DiffElement</code> implementation of this <code>ITypedElement</code> * method returns <code>ITypedElement.UNKNOWN_TYPE</code>. Subclasses may * re-implement to provide a type for this element. * @return <code>ITypedElement.UNKNOWN_TYPE</code>. */ public String getType() { return ITypedElement.UNKNOWN_TYPE; } /** * Sets the kind of difference for this element. * * @param kind set the kind of difference this element represents * @see Differencer */ public void setKind(int kind) { fKind= kind; } /* (non Javadoc) * see IDiffElement.getKind */ public int getKind() { return fKind; } /* (non Javadoc) * see IDiffElement.getParent */ public IDiffContainer getParent() { return fParent; } /* (non Javadoc) * see IDiffElement.setParent */ public void setParent(IDiffContainer parent) { fParent= parent; } } --- NEW FILE: IStructureComparator.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ 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 * wrappers the objects to be compared. * * @see org.eclipse.compare.ResourceNode * @see Differencer */ public interface IStructureComparator { /** * Returns an iterator for all children of this object or <code>null</code> * if there are no children. * * @return an array with all children of this object, or an empty array if there are no children */ Object[] getChildren(); /** * 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 * method body might differ). * * @param other the reference object with which to compare * @return <code>true</code> if this object is the same as the other argument; <code>false</code> otherwise * @see java.lang.Object#equals */ boolean equals(Object other); } --- NEW FILE: DocumentRangeNode.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.structuremergeviewer; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.ArrayList; import org.eclipse.jface.text.*; import org.eclipse.core.runtime.CoreException; import org.eclipse.compare.*; import org.eclipse.compare.internal.Utilities; import org.eclipse.compare.contentmergeviewer.IDocumentRange; /** * A document range node represents a structural element * when performing a structure compare of documents. * <code>DocumentRangeNodes</code> are created while parsing the document and represent * a semantic entity (e.g. a Java class or method). * As a consequence of the parsing a <code>DocumentRangeNode</code> maps to a range * of characters in the document. * <p> * Since a <code>DocumentRangeNode</code> implements the <code>IStructureComparator</code> * and <code>IStreamContentAccessor</code> interfaces it can be used as input to the * differencing engine. This makes it possible to perform * a structural diff on a document and have the nodes and leaves of the compare easily map * to character ranges within the document. * <p> * Subclasses may add additional state collected while parsing the document. * </p> * @see Differencer */ public class DocumentRangeNode implements IDocumentRange, IStructureComparator, IEditableContent, IEncodedStreamContentAccessor { private static final boolean POS_UPDATE= true; 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; private String fID; private Position fAppendPosition; // a position where to insert a child textually private ArrayList fChildren; /** * 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 * on two nodes if their IDs are equal. * * @param typeCode a type code for this node * @param id an identifier for this node * @param document document on which this node is based on * @param start start position of range within document * @param length length of range */ public DocumentRangeNode(int typeCode, String id, IDocument document, int start, int length) { fTypeCode= typeCode; fID= id; fBaseDocument= document; fBaseDocument.addPositionCategory(RANGE_CATEGORY); fRange= new Position(start, length); if (POS_UPDATE) { try { document.addPosition(RANGE_CATEGORY, fRange); } catch (BadPositionCategoryException ex) { // silently ignored } catch (BadLocationException ex) { // silently ignored } } } /* (non Javadoc) * see IDocumentRange.getDocument */ public IDocument getDocument() { return fBaseDocument; } /* (non Javadoc) * see IDocumentRange.getRange */ 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. * * @return the type code of this node */ public int getTypeCode() { return fTypeCode; } /** * Returns this node's id. * It is used in <code>equals</code> and <code>hashcode</code>. * * @return the node's id */ public String getId() { return fID; } /** * Sets this node's id. * It is used in <code>equals</code> and <code>hashcode</code>. * * @param id the new id for this node */ public void setId(String id) { fID= id; } /** * Adds the given node as a child. * * @param node the node to add as a child */ public void addChild(DocumentRangeNode node) { if (fChildren == null) fChildren= new ArrayList(); fChildren.add(node); } /* (non Javadoc) * see IStructureComparator.getChildren */ public Object[] getChildren() { if (fChildren != null) return fChildren.toArray(); return new Object[0]; } /** * Sets the length of the range of this node. * * @param length the length of the range */ public void setLength(int length) { getRange().setLength(length); } /** * Sets a position within the document range that can be used to (legally) insert * text without breaking the syntax of the document. * <p> * E.g. when parsing a Java document the "append position" of a <code>DocumentRangeNode</code> * representing a Java class could be the character position just before the closing bracket. * Inserting the text of a new method there would not disturb the syntax of the class. * * @param pos the character position within the underlying document where text can be legally inserted */ public void setAppendPosition(int pos) { if (POS_UPDATE) { fBaseDocument.removePosition(fAppendPosition); try { Position p= new Position(pos); fBaseDocument.addPosition(RANGE_CATEGORY, p); fAppendPosition= p; } catch (BadPositionCategoryException ex) { // silently ignored } catch (BadLocationException ex) { // silently ignored } } else { fAppendPosition= new Position(pos); } } /** * Returns the position that has been set with <code>setAppendPosition</code>. * If <code>setAppendPosition</code> hasn't been called, the position after the last character * of this range is returned. * * @return a position where text can be legally inserted */ public Position getAppendPosition() { if (fAppendPosition == null) { if (POS_UPDATE) { try { Position p= new Position(fBaseDocument.getLength()); fBaseDocument.addPosition(RANGE_CATEGORY, p); fAppendPosition= p; } catch (BadPositionCategoryException ex) { // silently ignored } catch (BadLocationException ex) { // silently ignored } } else { fAppendPosition= new Position(fBaseDocument.getLength()); } } return fAppendPosition; } /** * Implementation based on <code>getID</code>. * @param other the object to compare this <code>DocumentRangeNode</code> against. * @return <code>true</code> if the <code>DocumentRangeNodes</code>are equal; <code>false</code> otherwise. */ public boolean equals(Object other) { if (other != null && other.getClass() == getClass()) { DocumentRangeNode tn= (DocumentRangeNode) other; return fTypeCode == tn.fTypeCode && fID.equals(tn.fID); } return super.equals(other); } /** * Implementation based on <code>getID</code>. * @return a hash code for this object. */ public int hashCode() { return fID.hashCode(); } /* * Find corresponding position */ private Position findCorrespondingPosition(DocumentRangeNode otherParent, DocumentRangeNode child) { // we try to find a predecessor of left Node which exists on the right side if (child != null && fChildren != null) { int ix= otherParent.fChildren.indexOf(child); if (ix >= 0) { for (int i= ix - 1; i >= 0; i--) { DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i); int i2= fChildren.indexOf(c1); if (i2 >= 0) { DocumentRangeNode c= (DocumentRangeNode) fChildren.get(i2); //System.out.println(" found corresponding: " + i2 + " " + c); Position p= c.fRange; //try { Position po= new Position(p.getOffset() + p.getLength() + 1, 0); //c.fBaseDocument.addPosition(RANGE_CATEGORY, po); return po; //} catch (BadLocationException ex) { //} //break; } } for (int i= ix; i < otherParent.fChildren.size(); i++) { DocumentRangeNode c1= (DocumentRangeNode) otherParent.fChildren.get(i); int i2= fChildren.indexOf(c1); if (i2 >= 0) { DocumentRangeNode c= (DocumentRangeNode) fChildren.get(i2); //System.out.println(" found corresponding: " + i2 + " " + c); Position p= c.fRange; //try { Position po= new Position(p.getOffset(), 0); //c.fBaseDocument.addPosition(RANGE_CATEGORY, po); return po; //} catch (BadLocationException ex) { //} //break; } } } } return getAppendPosition(); } private void add(String s, DocumentRangeNode parent, DocumentRangeNode child) { Position p= findCorrespondingPosition(parent, child); if (p != null) { try { fBaseDocument.replace(p.getOffset(), p.getLength(), s); } catch (BadLocationException ex) { // silently ignored } } } /* (non Javadoc) * see IStreamContentAccessor.getContents */ public InputStream getContents() { String s; try { s= fBaseDocument.get(fRange.getOffset(), fRange.getLength()); } catch (BadLocationException ex) { s= ""; //$NON-NLS-1$ } return new ByteArrayInputStream(Utilities.getBytes(s, UTF_16)); } /* (non Javadoc) * see IEditableContent.isEditable */ public boolean isEditable() { return true; } /* (non Javadoc) * see IEditableContent.replace */ public ITypedElement replace(ITypedElement child, ITypedElement other) { DocumentRangeNode src= null; String srcContents= ""; //$NON-NLS-1$ if (other != null) { src= (DocumentRangeNode) child; if (other instanceof IStreamContentAccessor) { try { srcContents= Utilities.readString((IStreamContentAccessor)other); } catch(CoreException ex) { // NeedWork } } } if (child == null) // no destination: we have to add the contents into the parent add(srcContents, null, src); return child; } /* (non Javadoc) * see IEditableContent.setContent */ public void setContent(byte[] content) { // empty default implementation } /* (non-Javadoc) * @see org.eclipse.compare.IStreamContentAccessor#getEncoding() */ public String getCharset() { return UTF_16; } } --- NEW FILE: package.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="IBM"> <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]"> <title>Package-level Javadoc</title> </head> <body> Provides support for finding and displaying the differences between hierarchically structured data. <h2> Package Specification</h2> The class <b>Differencer</b> is a differencing engine for hierarchically structured data. It takes two or three inputs and performs a two-way or three-way compare on them. <p> If the input elements to the differencing engine implement the <b>IStructureComparator</b> interface the engine recursively applies itself to the children of the input element. Leaf elements must implement the <b>org.eclipse.compare.IStreamContentAccessor</b> interface so that the differencer can perform a bytewise comparison on their contents. <p> One good example for this is <b>org.eclipse.compare.ResourceNode</b> which implements both interfaces (and more) for Eclipse workspace resources (org.eclipse.core.resources.IResource). <p> Another example is the <b>DocumentRangeNode</b> which can be used to compare hierarchical structures that are superimposed on a document, that is where nodes and leafs correspond to ranges in a document (<b>org.eclipse.compare.contentmergeviewer.IDocumentRange</b>). <br> Typically <b>DocumentRangeNode</b>s are created while parsing a document and they represent the semantic entities of the document (e.g. a Java class, method or field). The two subclasses <b>JavaNode</b> (in org.eclipse.jdt.internal.ui.compare) and <b>PropertyNode</b> (in org.eclipse.jdt.internal.ui.compare) are good examples for this. <p> By default the differencing engine returns the result of the compare operation as a tree of <b>DiffNode</b> objects. However, this can be changed by overriding a single method of the engine. <p> Every <b>DiffNode</b> describes the changes among the two or three inputs. <p> A tree of <b>DiffNodes</b> can be displayed in a <b>DiffTreeViewer</b>. The <b>DiffTreeViewer</b> requires that inner nodes of the tree implement the <b>IDiffContainer</b> interface and leafs the <b>IDiffElement</b> interface. <p> The typical steps to compare hierarchically structured data and to display the differences would be to: <ul> <li> map the input data into a tree of <b>IStructureComparator</b> and <b>IStreamContentAccessor</b>s,</li> <li> perform the compare operation by means of the <b>Differencer</b>, and</li> <li> feed the differencing result into the <b>DiffTreeViewer</b>.</li> </ul> The <b>StructureDiffViewer</b> is a specialized <b>DiffTreeViewer</b> that automates the three steps from above. It takes a single input object of type <b>ICompareInput</b> from which it retrieves the two or three input elements to compare. Then it uses a <b>IStructureCreator</b> to extract a tree of <b>IStructureComparator</b> and <b>IStreamContentAccessor</b> from them. These trees are then compared with the differencing engine and the result is displayed in the tree viewer. <p> </body> </html> --- NEW FILE: DiffTreeViewer.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.structuremergeviewer; import java.util.Iterator; import java.util.ResourceBundle; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.*; import org.eclipse.jface.util.*; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.compare.internal.*; import org.eclipse.compare.*; /** * A tree viewer that works on objects implementing * the <code>IDiffContainer</code> and <code>IDiffElement</code> interfaces. * <p> * This class may be instantiated; it is not intended to be subclassed outside * this package. * </p> * * @see IDiffContainer * @see IDiffElement */ public class DiffTreeViewer extends TreeViewer { static class DiffViewerSorter extends ViewerSorter { public boolean isSorterProperty(Object element, Object property) { return false; } public int category(Object node) { if (node instanceof DiffNode) { Object o= ((DiffNode) node).getId(); if (o instanceof DocumentRangeNode) return ((DocumentRangeNode) o).getTypeCode(); } return 0; } } class DiffViewerContentProvider implements ITreeContentProvider { public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // empty implementation } public boolean isDeleted(Object element) { return false; } public void dispose() { inputChanged(DiffTreeViewer.this, getInput(), null); } public Object getParent(Object element) { if (element instanceof IDiffElement) return ((IDiffElement)element).getParent(); return null; } public final boolean hasChildren(Object element) { if (element instanceof IDiffContainer) return ((IDiffContainer)element).hasChildren(); return false; } public final Object[] getChildren(Object element) { if (element instanceof IDiffContainer) return ((IDiffContainer)element).getChildren(); return new Object[0]; } public Object[] getElements(Object element) { return getChildren(element); } } /* * Takes care of swapping left and right if fLeftIsLocal * is true. */ class DiffViewerLabelProvider extends LabelProvider { public String getText(Object element) { if (element instanceof IDiffElement) return ((IDiffElement)element).getName(); return Utilities.getString(fBundle, "defaultLabel"); //$NON-NLS-1$ } public Image getImage(Object element) { if (element instanceof IDiffElement) { IDiffElement input= (IDiffElement) element; int kind= input.getKind(); if (fLeftIsLocal) { switch (kind & Differencer.DIRECTION_MASK) { case Differencer.LEFT: kind= (kind &~ Differencer.LEFT) | Differencer.RIGHT; break; case Differencer.RIGHT: kind= (kind &~ Differencer.RIGHT) | Differencer.LEFT; break; } } return fCompareConfiguration.getImage(input.getImage(), kind); } return null; } } static class FilterSame extends ViewerFilter { public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IDiffElement) return (((IDiffElement)element).getKind() & Differencer.PSEUDO_CONFLICT) == 0; return true; } public boolean isFilterProperty(Object element, Object property) { return false; } } private ResourceBundle fBundle; private CompareConfiguration fCompareConfiguration; /* package */ boolean fLeftIsLocal; private IPropertyChangeListener fPropertyChangeListener; private Action fCopyLeftToRightAction; private Action fCopyRightToLeftAction; private Action fEmptyMenuAction; private Action fExpandAllAction; /** * Creates a new viewer for the given SWT tree control with the specified configuration. * * @param tree the tree control * @param configuration the configuration for this viewer */ public DiffTreeViewer(Tree tree, CompareConfiguration configuration) { super(tree); initialize(configuration); } /** * Creates a new viewer under the given SWT parent and with the specified configuration. * * @param parent the SWT control under which to create the viewer * @param configuration the configuration for this viewer */ public DiffTreeViewer(Composite parent, CompareConfiguration configuration) { super(new Tree(parent, SWT.MULTI)); initialize(configuration); } private void initialize(CompareConfiguration configuration) { Control tree= getControl(); INavigatable nav= new INavigatable() { public boolean gotoDifference(boolean next) { // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 return internalNavigate(next, true); } }; tree.setData(INavigatable.NAVIGATOR_PROPERTY, nav); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 IOpenable openable= new IOpenable() { public void openSelected() { internalOpen(); } }; tree.setData(IOpenable.OPENABLE_PROPERTY, openable); fLeftIsLocal= Utilities.getBoolean(configuration, "LEFT_IS_LOCAL", false); //$NON-NLS-1$ tree.setData(CompareUI.COMPARE_VIEWER_TITLE, getTitle()); Composite parent= tree.getParent(); fBundle= ResourceBundle.getBundle("org.eclipse.compare.structuremergeviewer.DiffTreeViewerResources"); //$NON-NLS-1$ // register for notification with the CompareConfiguration fCompareConfiguration= configuration; if (fCompareConfiguration != null) { fPropertyChangeListener= new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { DiffTreeViewer.this.propertyChange(event); } }; fCompareConfiguration.addPropertyChangeListener(fPropertyChangeListener); } setContentProvider(new DiffViewerContentProvider()); setLabelProvider(new DiffViewerLabelProvider()); addSelectionChangedListener( new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent se) { updateActions(); } } ); setSorter(new DiffViewerSorter()); ToolBarManager tbm= CompareViewerPane.getToolBarManager(parent); if (tbm != null) { tbm.removeAll(); tbm.add(new Separator("merge")); //$NON-NLS-1$ tbm.add(new Separator("modes")); //$NON-NLS-1$ tbm.add(new Separator("navigation")); //$NON-NLS-1$ createToolItems(tbm); updateActions(); tbm.update(true); } MenuManager mm= new MenuManager(); mm.setRemoveAllWhenShown(true); mm.addMenuListener( new IMenuListener() { public void menuAboutToShow(IMenuManager mm2) { fillContextMenu(mm2); if (mm2.isEmpty()) { if (fEmptyMenuAction == null) { fEmptyMenuAction= new Action(Utilities.getString(fBundle, "emptyMenuItem")) { //$NON-NLS-1$ // left empty }; fEmptyMenuAction.setEnabled(false); } mm2.add(fEmptyMenuAction); } } } ); tree.setMenu(mm.createContextMenu(tree)); } /** * Returns the viewer's name. * * @return the viewer's name */ public String getTitle() { String title= Utilities.getString(fBundle, "title", null); //$NON-NLS-1$ if (title == null) title= Utilities.getString("DiffTreeViewer.title"); //$NON-NLS-1$ return title; } /** * Returns the resource bundle. * * @return the viewer's resource bundle */ protected ResourceBundle getBundle() { return fBundle; } /** * Returns the compare configuration of this viewer. * * @return the compare configuration of this viewer */ public CompareConfiguration getCompareConfiguration() { return fCompareConfiguration; } /** * Called on the viewer disposal. * Unregisters from the compare configuration. * Clients may extend if they have to do additional cleanup. * @param event dispose event that triggered call to this method */ protected void handleDispose(DisposeEvent event) { if (fCompareConfiguration != null) { if (fPropertyChangeListener != null) fCompareConfiguration.removePropertyChangeListener(fPropertyChangeListener); fCompareConfiguration= null; } fPropertyChangeListener= null; super.handleDispose(event); } /** * Tracks property changes of the configuration object. * Clients may extend to track their own property changes. * @param event property change event that triggered call to this method */ protected void propertyChange(PropertyChangeEvent event) { // empty default implementation } protected void inputChanged(Object in, Object oldInput) { super.inputChanged(in, oldInput); if (in != oldInput) { initialSelection(); updateActions(); } } /** * This hook method is called from within <code>inputChanged</code> * after a new input has been set but before any controls are updated. * This default implementation calls <code>navigate(true)</code> * to select and expand the first leaf node. * Clients can override this method and are free to decide whether * they want to call the inherited method. * * @since 2.0 */ protected void initialSelection() { navigate(true); } /** * Overridden to avoid expanding <code>DiffNode</code>s that shouldn't expand. * @param node the node to expand * @param level non-negative level, or <code>ALL_LEVELS</code> to collapse all levels of the tree */ protected void internalExpandToLevel(Widget node, int level) { Object data= node.getData(); if (dontExpand(data)) return; super.internalExpandToLevel(node, level); } /** * This hook method is called from within <code>internalExpandToLevel</code> * to control whether a given model node should be expanded or not. * This default implementation checks whether the object is a <code>DiffNode</code> and * calls <code>dontExpand()</code> on it. * Clients can override this method and are free to decide whether * they want to call the inherited method. * * @param o the model object to be expanded * @return <code>false</code> if a node should be expanded, <code>true</code> to prevent expanding * @since 2.0 */ protected boolean dontExpand(Object o) { return o instanceof DiffNode && ((DiffNode)o).dontExpand(); } //---- merge action support /** * This factory method is called after the viewer's controls have been created. * It installs four actions in the given <code>ToolBarManager</code>. Two actions * allow for copying one side of a <code>DiffNode</code> to the other side. * Two other actions are for navigating from one node to the next (previous). * <p> * Clients can override this method and are free to decide whether they want to call * the inherited method. * * @param toolbarManager the toolbar manager for which to add the actions */ protected void createToolItems(ToolBarManager toolbarManager) { // fCopyLeftToRightAction= new Action() { // public void run() { // copySelected(true); // } // }; // Utilities.initAction(fCopyLeftToRightAction, fBundle, "action.TakeLeft."); // toolbarManager.appendToGroup("merge", fCopyLeftToRightAction); // fCopyRightToLeftAction= new Action() { // public void run() { // copySelected(false); // } // }; // Utilities.initAction(fCopyRightToLeftAction, fBundle, "action.TakeRight."); // toolbarManager.appendToGroup("merge", fCopyRightToLeftAction); // fNextAction= new Action() { // public void run() { // navigate(true); // } // }; // Utilities.initAction(fNextAction, fBundle, "action.NextDiff."); //$NON-NLS-1$ // toolbarManager.appendToGroup("navigation", fNextAction); //$NON-NLS-1$ // fPreviousAction= new Action() { // public void run() { // navigate(false); // } // }; // Utilities.initAction(fPreviousAction, fBundle, "action.PrevDiff."); //$NON-NLS-1$ // toolbarManager.appendToGroup("navigation", fPreviousAction); //$NON-NLS-1$ } /** * This method is called to add actions to the viewer's context menu. * It installs actions for expanding tree nodes, copying one side of a <code>DiffNode</code> to the other side. * Clients can override this method and are free to decide whether they want to call * the inherited method. * * @param manager the menu manager for which to add the actions */ protected void fillContextMenu(IMenuManager manager) { if (fExpandAllAction == null) { fExpandAllAction= new Action() { public void run() { expandSelection(); } }; Utilities.initAction(fExpandAllAction, fBundle, "action.ExpandAll."); //$NON-NLS-1$ } boolean enable= false; ISelection selection= getSelection(); if (selection instanceof IStructuredSelection) { Iterator elements= ((IStructuredSelection)selection).iterator(); while (elements.hasNext()) { Object element= elements.next(); if (element instanceof IDiffContainer) { if (((IDiffContainer)element).hasChildren()) { enable= true; break; } } } } fExpandAllAction.setEnabled(enable); manager.add(fExpandAllAction); if (fCopyLeftToRightAction != null) manager.add(fCopyLeftToRightAction); if (fCopyRightToLeftAction != null) manager.add(fCopyRightToLeftAction); } /** * Expands to infinity all items in the selection. * * @since 2.0 */ protected void expandSelection() { ISelection selection= getSelection(); if (selection instanceof IStructuredSelection) { Iterator elements= ((IStructuredSelection)selection).iterator(); while (elements.hasNext()) { Object next= elements.next(); expandToLevel(next, ALL_LEVELS); } } } /** * Copies one side of all <code>DiffNode</code>s in the current selection to the other side. * Called from the (internal) actions for copying the sides of a <code>DiffNode</code>. * Clients may override. * * @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 */ protected void copySelected(boolean leftToRight) { ISelection selection= getSelection(); if (selection instanceof IStructuredSelection) { Iterator e= ((IStructuredSelection) selection).iterator(); while (e.hasNext()) { Object element= e.next(); if (element instanceof ICompareInput) copyOne((ICompareInput) element, leftToRight); } } } /** * Called to copy one side of the given node to the other. * This default implementation delegates the call to <code>ICompareInput.copy(...)</code>. * Clients may override. * @param node the node to copy * @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 */ protected void copyOne(ICompareInput node, boolean leftToRight) { node.copy(leftToRight); // update node's image update(new Object[] { node }, null); } /** * Selects the next (or previous) node of the current selection. * If there is no current selection the first (last) node in the tree is selected. * Wraps around at end or beginning. * Clients may override. * * @param next if <code>true</code> the next node is selected, otherwise the previous node */ protected void navigate(boolean next) { // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 internalNavigate(next, false); } //---- private /** * Selects the next (or previous) node of the current selection. * If there is no current selection the first (last) node in the tree is selected. * Wraps around at end or beginning. * Clients may override. * * @param next if <code>true</code> the next node is selected, otherwise the previous node * @param fireOpen if <code>true</code> an open event is fired. * @return <code>true</code> if at end (or beginning) */ private boolean internalNavigate(boolean next, boolean fireOpen) { Control c= getControl(); if (!(c instanceof Tree)) return false; Tree tree= (Tree) c; TreeItem item= null; TreeItem children[]= tree.getSelection(); if (children != null && children.length > 0) item= children[0]; if (item == null) { children= tree.getItems(); if (children != null && children.length > 0) { item= children[0]; if (item != null && item.getItemCount() <= 0) { internalSetSelection(item, fireOpen); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 return false; } } } while (true) { item= findNextPrev(item, next); if (item == null) break; if (item.getItemCount() <= 0) break; } if (item != null) { internalSetSelection(item, fireOpen); // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 return false; } return true; } private TreeItem findNextPrev(TreeItem item, boolean next) { if (item == null) return null; TreeItem children[]= null; if (!next) { TreeItem parent= item.getParentItem(); if (parent != null) children= parent.getItems(); else children= item.getParent().getItems(); if (children != null && children.length > 0) { // goto previous child int index= 0; for (; index < children.length; index++) if (children[index] == item) break; if (index > 0) { item= children[index-1]; while (true) { createChildren(item); int n= item.getItemCount(); if (n <= 0) break; item.setExpanded(true); item= item.getItems()[n-1]; } // previous return item; } } // go up item= parent; } else { item.setExpanded(true); createChildren(item); if (item.getItemCount() > 0) { // has children: go down children= item.getItems(); return children[0]; } while (item != null) { children= null; TreeItem parent= item.getParentItem(); if (parent != null) children= parent.getItems(); else children= item.getParent().getItems(); if (children != null && children.length > 0) { // goto next child int index= 0; for (; index < children.length; index++) if (children[index] == item) break; if (index < children.length-1) { // next return children[index+1]; } } // go up item= parent; } } return item; } private void internalSetSelection(TreeItem ti, boolean fireOpen) { if (ti != null) { Object data= ti.getData(); if (data != null) { // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 ISelection selection= new StructuredSelection(data); setSelection(selection, true); ISelection currentSelection= getSelection(); if (fireOpen && currentSelection != null && selection.equals(currentSelection)) { fireOpen(new OpenEvent(this, selection)); } } } } private final boolean isEditable(Object element, boolean left) { if (element instanceof ICompareInput) { ICompareInput diff= (ICompareInput) element; Object side= left ? diff.getLeft() : diff.getRight(); if (side == null && diff instanceof IDiffElement) { IDiffContainer container= ((IDiffElement)diff).getParent(); if (container instanceof ICompareInput) { ICompareInput parent= (ICompareInput) container; side= left ? parent.getLeft() : parent.getRight(); } } if (side instanceof IEditableContent) return ((IEditableContent) side).isEditable(); } return false; } private void updateActions() { int leftToRight= 0; int rightToLeft= 0; ISelection selection= getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ss= (IStructuredSelection) selection; Iterator e= ss.iterator(); while (e.hasNext()) { Object element= e.next(); if (element instanceof ICompareInput) { if (isEditable(element, false)) leftToRight++; if (isEditable(element, true)) rightToLeft++; if (leftToRight > 0 && rightToLeft > 0) break; } } if (fExpandAllAction != null) fExpandAllAction.setEnabled(selection.isEmpty()); } if (fCopyLeftToRightAction != null) fCopyLeftToRightAction.setEnabled(leftToRight > 0); if (fCopyRightToLeftAction != null) fCopyRightToLeftAction.setEnabled(rightToLeft > 0); } /* * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 */ private void internalOpen() { ISelection selection= getSelection(); if (selection != null && !selection.isEmpty()) { fireOpen(new OpenEvent(this, selection)); } } } --- NEW FILE: DiffTreeViewerResources.properties --- ############################################################################### # Copyright (c) 2000, 2004 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://... [truncated message content] |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/internal/merge In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/internal/merge Added Files: MergeMessages.properties MergeMessages.java TextStreamMerger.java LineComparator.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: MergeMessages.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.merge; import org.eclipse.osgi.util.NLS; public final class MergeMessages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.compare.internal.merge.MergeMessages";//$NON-NLS-1$ private MergeMessages() { // Do not instantiate } public static String TextAutoMerge_inputEncodingError; public static String TextAutoMerge_outputEncodingError; public static String TextAutoMerge_outputIOError; public static String TextAutoMerge_conflict; static { NLS.initializeMessages(BUNDLE_NAME, MergeMessages.class); } } --- NEW FILE: MergeMessages.properties --- ############################################################################### # Copyright (c) 2004 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # 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 ############################################################################### TextAutoMerge_inputEncodingError= Unsupported encoding for input streams TextAutoMerge_outputEncodingError= Unsupported encoding for output streams TextAutoMerge_outputIOError= IO error on writing TextAutoMerge_conflict= Conflict: cannot auto merge --- NEW FILE: TextStreamMerger.java --- /******************************************************************************* * Copyright (c) 2003, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.merge; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import org.eclipse.compare.*; import org.eclipse.compare.rangedifferencer.RangeDifference; import org.eclipse.compare.rangedifferencer.RangeDifferencer; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; /** * A simple merger for streams containing text lines. */ 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, * org.eclipse.core.resources.IEncodedStorage, * org.eclipse.core.runtime.IProgressMonitor) */ public IStatus merge(OutputStream output, String outputEncoding, InputStream ancestor, String ancestorEncoding, InputStream target, String targetEncoding, InputStream other, String otherEncoding, IProgressMonitor monitor) { LineComparator a, t, o; try { a= new LineComparator(ancestor, ancestorEncoding); t= new LineComparator(target, targetEncoding); o= new LineComparator(other, otherEncoding); } catch (UnsupportedEncodingException e) { return new Status(IStatus.ERROR, CompareUI.PLUGIN_ID, 1, MergeMessages.TextAutoMerge_inputEncodingError, e); } try { String lineSeparator= System.getProperty("line.separator"); //$NON-NLS-1$ if (lineSeparator == null) lineSeparator= "\n"; //$NON-NLS-1$ RangeDifference[] diffs= RangeDifferencer.findRanges(monitor, a, t, o); for (int i= 0; i < diffs.length; i++) { RangeDifference rd= diffs[i]; switch (rd.kind()) { case RangeDifference.ANCESTOR: // pseudo conflict case RangeDifference.NOCHANGE: case RangeDifference.RIGHT: for (int j= rd.rightStart(); j < rd.rightEnd(); j++) { String s= o.getLine(j); output.write(s.getBytes(outputEncoding)); output.write(lineSeparator.getBytes(outputEncoding)); } break; case RangeDifference.LEFT: for (int j= rd.leftStart(); j < rd.leftEnd(); j++) { String s= t.getLine(j); output.write(s.getBytes(outputEncoding)); output.write(lineSeparator.getBytes(outputEncoding)); } break; case RangeDifference.CONFLICT: return new Status(IStatus.ERROR, CompareUI.PLUGIN_ID, CONFLICT, MergeMessages.TextAutoMerge_conflict, null); default: break; } } } catch (UnsupportedEncodingException e) { return new Status(IStatus.ERROR, CompareUI.PLUGIN_ID, 1, MergeMessages.TextAutoMerge_outputEncodingError, e); } catch (IOException e) { return new Status(IStatus.ERROR, CompareUI.PLUGIN_ID, 1, MergeMessages.TextAutoMerge_outputIOError, e); } return Status.OK_STATUS; } } --- NEW FILE: LineComparator.java --- /******************************************************************************* * Copyright (c) 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.merge; import java.io.*; import java.util.ArrayList; import org.eclipse.compare.rangedifferencer.IRangeComparator; /** * This implementation of IRangeComparator breaks an input stream into lines. */ class LineComparator implements IRangeComparator { private String[] fLines; public LineComparator(InputStream is, String encoding) throws UnsupportedEncodingException { BufferedReader br = new BufferedReader(new InputStreamReader(is, encoding)); String line; ArrayList ar = new ArrayList(); try { while ((line = br.readLine()) != null) ar.add(line); } catch (IOException e) { // silently ignored } // try { // is.close(); // } catch (IOException e1) { // } fLines = (String[]) ar.toArray(new String[ar.size()]); } String getLine(int ix) { return fLines[ix]; } /* (non-Javadoc) * @see org.eclipse.compare.rangedifferencer.IRangeComparator#getRangeCount() */ public int getRangeCount() { return fLines.length; } /* (non-Javadoc) * @see org.eclipse.compare.rangedifferencer.IRangeComparator#rangesEqual(int, org.eclipse.compare.rangedifferencer.IRangeComparator, int) */ public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) { String s1 = fLines[thisIndex]; String s2 = ((LineComparator) other).fLines[otherIndex]; return s1.equals(s2); } /* (non-Javadoc) * @see org.eclipse.compare.rangedifferencer.IRangeComparator#skipRangeComparison(int, int, org.eclipse.compare.rangedifferencer.IRangeComparator) */ public boolean skipRangeComparison(int length, int maxLength, IRangeComparator other) { return false; } } |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare Added Files: ResourceNode.java CompareUI.java IPropertyChangeNotifier.java CompareViewerSwitchingPane.java ICompareNavigator.java IEncodedStreamContentAccessor.java CompareViewerPane.java IEditableContent.java CompareConfiguration.java IViewerCreator.java CompareEditorInput.java IContentChangeNotifier.java IModificationDate.java Splitter.java IStreamContentAccessor.java BufferedContent.java ITypedElement.java package.html ZipFileStructureCreator.java EditionSelectionDialog.java NavigationAction.java IContentChangeListener.java IStreamMerger.java HistoryItem.java IResourceProvider.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: IContentChangeListener.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; /** * An <code>IContentChangeListener</code> is informed about content changes of a * <code>IContentChangeNotifier</code>. * <p> * Clients may implement this interface. * </p> * * @see IContentChangeNotifier */ public interface IContentChangeListener { /** * Called whenever the content of the given source has changed. * * @param source the source whose contents has changed */ void contentChanged(IContentChangeNotifier source); } --- NEW FILE: Splitter.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import org.eclipse.swt.widgets.*; import org.eclipse.swt.custom.SashForm; /** * The Splitter adds support for nesting to a SashForm. * <P> * If Splitters are nested directly: * <UL> * <LI>changing the visibility of a child may propagate upward to the parent Splitter if the child * 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. * <p> * The style value is either one of the style constants defined in * class <code>SWT</code> which is applicable to instances of this * class, or must be built by <em>bitwise OR</em>'ing together * (that is, using the <code>int</code> "|" operator) two or more * of those <code>SWT</code> style constants. The class description * lists the style constants that are applicable to the class. * Style bits are also inherited from superclasses. * </p> * * @param parent a widget which will be the parent of the new instance (cannot be null) * @param style the style of widget to construct * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @exception org.eclipse.swt.SWTException <ul> * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li> * </ul> */ 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 * is directly nested in one or more Splitters, this method recursively * propagates the new state upward. * * @param child the child control for which the visibility is changed * @param visible the new visibility state */ public void setVisible(Control child, boolean visible) { boolean wasEmpty= isEmpty(); child.setVisible(visible); child.setData(VISIBILITY, new Boolean(visible)); if (wasEmpty != isEmpty()) { // recursively walk up Composite parent= getParent(); if (parent instanceof Splitter) { Splitter sp= (Splitter) parent; sp.setVisible(this, visible); sp.layout(); } } else { layout(); } } /* (non-Javadoc) * Recursively calls setMaximizedControl for all direct parents that are * itself Splitters. */ public void setMaximizedControl(Control control) { if (control == null || control == getMaximizedControl()) super.setMaximizedControl(null); else super.setMaximizedControl(control); // recursively walk upward Composite parent= getParent(); if (parent instanceof Splitter) ((Splitter) parent).setMaximizedControl(this); else layout(true); } /* (non-Javadoc) * Returns true if Splitter has no children or if all children are invisible. */ private boolean isEmpty() { Control[] controls= getChildren(); for (int i= 0; i < controls.length; i++) if (isVisible(controls[i])) 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. */ private boolean isVisible(Control child) { if (child instanceof Sash) return false; Object data= child.getData(VISIBILITY); if (data instanceof Boolean) return ((Boolean)data).booleanValue(); return true; } } --- NEW FILE: ITypedElement.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import org.eclipse.swt.graphics.Image; /** * Interface for getting the name, image, and type for an object. * <p> * These methods are typically used to present an input object in the compare UI * (<code>getName</code> and <code>getImage</code>) * and for finding a viewer for a given input type (<code>getType</code>). * <p> * Clients may implement this interface. */ public interface ITypedElement { /** * Type for a folder input (value <code>"FOLDER"</code>). * Folders are comparison elements that have no contents, only a name and children. */ public static final String FOLDER_TYPE= "FOLDER"; //$NON-NLS-1$ /** * Type for an element whose actual type is text (value <code>"txt"</code>). */ public static final String TEXT_TYPE= "txt"; //$NON-NLS-1$ /** * Type for an element whose actual type could not * be determined. (value <code>"???"</code>). */ public static final String UNKNOWN_TYPE= "???"; //$NON-NLS-1$ /** * Returns the name of this object. * The name is used when displaying this object in the UI. * * @return the name of this object */ String getName(); /** * Returns an image for this object. * This image is used when displaying this object in the UI. * * @return the image of this object or <code>null</code> if this type of input has no image */ Image getImage(); /** * Returns the type of this object. For objects with a file name * this is typically the file extension. For folders its the constant * <code>FOLDER_TYPE</code>. * The type is used for determining a suitable viewer for this object. * * @return the type of this object */ String getType(); } --- NEW FILE: IModificationDate.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; /** * Common interface for objects with a modification date. The modification date * can be used in the UI to give the user a general idea of how old an object is. * <p> * Clients may implement this interface. * </p> */ public interface IModificationDate { /** * Returns the modification time of this object. * <p> * Note that this value should only be used to give the user a general idea of how * old the object is. * * @return the time of last modification, in milliseconds since January 1, 1970, 00:00:00 GMT */ long getModificationDate(); } --- NEW FILE: CompareViewerPane.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.widgets.*; import org.eclipse.jface.action.ToolBarManager; /** * A <code>CompareViewerPane</code> is a convenience class which installs a * <code>CLabel</code> and a <code>Toolbar</code> in a <code>ViewForm</code>. * <P> * Double clicking onto the <code>CompareViewerPane</code>'s title bar maximizes * the <code>CompareViewerPane</code> to the size of an enclosing <code>Splitter</code> * (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 { private ToolBarManager fToolBarManager; /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. * * @param container a widget which will be the container of the new instance (cannot be null) * @param style the style of widget to construct * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT - if the parent is null</li> * </ul> * @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; CLabel label= new CLabel(this, SWT.NONE) { public Point computeSize(int wHint, int hHint, boolean changed) { return super.computeSize(wHint, Math.max(24, hHint), changed); } }; setTopLeft(label); MouseAdapter ml= new MouseAdapter() { public void mouseDoubleClick(MouseEvent e) { Control content= getContent(); if (content != null && content.getBounds().contains(e.x, e.y)) return; Control parent= getParent(); if (parent instanceof Splitter) ((Splitter)parent).setMaximizedControl(CompareViewerPane.this); } }; addMouseListener(ml); label.addMouseListener(ml); addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (fToolBarManager != null) { fToolBarManager.removeAll(); fToolBarManager.dispose(); fToolBarManager= null; } } }); } /** * 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.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) { CLabel cl= (CLabel) getTopLeft(); 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> */ public static ToolBarManager getToolBarManager(Composite parent) { if (parent instanceof CompareViewerPane) { CompareViewerPane pane= (CompareViewerPane) parent; return pane.getToolBarManager(); } return null; } /** * 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) { ToolBarManager tbm= getToolBarManager(parent); if (tbm != null) { tbm.removeAll(); tbm.update(true); } } //---- private stuff private ToolBarManager getToolBarManager() { if (fToolBarManager == null) { ToolBar tb= new ToolBar(this, SWT.FLAT); setTopCenter(tb); fToolBarManager= new ToolBarManager(tb); } return fToolBarManager; } } --- NEW FILE: HistoryItem.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.io.InputStream; import java.io.BufferedInputStream; import org.eclipse.swt.graphics.Image; import org.eclipse.compare.IResourceProvider; import org.eclipse.core.resources.IEncodedStorage; import org.eclipse.core.resources.IFileState; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; /** * A combination <code>IFileState</code> and <code>ITypedElement</code> that can be used as * an input to a compare viewer or other places where an <code>IStreamContentAccessor</code> * is needed. * <p> * <p> * Clients may instantiate this class; it is not intended to be subclassed. * </p> */ public class HistoryItem implements IEncodedStreamContentAccessor, ITypedElement, IModificationDate, IResourceProvider { private ITypedElement fBase; private IFileState fFileState; /** * Creates a <code>HistoryItem</code> object which combines the given <code>IFileState</code> * and <code>ITypedElement</code> into an object * which is suitable as input for a compare viewer or <code>ReplaceWithEditionDialog</code>. * * @param base the implementation of the <code>ITypedElement</code> interface delegates to this base <code>ITypedElement</code> * @param fileState the <code>IFileState</code> from which the streamable contents and the modification time is derived from */ public HistoryItem(ITypedElement base, IFileState fileState) { 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 */ public String getType() { return fBase.getType(); } /* (non-Javadoc) * see IModificationDate.getModificationDate */ public long getModificationDate() { return fFileState.getModificationTime(); } /* (non-Javadoc) * see IStreamContentAccessor.getContents */ public InputStream getContents() throws CoreException { return new BufferedInputStream(fFileState.getContents()); } /* (non-Javadoc) * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset() */ public String getCharset() throws CoreException { String charset= fFileState.getCharset(); if (charset == null) { IResource resource= getResource(); if (resource instanceof IEncodedStorage) charset= ((IEncodedStorage)resource).getCharset(); } return charset; } /* (non-Javadoc) * @see org.eclipse.compare.internal.IResourceProvider#getResource() */ public IResource getResource() { IPath fullPath= fFileState.getFullPath(); return ResourcesPlugin.getWorkspace().getRoot().findMember(fullPath); } } --- NEW FILE: IContentChangeNotifier.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; /** * Interface common to all objects that provide a means for registering * for content change notification. * <p> * Clients may implement this interface. * </p> * * @see IContentChangeListener */ public interface IContentChangeNotifier { /** * Adds a content change listener to this notifier. * Has no effect if an identical listener is already registered. * * @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. * * @param listener a content changed listener */ void removeContentChangeListener(IContentChangeListener listener); } --- NEW FILE: CompareUI.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.util.ResourceBundle; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.DocumentManager; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.content.IContentType; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.IReusableEditor; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.plugin.AbstractUIPlugin; /** * The class <code>CompareUI</code> defines the entry point to initiate a configurable * compare operation on arbitrary resources. The result of the compare * is opened into a compare editor where the details can be browsed and * edited in dynamically selected structure and content viewers. * <p> * The Compare UI provides a registry for content and structure compare viewers, * which is initialized from extensions contributed to extension points * declared by this plug-in. */ 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$ /** * Image descriptor for the disabled icon of the 'Next' tool bar button. * @since 2.0 */ public static final ImageDescriptor DESC_DTOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.DTOOL_NEXT); /** * Image descriptor for the normal icon of the 'Next' tool bar button. * @since 2.0 */ public static final ImageDescriptor DESC_CTOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.CTOOL_NEXT); /** * Image descriptor for the roll-over icon of the 'Next' tool bar button. * @since 2.0 */ public static final ImageDescriptor DESC_ETOOL_NEXT= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.ETOOL_NEXT); /** * Image descriptor for the disabled icon of the 'Previous' tool bar button. * @since 2.0 */ public static final ImageDescriptor DESC_DTOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.DTOOL_PREV); /** * Image descriptor for the normal icon of the 'Previous' tool bar button. * @since 2.0 */ public static final ImageDescriptor DESC_CTOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.CTOOL_PREV); /** * Image descriptor for the roll-over icon of the 'Previous' tool bar button. * @since 2.0 */ public static final ImageDescriptor DESC_ETOOL_PREV= CompareUIPlugin.getImageDescriptor(CompareUIPlugin.ETOOL_PREV); /** * Name of the title property of a compare viewer. * If a property with this name is set * on the top level SWT control of a viewer, it is used as a title in the pane's * 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. * * @return the plugin's resource bundle */ 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. * * @param input the input on which to open the compare editor */ public static void openCompareEditor(CompareEditorInput input) { openCompareEditorOnPage(input, null); } /** * 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 the workbench page in which to open the compare editor * @since 2.1 */ public static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page) { CompareUIPlugin plugin= CompareUIPlugin.getDefault(); if (plugin != null) plugin.openCompareEditor(input, page, null); } /** * 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 the compare editor to reuse or null to create a new one * @since 3.0 */ public static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor) { CompareUIPlugin plugin= CompareUIPlugin.getDefault(); if (plugin != null) plugin.openCompareEditor(input, null, editor); } /** * Performs the comparison described by the given input and opens a * modal compare dialog on the result. * * @param input the input on which to open the compare dialog */ public static void openCompareDialog(CompareEditorInput input) { CompareUIPlugin plugin= CompareUIPlugin.getDefault(); if (plugin != null) plugin.openCompareDialog(input); } /** * Registers an image descriptor for the given type. * * @param type the type * @param descriptor the image descriptor */ 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. * <p> * Note: Images returned from this method will be automatically disposed * of when this plug-in shuts down. Callers must not dispose of these * images themselves. * </p> * * @param type the type * @return the image */ public static Image getImage(String type) { return CompareUIPlugin.getImage(type); } /** * Registers the given image for being disposed when this plug-in is shutdown. * * @param image the image to register for disposal */ public static void disposeOnShutdown(Image image) { CompareUIPlugin.disposeOnShutdown(image); } /** * Returns a shared image for the given adaptable. * This convenience method queries the given adaptable * for its <code>IWorkbenchAdapter.getImageDescriptor</code>, which it * uses to create an image if it does not already have one. * <p> * Note: Images returned from this method will be automatically disposed * of when this plug-in shuts down. Callers must not dispose of these * images themselves. * </p> * * @param adaptable the adaptable for which to find an image * @return an image */ 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. * * @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 */ public static IStreamMerger createStreamMerger(IContentType type) { return CompareUIPlugin.getDefault().createStreamMerger(type); } /** * Creates a stream merger for the given file extension. * If no stream merger is registered for the file extension <code>null</code> is returned. * * @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 */ public static IStreamMerger createStreamMerger(String type) { return CompareUIPlugin.getDefault().createStreamMerger(type); } /** * Returns a structure compare viewer based on an old viewer and an input object. * If the old viewer is suitable for showing the input, the old viewer * is returned. Otherwise, the input's type is used to find a viewer descriptor in the registry * which in turn is used to create a structure compare viewer under the given parent composite. * If no viewer descriptor can be found <code>null</code> is returned. * * @param oldViewer a new viewer is only created if this old viewer cannot show the given input * @param input the input object for which to find a structure viewer * @param parent the SWT parent composite under which the new viewer is created * @param configuration a configuration which is passed to a newly created viewer * @return the compare viewer which is suitable for the given input object or <code>null</code> */ public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent, CompareConfiguration configuration) { 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 * is returned. Otherwise the input's type is used to find a viewer descriptor in the registry * which in turn is used to create a content compare viewer under the given parent composite. * If no viewer descriptor can be found <code>null</code> is returned. * * @param oldViewer a new viewer is only created if this old viewer cannot show the given input * @param input the input object for which to find a content viewer * @param parent the SWT parent composite under which the new viewer is created * @param configuration a configuration which is passed to a newly created viewer * @return the compare viewer which is suitable for the given input object or <code>null</code> */ public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent, 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 * viewer is returned. Otherwise the input's type is used to find a viewer * descriptor in the registry which in turn is used to create a content * compare viewer under the given parent composite. In order to determine * the input's type, the input must either implement IStreamContentAccessor * and ITypedElement or ICompareInput. If no viewer descriptor can be found * <code>null</code> is returned. * * @param oldViewer a new viewer is only created if this old viewer cannot show the given input * @param input the input object for which to find a content viewer. Must * implement either <code>IStreamContentAccessor</code> and<code> * ITypedElement</code> or <code>ICompareInput</code>. * @param parent the SWT parent composite under which the new viewer is created * @param configuration a configuration which is passed to a newly created viewer * @return the compare viewer which is suitable for the given input object or <code>null</code> */ public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent, CompareConfiguration configuration) { return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration); } /** * 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. * <p> * Note: this method is for internal use only. Clients should not call this method. * @param type a type name for which a viewer has been registered * @param alias a type name which should be treated as a synonym of type * @since 2.0 */ 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. * <p> * Note: this method is for internal use only. Clients should not call this method. * @param type the type name for which all synonyms are removed. * @since 2.0 */ 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. * @param input the object for which to retrieve a document * @return a document or <code>null</code> if no document was registered for the input * @since 3.1 */ public static IDocument getDocument(Object input) { return DocumentManager.get(input); } /** * Register a document for the given input. * @param input the object for which to register a document * @param document the document to register * @since 3.1 */ public static void registerDocument(Object input, IDocument document) { DocumentManager.put(input, document); } /** * Unregister the given document. * @param document the document to unregister * @since 3.1 */ public static void unregisterDocument(IDocument document) { DocumentManager.remove(document); } } --- NEW FILE: IStreamContentAccessor.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.io.InputStream; import org.eclipse.core.runtime.CoreException; /** * An <code>IStreamContentAccessor</code> object represents a set of bytes which can be * accessed by means of a stream. * <p> * Clients may implement this interface, or use the standard implementation, * <code>BufferedContent</code>. * * @see BufferedContent */ public interface IStreamContentAccessor { /** * Returns an open <code>InputStream</code> for this object which can be used to retrieve the object's content. * The client is responsible for closing the stream when finished. * Returns <code>null</code> if this object has no streamable contents. * * @return an input stream containing the contents of this object * @exception CoreException if the contents of this object could not be accessed */ InputStream getContents() throws CoreException; } --- NEW FILE: ResourceNode.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.io.*; import java.util.ArrayList; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.util.Assert; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.compare.IResourceProvider; import org.eclipse.compare.internal.Utilities; import org.eclipse.compare.structuremergeviewer.IStructureComparator; /** * A <code>ResourceNode</code> wrappers an <code>IResources</code> so that it can be used * as input for the differencing engine (interfaces <code>IStructureComparator</code> and <code>ITypedElement</code>) * and the <code>ReplaceWithEditionDialog</code> (interfaces <code>ITypedElement</code> and <code>IModificationDate</code>). * <p> * Clients may instantiate this class; it is not intended to be subclassed. * </p> * * @see EditionSelectionDialog */ public class ResourceNode extends BufferedContent implements IEncodedStreamContentAccessor, IStructureComparator, ITypedElement, IEditableContent, IModificationDate, IResourceProvider { private IResource fResource; private ArrayList fChildren; /** * Creates a <code>ResourceNode</code> for the given resource. * * @param resource the resource */ public ResourceNode(IResource resource) { fResource= resource; Assert.isNotNull(resource); } /** * Returns the corresponding resource for this object. * * @return the corresponding resource */ public IResource getResource() { return fResource; } /* (non Javadoc) * see IStreamContentAccessor.getContents */ public InputStream getContents() throws CoreException { if (fResource instanceof IStorage) return super.getContents(); return null; } /* (non Javadoc) * see IModificationDate.getModificationDate */ public long getModificationDate() { IPath path= fResource.getLocation(); File file= path.toFile(); return file.lastModified(); } /* (non Javadoc) * see ITypedElement.getName */ public String getName() { if (fResource != null) return fResource.getName(); return null; } /* (non Javadoc) * see ITypedElement.getType */ public String getType() { if (fResource instanceof IContainer) return ITypedElement.FOLDER_TYPE; if (fResource != null) { String s= fResource.getFileExtension(); if (s != null) return s; } return ITypedElement.UNKNOWN_TYPE; } /* (non Javadoc) * see ITypedElement.getImage */ public Image getImage() { return CompareUI.getImage(fResource); } /* * Returns <code>true</code> if the other object is of type <code>ITypedElement</code> * and their names are identical. The content is not considered. */ public boolean equals(Object other) { if (other instanceof ITypedElement) { String otherName= ((ITypedElement)other).getName(); return getName().equals(otherName); } return super.equals(other); } /** * Returns the hash code of the name. * @return a hash code value for this object. */ public int hashCode() { return getName().hashCode(); } /* (non Javadoc) * see IStructureComparator.getChildren */ public Object[] getChildren() { if (fChildren == null) { fChildren= new ArrayList(); if (fResource instanceof IContainer) { try { IResource members[]= ((IContainer)fResource).members(); for (int i= 0; i < members.length; i++) { IStructureComparator child= createChild(members[i]); if (child != null) fChildren.add(child); } } catch (CoreException ex) { // NeedWork } } } return fChildren.toArray(); } /** * This hook method is called from <code>getChildren</code> once for every * member of a container resource. This implementation * creates a new <code>ResourceNode</code> for the given child resource. * Clients may override this method to create a different type of * <code>IStructureComparator</code> or to filter children by returning <code>null</code>. * * @param child the child resource for which a <code>IStructureComparator</code> must be returned * @return a <code>ResourceNode</code> for the given child or <code>null</code> */ 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. * * @return a buffered input stream containing the contents of this storage * @exception CoreException if the contents of this storage could not be accessed */ protected InputStream createStream() throws CoreException { if (fResource instanceof IStorage) { InputStream is= null; IStorage storage= (IStorage) fResource; try { is= storage.getContents(); } catch (CoreException e) { if (e.getStatus().getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) { fResource.refreshLocal(IResource.DEPTH_INFINITE, null); is= storage.getContents(); } else throw e; } if (is != null) return new BufferedInputStream(is); } return null; } /* (non Javadoc) * see IEditableContent.isEditable */ public boolean isEditable() { return true; } /* (non Javadoc) * see IEditableContent.replace */ public ITypedElement replace(ITypedElement child, ITypedElement other) { return child; } /* (non-Javadoc) * @see org.eclipse.compare.IEncodedStreamContentAccessor#getCharset() */ public String getCharset() { return Utilities.getCharset(fResource); } } --- NEW FILE: package.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="IBM"> <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]"> <title>Package-level Javadoc</title> </head> <body> Provides support for performing structural and textual compare operations on arbitrary data and displaying the results. <h2> Package Specification</h2> The class <b>CompareUI</b> defines the entry point to initiate a configurable compare operation on arbitrary resources. The result of the compare is opened into a compare editor where the details can be browsed and edited in dynamically selected structure and content viewers. <p> A compare operation must be implemented as a subclass of <b>CompareEditorInput</b>. A <b>CompareEditorInput</b> runs a (potentially lengthy) compare operation under progress monitor control, creates a UI for drilling-down into the compare results, tracks the dirty state of the result in case of merge, and saves any changes that occured during a merge. <p> The <b>NavigationAction</b> is used to navigate (step) through the individual differences of a <b>CompareEditorInput</b>. <p> An instance of <b>CompareConfiguration</b> configures various UI aspects of compare/merge viewers like title labels and images, or whether a side of a merge viewer is editable. It is passed to the <b>CompareEditorInput</b> on creation. <p> When implementing a hierarchical compare operation as a subclass of <b>CompareEditorInput</b> clients have to provide a tree of objects where each node implements the interface <b>org.eclipse.compare.structuremergeviewer.IStructureComparator</b>. This interface is used by the hierarchical differencing engine (<b>org.eclipse.compare.structuremergeviewer.Differencer</b>) to walk the tree. <br> In addition every leaf of the tree must implement the <b>IStreamContentAccessor</b> or <b>IEncodedStreamContentAccessor</b> interfaces in order to give the differencing engine access to its stream content and to its encoding (with IEncodedStreamContentAccessor). <p> The abstract class <b>BufferedContent</b> provides a default implementation for the <b>IStreamContentAccessor</b> and <b>IContentChangeNotifier</b> interfaces. Its subclass <b>ResourceNode</b> adds an implementation for the <b>IStructureComparator</b> and <b>ITypedElement</b> interfaces based on Eclipse workbench resources (org.eclipse.core.resources.IResource). It can be used without modification as the input to the differencing engine. <p> The <b>ZipFileStructureCreator</b> is an implementation of the <b>org.eclipse.compare.structuremergeviewer.IStructureCreator</b> interface and makes the contents of a zip archive available as a hierarchical structure of <b>IStructureComparator</b>s which can be easily compared by the differencing engine (<b>org.eclipse.compare.structuremergeviewer.Differencer</b>). It is a good example for how to make structured files available to the hierarchical compare functionality of the Compare plugin. <p> The <b>EditionSelectionDialog</b> is a simple selection dialog where one input element can be compared against a list of historic variants (<i>editions</i>) of the same input element. The dialog can be used to implement functions like <i>"Replace with Version"</i> or <i>"Replace with Edition"</i> on workbench resources. <p> In addition it is possible to specify a subsection of the input element (e.g. a method in a Java source file) by means of a <i>path</i>. In this case the dialog compares only the subsection (as specified by the path) with the corresponding subsection in the list of editions. This functionality can be used to implement <i>"Replace with Method Edition"</i> for the Java language. <p> The <b>EditionSelectionDialog</b> requires that the editions implement the <b>IStreamContentAccessor</b> and <b>IModificationDate</b> interfaces. The <b>HistoryItem</b> is a convenience class that implements these interfaces for <b>IFileState</b> objects. <p> The <b>CompareViewerPane</b> is a convenience class which provides a label and local toolbar for a compare viewer (or any other subclass of a JFace <b>Viewer</b>). <br> Its abstract subclass <b>CompareViewerSwitchingPane</b> supports <i>dynamic viewer switching</i>, that is the viewer installed in the pane is dynamically determined by the pane's input object. Both classes are useful if you want to use compare viewers outside the context of a compare editor, for example in a dialog or wizard. <p> A <b>Splitter</b> is an extension of a SashForm that supports nesting, maximizing of panes, and propagating the visibility state of panes. <p> The interface <b>IStreamMerger</b> defines a single operation for performing a three-way merge on three input streams. The merged result is written to an output stream. <br> Clients must implement this interface when contributing new mergers to the <code>org.eclipse.compare.streamMergers</code> extension point. New <b>IStreamMerger</b>s can be created for registered types with the createStreamMerger methods of CompareUI. </body> </html> --- NEW FILE: IViewerCreator.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import org.eclipse.swt.widgets.Composite; import org.eclipse.jface.viewers.Viewer; /** * A factory object for <code>Viewer</code>. * <p> * This interface is only required when creating a <code>Viewer</code> from a plugin.xml file. * Since <code>Viewer</code>s have no default constructor they cannot be * instantiated directly with <code>Class.forName</code>. */ public interface IViewerCreator { /** * Creates a new viewer under the given SWT parent control. * * @param parent the SWT parent control under which to create the viewer's SWT control * @param config a compare configuration the newly created viewer might want to use * @return a new viewer */ Viewer createViewer(Composite parent, CompareConfiguration config); } --- NEW FILE: IEncodedStreamContentAccessor.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; 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 * 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. * </p> * @return the name of a charset, or <code>null</code> * @exception CoreException if an error happens while determining * the charset. See any refinements for more information. * @see IStreamContentAccessor#getContents * @since 3.0 */ String getCharset() throws CoreException; } --- NEW FILE: BufferedContent.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.io.*; import org.eclipse.core.runtime.ListenerList; import org.eclipse.core.runtime.CoreException; import org.eclipse.compare.internal.Utilities; /** * Abstract implementation for a buffered <code>IStreamContentAccessor</code>. * <p> * Subclasses must implement the <code>createStream</code> method * to connect the buffered content with a streamable source (e.g., a file). * <p> * As long as the contents of <code>BufferedContent</code> is only retrieved as an input stream * (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 ListenerList fListenerList; /** * Creates a buffered stream content accessor. */ protected BufferedContent() { // empty implementation } /* (non-Javadoc) * see IStreamContentAccessor.getContents */ public InputStream getContents() throws CoreException { if (fContent != null) return new ByteArrayInputStream(fContent); return createStream(); } /** * Creates and returns a stream for reading the contents. * <p> * Subclasses must implement this method. * </p> * * @return the stream from which the content is read * @exception CoreException if the contents could not be accessed */ protected abstract InputStream createStream() throws CoreException; /** * Sets the contents. Registered content change listeners are notified. * * @param contents the new contents */ public void setContent(byte[] contents) { fContent= contents; fireContentChanged(); } /** * Returns the contents as an array of bytes. * * @return the contents as an array of bytes, or <code>null</code> if * the contents could not be accessed */ public byte[] getContent() { if (fContent == null) { try { InputStream is= createStream(); fContent= Utilities.readBytes(is); } catch(CoreException ex) { // NeedWork } } return fContent; } /** * Discards the buffered content. */ public void discardBuffer() { fContent= null; } /* (non-Javadoc) * see IContentChangeNotifier.addChangeListener */ public void addContentChangeListener(IContentChangeListener listener) { if (fListenerList == null) fListenerList= new ListenerList(); fListenerList.add(listener); } /* (non-Javadoc) * see IContentChangeNotifier.removeChangeListener */ public void removeContentChangeListener(IContentChangeListener listener) { if (fListenerList != null) { fListenerList.remove(listener); if (fListenerList.isEmpty()) fListenerList= null; } } /** * Notifies all registered <code>IContentChangeListener</code>s of a content change. */ protected void fireContentChanged() { if (fListenerList != null) { Object[] listeners= fListenerList.getListeners(); for (int i= 0; i < listeners.length; i++) ((IContentChangeListener)listeners[i]).contentChanged(this); } } } --- NEW FILE: IPropertyChangeNotifier.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import org.eclipse.jface.util.IPropertyChangeListener; /** * Interface common to all objects that provide a means for registering * for property change notification. * <p> * Clients may implement this interface. * </p> * * @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. * * @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. * * @param listener a property change listener */ void removePropertyChangeListener(IPropertyChangeListener listener); } --- NEW FILE: NavigationAction.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.util.ResourceBundle; import org.eclipse.jface.action.Action; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.compare.internal.CompareMessages; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.Utilities; /** * A <code>NavigationAction</code> is used to navigate through the individual * differences of a <code>CompareEditorInput</code>. * <p> * Clients may instantiate this class; it is not intended to be subclassed. * </p> * @since 2.0 */ public class NavigationAction extends Action { private boolean fNext; private CompareEditorInput fCompareEditorInput; /** * Creates a <code>NavigationAction</code>. * * @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference. */ public NavigationAction(boolean next) { this(CompareUI.getResourceBundle(), next); } /** * Creates a <code>NavigationAction</code> that initializes its attributes * from the given <code>ResourceBundle</code>. * * @param bundle is used to initialize the action * @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference. */ public NavigationAction(ResourceBundle bundle, boolean next) { Utilities.initAction(this, bundle, next ? "action.Next." : "action.Previous."); //$NON-NLS-2$ //$NON-NLS-1$ fNext= next; } public void run() { if (fCompareEditorInput != null) { Object adapter= fCompareEditorInput.getAdapter(ICompareNavigator.class); if (adapter instanceof ICompareNavigator) { boolean atEnd= ((ICompareNavigator)adapter).selectChange(fNext); Shell shell= CompareUIPlugin.getShell(); if (atEnd && shell != null) { Display display= shell.getDisplay(); if (display != null) display.beep(); String title; String message; if (fNext) { title= CompareMessages.CompareNavigator_atEnd_title; message= CompareMessages.CompareNavigator_atEnd_message; } else { 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) { fCompareEditorInput= input; } } --- NEW FILE: EditionSelectionDialog.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.util.Arrays; import java.util.HashMap; import java.util.ResourceBundle; import java.util.Date; import java.util.List; import java.util.ArrayList; import java.util.Iterator; [...1099 lines suppressed...] } if (fCommitButton != null) { if (fMultiSelect) fCommitButton.setEnabled(isOK && fSelectedItem != null && fArrayList.size() > 0); else fCommitButton.setEnabled(isOK && fSelectedItem != null && fTargetPair.getItem() != fSelectedItem); } } /* * Feeds selection from structure viewer to content viewer. */ private void feedInput2(ISelection sel) { if (sel instanceof IStructuredSelection) { IStructuredSelection ss= (IStructuredSelection) sel; if (ss.size() == 1) fContentPane.setInput(ss.getFirstElement()); } } } --- NEW FILE: CompareConfiguration.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare; import java.util.HashMap; import org.eclipse.swt.graphics.Image; import org.eclipse.core.runtime.ListenerList; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.compare.internal.*; import org.eclipse.compare.structuremergeviewer.Differencer; /** * A <code>CompareConfiguration</code> object * controls various UI aspects of compare/merge viewers like * title labels and images, or whether a side of a merge viewer is editable. * In addition to these fixed properties <code>ICompareConfiguration</code> provides * API for an open ended set of properties. Different viewers which share the same * configuration can communicate via this mechanism. E.g. if a compare editor * has a button for controlling whether compare viewers ignore white space, * the button would trigger... [truncated message content] |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/ui/part In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/ui/part Added Files: FileEditorInput.java FileEditorInputFactory.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: FileEditorInputFactory.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.ui.part; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Path; import org.eclipse.ui.IElementFactory; import org.eclipse.ui.IMemento; /** * Factory for saving and restoring a <code>FileEditorInput</code>. * The stored representation of a <code>FileEditorInput</code> remembers * the full path of the file (that is, <code>IFile.getFullPath</code>). * <p> * The workbench will automatically create instances of this class as required. * It is not intended to be instantiated or subclassed by the client. * </p> */ public class FileEditorInputFactory implements IElementFactory { /** * Factory id. The workbench plug-in registers a factory by this name * with the "org.eclipse.ui.elementFactories" extension point. */ private static final String ID_FACTORY = "org.eclipse.ui.part.FileEditorInputFactory"; //$NON-NLS-1$ /** * Tag for the IFile.fullPath of the file resource. */ private static final String TAG_PATH = "path"; //$NON-NLS-1$ /** * Creates a new factory. */ public FileEditorInputFactory() { } /* (non-Javadoc) * Method declared on IElementFactory. */ public IAdaptable createElement(IMemento memento) { // Get the file name. String fileName = memento.getString(TAG_PATH); if (fileName == null) return null; // Get a handle to the IFile...which can be a handle // to a resource that does not exist in workspace IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( new Path(fileName)); if (file != null) return new FileEditorInput(file); else return null; } /** * Returns the element factory id for this class. * * @return the element factory id */ public static String getFactoryId() { return ID_FACTORY; } /** * Saves the state of the given file editor input into the given memento. * * @param memento the storage area for element state * @param input the file editor input */ public static void saveState(IMemento memento, FileEditorInput input) { IFile file = input.getFile(); memento.putString(TAG_PATH, file.getFullPath().toString()); } } --- NEW FILE: FileEditorInput.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.ui.part; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IStorage; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; //import org.eclipse.core.runtime.content.IContentType; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IMemento; import org.eclipse.ui.IPathEditorInput; import org.eclipse.ui.IPersistableElement; import org.eclipse.ui.PlatformUI; //import org.eclipse.ui.ide.IDE; /** * Adapter for making a file resource a suitable input for an editor. * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> */ public class FileEditorInput implements IFileEditorInput, IPathEditorInput, IPersistableElement { private IFile file; /** * Creates an editor input based of the given file resource. * * @param file the file resource */ public FileEditorInput(IFile file) { if (file == null) { throw new IllegalArgumentException(); } this.file = file; } /* (non-Javadoc) * Method declared on Object. */ public int hashCode() { return file.hashCode(); } /* (non-Javadoc) * Method declared on Object. * * The <code>FileEditorInput</code> implementation of this <code>Object</code> * method bases the equality of two <code>FileEditorInput</code> objects on the * equality of their underlying <code>IFile</code> resources. */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof IFileEditorInput)) return false; IFileEditorInput other = (IFileEditorInput) obj; return file.equals(other.getFile()); } /* (non-Javadoc) * Method declared on IEditorInput. */ public boolean exists() { return file.exists(); } /* (non-Javadoc) * Method declared on IAdaptable. */ public Object getAdapter(Class adapter) { if (adapter == IFile.class) return file; return file.getAdapter(adapter); } /* (non-Javadoc) * Method declared on IPersistableElement. */ public String getFactoryId() { return FileEditorInputFactory.getFactoryId(); } /* (non-Javadoc) * Method declared on IFileEditorInput. */ public IFile getFile() { return file; } /* (non-Javadoc) * Method declared on IEditorInput. */ public ImageDescriptor getImageDescriptor() { //IContentType contentType = IDE.getContentType(file); return PlatformUI.getWorkbench().getEditorRegistry() .getImageDescriptor(file.getName(), null); } /* (non-Javadoc) * Method declared on IEditorInput. */ public String getName() { return file.getName(); } /* (non-Javadoc) * Method declared on IEditorInput. */ public IPersistableElement getPersistable() { return this; } /* (non-Javadoc) * Method declared on IStorageEditorInput. */ public IStorage getStorage() throws CoreException { return file; } /* (non-Javadoc) * Method declared on IEditorInput. */ public String getToolTipText() { return file.getFullPath().makeRelative().toString(); } /* (non-Javadoc) * Method declared on IPersistableElement. */ public void saveState(IMemento memento) { FileEditorInputFactory.saveState(memento, this); } /* (non-Javadoc) * Method declared on IPathEditorInput * @since 3.0 * @issue consider using an internal adapter for IPathEditorInput rather than adding this as API */ public IPath getPath() { return file.getLocation(); } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return getClass().getName() + "(" + getFile().getFullPath() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/icons/full/obj16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/icons/full/obj16 Added Files: resource_obj.gif day_obj.gif Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: resource_obj.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: day_obj.gif --- (This appears to be a binary file; contents omitted.) |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/icons/full/etool16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/icons/full/etool16 Added Files: ignorews_edit.gif conflict_edit.gif Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: conflict_edit.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ignorews_edit.gif --- (This appears to be a binary file; contents omitted.) |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/ui Added Files: IFileEditorInput.java IStorageEditorInput.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: IStorageEditorInput.java --- package org.eclipse.ui; import org.eclipse.core.resources.IStorage; import org.eclipse.core.runtime.CoreException; /** * Interface for a <code>IStorage</code> input to an editor. * <p> * Clients implementing this editor input interface should override * <code>Object.equals(Object)</code> to answer true for two inputs * that are the same. The <code>IWorbenchPage.openEditor</code> APIs * are dependent on this to find an editor with the same input. * </p><p> * Clients should implement this interface to declare new types of * <code>IStorage</code> editor inputs. * </p><p> * File-oriented editors should support this as a valid input type, and display * its content for viewing (but not allow modification). * Within the editor, the "save" and "save as" operations should create a new * file resource within the workspace. * </p><p> * All editor inputs must implement the <code>IAdaptable</code> interface; * extensions are managed by the platform's adapter manager. * </p> */ public interface IStorageEditorInput extends IEditorInput { /** * Returns the underlying IStorage object. * * @return an IStorage object. * @exception CoreException if this method fails */ public IStorage getStorage() throws CoreException; } --- NEW FILE: IFileEditorInput.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.ui; import org.eclipse.core.resources.IFile; /** * This interface defines a file-oriented input to an editor. * <p> * Clients implementing this editor input interface should override * <code>Object.equals(Object)</code> to answer true for two inputs * that are the same. The <code>IWorbenchPage.openEditor</code> APIs * are dependent on this to find an editor with the same input. * </p><p> * File-oriented editors should support this as a valid input type, and allow * full read-write editing of its content. * </p><p> * A default implementation of this interface is provided by * org.eclipse.ui.part.FileEditorInput. * </p><p> * All editor inputs must implement the <code>IAdaptable</code> interface; * extensions are managed by the platform's adapter manager. * </p> * * @see org.eclipse.core.resources.IFile */ public interface IFileEditorInput extends IStorageEditorInput { /** * Returns the file resource underlying this editor input. * <p> * The <code>IFile</code> returned can be a handle to a resource * that does not exist in the workspace. As such, an editor should * provide appropriate feedback to the user instead of simply failing * during input validation. For example, a text editor could open * in read-only mode with a message in the text area to inform the * user that the file does not exist. * </p> * * @return the underlying file */ public IFile getFile(); } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/.settings In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/.settings Added Files: org.eclipse.jdt.core.prefs Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: org.eclipse.jdt.core.prefs --- #Tue Nov 30 15:51:47 CET 2004 org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled org.eclipse.jdt.core.compiler.problem.unusedImport=error org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.builder.invalidClasspath=abort org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch org.eclipse.jdt.core.compiler.problem.unusedLocal=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.source=1.3 org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.compliance=1.4 org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error org.eclipse.jdt.core.builder.cleanOutputFolder=clean org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning org.eclipse.jdt.core.classpath.exclusionPatterns=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled org.eclipse.jdt.core.incompatibleJDKLevel=ignore eclipse.preferences.version=1 org.eclipse.jdt.core.circularClasspath=error org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error org.eclipse.jdt.core.incompleteClasspath=error org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning org.eclipse.jdt.core.builder.duplicateResourceTask=warning org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/patch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/patch Added Files: WorkspacePatcherUI.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: WorkspacePatcherUI.java --- package org.eclipse.compare.patch; import org.eclipse.compare.internal.patch.WorkspacePatcher; 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 * 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: * <pre> * //Write out workspace patch header * stream.println(CompareUI.getWorkspacePatchHeader()); * for (int i=0; i<projects.length; i++){ * //Write out project header * stream.println(CompareUI.getWorkspacePatchProjectHeader(projects[i]); * //Write out patches in Unified Diff format * } * </pre> * @return String * @see WorkspacePatcherUI#getWorkspacePatchProjectHeader(IProject) * @since 3.2 */ public static String getWorkspacePatchHeader() { return WorkspacePatcher.MULTIPROJECTPATCH_HEADER+" "+WorkspacePatcher.MULTIPROJECTPATCH_VERSION; //$NON-NLS-1$ } /** * Returns the project header that must appear before any patches that apply to that * project. All patches that are encountered after this header and before the next header * are understood to belong the the project. * @param project project to be patched * @return String * @see WorkspacePatcherUI#getWorkspacePatchHeader() * @since 3.2 */ public static String getWorkspacePatchProjectHeader(IProject project) { return WorkspacePatcher.MULTIPROJECTPATCH_PROJECT+" "+ project.getName(); //$NON-NLS-1$ } } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:25
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/ui/views/contentoutline In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/ui/views/contentoutline Added Files: IContentOutlinePage.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: IContentOutlinePage.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.ui.views.contentoutline; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.ui.part.IPage; /** * Marker-style interface for a content outline page. This interface defines * the minimum requirement for pages within the content outline view, namely * they must be pages (implement <code>IPage</code>) and provide selections * (implement <code>ISelectionProvider</code>). * <p> * Access to a content outline page begins when an editor is activated. When * activation occurs, the content outline view will ask the editor for its * content outline page. This is done by invoking * <code>getAdapter(IContentOutlinePage.class)</code> on the editor. * If the editor returns a page, the view then creates the controls for that * page (using <code>createControl</code>) and makes the page visible. * </p> * <p> * Clients may implement this interface from scratch, or subclass the * abstract base class <code>ContentOutlinePage</code>. * </p> * <p> * Note that this interface extends <code>ISelectionProvider</code>. * This is no longer required in the case of implementors who also * implement <code>IPageBookViewPage</code> (or extend <code>Page</code>) * as they are now passed an <code>IPageSite</code> during their initialization * and this site can be configured with a selection provider. * However to avoid a breaking change * 1) this interface will continue to extend ISelectionProvider * 2) if an IContentOutlinePage does not set a selection provider for its * site, the ContentOutline will continue to use the page itself for * this purpose. * </p> * * @see ContentOutlinePage */ public interface IContentOutlinePage extends IPage, ISelectionProvider { } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:23
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/rangedifferencer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/rangedifferencer Added Files: RangeDifferencer.java LinkedRangeDifference.java RangeDifference.java package.html DifferencesIterator.java IRangeComparator.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: IRangeComparator.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.rangedifferencer; /** * For breaking an object to compare into a sequence of comparable entities. * <p> * It is used by <code>RangeDifferencer</code> to find longest sequences of * matching and non-matching ranges. * <p> * For example, to compare two text documents and find longest common sequences * of matching and non-matching lines, the implementation must break the document * into lines. <code>getRangeCount</code> would return the number of lines in the * document, and <code>rangesEqual</code> would compare a specified line given * with one in another <code>IRangeComparator</code>. * </p> * <p> * Clients should implement this interface; there is no standard implementation. * </p> */ public interface IRangeComparator { /** * Returns the number of comparable entities. * * @return the number of comparable entities */ int getRangeCount(); /** * Returns whether the comparable entity given by the first index * matches an entity specified by the other <code>IRangeComparator</code> and index. * * @param thisIndex the index of the comparable entity within this <code>IRangeComparator</code> * @param other the IRangeComparator to compare this with * @param otherIndex the index of the comparable entity within the other <code>IRangeComparator</code> * @return <code>true</code> if the comparable entities are equal */ boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex); /** * Returns whether a comparison should be skipped because it would be too costly (or lengthy). * * @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 * <code>true</code> or <code>false</code> * @param other the other <code>IRangeComparator</code> to compare with * @return <code>true</code> to avoid a too lengthy range comparison */ boolean skipRangeComparison(int length, int maxLength, IRangeComparator other); } --- NEW FILE: RangeDifference.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.rangedifferencer; /** * Description of a change between two or three ranges of comparable entities. * <p> * <code>RangeDifference</code> objects are the elements of a compare result returned from * the <code>RangeDifferencer</code> <code>find* </code> methods. * Clients use these objects as they are returned from the differencer. * This class is not intended to be instantiated or subclassed. * <p> * Note: A range in the <code>RangeDifference</code> object is given as a start index * and length in terms of comparable entities. However, these entity indices and counts * are not necessarily character positions. For example, if an entity represents a line * in a document, the start index would be a line number and the count would be in lines. * </p> * * @see RangeDifferencer */ public class RangeDifference { /** Two-way change constant indicating no change. */ public final static int NOCHANGE= 0; /** Two-way change constant indicating two-way change (same as <code>RIGHT</code>) */ public final static int CHANGE= 2; /** Three-way change constant indicating a change in both right and left. */ public final static int CONFLICT= 1; /** Three-way change constant indicating a change in right. */ public final static int RIGHT= 2; /** Three-way change constant indicating a change in left. */ public final static int LEFT= 3; /** * Three-way change constant indicating the same change in both right and left, * that is only the ancestor is different. */ public final static int ANCESTOR= 4; /** Constant indicating an unknown change kind. */ public final static int ERROR= 5; /** the kind of change: NOCHANGE, CHANGE, LEFT, RIGHT, ANCESTOR, CONFLICT, ERROR */ int fKind; int fLeftStart; int fLeftLength; int fRightStart; int fRightLength; int lAncestorStart; int lAncestorLength; /** * Creates a new range difference with the given change kind. * * @param changeKind the kind of change */ /* package */ RangeDifference(int changeKind) { fKind= changeKind; } /** * Creates a new <code>RangeDifference</code> with the given change kind * and left and right ranges. * * @param kind the kind of change * @param rightStart start index of entity on right side * @param rightLength number of entities on right side * @param leftStart start index of entity on left side * @param leftLength number of entities on left side */ /* package */ RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength) { fKind= kind; fRightStart= rightStart; fRightLength= rightLength; fLeftStart= leftStart; fLeftLength= leftLength; } /** * Creates a new <code>RangeDifference</code> with the given change kind * and left, right, and ancestor ranges. * * @param kind the kind of change * @param rightStart start index of entity on right side * @param rightLength number of entities on right side * @param leftStart start index of entity on left side * @param leftLength number of entities on left side * @param ancestorStart start index of entity on ancestor side * @param ancestorLength number of entities on ancestor side */ /* package */ RangeDifference(int kind, int rightStart, int rightLength, int leftStart, int leftLength, int ancestorStart, int ancestorLength) { this(kind, rightStart, rightLength, leftStart, leftLength); lAncestorStart= ancestorStart; lAncestorLength= ancestorLength; } /** * Returns the kind of difference. * * @return the kind of difference, one of * <code>NOCHANGE</code>, <code>CHANGE</code>, <code>LEFT</code>, <code>RIGHT</code>, * <code>ANCESTOR</code>, <code>CONFLICT</code>, <code>ERROR</code> */ public int kind() { return fKind; } /** * Returns the start index of the entity range on the ancestor side. * * @return the start index of the entity range on the ancestor side */ public int ancestorStart() { return lAncestorStart; } /** * Returns the number of entities on the ancestor side. * * @return the number of entities on the ancestor side */ public int ancestorLength() { return lAncestorLength; } /** * Returns the end index of the entity range on the ancestor side. * * @return the end index of the entity range on the ancestor side */ public int ancestorEnd() { return lAncestorStart + lAncestorLength; } /** * Returns the start index of the entity range on the right side. * * @return the start index of the entity range on the right side */ public int rightStart() { return fRightStart; } /** * Returns the number of entities on the right side. * * @return the number of entities on the right side */ public int rightLength() { return fRightLength; } /** * Returns the end index of the entity range on the right side. * * @return the end index of the entity range on the right side */ public int rightEnd() { return fRightStart + fRightLength; } /** * Returns the start index of the entity range on the left side. * * @return the start index of the entity range on the left side */ public int leftStart() { return fLeftStart; } /** * Returns the number of entities on the left side. * * @return the number of entities on the left side */ public int leftLength() { return fLeftLength; } /** * Returns the end index of the entity range on the left side. * * @return the end index of the entity range on the left side */ public int leftEnd() { return fLeftStart + fLeftLength; } /** * Returns the maximum number of entities in the left, right, and ancestor sides of this range. * * @return the maximum number of entities in the left, right, and ancestor sides of this range */ public int maxLength() { return Math.max(fRightLength, Math.max(fLeftLength, lAncestorLength)); } } --- NEW FILE: package.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="IBM"> <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]"> <title>Package-level Javadoc</title> </head> <body> Provides support for finding the differences between two or three sequences of comparable entities. <h2> Package Specification</h2> The class <b>RangeDifferencer</b> finds longest sequences of matching and non-matching comparable entities. Its implementation is based on an objectified version of the algorithm described in: <i>A File Comparison Program,</i> by Webb Miller and Eugene W. Myers, Software Practice and Experience, Vol. 15, Nov. 1985. <p> Clients must supply the input to the differencer as an implementation of the <b>IRangeComparator</b> interface. An <b>IRangeComparator</b> breaks the input data into a sequence of entities and provides a method for comparing one entity with the entity in another <b>IRangeComparator</b>. <p> For example, to compare two text documents and find longest common sequences of matching and non-matching lines, the implementation of <b>IRangeComparator</b> must break the document into lines and provide a method for testing whether two lines are considered equal. See <b>org.eclipse.compare.internal.DocLineComparator</b> for how this can be done. <p> The differencer returns the differences among these sequences as an array of <b>RangeDifference</b> objects. Every single <b>RangeDifference</b> describes the kind of difference (no change, change, addition, deletion) and the corresponding ranges of the underlying comparable entities in the two or three inputs. </body> </html> --- NEW FILE: DifferencesIterator.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.rangedifferencer; import java.util.ArrayList; import java.util.List; /** * A custom iterator to iterate over a List of <code>RangeDifferences</code>. * It is used internally by the <code>RangeDifferencer</code>. */ /* package */ class DifferencesIterator { List fRange; int fIndex; RangeDifference[] fArray; RangeDifference fDifference; /* * Creates a differences iterator on an array of <code>RangeDifference</code>s. */ DifferencesIterator(RangeDifference[] differenceRanges) { fArray= differenceRanges; fIndex= 0; fRange= new ArrayList(); if (fIndex < fArray.length) fDifference= fArray[fIndex++]; else fDifference= null; } /* * Returns the number of RangeDifferences */ int getCount() { return fRange.size(); } /* * Appends the edit to its list and moves to the next <code>RangeDifference</code>. */ void next() { fRange.add(fDifference); if (fDifference != null) { if (fIndex < fArray.length) fDifference= fArray[fIndex++]; else fDifference= null; } } /* * Difference iterators are used in pairs. * This method returns the other iterator. */ DifferencesIterator other(DifferencesIterator right, DifferencesIterator left) { if (this == right) return left; return right; } /* * Removes all <code>RangeDifference</code>s */ void removeAll() { fRange.clear(); } } --- NEW FILE: RangeDifferencer.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.rangedifferencer; import java.util.*; import org.eclipse.jface.util.Assert; import org.eclipse.core.runtime.IProgressMonitor; /** * A <code>RangeDifferencer</code> finds the differences between two or three <code>IRangeComparator</code>s. * <p> * To use the differencer, clients provide an <code>IRangeComparator</code> * that breaks their input data into a sequence of comparable entities. The differencer * returns the differences among these sequences as an array of <code>RangeDifference</code> objects * (<code>findDifferences</code> methods). * Every <code>RangeDifference</code> represents a single kind of difference * and the corresponding ranges of the underlying comparable entities in the * left, right, and optionally ancestor sides. * <p> * Alternatively, the <code>findRanges</code> methods not only return objects for * the differing ranges but for non-differing ranges too. * <p> * The algorithm used is an objectified version of one described in: * <it>A File Comparison Program,</it> by Webb Miller and Eugene W. Myers, * Software Practice and Experience, Vol. 15, Nov. 1985. * * @see IRangeComparator * @see RangeDifference */ public final class RangeDifferencer { private static final RangeDifference[] EMPTY_RESULT= new RangeDifference[0]; /* (non Javadoc) * Cannot be instantiated! */ private RangeDifferencer() { // nothing to do } /** * Finds the differences between two <code>IRangeComparator</code>s. * The differences are returned as an array of <code>RangeDifference</code>s. * If no differences are detected an empty array is returned. * * @param left the left range comparator * @param right the right range comparator * @return an array of range differences, or an empty array if no differences were found */ public static RangeDifference[] findDifferences(IRangeComparator left, IRangeComparator right) { return findDifferences((IProgressMonitor)null, left, right); } /** * Finds the differences between two <code>IRangeComparator</code>s. * The differences are returned as an array of <code>RangeDifference</code>s. * If no differences are detected an empty array is returned. * * @param pm if not <code>null</code> used to report progress * @param left the left range comparator * @param right the right range comparator * @return an array of range differences, or an empty array if no differences were found * @since 2.0 */ public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) { // assert that both IRangeComparators are of the same class Assert.isTrue(right.getClass().equals(left.getClass())); int rightSize= right.getRangeCount(); int leftSize= left.getRangeCount(); // // Differences matrix: // only the last d of each diagonal is stored, i.e., lastDiagonal[k] = row of d // int diagLen= 2 * Math.max(rightSize, leftSize); // bound on the size of edit script int maxDiagonal= diagLen; int lastDiagonal[]= new int[diagLen + 1]; // the row containing the last d // on diagonal k (lastDiagonal[k] = row) int origin= diagLen / 2; // origin of diagonal 0 // script corresponding to d[k] LinkedRangeDifference script[]= new LinkedRangeDifference[diagLen + 1]; int row, col; // find common prefix for (row= 0; row < rightSize && row < leftSize && rangesEqual(right, row, left, row) == true;) row++; lastDiagonal[origin]= row; script[origin]= null; int lower= (row == rightSize) ? origin + 1 : origin - 1; int upper= (row == leftSize) ? origin - 1 : origin + 1; if (lower > upper) return EMPTY_RESULT; //System.out.println("findDifferences: " + maxDiagonal + " " + lower + " " + upper); // for each value of the edit distance for (int d= 1; d <= maxDiagonal; ++d) { // d is the current edit distance if (pm != null) pm.worked(1); if (right.skipRangeComparison(d, maxDiagonal, left)) return EMPTY_RESULT; // should be something we already found // for each relevant diagonal (-d, -d+2 ..., d-2, d) for (int k= lower; k <= upper; k += 2) { // k is the current diagonal LinkedRangeDifference edit; if (pm != null && pm.isCanceled()) return EMPTY_RESULT; if (k == origin - d || k != origin + d && lastDiagonal[k + 1] >= lastDiagonal[k - 1]) { // // move down // row= lastDiagonal[k + 1] + 1; edit= new LinkedRangeDifference(script[k + 1], LinkedRangeDifference.DELETE); } else { // // move right // row= lastDiagonal[k - 1]; edit= new LinkedRangeDifference(script[k - 1], LinkedRangeDifference.INSERT); } col= row + k - origin; edit.fRightStart= row; edit.fLeftStart= col; Assert.isTrue(k >= 0 && k <= maxDiagonal); script[k]= edit; // slide down the diagonal as far as possible while (row < rightSize && col < leftSize && rangesEqual(right, row, left, col) == true) { ++row; ++col; } Assert.isTrue(k >= 0 && k <= maxDiagonal); // Unreasonable value for diagonal index lastDiagonal[k]= row; if (row == rightSize && col == leftSize) { //showScript(script[k], right, left); return createDifferencesRanges(script[k]); } if (row == rightSize) lower= k + 2; if (col == leftSize) upper= k - 2; } --lower; ++upper; } // too many differences Assert.isTrue(false); return null; } /** * Finds the differences among three <code>IRangeComparator</code>s. * The differences are returned as a list of <code>RangeDifference</code>s. * If no differences are detected an empty list is returned. * If the ancestor range comparator is <code>null</code>, a two-way * comparison is performed. * * @param ancestor the ancestor range comparator or <code>null</code> * @param left the left range comparator * @param right the right range comparator * @return an array of range differences, or an empty array if no differences were found */ public static RangeDifference[] findDifferences(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) { return findDifferences(null, ancestor, left, right); } /** * Finds the differences among three <code>IRangeComparator</code>s. * The differences are returned as a list of <code>RangeDifference</code>s. * If no differences are detected an empty list is returned. * If the ancestor range comparator is <code>null</code>, a two-way * comparison is performed. * * @param pm if not <code>null</code> used to report progress * @param ancestor the ancestor range comparator or <code>null</code> * @param left the left range comparator * @param right the right range comparator * @return an array of range differences, or an empty array if no differences were found * @since 2.0 */ public static RangeDifference[] findDifferences(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) { if (ancestor == null) return findDifferences(pm, left, right); RangeDifference[] leftAncestorScript= null; RangeDifference[] rightAncestorScript= findDifferences(pm, ancestor, right); if (rightAncestorScript != null) leftAncestorScript= findDifferences(pm, ancestor, left); if (rightAncestorScript == null || leftAncestorScript == null) return null; DifferencesIterator myIter= new DifferencesIterator(rightAncestorScript); DifferencesIterator yourIter= new DifferencesIterator(leftAncestorScript); List diff3= new ArrayList(); diff3.add(new RangeDifference(RangeDifference.ERROR)); // add a sentinel int changeRangeStart= 0; int changeRangeEnd= 0; // // Combine the two two-way edit scripts into one // while (myIter.fDifference != null || yourIter.fDifference != null) { DifferencesIterator startThread; myIter.removeAll(); yourIter.removeAll(); // // take the next diff that is closer to the start // if (myIter.fDifference == null) startThread= yourIter; else if (yourIter.fDifference == null) startThread= myIter; else { // not at end of both scripts take the lowest range if (myIter.fDifference.fLeftStart <= yourIter.fDifference.fLeftStart) // 2 -> common (Ancestor) change range startThread= myIter; else startThread= yourIter; } changeRangeStart= startThread.fDifference.fLeftStart; changeRangeEnd= startThread.fDifference.leftEnd(); startThread.next(); // // check for overlapping changes with other thread // merge overlapping changes with this range // DifferencesIterator other= startThread.other(myIter, yourIter); while (other.fDifference != null && other.fDifference.fLeftStart <= changeRangeEnd) { int newMax= other.fDifference.leftEnd(); other.next(); if (newMax >= changeRangeEnd) { changeRangeEnd= newMax; other= other.other(myIter, yourIter); } } diff3.add(createRangeDifference3(myIter, yourIter, diff3, right, left, changeRangeStart, changeRangeEnd)); } // remove sentinel diff3.remove(0); return (RangeDifference[]) diff3.toArray(EMPTY_RESULT); } /** * Finds the differences among two <code>IRangeComparator</code>s. * In contrast to <code>findDifferences</code>, the result * contains <code>RangeDifference</code> elements for non-differing ranges too. * * @param left the left range comparator * @param right the right range comparator * @return an array of range differences */ public static RangeDifference[] findRanges(IRangeComparator left, IRangeComparator right) { return findRanges((IProgressMonitor)null, left, right); } /** * Finds the differences among two <code>IRangeComparator</code>s. * In contrast to <code>findDifferences</code>, the result * contains <code>RangeDifference</code> elements for non-differing ranges too. * * @param pm if not <code>null</code> used to report progress * @param left the left range comparator * @param right the right range comparator * @return an array of range differences * @since 2.0 */ public static RangeDifference[] findRanges(IProgressMonitor pm, IRangeComparator left, IRangeComparator right) { RangeDifference[] in= findDifferences(pm, left, right); List out= new ArrayList(); RangeDifference rd; int mstart= 0; int ystart= 0; for (int i= 0; i < in.length; i++) { RangeDifference es= in[i]; rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart); if (rd.maxLength() != 0) out.add(rd); out.add(es); mstart= es.rightEnd(); ystart= es.leftEnd(); } rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart); if (rd.maxLength() > 0) out.add(rd); return (RangeDifference[]) out.toArray(EMPTY_RESULT); } /** * Finds the differences among three <code>IRangeComparator</code>s. * In contrast to <code>findDifferences</code>, the result * contains <code>RangeDifference</code> elements for non-differing ranges too. * If the ancestor range comparator is <code>null</code>, a two-way * comparison is performed. * * @param ancestor the ancestor range comparator or <code>null</code> * @param left the left range comparator * @param right the right range comparator * @return an array of range differences */ public static RangeDifference[] findRanges(IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) { return findRanges(null, ancestor, left, right); } /** * Finds the differences among three <code>IRangeComparator</code>s. * In contrast to <code>findDifferences</code>, the result * contains <code>RangeDifference</code> elements for non-differing ranges too. * If the ancestor range comparator is <code>null</code>, a two-way * comparison is performed. * * @param pm if not <code>null</code> used to report progress * @param ancestor the ancestor range comparator or <code>null</code> * @param left the left range comparator * @param right the right range comparator * @return an array of range differences * @since 2.0 */ public static RangeDifference[] findRanges(IProgressMonitor pm, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) { if (ancestor == null) return findRanges(pm, left, right); RangeDifference[] in= findDifferences(pm, ancestor, left, right); List out= new ArrayList(); RangeDifference rd; int mstart= 0; int ystart= 0; int astart= 0; for (int i= 0; i < in.length; i++) { RangeDifference es= in[i]; rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, es.rightStart() - mstart, ystart, es.leftStart() - ystart, astart, es.ancestorStart() - astart); if (rd.maxLength() > 0) out.add(rd); out.add(es); mstart= es.rightEnd(); ystart= es.leftEnd(); astart= es.ancestorEnd(); } rd= new RangeDifference(RangeDifference.NOCHANGE, mstart, right.getRangeCount() - mstart, ystart, left.getRangeCount() - ystart, astart, ancestor.getRangeCount() - astart); if (rd.maxLength() > 0) out.add(rd); return (RangeDifference[]) out.toArray(EMPTY_RESULT); } //---- private methods /* * Creates a Vector of DifferencesRanges out of the LinkedRangeDifference. * It coalesces adjacent changes. * In addition, indices are changed such that the ranges are 1) open, i.e, * the end of the range is not included, and 2) are zero based. */ private static RangeDifference[] createDifferencesRanges(LinkedRangeDifference start) { LinkedRangeDifference ep= reverseDifferences(start); ArrayList result= new ArrayList(); RangeDifference es= null; while (ep != null) { es= new RangeDifference(RangeDifference.CHANGE); if (ep.isInsert()) { es.fRightStart= ep.fRightStart + 1; es.fLeftStart= ep.fLeftStart; RangeDifference b= ep; do { ep= ep.getNext(); es.fLeftLength++; } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart); } else { es.fRightStart= ep.fRightStart; es.fLeftStart= ep.fLeftStart; RangeDifference a= ep; // // deleted lines // do { a= ep; ep= ep.getNext(); es.fRightLength++; } while (ep != null && ep.isDelete() && ep.fRightStart == a.fRightStart + 1); boolean change= (ep != null && ep.isInsert() && ep.fRightStart == a.fRightStart); if (change) { RangeDifference b= ep; // // replacement lines // do { ep= ep.getNext(); es.fLeftLength++; } while (ep != null && ep.isInsert() && ep.fRightStart == b.fRightStart); } else { es.fLeftLength= 0; } es.fLeftStart++; // meaning of range changes from "insert after", to "replace with" } // // the script commands are 1 based, subtract one to make them zero based // es.fRightStart--; es.fLeftStart--; result.add(es); } return (RangeDifference[]) result.toArray(EMPTY_RESULT); } /* * Creates a <code>RangeDifference3</code> given the * state of two DifferenceIterators. */ private static RangeDifference createRangeDifference3(DifferencesIterator myIter, DifferencesIterator yourIter, List diff3, IRangeComparator right, IRangeComparator left, int changeRangeStart, int changeRangeEnd) { int rightStart, rightEnd; int leftStart, leftEnd; int kind= RangeDifference.ERROR; RangeDifference last= (RangeDifference) diff3.get(diff3.size() - 1); Assert.isTrue((myIter.getCount() != 0 || yourIter.getCount() != 0)); // At least one range array must be non-empty // // find corresponding lines to fChangeRangeStart/End in right and left // if (myIter.getCount() == 0) { // only left changed rightStart= changeRangeStart - last.ancestorEnd() + last.rightEnd(); rightEnd= changeRangeEnd - last.ancestorEnd() + last.rightEnd(); kind= RangeDifference.LEFT; } else { RangeDifference f= (RangeDifference) myIter.fRange.get(0); RangeDifference l= (RangeDifference) myIter.fRange.get(myIter.fRange.size() - 1); rightStart= changeRangeStart - f.fLeftStart + f.fRightStart; rightEnd= changeRangeEnd - l.leftEnd() + l.rightEnd(); } if (yourIter.getCount() == 0) { // only right changed leftStart= changeRangeStart - last.ancestorEnd() + last.leftEnd(); leftEnd= changeRangeEnd - last.ancestorEnd() + last.leftEnd(); kind= RangeDifference.RIGHT; } else { RangeDifference f= (RangeDifference) yourIter.fRange.get(0); RangeDifference l= (RangeDifference) yourIter.fRange.get(yourIter.fRange.size() - 1); leftStart= changeRangeStart - f.fLeftStart + f.fRightStart; leftEnd= changeRangeEnd - l.leftEnd() + l.rightEnd(); } if (kind == RangeDifference.ERROR) { // overlapping change (conflict) -> compare the changed ranges if (rangeSpansEqual(right, rightStart, rightEnd - rightStart, left, leftStart, leftEnd - leftStart)) kind= RangeDifference.ANCESTOR; else kind= RangeDifference.CONFLICT; } return new RangeDifference(kind, rightStart, rightEnd - rightStart, leftStart, leftEnd - leftStart, changeRangeStart, changeRangeEnd - changeRangeStart); } /* * Tests if two ranges are equal */ private static boolean rangesEqual(IRangeComparator a, int ai, IRangeComparator b, int bi) { return a.rangesEqual(ai, b, bi); } /* * Tests whether <code>right</code> and <code>left</code> changed in the same way */ private static boolean rangeSpansEqual(IRangeComparator right, int rightStart, int rightLen, IRangeComparator left, int leftStart, int leftLen) { if (rightLen == leftLen) { int i= 0; for (i= 0; i < rightLen; i++) { if (!rangesEqual(right, rightStart + i, left, leftStart + i)) break; } if (i == rightLen) return true; } return false; } /* * Reverses the range differences */ private static LinkedRangeDifference reverseDifferences(LinkedRangeDifference start) { LinkedRangeDifference ep, behind, ahead; ahead= start; ep= null; while (ahead != null) { behind= ep; ep= ahead; ahead= ahead.getNext(); ep.setNext(behind); } return ep; } } --- NEW FILE: LinkedRangeDifference.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.rangedifferencer; /* package */ class LinkedRangeDifference extends RangeDifference { static final int INSERT= 0; static final int DELETE= 1; LinkedRangeDifference fNext; /* * Creates a LinkedRangeDifference an initializes it to the error state */ LinkedRangeDifference() { super(ERROR); fNext= null; } /* * Constructs and links a LinkeRangeDifference to another LinkedRangeDifference */ LinkedRangeDifference(LinkedRangeDifference next, int operation) { super(operation); fNext= next; } /* * Follows the next link */ LinkedRangeDifference getNext() { return fNext; } boolean isDelete() { return kind() == DELETE; } boolean isInsert() { return kind() == INSERT; } /* * Sets the next link of this LinkedRangeDifference */ void setNext(LinkedRangeDifference next) { fNext= next; } } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:23
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/ui/views/navigator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/ui/views/navigator Added Files: ResourceSorter.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: ResourceSorter.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.ui.views.navigator; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; /** * Sorter for viewers that display items of type <code>IResource</code>. * The sorter supports two sort criteria: * <p> * <code>NAME</code>: Folders are given order precedence, followed by files. * Within these two groups resources are ordered by name. All name comparisons * are case-insensitive. * </p> * <p> * <code>TYPE</code>: Folders are given order precedence, followed by files. * Within these two groups resources are ordered by extension. All extension * comparisons are case-insensitive. * </p> * <p> * This class may be instantiated; it is not intended to be subclassed. * </p> */ public class ResourceSorter extends ViewerSorter { /** * Constructor argument value that indicates to sort items by name. */ public final static int NAME = 1; /** * Constructor argument value that indicates to sort items by extension. */ public final static int TYPE = 2; private int criteria; /** * Creates a resource sorter that will use the given sort criteria. * * @param criteria the sort criterion to use: one of <code>NAME</code> or * <code>TYPE</code> */ public ResourceSorter(int criteria) { super(); this.criteria = criteria; } /** * Returns an integer value representing the relative sort priority of the * given element based on its class. * <p> * <ul> * <li>resources (<code>IResource</code>) - 2</li> * <li>project references (<code>ProjectReference</code>) - 1</li> * <li>everything else - 0</li> * </ul> * </p> * * @param element the element * @return the sort priority (larger numbers means more important) */ protected int classComparison(Object element) { if (element instanceof IResource) { return 2; } return 0; } /* (non-Javadoc) * Method declared on ViewerSorter. */ public int compare(Viewer viewer, Object o1, Object o2) { //have to deal with non-resources in navigator //if one or both objects are not resources, returned a comparison //based on class. if (!(o1 instanceof IResource && o2 instanceof IResource)) { return compareClass(o1, o2); } IResource r1 = (IResource) o1; IResource r2 = (IResource) o2; if (r1 instanceof IContainer && r2 instanceof IContainer) return compareNames(r1, r2); else if (r1 instanceof IContainer) return -1; else if (r2 instanceof IContainer) return 1; else if (criteria == NAME) return compareNames(r1, r2); else if (criteria == TYPE) return compareTypes(r1, r2); else return 0; } /** * Returns a number reflecting the collation order of the given elements * based on their class. * * @param element1 the first element to be ordered * @param element2 the second element to be ordered * @return a negative number if the first element is less than the * second element; the value <code>0</code> if the first element is * equal to the second element; and a positive number if the first * element is greater than the second element */ protected int compareClass(Object element1, Object element2) { return classComparison(element1) - classComparison(element2); } /** * Returns a number reflecting the collation order of the given resources * based on their resource names. * * @param resource1 the first resource element to be ordered * @param resource2 the second resource element to be ordered * @return a negative number if the first element is less than the * second element; the value <code>0</code> if the first element is * equal to the second element; and a positive number if the first * element is greater than the second element */ protected int compareNames(IResource resource1, IResource resource2) { return collator.compare(resource1.getName(), resource2.getName()); } /** * Returns a number reflecting the collation order of the given resources * based on their respective file extensions. Resources with the same file * extension will be collated based on their names. * * @param resource1 the first resource element to be ordered * @param resource2 the second resource element to be ordered * @return a negative number if the first element is less than the * second element; the value <code>0</code> if the first element is * equal to the second element; and a positive number if the first * element is greater than the second element */ protected int compareTypes(IResource resource1, IResource resource2) { String ext1 = getExtensionFor(resource1); String ext2 = getExtensionFor(resource2); // Compare extensions. If they're different then return a value that // indicates correct extension ordering. If they're the same then // return a value that indicates the correct NAME ordering. int result = collator.compare(ext1, ext2); if (result != 0) // ie.- different extensions return result; return compareNames(resource1, resource2); } /** * Returns the sort criteria of this sorter. * * @return the sort criterion: one of <code>NAME</code> or <code>TYPE</code> */ public int getCriteria() { return criteria; } /** * Returns the extension portion of the given resource. * * @param resource the resource * @return the file extension, possibily the empty string */ private String getExtensionFor(IResource resource) { String ext = resource.getFileExtension(); return ext == null ? "" : ext; //$NON-NLS-1$ } /** * Sets the sort criteria of this sorter. * * @param criteria the sort criterion: * one of <code>ResourceSorter.NAME</code> or * <code>ResourceSorter.TYPE</code> */ public void setCriteria(int criteria) { this.criteria = criteria; } } |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:20
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127 Added Files: component.xml .project plugin.xml old_buildnotes_compare_3_1.html .cvsignore plugin.properties build.properties .classpath old_buildnotes_compare_3_0.html about.html buildnotes_compare.html Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: .cvsignore --- bin --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>org.jcommander.eclipsepatch.compare</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.pde.SchemaBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.pde.PluginNature</nature> </natures> </projectDescription> --- NEW FILE: plugin.properties --- ############################################################################### # Copyright (c) 2000, 2004 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # 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 ############################################################################### # # Resource strings for Compare Plug-in # pluginName= Compare Support providerName=Eclipse.org # # Extension point names # streamMergers= Stream Merger structureCreators= Structure Creator structureMergeViewers= Structure Merge Viewer contentMergeViewers= Content Merge Viewer contentViewers= Content Viewer # # CompareUIPlugin # CompareUIPlugin.dialogTitle=Compare CompareUIPlugin.noActiveWorkbenchPage=Cannot find active workbench page CompareUIPlugin.compareFailed=Compare Failed CompareUIPlugin.openEditorError=Problems Opening Editor CompareUIPlugin.noDifferences=There are no differences between the selected inputs. CompareUIPlugin.targetIdAttributeMissing=target id attribute ''{0}'' missing CompareUIPlugin.contentTypeNotFound=content type ''{0}'' not found CompareUIPlugin.targetNotFound=target ''{0}'' not found CompareUIPlugin.unexpectedTag=expected tag ''{1}'', got ''{0}'' # # Compare Editor # defaultCompareEditor.name= Default Compare Editor CompareEditor.saveError.title= Save Error CompareEditor.cantSaveError= Cannot save contents ({0}) CompareEditor.invalidInput=Invalid input: not a CompareEditorInput CompareEditor.error.setinput.title=Problem opening input CompareEditor.error.setinput.message=Cannot open input: # # Commands # compareCategory.name= Compare compareCategory.description= Compare command category Command.copyRightToLeft.name= Copy from Right to Left Command.copyRightToLeft.description= Copy Current Change from Right to Left Command.copyLeftToRight.name= Copy from Left to Right Command.copyLeftToRight.description= Copy Current Change from Left to Right Command.copyAllRightToLeft.name= Copy All from Right to Left Command.copyAllRightToLeft.description= Copy All Changes from Right to Left Command.copyAllLeftToRight.name= Copy All from Left to Right Command.copyAllLeftToRight.description= Copy All Changes from Left to Right Command.selectNextChange.name= Select Next Change Command.selectNextChange.description= Select Next Change Command.selectPreviousChange.name= Select Previous Change Command.selectPreviousChange.description= Select Previous Change # # Context menu & actions # CompareWithMenu.label= Comp&are With CompareWithEachOtherAction.label= &Each Other CompareWithEachOtherAction.tooltip= Compare the Selected Resources TeamMenu.label= T&eam CompareWithPatchAction.label= &Apply Patch... CompareWithPatchAction.tooltip= Apply a Patch to the Selected Resources CompareWithHistoryAction.label= &Local History... CompareWithHistoryAction.tooltip= Compare the Selected Resource with Local History ReplaceWithMenu.label= Rep&lace With ReplaceFromHistoryAction.label= &Local History... ReplaceFromHistoryAction.tooltip= Replace the Selected Resource with Local History ReplaceWithPreviousFromHistoryAction.label= &Previous from Local History ReplaceWithPreviousFromHistoryAction.tooltip= Replace the Selected Resource with the Previous from Local History addFromHistoryAction.label= Restore from Local Histor&y... addFromHistoryAction.tooltip= Restore Deleted Files from Local History # # Preference Page # ComparePreferencePage.name= Compare/Patch ComparePreferencePage.generalTab.label= &General ComparePreferencePage.structureCompare.label= &Open structure compare automatically ComparePreferencePage.showMoreInfo.label= &Show additional compare information in the status line ComparePreferencePage.ignoreWhitespace.label= Ignore &white space ComparePreferencePage.saveBeforePatching.label= A&utomatically save dirty editors before patching ComparePreferencePage.filter.description= Enter member names that should be excluded from 'Compare With Each Other'.\nList is comma separated (e.g. '*.class, .project, bin/') ComparePreferencePage.filter.label= &Filtered Members: ComparePreferencePage.filter.invalidsegment.error= Filter is invalid: {0} ComparePreferencePage.textCompareTab.label= &Text Compare ComparePreferencePage.initiallyShowAncestorPane.label= Initially show a&ncestor pane ComparePreferencePage.showPseudoConflicts.label= Show &pseudo conflicts ComparePreferencePage.synchronizeScrolling.label= Synchronize &scrolling between panes in compare viewers ComparePreferencePage.useSingleLine.label= Connect &ranges with single line ComparePreferencePage.preview.label= Preview: ComparePreferencePage.ancestor.label= Common Ancestor ComparePreferencePage.left.label= Local ComparePreferencePage.right.label= Remote ComparePreferencePage.backgroundColor1.label= Bac&kground Color: ComparePreferencePage.backgroundColor2.label= S&ystem Default ComparePreferencePage.backgroundColor3.label= C&ustom # Compare editor contents for Compare preview page ComparePreferencePage.previewAncestor= 1\n2\n3\nconflict\n4\n5 ComparePreferencePage.previewLeft= 1\n2\noutgoing addition\n3\noutgoing change\n4\npseudo conflict\n5 ComparePreferencePage.previewRight= 1\nincoming addition\nincoming addition\n2\n3\nincoming change\n4\npseudo conflict\n5 ComparePreferencePage.colorAndFontLink=See '<a>Colors and Fonts</a>' preferences for text compare colors and fonts. textCompareAppearance.label=Text Compare compareIncomingColor.label= Incoming change color compareIncomingColor.description= The color used to indicate an incoming change in compare and merge tools. compareOutgoingColor.label= Outgoing change color compareOutgoingColor.description= The color used to indicate an outgoing change in compare and merge tools. compareConflictColor.label= Conflicting change color compareConflictColor.description= The color used to indicate a conflicting change in compare and merge tools. compareResolvedColor.label= Resolved change color compareResolvedColor.description= The color used to indicate a resolved change in merge tools. compareFontDefiniton.label= Compare text font compareFontDefiniton.description= The compare text font is used by textual compare/merge tools. preferenceKeywords.general=merge merging whitespace filter synchronize scolling ancestor conflict line pseudo # New UI #ComparePreferencePage.useSplines.label= Use splines in center panel #ComparePreferencePage.useResolveUI.label= Use new resolve UI CompareEditorInput.defaultTitle= Compare # # Toolbar actions # action.IgnoreWhiteSpace.label=Ignore White Space action.IgnoreWhiteSpace.tooltip=Ignore White Space Where Applicable action.IgnoreWhiteSpace.image=etool16/ignorews_edit.gif action.Next.label=Next Difference action.Next.tooltip=Go to Next Difference action.Next.image=elcl16/next_nav.gif action.Previous.label=Previous Difference action.Previous.tooltip=Go to Previous Difference action.Previous.image=elcl16/prev_nav.gif # # Built in Structure Creators # ZipStructureCreator.name=Zip Archive Compare # # Compare Dialog # CompareDialog.commitAction.label=Commit CompareDialog.saveErrorTitle=Save Error CompareDialog.saveErrorMessage=Cannot save # # Compare With Each Other # ResourceCompare.taskName=Operation in Progress... ResourceCompare.twoWay.title=Compare ({0}-{1}) ResourceCompare.twoWay.tooltip=Two-way compare of {0} with {1} ResourceCompare.threeWay.title=Compare ({0}-{1}-{2}) ResourceCompare.threeWay.tooltip=Three-way compare of {1} and {2} relative to common ancestor {0} # # DiffTreeViewer & DiffNodes # DiffTreeViewer.title= Structure Compare DiffNode.noName= <no name> DiffNode.nameFormat= {0} / {1} # # Differencing engine # Differencer.progressFormat= Comparing {0} # # Patch: rejected patch markers # rejectedPatchMarker.name= Rejected Patch # # ValidateEdit # ValidateEdit.error.unable_to_perform= Operation cannot be performed. ValidateEdit.error.fileModified= File ''{0}'' has been modified since the beginning of the operation. ValidateEdit.error.stillReadonly= File ''{0}'' is read-only. --- NEW FILE: about.html --- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>About</title> <meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1"> </head> <body lang="EN-US"> <h2>About This Content</h2> <p>February 24, 2005</p> <h3>License</h3> <p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. For purposes of the EPL, "Program" will mean the Content.</p> <p>If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content.</p> </body> </html> --- NEW FILE: .classpath --- <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="compare/"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="output" path="bin"/> </classpath> --- NEW FILE: old_buildnotes_compare_3_0.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]"> <meta name="Author" content="IBM"> <title>Eclipse Platform Release Notes - Desktop</title> </head> <body> <h1> Eclipse Platform Build Notes<br> Compare</h1> Eclipse Build Input June 17th 2004 (RC3) <h2> Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=37648">37648</a>: Exceptions after one of the compare viewer inputs got deleted<br> [...1518 lines suppressed...] 1GI5DN9: ITPUI:WIN2000 - Conflicting token deletions don't show up in text compare viewer<br> 1GI3KUR: ITPJUI:WIN2000 - Compare: double-click in versions list closes view<br> 1GFFR4B: ITPUI:WIN98 - local history is misleading<br> 1GBM0IL: ITPUI:WINNT - CompareEditorInput#save should throw CoreException<br> 1GI99LE: ITPUI:ALL - Compare viewer does not show last line when horizontal scroll bar is present<br> 1GBB34N: ITPJUI:WIN2000 - Compare Viewer doesn't scroll to last line<br> 1GGZ8DO: ITPJUI:WIN - MergeViewer invalid selection range<br> 1GIIBHM: ITPUI:WIN2000 - Problems when comparing zip files<br> 1GIKKOZ: ITPUI:ALL - alt copyright text in html doc needs update<br> 1GIURNB: ITPUI:ALL - property file of EditionSelectionDialog contains configuration options<br> 1GIUS6L: ITPUI:ALL - TextMergeViewer uses deprecated Thread.stop()<br> 1GI3HDZ: ITPJUI:ALL - Compare: conflicts with no ancestor does not show differences<br> 1GEUX0D: ITPJUI:ALL - not state aware toolbar button in compare<br> <h2> Problem reports closed</h2> 1GF9Y9C: ITPUI:WIN2000 - DCR: only get ancestor pane contents if pane is visible<br> </body> </html> --- NEW FILE: buildnotes_compare.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="IBM"> <title>Eclipse Platform Release Notes - Desktop</title> </head> <body> <h1> Eclipse Platform Build Notes<br> Compare</h1> Eclipse Build Input February 28th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=114108">114108</a>: [Patch] Apply patch does nothing if Finish is selected on first page<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=132275">132275</a>: Apply Patch Wizard problems<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input February 28th 2005 <h2>Problem reports fixed</h2> some artwork changed from *.gif to *.png<br> removed a deprecation<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input February 14th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=126685">126685</a>: org.eclipse.compare.internal.Utilities.java's internalGetResources() method does not take ResourceMapping into consideration<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input February 7th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=126442">126442</a>: Leak: CompareViewerPane and created ToolBar<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=125997">125997</a>: Make EditionSelectionDialog.setHelpContextId API<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=126230">126230</a>: CompareEditor and ISaveableModelSource<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input January 31th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=125379">125379</a>: CompareConfiguration uses ListenerList that has been removed<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=125149">125149</a>: Unexported package and exceptions ignored when creating IViewerCreator<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input December 13th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=115395">115395</a>: TextStreamMerger always uses '\n' as line ending<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 22th 2005 <h2>Problem reports fixed</h2> Updated the version of org.eclipse.compare to 3.2.0.qualifier and added version ranges to the dependencies.<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 15th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=116318">116318</a>: Ambiguous use of Assert and ListenerList<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input October 25th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=110481">110481</a>: Ability for Apply Patch wizard to work with multiple-project patches<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input October 18th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=112400">112400</a>: Change required due to ResourceMapping API<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input October 10th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=110481">110481</a>: Ability for Apply Patch wizard to work with multiple-project patches<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input 3.2 M1 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=105230">105230</a>: [BIDI] need to add $nl$/ to icon paths for reversed icons<br> </body> </html> --- NEW FILE: component.xml --- <?xml version="1.0" encoding="UTF-8"?> <component xmlns="http://eclipse.org/component" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://eclipse.org/component ../component.xsd " name="Compare Support"> <plugin id="org.eclipse.compare" /> <package name="org.eclipse.compare"> <type name= "BufferedContent"/> <type name= "CompareConfiguration"/> <type name= "CompareEditorInput"/> <type name= "CompareUI" subclass="false" instantiate="false"/> <type name= "CompareViewerPane"/> <type name= "CompareViewerSwitchingPane"/> <type name= "EditionSelectionDialog" subclass="false"/> <type name= "HistoryItem" subclass="false"/> <type name= "ICompareNavigator"/> <type name= "IContentChangeListener"/> <type name= "IContentChangeNotifier"/> <type name= "IEditableContent"/> <type name= "IEncodedStreamContentAccessor"/> <type name= "IModificationDate"/> <type name= "IPropertyChangeNotifier"/> <type name= "IResourceProvider"/> <type name= "IStreamContentAccessor"/> <type name= "IStreamMerger"/> <type name= "ITypedElement"/> <type name= "IViewerCreator"/> <type name= "NavigationAction" subclass="false"/> <type name= "ResourceNode" subclass="false"/> <type name= "Splitter"/> <type name= "ZipFileStructureCreator"/> </package> <package name="org.eclipse.compare.contentmergeviewer"> <type name= "ContentMergeViewer"/> <type name= "IDocumentRange"/> <type name= "IMergeViewerContentProvider"/> <type name= "ITokenComparator"/> <type name= "TextMergeViewer"/> </package> <package name="org.eclipse.compare.rangedifferencer"> <type name= "IRangeComparator"/> <type name= "RangeDifference" subclass="false" instantiate="false"/> <type name= "RangeDifferencer" subclass="false"/> </package> <package name="org.eclipse.compare.structuremergeviewer"> <type name= "DiffContainer"/> <type name= "DiffElement"/> <type name= "Differencer"/> <type name= "DiffNode"/> <type name= "DiffTreeViewer" subclass="false"/> <type name= "DocumentRangeNode"/> <type name= "ICompareInput"/> <type name= "ICompareInputChangeListener"/> <type name= "IDiffContainer"/> <type name= "IDiffElement"/> <type name= "IStructureComparator"/> <type name= "IStructureCreator"/> <type name= "StructureDiffViewer" subclass="false"/> </package> <package name="org.eclipse.compare.patch"> <type name= "WorkspacePatcherUI" subclass="false" instantiate="false"/> </package> <component-depends unrestricted="true"/> </component> --- NEW FILE: plugin.xml --- <?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin> <!-- Compare extension point definitions --> <extension-point id="streamMergers" name="%streamMergers" schema="schema/streamMergers.exsd"/> <extension-point id="structureCreators" name="%structureCreators" schema="schema/structureCreators.exsd"/> <extension-point id="structureMergeViewers" name="%structureMergeViewers" schema="schema/structureMergeViewers.exsd"/> <extension-point id="contentMergeViewers" name="%contentMergeViewers" schema="schema/contentMergeViewers.exsd"/> <extension-point id="contentViewers" name="%contentViewers" schema="schema/contentViewers.exsd"/> <!-- Extensions --> <extension point="org.eclipse.ui.themes"> <themeElementCategory label="%textCompareAppearance.label" id="org.eclipse.compare.contentmergeviewer.TextMergeViewer"> </themeElementCategory> <colorDefinition label="%compareIncomingColor.label" categoryId="org.eclipse.compare.contentmergeviewer.TextMergeViewer" value="COLOR_BLUE" id="INCOMING_COLOR"> <description> %compareIncomingColor.description </description> </colorDefinition> <colorDefinition label="%compareOutgoingColor.label" categoryId="org.eclipse.compare.contentmergeviewer.TextMergeViewer" value="COLOR_BLACK" id="OUTGOING_COLOR"> <description> %compareOutgoingColor.description </description> </colorDefinition> <colorDefinition label="%compareConflictColor.label" categoryId="org.eclipse.compare.contentmergeviewer.TextMergeViewer" value="COLOR_RED" id="CONFLICTING_COLOR"> <description> %compareConflictColor.description </description> </colorDefinition> <colorDefinition label="%compareResolvedColor.label" categoryId="org.eclipse.compare.contentmergeviewer.TextMergeViewer" value="COLOR_GREEN" id="RESOLVED_COLOR"> <description> %compareResolvedColor.description </description> </colorDefinition> <fontDefinition label="%compareFontDefiniton.label" defaultsTo="org.eclipse.jface.textfont" categoryId="org.eclipse.compare.contentmergeviewer.TextMergeViewer" id="org.eclipse.compare.contentmergeviewer.TextMergeViewer"> <description> %compareFontDefiniton.description </description> </fontDefinition> </extension> <extension id="rejectedPatchMarker" name="%rejectedPatchMarker.name" point="org.eclipse.core.resources.markers"> <super type="org.eclipse.core.resources.taskmarker"> </super> <persistent value="true"> </persistent> </extension> <extension point="org.eclipse.ui.editors"> <editor name="%defaultCompareEditor.name" icon="$nl$/icons/full/eview16/compare_view.gif" contributorClass="org.eclipse.compare.internal.CompareEditorContributor" class="org.eclipse.compare.internal.CompareEditor" id="org.jcommander.eclipsepatch.compare.CompareEditor"> </editor> </extension> <extension point="org.eclipse.ui.preferencePages"> <page name="%ComparePreferencePage.name" category="org.eclipse.ui.preferencePages.Workbench" class="org.eclipse.compare.internal.ComparePreferencePage" id="org.eclipse.compare.internal.ComparePreferencePage"> <keywordReference id="org.eclipse.compare.general"/> </page> </extension> <extension point="org.eclipse.ui.keywords"> <keyword label="%preferenceKeywords.general" id="org.eclipse.compare.general"/> </extension> <!-- commands and their bindings --> <extension point="org.eclipse.ui.commands"> <category name="%compareCategory.name" description="%compareCategory.description" id="org.eclipse.compare.ui.category.compare"> </category> <command name="%Command.copyRightToLeft.name" description="%Command.copyRightToLeft.description" categoryId="org.eclipse.compare.ui.category.compare" id="org.eclipse.compare.copyRightToLeft"> </command> <command name="%Command.copyLeftToRight.name" description="%Command.copyLeftToRight.description" categoryId="org.eclipse.compare.ui.category.compare" id="org.eclipse.compare.copyLeftToRight"> </command> <command name="%Command.copyAllRightToLeft.name" description="%Command.copyAllRightToLeft.description" categoryId="org.eclipse.compare.ui.category.compare" id="org.eclipse.compare.copyAllRightToLeft"> </command> <command name="%Command.copyAllLeftToRight.name" description="%Command.copyAllLeftToRight.description" categoryId="org.eclipse.compare.ui.category.compare" id="org.eclipse.compare.copyAllLeftToRight"> </command> <command name="%Command.selectNextChange.name" description="%Command.selectNextChange.description" categoryId="org.eclipse.compare.ui.category.compare" id="org.eclipse.compare.selectNextChange"> </command> <command name="%Command.selectPreviousChange.name" description="%Command.selectPreviousChange.description" categoryId="org.eclipse.compare.ui.category.compare" id="org.eclipse.compare.selectPreviousChange"> </command> </extension> <extension point="org.eclipse.ui.popupMenus"> <objectContribution objectClass="org.eclipse.core.resources.mapping.ResourceMapping" adaptable="true" id="org.eclipse.compare.MenuGroups"> <menu label="%ReplaceWithMenu.label" path="additions" id="replaceWithMenu"> <separator name="replaceWithGroup"> </separator> </menu> <menu label="%CompareWithMenu.label" path="additions" id="compareWithMenu"> <separator name="compareWithGroup"> </separator> </menu> <menu label="%TeamMenu.label" path="additions" id="team.main"> <separator name="group1"> </separator> </menu> </objectContribution> <objectContribution objectClass="org.eclipse.core.resources.IResource" adaptable="true" id="org.eclipse.compare.CompareAction"> <action label="%CompareWithEachOtherAction.label" tooltip="%CompareWithEachOtherAction.tooltip" class="org.eclipse.compare.internal.CompareAction" menubarPath="compareWithMenu/compareWithGroup" enablesFor="2+" id="compareWithEachOther"> </action> <action label="%CompareWithPatchAction.label" tooltip="%CompareWithPatchAction.tooltip" class="org.eclipse.compare.internal.patch.CompareWithPatchAction" menubarPath="team.main/group1" enablesFor="1" id="compareWithPatch"> </action> </objectContribution> <objectContribution objectClass="org.eclipse.core.resources.IFile" adaptable="true" id="org.eclipse.compare.ReplaceWithEditionAction"> <menu label="%ReplaceWithMenu.label" path="additions" id="replaceWithMenu"> <separator name="replaceWithGroup"> </separator> </menu> <action label="%ReplaceFromHistoryAction.label" tooltip="%ReplaceFromHistoryAction.tooltip" class="org.eclipse.compare.internal.ReplaceWithEditionAction" menubarPath="replaceWithMenu/replaceWithGroup" enablesFor="1" id="replaceFromHistory"> </action> <action label="%ReplaceWithPreviousFromHistoryAction.label" tooltip="%ReplaceWithPreviousFromHistoryAction.tooltip" class="org.eclipse.compare.internal.ReplaceWithPreviousEditionAction" menubarPath="replaceWithMenu/replaceWithGroup" enablesFor="1" id="replaceWithPreviousFromHistory"> </action> </objectContribution> <objectContribution objectClass="org.eclipse.core.resources.IFile" adaptable="true" id="org.eclipse.compare.CompareWithEditionAction"> <menu label="%CompareWithMenu.label" path="additions" id="compareWithMenu"> <separator name="compareWithGroup"> </separator> </menu> <action label="%CompareWithHistoryAction.label" tooltip="%CompareWithHistoryAction.tooltip" class="org.eclipse.compare.internal.CompareWithEditionAction" menubarPath="compareWithMenu/compareWithGroup" enablesFor="1" id="compareWithHistory"> </action> </objectContribution> <objectContribution objectClass="org.eclipse.core.resources.IContainer" adaptable="true" id="org.eclipse.compare.AddFromHistoryAction"> <action label="%addFromHistoryAction.label" tooltip="%addFromHistoryAction.tooltip" class="org.eclipse.compare.internal.AddFromHistoryAction" menubarPath="replaceWithMenu" enablesFor="1" id="addFromHistoryAction"> </action> </objectContribution> </extension> <extension point="org.jcommander.eclipsepatch.compare.streamMergers"> <streamMerger extensions="txt" class="org.eclipse.compare.internal.merge.TextStreamMerger" id="org.eclipse.compare.internal.merge.TextStreamMerger"> </streamMerger> <contentTypeBinding contentTypeId="org.eclipse.core.runtime.text" streamMergerId="org.eclipse.compare.internal.merge.TextStreamMerger"> </contentTypeBinding> </extension> <extension point="org.jcommander.eclipsepatch.compare.structureCreators"> <structureCreator extensions="zip" class="org.eclipse.compare.ZipFileStructureCreator" id="org.eclipse.compare.ZipFileStructureCreator"> </structureCreator> </extension> <extension point="org.jcommander.eclipsepatch.compare.contentMergeViewers"> <viewer extensions="class,exe,dll,binary,zip,jar" class="org.eclipse.compare.internal.BinaryCompareViewerCreator" id="org.eclipse.compare.BinaryCompareViewerCreator"> </viewer> <viewer extensions="txt" class="org.eclipse.compare.internal.TextMergeViewerCreator" id="org.eclipse.compare.TextMergeViewerCreator"> </viewer> <viewer extensions="gif,jpg,jpeg,png,bmp,ico,tif,tiff" class="org.eclipse.compare.internal.ImageMergeViewerCreator" id="org.eclipse.compare.ImageMergeViewerCreator"> </viewer> <contentTypeBinding contentTypeId="org.eclipse.core.runtime.text" contentMergeViewerId="org.eclipse.compare.TextMergeViewerCreator"> </contentTypeBinding> </extension> <extension point="org.jcommander.eclipsepatch.compare.contentViewers"> <viewer extensions="txt" class="org.eclipse.compare.internal.TextViewerCreator" id="org.eclipse.compare.TextViewerCreator"> </viewer> <contentTypeBinding contentTypeId="org.eclipse.core.runtime.text" contentViewerId="org.eclipse.compare.TextViewerCreator"> </contentTypeBinding> </extension> </plugin> --- NEW FILE: old_buildnotes_compare_3_1.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]"> <meta name="Author" content="IBM"> <title>Eclipse Platform Release Notes - Desktop</title> </head> <body> <h1> Eclipse Platform Build Notes<br> Compare</h1> Eclipse Build Input 3.1RC2 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=98828">98828</a>: CompareFilter bug filtering folders<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=67888">67888</a>: [accessibility] Go To Next Difference stops working on reuse of editor<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input May 12th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=93561">93561</a>: ResouceMapping changed to Internal<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=91005">91005</a>: reusing compare editor does not update title if filename stays the same<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=93810">93810</a>: Method extractPair(String, char, int[]) in Patcher.java fails on single number in range<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=93901">93901</a>: Applying patch with one line added inserts new line one line above<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=78653">78653</a>: Eclipse compare support does not appear to use file inspection correctly<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=78652">78652</a>: content type should be bound hierarchically<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=93924">93924</a>: Add keywords to preference pages<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=94077">94077</a>: IndexOutOfBounds applying patch<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=91211">91211</a>: Apply patch doesn't work for files with missing line endings<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=92270">92270</a>: compare should use content-based content type matching<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=69920">69920</a>: Compare should show png, bmp, etc. as image<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=94420">94420</a>: [Preferences] Widget is disposed in Compare/Patch<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input April 19th 2005 <h2>Problem reports fixed</h2> Converted Compare plug-in folder to jar<br> Converted to new NLS scheme<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input April 12th 2005 <h2>Problem reports fixed</h2> Added MANIFEST.MF<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input March 29nd 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=87750">87750</a>: Java Compare references internal API from platform/compare and JDT/Core<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input March 22nd 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=87434">87434</a>: add a link in Synchronize/Compare to Compare/Patch<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input February 8th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=84487">84487</a>: Patch to put menu path contributions on ResourceMappings<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input January 11th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=81853">81853</a>: quote problems in property files (compare)<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input January 4th 2005 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=80387">80387</a>: NPE opening compare editor<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input December 7th 2004 <h2>Problem reports fixed</h2> Eliminated all compiler warnings<br> Removed dependency on core.runtime.compatibility <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 30th 2004 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=79414">79414</a>: states with same time stamps may appear in the wrong order<br> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=79566">79566</a>: NPE when closing JUnit compare view<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 23rd 2004 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=47786">47786</a>: Possible leak in TextMergeViewer<br> Added translatable attribute to extension point schemas. <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 16th 2004 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=78679">78679</a>: Prefs Filtered Members field does not restore defaults<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 9th 2004 <h2>Problem reports fixed</h2> (partial fix; awaits fix in jdt.ui): <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=77599">77599</a>: [5.0] Structure comparing of enums does not work<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input November 1st 2004 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=65981">65981</a>: empty compare viewer has no focus<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input September 21th 2004 <h2>Problem reports fixed</h2> <a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=74450">74450</a>: AbstractUIPlugin.initializeDefaultPreferences no longer called?<br> <h1><hr WIDTH="100%"></h1> Eclipse Build Input August 24th 2004 <h2>Problem reports fixed</h2> Eliminated compiler warnings <h1><hr WIDTH="100%"></h1> Eclipse Build Input July 27th 2004 <h2>Problem reports fixed</h2> Updated version number in plugin.xml and export script to 3.1 </body> </html> --- NEW FILE: build.properties --- ############################################################################### # Copyright (c) 2000, 2004 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # 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 ############################################################################### source.. = compare/ bin.includes = icons/,\ plugin.xml,\ .,\ plugin.properties,\ about.html,\ META-INF/ src.includes = about.html,\ schema/ |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:20
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/META-INF Added Files: MANIFEST.MF Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: MANIFEST.MF --- Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.jcommander.eclipsepatch.compare;singleton:=true Bundle-Version: 3.2.0 Bundle-Activator: org.eclipse.compare.internal.CompareUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.compare, org.eclipse.compare.contentmergeviewer, org.eclipse.compare.internal;x-internal:=true, org.eclipse.compare.internal.merge;x-internal:=true, org.eclipse.compare.internal.patch;x-internal:=true, org.eclipse.compare.patch, org.eclipse.compare.rangedifferencer, org.eclipse.compare.structuremergeviewer Require-Bundle: org.eclipse.ui;bundle-version="[3.1.0,4.0.0)", org.eclipse.core.resources;bundle-version="[3.1.0,4.0.0)", org.eclipse.jface.text;bundle-version="[3.1.0,4.0.0)", org.eclipse.ui.workbench.texteditor;bundle-version="[3.1.0,4.0.0)", org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)" Eclipse-LazyStart: true |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:20
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/contentmergeviewer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/contentmergeviewer Added Files: package.html TextMergeViewerResources.properties IDocumentRange.java ITokenComparator.java IMergeViewerContentProvider.java TextMergeViewer.java ContentMergeViewer.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: IDocumentRange.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.contentmergeviewer; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.IDocument; /** * Defines a subrange in a document. * <p> * It is used by text viewers that can work on a subrange of a document. For example, * a text viewer for Java compilation units might use this to restrict the view * to a single method. * </p> * <p> * Clients may implement this interface. * </p> * * @see TextMergeViewer * @see org.eclipse.compare.structuremergeviewer.DocumentRangeNode */ public interface IDocumentRange { /** * The position category typically used for an <code>IDocumentRange</code> position * (value <code>"DocumentRangeCategory"</code>). * @since 2.0 */ public static final String RANGE_CATEGORY= "DocumentRangeCategory"; //$NON-NLS-1$ /** * 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(); } --- NEW FILE: TextMergeViewerResources.properties --- ############################################################################### # Copyright (c) 2000, 2005 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # 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 ############################################################################### # NLS_MESSAGEFORMAT_VAR # @(#)TextMergeViewerResources.properties # # Resource strings for TextMergeViewer.java title= Text Compare saveDialog.title= Save Resource saveDialog.message= Resource has been modified. Save changes? compareProgressTask.title= Computing Differences... tooComplexError.title= Error # NLS_MESSAGEFORMAT_ALL tooComplexError.format= Too many differences. Turn on the ''Ignore White Space'' option or do a structure compare first. # NLS_MESSAGEFORMAT_VAR ##################################################### # Toolbar actions ##################################################### action.CopyLeftToRight.label=Copy Left to Right action.CopyLeftToRight.tooltip=Copy All from Left to Right action.CopyLeftToRight.image=copy_r_co.gif action.CopyRightToLeft.label=Copy Right to Left action.CopyRightToLeft.tooltip=Copy All Non-Conflicting Changes from Right to Left action.CopyRightToLeft.image=copy_l_co.gif action.CopyDiffLeftToRight.label=Copy Current Change to Right action.CopyDiffLeftToRight.tooltip=Copy Current Change from Left to Right action.CopyDiffLeftToRight.image=copycont_r_co.gif action.CopyDiffRightToLeft.label=Copy Current Change to Left action.CopyDiffRightToLeft.tooltip=Copy Current Change from Right to Left action.CopyDiffRightToLeft.image=copycont_l_co.gif action.NextDiff.label=Next action.NextDiff.tooltip=Select Next Change action.NextDiff.image=next_nav.gif action.PrevDiff.label=Previous action.PrevDiff.tooltip=Select Previous Change action.PrevDiff.image=prev_nav.gif action.EnableAncestor.label=Enable Ancestor Pane action.EnableAncestor.tooltip.unchecked=Show Ancestor Pane action.EnableAncestor.tooltip.checked=Hide Ancestor Pane action.EnableAncestor.description.unchecked=Show Ancestor Pane action.EnableAncestor.description.checked=Hide Ancestor Pane action.EnableAncestor.image=ancestorpane_co.gif action.IgnoreAncestor.label=Ignore Ancestor action.IgnoreAncestor.tooltip.unchecked=Two-Way Compare (Ignore Ancestor) action.IgnoreAncestor.tooltip.checked=Three-Way Compare action.IgnoreAncestor.description.unchecked=Two-Way Compare (Ignore Ancestor) action.IgnoreAncestor.description.checked=Three-Way Compare action.IgnoreAncestor.image=twowaycompare_co.gif ##################################################### # Context menu actions ##################################################### action.undo.label=Undo@Ctrl+Z action.undo.tooltip=Undo Last Operation action.redo.label=Redo@Ctrl+Y action.redo.tooltip=Redo Last Operation action.cut.label=Cut@Ctrl+X action.cut.tooltip=Cut Text Selection to Clipboard action.copy.label=Copy@Ctrl+C action.copy.tooltip=Copy Text Selection to Clipboard action.paste.label=Paste@Ctrl+V action.paste.tooltip=Replace Text Selection with Clipboard Contents action.delete.label=Delete action.delete.tooltip=Delete Current Text Selection action.find.label=Find...@Ctrl+F action.find.tooltip=Find Occurrence action.selectAll.label=Select All@Ctrl+A action.selectAll.tooltip=Select All Changes action.save.label=Save@Ctrl+S action.save.tooltip=Save Changes --- NEW FILE: IMergeViewerContentProvider.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.contentmergeviewer; 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 /** * Returns the label for the ancestor side of a <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the label for the ancestor side of a <code>ContentMergeViewer</code> */ String getAncestorLabel(Object input); /** * Returns an optional image for the ancestor side of a <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the image for the ancestor side of a <code>ContentMergeViewer</code>, * or <code>null</code> if none */ Image getAncestorImage(Object input); /** * Returns the contents for the ancestor side of a <code>ContentMergeViewer</code>. * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the content for the ancestor side of a <code>ContentMergeViewer</code>, * or <code>null</code> if none */ Object getAncestorContent(Object input); /** * Returns whether the ancestor side of the given input element should be shown. * @param input the merge viewer's input * @return <code>true</code> if the ancestor side of the given input element should be shown */ boolean showAncestor(Object input); //---- left side /** * Returns the label for the left side of a <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the label for the left side of a <code>ContentMergeViewer</code> */ String getLeftLabel(Object input); /** * Returns an optional image for the left side of a <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the image for the left side of a <code>ContentMergeViewer</code>, * or <code>null</code> if none */ Image getLeftImage(Object input); /** * Returns the contents for the left side of a <code>ContentMergeViewer</code>. * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the content for the left side of a <code>ContentMergeViewer</code>, * or <code>null</code> if none */ Object getLeftContent(Object input); /** * 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 */ boolean isLeftEditable(Object input); /** * Saves new contents for the left side of the <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @param bytes the new contents to save for the left side */ void saveLeftContent(Object input, byte[] bytes); //---- right side /** * Returns the label for the right side of a <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the label for the right side of a <code>ContentMergeViewer</code> */ String getRightLabel(Object input); /** * Returns an optional image for the right side of a <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the image for the right side of a <code>ContentMergeViewer</code>, * or <code>null</code> if none */ Image getRightImage(Object input); /** * Returns the contents for the right side of a <code>ContentMergeViewer</code>. * The interpretation of the returned object depends on the concrete <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @return the content for the right side of a <code>ContentMergeViewer</code>, * or <code>null</code> if none */ Object getRightContent(Object input); /** * 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 */ boolean isRightEditable(Object input); /** * Saves new contents for the right side of the <code>ContentMergeViewer</code>. * * @param input the input object of the <code>ContentMergeViewer</code> * @param bytes the new contents to save for the right side */ void saveRightContent(Object input, byte[] bytes); } --- NEW FILE: package.html --- <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="IBM"> <meta name="GENERATOR" content="Mozilla/4.75 [en] (WinNT; U) [Netscape]"> <title>Package-level Javadoc</title> </head> <body> Support for compare and merge viewers which show the content side-by-side. <h2> Package Specification</h2> The <b>ContentMergeViewer</b> is an abstract compare and merge viewer with two side-by-side content areas and an optional content area for a common ancestor (for three-way compare). Because the implementation makes no assumptions about the content type it is a subclass responsibility to deal with a specific type. Its subclass <b>ImageMergeViewer</b> in package org.eclipse.compare.internal shows how to base a simple mergeviewer for images on <b>ContentMergeViewer</b>. <p> A <b>ContentMergeViewer</b> accesses its model by means of a content provider which must implement the <b>IMergeViewerContentProvider</b> interface. <p> The <b>TextMergeViewer</b> is the standard concrete subclass of <b>ContentMergeViewer</b> for comparing and merging text content. <br> A text merge viewer uses the <b>org.eclipse.compare.rangedifferencer.RangeDifferencer</b> to perform a textual, line-by-line comparison of two (or three) input documents. For text lines that differ the <b>TextMergeViewer</b> uses an <b>ITokenComparator</b> to find longest sequences of matching and non-matching tokens. The <b>TextMergeViewer</b>'s default token compare works on characters separated by whitespace. If a different strategy is needed (for example, Java tokens in a Java-aware merge viewer), clients can create their own token comparators by implementing the <b>ITokenComparator</b> interface. <p>The <b>TextMergeViewer</b> not only works on whole documents but on subranges of documents too. In this case the viewer's input must be an <b>IDocumentRange</b> instead of an <b>IDocument</b>. </body> </html> --- NEW FILE: ContentMergeViewer.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.contentmergeviewer; import java.util.ResourceBundle; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; [...1005 lines suppressed...] boolean leftEmpty= content.getLeftContent(oldInput) == null; boolean rightEmpty= content.getRightContent(oldInput) == null; if (fCompareConfiguration.isLeftEditable() && fLeftSaveAction.isEnabled()) { byte[] bytes= getContents(true); if (leftEmpty && bytes != null && bytes.length == 0) bytes= null; setLeftDirty(false); content.saveLeftContent(oldInput, bytes); } if (fCompareConfiguration.isRightEditable() && fRightSaveAction.isEnabled()) { byte[] bytes= getContents(false); if (rightEmpty && bytes != null && bytes.length == 0) bytes= null; setRightDirty(false); content.saveRightContent(oldInput, bytes); } } } --- NEW FILE: TextMergeViewer.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 * cha...@ma... - curved line code *******************************************************************************/ package org.eclipse.compare.contentmergeviewer; import java.util.List; import java.util.ArrayList; import java.util.Iterator; import java.util.Map; import java.util.HashMap; import java.util.ResourceBundle; [...4266 lines suppressed...] while (e.hasNext()) { Diff diff= (Diff) e.next(); Position pos= diff.getPosition(part); int viewHeight= part.getLineRange(pos, region).y; int virtualHeight= diff.getMaxDiffHeight(fShowAncestor); if (v < (virtualPos + virtualHeight)) { v-= virtualPos; // make relative to this slot if (viewHeight <= 0) { v= 0; } else { v= (v*viewHeight)/virtualHeight; } return viewPos+v; } virtualPos+= virtualHeight; viewPos+= viewHeight; } return viewPos; } } --- NEW FILE: ITokenComparator.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.contentmergeviewer; import org.eclipse.compare.rangedifferencer.IRangeComparator; /** * For performing a so-called "token compare" on a line of text. * This interface extends the <code>IRangeComparator</code> interface * so that it can be used by the <code>TextMergeViewer</code>. * <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 * the differing token by selecting them. * <p> * <code>TextMergeViewer</code>'s default token comparator works on characters separated * by whitespace. If a different strategy is needed (for example, to use Java tokens in * a Java-aware merge viewer), clients may create their own token * comparators by implementing this interface (and overriding the * <code>TextMergeViewer.createTokenComparator</code> factory method). * </p> * * @see TextMergeViewer */ public interface ITokenComparator extends IRangeComparator { /** * Returns the start character position of the token with the given index. * If the index is out of range (but not negative) the character position * behind the last character (the length of the input string) is returned. * * @param index index of the token for which to return the start position * @return the start position of the token with the given index * @throws java.lang.IndexOutOfBoundsException if index is negative */ int getTokenStart(int index); /** * Returns the character length of the token with the given index. * If the index is out of range (but not negative) the value 0 is returned. * * @param index index of the token for which to return the start position * @return the character length of the token with the given index * @throws java.lang.IndexOutOfBoundsException if index is negative */ int getTokenLength(int index); } |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/internal In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/internal Added Files: ReplaceWithEditionAction.properties BufferedCanvas.java CompareFilter.java ImageCanvas.java CompareMessages.java AddFromHistoryDialog.java StructureCreatorDescriptor.java CompareWithEditionAction.java ImageMergeViewerResources.properties AddFromHistoryAction.java DiffImage.java ExceptionHandler.java TextViewerCreator.java ViewerSwitchingCancelled.java IViewerDescriptor.java MergeSourceViewer.java TextMergeViewerCreator.java MergeViewerAction.java TokenComparator.java CompareOutlinePage.java EditionAction.java ReplaceWithPreviousEditionAction.java ResourceCompareInput.java ReplaceWithEditionAction.java IgnoreWhiteSpaceAction.java CompareUIPlugin.java MergeViewerContentProvider.java TabFolderLayout.java DocLineComparator.java ViewerDescriptor.java ComparePreferencePage.java ICompareContextIds.java OverlayPreferenceStore.java BinaryCompareViewerResources.properties INavigatable.java AbstractViewer.java CompareEditor.java BinaryCompareViewer.java CompareDialog.java ImageMergeViewer.java CompareNavigator.java DocumentManager.java ListDialog.java AddFromHistoryAction.properties CompareMessages.properties BaseCompareAction.java IOpenable.java NullViewer.java CompareAction.java SimpleTextViewer.java ShowPseudoConflicts.java ResizableDialog.java StreamMergerDescriptor.java ChangePropertyAction.java CompareWithEditionAction.properties ISavable.java ImageMergeViewerCreator.java ListContentProvider.java Utilities.java BinaryCompareViewerCreator.java Messages.java CompareEditorContributor.java BufferedResourceNode.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: ICompareContextIds.java --- /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the 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 *******************************************************************************/ package org.eclipse.compare.internal; import org.eclipse.compare.CompareUI; /** * Help context ids for the Compare UI. * <p> * 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$ public static final String COMPARE_EDITOR= PREFIX + "compare_editor_context"; //$NON-NLS-1$ public static final String PATCH_INPUT_WIZARD_PAGE= PREFIX + "patch_input_wizard_page_context"; //$NON-NLS-1$ public static final String PATCH_PREVIEW_WIZARD_PAGE= PREFIX + "patch_preview_wizard_page_context"; //$NON-NLS-1$ public static final String ADD_FROM_HISTORY_DIALOG= PREFIX + "add_from_history_dialog_context"; //$NON-NLS-1$ 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$ public static final String NEXT_DIFF_ACTION= PREFIX + "next_diff_action_context"; //$NON-NLS-1$ public static final String PREVIOUS_DIFF_ACTION= PREFIX + "previous_diff_action_context"; //$NON-NLS-1$ public static final String IGNORE_WHITESPACE_ACTION= PREFIX + "ignore_whitespace_action_context"; //$NON-NLS-1$ // Preference page public static final String COMPARE_PREFERENCE_PAGE= PREFIX + "compare_preference_page_context"; //$NON-NLS-1$ } --- NEW FILE: CompareNavigator.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import org.eclipse.swt.widgets.Control; import org.eclipse.jface.viewers.Viewer; import org.eclipse.compare.CompareEditorInput; import org.eclipse.compare.*; /** * Supports cross-pane navigation through differences. * XXX: Design is as it is because the feature had to be added without touching API. */ public class CompareNavigator implements ICompareNavigator { private boolean fLastDirection= true; private CompareViewerSwitchingPane[] fPanes; // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 private boolean fNextFirstTime= true; public CompareNavigator(CompareViewerSwitchingPane[] panes) { fPanes= panes; } public CompareViewerSwitchingPane[] getPanes() { return fPanes; } public boolean selectChange(boolean next) { fLastDirection= next; // Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 if (next && fNextFirstTime && mustOpen()) { fNextFirstTime= false; openElement(); } // find most down stream CompareViewerPane int n= 0; INavigatable[] navigators= new INavigatable[4]; for (int i= 0; i < fPanes.length; i++) { navigators[n]= getNavigator(fPanes[i]); if (navigators[n] != null) n++; } while (n > 0) { n--; if (navigators[n].gotoDifference(next)) { // at end of this navigator continue; } // not at end return false; } return true; } private static INavigatable getNavigator(CompareViewerSwitchingPane pane) { if (pane == null) return null; if (pane.isEmpty()) return null; Viewer viewer= pane.getViewer(); if (viewer == null) return null; Control control= viewer.getControl(); if (control == null) return null; Object data= control.getData(INavigatable.NAVIGATOR_PROPERTY); if (data instanceof INavigatable) return (INavigatable) data; return null; } private static CompareNavigator findNavigator(Control c) { while (c != null && !c.isDisposed()) { // PR 1GEUVV2 Object data= c.getData(); if (data instanceof CompareEditorInput) { CompareEditorInput cei= (CompareEditorInput) data; Object adapter= cei.getAdapter(CompareNavigator.class); if (adapter instanceof CompareNavigator) return (CompareNavigator)adapter; } c= c.getParent(); } return null; } private boolean resetDirection() { boolean last= fLastDirection; fLastDirection= true; return last; } public static boolean getDirection(Control c) { CompareNavigator nav= findNavigator(c); if (nav != null) return nav.resetDirection(); return true; } /* * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 */ private boolean mustOpen() { if (fPanes == null || fPanes.length == 0) return false; for (int i= 1; i < fPanes.length; i++) { CompareViewerSwitchingPane pane= fPanes[i]; if (pane != null && pane.getInput() != null) return false; } return true; } /* * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 */ private void openElement() { if (fPanes == null || fPanes.length == 0) return; IOpenable openable= getOpenable(fPanes[0]); if (openable != null) { openable.openSelected(); } } /* * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 */ private static IOpenable getOpenable(CompareViewerSwitchingPane pane) { if (pane == null) return null; if (pane.isEmpty()) return null; Viewer viewer= pane.getViewer(); if (viewer == null) return null; Control control= viewer.getControl(); if (control == null) return null; Object data= control.getData(IOpenable.OPENABLE_PROPERTY); if (data instanceof IOpenable) return (IOpenable) data; return null; } } --- NEW FILE: DiffImage.java --- /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the 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 *******************************************************************************/ package org.eclipse.compare.internal; import org.eclipse.swt.graphics.*; import org.eclipse.jface.resource.CompositeImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor; /** * Combines an image with an overlay. */ public class DiffImage extends CompositeImageDescriptor { static final int HEIGHT= 16; private Image fBaseImage; private ImageDescriptor fOverlayImage; private int fWidth; private boolean fLeft= true; public DiffImage(Image base, ImageDescriptor overlay, int w) { fBaseImage= base; fOverlayImage= overlay; fWidth= w; } public DiffImage(Image base, ImageDescriptor overlay, int w, boolean onLeft) { fBaseImage= base; fOverlayImage= overlay; fWidth= w; fLeft= onLeft; } protected Point getSize() { return new Point(fWidth, HEIGHT); } protected void drawCompositeImage(int width, int height) { if (fLeft) { if (fBaseImage != null) { ImageData base= fBaseImage.getImageData(); if (base == null) base= DEFAULT_IMAGE_DATA; drawImage(base, fWidth - base.width, 0); } if (fOverlayImage != null) { ImageData overlay= fOverlayImage.getImageData(); if (overlay == null) overlay= DEFAULT_IMAGE_DATA; drawImage(overlay, 0, (HEIGHT - overlay.height) / 2); } } else { if (fBaseImage != null) { ImageData base= fBaseImage.getImageData(); if (base == null) base= DEFAULT_IMAGE_DATA; drawImage(base, 0, 0); } if (fOverlayImage != null) { ImageData overlay= fOverlayImage.getImageData(); if (overlay == null) overlay= DEFAULT_IMAGE_DATA; drawImage(overlay, fWidth - overlay.width, (HEIGHT - overlay.height) / 2); } } } } --- NEW FILE: ResourceCompareInput.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import java.lang.reflect.InvocationTargetException; import java.text.MessageFormat; import java.util.HashSet; import java.util.Set; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.swt.widgets.Composite; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.compare.*; import org.eclipse.compare.structuremergeviewer.*; /** * 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; private IStructureComparator fLeft; private IStructureComparator fRight; private IResource fAncestorResource; private IResource fLeftResource; 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); } public void fireChange() { super.fireChange(); setDirty(true); fDirty= true; if (fDiffViewer != null) fDiffViewer.refresh(this); } void clearDirty() { fDirty= false; } public String getName() { if (fLastName == null) fLastName= super.getName(); if (fDirty) return '<' + fLastName + '>'; return fLastName; } public ITypedElement getId() { ITypedElement id= super.getId(); if (id == null) return fLastId; fLastId= id; return id; } } static class FilteredBufferedResourceNode extends BufferedResourceNode { FilteredBufferedResourceNode(IResource resource) { super(resource); } protected IStructureComparator createChild(IResource child) { String name= child.getName(); if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false)) return null; 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() { handleOpen(null); } }; Utilities.initAction(fOpenAction, getBundle(), "action.CompareContents."); //$NON-NLS-1$ } boolean enable= false; ISelection selection= getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ss= (IStructuredSelection)selection; if (ss.size() == 1) { Object element= ss.getFirstElement(); if (element instanceof MyDiffNode) { ITypedElement te= ((MyDiffNode) element).getId(); if (te != null) enable= !ITypedElement.FOLDER_TYPE.equals(te.getType()); } else enable= true; } } fOpenAction.setEnabled(enable); manager.add(fOpenAction); super.fillContextMenu(manager); } }; return fDiffViewer; } void setSelection(ISelection s) { IResource[] selection= Utilities.getResources(s); fThreeWay= selection.length == 3; fAncestorResource= null; fLeftResource= selection[0]; fRightResource= selection[1]; if (fThreeWay) { fLeftResource= selection[1]; fRightResource= selection[2]; } fAncestor= null; fLeft= getStructure(fLeftResource); fRight= getStructure(fRightResource); if (fThreeWay) { fAncestorResource= selection[0]; fAncestor= getStructure(fAncestorResource); } } /* * 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; fThreeWay= selection.length == 3; fLeftResource= selection[0]; fRightResource= selection[1]; if (fThreeWay) { fLeftResource= selection[1]; fRightResource= selection[2]; } if (!comparable(fLeftResource, fRightResource)) return false; if (fThreeWay) { fAncestorResource= selection[0]; if (!comparable(fLeftResource, fRightResource)) return false; } return true; } /** * Initializes the images in the compare configuration. */ void initializeCompareConfiguration() { CompareConfiguration cc= getCompareConfiguration(); if (fLeftResource != null) { cc.setLeftLabel(buildLabel(fLeftResource)); cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource)); } if (fRightResource != null) { cc.setRightLabel(buildLabel(fRightResource)); cc.setRightImage(CompareUIPlugin.getImage(fRightResource)); } 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(); if (type != null) { type= normalizeCase(type); 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; String type= normalizeCase(file.getFileExtension()); if ("JAR".equals(type) || "ZIP".equals(type)) //$NON-NLS-2$ //$NON-NLS-1$ return new ZipFileStructureCreator().getStructure(rn); return rn; } 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 fLeftResource.refreshLocal(IResource.DEPTH_INFINITE, pm); fRightResource.refreshLocal(IResource.DEPTH_INFINITE, pm); if (fThreeWay && fAncestorResource != null) fAncestorResource.refreshLocal(IResource.DEPTH_INFINITE, pm); // 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) { String format= Utilities.getString("ResourceCompare.threeWay.title"); //$NON-NLS-1$ String ancestorLabel= fAncestorResource.getName(); title= MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel}); } else { String format= Utilities.getString("ResourceCompare.twoWay.title"); //$NON-NLS-1$ title= MessageFormat.format(format, new String[] {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 format= Utilities.getString("ResourceCompare.threeWay.tooltip"); //$NON-NLS-1$ String ancestorLabel= fAncestorResource.getFullPath().makeRelative().toString(); return MessageFormat.format(format, new String[] {ancestorLabel, leftLabel, rightLabel}); } String format= Utilities.getString("ResourceCompare.twoWay.tooltip"); //$NON-NLS-1$ return MessageFormat.format(format, new String[] {leftLabel, rightLabel}); } // fall back return super.getToolTipText(); } private String buildLabel(IResource r) { String n= r.getFullPath().toString(); if (n.charAt(0) == IPath.SEPARATOR) return n.substring(1); return n; } public void saveChanges(IProgressMonitor pm) throws CoreException { super.saveChanges(pm); if (fRoot instanceof DiffNode) { try { commit(pm, (DiffNode) fRoot); } finally { if (fDiffViewer != null) 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) ((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); IDiffElement[] children= node.getChildren(); if (children != null) { for (int i= 0; i < children.length; i++) { IDiffElement element= children[i]; if (element instanceof DiffNode) commit(pm, (DiffNode) element); } } } /* (non Javadoc) * see IAdaptable.getAdapter */ public Object getAdapter(Class adapter) { if (IFile[].class.equals(adapter)) { HashSet collector= new HashSet(); collectDirtyResources(fRoot, collector); return collector.toArray(new IFile[collector.size()]); } 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; if (bn.isDirty()) { IResource resource= bn.getResource(); if (resource instanceof IFile) collector.add(resource); } } ITypedElement right= node.getRight(); if (right instanceof BufferedResourceNode) { BufferedResourceNode bn= (BufferedResourceNode) right; if (bn.isDirty()) { IResource resource= bn.getResource(); if (resource instanceof IFile) collector.add(resource); } } IDiffElement[] children= node.getChildren(); if (children != null) { for (int i= 0; i < children.length; i++) { IDiffElement element= children[i]; if (element instanceof DiffNode) collectDirtyResources(element, collector); } } } } private static String normalizeCase(String s) { if (NORMALIZE_CASE && s != null) return s.toUpperCase(); return s; } } --- NEW FILE: TextViewerCreator.java --- /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the 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 *******************************************************************************/ package org.eclipse.compare.internal; import org.eclipse.swt.widgets.Composite; import org.eclipse.jface.viewers.Viewer; import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.IViewerCreator; /** * A factory object for the <code>TextMergeViewer</code>. * This indirection is necessary because only objects with a default * constructor can be created via an extension point * (this precludes Viewers). */ public class TextViewerCreator implements IViewerCreator { public Viewer createViewer(Composite parent, CompareConfiguration mp) { return new SimpleTextViewer(parent); } } --- NEW FILE: CompareUIPlugin.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import java.io.*; import java.lang.reflect.InvocationTargetException; import java.net.*; import java.util.*; import java.util.List; import org.eclipse.ui.*; [...1123 lines suppressed...] } } } return (IEditorPart[])result.toArray(new IEditorPart[result.size()]); } public static void logErrorMessage(String message) { if (message == null) message= ""; //$NON-NLS-1$ log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, message, null)); } public static void log(Throwable e) { log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, CompareMessages.ComparePlugin_internal_error, e)); } public static void log(IStatus status) { getDefault().getLog().log(status); } } --- NEW FILE: MergeViewerAction.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import org.eclipse.ui.texteditor.IUpdate; 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; fContent= content; } public boolean isSelectionDependent() { return fSelection; } public boolean isContentDependent() { return fContent; } public boolean isEditableDependent() { return fMutable; } public void update() { // empty default implementation } } --- NEW FILE: ReplaceWithEditionAction.properties --- ############################################################################### # Copyright (c) 2000, 2004 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # 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 ############################################################################### # @(#)ReplaceWithEditionAction.properties # # Resources for ReplaceWithEditionAction.java title= Replace from Local History treeTitleFormat= Local History of ''{0}'' dateIcon= obj16/day_obj.gif timeIcon= obj16/resource_obj.gif treeFormat= {0} workspaceTreeFormat= {0} (Workspace File) parseErrorFormat= {0} (Parse Error) editionLabel= Local History ({0}) workspaceEditionLabel= Workspace File targetLabel= {0} todayFormat= Today ({0}) yesterdayFormat= Yesterday ({0}) dayFormat= {0} buttonLabel= Replace noLocalHistoryError= No local history available for selected resource. replaceError=Cannot replace resource (reason: {0}). taskName=Replacing --- NEW FILE: ComparePreferencePage.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import java.io.*; import java.util.*; import org.eclipse.ui.*; import org.eclipse.ui.dialogs.PreferenceLinkArea; import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; import org.eclipse.ui.texteditor.AbstractTextEditor; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.preference.*; import org.eclipse.jface.util.*; import org.eclipse.compare.*; import org.eclipse.compare.contentmergeviewer.TextMergeViewer; import org.eclipse.compare.structuremergeviewer.*; 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); } public Image getImage() { return null; } public String getName() { return "no name"; //$NON-NLS-1$ } public String getType() { return "no type"; //$NON-NLS-1$ } public InputStream getContents() { return new ByteArrayInputStream(Utilities.getBytes(fContent, UTF_16)); } public String getCharset() { return UTF_16; } } private static final String PREFIX= CompareUIPlugin.PLUGIN_ID + "."; //$NON-NLS-1$ public static final String OPEN_STRUCTURE_COMPARE= PREFIX + "OpenStructureCompare"; //$NON-NLS-1$ public static final String SYNCHRONIZE_SCROLLING= PREFIX + "SynchronizeScrolling"; //$NON-NLS-1$ public static final String SHOW_PSEUDO_CONFLICTS= PREFIX + "ShowPseudoConflicts"; //$NON-NLS-1$ 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 SHOW_MORE_INFO= PREFIX + "ShowMoreInfo"; //$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 USE_RESOLVE_UI= PREFIX + "UseResolveUI"; //$NON-NLS-1$ public static final String PATH_FILTER= PREFIX + "PathFilter"; //$NON-NLS-1$ private TextMergeViewer fPreviewViewer; private IPropertyChangeListener fPreferenceChangeListener; private CompareConfiguration fCompareConfiguration; private OverlayPreferenceStore fOverlayStore; private Map fCheckBoxes= new HashMap(); private Text fFilters; private SelectionListener fCheckBoxListener; public final OverlayPreferenceStore.OverlayKey[] fKeys= new OverlayPreferenceStore.OverlayKey[] { new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, OPEN_STRUCTURE_COMPARE), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SYNCHRONIZE_SCROLLING), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_PSEUDO_CONFLICTS), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, INITIALLY_SHOW_ANCESTOR_PANE), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, SHOW_MORE_INFO), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, IGNORE_WHITESPACE), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, PREF_SAVE_ALL_EDITORS), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT), //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SPLINES), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_SINGLE_LINE), //new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, USE_RESOLVE_UI), new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, PATH_FILTER), }; public static void initDefaults(IPreferenceStore store) { store.setDefault(OPEN_STRUCTURE_COMPARE, true); store.setDefault(SYNCHRONIZE_SCROLLING, true); store.setDefault(SHOW_PSEUDO_CONFLICTS, false); store.setDefault(INITIALLY_SHOW_ANCESTOR_PANE, false); store.setDefault(SHOW_MORE_INFO, false); store.setDefault(IGNORE_WHITESPACE, false); store.setDefault(PREF_SAVE_ALL_EDITORS, false); //store.setDefault(USE_SPLINES, false); store.setDefault(USE_SINGLE_LINE, true); //store.setDefault(USE_RESOLVE_UI, false); store.setDefault(PATH_FILTER, ""); //$NON-NLS-1$ store.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true); } 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) { String key= event.getProperty(); if (key.equals(INITIALLY_SHOW_ANCESTOR_PANE)) { boolean b= fOverlayStore.getBoolean(INITIALLY_SHOW_ANCESTOR_PANE); if (fCompareConfiguration != null) { fCompareConfiguration.setProperty(INITIALLY_SHOW_ANCESTOR_PANE, new Boolean(b)); } } } }; fOverlayStore.addPropertyChangeListener(fPreferenceChangeListener); } /* * @see IWorkbenchPreferencePage#init() */ public void init(IWorkbench workbench) { // empty } /* * @see PreferencePage#performOk() */ public boolean performOk() { fOverlayStore.propagate(); 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); fPreferenceChangeListener= null; } fOverlayStore.stop(); fOverlayStore= null; } super.dispose(); } static public boolean getSaveAllEditors() { 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.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)); 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.showMoreInfo.label", SHOW_MORE_INFO, 0); //$NON-NLS-1$ addCheckBox(composite, "ComparePreferencePage.ignoreWhitespace.label", IGNORE_WHITESPACE, 0); //$NON-NLS-1$ // a spacer new Label(composite, SWT.NONE); addCheckBox(composite, "ComparePreferencePage.saveBeforePatching.label", PREF_SAVE_ALL_EDITORS, 0); //$NON-NLS-1$ // a spacer new Label(composite, SWT.NONE); Label l= new Label(composite, SWT.WRAP); l.setText(Utilities.getString("ComparePreferencePage.filter.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.filter.label")); //$NON-NLS-1$ fFilters= new Text(c2, SWT.BORDER); fFilters.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fFilters.setText(fOverlayStore.getString(PATH_FILTER)); fFilters.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { String filters= fFilters.getText(); String message= CompareFilter.validateResourceFilters(filters); setValid(message == null); setMessage(null); setErrorMessage(message); fOverlayStore.setValue(PATH_FILTER, filters); } } ); 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.useResolveUI.label", USE_RESOLVE_UI, 0); //$NON-NLS-1$ // 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(), null); 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$ new FakeInput("ComparePreferencePage.previewLeft"), //$NON-NLS-1$ new FakeInput("ComparePreferencePage.previewRight") //$NON-NLS-1$ ) ); Control c= fPreviewViewer.getControl(); c.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (fCompareConfiguration != null) fCompareConfiguration.dispose(); } }); return c; } private void initializeFields() { Iterator e= fCheckBoxes.keySet().iterator(); while (e.hasNext()) { Button b= (Button) e.next(); String key= (String) fCheckBoxes.get(b); b.setSelection(fOverlayStore.getBoolean(key)); } if (fFilters != null) fFilters.setText(fOverlayStore.getString(PATH_FILTER)); } // 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; gd.horizontalSpan= 2; checkBox.setLayoutData(gd); if (fCheckBoxListener == null) { fCheckBoxListener= new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Button button= (Button) e.widget; fOverlayStore.setValue((String) fCheckBoxes.get(button), button.getSelection()); } }; } 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(); for (int i= 0; i < preview.length(); i++) { char c= preview.charAt(i); if (c == '\n') buffer.append(separator); else buffer.append(c); } return buffer.toString(); } } --- NEW FILE: IOpenable.java --- /******************************************************************************* * Copyright (c) 2000, 2003 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the 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 *******************************************************************************/ package org.eclipse.compare.internal; /* * Fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=20106 */ public interface IOpenable { static final String OPENABLE_PROPERTY= "org.eclipse.compare.internal.Openable"; //$NON-NLS-1$ /** * Opens the selected element */ void openSelected(); } --- NEW FILE: ImageCanvas.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; /** * A <code>Canvas</code> showing a single centered SWT <code>Image</code>. * If the <code>Image</code> is larger than the <code>Canvas<code>, * <code>Scrollbars</code> will appear. */ class ImageCanvas extends Canvas { private Image fImage; /* * Create a new ImageCanvas with the given SWT stylebits. * (SWT.H_SCROLL and SWT.V_SCROLL are automtically added). */ public ImageCanvas(Composite parent, int style) { super(parent, style | SWT.H_SCROLL | SWT.V_SCROLL); ScrollBar sb= getHorizontalBar(); sb.setIncrement(20); sb.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { repaint(); } }); sb= getVerticalBar(); sb.setIncrement(20); sb.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { repaint(); } }); addListener(SWT.Resize, new Listener() { public void handleEvent(Event e) { updateScrollbars(); } }); addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { paint(event.gc); } }); } /* * Set the SWT Image to use as the ImageCanvas contents. */ public void setImage(Image img) { fImage= img; if (!isDisposed()) { getHorizontalBar().setSelection(0); getVerticalBar().setSelection(0); updateScrollbars(); getParent().layout(); redraw(); } } public void repaint() { if (!isDisposed()) { GC gc= new GC(this); paint(gc); gc.dispose(); } } void paint(GC gc) { if (fImage != null) { Rectangle bounds= fImage.getBounds(); Rectangle clientArea= getClientArea(); int x; if (bounds.width < clientArea.width) x= (clientArea.width - bounds.width) / 2; else x= -getHorizontalBar().getSelection(); int y; if (bounds.height < clientArea.height) y= (clientArea.height - bounds.height) / 2; else y= -getVerticalBar().getSelection(); gc.drawImage(fImage, x, y); } } /** * @private */ void updateScrollbars() { Rectangle bounds= fImage != null ? fImage.getBounds() : new Rectangle(0, 0, 0, 0); Point size= getSize(); Rectangle clientArea= getClientArea(); ScrollBar horizontal= getHorizontalBar(); if (bounds.width <= clientArea.width) { horizontal.setVisible(false); horizontal.setSelection(0); } else { horizontal.setPageIncrement(clientArea.width - horizontal.getIncrement()); int max= bounds.width + (size.x - clientArea.width); horizontal.setMaximum(max); horizontal.setThumb(size.x > max ? max : size.x); horizontal.setVisible(true); } ScrollBar vertical= getVerticalBar(); if (bounds.height <= clientArea.height) { vertical.setVisible(false); vertical.setSelection(0); } else { vertical.setPageIncrement(clientArea.height - vertical.getIncrement()); int max= bounds.height + (size.y - clientArea.height); vertical.setMaximum(max); vertical.setThumb(size.y > max ? max : size.y); vertical.setVisible(true); } } } --- NEW FILE: BufferedResourceNode.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import java.io.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; import org.eclipse.compare.*; 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. * * @param resource the resource */ 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) { byte[] bytes= getContent(); ByteArrayInputStream is= new ByteArrayInputStream(bytes); try { IFile file= (IFile) resource; if (file.exists()) file.setContents(is, false, true, pm); else file.create(is, false, pm); fDirty= false; } finally { if (is != null) try { is.close(); } catch(IOException ex) { // Silently ignored } } } } } public ITypedElement replace(ITypedElement child, ITypedElement other) { if (child == null) { // add resource // create a node without a resource behind it! IResource resource= getResource(); if (resource instanceof IFolder) { IFolder folder= (IFolder) resource; IFile file= folder.getFile(other.getName()); child= new BufferedResourceNode(file); } } if (other == null) { // delete resource IResource resource= getResource(); if (resource instanceof IFolder) { IFolder folder= (IFolder) resource; IFile file= folder.getFile(child.getName()); if (file != null && file.exists()) { fDeleteFile= file; fDirty= true; } } return null; } if (other instanceof IStreamContentAccessor && child instanceof IEditableContent) { IEditableContent dst= (IEditableContent) child; try { InputStream is= ((IStreamContentAccessor)other).getContents(); byte[] bytes= Utilities.readBytes(is); if (bytes != null) dst.setContent(bytes); } catch (CoreException ex) { // NeedWork } } return child; } } --- NEW FILE: ViewerSwitchingCancelled.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; public class ViewerSwitchingCancelled extends RuntimeException { private static final long serialVersionUID = 1L; } --- NEW FILE: ResizableDialog.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import java.util.ResourceBundle; import org.eclipse.swt.SWT; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.DialogSettings; /** * Base class for resizable Dialogs with persistent window bounds. */ public abstract class ResizableDialog extends Dialog { // dialog store id constants private final static String DIALOG_BOUNDS_KEY= "ResizableDialogBounds"; //$NON-NLS-1$ private static final String X= "x"; //$NON-NLS-1$ 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; private String fContextId; 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; } /* * @see org.eclipse.jface.window.Window#configureShell(Shell) */ protected void configureShell(Shell newShell) { super.configureShell(newShell); 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( new ControlListener() { public void controlMoved(ControlEvent arg0) { fNewBounds= s.getBounds(); } public void controlResized(ControlEvent arg0) { fNewBounds= s.getBounds(); } } ); } IDialogSettings bounds= fSettings.getSection(DIALOG_BOUNDS_KEY); if (bounds == null) { if (fBundle != null) { width= Utilities.getInteger(fBundle, WIDTH, 0); height= Utilities.getInteger(fBundle, HEIGHT, 0); Shell shell= getParentShell(); if (shell != null) { Point parentSize= shell.getSize(); if (width <= 0) width= parentSize.x-300; if (height <= 0) height= parentSize.y-200; } } else { Shell shell= getParentShell(); if (shell != null) { Point parentSize= shell.getSize(); width= parentSize.x-100; height= parentSize.y-100; } } if (width < 700) width= 700; if (height < 500) height= 500; } else { try { width= bounds.getInt(WIDTH); } catch (NumberFormatException e) { width= 700; } try { height= bounds.getInt(HEIGHT); } 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 { loc.x= bounds.getInt(X); } catch (NumberFormatException e) { // silently ignored } try { loc.y= bounds.getInt(Y); } catch (NumberFormatException e) { // silently ignored } } return loc; } public boolean close() { boolean closed= super.close(); if (closed && fNewBounds != null) saveBounds(fNewBounds); return closed; } private void saveBounds(Rectangle bounds) { IDialogSettings dialogBounds= fSettings.getSection(DIALOG_BOUNDS_KEY); if (dialogBounds == null) { dialogBounds= new DialogSettings(DIALOG_BOUNDS_KEY); fSettings.addSection(dialogBounds); } dialogBounds.put(X, bounds.x); dialogBounds.put(Y, bounds.y); dialogBounds.put(WIDTH, bounds.width); dialogBounds.put(HEIGHT, bounds.height); } } --- NEW FILE: CompareEditorContributor.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal; import java.util.ResourceBundle; import org.eclipse.jface.action.*; import org.eclipse.ui.*; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.help.IWorkbenchHelpSystem; import org.eclipse.ui.part.EditorActionBarContributor; import org.eclipse.compare.*; public class CompareEditorContributor extends EditorActionBarContributor { private IEditorPart fActiveEditorPart= null; private IgnoreWhiteSpaceAction 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= new IgnoreWhiteSpaceAction(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); } /* * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager) */ public void contributeToToolBar(IToolBarManager tbm) { tbm.add(new Separator()); tbm.add(fIgnoreWhitespace); tbm.add(fToolbarNext); tbm.add(fToolbarPrevious); } /* * @see EditorActionBarContributor#contributeToMenu(IMenuManager) */ public void contributeToMenu(IMenuManager menuManager) { // empty implementation } public void setActiveEditor(IEditorPart targetEditor) { if (fActiveEditorPart == targetEditor) return; fActiveEditorPart= targetEditor; if (fActiveEditorPart != null) { IEditorInput input= fActiveEditorPart.getEditorInput(); if (input instanceof CompareEditorInput) { CompareEditorInput compareInput= (CompareEditorInput) input; fNext.setCompareEditorInput(compareInput); fPrevious.setCompareEditorInput(compareInput); // Begin fix http://bugs.eclipse.org/bugs/show_bug.cgi?id=20105 fToolbarNext.setCompareEditorInput(compareInput); fToolbarPrevious.setCompareEditorInput(compareInput); // 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); CompareConfiguration cc= editor.getCompareConfiguration(); fIgnoreWhitespace.setCompareConfiguration(cc); } } } --- NEW FILE: OverlayPreferenceStore.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 Corp... [truncated message content] |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/compare/org/eclipse/compare/internal/patch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/compare/org/eclipse/compare/internal/patch Added Files: Diff.java PatchMessages.java Hunk.java CompareWithPatchAction.java PatchMessages.properties PatchTargetPage.java PreviewPatchLabelDecorator.java LineReader.java PatchWizard.java InputPatchPage.java PreviewPatchPage.java PatchErrorDialog.java WorkspacePatcher.java DiffProject.java Patcher.java Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: PreviewPatchPage.java --- /******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 * Sebastian Davids <sd...@gm...> - layout tweaks *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.compare.CompareConfiguration; import org.eclipse.compare.CompareUI; import org.eclipse.compare.CompareViewerSwitchingPane; import org.eclipse.compare.IEncodedStreamContentAccessor; import org.eclipse.compare.ITypedElement; import org.eclipse.compare.Splitter; import org.eclipse.compare.internal.ICompareContextIds; import org.eclipse.compare.internal.Utilities; import org.eclipse.compare.structuremergeviewer.DiffNode; import org.eclipse.compare.structuremergeviewer.Differencer; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.CheckStateChangedEvent; import org.eclipse.jface.viewers.DecoratingLabelProvider; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.ICheckStateListener; import org.eclipse.jface.viewers.ICheckable; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer; import org.eclipse.ui.model.BaseWorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.model.WorkbenchViewerSorter; import org.eclipse.ui.views.navigator.ResourceSorter; /** * Shows the parsed patch file and any mismatches * between files, hunks and the currently selected * resources. */ /* package */ class PreviewPatchPage extends WizardPage { /** * Used with CompareInput */ static class HunkInput implements ITypedElement, IEncodedStreamContentAccessor { static final String UTF_16= "UTF-16"; //$NON-NLS-1$ String fContent; String fType; HunkInput(String type, String s) { fType= type; fContent= s; } public Image getImage() { return null; } public String getName() { return PatchMessages.PreviewPatchPage_NoName_text; } public String getType() { return fType; } public InputStream getContents() { return new ByteArrayInputStream(Utilities.getBytes(fContent, UTF_16)); } public String getCharset() { return UTF_16; } } class RetargetPatchDialog extends Dialog { protected TreeViewer rpTreeViewer; protected DiffProject rpSelectedProject; protected IProject rpTargetProject; public RetargetPatchDialog(Shell shell, ISelection selection) { super(shell); setShellStyle(getShellStyle()|SWT.RESIZE); if (selection instanceof IStructuredSelection) { rpSelectedProject= (DiffProject) ((IStructuredSelection) selection).getFirstElement(); } } protected Control createDialogArea(Composite parent) { Composite composite= (Composite) super.createDialogArea(parent); initializeDialogUnits(parent); getShell().setText(PatchMessages.PreviewPatchPage_RetargetPatch); GridLayout layout= new GridLayout(); layout.numColumns= 1; layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); composite.setLayout(layout); final GridData data= new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(data); //add controls to composite as necessary Label label= new Label(composite, SWT.LEFT|SWT.WRAP); label.setText(NLS.bind(PatchMessages.PreviewPatchPage_SelectProject, rpSelectedProject.getName())); final GridData data2= new GridData(SWT.FILL, SWT.BEGINNING, true, false); label.setLayoutData(data2); rpTreeViewer= new TreeViewer(composite, SWT.BORDER); GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true); gd.widthHint= 0; gd.heightHint= 0; rpTreeViewer.getTree().setLayoutData(gd); rpTreeViewer.setContentProvider(new RetargetPatchContentProvider()); rpTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); rpTreeViewer.setSorter(new ResourceSorter(ResourceSorter.NAME)); rpTreeViewer.setInput(ResourcesPlugin.getWorkspace()); rpTreeViewer.setSelection(new StructuredSelection(rpSelectedProject.getProject())); setupListeners(); Dialog.applyDialogFont(composite); return parent; } protected void okPressed() { rpSelectedProject.setProject(rpTargetProject); super.okPressed(); } void setupListeners() { rpTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection s= (IStructuredSelection) event.getSelection(); Object obj= s.getFirstElement(); if (obj instanceof IProject) rpTargetProject= (IProject) obj; } }); rpTreeViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { ISelection s= event.getSelection(); if (s instanceof IStructuredSelection) { Object item= ((IStructuredSelection) s).getFirstElement(); if (rpTreeViewer.getExpandedState(item)) rpTreeViewer.collapseToLevel(item, 1); else rpTreeViewer.expandToLevel(item, 1); } } }); } protected Point getInitialSize() { final Point size= super.getInitialSize(); size.x= convertWidthInCharsToPixels(75); size.y+= convertHeightInCharsToPixels(20); return size; } } class RetargetPatchContentProvider extends BaseWorkbenchContentProvider { //Never show closed projects boolean showClosedProjects= false; public Object[] getChildren(Object element) { if (element instanceof IWorkspace) { // check if closed projects should be shown IProject[] allProjects= ((IWorkspace) element).getRoot().getProjects(); if (showClosedProjects) return allProjects; ArrayList accessibleProjects= new ArrayList(); for (int i= 0; i<allProjects.length; i++) { if (allProjects[i].isOpen()) { accessibleProjects.add(allProjects[i]); } } return accessibleProjects.toArray(); } if (element instanceof IProject) { return new Object[0]; } return super.getChildren(element); } } private PatchWizard fPatchWizard; private ContainerCheckedTreeViewer fTreeViewer; private Combo fStripPrefixSegments; private CompareViewerSwitchingPane fHunkViewer; private Button fIgnoreWhitespaceButton; private Button fReversePatchButton; private Text fFuzzField; private Button fMatchProject; private Object inputElement; private CompareConfiguration fCompareConfiguration; protected boolean pageRecalculate= true; protected final static String PREVIEWPATCHPAGE_NAME= "PreviewPatchPage"; //$NON-NLS-1$ /* package */ PreviewPatchPage(PatchWizard pw) { super(PREVIEWPATCHPAGE_NAME, PatchMessages.PreviewPatchPage_title, null); setMessage(PatchMessages.PreviewPatchPage_message); fPatchWizard= pw; //setPageComplete(false); fCompareConfiguration= new CompareConfiguration(); fCompareConfiguration.setLeftEditable(false); fCompareConfiguration.setLeftLabel(PatchMessages.PreviewPatchPage_Left_title); fCompareConfiguration.setRightEditable(false); fCompareConfiguration.setRightLabel(PatchMessages.PreviewPatchPage_Right_title); } /* (non-Javadoc) * Method declared in WizardPage */ public void setVisible(boolean visible) { if (visible) { buildTree(); updateTree(); } super.setVisible(visible); } 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)); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICompareContextIds.PATCH_PREVIEW_WIZARD_PAGE); setControl(composite); initializeDialogUnits(parent); buildPatchOptionsGroup(composite); Splitter splitter= new Splitter(composite, SWT.VERTICAL); splitter.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL)); // top pane showing diffs and hunks in a check box tree createTreeViewer(splitter); // bottom pane showing hunks in compare viewer fHunkViewer= new CompareViewerSwitchingPane(splitter, SWT.BORDER|SWT.FLAT) { protected Viewer getViewer(Viewer oldViewer, Object input) { return CompareUI.findContentViewer(oldViewer, (ICompareInput) input, this, fCompareConfiguration); } }; fHunkViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); //create Match Project button fMatchProject= new Button(composite, SWT.PUSH); fMatchProject.setLayoutData(new GridData(SWT.END, GridData.BEGINNING, false, false)); fMatchProject.setText(PatchMessages.PreviewPatchPage_MatchProjects); fMatchProject.setEnabled(false); fMatchProject.setVisible(false); fMatchProject.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { final RetargetPatchDialog dialog= new RetargetPatchDialog(getShell(), fTreeViewer.getSelection()); dialog.open(); updateTree(); } }); // creating tree's content buildTree(); Dialog.applyDialogFont(composite); } private void createTreeViewer(Splitter splitter) { fTreeViewer= new ContainerCheckedTreeViewer(splitter, SWT.BORDER); fTreeViewer.setContentProvider(new BaseWorkbenchContentProvider()); fTreeViewer.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), new PreviewPatchLabelDecorator())); fTreeViewer.setSorter(new WorkbenchViewerSorter()); fTreeViewer.addCheckStateListener(new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { Object obj = event.getElement(); ICheckable checked = event.getCheckable(); DiffProject proj = null; if (obj instanceof DiffProject){ proj = (DiffProject) obj; // Check to see if any of the Diffs contained by the DiffProject // have their diff problems set Object[] diffs = proj.getChildren(null); for (int i= 0; i<diffs.length; i++) { if (((Diff) diffs[i]).containsProblems()){ checked.setChecked(obj, false); break; } } } else if (obj instanceof Diff){ proj = ((Diff) obj).getProject(); // If Diff has any diff problems set, at least one hunk underneath // does not match - so don't allow entire tree to be checked if (((Diff) obj).containsProblems()){ checked.setChecked(obj, false); } } else if (obj instanceof Hunk){ Diff diff = (Diff) ((Hunk) obj).getParent(null); proj = diff.getProject(); // Check to see if this hunk has any problems OR // if its parent has any problems if( diff.getDiffProblem() || ((Hunk) obj).getHunkProblem()){ checked.setChecked(obj, false); } } if (proj!= null && !proj.getProject().exists()){ checked.setChecked(obj, false); } updateEnablements(); } }); fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection sel= (IStructuredSelection) event.getSelection(); Object obj= sel.getFirstElement(); if (obj instanceof Hunk) { PreviewPatchPage.this.fHunkViewer.setInput(createInput((Hunk) obj)); } else PreviewPatchPage.this.fHunkViewer.setInput(null); fMatchProject.setEnabled(false); //See if we need to enable match project button if (fPatchWizard.getPatcher().isWorkspacePatch()&&obj instanceof DiffProject) { fMatchProject.setEnabled(true); } } }); fTreeViewer.setInput(null); } /* * Create the group for setting various patch options */ private void buildPatchOptionsGroup(Composite parent) { GridLayout gl; GridData gd; Label l; final WorkspacePatcher patcher= fPatchWizard.getPatcher(); Group group= new Group(parent, SWT.NONE); group.setText(PatchMessages.PreviewPatchPage_PatchOptions_title); gl= new GridLayout(); gl.numColumns= 4; group.setLayout(gl); group.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL|GridData.GRAB_HORIZONTAL)); // 1st row Composite pair= new Composite(group, SWT.NONE); gl= new GridLayout(); gl.numColumns= 2; gl.marginHeight= gl.marginWidth= 0; pair.setLayout(gl); gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); pair.setLayoutData(gd); l= new Label(pair, SWT.NONE); l.setText(PatchMessages.PreviewPatchPage_IgnoreSegments_text); gd= new GridData(GridData.VERTICAL_ALIGN_CENTER|GridData.HORIZONTAL_ALIGN_BEGINNING|GridData.GRAB_HORIZONTAL); l.setLayoutData(gd); fStripPrefixSegments= new Combo(pair, SWT.DROP_DOWN|SWT.READ_ONLY|SWT.SIMPLE); int prefixCnt= patcher.getStripPrefixSegments(); String prefix= Integer.toString(prefixCnt); fStripPrefixSegments.add(prefix); fStripPrefixSegments.setText(prefix); gd= new GridData(GridData.VERTICAL_ALIGN_CENTER|GridData.HORIZONTAL_ALIGN_END); fStripPrefixSegments.setLayoutData(gd); addSpacer(group); fReversePatchButton= new Button(group, SWT.CHECK); fReversePatchButton.setText(PatchMessages.PreviewPatchPage_ReversePatch_text); addSpacer(group); // 2nd row pair= new Composite(group, SWT.NONE); gl= new GridLayout(); gl.numColumns= 3; gl.marginHeight= gl.marginWidth= 0; pair.setLayout(gl); gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); pair.setLayoutData(gd); l= new Label(pair, SWT.NONE); l.setText(PatchMessages.PreviewPatchPage_FuzzFactor_text); l.setToolTipText(PatchMessages.PreviewPatchPage_FuzzFactor_tooltip); gd= new GridData(GridData.VERTICAL_ALIGN_CENTER|GridData.HORIZONTAL_ALIGN_BEGINNING|GridData.GRAB_HORIZONTAL); l.setLayoutData(gd); fFuzzField= new Text(pair, SWT.BORDER); fFuzzField.setText("2"); //$NON-NLS-1$ gd= new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_END); gd.widthHint= 30; fFuzzField.setLayoutData(gd); Button b= new Button(pair, SWT.PUSH); b.setText(PatchMessages.PreviewPatchPage_GuessFuzz_text); b.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { int fuzz= guessFuzzFactor(patcher); if (fuzz>=0) fFuzzField.setText(Integer.toString(fuzz)); } } ); 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); b.setLayoutData(gd); addSpacer(group); fIgnoreWhitespaceButton= new Button(group, SWT.CHECK); fIgnoreWhitespaceButton.setText(PatchMessages.PreviewPatchPage_IgnoreWhitespace_text); addSpacer(group); // register listeners if (fStripPrefixSegments!=null) fStripPrefixSegments.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (patcher.setStripPrefixSegments(getStripPrefixSegments())) updateTree(); } } ); fReversePatchButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (patcher.setReversed(fReversePatchButton.getSelection())) updateTree(); } } ); fIgnoreWhitespaceButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (patcher.setIgnoreWhitespace(fIgnoreWhitespaceButton.getSelection())) updateTree(); } } ); fFuzzField.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { if (patcher.setFuzz(getFuzzFactor())) updateTree(); } }); } private int guessFuzzFactor(final WorkspacePatcher patcher) { final int strip= getStripPrefixSegments(); final int[] result= new int[1]; try { PlatformUI.getWorkbench().getProgressService().run(true, true, //TimeoutContext.run(true, GUESS_TIMEOUT, getControl().getShell(), new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { result[0]= guess(patcher, monitor, strip); } } ); return result[0]; } catch (InvocationTargetException ex) { // NeedWork } catch (InterruptedException ex) { // NeedWork } return -1; } private int guess(WorkspacePatcher patcher, IProgressMonitor pm, int strip) { Diff[] diffs= patcher.getDiffs(); if (diffs==null||diffs.length<=0) return -1; // now collect files and determine "work" IFile[] files= new IFile[diffs.length]; int work= 0; for (int i= 0; i<diffs.length; i++) { Diff diff= diffs[i]; if (diff==null) continue; if (diff.getType()!=Differencer.ADDITION) { IPath p= diff.fOldPath; if (strip>0&&strip<p.segmentCount()) p= p.removeFirstSegments(strip); IFile file= existsInSelection(p); if (file!=null) { files[i]= file; work+= diff.fHunks.size(); } } } // do the "work" int[] fuzzRef= new int[1]; String format= PatchMessages.PreviewPatchPage_GuessFuzzProgress_format; pm.beginTask(PatchMessages.PreviewPatchPage_GuessFuzzProgress_text, work); try { int fuzz= 0; for (int i= 0; i<diffs.length; i++) { Diff d= diffs[i]; IFile file= files[i]; if (d!=null&&file!=null) { List lines= patcher.load(file, false); String name= d.getPath().lastSegment(); Iterator iter= d.fHunks.iterator(); int shift= 0; for (int hcnt= 1; iter.hasNext(); hcnt++) { pm.subTask(MessageFormat.format(format, new String[] {name, Integer.toString(hcnt)})); Hunk h= (Hunk) iter.next(); shift= patcher.calculateFuzz(h, lines, shift, pm, fuzzRef); int f= fuzzRef[0]; if (f==-1) // cancel return -1; if (f>fuzz) fuzz= f; pm.worked(1); } } } return fuzz; } finally { pm.done(); } } ICompareInput createInput(Hunk hunk) { String[] lines= hunk.fLines; StringBuffer left= new StringBuffer(); StringBuffer right= new StringBuffer(); for (int i= 0; i<lines.length; i++) { String line= lines[i]; String rest= line.substring(1); switch (line.charAt(0)) { case ' ' : left.append(rest); right.append(rest); break; case '-' : left.append(rest); break; case '+' : right.append(rest); break; } } Diff diff= hunk.fParent; IPath path= diff.getPath(); String type= path.getFileExtension(); return new DiffNode(new HunkInput(type, left.toString()), new HunkInput(type, right.toString())); } private IFile existsInSelection(IPath path) { return fPatchWizard.getPatcher().existsInTarget(path); } private void buildTree() { inputElement= fPatchWizard.getPatcher(); //Update prefix count - go through all of the diffs and find the smallest //path segment contained in all diffs. int length= 99; if (fStripPrefixSegments!=null&&pageRecalculate) { length= fPatchWizard.getPatcher().calculatePrefixSegmentCount(); if (length!=99) { for (int k= 1; k<length; k++) fStripPrefixSegments.add(Integer.toString(k)); pageRecalculate= false; } } fTreeViewer.setInput(inputElement); } /** * Updates label and checked state of tree items. */ private void updateTree() { if (fTreeViewer==null) return; int strip= getStripPrefixSegments(); //Get the elements from the content provider BaseWorkbenchContentProvider contentProvider= (BaseWorkbenchContentProvider) fTreeViewer.getContentProvider(); Object[] projects= contentProvider.getElements(inputElement); ArrayList hunksToCheck= new ArrayList(); //Iterate through projects and call reset on each project for (int j= 0; j<projects.length; j++) { if (projects[j] instanceof DiffProject) { DiffProject project= (DiffProject) projects[j]; hunksToCheck.addAll(project.reset(fPatchWizard.getPatcher(), strip, getFuzzFactor())); for (Iterator iter= project.fDiffs.iterator(); iter.hasNext();) { Diff diff= (Diff) iter.next(); fTreeViewer.update(diff, null); } } else { if (projects[j] instanceof Diff) { Diff diff= (Diff) projects[j]; hunksToCheck.addAll(diff.reset(fPatchWizard.getPatcher(), strip, getFuzzFactor())); fTreeViewer.update(diff, null); } } } fTreeViewer.refresh(); fTreeViewer.setCheckedElements(hunksToCheck.toArray()); updateEnablements(); } private void addSpacer(Composite parent) { Label label= new Label(parent, SWT.NONE); GridData gd= new GridData(GridData.FILL_HORIZONTAL); gd.widthHint= 20; label.setLayoutData(gd); } private int getStripPrefixSegments() { int stripPrefixSegments= 0; if (fStripPrefixSegments!=null) { String s= fStripPrefixSegments.getText(); try { stripPrefixSegments= Integer.parseInt(s); } catch (NumberFormatException ex) { // silently ignored } } return stripPrefixSegments; } private int getFuzzFactor() { int fuzzFactor= 0; if (fFuzzField!=null) { String s= fFuzzField.getText(); try { fuzzFactor= Integer.parseInt(s); } catch (NumberFormatException ex) { // silently ignored } } return fuzzFactor; } /** * Makes sure that at least one hunk is checked off in the tree before * allowing the patch to be applied. */ /* private */void updateEnablements() { boolean atLeastOneIsEnabled= false; if (fTreeViewer!=null) { BaseWorkbenchContentProvider contentProvider= (BaseWorkbenchContentProvider) fTreeViewer.getContentProvider(); Object[] projects= contentProvider.getElements(inputElement); //Iterate through projects for (int j= 0; j<projects.length; j++) { if (projects[j] instanceof DiffProject) { DiffProject project= (DiffProject) projects[j]; //Iterate through project diffs Object[] diffs= project.getChildren(project); for (int i= 0; i<diffs.length; i++) { Diff diff= (Diff) diffs[i]; atLeastOneIsEnabled= updateEnablement(atLeastOneIsEnabled, diff); } } else if (projects[j] instanceof Diff) { Diff diff= (Diff) projects[j]; atLeastOneIsEnabled= updateEnablement(atLeastOneIsEnabled, diff); } } } //Check to see if Match Project button should be visible fMatchProject.setVisible(fPatchWizard.getPatcher().isWorkspacePatch()); setPageComplete(atLeastOneIsEnabled); } private boolean updateEnablement(boolean atLeastOneIsEnabled, Diff diff) { boolean checked= fTreeViewer.getChecked(diff); diff.setEnabled(checked); if (checked) { Object[] hunkItems= diff.getChildren(diff); for (int h= 0; h<hunkItems.length; h++) { Hunk hunk= (Hunk) hunkItems[h]; checked= fTreeViewer.getChecked(hunk); hunk.setEnabled(checked); if (checked) { //For workspace patch: before setting enabled flag, make sure that the project //that contains this hunk actually exists in the workspace. This is to guard against the //case of having a new file in a patch that is being applied to a project that //doesn't currently exist. boolean projectExists= true; DiffProject project= (DiffProject)diff.getParent(null); if (project!= null){ projectExists=project.getProject().exists(); } if (projectExists) atLeastOneIsEnabled= true; } } } return atLeastOneIsEnabled; } } --- NEW FILE: PatchMessages.properties --- ############################################################################### # Copyright (c) 2000, 2006 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # 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 # Sebastian Davids <sd...@gm...> - layout tweaks ############################################################################### # # 'Compare with Patch' Action # PatchAction_ExceptionTitle=Saving Resources PatchAction_Exception=Unexpected exception. See log for details PatchAction_SavingDirtyEditorsTask=Saving dirty editors PatchAction_AlwaysSaveQuestion=&Always save all modified resources automatically prior to patching PatchAction_SaveAllQuestion=Save all modified resources PatchAction_SaveAllDescription=All modified resources have to be saved before this operation.\nClick 'OK' to confirm or click 'Cancel'. # # PatchWizard # PatchWizard_title=Apply Patch PatchWizard_unexpectedException_message= Unexpected exception while applying the patch. See log for a detailed error description. # # InputPatchPage # InputPatchPage_title= Patch Input Specification InputPatchPage_message= Select the patch location. InputPatchPage_Clipboard=Clipboard InputPatchPage_SelectInput=&Select a single file or folder to patch: InputPatchPage_PatchErrorDialog_title=Patch Error InputPatchPage_SelectPatch_title=Select Patch InputPatchPage_FileButton_text=Fil&e InputPatchPage_ChooseFileButton_text=&Browse... InputPatchPage_UseClipboardButton_text=&Clipboard InputPatchPage_UseWorkspaceButton_text=&Workspace InputPatchPage_WorkspaceSelectPatch_text=&Select the location of the patch: InputPatchPage_NothingSelected_message=Select a file or folder to be patched InputPatchPage_ClipboardIsEmpty_message=Clipboard is empty InputPatchPage_NoTextInClipboard_message=Clipboard does not contain text InputPatchPage_CouldNotReadClipboard_message=Cannot retrieve clipboard contents InputPatchPage_CannotLocatePatch_message=Cannot locate patch file: InputPatchPage_NoFileName_message=No file name InputPatchPage_FileSelectedNotPatch_message=Selected resource is not a valid patch #SI - Select file name ? InputPatchPage_SelectPatchFileDialog_title=Select Patch File InputPatchPage_PatchFileNotFound_message=Patch file not found. InputPatchPage_ParseError_message=Error while parsing patch InputPatchPage_Clipboard_title=Clipboard InputPatchPage_PatchFile_title=Patch file InputPatchPage_WorkspacePatch_title=Workspace file InputPatchPage_NoDiffsFound_format={0} does not contain valid patch. InputPatchPage_SingleFileError_format={0} contains multiple patches. You cannot apply them to a single file. # # PatchTargetPage # PatchTargetPage_title= Patch Target Specification PatchTargetPage_message= Define the resource to patch. # # PreviewPatchPage # PreviewPatchPage_title= Verify Patch PreviewPatchPage_message= The tree shows the contents of the patch.\nA checked item indicates that a patch can be applied successfully. To remove an item, clear its checkbox. PreviewPatchPage_Target=(target: {0}) PreviewPatchPage_Left_title= Original PreviewPatchPage_Right_title= Result PreviewPatchPage_PatchOptions_title=Patch options PreviewPatchPage_IgnoreSegments_text=&Ignore leading path name segments: PreviewPatchPage_ReversePatch_text=&Reverse patch PreviewPatchPage_FuzzFactor_text=&Maximum fuzz factor: PreviewPatchPage_FuzzFactor_tooltip=Allow Context to Shift This Number of Lines from the Original Location PreviewPatchPage_IgnoreWhitespace_text=Ignore &white space PreviewPatchPage_NoName_text=no name PreviewPatchPage_FileExists_error=(file already exists) PreviewPatchPage_FileDoesNotExist_error=(file does not exist) PreviewPatchPage_NoMatch_error=(no match) PreviewPatchPage_MatchProjects=Match &Project... PreviewPatchPage_RetargetPatch=Retarget Patch PreviewPatchPage_SelectProject=Select the project in your workspace that corresponds to project ''{0}'': PreviewPatchPage_FileIsReadOnly_error=(file is read-only) PreviewPatchPage_GuessFuzz_text= &Guess PreviewPatchPage_GuessFuzzProgress_text= Guessing Fuzz Factor... PreviewPatchPage_GuessFuzzProgress_format= {0} (hunk #{1}) PreviewPatchLabelDecorator_ProjectDoesNotExist=(Project does not exist in workspace) # # Patcher # Patcher_Marker_message=Rejected patch Patcher_Task_message=Patching Diff_2Args={0} {1} --- NEW FILE: PreviewPatchLabelDecorator.java --- /******************************************************************************* * Copyright (c) 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.DiffImage; import org.eclipse.compare.structuremergeviewer.Differencer; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.ILabelDecorator; import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.graphics.Image; public class PreviewPatchLabelDecorator implements ILabelDecorator { /** Maps strings to images */ private Map fImages= new Hashtable(10); private List fDisposeOnShutdownImages= new ArrayList(); ImageDescriptor errId= CompareUIPlugin.getImageDescriptor("ovr16/error_ov.gif"); //$NON-NLS-1$ static final String error = "error"; //$NON-NLS-1$ static final String add = "add"; //$NON-NLS-1$ static final String delete = "del"; //$NON-NLS-1$ public Image decorateImage(Image image, Object element) { if (element instanceof Diff){ Diff diff = (Diff) element; switch (diff.getType()){ case Differencer.ADDITION: return getImageFor(add + (diff.fMatches ? "" : error), image, diff.fMatches); //$NON-NLS-1$ case Differencer.DELETION: return getImageFor(delete + (diff.fMatches ? "" : error), image, diff.fMatches); //$NON-NLS-1$ default: return getImageFor(diff.fMatches ? "" : error, image, diff.fMatches); //$NON-NLS-1$ } } else if (element instanceof Hunk){ Hunk hunk = (Hunk) element; return getImageFor((hunk.fMatches ? "" : error),image, hunk.fMatches); //$NON-NLS-1$ } return null; } private Image getImageFor(String id, Image image, boolean hasMatches) { Image cached_image = (Image) fImages.get(id); if (cached_image == null){ DiffImage diffImage = new DiffImage(image, hasMatches ? null : errId, 16, false); cached_image = diffImage.createImage(); fImages.put(id, cached_image); fDisposeOnShutdownImages.add(cached_image); } return cached_image; } public String decorateText(String text, Object element) { if (element instanceof DiffProject){ DiffProject project = (DiffProject)element; //Check to see if this project exists in the workspace IResource projectExistsInWorkspace = ResourcesPlugin.getWorkspace().getRoot().findMember(project.getProject().getFullPath()); if(projectExistsInWorkspace == null) return NLS.bind(PatchMessages.Diff_2Args, new String[]{text, PatchMessages.PreviewPatchLabelDecorator_ProjectDoesNotExist}); if (!project.getName().equals(project.getOriginalProjectName())) return NLS.bind(PatchMessages.Diff_2Args, new String[]{project.getOriginalProjectName(), NLS.bind(PatchMessages.PreviewPatchPage_Target, new String[]{project.getName()})}); } return null; } public void dispose() { if (fDisposeOnShutdownImages != null) { Iterator i= fDisposeOnShutdownImages.iterator(); while (i.hasNext()) { Image img= (Image) i.next(); if (!img.isDisposed()) img.dispose(); } fImages= null; } } public boolean isLabelProperty(Object element, String property) { return false; } public void addListener(ILabelProviderListener listener) { //don't need listener } public void removeListener(ILabelProviderListener listener) { //don't need listener } } --- NEW FILE: PatchTargetPage.java --- /******************************************************************************* * Copyright (c) 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.text.MessageFormat; import org.eclipse.compare.internal.ICompareContextIds; import org.eclipse.compare.internal.Utilities; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.CheckboxTreeViewer; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Tree; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.views.navigator.ResourceSorter; /*** * This page only shows up if the user is trying to apply * a non-workspace rooted patch. */ public class PatchTargetPage extends WizardPage { private boolean fShowError = false; // SWT widgets private CheckboxTreeViewer fPatchTargets; private PatchWizard fPatchWizard; protected final static String PATCHTARGETPAGE_NAME = "PatchTargetPage"; //$NON-NLS-1$ PatchTargetPage(PatchWizard pw) { super(PATCHTARGETPAGE_NAME, PatchMessages.PatchTargetPage_title, null); fPatchWizard = pw; setMessage(PatchMessages.PatchTargetPage_message); } /* * Get a path from the supplied text widget. * @return org.eclipse.core.runtime.IPath */ protected IPath getPathFromText(Text textField) { return (new Path(textField.getText())).makeAbsolute(); } 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); Label l = new Label(composite, SWT.NONE); l.setText(PatchMessages.InputPatchPage_SelectInput); buildInputGroup(composite); updateWidgetEnablements(); Dialog.applyDialogFont(composite); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, ICompareContextIds.PATCH_INPUT_WIZARD_PAGE); } /* (non-JavaDoc) * Method declared in IWizardPage. */ public IWizardPage getNextPage() { WorkspacePatcher patcher = ((PatchWizard) getWizard()).getPatcher(); // if selected target is file ensure that patch file // contains only a patch for a single file IResource target = fPatchWizard.getTarget(); if (target instanceof IFile && patcher.getDiffs().length > 1) { InputPatchPage inputPage = (InputPatchPage) fPatchWizard.getPage(InputPatchPage.INPUTPATCHPAGE_NAME); String source = ""; //$NON-NLS-1$ switch (inputPage.getInputMethod()) { case InputPatchPage.CLIPBOARD : source = PatchMessages.InputPatchPage_Clipboard_title; break; case InputPatchPage.FILE : source = PatchMessages.InputPatchPage_PatchFile_title; break; case InputPatchPage.WORKSPACE : source = PatchMessages.InputPatchPage_WorkspacePatch_title; break; } String format = PatchMessages.InputPatchPage_SingleFileError_format; String message = MessageFormat.format(format, new String[] {source}); MessageDialog.openInformation(null, PatchMessages.InputPatchPage_PatchErrorDialog_title, message); return this; } return super.getNextPage(); } /* (non-JavaDoc) * Method declared in IWizardPage. */ public boolean canFlipToNextPage() { // we can't call getNextPage to determine if flipping is allowed since computing // the next page is quite expensive. So we say yes if the page is complete. return isPageComplete(); } private void buildInputGroup(Composite parent) { Tree tree = new Tree(parent, SWT.BORDER); GridData gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 200; tree.setLayoutData(gd); fPatchTargets = new CheckboxTreeViewer(tree); fPatchTargets.setLabelProvider(new WorkbenchLabelProvider()); fPatchTargets.setContentProvider(new WorkbenchContentProvider()); fPatchTargets.setSorter(new ResourceSorter(ResourceSorter.NAME)); fPatchTargets.setInput(ResourcesPlugin.getWorkspace().getRoot()); PatchWizard pw = (PatchWizard) getWizard(); IResource target = pw.getTarget(); if (target != null) { fPatchTargets.expandToLevel(target, 0); fPatchTargets.setSelection(new StructuredSelection(target)); } // register listeners fPatchTargets.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { fPatchWizard.setTarget(Utilities.getFirstResource(event.getSelection())); updateWidgetEnablements(); } }); fPatchTargets.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { fPatchWizard.showPage(getNextPage()); } }); } /** * Updates the enable state of this page's controls. */ private void updateWidgetEnablements() { String error = null; ISelection selection = fPatchTargets.getSelection(); boolean anySelected = selection != null && !selection.isEmpty(); if (!anySelected) error = PatchMessages.InputPatchPage_NothingSelected_message; setPageComplete(anySelected); if (fShowError) setErrorMessage(error); } /** * 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 * not close. * * @return boolean */ public boolean finish() { return true; } } --- NEW FILE: PatchWizard.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.lang.reflect.InvocationTargetException; import org.eclipse.compare.internal.CompareUIPlugin; import org.eclipse.compare.internal.ExceptionHandler; import org.eclipse.compare.internal.Utilities; import org.eclipse.compare.internal.patch.CompareWithPatchAction.PatchWizardDialog; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.MultiRule; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; import org.eclipse.ui.actions.WorkspaceModifyOperation; /* package */class PatchWizard extends Wizard { // dialog store id constants private final static String DIALOG_SETTINGS_KEY= "PatchWizard"; //$NON-NLS-1$ private boolean fHasNewDialogSettings; private InputPatchPage fPatchWizardPage; private WorkspacePatcher fPatcher; private PatchWizardDialog fDialog; /* * Creates a wizard for applying a patch file to the workspace. */ /* package */PatchWizard(ISelection selection) { setDefaultPageImageDescriptor(CompareUIPlugin.getImageDescriptor("wizban/applypatch_wizban.png")); //$NON-NLS-1$ setWindowTitle(PatchMessages.PatchWizard_title); fPatcher= new WorkspacePatcher(); setTarget(Utilities.getFirstResource(selection)); IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings(); IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY); if (section == null) { fHasNewDialogSettings= true; } else { fHasNewDialogSettings= false; setDialogSettings(section); } } WorkspacePatcher getPatcher() { return fPatcher; } IResource getTarget() { return fPatcher.getTarget(); } void setTarget(IResource target) { fPatcher.setTarget(target); } /* (non-Javadoc) * Method declared on IWizard. */ public void addPages() { super.addPages(); addPage(fPatchWizardPage= new InputPatchPage(this)); addPage(new PatchTargetPage(this)); addPage(new PreviewPatchPage(this)); } /* (non-Javadoc) * Method declared on IWizard. */ public boolean needsProgressMonitor() { return true; } /* (non-Javadoc) * Method declared on IWizard. */ public boolean performFinish() { fPatcher.setName(fPatchWizardPage.getPatchName()); // make sure that the patch has been read if (!fPatchWizardPage.isPatchRead()) fPatchWizardPage.readInPatch(); try { // create scheduling rule based on the type of patch - single or workspace ISchedulingRule scheduleRule= null; if (fPatcher.isWorkspacePatch()) { // workspace patch scheduleRule= new MultiRule(fPatcher.getTargetProjects()); } else { // single patch scheduleRule= getTarget(); } WorkspaceModifyOperation op= new WorkspaceModifyOperation(scheduleRule) { protected void execute(IProgressMonitor monitor) throws InvocationTargetException { try { fPatcher.applyAll(monitor, getShell(), PatchMessages.PatchWizard_title); } catch (CoreException e) { throw new InvocationTargetException(e); } } }; getContainer().run(true, false, op); } catch (InvocationTargetException e) { ExceptionHandler.handle(e, PatchMessages.PatchWizard_title, PatchMessages.PatchWizard_unexpectedException_message); } catch (InterruptedException e) { // cannot happen // NeedWork: use assert! } // Save the dialog settings if (fHasNewDialogSettings) { IDialogSettings workbenchSettings= CompareUIPlugin.getDefault().getDialogSettings(); IDialogSettings section= workbenchSettings.getSection(DIALOG_SETTINGS_KEY); section= workbenchSettings.addNewSection(DIALOG_SETTINGS_KEY); setDialogSettings(section); } fPatchWizardPage.saveWidgetValues(); //fPreviewPatchPage.saveWidgetValues(); return true; } public void setDialog(PatchWizardDialog dialog) { fDialog= dialog; } public void showPage(IWizardPage page) { fDialog.showPage(page); } } --- NEW FILE: Hunk.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.util.List; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.osgi.util.NLS; import org.eclipse.ui.model.IWorkbenchAdapter; /** * A Hunk describes a range of changed lines and some context lines. */ /* package */ class Hunk implements IWorkbenchAdapter, IAdaptable { Diff fParent; int fOldStart, fOldLength; int fNewStart, fNewLength; String[] fLines; boolean fMatches= false; private boolean fIsEnabled= true; boolean fHunkProblem= false; /* package */ Hunk(Diff parent, int[] oldRange, int[] newRange, List lines) { fParent= parent; if (fParent != null) fParent.add(this); if (oldRange[0] > 0) fOldStart= oldRange[0]-1; // line number start at 0! else fOldStart= 0; fOldLength= oldRange[1]; if (newRange[0] > 0) fNewStart= newRange[0]-1; // line number start at 0! else fNewStart= 0; fNewLength= newRange[1]; fLines= (String[]) lines.toArray(new String[lines.size()]); } boolean isEnabled() { return fIsEnabled; } void setEnabled(boolean enable) { fIsEnabled= enable; } void reverse() { int t= fOldStart; fOldStart= fNewStart; fNewStart= t; t= fOldLength; fOldLength= fNewLength; fNewLength= t; for (int i= 0; i < fLines.length; i++) { String line= fLines[i]; char c= line.charAt(0); switch (c) { case '+': fLines[i]= '-' + line.substring(1); break; case '-': fLines[i]= '+' + line.substring(1); break; default: break; } } } /* * Returns the contents of this hunk. * Each line starts with a control character. Their meaning is as follows: * <ul> * <li> * '+': add the line * <li> * '-': delete the line * <li> * ' ': no change, context line * </ul> */ String getContent() { StringBuffer sb= new StringBuffer(); for (int i= 0; i < fLines.length; i++) { String line= fLines[i]; sb.append(line.substring(0, Patcher.length(line))); sb.append('\n'); } return sb.toString(); } /* * Returns a descriptive String for this hunk. * It is in the form old_start,old_length -> new_start,new_length. */ String getDescription() { StringBuffer sb= new StringBuffer(); sb.append(Integer.toString(fOldStart)); sb.append(','); sb.append(Integer.toString(fOldLength)); sb.append(" -> "); //$NON-NLS-1$ sb.append(Integer.toString(fNewStart)); sb.append(','); sb.append(Integer.toString(fNewLength)); return sb.toString(); } String getRejectedDescription() { StringBuffer sb= new StringBuffer(); sb.append("@@ -"); //$NON-NLS-1$ sb.append(Integer.toString(fOldStart)); sb.append(','); sb.append(Integer.toString(fOldLength)); sb.append(" +"); //$NON-NLS-1$ sb.append(Integer.toString(fNewStart)); sb.append(','); sb.append(Integer.toString(fNewLength)); sb.append(" @@"); //$NON-NLS-1$ return sb.toString(); } void reset(boolean problemEncountered) { fHunkProblem= problemEncountered; } //IWorkbenchAdapter methods public Object[] getChildren(Object o) { return new Object[0]; } public ImageDescriptor getImageDescriptor(Object object) { return null; } public String getLabel(Object o) { String label= getDescription(); if (this.fHunkProblem) return NLS.bind(PatchMessages.Diff_2Args, new String[] {label, PatchMessages.PreviewPatchPage_NoMatch_error}); return label; } public Object getParent(Object o) { return fParent; } //IAdaptable methods public Object getAdapter(Class adapter) { if (adapter == IWorkbenchAdapter.class) return this; return null; } protected boolean getHunkProblem() { return fHunkProblem; } } --- NEW FILE: Patcher.java --- /******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 * Martin Burger <m...@rt...> patch for #93810 and #93901 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.io.*; import java.text.*; import java.util.*; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Shell; [...1098 lines suppressed...] return true; } return false; } public int calculatePrefixSegmentCount() { //Update prefix count - go through all of the diffs and find the smallest //path segment contained in all diffs. int length= 99; if (fDiffs!=null) for (int i= 0; i<fDiffs.length; i++) { Diff diff= fDiffs[i]; if (diff.fOldPath!=null) length= Math.min(length, diff.fOldPath.segmentCount()); if (diff.fNewPath!=null) length= Math.min(length, diff.fNewPath.segmentCount()); } return length; } } --- NEW FILE: LineReader.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.io.*; import java.util.*; import org.eclipse.jface.util.Assert; public class LineReader { private boolean fHaveChar= false; private int fLastChar; private boolean fSawEOF= false; private BufferedReader fReader; private boolean fIgnoreSingleCR= false; public LineReader(BufferedReader reader) { fReader= reader; Assert.isNotNull(reader); } void ignoreSingleCR() { fIgnoreSingleCR= true; } /** * 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 linefeed. * @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 * @exception IOException If an I/O error occurs */ /* package */ String readLine() throws IOException { StringBuffer sb= null; while (!fSawEOF) { int c= readChar(); if (c == -1) { fSawEOF= true; break; } if (sb == null) sb= new StringBuffer(); sb.append((char)c); if (c == '\n') break; if (c == '\r') { c= readChar(); if (c == -1) { fSawEOF= true; break; // EOF } if (c != '\n') { if (fIgnoreSingleCR) { sb.append((char)c); continue; } fHaveChar= true; fLastChar= c; } else sb.append((char)c); break; } } if (sb != null) return sb.toString(); return null; } /* package */ void close() { try { fReader.close(); } catch (IOException ex) { // silently ignored } } public List readLines() { try { List lines= new ArrayList(); String line; while ((line= readLine()) != null) lines.add(line); return lines; } catch (IOException ex) { // NeedWork //System.out.println("error while reading file: " + fileName + "(" + ex + ")"); } finally { close(); } return null; } /* * Returns the number of characters in the given string without * counting a trailing line separator. */ /* package */ int lineContentLength(String line) { if (line == null) return 0; int length= line.length(); for (int i= length-1; i >= 0; i--) { char c= line.charAt(i); if (c =='\n' || c == '\r') length--; else break; } return length; } //---- private private int readChar() throws IOException { if (fHaveChar) { fHaveChar= false; return fLastChar; } return fReader.read(); } } --- NEW FILE: DiffProject.java --- /******************************************************************************* * Copyright (c) 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IPath; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.model.IWorkbenchAdapter; public class DiffProject implements IWorkbenchAdapter, IAdaptable { List fDiffs= new ArrayList(); IProject fProject; //used for patch retargeting String fOriginalProjectName= null; DiffProject(IProject project) { this.fProject= project; this.fOriginalProjectName= project.getName(); } void addDiff(Diff diff) { fDiffs.add(diff); } void addDiffs(Diff[] diffs) { for (int i= 0; i<diffs.length; i++) { fDiffs.add(diffs[i]); } } IProject getProject() { return this.fProject; } String getName() { return fProject.getName(); } void setProject(IProject project) { this.fProject= project; } /** * Resets all of the diffs contained by this project * @param patcher * @param strip * @param fuzzfactor * @return a list of which hunks need to be checked */ ArrayList reset(WorkspacePatcher patcher, int strip, int fuzzfactor) { ArrayList hunksToCheck= new ArrayList(); for (Iterator iter= fDiffs.iterator(); iter.hasNext();) { Diff diff= (Diff) iter.next(); hunksToCheck.addAll(diff.reset(patcher, strip, fuzzfactor)); } return hunksToCheck; } public IFile getFile(IPath path) { return fProject.getFile(path); } /** * Returns the target files of all the Diffs contained by this * DiffProject. * @return An array of IFiles that are targeted by the Diffs */ public IFile[] getTargetFiles() { List files= new ArrayList(); for (Iterator iter= fDiffs.iterator(); iter.hasNext();) { Diff diff= (Diff) iter.next(); if (diff.isEnabled()) { files.add(diff.getTargetFile()); } } return (IFile[]) files.toArray(new IFile[files.size()]); } //IWorkbenchAdapter methods public Object[] getChildren(Object o) { return fDiffs.toArray(); } public ImageDescriptor getImageDescriptor(Object object) { Object o= fProject.getAdapter(IWorkbenchAdapter.class); if (o instanceof IWorkbenchAdapter) { ImageDescriptor id= ((IWorkbenchAdapter) o).getImageDescriptor(fProject); return id; } return null; } public String getLabel(Object o) { return getName(); } public Object getParent(Object o) { return null; } //IAdaptable methods public Object getAdapter(Class adapter) { if (adapter==IWorkbenchAdapter.class) { return this; } return null; } public String getOriginalProjectName() { return fOriginalProjectName; } } --- NEW FILE: PatchErrorDialog.java --- /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 *******************************************************************************/ package org.eclipse.compare.internal.patch; public class PatchErrorDialog { private PatchErrorDialog() { // no instance. } } --- NEW FILE: InputPatchPage.java --- /******************************************************************************* * Copyright (c) 2000, 2006 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * 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 * Sebastian Davids <sd...@gm...> - layout tweaks *******************************************************************************/ package org.eclipse.compare.internal.patch; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.text.MessageFormat; import org.eclipse.compare.internal.ICompareContextIds; import org.eclipse.compare.internal.Utilities; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEven... [truncated message content] |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:49:19
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/icons/full/dtool16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/icons/full/dtool16 Added Files: ignorews_edit.gif conflict_edit.gif Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: conflict_edit.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: ignorews_edit.gif --- (This appears to be a binary file; contents omitted.) |
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/icons/full/ovr16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5127/icons/full/ovr16 Added Files: confadd_ov.gif indel_ov.gif r_outchg_ov.gif outchg_ov.gif inadd_ov.gif r_inchg_ov.gif r_outadd_ov.gif outadd_ov.gif outdel_ov.gif add_ov.gif confchg_ov.gif error_ov.gif r_indel_ov.gif del_ov.gif r_outdel_ov.gif confdel_ov.gif chg_ov.gif inchg_ov.gif r_inadd_ov.gif Log Message: org.eclipse.compare, extracted from the Eclipse CVS. Now independent of org.eclipse.ui.ide etc. --- NEW FILE: outchg_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: r_outdel_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: chg_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: confadd_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: r_inadd_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: r_outchg_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: add_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: inadd_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: r_outadd_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: error_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: r_indel_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: outdel_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: inchg_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: del_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: outadd_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: indel_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: confchg_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: confdel_ov.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: r_inchg_ov.gif --- (This appears to be a binary file; contents omitted.) |
|
From: Matthias K <mat...@us...> - 2006-03-28 13:47:18
|
Update of /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4880/scripts Log Message: Directory /cvsroot/jcommander/plugins/org.jcommander.eclipsepatch.compare/scripts added to the repository |