Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/ChangeLog284
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/META-INF/MANIFEST.MF12
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/plugin.properties4
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/plugin.xml25
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogExtensionManager.java46
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogPreferencesPage.java16
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java8
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java20
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/ChangeLogAction.java68
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java26
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java501
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java186
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareCommitAction.java133
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java82
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java22
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java65
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/strings.properties24
-rw-r--r--changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java5
18 files changed, 600 insertions, 927 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog b/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog
index 2b809a8c11..e3541d0f1a 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog
+++ b/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog
@@ -1,109 +1,8 @@
-2008-01-11 Jeff Johnston <jjohnstn@redhat.com>
-
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java:
- Update copyright.
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java
- (execute): Return if no selected project exists.
- * src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java
- (initializeDefaultPreferences): Use new getUserEmail method.
- * src/org/eclipse/linuxtools/changelog/core/ChangeLogPreferencesPage.java
- (getUserRealName): Try and use environment variable if available.
- (getUserEmail): New method.
- (initializeDefaultPreferences): Use new getUserEmail method.
-
-2008-01-10 Jeff Johnston <jjohnstn@redhat.com>
-
- * plugin.properties: Add new message for Prepare ChangeLog menu item.
- * plugin.xml: Add "Prepare ChangeLog" action to project menu.
-
-2008-01-09 Jeff Johnston <jjohnstn@redhat.com>
-
- Bugzilla #214684
- * META-INF/MANIFEST.MF: Add specific minimum versions for plugins that are
- required by the Java parser. This allows the Java parser to omit these plugin
- dependencies and use the ones in this, the host plugin.
- * plugin.xml: Remove locationContribution extension which does not exist.
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java:
- Remove unused imports.
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java
- (execute): Add support for editors that are editing IResources.
-
-2008-01-08 Jeff Johnston <jjohnstn@redhat.com>
-
- * META-INF/MANIFEST.MF: Update version to 2.6.1.
-
-2007-12-16 Jeff Johnston <jjohnstn@redhat.com>
-
- * MANIFEST.MF: Remove CVS dependencies.
- * src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java: Add new static
- PLUGIN_ID.
- * src/org/eclipse/linuxtools/changelog/core/LineComparator.java: New file.
- * src/org/eclipse/linuxtools/changelog/core/ChangeLogExtensionManager.java: Add
- NLS comments.
- * src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java: Ditto.
- * src/org/eclipse/linuxtools/changelog/core/strings.properties: Add new messages
- for NLS support.
- * src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java: NLS
- string support.
- * src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java: Add
- NLS message support.
- (getCompareAdapter): Renamed from getCompareAdpater.
- * src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java: Add NLS
- support.
- (mergeChangelog): Fix test for existing entry to include the "*" qualifier so
- that we don't get a false positive when dealing with short filenames that might
- match the end of another entry.
- * src/org/eclipse/linuxtools/changelog/core/actions/ChangeLogAction.java:
- (createChangeLog): Use Messages to get string.
- (getChangelogForRemovePath): New method to get ChangeLog for a removed file.
- (loadPreferences): Add NLS comment.
- * src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java: Add
- removedFile boolean. Add constructor that takes an IPath.
- (isRemovedFile, setRemovedFile): New methods.
- * src/org/eclipse/linuxtools/changelog/core/actions/PatchFileComparator.java:
- New file.
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java:
- (doRun): Use Messages to get monitor message.
- (getResourceMappings): Removed.
- (guessFunctionNames): String cleanups.
- (outputMultipleEntryChangeLog): Add removed file support. Add support for no
- guessed function names. Remove variation of this method that takes all String
- arguments.
- (parseStandardPatch): Removed.
- (parseCurrentFunctionAtOffset): Clean up strings.
- (preapreChangeLog): Renamed to...
- (prepareChangeLog): this.. As well, use RepositoryProvider to get set of
- SyncInfos for changes instead of using resource list. As well, create patch file
- manually using line comparators instead of calling StringDiffOperation which is
- CVS-specific and uses internal classes. Sort the types of changes into new,
- removed, and changed and within each category perform alphabetic sort.
- (extractSynchronizeModelInfo): New method to extract all elements of the
- Synchronize tree via an ISynchronizeModelInfo object.
- (getChangedLines): New method to figure out what lines have changed in local
- resource.
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java:
- Change to superclass ChangeLogAction and also make it IWorkbenchWindowDelegate.
- (execute): Change to get current selection in current window. See if selection
- can be used to either get an IResource directly, via IAdapter interface, or
- through an ISynchronizeModelElement. If not, look to see if the SynchronizeView
- is open and see if a resource is selected. Do not use current editor, nor bring
- up choose project dialog.
- (init, getWorkbenchWindow, getActiveWorkbenchShell): New methods.
- (run): Ditto.
- (PrepareChangeLog): New constructor.
- * src/org/eclipse/linuxtools/changelog/core/actions/PrepareCommitAction.java
- (doRun): String clean-up.
- (extractNewlines): Removed.
- (loadClipboard): Use line comparators to generate patch for ChangeLog instead of
- using StringDiffOperation class.
- * src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java:
- Remove.
-
2007-08-16 Andrew Overholt <overholt@redhat.com>
* build.properties: Change to be jarred plugin and not contain changelog.jar.
- * META-INF/MANIFEST.MF: Change from changelog.jar to .. Set required EE. Bump to
- 2.5.1.
+ * META-INF/MANIFEST.MF: Change from changelog.jar to .. Set required EE. Bump
+ to 2.5.1.
2007-08-07 klee <klee@redhat.com>
@@ -114,11 +13,12 @@
* META-INF/MANIFEST.MF: Version bump to 2.5.0.
* src/org/eclipse/linuxtools/changelog/core/actions/FormatChangeLogAction.java:
Removed unused imports.
- * src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java: Ditto.
+ * src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java:
+ Ditto.
* src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java:
Ditto.
- * src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java: Added
- support for new files.
+ * src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java:
+ Added support for new files.
* src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java:
Ditto. + Removed internal class reference.
* src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java:
@@ -129,9 +29,10 @@
Removed internal class reference.
* src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java:
Added a constructor with default options for DiffOperation.
- * src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java: Added support
- for inserting default content to changelog entry.
- * src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java: Ditto.
+ * src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java:
+ Added support for inserting default content to changelog entry.
+ * src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java:
+ Ditto.
* src/org/eclipse/linuxtools/changelog/core/IFormatterChangeLogContrib.java:
Ditto.
@@ -139,20 +40,22 @@
* src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java
(StringDiffOperation): Added support for Eclipse 3.3
- * META-INF/MANIFEST.MF: Version bump to 2.4.1 and add dependency for Eclipse
- 3.3.
+ * META-INF/MANIFEST.MF: Version bump to 2.4.1 and add dependency for Eclipse 3.3.
-2007-05-09 Kyu Lee <klee@redhat.com>
+2007-05-09 Kyu Lee <klee@redhat.com>
- * src/org/eclipse/linuxtools/changelog/core/parsers/JavaParser.java: Removed.
- Now separate javaparser plugin will provide parsing.
- * src/org/eclipse/linuxtools/changelog/core/parsers/CParser.java: Ditto.
- * src/org/eclipse/linuxtools/changelog/core/parsers/PythonParser.java: Ditto.
- * src/org/eclipse/linuxtools/changelog/core/parsers/CompareParser.java: Ditto.
+ * src/org/eclipse/linuxtools/changelog/core/parsers/JavaParser.java:
+ Removed. Now separate javaparser plugin will provide parsing.
+ * src/org/eclipse/linuxtools/changelog/core/parsers/CParser.java:
+ Ditto.
+ * src/org/eclipse/linuxtools/changelog/core/parsers/PythonParser.java:
+ Ditto.
+ * src/org/eclipse/linuxtools/changelog/core/parsers/CompareParser.java:
+ Ditto.
* src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java:
Removed JDT import for JavaModelException which we don't really need.
- * META-INF/MANIFEST.MF: Removed JDT and CDT dependency because now Java/C
- parsers are in separate plug-ins.
+ * META-INF/MANIFEST.MF: Removed JDT and CDT dependency because
+ now Java/C parsers are in separate plug-ins.
* plugin.xml: Version bump to 2.4.0 and remove parser extensions.
2007-05-04 Andrew Overholt <overholt@redhat.com>
@@ -160,43 +63,52 @@
Bug #185598
* META-INF/MANIFEST.MF: Add "Incubation" to Bundle-Name.
-2007-04-10 Kyu Lee <klee@redhat.com>
+2007-04-10 Kyu Lee <klee@redhat.com>
- * plugin.xml: Igor's patch to renamespace old com.redhat strings bug #181497.
- * src/org/eclipse/linuxtools/changelog/core/parsers/JavaParser.java: Removed use
- of internal classes.
+ * plugin.xml: Igor's patch to renamespace old com.redhat strings
+ bug #181497.
+ * src/org/eclipse/linuxtools/changelog/core/parsers/JavaParser.java:
+ Removed use of internal classes.
2007-03-28 Remy Chi Jian Suen <remy.suen@gmail.com>
- * src/org/eclipse/linuxtools/changelog/core/parsers/JavaParser.java: Add support
- for identifying static initializing blocks per bug #179549.
+ * src/org/eclipse/linuxtools/changelog/core/parsers/JavaParser.java:
+ Add support for identifying static initializing blocks per bug #179549.
2007-03-27 Ben Konrath <bkonrath@redhat.com>
* src/org/eclipse/linuxtools/changelog/core/editors/GNUHyperlinkDetector.java:
- Don't use internal classes.
+ Don't use internal classes.
* .svnignore: Rename from .cvsignore.
2007-03-26 Kyu Lee <klee@redhat.com>
* META-INF/MANIFEST.MF: Added.
- * plugin.xml: Migrated require and other declarations to MANIFEST.MF. Fixed
- extension declarations to work with new namespace.
+ * plugin.xml: Migrated require and other declarations to MANIFEST.MF.
+ Fixed extension declarations to work with new namespace.
2007-01-24 Kyu Lee <klee@redhat.com>
- * src/com/redhat/eclipse/changelog/core/parsers/PythonParser.java: Changed
- copyright to Phil Muldoon.
- * src/com/redhat/eclipse/changelog/core/parsers/JavaParser.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/parsers/CParser.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/parsers/CompareParser.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/formatters/GNUFormat.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/actions/InsertChangeLogKeyHandler.java:
+ * src/com/redhat/eclipse/changelog/core/parsers/PythonParser.java:
+ Changed copyright to Phil Muldoon.
+ * src/com/redhat/eclipse/changelog/core/parsers/JavaParser.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/parsers/CParser.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/parsers/CompareParser.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/formatters/GNUFormat.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/actions/InsertChangeLogKeyHandler.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/IParserChangeLogContrib.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/IFormatterChangeLogContrib.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/ChangeLogPreferencesPage.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/ChangelogPlugin.java:
Ditto.
- * src/com/redhat/eclipse/changelog/core/IParserChangeLogContrib.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/IFormatterChangeLogContrib.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/ChangeLogPreferencesPage.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/ChangelogPlugin.java: Ditto.
2007-01-23 Kyu Lee <klee@redhat.com>
@@ -204,12 +116,13 @@
2007-01-22 Kyu Lee <klee@redhat.com>
- * src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java:
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java:
Error checking.
- * src/com/redhat/eclipse/changelog/core/actions/PatchRangeElement.java: Minor
- design changes.
- * src/com/redhat/eclipse/changelog/core/actions/PatchFile.java: Ditto.
- * src/com/redhat/eclipse/changelog/core/actions/InsertChangeLogKeyHandler.java:
+ * src/com/redhat/eclipse/changelog/core/actions/PatchRangeElement.java:
+ Minor design changes.
+ * src/com/redhat/eclipse/changelog/core/actions/PatchFile.java:
+ Ditto.
+ * src/com/redhat/eclipse/changelog/core/actions/InsertChangeLogKeyHandler.java:
Files without proper parsers to guess function names generates changelog entry.
* plubin.xml: Bumped version to 2.3.4.
@@ -219,26 +132,29 @@
2006-11-16 Kyu Lee <klee@redhat.com>
- * src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java
+ * src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java
(getDocumentLocation): Improved error handling. Returns empty string when
current editor/workspace is not set properly.
2006-11-15 Kyu Lee <klee@redhat.com>
- * src/com/redhat/eclipse/changelog/core/actions/PrepareChangelogKeyHandler.java
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareChangelogKeyHandler.java
(execute): Prepare ChangeLog defaults to currently-selected project. BZ#214430.
2006-11-13 Kyu Lee <klee@redhat.com>
- * src/com/redhat/eclipse/changelog/core/actions/PrepareCommitAction.java New
- class for implementation of filling clipboard with changes in ChangeLog.
- * src/com/redhat/eclipse/changelog/core/actions/PrepareCommitHandler.java New
- class that handles keybinding.
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareCommitAction.java
+ New class for implementation of filling clipboard with changes in ChangeLog.
+
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareCommitHandler.java
+ New class that handles keybinding.
+
* src/com/redhat/eclipse/changelog/core/editors/ChangeLogEditor.java
(editorContextMenuAboutToShow): Addes Fomratter action to context menu.
(ChangeLogEditor): Ditto.
+
* plugin.xml: Keybindings for changelog formatter and prepare commit added.
-
+
2006-10-13 Kyu Lee <klee@redhat.com>
* plugin.xml: Bump to version 2.3.3.
@@ -246,67 +162,71 @@
2006-10-06 Kyu Lee <klee@redhat.com>
* plugin.xml: Rename of KeyAction class to InsertChangeLogKeyHandler.
- * src/com/redhat/eclipse/changelog/core/ChangeLogWriter.java : Debug output.
- * src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java : Clean up.
+ * src/com/redhat/eclipse/changelog/core/ChangeLogWriter.java :
+ Debug output.
+ * src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java :
+ Clean up.
* src/com/redhat/eclipse/changelog/core/actions/InsertChangeLogKeyHandler.java :
Replaces KeyAction.java.
- * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java : Removed.
- Replaced by InsertChangeLogKeyHandler.java.
+ * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java :
+ Removed. Replaced by InsertChangeLogKeyHandler.java.
* src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java :
Clean up.
- * src/com/redhat/eclipse/changelog/core/actions/PrepareChangelogKeyHandler.java
- : Clean up.
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareChangelogKeyHandler.java :
+ Clean up.
(execute): Opens resource selection window to let users choose files that will
be used in prepare changelog feature.
- * src/com/redhat/eclipse/changelog/core/ui/ChangeLogActionProvider : Clean up.
+ * src/com/redhat/eclipse/changelog/core/ui/ChangeLogActionProvider :
+ Clean up.
2006-10-03 Kyu Lee <klee@redhat.com>
- * src/com/redhat/eclipse/changelog/core/ChangeLogWriter.java : Added.
+ * src/com/redhat/eclipse/changelog/core/ChangeLogWriter.java :
+ Added.
* src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java:
(insertChangelog): Removed. Refactored to a new class ChangeLogWriter.
- * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java:
+ * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java:
(run): Uses new ChangeLogWriter class.
- * src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java:
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java:
(outputMultipleEntryChangeLog): Uses new ChangeLogWriter class.
2006-09-29 Kyu Lee <klee@redhat.com>
- * plugin.xml: Added prepare changelog key binding(not implemented yet). Bumped
- version to 2.3.2.
- * src/com/redhat/eclipse/changelog/core/ui/ChangeLogActionProvider.java: Some
- cleanup.
- * src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java:
+ * plugin.xml: Added prepare changelog key binding(not implemented yet).
+ Bumped version to 2.3.2.
+ * src/com/redhat/eclipse/changelog/core/ui/ChangeLogActionProvider.java:
+ Some cleanup.
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareChangeLogAction.java:
(parseCurrentFunctionAtOffset): Modified to use new extension manager.
- * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java : Implemented new
- abstract methods.
+ * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java :
+ Implemented new abstract methods.
(run): Runs super's run instead.
- * src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java
- (run): Uses prepareChangelog instead.
+ * src/com/redhat/eclipse/changelog/core/actions/ChangeLogAction.java (run):
+ Uses prepareChangelog instead.
(reportErr): New method for reporting errors.
- (insertChangelog): More generalized, clean, intuitive way of inserting
- changelog.
+ (insertChangelog): More generalized, clean, intuitive way of inserting changelog.
(getEntryFilePath): Returns file path of changelog entry.
(getEditorName): Returns name of responsible editor for file specified in entry.
(parseFunctionName): Guesses current function name with given parser from
extension point.
(getChangelog): Finds/creates Changelog file.
- * src/com/redhat/eclipse/changelog/core/actions/PrepareChangelogKeyHandler.java:
+ * src/com/redhat/eclipse/changelog/core/actions/PrepareChangelogKeyHandler.java:
New Class reponsible for binding key to prepare changelog action.
- * src/com/redhat/eclipse/changelog/core/ChangeLogExtensionManager.java : New
- Class that manages extensions of changelog.
+ * src/com/redhat/eclipse/changelog/core/ChangeLogExtensionManager.java :
+ New Class that manages extensions of changelog.
+
2006-09-18 Kyu Lee <klee@redhat.com>
* plugin.xml: Bump version to 2.3.1.
- * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java
- (run): Handles exception when no editor is open.
+ * src/com/redhat/eclipse/changelog/core/actions/KeyAction.java (run):
+ Handles exception when no editor is open.
2006-09-14 Kyu Lee <klee@redhat.com>
- * plugin.xml: Bump version to 2.3.0 to differentiate with 2.2.X. Fixed key
- binding.
-
+ * plugin.xml: Bump version to 2.3.0 to differentiate with 2.2.X.
+ Fixed key binding.
+
2006-09-07 Igor Foox <ifoox@redhat.com>
* plugin.xml: Change definition of
@@ -709,8 +629,8 @@
2004-09-24 Phil Muldoon <pmuldoon@redhat.com>
- * plugin.xml : Added org.eclipse.linuxtools.changelog.core.parsers.JavaParser.
- Added org.eclipse.linuxtools.changelog.core.parsers.CParser. Added
+ * plugin.xml : Added org.eclipse.linuxtools.changelog.core.parsers.JavaParser. Added
+ org.eclipse.linuxtools.changelog.core.parsers.CParser. Added
org.eclipse.linuxtools.changelog.core.parsers.CompareParser. Added
org.eclipse.linuxtools.changelog.core.formatters.GNUFormat Added
com.redhat.eclipse.changelog.core.actions.KeyAction Removed
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/META-INF/MANIFEST.MF b/changelog/org.eclipse.linuxtools.changelog.core/META-INF/MANIFEST.MF
index 58bbcde21c..f409b4f819 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/META-INF/MANIFEST.MF
+++ b/changelog/org.eclipse.linuxtools.changelog.core/META-INF/MANIFEST.MF
@@ -2,19 +2,21 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ChangeLog Core Functionality (Incubation)
Bundle-SymbolicName: org.eclipse.linuxtools.changelog.core;singleton:=true
-Bundle-Version: 2.6.1
+Bundle-Version: 2.5.1
Bundle-Activator: org.eclipse.linuxtools.changelog.core.ChangelogPlugin
Bundle-Localization: plugin
Bundle-Vendor: Eclipse.org
Eclipse-LazyStart: true
Require-Bundle: org.eclipse.team.ui,
org.eclipse.ui.ide,
- org.eclipse.jface.text;bundle-version="3.3.0",
+ org.eclipse.jface.text,
org.eclipse.ui.workbench.texteditor,
org.eclipse.core.resources,
- org.eclipse.core.runtime;bundle-version="3.3.100",
- org.eclipse.ui;bundle-version="3.3.0",
- org.eclipse.ui.editors;bundle-version="3.3.0",
+ org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.ui.editors,
+ org.eclipse.team.cvs.ui,
+ org.eclipse.team.cvs.core;bundle-version="3.3.0",
org.eclipse.team.core,
org.eclipse.ui.navigator,
org.eclipse.compare
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties b/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties
index 55c065b9a1..b02c9a2472 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties
+++ b/changelog/org.eclipse.linuxtools.changelog.core/plugin.properties
@@ -9,10 +9,6 @@ gnuEditorConfig=GNU Editor
gnuFormatter=GNU Style
clActionSet=ChangeLog Action Set
clEntry=&ChangeLog Entry
-prepCl=Prepare &ChangeLog
-prepChangeLog=Prepare ChangeLog
-prepChangeLog.tooltip=Create a set of ChangeLog entries based on local changes
-prepSVNChangeLog=Prepare ChangeLog
insertCLEntry=Insert ChangeLog entry
insertCLEntryDesc=Insert a ChangeLog entry
prefTitle=ChangeLog
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/plugin.xml b/changelog/org.eclipse.linuxtools.changelog.core/plugin.xml
index 715e9bcdc4..a352988ca3 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/plugin.xml
+++ b/changelog/org.eclipse.linuxtools.changelog.core/plugin.xml
@@ -7,7 +7,8 @@
schema="schema/parserContribution.exsd"/>
<extension-point id="formatterContribution" name="Changelog Format Contribution" schema="schema/formatterContribution.exsd"/>
<extension-point id="editorContribution" name="ChangeLog Editor Contribution" schema="schema/editorContribution.exsd"/>
-
+ <extension-point id="locationContribution" name="ChangeLog location contribution" schema="schema/locationContribution.exsd"/>
+
<extension
point="org.eclipse.ui.commands">
@@ -51,28 +52,6 @@
menubarPath="edit/"
id="org.eclipse.linuxtools.changelog.core.actions.KeyAction">
</action>
- <action
- class="org.eclipse.linuxtools.changelog.core.actions.PrepareChangelogKeyHandler"
- definitionId="org.eclipse.linuxtools.changelog.core.preparechangelog"
- id="org.eclipse.linuxtools.changelog.core.action.prepChangeLog"
- label="%prepCl"
- menubarPath="project/"
- tooltip="%prepChangeLog.tooltip">
- <enablement>
- <or>
- <objectClass
- name="org.eclipse.core.resources.IResource">
- </objectClass>
- <objectClass
- name="org.eclipse.team.ui.synchronize.ISynchronizeModelElement">
- </objectClass>
- <objectState
- name="projectNature"
- value="org.eclipse.cdt.core.cnature">
- </objectState>
- </or>
- </enablement>
- </action>
</actionSet>
</extension>
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogExtensionManager.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogExtensionManager.java
index 8cdefe6540..f5d739c6d5 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogExtensionManager.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogExtensionManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -81,18 +81,18 @@ public class ChangeLogExtensionManager {
IConfigurationElement[] elements = parserExtensions
.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
- if (elements[i].getName().equals("parser") // $NON-NLS-1$
- && (elements[i].getAttribute("editor") // $NON-NLS-1$
+ if (elements[i].getName().equals("parser")
+ && (elements[i].getAttribute("editor")
.equals(editorName))) {
//$NON-NLS-1$
try {
IConfigurationElement bob = elements[i];
parserContributor = (IParserChangeLogContrib) bob
- .createExecutableExtension("class"); // $NON-NLS-1$
+ .createExecutableExtension("class");
return parserContributor;
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID,
+ new Status(IStatus.ERROR, "Changelog",
IStatus.ERROR, e.getMessage(), e));
}
@@ -140,9 +140,9 @@ public class ChangeLogExtensionManager {
List inFileFormatters = new LinkedList();
for (int i = 0; i < elements.length; i++) {
IConfigurationElement formatterConfigElement = elements[i];
- if (formatterConfigElement.getName().equals("formatter") // $NON-NLS-1$
- && formatterConfigElement.getAttribute("inFile") // $NON-NLS-1$
- .toLowerCase().equals("true")) { // $NON-NLS-1$
+ if (formatterConfigElement.getName().equals("formatter")
+ && formatterConfigElement.getAttribute("inFile")
+ .toLowerCase().equals("true")) {
inFileFormatters.add(elements[i]);
}
}
@@ -164,19 +164,20 @@ public class ChangeLogExtensionManager {
continue;
IConfigurationElement patternElement = patternElementTmp[0];
- if (patternElement.getAttribute("pattern") == null) { // $NON-NLS-1$
+ if (patternElement.getAttribute("pattern") == null) {
ChangelogPlugin
.getDefault()
.getLog()
.log(
new Status(
IStatus.ERROR,
- ChangelogPlugin.PLUGIN_ID,
+ "Changelog",
IStatus.ERROR,
- Messages.getString("ChangeLog.ErrNonPattern"), // $NON-NLS-1$
- new Exception(Messages.getString("ChangeLog.ErrNonPattern")))); // $NON-NLS-1$
+ "Got non-pattern child with inFile set to True",
+ new Exception(
+ "Got non-pattern child with inFile set to True")));
} else {
- String filePattern = patternElement.getAttribute("pattern"); // $NON-NLS-1$
+ String filePattern = patternElement.getAttribute("pattern");
try {
Pattern pattern = Pattern.compile(filePattern);
@@ -191,7 +192,7 @@ public class ChangeLogExtensionManager {
}
} catch (PatternSyntaxException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID,
+ new Status(IStatus.ERROR, "Changelog",
IStatus.ERROR, e.getMessage(), e));
}
}
@@ -205,14 +206,14 @@ public class ChangeLogExtensionManager {
// we cache the user's preferred formatter on the first run, and
// whenever it changes
if (cachedPrefFormatter == null
- || !cachedPrefFormatter.getAttribute("name").equals( // $NON-NLS-1$
+ || !cachedPrefFormatter.getAttribute("name").equals(
formatterName)) {
for (int i = 0; i < elements.length; i++) {
IConfigurationElement formatterConfigElement = elements[i];
if (formatterConfigElement.getName()
- .equals("formatter") && formatterConfigElement.getAttribute("inFile").toLowerCase().equals("false")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if (formatterConfigElement.getAttribute("name") // $NON-NLS-1$
+ .equals("formatter") && formatterConfigElement.getAttribute("inFile").toLowerCase().equals("false")) { //$NON-NLS-1$
+ if (formatterConfigElement.getAttribute("name")
.equals(formatterName))
cachedPrefFormatter = formatterConfigElement;
break;
@@ -230,10 +231,11 @@ public class ChangeLogExtensionManager {
.log(
new Status(
IStatus.ERROR,
- ChangelogPlugin.PLUGIN_ID,
+ "Changelog",
IStatus.ERROR,
- Messages.getString("ChangeLog.ErrRetrieveFormatter"), // $NON-NLS-1$
- new Exception(Messages.getString("ChangeLog.ErrRetrieveFormatter")))); // $NON-NLS-1$
+ "Could not retrieve user's preferred formatter, aborting action.",
+ new Exception(
+ "Could not retrieve user's preferred formatter, aborting action.")));
return null;
}
@@ -245,11 +247,11 @@ public class ChangeLogExtensionManager {
try {
return (IFormatterChangeLogContrib) formatterConfigElementToUse
- .createExecutableExtension("class"); // $NON-NLS-1$
+ .createExecutableExtension("class");
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e));
e.printStackTrace();
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogPreferencesPage.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogPreferencesPage.java
index 41874f99ec..17248448c6 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogPreferencesPage.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogPreferencesPage.java
@@ -112,19 +112,9 @@ public class ChangeLogPreferencesPage extends PreferencePage implements
}
protected static String getUserRealName() {
- String realUserName = System.getenv("ECLIPSE_CHANGELOG_REALNAME"); // $NON-NLS-1$
- if (realUserName != null)
- return realUserName;
return System.getProperty("gnu.gcj.user.realname", //$NON-NLS-1$
getUserName());
}
-
- protected static String getUserEmail() {
- String emailID = System.getenv("ECLIPSE_CHANGELOG_EMAIL"); // $NON-NLS-1$
- if (emailID != null)
- return emailID;
- return getUserName() + "@" + getHostName(); // $NON-NLS-1$
- }
protected static String getUserName() {
return System.getProperty("user.name"); //$NON-NLS-1$
@@ -148,8 +138,10 @@ public class ChangeLogPreferencesPage extends PreferencePage implements
// "IChangeLogConstants.AUTHOR_EMAIL", getUserName() + "@" +
// getHostName()); //$NON-NLS-1$ //$NON-NLS-2$
//
- store.setDefault("IChangeLogConstants.AUTHOR_NAME", getUserRealName()); //$NON-NLS-1$
- store.setDefault("IChangeLogConstants.AUTHOR_EMAIL", getUserEmail()); //$NON-NLS-1$
+ store.setDefault("IChangeLogConstants.AUTHOR_NAME", getUserRealName()); //$NON-NLS-1$ //$NON-NLS-2$
+ store
+ .setDefault(
+ "IChangeLogConstants.AUTHOR_EMAIL", getUserName() + "@" + getHostName()); //$NON-NLS-1$ //$NON-NLS-2$
store.setDefault("IChangeLogConstants.DEFAULT_FORMATTER", "GNU Style"); //$NON-NLS-1$ //$NON-NLS-2$
store.setDefault("IChangeLogConstants.DEFAULT_EDITOR", "GNU Editor"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java
index 8713618d51..c408012213 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangeLogWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -22,7 +22,7 @@ import org.eclipse.ui.IEditorPart;
*/
public class ChangeLogWriter {
- private String defaultContent = ""; // $NON-NLS-1$
+ private String defaultContent = "";
private String entryFilePath = null;
@@ -99,8 +99,8 @@ public class ChangeLogWriter {
|| changelog == null || dateLine == null
|| changelogLocation == null) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
- Messages.getString("ChangeLogWriter.ErrUninitialized"), null)); // $NON-NLS-1$
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR,
+ "Some element not set to write a Changelog", null));
return;
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java
index 0496809996..d1a4d3edcd 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ChangelogPlugin.java
@@ -28,9 +28,6 @@ import org.osgi.framework.BundleContext;
* The main plugin class to be used in the desktop.
*/
public class ChangelogPlugin extends AbstractUIPlugin {
-
- public final static String PLUGIN_ID = "org.eclipse.linuxtools.changelog.core"; // $NON-NLS-1$
-
// The shared instance.
private static ChangelogPlugin plugin;
@@ -99,17 +96,16 @@ public class ChangelogPlugin extends AbstractUIPlugin {
}
protected void initializeDefaultPreferences(IPreferenceStore store) {
- store.setDefault("IChangeLogConstants.DATE_FORMAT", "true"); // $NON-NLS-1$ // $NON-NLS-2$
- store.setDefault("IChangeLogConstants.APPEND_RESOURCE_PATH", "false"); // $NON-NLS-1$ // $NON-NLS-2$
+ store.setDefault("IChangeLogConstants.DATE_FORMAT", "true");
+ store.setDefault("IChangeLogConstants.APPEND_RESOURCE_PATH", "false");
- store.setDefault("IChangeLogConstants.AUTHOR_NAME", // $NON-NLS-1$
+ store.setDefault("IChangeLogConstants.AUTHOR_NAME",
ChangeLogPreferencesPage.getUserRealName());
- store.setDefault("IChangeLogConstants.AUTHOR_EMAIL", // $NON-NLS-2$
- ChangeLogPreferencesPage.getUserEmail());
- store.setDefault("IChangeLogConstants.DEFAULT_FORMATTER", // $NON-NLS-1$
- getResourceString("gnuFormatter")); // $NON-NLS-1$
- store.setDefault("IChangeLogConstants.DEFAULT_EDITOR", // $NON-NLS-1$
- getResourceString("gnuEditorConfig")); // $NON-NLS-1$
+ store.setDefault("IChangeLogConstants.AUTHOR_EMAIL",
+ ChangeLogPreferencesPage.getUserName() + "@"
+ + ChangeLogPreferencesPage.getHostName());
+ store.setDefault("IChangeLogConstants.DEFAULT_FORMATTER", "GNU Style");
+ store.setDefault("IChangeLogConstants.DEFAULT_EDITOR", "GNU Editor");
}
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/ChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/ChangeLogAction.java
index 28e428c281..87670cc760 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/ChangeLogAction.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/ChangeLogAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -7,7 +7,6 @@
*
* Contributors:
* Kyu Lee <klee@redhat.com> - initial API and implementation
- * Jeff Johnston <jjohnstn@redhat.com> - add removed files support
*******************************************************************************/
package org.eclipse.linuxtools.changelog.core.actions;
@@ -53,7 +52,7 @@ public abstract class ChangeLogAction extends Action {
protected String pref_AuthorEmail;
- protected String pref_ChangeLogName = "ChangeLog"; // $NON-NLS-1$
+ protected String pref_ChangeLogName = "ChangeLog";
protected String pref_Formatter;
@@ -73,7 +72,7 @@ public abstract class ChangeLogAction extends Action {
protected void reportErr(String msg, Exception e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, msg, e));
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, msg, e));
}
protected IWorkbench getWorkbench() {
@@ -115,7 +114,7 @@ public abstract class ChangeLogAction extends Action {
WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws CoreException {
try {
- monitor.beginTask(Messages.getString("ChangeLog.AddingChangeLog"), 2000); //$NON-NLS-1$
+ monitor.beginTask("Adding ChangeLog", 2000); //$NON-NLS-1$
changelog_File.create(initialContents, false, monitor);
if (monitor.isCanceled()) {
@@ -132,17 +131,17 @@ public abstract class ChangeLogAction extends Action {
new ProgressMonitorDialog(ws.getActiveWorkbenchWindow().getShell())
.run(true, true, operation);
} catch (InterruptedException e) {
- reportErr(Messages.getString("ChangeLog.ErrInterrupted"), e); // $NON-NLS-1$
+ reportErr("Interruped while creating changelog", e);
return null;
} catch (InvocationTargetException e) {
- reportErr(Messages.getString("ChangeLog.ErrInvocation"), e); // $NON-NLS-1$
+ reportErr("Couldn't create changelog process", e);
return null;
}
try {
myWorkspaceRoot.refreshLocal(2, null);
} catch (CoreException e) {
- reportErr(Messages.getString("ChangeLog.ErrRefresh"), e); // $NON-NLS-1$
+ reportErr("Couldn't refresh local resources", e);
return null;
}
@@ -212,57 +211,6 @@ public abstract class ChangeLogAction extends Action {
return null;
}
- /**
- * Find the ChangeLog for a file that is being removed. It can't be found and
- * it is possible that the directory it is in has also been removed.
- *
- * @param path Path of removed file
- * @return ChangeLog editor part that must be used to report removed file
- */
- protected IEditorPart getChangelogForRemovePath(IPath path) {
- IResource parent_resource = null;
- IPath loc_path = path;
- // Look from current loc up to find first folder that is still existing
- IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot();
- while (loc_path.segmentCount() > 0) {
- parent_resource = myWorkspaceRoot.findMember(loc_path);
- if (parent_resource != null)
- break;
- loc_path = loc_path.removeLastSegments(1);
- }
-
- if (parent_resource != null) {
- IResource parent_dec = parent_resource;
-
- while (parent_dec != null) {
- String parent_node = parent_dec.getFullPath().toOSString();
- parent_node = parent_node
- + System.getProperty("file.separator") + pref_ChangeLogName; //$NON-NLS-1$
-
- IResource change_log_res = myWorkspaceRoot
- .findMember(parent_node);
-
- if (change_log_res != null) {
- IProject proj_loc = parent_resource.getProject();
- IPath modified_changelog_path = change_log_res
- .getFullPath().removeFirstSegments(1);
- IFile change_log_file = proj_loc
- .getFile(modified_changelog_path);
-
- return openEditor(change_log_file);
- }
-
- parent_dec = (IResource) parent_dec.getParent();
-
- if (parent_dec == null) {
- break;
- }
- }
- }
-
- return null;
- }
-
protected IFile getDocumentIFile(IEditorPart currentEditor) {
IEditorInput cc = currentEditor.getEditorInput();
@@ -316,7 +264,7 @@ public abstract class ChangeLogAction extends Action {
pref_AuthorEmail = store.getString("IChangeLogConstants.AUTHOR_EMAIL"); //$NON-NLS-1$
pref_Formatter = store
- .getString("IChangeLogConstants.DEFAULT_FORMATTER"); // $NON-NLS-1$
+ .getString("IChangeLogConstants.DEFAULT_FORMATTER");
}
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java
index 9770f57fd3..4163e77684 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PatchFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -7,14 +7,12 @@
*
* Contributors:
* Kyu Lee <klee@redhat.com> - initial API and implementation
- * Jeff Johnston <jjohnstn@redhat.com> - add removed files support
*******************************************************************************/
package org.eclipse.linuxtools.changelog.core.actions;
import java.util.ArrayList;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -29,8 +27,6 @@ public class PatchFile {
private ArrayList pranges = new ArrayList();
private boolean newfile = false;
- private boolean removedfile = false;
- private IResource resource; // required only if dealing with change
public boolean isNewfile() {
@@ -41,22 +37,10 @@ public class PatchFile {
this.newfile = newfile;
}
- public boolean isRemovedFile() {
- return removedfile;
- }
-
- public void setRemovedFile(boolean removedfile) {
- this.removedfile = removedfile;
- }
-
public PatchFile(String filePath) {
fpath = new Path(filePath);
}
- public PatchFile(IPath filePath) {
- fpath = filePath;
- }
-
public void addLineRange(int from, int to) {
pranges.add(new PatchRangeElement(from, to, ""));
@@ -89,14 +73,6 @@ public class PatchFile {
return fpath;
}
- public void setResource(IResource resource) {
- this.resource = resource;
- }
-
- public IResource getResource() {
- return resource;
- }
-
public int countRanges() {
return pranges.size();
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java
index 359bb07710..6a5266db70 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006-2008 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -7,35 +7,29 @@
*
* Contributors:
* Kyu Lee <klee@redhat.com> - initial API and implementation
- * Jeff Johnston <jjohnstn@redhat.com> - remove CVS bindings, support removal
*******************************************************************************/
package org.eclipse.linuxtools.changelog.core.actions;
-import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Vector;
-
-import org.eclipse.compare.rangedifferencer.RangeDifference;
-import org.eclipse.compare.rangedifferencer.RangeDifferencer;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.IDiffElement;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.text.BadLocationException;
@@ -44,17 +38,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.linuxtools.changelog.core.ChangeLogWriter;
import org.eclipse.linuxtools.changelog.core.ChangelogPlugin;
import org.eclipse.linuxtools.changelog.core.IParserChangeLogContrib;
-import org.eclipse.linuxtools.changelog.core.LineComparator;
-import org.eclipse.linuxtools.changelog.core.Messages;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.IResourceDiff;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
-import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.ui.IActionDelegate;
import org.eclipse.ui.IContributorResourceAdapter;
import org.eclipse.ui.IEditorDescriptor;
@@ -80,7 +63,6 @@ public class PrepareChangeLogAction extends ChangeLogAction {
* @author klee
*
*/
-
private class MyDocumentProvider extends FileDocumentProvider {
public IDocument createDocument(Object element) throws CoreException {
@@ -120,7 +102,7 @@ public class PrepareChangeLogAction extends ChangeLogAction {
return parser.parseCurrentFunction(input, offset);
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e));
}
return "";
@@ -154,12 +136,13 @@ public class PrepareChangeLogAction extends ChangeLogAction {
* @see IActionDelegate#run(IAction)
*/
protected void doRun() {
+
IRunnableWithProgress code = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
- monitor.beginTask(Messages.getString("ChangeLog.PrepareChangeLog"), 1000); // $NON-NLS-1$
- prepareChangeLog(monitor);
+ monitor.beginTask("Preparing ChangeLog", 1000);
+ preapreChangeLog(monitor);
monitor.done();
}
};
@@ -171,12 +154,12 @@ public class PrepareChangeLogAction extends ChangeLogAction {
pd.run(false /* fork */, false /* cancelable */, code);
} catch (InvocationTargetException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e));
return;
} catch (InterruptedException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e));
}
}
@@ -205,224 +188,106 @@ public class PrepareChangeLogAction extends ChangeLogAction {
}
return null;
}
-
- private void extractSynchronizeModelInfo (ISynchronizeModelElement d, IPath path, Vector newList, Vector removeList, Vector changeList) {
- // Recursively traverse the tree for children and sort leaf elements into their respective change kind sets.
- // Don't add entries for ChangeLog files though.
- if (d.hasChildren()) {
- IPath newPath = path.append(d.getName());
- IDiffElement[] elements = d.getChildren();
- for (int i = 0; i < elements.length; ++i) {
- if (elements[i] instanceof ISynchronizeModelElement)
- extractSynchronizeModelInfo((ISynchronizeModelElement)elements[i], newPath, newList, removeList, changeList);
- else if (!(d.getName().equals("ChangeLog"))) { // $NON-NLS-1$
- IPath finalPath = path.append(d.getName());
- PatchFile p = new PatchFile(finalPath);
- int kind = d.getKind() & Differencer.CHANGE_TYPE_MASK;
- if (kind == Differencer.CHANGE) {
- changeList.add(p);
- // Save the resource so we can later figure out what lines changed
- p.setResource(d.getResource());
- }
- else if (kind == Differencer.ADDITION) {
- p.setNewfile(true);
- newList.add(p);
- }
- else if (kind == Differencer.DELETION) {
- p.setRemovedFile(true);
- removeList.add(p);
- }
- }
- }
- } else if (!(d.getName().equals("ChangeLog"))) { // $NON-NLS-1$
- IPath finalPath = path.append(d.getName());
- PatchFile p = new PatchFile(finalPath);
- int kind = d.getKind() & Differencer.CHANGE_TYPE_MASK;
- if (kind == Differencer.CHANGE) {
- changeList.add(p);
- // Save the resource so we can later figure out what lines changed
- p.setResource(d.getResource());
- }
- else if (kind == Differencer.ADDITION) {
- p.setNewfile(true);
- newList.add(p);
- }
- else if (kind == Differencer.DELETION) {
- p.setRemovedFile(true);
- removeList.add(p);
- }
+
+ private ResourceMapping[] getResourceMappings(Object[] objects) {
+ List result = new ArrayList();
+ for (int i = 0; i < objects.length; i++) {
+ Object object = objects[i];
+ ResourceMapping mapping = getResourceMapping(object);
+ if (mapping != null)
+ result.add(mapping);
}
+ return (ResourceMapping[]) result.toArray(new ResourceMapping[result
+ .size()]);
}
- private void getChangedLines(Subscriber s, PatchFile p, IProgressMonitor monitor) {
- try {
- // For an outgoing changed resource, find out which lines
- // differ from the local file and its previous local version
- // (i.e. we don't want to force a diff with the repository).
- IDiff d = s.getDiff(p.getResource());
- if (d instanceof IThreeWayDiff
- && ((IThreeWayDiff)d).getDirection() == IThreeWayDiff.OUTGOING) {
- IThreeWayDiff diff = (IThreeWayDiff)d;
- monitor.beginTask(null, 100);
- IResourceDiff localDiff = (IResourceDiff)diff.getLocalChange();
- IFile file = (IFile)localDiff.getResource();
- monitor.subTask(Messages.getString("ChangeLog.MergingDiffs")); // $NON-NLS-1$
- String osEncoding = file.getCharset();
- IFileRevision ancestorState = localDiff.getBeforeState();
- IStorage ancestorStorage;
- if (ancestorState != null)
- ancestorStorage = ancestorState.getStorage(monitor);
- else
- ancestorStorage = null;
-
- RangeDifference[] rd = null;
- try {
- // We compare using a standard differencer to get ranges
- // of changes. We modify them to be document-based (i.e.
- // first line is line 1) and store them for later parsing.
- LineComparator left = new LineComparator(ancestorStorage.getContents(), osEncoding);
- LineComparator right = new LineComparator(file.getContents(), osEncoding);
- rd = RangeDifferencer.findDifferences(left, right);
- for (int j = 0; j < rd.length; ++j) {
- RangeDifference tmp = rd[j];
- if (tmp.kind() == RangeDifference.CHANGE) {
- int rightLength = tmp.rightLength() > 0 ? tmp.rightLength() : tmp.rightLength() + 1;
- p.addLineRange(tmp.rightStart() + 1, tmp.rightStart() + rightLength);
- }
- }
- } catch (UnsupportedEncodingException e) {
- // do nothing for now
- }
- monitor.done();
+ private void preapreChangeLog(IProgressMonitor monitor) {
- }
- } catch (CoreException e) {
- // Do nothing if error occurs
- }
- }
-
- private void prepareChangeLog(IProgressMonitor monitor) {
+ // getParserContributions();
+ String diffResult = null;
+ String projectPath = null;
Object element = selected.getFirstElement();
-
- IResource resource = null;
- Vector newList = new Vector();
- Vector removeList = new Vector();
- Vector changeList = new Vector();
- int totalChanges = 0;
-
- if (element instanceof IResource) {
- resource = (IResource)element;
- } else if (element instanceof ISynchronizeModelElement) {
- ISynchronizeModelElement sme = (ISynchronizeModelElement)element;
- resource = sme.getResource();
- } else if (element instanceof IAdaptable) {
- resource = (IResource)((IAdaptable)element).getAdapter(IResource.class);
- }
- if (resource == null)
- return;
+ ResourceMapping[] mappings = getResourceMappings(selected.toArray());
- IProject project = resource.getProject();
+ IResource resource = (IResource) element;
- // Get the repository provider so we can support multiple types of
- // code repositories without knowing exactly which (e.g. CVS, SVN, etc..).
- RepositoryProvider r = RepositoryProvider.getProvider(project);
- if (r == null)
- return;
- SyncInfoSet set = new SyncInfoSet();
- Subscriber s = r.getSubscriber();
- if (s == null)
+ projectPath = resource.getProject().getFullPath().toOSString();
+
+ try {
+
+ StringDiffOperation sdo = new StringDiffOperation(getWorkbench()
+ .getActiveWorkbenchWindow().getPartService()
+ .getActivePart(), mappings,
+ false, true,
+ ResourcesPlugin.getWorkspace().getRoot().getFullPath());
+
+ sdo.execute(monitor);
+
+ diffResult = sdo.getResult();
+ }catch (Exception e) {
+
+ e.printStackTrace();
return;
- if (element instanceof ISynchronizeModelElement) {
- // We can extract the ChangeLog list from the synchronize view which
- // allows us to skip items removed from the view
- ISynchronizeModelElement d = (ISynchronizeModelElement)element;
- while (d.getParent() != null)
- d = (ISynchronizeModelElement)d.getParent();
- extractSynchronizeModelInfo(d, new Path(""), newList, removeList, changeList);
- totalChanges = newList.size() + removeList.size() + changeList.size();
}
- else {
- // We can then get a list of all out-of-sync resources.
- s.collectOutOfSync(new IResource[] {project}, IResource.DEPTH_INFINITE, set, monitor);
- SyncInfo[] infos = set.getSyncInfos();
- totalChanges = infos.length;
- // Iterate through the list of changed resources and categorize them into
- // New, Removed, and Changed lists.
- for (int i = 0; i < infos.length; ++i) {
- int kind = SyncInfo.getChange(infos[i].getKind());
- PatchFile p = new PatchFile(infos[i].getLocal().getFullPath());
-
- // Check the type of entry and sort into lists. Do not add an entry
- // for ChangeLog files.
- if (!(p.getPath().lastSegment().equals("ChangeLog"))) { // $NON-NLS-1$
- if (kind == SyncInfo.ADDITION) {
- p.setNewfile(true);
- newList.add(p);
- } else if (kind == SyncInfo.DELETION) {
- p.setRemovedFile(true);
- removeList.add(p);
- } else if (kind == SyncInfo.CHANGE) {
- changeList.add(p);
- // Save the resource so we can later figure out which lines were changed
- p.setResource(infos[i].getLocal());
- }
- }
- }
+
+ if (diffResult == null) {
+ ChangelogPlugin.getDefault().getLog().log(
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR,
+ "Could not get diff", new Exception(
+ "No diff result from CVS")));
+ return;
}
-
- if (totalChanges == 0)
- return; // nothing to parse
-
- PatchFile[] patchFileInfoList = new PatchFile[totalChanges];
-
- // Group like changes together and sort them by path name.
- // We want removed files, then new files, then changed files.
- // To get this, we put them in the array in reverse order.
- int index = 0;
- if (changeList.size() > 0) {
- // Get the repository provider so we can support multiple types of
- // code repositories without knowing exactly which (e.g. CVS, SVN, etc..).
- Collections.sort(changeList, new PatchFileComparator());
- int size = changeList.size();
- for (int i = 0; i < size; ++i) {
- PatchFile p = (PatchFile)changeList.get(i);
- getChangedLines(s, p, monitor);
- patchFileInfoList[index+(size-i-1)] = p;
- }
- index += size;
+ if (projectPath == null) {
+ ChangelogPlugin.getDefault().getLog().log(
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR,
+ "Could not get project path", new Exception(
+ "Couldn't get project path")));
+ return;
}
-
- if (newList.size() > 0) {
- Collections.sort(newList, new PatchFileComparator());
- int size = newList.size();
- for (int i = 0; i < size; ++i)
- patchFileInfoList[index+(size-i-1)] = (PatchFile)newList.get(i);
- index += size;
+
+ if (diffResult.equals(StringDiffOperation.EMPTY_DIFF)) {
+ MessageDialog.openInformation(getWorkbench()
+ .getActiveWorkbenchWindow().getShell(),
+ "Prepare ChangeLog - ChangeLog", "No changes found.");
+ return;
}
+ // parse the patch and get only info we need
+ // filename, which line has changed.(range)
+
- if (removeList.size() > 0) {
- Collections.sort(removeList, new PatchFileComparator());
- int size = removeList.size();
- for (int i = 0; i < size; ++i)
- patchFileInfoList[index+(size-i-1)] = (PatchFile)removeList.get(i);
- }
-
+ monitor.subTask("Parsing diff result");
+ PatchFile[] patchFileInfoList = parseStandardPatch(diffResult,
+ projectPath, monitor);
+ monitor.worked(250);
// now, find out modified functions/classes.
// try to use the the extension point. so it can be extended easily
+
+ if (patchFileInfoList == null) {
+ // nothing to parse
+ return;
+ }
+
// for all files in patch file info list, get function guesses of each
// file.
- monitor.subTask(Messages.getString("ChangeLog.WritingMessage")); // $NON-NLS-1$
+ monitor.subTask("Writing ChangeLog");
int unitwork = 250 / patchFileInfoList.length;
for (int pfIndex = 0; pfIndex < patchFileInfoList.length; pfIndex++) {
// for each file
PatchFile pf = patchFileInfoList[pfIndex];
+ // System.out.println(pf.getPath().toOSString());
String[] funcGuessList = guessFunctionNames(pf);
- outputMultipleEntryChangeLog(pf, funcGuessList);
+ String defaultContent = null;
+
+ if (pf.isNewfile())
+ defaultContent = "New File.";
+
+ outputMultipleEntryChangeLog(pf.getPath().toOSString(), defaultContent,
+ funcGuessList);
/*
* // print info for debug
@@ -437,25 +302,16 @@ public class PrepareChangeLogAction extends ChangeLogAction {
protected IEditorPart changelog;
- public void outputMultipleEntryChangeLog(PatchFile pf, String[] functionGuess) {
-
- String defaultContent = null;
-
- if (pf.isNewfile())
- defaultContent = Messages.getString("ChangeLog.NewFile"); // $NON-NLS-1$
- else if (pf.isRemovedFile())
- defaultContent = Messages.getString("ChangeLog.RemovedFile"); // $NON-NLS-1$
+ public void outputMultipleEntryChangeLog(String entryFileName, String defaultContent,
+ String[] functionGuess) {
- IPath entryPath = pf.getPath();
- String entryFileName = entryPath.toOSString();
-
ChangeLogWriter clw = new ChangeLogWriter();
// load settings from extensions + user pref.
loadPreferences();
// get file path from target file
- clw.setEntryFilePath(entryPath.toOSString());
+ clw.setEntryFilePath(entryFileName);
if (defaultContent != null)
clw.setDefaultContent(defaultContent);
@@ -471,19 +327,13 @@ public class PrepareChangeLogAction extends ChangeLogAction {
IEditorPart changelog = null;
- if (pf.isRemovedFile())
- changelog = getChangelogForRemovePath(entryPath);
- else
- changelog = getChangelog(entryFileName);
+ changelog = getChangelog(entryFileName);
- // FIXME: this doesn't seem very useful or probable
if (changelog == null)
changelog = askChangeLogLocation(entryFileName);
if (changelog == null) {
- ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, // $NON-NLS-1$
- Messages.getString("ChangeLog.ErrNoChangeLog"), null)); // $NON-NLS-1$
+ System.out.println("oops, coudln't get changelog");
return;
}
@@ -498,27 +348,134 @@ public class PrepareChangeLogAction extends ChangeLogAction {
clw.setChangelogLocation(getDocumentLocation(clw.getChangelog(), true));
// print multiple changelog entries with different
- // function guess names. We default to an empty guessed name
- // if we have zero function guess names.
- int numFuncs = 0;
- clw.setGuessedFName(""); // $NON-NLS-1$
- if (functionGuess.length > 0) {
- for (int i = 0; i < functionGuess.length; i++) {
- if (!functionGuess[i].trim().equals("")) { // $NON-NLS-1$
- ++numFuncs;
- clw.setGuessedFName(functionGuess[i]);
- clw.writeChangeLog();
- }
- }
- }
- // Default an empty entry if we did not have any none-empty
- // function guesses.
- if (numFuncs == 0) {
+ // function guess names.
+ for (int i = 0; i < functionGuess.length; i++) {
+
+ clw.setGuessedFName(functionGuess[i]);
clw.writeChangeLog();
}
}
+ /**
+ * Parses patch generated by CVS diff into <code>PatchFile</code> array.
+ *
+ * @param diffResult
+ * patch file
+ * @param projectPathh
+ * local parent path for the patch
+ * @return array of PatchFile info
+ */
+ protected PatchFile[] parseStandardPatch(String diffResult,
+ String projectPath, IProgressMonitor monitor) {
+ StringTokenizer st = new StringTokenizer(diffResult, "\n");
+ ArrayList fileList = new ArrayList();
+
+ // regex pattern for matching line info in standard patch.
+ Pattern lineInfoPattern = Pattern
+ .compile("(\\d+|\\d+,\\d+)[adc](\\d+|\\d+,\\d+)");
+
+ boolean inRange = false;
+ if (st.countTokens() == 0)
+ return null;
+ int unitwork = 250 / st.countTokens();
+ boolean newFileFlag = false;
+ while (st.hasMoreTokens()) {
+ String ln = st.nextToken();
+ // this line contains file path relative to resource
+ // and starts new file entry
+ if (ln.indexOf("Index: ") == 0) {
+ String fullPath = projectPath + "/" + ln.substring(7);
+
+ // ignore all ChangeLogs
+ if (fullPath.substring(
+ fullPath.length() - "ChangeLog".length(),
+ fullPath.length()).equals("ChangeLog")) {
+ continue;
+ }
+
+ // System.out.println(fullPath + "- full path");
+ fileList.add(new PatchFile(fullPath));
+ inRange = false;
+ continue;
+ }
+
+ // if this file is a new file, flag it
+ if (ln.indexOf("diff -N") == 0) {
+ newFileFlag = true;
+ continue;
+ }
+ if (fileList.size() > 0) {
+
+ PatchFile tpe = (PatchFile) fileList.get(fileList.size() - 1);
+ if (tpe != null) {
+
+ Matcher linem = lineInfoPattern.matcher(ln);
+
+ // if newfileflag is set, add this info to PatchFile object
+ if (newFileFlag) {
+ tpe.setNewfile(true);
+ newFileFlag=false;
+ }
+
+ if (linem.matches()) {
+ inRange = true;
+ int from = 1;
+ int length = 0;
+
+ int modifierIndex;
+
+ if ((modifierIndex = ln.indexOf("a")) < 0)
+ if ((modifierIndex = ln.indexOf("d")) < 0)
+ modifierIndex = ln.indexOf("c");
+
+ // String firstHalf = ln.substring(0, modifierIndex);
+ String secondHalf = ln.substring(modifierIndex + 1);
+
+ int commaIndex;
+ switch (ln.charAt(modifierIndex)) {
+
+ case 'a':
+ case 'c':
+
+ if ((commaIndex = secondHalf.indexOf(",")) >= 0) {
+ from = Integer.parseInt(secondHalf.substring(0,
+ commaIndex));
+ length = Integer.parseInt(secondHalf
+ .substring(commaIndex + 1))
+ - Integer.parseInt(secondHalf
+ .substring(0, commaIndex));
+ } else {
+ from = Integer.parseInt(secondHalf);
+ }
+
+ break;
+
+ case 'd':
+ from = Integer.parseInt(secondHalf);
+ from++;
+ break;
+ }
+
+ tpe.addLineRange(from, from + length);
+ continue;
+ }
+
+ // add actual patch just in case if we need it later.
+ if (inRange)
+ tpe.appendTxtToLastRange(ln);
+
+ }
+ }
+ monitor.worked(unitwork);
+ }
+
+ PatchFile[] parseResult = new PatchFile[fileList.size()];
+ for (int i = 0; i < fileList.size(); i++)
+ parseResult[i] = (PatchFile) fileList.get(i);
+
+ return (parseResult.length == 0) ? null : parseResult;
+ }
/**
* Guesses the function effected/modified by the patch from local file(newer
@@ -531,24 +488,24 @@ public class PrepareChangeLogAction extends ChangeLogAction {
private String[] guessFunctionNames(PatchFile patchFileInfo) {
- // if this file is new file or removed file, do not guess function files
+ // if this file is new file, do not guess function files
// TODO: create an option to include function names on
// new files or not
- if (patchFileInfo.isNewfile() || patchFileInfo.isRemovedFile()) {
+ if (patchFileInfo.isNewfile()) {
return new String[]{""};
}
String[] fnames = new String[0];
- String editorName = ""; // $NON-NLS-1$
+ String editorName = "";
try {
IEditorDescriptor ed = org.eclipse.ui.ide.IDE
.getEditorDescriptor(patchFileInfo.getPath().toOSString());
- editorName = ed.getId().substring(ed.getId().lastIndexOf(".") + 1); // $NON-NLS-1$
+ editorName = ed.getId().substring(ed.getId().lastIndexOf(".") + 1);
} catch (PartInitException e1) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
- e1.getMessage(), e1));
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e1
+ .getMessage(), e1));
return new String[0];
}
@@ -605,18 +562,18 @@ public class PrepareChangeLogAction extends ChangeLogAction {
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
- e.getMessage(), e));
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
+ .getMessage(), e));
} catch (BadLocationException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
- e.getMessage(), e));
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
+ .getMessage(), e));
} catch (Exception e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
- e.getMessage(), e));
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
+ .getMessage(), e));
}
return fnames;
}
-
+
} \ No newline at end of file
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java
index 081e60adad..721ad8a3fb 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangelogKeyHandler.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2006-2008 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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:
- * Red Hat, Inc. - initial API and implementation
+ * Kyu Lee <klee@redhat.com> - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.changelog.core.actions;
@@ -16,7 +16,6 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.commands.IHandlerListener;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceMapping;
@@ -25,26 +24,12 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.linuxtools.changelog.core.ChangelogPlugin;
-import org.eclipse.linuxtools.changelog.core.Messages;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
import org.eclipse.ui.IContributorResourceAdapter;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.dialogs.ResourceSelectionDialog;
import org.eclipse.ui.ide.IContributorResourceAdapter2;
/**
@@ -52,14 +37,7 @@ import org.eclipse.ui.ide.IContributorResourceAdapter2;
* @author klee
*
*/
-public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHandler, IWorkbenchWindowActionDelegate {
-
- private IWorkbenchWindow window;
-
- public PrepareChangelogKeyHandler() {
- super();
- }
-
+public class PrepareChangelogKeyHandler implements IHandler {
private ResourceMapping getResourceMapping(Object o) {
if (o instanceof ResourceMapping) {
return (ResourceMapping) o;
@@ -85,105 +63,67 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand
return null;
}
-
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IProject[] currentProject = null;
- IStructuredSelection tempResult = null;
+ IProject[] currentProject;
// try getting currently selected project
try {
- IWorkbenchPage ref = getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IWorkbenchPart part = ref.getActivePart();
- if (part instanceof IEditorPart) {
- // If we are in an editor, check if the file being edited is an IResource
- // that belongs to a project in the workspace
- IEditorPart editorPart = (IEditorPart)part;
- IEditorInput input = editorPart.getEditorInput();
- IResource r = (IResource)input.getAdapter(IResource.class);
- if (r != null) {
- // We have an IResource to work with, so create a selection we can use
- // in PrepareChangeLogAction
- tempResult = new StructuredSelection(r);
- }
- } else {
- // Otherwise, our view is not an editor, see if we have an IResource or something
- // that will lead us to an IResource
- ISelection selected = ref.getSelection();
- if (selected instanceof IStructuredSelection) {
- IResource r = null;
- IStructuredSelection iss = (IStructuredSelection)selected;
- Object o = ((IStructuredSelection)selected).getFirstElement();
- if (o instanceof ISynchronizeModelElement) {
- r = ((ISynchronizeModelElement)o).getResource();
- } else if (o instanceof IAdaptable) {
- r = (IResource)((IAdaptable)o).getAdapter(IResource.class);
- }
- if (r != null)
- tempResult = iss;
- }
- }
- if (tempResult == null) {
- // We don't have an obvious project match in the current active view.
- // Let's search all open views for the Synchronize View which is our first
- // choice to fall back on.
- IViewReference[] views = ref.getViewReferences();
- for (int j = 0; j < views.length; ++j) {
- if (views[j].getId().equals("org.eclipse.team.sync.views.SynchronizeView")) { // $NON-NLS-1$
- IViewPart v = views[j].getView(false);
- ISelection s = null;
- ISelectionProvider sp = v.getViewSite().getSelectionProvider();
- if (sp != null) {
- s = sp.getSelection();
- }
- if (s != null && s instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)s;
- Object element = ss.getFirstElement();
- IResource r = null;
- if (element instanceof ISynchronizeModelElement) {
- r = ((ISynchronizeModelElement)element).getResource();
- } else if (element instanceof IAdaptable) {
- r = (IResource)((IAdaptable)element).getAdapter(IResource.class);
- }
-
- if (r != null) {
- tempResult = ss;
- }
- }
- }
- }
- }
+ IEditorPart editor = getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage().getActiveEditor();
+ currentProject = (getResourceMapping(editor
+ .getEditorInput()).getProjects());
+
} catch (Exception e) {
- tempResult = null;
+ // if fail, no default selection
+ currentProject = new IProject[] {};
}
+
+
+
+
+
+ ResourceSelectionDialog rsd = new ResourceSelectionDialog(
+ ChangelogPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), workspaceRoot,
+ "Choose resources to be included in preparing changelog.");
+
+ rsd.setInitialSelections(currentProject);
- // If we can't find the project directly, let the user know.
- if (tempResult == null) {
- MessageDialog.openInformation(getActiveWorkbenchShell(), Messages.getString("ChangeLog.PrepareChangeLog"), // $NON-NLS-1$,
- Messages.getString("PrepareChangeLog.InfoNoProjectFound")); // $NON-NLS-1$
- return null;
- }
+ rsd.open();
+
+ final Object[] result = rsd.getResult();
+
+
+ if (result == null)
+ return null; // user didn't select anything or pressed cancel
+
+
+
- final IStructuredSelection result = tempResult;
try {
- Action exampleAction;
- exampleAction = new PrepareChangeLogAction() {
- public void run() {
- setSelection(result);
- doRun();
- }
- };
+
+ Action exampleAction;
+ exampleAction = new PrepareChangeLogAction() {
+ public void run() {
+ setSelection(new StructuredSelection(result));
- exampleAction.run();
+ doRun();
+ }
+ };
+ exampleAction.run();
+
} catch (Exception e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR,
e.getMessage(), e));
}
+
+
return null;
}
@@ -196,38 +136,6 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand
}
public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- this.window = window;
- }
-
- protected IWorkbenchWindow getWorkbenchWindow() {
- return window;
- }
-
- /**
- * Returns active shell.
- */
- protected Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- return window.getShell();
- }
- return null;
- }
-
- public void run(IAction action) {
-
- try {
- execute(null);
- } catch (ExecutionException e) {
-
- reportErr(Messages.getString("PrepareChangeLog.ErrExecuteFailed"), e); // $NON-NLS-1$
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
}
@@ -244,5 +152,5 @@ public class PrepareChangelogKeyHandler extends ChangeLogAction implements IHand
public void removeHandlerListener(IHandlerListener handlerListener) {
}
-
+
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareCommitAction.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareCommitAction.java
index 7a74a1b3ed..d44babf42e 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareCommitAction.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/PrepareCommitAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -10,20 +10,11 @@
*******************************************************************************/
package org.eclipse.linuxtools.changelog.core.actions;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
+import java.util.StringTokenizer;
-import org.eclipse.compare.rangedifferencer.RangeDifference;
-import org.eclipse.compare.rangedifferencer.RangeDifferencer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -32,21 +23,10 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.linuxtools.changelog.core.ChangelogPlugin;
-import org.eclipse.linuxtools.changelog.core.LineComparator;
-import org.eclipse.linuxtools.changelog.core.Messages;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.mapping.IResourceDiff;
-import org.eclipse.team.core.subscribers.Subscriber;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.synchronize.SyncInfoSet;
import org.eclipse.ui.IContributorResourceAdapter;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ide.IContributorResourceAdapter2;
@@ -79,12 +59,12 @@ public class PrepareCommitAction extends ChangeLogAction {
pd.run(false /* fork */, false /* cancelable */, code);
} catch (InvocationTargetException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e));
return;
} catch (InterruptedException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e));
return;
}
@@ -140,80 +120,49 @@ public class PrepareCommitAction extends ChangeLogAction {
// System.out.println(currentEditor.getTitle());
- String diffResult = "";
- IEditorInput input = currentEditor.getEditorInput();
- ResourceMapping mapping = getResourceMapping(input);
- // Experiment Jeff
- IProject project = mapping.getProjects()[0];
-
- RepositoryProvider r = RepositoryProvider.getProvider(project);
- SyncInfoSet set = new SyncInfoSet();
- Subscriber s = r.getSubscriber();
- s.collectOutOfSync(new IResource[] { (IResource)mapping.getModelObject() }, IResource.DEPTH_ZERO, set, monitor);
- SyncInfo[] infos = set.getSyncInfos();
+ String diffResult;
- if (infos.length == 1) {
- int kind = SyncInfo.getChange(infos[0].getKind());
- if (kind == SyncInfo.CHANGE) {
- try {
- IDiff d = s.getDiff(infos[0].getLocal());
- if (d instanceof IThreeWayDiff
- && ((IThreeWayDiff)d).getDirection() == IThreeWayDiff.OUTGOING) {
- IThreeWayDiff diff = (IThreeWayDiff)d;
- monitor.beginTask(null, 100);
- IResourceDiff localDiff = (IResourceDiff)diff.getLocalChange();
- IFile file = (IFile)localDiff.getResource();
- monitor.subTask(Messages.getString("ChangeLog.MergingDiffs")); // $NON-NLS-1$
- String osEncoding = file.getCharset();
- IFileRevision ancestorState = localDiff.getBeforeState();
- IStorage ancestorStorage;
- if (ancestorState != null)
- ancestorStorage = ancestorState.getStorage(monitor);
- else
- ancestorStorage = null;
+
+ try {
- RangeDifference[] rd = null;
+ StringDiffOperation sdo = new StringDiffOperation(getWorkbench()
+ .getActiveWorkbenchWindow().getPartService()
+ .getActivePart(), new ResourceMapping[] {getResourceMapping(currentEditor.getEditorInput())},
+ false, true,
+ ResourcesPlugin.getWorkspace().getRoot().getFullPath());
+ //NullProgressMonitor np = new NullProgressMonitor();
+ sdo.execute(monitor);
+
+ diffResult = sdo.getResult();
- try {
- LineComparator left = new LineComparator(ancestorStorage.getContents(), osEncoding);
- LineComparator right = new LineComparator(file.getContents(), osEncoding);
- rd = RangeDifferencer.findDifferences(left, right);
- for (int j = 0; j < rd.length; ++j) {
- RangeDifference tmp = rd[j];
- if (tmp.kind() == RangeDifference.CHANGE) {
- LineNumberReader l = new LineNumberReader(new InputStreamReader(file.getContents()));
- int rightLength = tmp.rightLength() > 0 ? tmp.rightLength() : tmp.rightLength() + 1;
- for (int i = 0; i < tmp.rightStart(); ++i) {
- try {
- l.readLine();
- } catch (IOException e) {
- break;
- }
- }
- for (int i = 0; i < rightLength; ++i) {
- try {
- diffResult += l.readLine() + "\n"; // $NON-NLS-1$
- } catch (IOException e) {
- // do nothing
- }
- }
- }
- }
- } catch (UnsupportedEncodingException e) {
- // do nothing for now
- }
- monitor.done();
- }
- } catch (CoreException e) {
- // do nothing
- }
- }
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ return;
}
- if (!diffResult.equals(""))
- populateClipboardBuffer(diffResult);
+
+ populateClipboardBuffer(extractNewLines(diffResult));
+
+
+
+ }
+
+ private String extractNewLines(String input) {
+
+ // System.out.println(input);
+ String output = "";
+ StringTokenizer st = new StringTokenizer(input, "\n");
+ while(st.hasMoreTokens()) {
+ String cr;
+ if ((cr = st.nextToken()).startsWith("> "))
+ output+=cr.substring(2,cr.length()) + "\n";
+ }
+ // System.out.println("\n\n" + output);
+ return output;
}
+
private void populateClipboardBuffer(String input) {
TextTransfer plainTextTransfer = TextTransfer.getInstance();
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java
new file mode 100644
index 0000000000..b792951d9a
--- /dev/null
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/actions/StringDiffOperation.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2006 Red Hat Inc. 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:
+ * Kyu Lee <klee@redhat.com> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.changelog.core.actions;
+
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import org.eclipse.core.resources.mapping.ResourceMapping;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.client.Diff;
+import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
+import org.eclipse.team.internal.ccvs.ui.operations.DiffOperation;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ *
+ * @author klee
+ *
+ */
+public class StringDiffOperation extends DiffOperation {
+
+
+ public static final String EMPTY_DIFF = "empty_diff";
+
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ private String diffResult = "";
+ private boolean diffDone = false;
+
+ public StringDiffOperation(IWorkbenchPart part, ResourceMapping[] mappings, LocalOption[] options, boolean isMultiPatch, boolean includeFullPathInformation, IPath patchRoot) {
+ super(part, mappings, options, isMultiPatch, includeFullPathInformation,patchRoot,null);
+
+
+ }
+
+
+ public StringDiffOperation(IWorkbenchPart part, ResourceMapping[] mappings, boolean isMultiPatch, boolean includeFullPathInformation, IPath patchRoot) {
+
+ super(part, mappings, new LocalOption[] { Diff.INCLUDE_NEWFILES }, isMultiPatch,includeFullPathInformation,
+ patchRoot,null);
+
+ }
+
+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException {
+ super.execute(monitor);
+
+ if (os.size() == 0 ||
+ (!patchHasContents && !patchHasNewFiles)) {
+ reportEmptyDiff();
+ } else {
+
+
+ diffResult = os.toString();
+ }
+
+ diffDone = true;
+
+ }
+
+
+ public String getResult() {
+ return diffDone ? diffResult : null;
+ }
+
+
+
+ protected PrintStream openStream() throws CVSException {
+ return new PrintStream(os);
+ }
+
+}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java
index 1e7b7ed0d1..21b042a420 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/editors/ChangeLogEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Red Hat Inc. and others.
+ * Copyright (c) 2006 Red Hat Inc. 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
@@ -22,7 +22,6 @@ import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.linuxtools.changelog.core.ChangelogPlugin;
import org.eclipse.linuxtools.changelog.core.IEditorChangeLogContrib;
-import org.eclipse.linuxtools.changelog.core.Messages;
import org.eclipse.linuxtools.changelog.core.actions.FormatChangeLogAction;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
@@ -49,9 +48,9 @@ public class ChangeLogEditor extends TextEditor {
setSourceViewerConfiguration(config);
} else
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR,
- Messages.getString("ChangeLogEditor.ErrConfiguration"), // $NON-NLS-1$
- new Exception(Messages.getString("ChangeLogEditor.ErrConfiguration")))); // $NON-NLS-1$
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR,
+ "Couldn't get editor configuration", new Exception(
+ "Couldn't get editor configuration")));
setDocumentProvider(new ChangeLogDocumentProvider());
@@ -60,7 +59,7 @@ public class ChangeLogEditor extends TextEditor {
/**
* Gets appropriate style editor from user pref.
*
- * @return configuration for the Changelog editor
+ * @return configuration for the Chagelog editor
*/
public SourceViewerConfiguration getConfig() {
@@ -72,28 +71,27 @@ public class ChangeLogEditor extends TextEditor {
IPreferenceStore store = ChangelogPlugin.getDefault()
.getPreferenceStore();
String pref_Editor = store
- .getString("IChangeLogConstants.DEFAULT_EDITOR"); // $NON-NLS-1$
+ .getString("IChangeLogConstants.DEFAULT_EDITOR");
editorExtensions = Platform.getExtensionRegistry().getExtensionPoint(
- "org.eclipse.linuxtools.changelog.core", "editorContribution"); //$NON-NLS-1$ //$NON-NLS-2$
+ "org.eclipse.linuxtools.changelog.core", "editorContribution"); //$NON-NLS-1$
if (editorExtensions != null) {
IConfigurationElement[] elements = editorExtensions
.getConfigurationElements();
for (int i = 0; i < elements.length; i++) {
- if (elements[i].getName().equals("editor") // $NON-NLS-1$
- && (elements[i].getAttribute("name").equals(pref_Editor))) { //$NON-NLS-1$
+ if (elements[i].getName().equals("editor") && (elements[i].getAttribute("name").equals(pref_Editor))) { //$NON-NLS-1$
try {
IConfigurationElement bob = elements[i];
editorContrib = (IEditorChangeLogContrib) bob
- .createExecutableExtension("class"); // $NON-NLS-1$
+ .createExecutableExtension("class");
editorContrib.setTextEditor(this);
return (SourceViewerConfiguration) editorContrib;
} catch (CoreException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID,
+ new Status(IStatus.ERROR, "Changelog",
IStatus.ERROR, e.getMessage(), e));
}
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java
index d2b474cf76..72f348f31b 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/formatters/GNUFormat.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 Phil Muldoon <pkmuldoon@picobot.org>.
+ * Copyright (c) 2004 Phil Muldoon <pkmuldoon@picobot.org>.
* 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
@@ -38,7 +38,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
final String line_sep = System.getProperty("line.separator"); //$NON-NLS-1$
- final String TAB = "\t"; // $NON-NLS-1$
+ final String TAB = "\t";
public String formatDateLine(String authorName, String authorEmail) {
@@ -56,9 +56,9 @@ public class GNUFormat implements IFormatterChangeLogContrib {
IDocument changelog_doc = getDocument(changelog);
String function = formatFunction(functionGuess);
boolean multipleEntrySuccess = false;
- String functionSpacer = " "; // $NON-NLS-1$
- if (function.equals(": ")) // $NON-NLS-1$
- functionSpacer = ""; // $NON-NLS-1$
+ String functionSpacer=" ";
+ if (function.equals(": "))
+ functionSpacer="";
if (changelog_doc.getLength() > 0) {
int offset_start = findChangeLogEntry(changelog_doc, dateLine);
@@ -72,7 +72,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
while (functLogEntry < nextChangeEntry) {
int line_length = 0;
- String entry = ""; // $NON-NLS-1$
+ String entry = "";
try {
line_length = changelog_doc
.getLineOfOffset(functLogEntry);
@@ -82,19 +82,11 @@ public class GNUFormat implements IFormatterChangeLogContrib {
// TODO Auto-generated catch block
e.printStackTrace();
}
- // Look to see if entry already exists for file (will be preceded by "*")
- if (entry.lastIndexOf("* " + fileDetail) > 0) {
+ if (entry.lastIndexOf(fileDetail) > 0) {
foundFunction = true;
- // Check for the case where the default content (e.g. new or removed file)
- // is being caught again because user has prepared the ChangeLog more than once.
- // In such a case, just return. We don't need to repeat ourselves.
- if (defaultContent.length() > 0) {
- if (entry.lastIndexOf(defaultContent) > 0)
- return ""; // $NON-NLS-1$
- }
int nextFunctLoc = functLogEntry + fileDetail.length()
+ 2;
- String nextFunc = ""; // $NON-NLS-1$
+ String nextFunc = "";
try {
nextFunc = changelog_doc.get(nextFunctLoc,
nextChangeEntry - nextFunctLoc);
@@ -102,16 +94,16 @@ public class GNUFormat implements IFormatterChangeLogContrib {
// TODO Auto-generated catch block
e1.printStackTrace();
}
- int foundFunc = nextFunc.indexOf("* "); // $NON-NLS-1$
+ int foundFunc = nextFunc.indexOf("* ");
if (foundFunc > 0) {
foundFunc--;
try {
while (changelog_doc.get(
nextFunctLoc + foundFunc, 1).equals(
- "\t") // $NON-NLS-1$
+ "\t")
|| changelog_doc.get(
nextFunctLoc + foundFunc, 1)
- .equals("\n")) // $NON-NLS-1$
+ .equals("\n"))
foundFunc--;
} catch (BadLocationException e2) {
// TODO Auto-generated catch block
@@ -133,7 +125,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
if (functLogEntry >= nextChangeEntry) {
functLogEntry = nextChangeEntry - 1;
try {
- while (changelog_doc.get(functLogEntry, 1).equals("\n")) // $NON-NLS-1$
+ while (changelog_doc.get(functLogEntry, 1).equals("\n"))
functLogEntry--;
} catch (BadLocationException e) {
// TODO Auto-generated catch block
@@ -145,18 +137,18 @@ public class GNUFormat implements IFormatterChangeLogContrib {
if (offset_start != -1) {
if (foundFunction) {
try {
- if (!function.equals(": ")) // $NON-NLS-1$
- changelog_doc.replace(functLogEntry, 0, "\n" + TAB // $NON-NLS-1$
- + function + " "); // $NON-NLS-1$
+ if (!function.equals(": "))
+ changelog_doc.replace(functLogEntry, 0, "\n" + TAB
+ + function+" ");
else
- changelog_doc.replace(functLogEntry, 0, "\n" + TAB // $NON-NLS-1$
+ changelog_doc.replace(functLogEntry, 0, "\n" + TAB
);
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ITextEditor edit = (ITextEditor) changelog;
- if (!function.equals(": ")) // $NON-NLS-1$
+ if (!function.equals(": "))
edit.selectAndReveal(functLogEntry + function.length()
+ 3, 0);
else
@@ -166,8 +158,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
} else {
try {
changelog_doc.replace(offset_end, 0, TAB
- + "* " + fileDetail + functionSpacer // $NON-NLS-1$
- + function + functionSpacer + defaultContent + "\n"); //$NON-NLS-1$
+ + "* " + fileDetail + functionSpacer+function+functionSpacer + defaultContent + "\n"); //$NON-NLS-1$
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -187,7 +178,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
try {
if (changelog_doc.getLength() > 0)
changelog_doc.replace(0, 0, "\n\n"); //$NON-NLS-1$
- changelog_doc.replace(0, 0, dateLine + TAB + "* " + fileDetail // $NON-NLS-1$
+ changelog_doc.replace(0, 0, dateLine + TAB + "* " + fileDetail
+ functionSpacer+function+functionSpacer);
ITextEditor edit = (ITextEditor) changelog;
@@ -200,7 +191,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
}
- return ""; // $NON-NLS-1$
+ return "";
}
@@ -213,8 +204,8 @@ public class GNUFormat implements IFormatterChangeLogContrib {
// Format Path. Is a full path specified, or just file name?
IWorkspaceRoot myWorkspaceRoot = getWorkspaceRoot();
String WorkspaceRoot = myWorkspaceRoot.getLocation().toOSString();
- String changeLogLocNoRoot = ""; // $NON-NLS-1$
- String editorFileLocNoRoot = ""; // $NON-NLS-1$
+ String changeLogLocNoRoot = "";
+ String editorFileLocNoRoot = "";
if (changeLogLocation.lastIndexOf(WorkspaceRoot) >= 0) {
changeLogLocNoRoot = changeLogLocation.substring(changeLogLocation
.lastIndexOf(WorkspaceRoot)
@@ -233,7 +224,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
File changelogLocation = new File(changeLogLocNoRoot);
File fileLocation = new File(editorFileLocNoRoot);
File reversePath = fileLocation.getParentFile();
- String reversePathb = ""; // $NON-NLS-1$
+ String reversePathb = "";
while (reversePath.getParentFile() != null) {
if (reversePath.compareTo(changelogLocation.getParentFile()) == 0)
@@ -252,7 +243,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
// but one that "looks" like an entry
int nextEntry = startOffset;
int line_length = 0;
- String entry = ""; // $NON-NLS-1$
+ String entry = "";
while (nextEntry < changelog_doc.getLength()) {
try {
// Get the line of interest in the changelog document
@@ -268,7 +259,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
nextEntry += changelog_doc.getLineLength(line_length);
} catch (BadLocationException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e
));
@@ -281,7 +272,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
private boolean matchDatePattern(String text) {
// Set up patterns for looking for the next date in the changelog
- SimpleDateFormat isoDate = new SimpleDateFormat("yyyy-MM-dd"); // $NON-NLS-1$
+ SimpleDateFormat isoDate = new SimpleDateFormat("yyyy-MM-dd");
// Try to find next Date bounded changelog entry by parsing date patterns
// First start with an ISO date
@@ -304,7 +295,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
region = findDocumentAptd.find(0, entry, true, false,/*whole world */ false, true);
} catch (BadLocationException e) {
ChangelogPlugin.getDefault().getLog().log(
- new Status(IStatus.ERROR, ChangelogPlugin.PLUGIN_ID, IStatus.ERROR, e
+ new Status(IStatus.ERROR, "Changelog", IStatus.ERROR, e
.getMessage(), e
));
@@ -323,7 +314,7 @@ public class GNUFormat implements IFormatterChangeLogContrib {
// If Function Guess is true, and Function Guess has found something
if (function.length() > 0)
- return "(" + function + "):"; // $NON-NLS-1$ // $NON-NLS-2$
+ return "(" + function + "):";
else
return ": "; //$NON-NLS-1$
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/strings.properties b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/strings.properties
index 9c8059e2da..e56688d6c9 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/strings.properties
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/strings.properties
@@ -3,26 +3,4 @@ AddAction.str_ChangeLog_Location=Select a location for the ChangeLog
ChangeLogPreferencesPage.Formatters=Formatters:
ChangeLogPreferencesPage.AuthorName=Author Name:
ChangeLogPreferencesPage.AuthorEmail=Author Email:
-ChangeLogPreferencesPage.Editors=Editors:
-
-ChangeLog.PrepareChangeLog=Prepare ChangeLog
-ChangeLog.NewFile=New file.
-ChangeLog.RemovedFile=Removed.
-ChangeLog.WritingMessage=Writing ChangeLog
-ChangeLog.MergingDiffs=Merging Diffs
-ChangeLog.AddingChangeLog=Adding ChangeLog
-
-ChangeLog.ErrInterrupted=Interrupted while creating ChangeLog
-ChangeLog.ErrInvocation=Couldn't create ChangeLog process
-ChangeLog.ErrRefresh=Couldn't refresh local resources
-ChangeLog.ErrNoChangeLog=Couldn't locate ChangeLog
-ChangeLog.ErrNonPattern=Got non-pattern child with inFile set to True
-ChangeLog.ErrRetrieveFormatter=Could not retrieve user's preferred formatter: aborting action
-
-PrepareChangeLog.ErrExecuteFailed=Executing prepare ChangeLog failed
-PrepareChangeLog.InfoNoProjectFound=Cannot prepare ChangeLog entry without a selected project.
-PrepareChangeLog.chooseResources=Choose resources to be included in preparing ChangeLog.
-
-ChangeLogEditor.ErrConfiguration=Couldn't get editor configuration
-
-ChangeLogWriter.ErrUninitialized=Some element of ChangeLog entry is uninitialized \ No newline at end of file
+ChangeLogPreferencesPage.Editors=Editors: \ No newline at end of file
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java
index 9fd765f3c7..85bde260af 100644
--- a/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java
+++ b/changelog/org.eclipse.linuxtools.changelog.core/src/org/eclipse/linuxtools/changelog/core/ui/ChangeLogActionProvider.java
@@ -15,7 +15,6 @@ import org.eclipse.core.resources.mapping.ResourceMapping;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.linuxtools.changelog.core.Messages;
import org.eclipse.linuxtools.changelog.core.actions.PrepareChangeLogAction;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
@@ -96,7 +95,7 @@ public class ChangeLogActionProvider extends CommonActionProvider {
* selected elements: " + buffer.toString()); } };
*/
- exampleAction = new PrepareChangeLogAction(Messages.getString("ChangeLog.PrepareChangeLog")) { // $NON-NLS-1$
+ exampleAction = new PrepareChangeLogAction("Prepare Changelog") {
public void run() {
setSelection((IStructuredSelection) getContext().getSelection());
doRun();
@@ -106,7 +105,7 @@ public class ChangeLogActionProvider extends CommonActionProvider {
}
- protected ISynchronizationCompareAdapter getCompareAdapter(
+ protected ISynchronizationCompareAdapter getCompareAdpater(
ResourceMapping mapping) {
if (mapping != null) {
ModelProvider provider = mapping.getModelProvider();

Back to the top