Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 80749 Details for
Bug 150663
make commit comment templates repository or project specific
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
clipboard.txt (text/plain), 15.89 KB, created by
Steffen Pingel
on 2007-10-19 03:47:01 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2007-10-19 03:47:01 EDT
Size:
15.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.team.ui >Index: src/org/eclipse/mylyn/internal/team/ui/preferences/FocusedTeamPreferencePage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.team.ui/src/org/eclipse/mylyn/internal/team/ui/preferences/FocusedTeamPreferencePage.java,v >retrieving revision 1.6 >diff -u -r1.6 FocusedTeamPreferencePage.java >--- src/org/eclipse/mylyn/internal/team/ui/preferences/FocusedTeamPreferencePage.java 10 Jul 2007 00:30:14 -0000 1.6 >+++ src/org/eclipse/mylyn/internal/team/ui/preferences/FocusedTeamPreferencePage.java 19 Oct 2007 07:45:40 -0000 >@@ -33,6 +33,8 @@ > */ > public class FocusedTeamPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { > >+ public final static String PAGE_ID = "org.eclipse.mylyn.team.ui.ui.preferences"; >+ > private Button manageChangeSets; > > private Text commitTemplate = null; >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.team.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.192 >diff -u -r1.192 MANIFEST.MF >--- META-INF/MANIFEST.MF 19 Oct 2007 04:00:48 -0000 1.192 >+++ META-INF/MANIFEST.MF 19 Oct 2007 07:45:40 -0000 >@@ -21,7 +21,9 @@ > org.eclipse.compare, > org.eclipse.mylyn.monitor.core, > org.eclipse.mylyn, >- org.eclipse.ui.navigator.resources >+ org.eclipse.ui.navigator.resources, >+ org.eclipse.ui, >+ org.eclipse.ui.forms > Eclipse-LazyStart: true > Export-Package: org.eclipse.mylyn.internal.team.ui, > org.eclipse.mylyn.internal.team.ui.actions, >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.team.ui/plugin.xml,v >retrieving revision 1.33 >diff -u -r1.33 plugin.xml >--- plugin.xml 15 Jun 2007 16:16:16 -0000 1.33 >+++ plugin.xml 19 Oct 2007 07:45:40 -0000 >@@ -255,5 +255,15 @@ > <adapter type="org.eclipse.mylyn.tasks.core.ILinkedTaskInfo"/> > </factory> > </extension> >+ <extension >+ point="org.eclipse.ui.propertyPages"> >+ <page >+ adaptable="true" >+ class="org.eclipse.mylyn.internal.team.ui.properties.ProjectTeamPage" >+ id="org.eclipse.mylyn.tasks.ui.properties.pages.project.team" >+ name="Mylyn Team" >+ objectClass="org.eclipse.core.resources.IProject"> >+ </page> >+ </extension> > > </plugin> >Index: src/org/eclipse/mylyn/internal/team/ui/ContextChangeSet.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.team.ui/src/org/eclipse/mylyn/internal/team/ui/ContextChangeSet.java,v >retrieving revision 1.8 >diff -u -r1.8 ContextChangeSet.java >--- src/org/eclipse/mylyn/internal/team/ui/ContextChangeSet.java 10 Jul 2007 00:30:14 -0000 1.8 >+++ src/org/eclipse/mylyn/internal/team/ui/ContextChangeSet.java 19 Oct 2007 07:45:40 -0000 >@@ -14,6 +14,7 @@ > import java.util.List; > import java.util.Set; > >+import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.resources.mapping.ResourceMapping; >@@ -21,6 +22,7 @@ > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.Platform; > import org.eclipse.mylyn.context.core.ContextCorePlugin; >+import org.eclipse.mylyn.internal.team.ui.properties.TeamPropertiesLinkProvider; > import org.eclipse.mylyn.monitor.core.InteractionEvent; > import org.eclipse.mylyn.resources.ResourcesUiBridgePlugin; > import org.eclipse.mylyn.tasks.core.AbstractTask; >@@ -36,6 +38,7 @@ > > /** > * @author Mik Kersten >+ * @author Steffen Pingel > */ > public class ContextChangeSet extends CVSActiveChangeSet/*ActiveChangeSet*/implements IAdaptable { > >@@ -89,8 +92,20 @@ > > @Override > public String getComment() { >- String template = FocusedTeamUiPlugin.getDefault().getPreferenceStore().getString( >- FocusedTeamUiPlugin.COMMIT_TEMPLATE); >+ String template = null; >+ IResource[] resources = getResources(); >+ if (resources.length > 0) { >+ IProject project = resources[0].getProject(); >+ if (project != null && project.isAccessible()) { >+ TeamPropertiesLinkProvider provider = new TeamPropertiesLinkProvider(); >+ template = provider.getCommitCommentTemplate(project); >+ } >+ } >+ >+ if (template == null) { >+ template = FocusedTeamUiPlugin.getDefault().getPreferenceStore().getString( >+ FocusedTeamUiPlugin.COMMIT_TEMPLATE); >+ } > return FocusedTeamUiPlugin.getDefault().getCommitTemplateManager().generateComment(task, template); > } > >Index: src/org/eclipse/mylyn/internal/team/ui/properties/ProjectTeamPage.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/team/ui/properties/ProjectTeamPage.java >diff -N src/org/eclipse/mylyn/internal/team/ui/properties/ProjectTeamPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/team/ui/properties/ProjectTeamPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,220 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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 >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.team.ui.properties; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.jface.fieldassist.IContentProposalProvider; >+import org.eclipse.jface.fieldassist.IControlContentAdapter; >+import org.eclipse.jface.fieldassist.IControlCreator; >+import org.eclipse.jface.fieldassist.TextContentAdapter; >+import org.eclipse.jface.layout.GridDataFactory; >+import org.eclipse.jface.preference.PreferenceDialog; >+import org.eclipse.jface.resource.JFaceColors; >+import org.eclipse.mylyn.internal.team.ui.FocusedTeamUiPlugin; >+import org.eclipse.mylyn.internal.team.ui.preferences.FocusedTeamPreferencePage; >+import org.eclipse.mylyn.internal.team.ui.templates.TemplateHandlerContentProposalProvider; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionAdapter; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.ui.dialogs.PreferencesUtil; >+import org.eclipse.ui.dialogs.PropertyPage; >+import org.eclipse.ui.fieldassist.ContentAssistField; >+import org.eclipse.ui.forms.events.HyperlinkAdapter; >+import org.eclipse.ui.forms.events.HyperlinkEvent; >+import org.eclipse.ui.forms.widgets.Hyperlink; >+ >+/** >+ * @author Rob Elves >+ * @author Steffen Pingel >+ * @see Adapted from org.eclipse.ui.internal.ide.dialogs.ProjectReferencePage >+ */ >+@SuppressWarnings("deprecation") >+public class ProjectTeamPage extends PropertyPage { >+ >+ private IProject project; >+ >+ private boolean modified = false; >+ >+ private Button useProjectSettings; >+ >+ private Text commitTemplateText; >+ >+ private Composite propertiesComposite; >+ >+ private Hyperlink configurationHyperlink; >+ >+ private Label label; >+ >+ public ProjectTeamPage() { >+ noDefaultAndApplyButton(); >+ } >+ >+ @Override >+ protected Control createContents(Composite parent) { >+ Font font = parent.getFont(); >+ >+ Composite composite = new Composite(parent, SWT.NONE); >+ GridLayout layout = new GridLayout(); >+ composite.setLayout(layout); >+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ composite.setFont(font); >+ >+ createDescription(composite); >+ createPropertiesControl(composite); >+ >+ initialize(); >+ >+ return composite; >+ } >+ >+ private void createDescription(Composite parent) { >+ Composite composite = new Composite(parent, SWT.NONE); >+ composite.setFont(parent.getFont()); >+ GridLayout layout = new GridLayout(); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ layout.numColumns = 2; >+ composite.setLayout(layout); >+ composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ >+ useProjectSettings = new Button(composite, SWT.CHECK); >+ useProjectSettings.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ modified = true; >+ setPropertiesEnabled(useProjectSettings.getSelection()); >+ } >+ }); >+ useProjectSettings.setText("Enable project specific settings"); >+ GridDataFactory.fillDefaults().grab(true, false).applyTo(useProjectSettings); >+ >+ configurationHyperlink = new Hyperlink(composite, SWT.NONE); >+ configurationHyperlink.setUnderlined(true); >+ configurationHyperlink.setText("Configure workspace"); >+ configurationHyperlink.addHyperlinkListener(new HyperlinkAdapter() { >+ >+ public void linkActivated(HyperlinkEvent e) { >+ PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getShell(), >+ FocusedTeamPreferencePage.PAGE_ID, new String[] { FocusedTeamPreferencePage.PAGE_ID }, null); >+ dlg.open(); >+ } >+ }); >+ >+ Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); >+ horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1)); >+ horizontalLine.setFont(composite.getFont()); >+ } >+ >+ private void setPropertiesEnabled(boolean enabled) { >+ propertiesComposite.setEnabled(enabled); >+ for (Control child : propertiesComposite.getChildren()) { >+ child.setEnabled(enabled); >+ } >+ commitTemplateText.setEnabled(enabled); >+ >+ configurationHyperlink.setEnabled(!enabled); >+ if (!enabled) { >+ configurationHyperlink.setForeground(JFaceColors.getHyperlinkText(getShell().getDisplay())); >+ } else { >+ configurationHyperlink.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); >+ } >+ } >+ >+ private void createPropertiesControl(Composite parent) { >+ propertiesComposite = new Composite(parent, SWT.NONE); >+ propertiesComposite.setFont(parent.getFont()); >+ GridLayout layout = new GridLayout(); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ layout.numColumns = 1; >+ propertiesComposite.setLayout(layout); >+ propertiesComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); >+ >+ label = new Label(propertiesComposite, SWT.NONE); >+ label.setText("Commit Comment Template"); >+ >+ String completedTemplate = ""; //getPreferenceStore().getString(FocusedTeamUiPlugin.COMMIT_TEMPLATE); >+ commitTemplateText = addTemplateField(propertiesComposite, completedTemplate, >+ new TemplateHandlerContentProposalProvider()); >+ } >+ >+ @SuppressWarnings("deprecation") >+ private Text addTemplateField(final Composite parent, final String text, IContentProposalProvider provider) { >+ IControlContentAdapter adapter = new TextContentAdapter(); >+ IControlCreator controlCreator = new IControlCreator() { >+ public Control createControl(Composite parent, int style) { >+ Text control = new Text(parent, style); >+ control.setText(text); >+ control.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ modified = true; >+ } >+ }); >+ return control; >+ } >+ }; >+ >+ ContentAssistField field = new ContentAssistField(parent, SWT.BORDER | SWT.MULTI, controlCreator, adapter, >+ provider, null, new char[] { '$' }); >+ >+ GridData gd = new GridData(); >+ gd.heightHint = 60; >+ gd.horizontalAlignment = GridData.FILL; >+ gd.grabExcessHorizontalSpace = true; >+ gd.verticalAlignment = GridData.CENTER; >+ gd.grabExcessVerticalSpace = false; >+ field.getLayoutControl().setLayoutData(gd); >+ >+ return (Text) field.getControl(); >+ } >+ >+ private void initialize() { >+ project = (IProject) getElement().getAdapter(IResource.class); >+ >+ TeamPropertiesLinkProvider provider = new TeamPropertiesLinkProvider(); >+ String template = provider.getCommitCommentTemplate(project); >+ if (template == null) { >+ useProjectSettings.setSelection(false); >+ setPropertiesEnabled(false); >+ commitTemplateText.setText(FocusedTeamUiPlugin.getDefault().getPreferenceStore().getString( >+ FocusedTeamUiPlugin.COMMIT_TEMPLATE)); >+ } else { >+ useProjectSettings.setSelection(true); >+ setPropertiesEnabled(true); >+ commitTemplateText.setText(template); >+ } >+ } >+ >+ @Override >+ public boolean performOk() { >+ if (!modified) { >+ return true; >+ } >+ >+ TeamPropertiesLinkProvider provider = new TeamPropertiesLinkProvider(); >+ if (useProjectSettings.getSelection()) { >+ provider.setCommitCommentTemplate(project, commitTemplateText.getText()); >+ } else { >+ provider.setCommitCommentTemplate(project, null); >+ } >+ >+ return true; >+ } >+} >Index: src/org/eclipse/mylyn/internal/team/ui/properties/TeamPropertiesLinkProvider.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/team/ui/properties/TeamPropertiesLinkProvider.java >diff -N src/org/eclipse/mylyn/internal/team/ui/properties/TeamPropertiesLinkProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/team/ui/properties/TeamPropertiesLinkProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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 >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.team.ui.properties; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.ProjectScope; >+import org.eclipse.core.runtime.preferences.IEclipsePreferences; >+import org.eclipse.core.runtime.preferences.IScopeContext; >+import org.eclipse.mylyn.internal.team.ui.FocusedTeamUiPlugin; >+import org.eclipse.mylyn.monitor.core.StatusHandler; >+import org.osgi.service.prefs.BackingStoreException; >+ >+/** >+ * Retrieves team settings from project properties. >+ * >+ * @author Eugene Kuleshov >+ * @author Steffen Pingel >+ */ >+public class TeamPropertiesLinkProvider { >+ >+ private static final String PROJECT_COMMIT_COMMENT_TEMPLATE = "commit.comment.template"; >+ >+ public boolean canAccessProperties(IResource resource) { >+ IProject project = resource.getProject(); >+ return project != null && project.isAccessible(); >+ } >+ >+ public String getCommitCommentTemplate(IResource resource) { >+ if (!canAccessProperties(resource)) { >+ return null; >+ } >+ >+ IScopeContext projectScope = new ProjectScope(resource.getProject()); >+ IEclipsePreferences projectNode = projectScope.getNode(FocusedTeamUiPlugin.PLUGIN_ID); >+ if (projectNode != null) { >+ return projectNode.get(PROJECT_COMMIT_COMMENT_TEMPLATE, null); >+ } >+ return null; >+ } >+ >+ public boolean setCommitCommentTemplate(IResource resource, String commitCommentTemplate) { >+ if (!canAccessProperties(resource)) { >+ return false; >+ } >+ >+ IScopeContext projectScope = new ProjectScope(resource.getProject()); >+ IEclipsePreferences projectNode = projectScope.getNode(FocusedTeamUiPlugin.PLUGIN_ID); >+ if (projectNode != null) { >+ if (commitCommentTemplate != null) { >+ projectNode.put(PROJECT_COMMIT_COMMENT_TEMPLATE, commitCommentTemplate); >+ } else { >+ projectNode.remove(PROJECT_COMMIT_COMMENT_TEMPLATE); >+ } >+ try { >+ projectNode.flush(); >+ return true; >+ } catch (BackingStoreException e) { >+ StatusHandler.fail(e, "Failed to save commit comment template for project", false); >+ } >+ } >+ return false; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 150663
: 80749 |
80750
|
80990
|
81806
|
81807