diff options
author | Andrew Overholt | 2011-02-28 19:47:42 +0000 |
---|---|---|
committer | Andrew Overholt | 2011-02-28 19:47:45 +0000 |
commit | e60507ab0cd984a1ecc35000beb852ba21047693 (patch) | |
tree | 11c3dc0124094bf691a9de2ae60a1f9022c11e23 | |
parent | c616970cf55808f4f4fe49518f4454851e31dac1 (diff) | |
parent | 8e6f0f95e04a0c6127dfdbfaf8f7c77704d97381 (diff) | |
download | org.eclipse.linuxtools-e60507ab0cd984a1ecc35000beb852ba21047693.tar.gz org.eclipse.linuxtools-e60507ab0cd984a1ecc35000beb852ba21047693.tar.xz org.eclipse.linuxtools-e60507ab0cd984a1ecc35000beb852ba21047693.zip |
Merge changelog 0.5.1
2 files changed, 56 insertions, 23 deletions
diff --git a/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog b/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog index 950138b7ee..44e7312a99 100644 --- a/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog +++ b/changelog/org.eclipse.linuxtools.changelog.core/ChangeLog @@ -1,3 +1,10 @@ +2010-03-25 Jeff Johnston <jjohnstn@redhat.com> + + Resolves #306247 + * src/org/eclipse/linuxtools/changelog/core/actions/PrepareChangeLogAction.java (outputMultipleEntryChangeLog): Make + a check for inline formatter before searching for a ChangeLog file. If the file does not have an inline formatter, + do not create a ChangeLog. + 2010-03-01 Jeff Johnston <jjohnstn@redhat.com> Resolves #304185 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 22bb635c91..52694b838f 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 @@ -28,6 +28,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IStorage; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; @@ -41,6 +42,7 @@ import org.eclipse.jface.text.IDocument; 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.IFormatterChangeLogContrib; import org.eclipse.linuxtools.changelog.core.IParserChangeLogContrib; import org.eclipse.linuxtools.changelog.core.LineComparator; import org.eclipse.linuxtools.changelog.core.Messages; @@ -57,6 +59,8 @@ import org.eclipse.ui.IActionDelegate; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.editors.text.FileDocumentProvider; import org.eclipse.ui.editors.text.StorageDocumentProvider; @@ -418,34 +422,56 @@ public class PrepareChangeLogAction extends ChangeLogAction { return; } - // get formatter - clw.setFormatter(extensionManager.getFormatterContributor( - entryFileName, pref_Formatter)); - + // Check if formatter is internal or inline..if inline, use the + // current active editor part, otherwise, we must find the external + // ChangeLog file. IEditorPart changelog = null; - - if (pf.isRemovedFile()) - changelog = getChangelogForRemovePath(entryPath); - else - 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$ - return; + + // Before accessing the getFormatterConfigElement, the getFormatContibutor + // method must be called to initialize. + extensionManager.getFormatterContributor(clw.getEntryFilePath(), + pref_Formatter); + IConfigurationElement formatterConfigElement = extensionManager + .getFormatterConfigElement(); + + if (formatterConfigElement.getAttribute("inFile").toLowerCase().equals( //$NON-NLS-1$ + "true")) { //$NON-NLS-1$ + try { + IWorkbenchPage ref = getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IWorkbenchPart part = ref.getActivePart(); + if (part instanceof IEditorPart) { + changelog = (IEditorPart)part; + } + clw.setFormatter(extensionManager.getFormatterContributor( + clw.getEntryFilePath(), pref_Formatter)); + } catch (Exception e) { + // do nothing changelog will be null + } + } else { + // external changelog + // get formatter + clw.setFormatter(extensionManager.getFormatterContributor( + entryFileName, pref_Formatter)); + + if (pf.isRemovedFile()) + changelog = getChangelogForRemovePath(entryPath); + else + changelog = getChangelog(entryFileName); + + // If there isn't a ChangeLog, we will not create one here. + // This prevents the situation whereby a project has an inline + // ChangeLog formatter and some other files have been modified + // as well (e.g. an rpm project). In that case, we don't want + // to create a separate ChangeLog for the end-user. + if (changelog == null) + return; } - // select changelog clw.setChangelog(changelog); - + // write to changelog - - clw.setDateLine(clw.getFormatter().formatDateLine(pref_AuthorName, + IFormatterChangeLogContrib formatter = clw.getFormatter(); + clw.setDateLine(formatter.formatDateLine(pref_AuthorName, pref_AuthorEmail)); clw.setChangelogLocation(getDocumentLocation(clw.getChangelog(), true)); |