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 50234 Details for
Bug 117517
add support for commit comment templates
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]
CommitTemplatesPatch.txt (Now with RegexGuesser)
CommitTemplatesPatch.txt (text/plain), 127.82 KB, created by
Eike Stepper
on 2006-09-15 03:42:58 EDT
(
hide
)
Description:
CommitTemplatesPatch.txt (Now with RegexGuesser)
Filename:
MIME Type:
Creator:
Eike Stepper
Created:
2006-09-15 03:42:58 EDT
Size:
127.82 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.team >Index: src/org/eclipse/mylar/internal/team/TeamRespositoriesManager.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/TeamRespositoriesManager.java,v >retrieving revision 1.2 >diff -u -r1.2 TeamRespositoriesManager.java >--- src/org/eclipse/mylar/internal/team/TeamRespositoriesManager.java 13 Sep 2006 23:58:10 -0000 1.2 >+++ src/org/eclipse/mylar/internal/team/TeamRespositoriesManager.java 15 Sep 2006 07:41:16 -0000 >@@ -64,8 +64,8 @@ > > private void readExtensions() { > ArrayList<AbstractTeamRepositoryProvider> providerList = new ArrayList<AbstractTeamRepositoryProvider>(); >- IExtensionPoint teamProvider = Platform.getExtensionRegistry().getExtensionPoint( >- MylarTeamPlugin.PLUGIN_ID, EXT_POINT_TEAM_REPOSITORY_PROVIDER); >+ IExtensionPoint teamProvider = Platform.getExtensionRegistry().getExtensionPoint(MylarTeamPlugin.PLUGIN_ID, >+ EXT_POINT_TEAM_REPOSITORY_PROVIDER); > IExtension[] extensions = teamProvider.getExtensions(); > for (int i = 0; i < extensions.length; i++) { > IExtension extension = extensions[i]; >@@ -81,7 +81,7 @@ > .createExecutableExtension(ATTR_CLASS); > providerList.add(provider); > } catch (CoreException e) { >- // ignore, we >+ // ignore, we > MylarStatusHandler.log(e, MessageFormat.format( > "Error while initializing repository contribution {0} from plugin {1}.", element > .getAttribute(ATTR_CLASS), element.getContributor().getName())); >Index: src/org/eclipse/mylar/internal/team/ContextChangeSetManager.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ContextChangeSetManager.java,v >retrieving revision 1.2 >diff -u -r1.2 ContextChangeSetManager.java >--- src/org/eclipse/mylar/internal/team/ContextChangeSetManager.java 13 Sep 2006 23:58:10 -0000 1.2 >+++ src/org/eclipse/mylar/internal/team/ContextChangeSetManager.java 15 Sep 2006 07:41:15 -0000 >@@ -76,11 +76,11 @@ > private Map<String, ContextChangeSet> activeChangeSets = new HashMap<String, ContextChangeSet>(); > > private ITaskActivityListener TASK_ACTIVITY_LISTENER = new ITaskActivityListener() { >- >+ > public void taskListRead() { > initContextChangeSets(); > } >- >+ > public void taskActivated(ITask task) { > // ignore > } >@@ -90,18 +90,18 @@ > } > > public void taskDeactivated(ITask task) { >- // ignore >+ // ignore > } > > public void activityChanged(DateRangeContainer week) { >- // ignore >+ // ignore > } > > public void calendarChanged() { > // ignore > } > }; >- >+ > private ITaskListChangeListener TASK_CHANGE_LISTENER = new ITaskListChangeListener() { > > public void localInfoChanged(ITask task) { >@@ -154,7 +154,7 @@ > List<AbstractTeamRepositoryProvider> providerList = TeamRespositoriesManager.getInstance().getProviders(); > for (AbstractTeamRepositoryProvider provider : providerList) { > ActiveChangeSetManager changeSetManager = provider.getActiveChangeSetManager(); >- if(null != changeSetManager) >+ if (null != changeSetManager) > collectors.add(changeSetManager); > } > } >@@ -239,16 +239,17 @@ > ContextChangeSet contextChangeSet = new ContextChangeSet(task, collector); > List<IResource> interestingResources = MylarResourcesPlugin.getDefault().getInterestingResources(); > contextChangeSet.add(interestingResources.toArray(new IResource[interestingResources.size()])); >- >+ > activeChangeSets.put(task.getHandleIdentifier(), contextChangeSet); > > if (!collector.contains(contextChangeSet)) { > collector.add(contextChangeSet); > } >-// collector.makeDefault(contextChangeSet); >-// IdeUiUtil.forceSynchronizeViewUpdate(); >-// DiffChangeEvent event = new DiffChangeEvent(contextChangeSet.getDiffTree()); >-// collector.diffsChanged(event, new NullProgressMonitor()); >+ // collector.makeDefault(contextChangeSet); >+ // IdeUiUtil.forceSynchronizeViewUpdate(); >+ // DiffChangeEvent event = new >+ // DiffChangeEvent(contextChangeSet.getDiffTree()); >+ // collector.diffsChanged(event, new NullProgressMonitor()); > } > } > } catch (Exception e) { >@@ -320,14 +321,14 @@ > } > } > } >-// if (shouldRemove(element)) { >-// ChangeSet[] sets = collector.getSets(); >-// for (int i = 0; i < sets.length; i++) { >-// if (sets[i] instanceof MylarActiveChangeSet) { >-// sets[i].remove(resource); >-// } >-// } >-// } >+ // if (shouldRemove(element)) { >+ // ChangeSet[] sets = collector.getSets(); >+ // for (int i = 0; i < sets.length; i++) { >+ // if (sets[i] instanceof MylarActiveChangeSet) { >+ // sets[i].remove(resource); >+ // } >+ // } >+ // } > } > } > } catch (Exception e) { >Index: src/org/eclipse/mylar/internal/team/ContextChangeSet.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ContextChangeSet.java,v >retrieving revision 1.1 >diff -u -r1.1 ContextChangeSet.java >--- src/org/eclipse/mylar/internal/team/ContextChangeSet.java 17 Jul 2006 03:34:59 -0000 1.1 >+++ src/org/eclipse/mylar/internal/team/ContextChangeSet.java 15 Sep 2006 07:41:15 -0000 >@@ -7,24 +7,20 @@ > * > * Contributors: > * University Of British Columbia - initial API and implementation >+ * Eike Stepper - template based commit templates > *******************************************************************************/ >- > package org.eclipse.mylar.internal.team; > >-import java.util.ArrayList; >-import java.util.Arrays; >-import java.util.HashSet; >-import java.util.List; >-import java.util.Set; >- > import org.eclipse.core.resources.IResource; > 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.mylar.context.core.InteractionEvent; >+import org.eclipse.mylar.context.core.MylarStatusHandler; > import org.eclipse.mylar.resources.MylarResourcesPlugin; > import org.eclipse.mylar.tasks.core.ITask; >+import org.eclipse.mylar.team.ITemplateHandlersManager; > import org.eclipse.mylar.team.MylarTeamPlugin; > import org.eclipse.team.core.TeamException; > import org.eclipse.team.core.diff.IDiff; >@@ -35,6 +31,14 @@ > import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager; > import org.osgi.service.prefs.Preferences; > >+import java.util.ArrayList; >+import java.util.Arrays; >+import java.util.HashSet; >+import java.util.List; >+import java.util.Set; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; >+ > /** > * @author Mik Kersten > */ >@@ -65,7 +69,7 @@ > public boolean isUserCreated() { > return true; > } >- >+ > public void initTitle() { > super.setName(task.getDescription()); > super.setTitle(task.getDescription()); >@@ -97,13 +101,11 @@ > > @Override > public String getComment() { >- String completedPrefix = MylarTeamPlugin.getDefault().getPreferenceStore().getString( >- MylarTeamPlugin.COMMIT_PREFIX_COMPLETED); >- String progressPrefix = MylarTeamPlugin.getDefault().getPreferenceStore().getString( >- MylarTeamPlugin.COMMIT_PREFIX_PROGRESS); >- String comment = ""; >- comment = generateComment(task, completedPrefix, progressPrefix); >- return comment; >+ String completedTemplate = MylarTeamPlugin.getDefault().getPreferenceStore().getString( >+ MylarTeamPlugin.COMMIT_TEMPLATE_COMPLETED); >+ String progressTemplate = MylarTeamPlugin.getDefault().getPreferenceStore().getString( >+ MylarTeamPlugin.COMMIT_TEMPLATE_PROGRESS); >+ return ITemplateHandlersManager.INSTANCE.generateComment(task, completedTemplate, progressTemplate); > } > > @Override >@@ -122,23 +124,24 @@ > IResource resource = getResourceFromDiff(diff); > if (!suppressInterestContribution && resource != null) { > Set<IResource> resources = new HashSet<IResource>(); >- resources.add(resource); >+ resources.add(resource); > if (MylarResourcesPlugin.getDefault() != null) { >- MylarResourcesPlugin.getDefault().getInterestUpdater().addResourceToContext(resources, InteractionEvent.Kind.SELECTION); >+ MylarResourcesPlugin.getDefault().getInterestUpdater().addResourceToContext(resources, >+ InteractionEvent.Kind.SELECTION); > } > } > } > > private IResource getResourceFromDiff(IDiff diff) { > if (diff instanceof ResourceDiff) { >- return ((ResourceDiff)diff).getResource(); >+ return ((ResourceDiff) diff).getResource(); > } else if (diff instanceof ThreeWayDiff) { >- ThreeWayDiff threeWayDiff = (ThreeWayDiff)diff; >+ ThreeWayDiff threeWayDiff = (ThreeWayDiff) diff; > return ResourcesPlugin.getWorkspace().getRoot().findMember(threeWayDiff.getPath()); > } else { > return null; > } >- } >+ } > > @Override > public void add(IDiff[] diffs) { >@@ -172,7 +175,8 @@ > Set<IResource> allResources = new HashSet<IResource>(); > allResources.addAll(Arrays.asList(super.getResources())); > if (MylarResourcesPlugin.getDefault() != null && task.isActive()) { >- // TODO: if super is always managed correctly should remove following line >+ // TODO: if super is always managed correctly should remove >+ // following line > allResources.addAll(MylarResourcesPlugin.getDefault().getInterestingResources()); > } > return new ArrayList<IResource>(allResources); >@@ -185,42 +189,48 @@ > return getAllResourcesInChangeContext().contains(local); > } > >- public static String generateComment(ITask task, String completedPrefix, String progressPrefix) { >- String comment; >- completedPrefix = fixUpDelimIfPresent(completedPrefix); >- progressPrefix = fixUpDelimIfPresent(progressPrefix); >- if (task.isCompleted()) { >- comment = completedPrefix + PREFIX_DELIM; >- } else { >- comment = progressPrefix + PREFIX_DELIM; >- } >- comment += task.getDescription(); >- String url = task.getUrl(); >- if (url != null && !url.equals("") && !url.endsWith("//")) { >- comment += " \n" + url; >+ public static String generateComment(ITask task, String completedTemplate, String progressTemplate) { >+ return ITemplateHandlersManager.INSTANCE.generateComment(task, completedTemplate, progressTemplate); >+ } >+ >+ public static String getTaskIdFromCommentOrLabel(String commentOrLabel) { >+ String id = getTaskIdFromComment(commentOrLabel); >+ if (id == null) { >+ id = getTaskIdFromLabel(commentOrLabel); > } >- return comment; >+ >+ return id; > } > >- private static String fixUpDelimIfPresent(String prefix) { >- if (prefix.endsWith(":") || prefix.endsWith(PREFIX_DELIM)) { >- prefix = prefix.substring(0, prefix.lastIndexOf(':')); >+ public static String getTaskIdFromComment(String comment) { >+ try { >+ String regex = MylarTeamPlugin.getDefault().getPreferenceStore().getString( >+ MylarTeamPlugin.COMMIT_REGEX_TASK_ID); >+ >+ Pattern pattern = Pattern.compile(regex); >+ Matcher matcher = pattern.matcher(comment); >+ if (matcher.find()) { >+ return matcher.group(1); >+ } >+ } catch (Exception ex) { >+ MylarStatusHandler.log(ex, "Problem while parsing task id from comment"); > } >- return prefix; >+ >+ return null; > } > >- public static String getTaskIdFromCommentOrLabel(String comment) { >- int firstDelimIndex = comment.indexOf(PREFIX_DELIM); >+ public static String getTaskIdFromLabel(String label) { >+ int firstDelimIndex = label.indexOf(PREFIX_DELIM); > if (firstDelimIndex != -1) { > int idStart = firstDelimIndex + PREFIX_DELIM.length(); >- int idEnd = comment.indexOf(PREFIX_DELIM, firstDelimIndex + PREFIX_DELIM.length());// comment.indexOf(PREFIX_DELIM); >+ int idEnd = label.indexOf(PREFIX_DELIM, firstDelimIndex + PREFIX_DELIM.length());// comment.indexOf(PREFIX_DELIM); > if (idEnd != -1 && idStart < idEnd) { >- String id = comment.substring(idStart, idEnd); >+ String id = label.substring(idStart, idEnd); > if (id != null) > return id.trim(); > } else { > // change set label >- return comment.substring(0, firstDelimIndex); >+ return label.substring(0, firstDelimIndex); > } > } > return null; >Index: src/org/eclipse/mylar/internal/team/ui/actions/OpenCorrespondingTaskAction.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ui/actions/OpenCorrespondingTaskAction.java,v >retrieving revision 1.3 >diff -u -r1.3 OpenCorrespondingTaskAction.java >--- src/org/eclipse/mylar/internal/team/ui/actions/OpenCorrespondingTaskAction.java 25 Aug 2006 07:29:43 -0000 1.3 >+++ src/org/eclipse/mylar/internal/team/ui/actions/OpenCorrespondingTaskAction.java 15 Sep 2006 07:41:16 -0000 >@@ -76,16 +76,16 @@ > // find change set if available > element = findParent((ISynchronizeModelElement) element); > } >- >+ > if (element instanceof ContextChangeSet) { >- ITask task = ((ContextChangeSet)element).getTask(); >+ ITask task = ((ContextChangeSet) element).getTask(); > if (task != null) { > TaskUiUtil.openEditor(task, false); > resolved = true; > } > } else { > if (element instanceof CVSCheckedInChangeSet) { >- comment = ((CVSCheckedInChangeSet)element).getComment(); >+ comment = ((CVSCheckedInChangeSet) element).getComment(); > } else if (element instanceof ChangeSetDiffNode) { > ChangeSetDiffNode diffNode = (ChangeSetDiffNode) element; > if (diffNode.getSet() instanceof ContextChangeSet) { >@@ -99,7 +99,7 @@ > comment = ((LogEntry) element).getComment(); > } else if (element instanceof IFileRevision) { > comment = ((IFileRevision) element).getComment(); >- } >+ } > if (comment != null) { > String fullUrl = ContextChangeSet.getUrlFromComment(comment); > String repositoryUrl = null; >@@ -119,7 +119,7 @@ > } > String id = ContextChangeSet.getTaskIdFromCommentOrLabel(comment); > resolved = TaskUiUtil.openRepositoryTask(repositoryUrl, id, fullUrl); >- >+ > if (!resolved) { > TaskUiUtil.openUrl(fullUrl); > resolved = true; >Index: src/org/eclipse/mylar/internal/team/ui/actions/TaskResourceMappingActionProvider.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ui/actions/TaskResourceMappingActionProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 TaskResourceMappingActionProvider.java >--- src/org/eclipse/mylar/internal/team/ui/actions/TaskResourceMappingActionProvider.java 16 Jul 2006 09:13:41 -0000 1.1 >+++ src/org/eclipse/mylar/internal/team/ui/actions/TaskResourceMappingActionProvider.java 15 Sep 2006 07:41:16 -0000 >@@ -22,18 +22,18 @@ > public class TaskResourceMappingActionProvider extends CommonActionProvider { > > private OpenCorrespondingTaskAction openCorrespondingAction = new OpenCorrespondingTaskAction(); >- >+ > public void fillContextMenu(IMenuManager menuManager) { > IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); > openCorrespondingAction.selectionChanged(openCorrespondingAction, selection); >- >+ > menuManager.insertAfter(ICommonMenuConstants.GROUP_ADDITIONS, openCorrespondingAction); >- >-// openCorrespondingAction.selectionChanged(selection); >-// if (openCorrespondingAction.isEnabled()) { >-// menuManager.insertAfter(ICommonMenuConstants.GROUP_OPEN, openAction); >-// } >-// menuManager.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); >+ >+ // openCorrespondingAction.selectionChanged(selection); >+ // if (openCorrespondingAction.isEnabled()) { >+ // menuManager.insertAfter(ICommonMenuConstants.GROUP_OPEN, openAction); >+ // } >+ // menuManager.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); > } >- >+ > } >Index: src/org/eclipse/mylar/team/AbstractTeamRepositoryProvider.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/team/AbstractTeamRepositoryProvider.java,v >retrieving revision 1.1 >diff -u -r1.1 AbstractTeamRepositoryProvider.java >--- src/org/eclipse/mylar/team/AbstractTeamRepositoryProvider.java 13 Sep 2006 23:58:11 -0000 1.1 >+++ src/org/eclipse/mylar/team/AbstractTeamRepositoryProvider.java 15 Sep 2006 07:41:16 -0000 >@@ -38,24 +38,29 @@ > > /** > * Determines if the team provider manages at least one of the resources and >- * at least one of the resources has an 'outgoing' state (locally changed). If >- * this method returns <code>true</code>, the team provider may be later asked >- * to {@link #commit} them. The set of resources may contain resources from >- * projects that are not managed by your provider or not managed at all. >+ * at least one of the resources has an 'outgoing' state (locally changed). >+ * If this method returns <code>true</code>, the team provider may be >+ * later asked to {@link #commit} them. The set of resources may contain >+ * resources from projects that are not managed by your provider or not >+ * managed at all. >+ * > * @param resources >- * @return <code>true</code> if the team provider manages at least one of the >- * resources or <code>false</code> otherwise. >+ * @return <code>true</code> if the team provider manages at least one of >+ * the resources or <code>false</code> otherwise. > */ > public boolean hasOutgoingChanges(IResource[] resources) { > return false; > } >- >+ > /** >- * Asks the team provider to commit a set of resources that may be managed by >- * the team provider. It is up to the team provider to only operate on resources >- * that are being managed by it. The set of resources may contain resources from >- * projects that are not managed by your provider or not managed at all. >- * @param resources Set of resources that need to be committed >+ * Asks the team provider to commit a set of resources that may be managed >+ * by the team provider. It is up to the team provider to only operate on >+ * resources that are being managed by it. The set of resources may contain >+ * resources from projects that are not managed by your provider or not >+ * managed at all. >+ * >+ * @param resources >+ * Set of resources that need to be committed > */ > public void commit(IResource[] resources) { > } >Index: src/org/eclipse/mylar/team/MylarTeamPlugin.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/team/MylarTeamPlugin.java,v >retrieving revision 1.4 >diff -u -r1.4 MylarTeamPlugin.java >--- src/org/eclipse/mylar/team/MylarTeamPlugin.java 24 Jul 2006 23:44:26 -0000 1.4 >+++ src/org/eclipse/mylar/team/MylarTeamPlugin.java 15 Sep 2006 07:41:16 -0000 >@@ -1,3 +1,14 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 - 2006 University Of British Columbia 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: >+ * University Of British Columbia - initial API and implementation >+ * Eike Stepper - template based commit templates >+ *******************************************************************************/ > package org.eclipse.mylar.team; > > import org.eclipse.mylar.context.core.MylarStatusHandler; >@@ -20,13 +31,21 @@ > > public static final String CHANGE_SET_MANAGE = "org.eclipse.mylar.team.changesets.manage"; > >- public static final String COMMIT_PREFIX_COMPLETED = "org.eclipse.mylar.team.commit.template.completed"; >+ public static final String COMMIT_TEMPLATE_COMPLETED = "org.eclipse.mylar.team.commit.template.completed"; > >- public static final String COMMIT_PREFIX_PROGRESS = "org.eclipse.mylar.team.commit.template.progress"; >+ public static final String COMMIT_TEMPLATE_PROGRESS = "org.eclipse.mylar.team.commit.template.progress"; > >- public static final String DEFAULT_PREFIX_PROGRESS = "Progress on:"; >+ public static final String COMMIT_REGEX_TASK_ID = "org.eclipse.mylar.team.commit.regex"; > >- public static final String DEFAULT_PREFIX_COMPLETED = "Completed:"; >+ public static final String COMMIT_REGEX_AUTO_GUESS = "org.eclipse.mylar.team.commit.regex.auto.guess"; >+ >+ public static final String DEFAULT_TEMPLATE_PROGRESS = "[${task.id}] ${task.summary} ${task.url}"; >+ >+ public static final String DEFAULT_TEMPLATE_COMPLETED = "[${task.id}] ${task.summary} (COMPLETED) ${task.url}"; >+ >+ public static final String DEFAULT_REGEX_TASK_ID = "\\[(\\d+)\\].*"; >+ >+ public static final boolean DEFAULT_REGEX_AUTO_GUESS = true; > > public MylarTeamPlugin() { > INSTANCE = this; >@@ -38,23 +57,22 @@ > > PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { > public void run() { >- try { >+ try { > changeSetManager = new ContextChangeSetManager(); > if (getPreferenceStore().getBoolean(CHANGE_SET_MANAGE)) { > changeSetManager.enable(); > } > } catch (Exception e) { >- MylarStatusHandler.fail(e, "Mylar Team start failed", >- false); >+ MylarStatusHandler.fail(e, "Mylar Team start failed", false); > } > } > }); > } > > public void earlyStartup() { >- // all done in start >+ // all done in start > } >- >+ > public void stop(BundleContext context) throws Exception { > INSTANCE = null; > super.stop(context); >@@ -63,10 +81,10 @@ > > private void initPreferenceDefaults() { > getPreferenceStore().setDefault(CHANGE_SET_MANAGE, true); >- getPreferenceStore().setDefault(COMMIT_PREFIX_COMPLETED, >- DEFAULT_PREFIX_COMPLETED); >- getPreferenceStore().setDefault(COMMIT_PREFIX_PROGRESS, >- DEFAULT_PREFIX_PROGRESS); >+ getPreferenceStore().setDefault(COMMIT_TEMPLATE_COMPLETED, DEFAULT_TEMPLATE_COMPLETED); >+ getPreferenceStore().setDefault(COMMIT_TEMPLATE_PROGRESS, DEFAULT_TEMPLATE_PROGRESS); >+ getPreferenceStore().setDefault(COMMIT_REGEX_TASK_ID, DEFAULT_REGEX_TASK_ID); >+ getPreferenceStore().setDefault(COMMIT_REGEX_AUTO_GUESS, DEFAULT_REGEX_AUTO_GUESS); > } > > public static MylarTeamPlugin getDefault() { >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/plugin.xml,v >retrieving revision 1.5 >diff -u -r1.5 plugin.xml >--- plugin.xml 24 Aug 2006 17:51:15 -0000 1.5 >+++ plugin.xml 15 Sep 2006 07:41:15 -0000 >@@ -3,6 +3,7 @@ > <?eclipse version="3.0"?> > <plugin> > <extension-point id="providers" name="Mylar Team Providers" schema="schema/providers.exsd"/> >+ <extension-point id="templateHandlers" name="Mylar Template Handlers" schema="schema/templateHandlers.exsd"/> > > <extension > point="org.eclipse.mylar.team.providers"> >@@ -152,4 +153,92 @@ > </viewerActionBinding> > </extension> > >+ <extension >+ point="org.eclipse.mylar.team.templateHandlers"> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$RepositoryKind" >+ description="Provides the repository kind of a Mylar task." >+ recognizedKeyword="repository.kind"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$RepositoryURL" >+ description="Provides the repository URL of a Mylar task." >+ recognizedKeyword="repository.url"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskAssignee" >+ description="Provides the user a Mylar task is assigned to, if available." >+ recognizedKeyword="task.assignee"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskCC" >+ description="Provides the comma separated CC list of a Mylar task, if available." >+ recognizedKeyword="task.cc"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskDescription" >+ description="Provides the description of a Mylar task." >+ recognizedKeyword="task.description"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskHandle" >+ description="Provides the handle of a Mylar task." >+ recognizedKeyword="task.handle"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskID" >+ description="Provides the ID of a Mylar task." >+ recognizedKeyword="task.id"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskKeywords" >+ description="Provides the comma separated keyword list of a Mylar task, if available." >+ recognizedKeyword="task.keywords"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskLastModified" >+ description="Provides the date of last modification of a Mylar task, if available." >+ recognizedKeyword="task.lastmodified"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskNotes" >+ description="Provides the notes of a Mylar task." >+ recognizedKeyword="task.notes"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskPriority" >+ description="Provides the priority of a Mylar task." >+ recognizedKeyword="task.priority"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskProduct" >+ description="Provides the prroduct a Mylar task belongs to, if available." >+ recognizedKeyword="task.product"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskReporter" >+ description="Provides the user who reported a Mylar task, if available." >+ recognizedKeyword="task.reporter"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskResolution" >+ description="Provides the resolution of a Mylar task, if available." >+ recognizedKeyword="task.resolution"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskStatus" >+ description="Provides the status of a Mylar task, if available." >+ recognizedKeyword="task.status"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskSummary" >+ description="Provides the summary or description of a Mylar task, whichever is available." >+ recognizedKeyword="task.summary"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskType" >+ description="Provides the type of a Mylar task." >+ recognizedKeyword="task.type"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$TaskURL" >+ description="Provides the URL of a Mylar task." >+ recognizedKeyword="task.url"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$Date$TaskCompletion" >+ description="Provides the completion date of a Mylar task." >+ recognizedKeyword="task.completiondate"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$Date$TaskCreation" >+ description="Provides the creation date of a Mylar task." >+ recognizedKeyword="task.creationdate"/> >+ <templateHandler >+ class="org.eclipse.mylar.internal.team.template.TemplateHandler$Date$TaskReminder" >+ description="Provides the reminder date of a Mylar task." >+ recognizedKeyword="task.reminderdate"/> >+ </extension> >+ > </plugin> >Index: src/org/eclipse/mylar/internal/team/ccvs/CvsRepositoryProvider.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ccvs/CvsRepositoryProvider.java,v >retrieving revision 1.2 >diff -u -r1.2 CvsRepositoryProvider.java >--- src/org/eclipse/mylar/internal/team/ccvs/CvsRepositoryProvider.java 13 Sep 2006 23:58:10 -0000 1.2 >+++ src/org/eclipse/mylar/internal/team/ccvs/CvsRepositoryProvider.java 15 Sep 2006 07:41:16 -0000 >@@ -29,13 +29,12 @@ > */ > public class CvsRepositoryProvider extends AbstractTeamRepositoryProvider { > private static final String WIZARD_LABEL = "Commit Resources in Task Context"; >- >+ > @Override > public ActiveChangeSetManager getActiveChangeSetManager() { >- return (CVSActiveChangeSetCollector) CVSUIPlugin.getPlugin() >- .getChangeSetManager(); >+ return (CVSActiveChangeSetCollector) CVSUIPlugin.getPlugin().getChangeSetManager(); > } >- >+ > @Override > public boolean hasOutgoingChanges(IResource[] resources) { > try { >@@ -45,7 +44,7 @@ > return false; > } > } >- >+ > @Override > public void commit(IResource[] resources) { > try { >Index: src/org/eclipse/mylar/internal/team/ui/ContextChangeSetDecorator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ui/ContextChangeSetDecorator.java,v >retrieving revision 1.2 >diff -u -r1.2 ContextChangeSetDecorator.java >--- src/org/eclipse/mylar/internal/team/ui/ContextChangeSetDecorator.java 17 Jul 2006 07:32:21 -0000 1.2 >+++ src/org/eclipse/mylar/internal/team/ui/ContextChangeSetDecorator.java 15 Sep 2006 07:41:16 -0000 >@@ -26,8 +26,8 @@ > public void decorate(Object element, IDecoration decoration) { > if (element instanceof ContextChangeSet) { > decoration.addOverlay(ContextUiImages.MYLAR_OVERLAY, IDecoration.BOTTOM_RIGHT); >- ContextChangeSet changeSet = (ContextChangeSet)element; >- if (changeSet.getTask().isActive()) { >+ ContextChangeSet changeSet = (ContextChangeSet) element; >+ if (changeSet.getTask().isActive()) { > decoration.setFont(TaskListColorsAndFonts.BOLD); > } > } >@@ -50,5 +50,4 @@ > // ignore > } > >- > } >Index: src/org/eclipse/mylar/internal/team/ui/preferences/MylarTeamPreferencePage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ui/preferences/MylarTeamPreferencePage.java,v >retrieving revision 1.3 >diff -u -r1.3 MylarTeamPreferencePage.java >--- src/org/eclipse/mylar/internal/team/ui/preferences/MylarTeamPreferencePage.java 2 Aug 2006 07:50:06 -0000 1.3 >+++ src/org/eclipse/mylar/internal/team/ui/preferences/MylarTeamPreferencePage.java 15 Sep 2006 07:41:16 -0000 >@@ -7,13 +7,25 @@ > * > * Contributors: > * University Of British Columbia - initial API and implementation >+ * Eike tepper - commit comment template preferences > *******************************************************************************/ > > package org.eclipse.mylar.internal.team.ui.preferences; > >+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.preference.PreferencePage; >+import org.eclipse.mylar.internal.team.template.TemplateHandlerContentProposalProvider; >+import org.eclipse.mylar.internal.team.ui.preferences.workaround.RegExContentProposalProvider; >+import org.eclipse.mylar.team.ITemplateHandlersManager; > import org.eclipse.mylar.team.MylarTeamPlugin; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; >@@ -24,17 +36,23 @@ > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.IWorkbench; > import org.eclipse.ui.IWorkbenchPreferencePage; >+import org.eclipse.ui.fieldassist.ContentAssistField; > > /** > * @author Mik Kersten > */ > public class MylarTeamPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { >- > private Button changeSetsManage; > >- private Text commitPrefixCompleted = null; >+ private Text commitTemplateCompleted = null; >+ >+ private Text commitTemplateProgress = null; >+ >+ private Text regexText; >+ >+ private Button guessButton; > >- private Text commitPrefixProgress = null; >+ private Button autoGuessButton; > > public MylarTeamPreferencePage() { > super(); >@@ -58,8 +76,10 @@ > > @Override > public boolean performOk() { >- getPreferenceStore().setValue(MylarTeamPlugin.COMMIT_PREFIX_COMPLETED, commitPrefixCompleted.getText()); >- getPreferenceStore().setValue(MylarTeamPlugin.COMMIT_PREFIX_PROGRESS, commitPrefixProgress.getText()); >+ getPreferenceStore().setValue(MylarTeamPlugin.COMMIT_TEMPLATE_COMPLETED, commitTemplateCompleted.getText()); >+ getPreferenceStore().setValue(MylarTeamPlugin.COMMIT_TEMPLATE_PROGRESS, commitTemplateProgress.getText()); >+ getPreferenceStore().setValue(MylarTeamPlugin.COMMIT_REGEX_TASK_ID, regexText.getText()); >+ getPreferenceStore().setValue(MylarTeamPlugin.COMMIT_REGEX_AUTO_GUESS, autoGuessButton.getSelection()); > getPreferenceStore().setValue(MylarTeamPlugin.CHANGE_SET_MANAGE, changeSetsManage.getSelection()); > > if (changeSetsManage.getSelection()) { >@@ -77,8 +97,9 @@ > > public void performDefaults() { > super.performDefaults(); >- commitPrefixCompleted.setText(getPreferenceStore().getDefaultString(MylarTeamPlugin.COMMIT_PREFIX_COMPLETED)); >- commitPrefixProgress.setText(getPreferenceStore().getDefaultString(MylarTeamPlugin.COMMIT_PREFIX_PROGRESS)); >+ commitTemplateCompleted.setText(getPreferenceStore() >+ .getDefaultString(MylarTeamPlugin.COMMIT_TEMPLATE_COMPLETED)); >+ commitTemplateProgress.setText(getPreferenceStore().getDefaultString(MylarTeamPlugin.COMMIT_TEMPLATE_PROGRESS)); > changeSetsManage.setSelection(getPreferenceStore().getDefaultBoolean(MylarTeamPlugin.CHANGE_SET_MANAGE)); > } > >@@ -109,20 +130,99 @@ > group.setLayout(new GridLayout(2, false)); > group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > >- Label completedLabel = createLabel(group, "Completed task prefix: "); >+ Label completedLabel = createLabel(group, "Completed task template: "); > completedLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); > >- String completedPrefix = getPreferenceStore().getString(MylarTeamPlugin.COMMIT_PREFIX_COMPLETED); >- commitPrefixCompleted = new Text(group, SWT.BORDER); >- commitPrefixCompleted.setText(completedPrefix); >- commitPrefixCompleted.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ String completedTemplate = getPreferenceStore().getString(MylarTeamPlugin.COMMIT_TEMPLATE_COMPLETED); >+ commitTemplateCompleted = addTemplateField(group, completedTemplate, >+ new TemplateHandlerContentProposalProvider()); > >- Label progressLabel = createLabel(group, "In progress task prefix: "); >+ Label progressLabel = createLabel(group, "In progress task template: "); > progressLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); > >- String progressPrefix = getPreferenceStore().getString(MylarTeamPlugin.COMMIT_PREFIX_PROGRESS); >- commitPrefixProgress = new Text(group, SWT.BORDER); >- commitPrefixProgress.setText(progressPrefix); >- commitPrefixProgress.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ String progressTemplate = getPreferenceStore().getString(MylarTeamPlugin.COMMIT_TEMPLATE_PROGRESS); >+ commitTemplateProgress = addTemplateField(group, progressTemplate, new TemplateHandlerContentProposalProvider()); >+ commitTemplateProgress.addModifyListener(new ModifyListener() { >+ public void modifyText(ModifyEvent e) { >+ if (autoGuessButton.getSelection()) { >+ guessRegex(); >+ } >+ } >+ }); >+ >+ Label regexLabel = createLabel(group, "Regex to parse task id: "); >+ regexLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); >+ >+ GridLayout layout = new GridLayout(3, false); >+ layout.marginHeight = 0; >+ layout.marginWidth = 0; >+ >+ Composite composite = new Composite(group, SWT.NONE); >+ composite.setLayout(layout); >+ composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); >+ >+ boolean autoGuess = getPreferenceStore().getBoolean(MylarTeamPlugin.COMMIT_REGEX_AUTO_GUESS); >+ String regex = getPreferenceStore().getString(MylarTeamPlugin.COMMIT_REGEX_TASK_ID); >+ regexText = addTemplateField(composite, regex, new RegExContentProposalProvider(true)); >+ >+ guessButton = new Button(composite, SWT.PUSH); >+ guessButton.setText("Guess"); >+ guessButton.setEnabled(!autoGuess); >+ guessButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ guessRegex(); >+ } >+ }); >+ >+ autoGuessButton = new Button(composite, SWT.CHECK); >+ autoGuessButton.setText("Auto"); >+ autoGuessButton.setSelection(autoGuess); >+ autoGuessButton.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent e) { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) { >+ if (autoGuessButton.getSelection()) { >+ guessButton.setEnabled(false); >+ guessRegex(); >+ } else { >+ guessButton.setEnabled(true); >+ } >+ } >+ }); >+ } >+ >+ 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); >+ return control; >+ } >+ }; >+ >+ ContentAssistField field = new ContentAssistField(parent, SWT.BORDER, controlCreator, adapter, provider, null, >+ new char[] { '$' }); >+ >+ GridData gd = new GridData(); >+ gd.horizontalAlignment = GridData.FILL; >+ gd.grabExcessHorizontalSpace = true; >+ gd.verticalAlignment = GridData.CENTER; >+ gd.grabExcessVerticalSpace = false; >+ field.getLayoutControl().setLayoutData(gd); >+ >+ return (Text) field.getControl(); >+ } >+ >+ protected void guessRegex() { >+ String template = commitTemplateProgress.getText(); >+ String regex = ITemplateHandlersManager.INSTANCE.getTaskIDRegEx(template); >+ regexText.setText(regex); > } > } >Index: src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java,v >retrieving revision 1.3 >diff -u -r1.3 SubclipseTeamRepositoryProvider.java >--- src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java 13 Sep 2006 23:58:10 -0000 1.3 >+++ src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java 15 Sep 2006 07:41:16 -0000 >@@ -29,21 +29,15 @@ > @Override > public ActiveChangeSetManager getActiveChangeSetManager() { > // collectors.add((CVSActiveChangeSetCollector)CVSUIPlugin.getPlugin().getChangeSetManager()); >- Bundle svnBundle = Platform >- .getBundle("org.tigris.subversion.subclipse.core"); >+ Bundle svnBundle = Platform.getBundle("org.tigris.subversion.subclipse.core"); > if (svnBundle != null) { > Method getChangeSetManagerMethod; > try { >- Class providerPlugin = svnBundle >- .loadClass("org.tigris.subversion.subclipse.core.SVNProviderPlugin"); // Class.forName("org.tigris.subversion.subclipse.core.SVNProviderPlugin"); >- Method getPluginMethod = providerPlugin.getMethod("getPlugin", >- new Class[0]); >- Object pluginInstance = getPluginMethod.invoke(null, >- new Object[0]); >- getChangeSetManagerMethod = providerPlugin.getDeclaredMethod( >- "getChangeSetManager", new Class[0]); >- Object manager = getChangeSetManagerMethod.invoke( >- pluginInstance, new Object[0]); >+ Class providerPlugin = svnBundle.loadClass("org.tigris.subversion.subclipse.core.SVNProviderPlugin"); // Class.forName("org.tigris.subversion.subclipse.core.SVNProviderPlugin"); >+ Method getPluginMethod = providerPlugin.getMethod("getPlugin", new Class[0]); >+ Object pluginInstance = getPluginMethod.invoke(null, new Object[0]); >+ getChangeSetManagerMethod = providerPlugin.getDeclaredMethod("getChangeSetManager", new Class[0]); >+ Object manager = getChangeSetManagerMethod.invoke(pluginInstance, new Object[0]); > if (manager instanceof ActiveChangeSetManager) { > return (ActiveChangeSetManager) manager; > } >@@ -60,21 +54,15 @@ > return false; > > try { >- Class commitActionClass = Class >- .forName("org.tigris.subversion.subclipse.ui.actions.CommitAction"); >- Constructor commitActionConstructor = commitActionClass >- .getConstructor(new Class[] { String.class }); >- Object commitAction = commitActionConstructor >- .newInstance(new Object[] { "" }); >- Method setSelectedResourcesMethod = commitActionClass.getMethod( >- "setSelectedResources", new Class[] { IResource[].class }); >- setSelectedResourcesMethod.invoke(commitAction, >- new Object[] { resources }); >- >- Method hasOutgoingChangesMethod = commitActionClass.getMethod( >- "hasOutgoingChanges", new Class[0]); >- Boolean hasOutgoingChanges = (Boolean) hasOutgoingChangesMethod >- .invoke(commitAction, new Object[0]); >+ Class commitActionClass = Class.forName("org.tigris.subversion.subclipse.ui.actions.CommitAction"); >+ Constructor commitActionConstructor = commitActionClass.getConstructor(new Class[] { String.class }); >+ Object commitAction = commitActionConstructor.newInstance(new Object[] { "" }); >+ Method setSelectedResourcesMethod = commitActionClass.getMethod("setSelectedResources", >+ new Class[] { IResource[].class }); >+ setSelectedResourcesMethod.invoke(commitAction, new Object[] { resources }); >+ >+ Method hasOutgoingChangesMethod = commitActionClass.getMethod("hasOutgoingChanges", new Class[0]); >+ Boolean hasOutgoingChanges = (Boolean) hasOutgoingChangesMethod.invoke(commitAction, new Object[0]); > > return hasOutgoingChanges.booleanValue(); > } catch (Throwable t) { >@@ -90,19 +78,14 @@ > return; > > try { >- Class commitActionClass = Class >- .forName("org.tigris.subversion.subclipse.ui.actions.CommitAction"); >- Constructor commitActionConstructor = commitActionClass >- .getConstructor(new Class[] { String.class }); >- Object commitAction = commitActionConstructor >- .newInstance(new Object[] { "" }); >- Method setSelectedResourcesMethod = commitActionClass.getMethod( >- "setSelectedResources", new Class[] { IResource[].class }); >- setSelectedResourcesMethod.invoke(commitAction, >- new Object[] { resources }); >+ Class commitActionClass = Class.forName("org.tigris.subversion.subclipse.ui.actions.CommitAction"); >+ Constructor commitActionConstructor = commitActionClass.getConstructor(new Class[] { String.class }); >+ Object commitAction = commitActionConstructor.newInstance(new Object[] { "" }); >+ Method setSelectedResourcesMethod = commitActionClass.getMethod("setSelectedResources", >+ new Class[] { IResource[].class }); >+ setSelectedResourcesMethod.invoke(commitAction, new Object[] { resources }); > >- Method executeMethod = commitActionClass.getMethod("execute", >- new Class[] { IAction.class }); >+ Method executeMethod = commitActionClass.getMethod("execute", new Class[] { IAction.class }); > executeMethod.invoke(commitAction, new Object[] { null }); > } catch (Throwable t) { > // nothing we can do >Index: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.properties >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.properties >diff -N src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.properties >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.properties 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,495 @@ >+############################################################################### >+# Copyright (c) 2000, 2005 IBM Corporation and others. >+# All rights reserved. This program and the accompanying materials >+# are made available under the terms of the Eclipse Public License v1.0 >+# which accompanies this distribution, and is available at >+# http://www.eclipse.org/legal/epl-v10.html >+# >+# Contributors: >+# IBM Corporation - initial API and implementation >+############################################################################### >+ >+## Content Assist for regular expressions ## >+## Copied from org.eclipse.ui.texteditor.RegExMessages.properties. >+## Needed by org.eclipse.mylar.internal.team.ui.preferences.workaround.RegExMessages. >+## TODO Ask platform guys to open this API >+# use \\\u0075 for a backslash-u >+displayString_bs_bs= \\\\ - Backslash >+additionalInfo_bs_bs= Backslash >+displayString_bs_0= \\0nnn - Octal character code >+additionalInfo_bs_0= Octal character code\n\nExamples:\n\\011 (tabulator)\n\\0112 (character J) >+displayString_bs_x= \\xhh - Hex character code >+additionalInfo_bs_x= Hexadecimal character code\n\nExamples:\n\\x09 (tabulator)\n\\x4A or \\x4a (character J) >+displayString_bs_u= \\\u0075hhhh - Hex code for Unicode character >+additionalInfo_bs_u= Hexadecimal code for Unicode character\n\nExamples:\n\\\u0075004A (character J)\n\\\u007503B2 (lowercase Greek letter beta: \u03B2) >+displayString_bs_t= \\t - Tab >+additionalInfo_bs_t= Tabulator (\\x09, decimal: 9) >+displayString_bs_n= \\n - Newline >+additionalInfo_bs_n= Newline (\\x0A, decimal: 10) >+displayString_bs_r= \\r - CR >+additionalInfo_bs_r= Carriage Return (\\x0D, decimal: 13) >+displayString_bs_f= \\f - FF >+additionalInfo_bs_f= Form Feed (\\x0C, decimal: 12) >+displayString_bs_a= \\a - Beep >+additionalInfo_bs_a= Beep, Bell, Alert (\\x07, decimal: 7) >+displayString_bs_e= \\e - Esc >+additionalInfo_bs_e= Escape (\\x1B, decimal: 27) >+displayString_bs_c= \\c - Control character >+additionalInfo_bs_c= Control character\n\nExample:\n\\cC (Ctrl+C) >+ >+displayString_dot= . - Any character >+additionalInfo_dot= The dot matches any character except line terminators.\n\n\ >+To make the dot match line terminators as well, \n\ >+start the expression with the embedded flag expression \n\ >+"(?s)" (without quotes). >+displayString_bs_d= \\d - A digit >+additionalInfo_bs_d= A digit: [0-9] >+displayString_bs_D= \\D - Not a digit >+additionalInfo_bs_D= Not a digit: [^0-9] >+displayString_bs_s= \\s - A whitespace >+additionalInfo_bs_s= A whitespace: [ \\t\\n\\x0B\\f\\r] >+displayString_bs_S= \\S - Not a whitespace >+additionalInfo_bs_S= Not a whitespace: [^\\s] >+displayString_bs_w= \\w - An alphanumeric (word character) >+additionalInfo_bs_w= An alphanumeric (a word character): [a-zA-Z_0-9] >+displayString_bs_W= \\W - Not an alphanumeric >+additionalInfo_bs_W= Not an alphanumeric (not a word character): [^\\w] >+ >+displayString_start= ^ - Line start >+additionalInfo_start= Line start (positional match)\n\nExample:\n\ >+The expression "^Eclipse" matches the term "Eclipse"\n\ >+only on the second line of text\n\ >+"The Eclipse Project\n\ >+Eclipse Platform". >+displayString_end= $ - Line end >+additionalInfo_end= Line end (positional match)\n\nExample:\n\ >+The expression "Eclipse$" matches the term "Eclipse"\n\ >+only on the second line of text\n\ >+"- Install the Eclipse Platform\n\ >+- Run Eclipse". >+displayString_bs_b= \\b- Word beginning or end >+additionalInfo_bs_b= Word beginning or end (positional match)\n\nExample:\n\ >+The expression "s\\b" matches only the last "s" of "glasses" in text\n\ >+"I lost my glasses." >+displayString_bs_B= \\B - Not a word beginning or end >+additionalInfo_bs_B= Not a word beginning or end (positional match)\n\nExample:\n\ >+The expression "\\BS" matches only "S" of "printString" in text\n\ >+"void print(String printString)". >+displayString_bs_A= \\A - Start of input >+additionalInfo_bs_A= Start of input (positional match)\n\nExample:\n\ >+The expression "\\ABC" matches only "BC" of "BCD" in text\n\ >+"BCD ABC\n\ >+BCDEF". >+displayString_bs_G= \\G - Previous match's end >+additionalInfo_bs_G= Previous match's end (positional match)\n\nExample:\n\ >+The expression "\\Ga" matches the first and then the second "a" in text\n\ >+"aardvark" (when starting from the beginning). >+displayString_bs_Z= \\Z - End of input, does not consider last line terminator >+additionalInfo_bs_Z= End of input, does not consider last line terminator (positional match)\n\n\ >+The expression matches at the end of the file, except for when the\n\ >+file ends in a line terminator, in which case it matches before that\n\ >+line terminator.\n\nExample:\n\ >+The expression "ing\\Z" matches "ing" in text\n\ >+"testing", as well as in text\n\ >+"testing\n\ >+", but doesn't match in text\n\ >+"testing\n\ >+\n\ >+" >+displayString_bs_z= \\z - End of input >+additionalInfo_bs_z= End of input (positional match)\n\nExample:\n\ >+The expression "ing\\z" matches "ing" in text\n\ >+"testing", but doesn't match in text\n\ >+"testing\n\ >+" >+ >+### repetition quantifiers ### >+displayString_quest= ? - Greedy match 0 or 1 times >+additionalInfo_quest= Greedy match 0 or 1 times.\n\n\ >+First tries to match the preceding token.\n\ >+Falls back to not matching if this choice made a full match impossible.\n\nExample:\n\ >+The expression "fo?" matches "f", "fo", and "fo" in text\n\ >+"f fo foo". >+displayString_star= * - Greedy match 0 or more times >+additionalInfo_star= Greedy match 0 or more times.\n\n\ >+First tries to match the preceding token as many times as possible.\n\ >+Falls back to matching it less often if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo*" matches "f", "fo", and "foo" in text\n\ >+"f fo foo".\n\ >+- The expression "fo*o\\d" matches all three words in text\n\ >+"fo1 foo2 fooo3".\n\ >+- The expression "<.*>" matches the whole text\n\ >+"<p><b>bold</b>". >+displayString_plus= + - Greedy match 1 or more times >+additionalInfo_plus= Greedy match 1 or more times\n\n\ >+First tries to match the preceding token as many times as possible.\n\ >+Falls back to matching it less often if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo+" matches "fo" and "foo" in text\n\ >+"f fo foo".\n\ >+- The expression "fo+o\\d" matches "foo2" and "fooo3" in text\n\ >+"fo1 foo2 fooo3".\n\ >+- The expression "<.+>" matches the whole text\n\ >+"<p><b>bold</b>", but does not match anywhere in "<>". >+displayString_exact= {n} - Greedy match exactly n times >+additionalInfo_exact= Greedy match exactly n times.\n\nExamples:\n\ >+- The expression "\\\\0[0-3][0-7]{2}" matches all three-digit octal character tokens.\n\ >+- The expression "\\b\\w{4}\\b" matches all four-letter-words\n\ >+such as "Java", "cool", or "food" (but not "dog"). >+displayString_least= {n,} - Greedy match >= n times >+additionalInfo_least= Greedy match >= n times.\n\n\ >+First tries to match the preceding token as many times as possible.\n\ >+Falls back to matching it less often (but at least n times),\n\ >+if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo{2,}" matches "foo" and "fooo" in text\n\ >+"f fo foo fooo".\n\ >+- The expression "fo{2,}o\\d" matches "fooo3" and "foooo4" in text\n\ >+"fo1 foo2 fooo3 foooo4".\n\ >+- The expression "10{3,}[^0]" matches all powers of ten that are larger than one thousand.\n\n\ >+Note: The expressions "{0,}" and "*" are equivalent;\n\ >+likewise, "{1,}" is equivalent to "+". >+displayString_count= {n,m} - Greedy match >= n times but <= m times >+additionalInfo_count= Greedy match >= n times but <= m times.\n\n\ >+First tries to match the preceding token m times.\n\ >+Falls back to matching it less often (but at least n times),\n\ >+if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo{1,2}" matches "fo", "foo", and "foo" in text\n\ >+"f fo foo fooo".\n\ >+- The expression "fo{1,2}o\\d" matches "foo2" and "fooo3" in text\n\ >+"fo1 foo2 fooo3 foooo4".\n\ >+- The expression "^.{70,80}$" matches all the lines that contain\n\ >+between 70 and 80 characters (inclusive). >+ >+displayString_questLazy= ?? - Lazy match 0 or 1 times >+additionalInfo_questLazy= Lazy match 0 or 1 times.\n\n\ >+First tries to not match the preceding token.\n\ >+Falls back to matching it if this choice made a full match impossible.\n\nExample:\n\ >+The expression "fo??" matches "f", "f", and "f" in text\n\ >+"f fo foo". >+displayString_starLazy= *? - Lazy match 0 or more times >+additionalInfo_starLazy= Lazy match 0 or more times.\n\n\ >+First tries to not match the preceding token.\n\ >+Falls back to matching it more often if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo*?" matches "f", "f", and "f" in text\n\ >+"f fo foo".\n\ >+- The expression "fo*?o\\d" matches all three words in text\n\ >+"fo1 foo2 fooo3".\n\ >+- The expression "<.*?>" matches "<p>", "<b>", and "</b>" in text\n\ >+"<p><b>bold</b>". Note: a more performant expression for finding\n\ >+xml tags is "<[^>]*>", which avoids backtracking. >+displayString_plusLazy= +? - Lazy match 1 or more times >+additionalInfo_plusLazy= Lazy match 1 or more times\n\n\ >+First tries to match the preceding token once.\n\ >+Falls back to matching it more often if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo+?" matches "fo" and "fo" in text\n\ >+"f fo foo".\n\ >+- The expression "fo+?o\\d" matches "foo2" and "fooo3" in text\n\ >+"fo1 foo2 fooo3".\n\ >+- The expression "<.+?>" matches "<p>", "<b>", and "</b>" in text\n\ >+"<p><b>bold</b>". Note: a more performant expression for finding\n\ >+xml tags is "<[^>]*>", which avoids backtracking. >+displayString_exactLazy= {n}? - Lazy match exactly n times >+additionalInfo_exactLazy= Lazy match exactly n times.\n\n\ >+This expression is equivalent to the expression\n\ >+{n} - Greedy match exactly n times. >+displayString_leastLazy= {n,}? - Lazy match >= n times >+additionalInfo_leastLazy= Lazy match >= n times.\n\n\ >+First tries to match the preceding token n times. Falls back to\n\ >+matching it more often, if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo{2,}?" matches "foo" and "foo" in text\n\ >+"f fo foo fooo".\n\ >+- The expression "fo{2,}?o\\d" matches "fooo3" and "foooo4" in text\n\ >+"fo1 foo2 fooo3 foooo4".\n\ >+- The expression "10{3,}?[^0]" matches all powers of ten that are larger than one thousand.\n\n\ >+Note: The expressions "{0,}?" and "*?" are equivalent;\n\ >+likewise, "{1,}?" is equivalent to "+?". >+displayString_countLazy= {n,m}? - Lazy match >= n times but <= m times >+additionalInfo_countLazy= Lazy match >= n times but <= m times.\n\n\ >+First tries to match the preceding token n times.\n\ >+Falls back to matching it more often (but at most m times),\n\ >+if this choice made a full match impossible.\n\nExamples:\n\ >+- The expression "fo{1,2}?" matches "fo", "fo", and "fo" in text\n\ >+"f fo foo fooo".\n\ >+- The expression "fo{1,2}?o\\d" matches "foo2" and "fooo3" in text\n\ >+"fo1 foo2 fooo3 foooo4".\n\ >+ >+displayString_questPoss= ?+ - Possessive match 0 or 1 times (no backtracking) >+additionalInfo_questPoss= Possessive match 0 or 1 times.\n\n\ >+Matches the preceding token if possible. Never backtracks,\n\ >+even if this choice renders a full match impossible.\n\nExample:\n\ >+The expression "fo?+o\\d" matches the first, but not the second line in text\n\ >+"fo1\n\ >+foo1". >+displayString_starPoss= *+ Possessive match 0 or more times (no backtracking) >+additionalInfo_starPoss= Possessive match 0 or more times.\n\n\ >+Tries to match the preceding token as many times as possible. Never backtracks,\n\ >+even if this choice renders a full match impossible.\n\nExamples:\n\ >+- The expression "fo*+" matches "f", "fo" and "foo" in text\n\ >+"f fo foo".\n\ >+- The expression "fo*+o\\d" matches nowhere in text\n\ >+"fo1 foo2 fooo3".\n\ >+- The expression "<.*+>" matches nowhere in text\n\ >+"<p><b>bold</b>". >+displayString_plusPoss= ++ - Possessive match 1 or more times (no backtracking) >+additionalInfo_plusPoss= Possessive match 1 or more times.\n\n\ >+Tries to match the preceding token as many times as possible. Never backtracks,\n\ >+even if this choice renders a full match impossible.\n\nExamples:\n\ >+- The expression "fo++" matches "fo" and "foo" in text\n\ >+"f fo foo".\n\ >+- The expression "fo++o\\d" matches nowhere in text\n\ >+"fo1 foo2 fooo3".\n\ >+- The expression "<.++>" matches nowhere in text\n\ >+"<p><b>bold</b>". >+ >+displayString_exactPoss= {n}+ - Possessive match exactly n times (no backtracking) >+additionalInfo_exactPoss= Possessive match exactly n times.\n\n\ >+This expression is equivalent to the expression\n\ >+{n} - Greedy match exactly n times. >+displayString_leastPoss= {n,}+ - Possessive match >= n times (no backtracking) >+additionalInfo_leastPoss= Possessive match >= n times.\n\n\ >+Tries to match the preceding token as many times as possible, but at least n times.\n\ >+Never backtracks, even if this choice renders a full match impossible.\n\nExamples:\n\ >+- The expression "fo{2,}+" matches "foo" and "fooo" in text\n\ >+"f fo foo fooo".\n\ >+- The expression "fo{2,}?o\\d" matches nowhere in text\n\ >+"fo1 foo2 fooo3 foooo4".\n\ >+Note: The expressions "{0,}?" and "*?" are equivalent;\n\ >+likewise, "{1,}?" is equivalent to "+?". >+ >+displayString_countPoss= {n,m}+ - Possessive match >= n times but <= m times (no backtracking) >+additionalInfo_countPoss= Possessive match >= n times but <= m times.\n\n\ >+Tries to match the preceding token as many times as possible, \n\ >+at least n times and at most m times.\n\ >+Never backtracks, even if this choice renders a full match impossible.\n\nExamples:\n\ >+- The expression "fo{1,2}+" matches "fo", "foo", and "foo" in text\n\ >+"f fo foo fooo".\n\ >+- The expression "fo{1,2}+o\\d" matches only "fooo3" in text\n\ >+"fo1 foo2 fooo3 foooo4".\n\ >+- The expression "^.{70,80}+$" matches all the lines that contain\n\ >+between 70 and 80 characters (inclusive). >+ >+displayString_alt= U|V - Alternation: U or V >+additionalInfo_alt= Alternation.\n\n\ >+First tries to match subexpression U. Falls back and tries to match V if U didn't match.\n\nExamples:\n\ >+- The expression "A|B" applied to text "BA" first matches "B", then "A".\n\ >+- The expression "AB|BC|CD" applied to text "ABC BC DAB" matches, in sequence:\n\ >+"AB" in the first word, the second word "BC", "AB" at the very end. >+displayString_group= (Expr) - Mark Expr as capturing group >+additionalInfo_group= Mark Expr as capturing group.\n\n\ >+Capturing groups are numbered by counting their opening parentheses from left to right.\n\ >+In the expression "((A)(B(C)))", for example, there are four such groups:\n\ >+1 ((A)(B(C)))\n\ >+2 (A)\n\ >+3 (B(C))\n\ >+4 (C)\n\ >+\n\ >+Group zero always stands for the entire expression. During a match,\n\ >+each subsequence of the input sequence that matches such a group is saved.\n\ >+The captured subsequence i may be used later in the expression, via a back reference "\\i",\n\ >+and may also be used in the replace string via "$i".\n\ >+\n\ >+Note: Groups beginning with (? are pure, non-capturing groups that\n\ >+do not capture text and do not count towards the group total. >+ >+displayString_bs_i= \\i - Match of the capturing group i >+additionalInfo_bs_i= Match of the capturing group i.\n\n\ >+\\i matches the subsequence that has already been saved as capturing group i.\n\ >+\\0 is not a valid group number in the regular expression.\n\nExample:\n\ >+The expression "(\\d+)\\+\\1" matches "10+10" in text "9+10+10+11".\n\ >+\n\ >+Note: in the replace string, $i stands for the capturing group i. >+ >+displayString_bs= \\ - Quote next character >+additionalInfo_bs= Quote next character\n\nExample:\n\ >+The expression "\\{\\n\\}" matches the text "{n}". >+ >+displayString_bs_Q= \\Q - Start quoting >+additionalInfo_bs_Q= Start quoting\n\n\ >+All characters between \\Q and the next \\E are taken literally and are not interpreted.\n\nExample:\n\ >+The expression "\\Qnew int[] {42}\\E;" matches text "new int[] {42}". >+displayString_bs_E= \\E - End quoting >+additionalInfo_bs_E= End quoting\n\n\ >+All characters between \\Q and the next \\E are taken literally and are not interpreted.\n\nExample:\n\ >+The expression "\\Qnew int[] {42}\\E;" matches text "new int[] {42}". >+ >+displayString_set= [ecl] - Character set >+additionalInfo_set= Character set\n\n\ >+Matches a single character out of the set.\n\nExample:\n\ >+The expression "[ecl]" matches "c" and "l" in text "cold". >+displayString_setExcl= [^ecl] - Excluded character set >+additionalInfo_setExcl= Excluded character set\n\n\ >+Matches a single character that is not one of the excluded characters.\n\nExamples:\n\ >+The expression "[^ecl]" matches "o" and "d" in text "cold".\n\ >+The expression "[a-z&&[^ecl]]" matches any character from a to z, excluding e, c, and l. >+displayString_setRange= [c-l] - Character range >+additionalInfo_setRange= Character range\n\n\ >+Matches a single character out of the range from 'c' to 'l'.\n\nExamples:\n\ >+The expression "[c-l]" matches "c", "l", and "d" in text "cold".\n\ >+The expression "[a-z&&[^ecl]]" matches any character from a to z, excluding e, c, and l. >+displayString_setInter= && - Intersection of character sets >+additionalInfo_setInter= Intersection of character sets\n\n\ >+Matches a character that is in both of the given sets.\n\nExample:\n\ >+The expression "[a-z&&[^ecl]]" matches any character from a to z, excluding e, c, and l. >+ >+displayString_posix= \\p{Class} - POSIX or Unicode character class >+additionalInfo_posix= POSIX or Unicode character class\n\n\ >+Matches a character from the given character class 'Class'.\n\ >+Valid classes are:\n\ >+\n\ >+- POSIX character classes (US-ASCII only):\n\ >+\ Lower, Upper, ASCII, Alpha, Digit, Alnum, Punct,\n\ >+\ Graph, Print, Blank, Cntrl, XDigit, and Space.\n\ >+\n\ >+- Unicode blocks and categories, e.g.:\n\ >+\ BasicLatin\n\ >+\ Latin-1Supplement\n\ >+\ Greek\n\ >+\ Lu: Uppercase Letter\n\ >+\ Ll: Lowercase Letter\n\ >+\ L: Letter\n\ >+\ N: Number\n\ >+\ Z: Separator\n\ >+\ LD: Letter or Digit\n\ >+\ L1: Latin-1 >+ >+displayString_posixNot= \\P{Class} - Excluded POSIX or Unicode character class >+additionalInfo_posixNot= Excluded POSIX or Unicode character class\n\n\ >+Negation of character set \\p{Class}. Example:\n\ >+\\P{ASCII} is equivalent to [^\\p{ASCII}] and matches all non-ASCII characters.\n\n\ >+Valid classes are:\n\ >+\n\ >+- POSIX character classes (US-ASCII only):\n\ >+\ Lower, Upper, ASCII, Alpha, Digit, Alnum, Punct,\n\ >+\ Graph, Print, Blank, Cntrl, XDigit, and Space.\n\ >+\n\ >+- Unicode blocks and categories, e.g.:\n\ >+\ BasicLatin\n\ >+\ Latin-1Supplement\n\ >+\ Greek\n\ >+\ Lu: Uppercase Letter\n\ >+\ Ll: Lowercase Letter\n\ >+\ L: Letter\n\ >+\ N: Number\n\ >+\ Z: Separator\n\ >+\ LD: Letter or Digit\n\ >+\ L1: Latin-1 >+ >+ >+#Flags: >+displayString_flag= (?ismd-ismd) - Turn flags on or off >+additionalInfo_flag= Turn flags on and off for the rest of the matching process.\n\n\ >+Flags before the dash are turned on; those after the dash are turned off.\n\ >+The following flags are supported:\n\ >+- i: case-insensitive matching\n\ >+\n\ >+- s: single-line, or dotall matching mode:\n\ >+\ The expression . matches any character, including a line terminator.\n\ >+\n\ >+- m: multiline matching mode:\n\ >+\ The expressions ^ and $ match just after or just before,\n\ >+\ respectively, a line terminator or the end of the input sequence.\n\ >+\ By default these expressions only match at the beginning and the\n\ >+\ end of the entire input sequence.\n\ >+\n\ >+- d: Unix lines matching mode:\n\ >+\ Only the '\\n' line terminator\n\ >+\ is recognized in the behavior of ., ^, and $ >+# - u: unicode-aware case folding:\n\ >+# Case-insensitive matching, when enabled, is done in a manner consistent\n\ >+# with the Unicode Standard. By default, case-insensitive matching\n\ >+# assumes that only characters in the US-ASCII charset are being matched. >+# - c: canonical equivalence\n\ >+# Two characters will be considered to match if, and only if, their full\n\ >+# canonical decompositions match. The expression "a\\\u0075030A", for example,\n\ >+# will match the string "a\u030A" when this flag is specified.\n\ >+# By default, matching does not take canonical equivalence into account. >+# - x: comments mode\n\ >+# Whitespace is ignored, and embedded comments starting with\n\ >+# # are ignored until the end of a line.\n\ >+ >+displayString_flagExpr= (?ismd-ismd:Expr) - Turn flags on or off in Expr >+additionalInfo_flagExpr= Turn flags on and off in Expr.\n\n\ >+Flags before the dash are turned on; those after the dash are turned off.\n\ >+The following flags are supported:\n\ >+- i: case-insensitive matching\n\ >+\n\ >+- s: single-line, or dotall matching mode:\n\ >+\ The expression . matches any character, including a line terminator.\n\ >+\n\ >+- m: multiline matching mode:\n\ >+\ The expressions ^ and $ match just after or just before,\n\ >+\ respectively, a line terminator or the end of the input sequence.\n\ >+\ By default these expressions only match at the beginning and the\n\ >+\ end of the entire input sequence.\n\ >+\n\ >+- d: Unix lines matching mode:\n\ >+\ Only the '\\n' line terminator\n\ >+\ is recognized in the behavior of ., ^, and $ >+ >+ >+#Noncapturing groups: >+displayString_nonCap= (?:Expr) - Non-capturing group >+additionalInfo_nonCap= Non-capturing group of regular expression Expr.\n\n\ >+The group is not saved in a back reference.\n\nExample:\n\ >+The expression "(?:\\w+) (\\d+)" matches "bug 42" in text "It's bug 42.".\n\ >+A back reference "$1" in the replace string will be replaced by "42". >+ >+displayString_atomicCap= (?>Expr) - Non-capturing atomic group >+additionalInfo_atomicCap= Non-capturing atomic group of regular expression Expr.\n\n\ >+Matches the regular expression Expr once, but does not backtrack into the expression\n\ >+again if the first match did not prove to be successful later on.\n\ >+The group is not saved in a back reference. >+ >+#Lookaround: >+displayString_posLookahead= (?=Expr) - Zero-width positive lookahead >+additionalInfo_posLookahead= Expr, via zero-width positive lookahead.\n\n\ >+Matches a position (zero-width: does not consume the matched characters),\n\ >+where the next characters (-> lookahead)\n\ >+do match (-> positive) the embedded expression Expr.\n\nExamples:\n\ >+- The expression "var(?==)" matches only the first "var" in text "var=17; other=var;".\n\ >+- The expression "\\b(?=\\w{7}\\b)\\w*clip\\w*\\b" matches any\n\ >+seven-letter-word that contains "clip". It matches "Eclipse", but not "paperclip". >+ >+displayString_negLookahead= (?!Expr) - Zero-width negative lookahead >+additionalInfo_negLookahead= Expr, via zero-width negative lookahead.\n\n\ >+Matches a position (zero-width: does not consume the matched characters),\n\ >+where the next characters (-> lookahead)\n\ >+do not match (-> negative) the embedded expression Expr.\n\nExamples:\n\ >+- The expression "var(?!=)" matches only the second "var" in text "var=17; other=var;".\n\ >+- The expression "\\b(?!\\w{5,7}\\b)\\w*clip\\w*\\b" matches any\n\ >+word that contains "clip" and consists of less than 5 or more than 7 characters.\n\ >+It matches "clip" and "paperclip", but not "Eclipse". >+ >+displayString_posLookbehind= (?<=Expr) - Zero-width positive lookbehind >+additionalInfo_posLookbehind= Expr, via zero-width positive lookbehind.\n\n\ >+Matches a position (zero-width: does not consume the matched characters),\n\ >+where the previous characters (-> lookbehind)\n\ >+do match (-> positive) the embedded expression Expr.\n\nExample:\n\ >+- The expression "\\w{5,}+(?<=as)\\b" matches "alias" and "bananas",\n\ >+but does not match "peas", "apples", or "Alaska". >+ >+displayString_negLookbehind= (?<!Expr) - Zero-width negative lookbehind >+additionalInfo_negLookbehind= Expr, via zero-width negative lookbehind.\n\n\ >+Matches a position (zero-width: does not consume the matched characters),\n\ >+where the previous characters (-> lookbehind)\n\ >+do not match (-> negative) the embedded expression Expr.\n\nExample:\n\ >+- The expression "\\w{5,}+(?<!as)\\b" matches "Eclipse" and "apples",\n\ >+but does not match "peas" or "bananas". >+ >+#Replace string: >+displayString_dollar= $i - Match of the capturing group i >+additionalInfo_dollar= Match of the capturing group i.\n\n\ >+$i is the string that has been saved as capturing group i.\n\ >+$0 is the subsequence matched by the entire expression.\n\ >+\n\ >+Note: in the find expression, \\i stands for the capturing group i. >+displayString_replace_bs= \\ - Quote next character >+additionalInfo_replace_bs= Quote next character\n\nExamples:\n\ >+"\\$" will be replaced by "$".\n\ >+"\\a" will be replaced by "a".\n\ >+"\\\\" will be replaced by "\\". >+displayString_tab= Tab - The tabulator character >+additionalInfo_tab= The tabulator character (\\t in the find expression). >+displayString_cr= CR - The carriage return character >+additionalInfo_cr= The carriage return character (\\r or \\x0D in the find expression). >+displayString_nl= Newline - The newline character >+additionalInfo_nl= The newline character (\\n or \\x0A in the find expression). >Index: src/org/eclipse/mylar/internal/team/template/TemplateHandlersManager.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/template/TemplateHandlersManager.java >diff -N src/org/eclipse/mylar/internal/team/template/TemplateHandlersManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/template/TemplateHandlersManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,211 @@ >+/*************************************************************************** >+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany. >+ * 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: >+ * Eike Stepper - initial API and implementation >+ **************************************************************************/ >+package org.eclipse.mylar.internal.team.template; >+ >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtension; >+import org.eclipse.core.runtime.IExtensionPoint; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.mylar.context.core.MylarStatusHandler; >+import org.eclipse.mylar.tasks.core.ITask; >+import org.eclipse.mylar.team.ITemplateHandler; >+import org.eclipse.mylar.team.ITemplateHandlersManager; >+import org.eclipse.mylar.team.MylarTeamPlugin; >+ >+import java.text.MessageFormat; >+import java.util.ArrayList; >+ >+/** >+ * @author Eike Stepper >+ */ >+public class TemplateHandlersManager implements ITemplateHandlersManager { >+ private static final String ATTR_CLASS = "class"; >+ >+ private static final String ATTR_DESCRIPTION = "description"; >+ >+ private static final String ATTR_RECOGNIZED_KEYWORD = "recognizedKeyword"; >+ >+ private static final String ELEM_TEMPLATE_HANDLER = "templateHandler"; >+ >+ private static final String EXT_POINT_TEMPLATE_HANDLERS = "templateHandlers"; >+ >+ public TemplateHandlersManager() { >+ } >+ >+ public String getTaskIDRegEx(String template) { >+ final String META_CHARS = "$()*+.< [\\]^{|}"; >+ final String TASK_ID_PLACEHOLDER = "\uffff"; >+ final String KEYWORD_PLACEHOLDER = "\ufffe"; >+ >+ template = template.replaceFirst("\\$\\{task\\.id\\}", TASK_ID_PLACEHOLDER); >+ template = replaceKeywords(template, KEYWORD_PLACEHOLDER); >+ template = quoteChars(template, META_CHARS); >+ template = template.replaceFirst(TASK_ID_PLACEHOLDER, "(\\\\d+)"); >+ template = template.replaceAll(KEYWORD_PLACEHOLDER, ".*"); >+ return template; >+ } >+ >+ private String replaceKeywords(String str, String placeholder) { >+ String[] recognizedKeywords = getRecognizedKeywords(); >+ for (String keyword : recognizedKeywords) { >+ str = str.replaceAll("\\$\\{" + keyword + "\\}", placeholder); >+ } >+ return str; >+ } >+ >+ private String quoteChars(String str, String charsToQuote) { >+ StringBuilder builder = new StringBuilder(str.length() * 2); >+ for (int i = 0; i < str.length(); i++) { >+ char c = str.charAt(i); >+ if (charsToQuote.indexOf(c) != -1) { >+ builder.append('\\'); >+ } >+ builder.append(c); >+ } >+ return builder.toString(); >+ } >+ >+ public String[] getRecognizedKeywords() { >+ final ArrayList<String> result = new ArrayList<String>(); >+ new ExtensionProcessor() { >+ @Override >+ protected Object processContribution(IConfigurationElement element, String keyword, String description, >+ String className) throws Exception { >+ result.add(keyword); >+ return null; >+ } >+ }.run(); >+ >+ return result.toArray(new String[result.size()]); >+ } >+ >+ public String getHandlerDescription(final String keyword) { >+ return (String) new ExtensionProcessor() { >+ @Override >+ protected Object processContribution(IConfigurationElement element, String foundKeyword, >+ String description, String className) throws Exception { >+ return keyword.equals(foundKeyword) ? description : null; >+ } >+ }.run(); >+ } >+ >+ public ITemplateHandler createHandler(final String keyword) { >+ return (ITemplateHandler) new ExtensionProcessor() { >+ @Override >+ protected Object processContribution(IConfigurationElement element, String foundKeyword, >+ String description, String className) throws Exception { >+ if (keyword.equals(foundKeyword)) { >+ ITemplateHandler handler = (ITemplateHandler) element.createExecutableExtension(ATTR_CLASS); >+ if (handler instanceof TemplateHandler) { >+ ((TemplateHandler) handler).setDescription(description); >+ ((TemplateHandler) handler).setRecognizedKeyword(foundKeyword); >+ } else { >+ String recognizedKeyword = handler.getRecognizedKeyword(); >+ if (recognizedKeyword == null || !recognizedKeyword.equals(foundKeyword)) { >+ throw new IllegalArgumentException("Keyword markup does not match handler implementation"); >+ } >+ } >+ >+ return handler; >+ } >+ >+ return null; >+ } >+ }.run(); >+ } >+ >+ public String generateComment(ITask task, String completedTemplate, String progressTemplate) { >+ String template = task.isCompleted() ? completedTemplate : progressTemplate; >+ return processKeywords(task, template); >+ } >+ >+ private String processKeywords(ITask task, String template) { >+ String[] segments = template.split("\\$\\{"); >+ StringBuffer buffer = new StringBuffer(segments[0]); >+ >+ for (int i = 1; i < segments.length; i++) { >+ String segment = segments[i]; >+ String value = null; >+ int brace = segment.indexOf('}'); >+ if (brace > 0) { >+ String keyword = segment.substring(0, brace); >+ value = processKeyword(task, keyword); >+ } >+ >+ if (value != null) { >+ buffer.append(value); >+ buffer.append(segment.substring(brace + 1)); >+ } else { >+ buffer.append("${"); >+ buffer.append(segment); >+ } >+ } >+ >+ return buffer.toString(); >+ } >+ >+ private String processKeyword(ITask task, String keyword) { >+ try { >+ ITemplateHandler handler = createHandler(keyword); >+ if (handler != null) { >+ return handler.getValue(task); >+ } >+ } catch (Exception ex) { >+ MylarStatusHandler.log(ex, "Problem while dispatching to template handler for: " + keyword); >+ } >+ >+ return null; >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ private static class ExtensionProcessor { >+ public Object run() { >+ IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(MylarTeamPlugin.PLUGIN_ID, >+ EXT_POINT_TEMPLATE_HANDLERS); >+ IExtension[] extensions = extPoint.getExtensions(); >+ for (int i = 0; i < extensions.length; i++) { >+ IExtension extension = extensions[i]; >+ IConfigurationElement[] elements = extension.getConfigurationElements(); >+ for (int j = 0; j < elements.length; j++) { >+ IConfigurationElement element = elements[j]; >+ if (ELEM_TEMPLATE_HANDLER.equals(element.getName())) { >+ try { >+ Object result = processContribution(element); >+ if (result != null) >+ return result; >+ } catch (Exception ex) { >+ final String msg = MessageFormat.format( >+ "Error while processing template handler contribution {0} from plugin {1}.", >+ element.getAttribute(ATTR_CLASS), element.getContributor().getName()); >+ MylarStatusHandler.log(ex, msg); >+ } >+ } >+ } >+ } >+ >+ return null; >+ } >+ >+ protected Object processContribution(IConfigurationElement element) throws Exception { >+ String keyword = element.getAttribute(ATTR_RECOGNIZED_KEYWORD); >+ String description = element.getAttribute(ATTR_DESCRIPTION); >+ String className = element.getAttribute(ATTR_CLASS); >+ return processContribution(element, keyword, description, className); >+ } >+ >+ protected Object processContribution(IConfigurationElement element, String keyword, String description, >+ String className) throws Exception { >+ return null; >+ } >+ } >+} >Index: src/org/eclipse/mylar/team/ITemplateHandlersManager.java >=================================================================== >RCS file: src/org/eclipse/mylar/team/ITemplateHandlersManager.java >diff -N src/org/eclipse/mylar/team/ITemplateHandlersManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/team/ITemplateHandlersManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/*************************************************************************** >+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany. >+ * 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: >+ * Eike Stepper - initial API and implementation >+ **************************************************************************/ >+package org.eclipse.mylar.team; >+ >+import org.eclipse.mylar.tasks.core.ITask; >+ >+/** >+ * @author Eike Stepper >+ */ >+public interface ITemplateHandlersManager { >+ public static final ITemplateHandlersManager INSTANCE = new org.eclipse.mylar.internal.team.template.TemplateHandlersManager(); >+ >+ public String[] getRecognizedKeywords(); >+ >+ public String getHandlerDescription(String keyword); >+ >+ public ITemplateHandler createHandler(String keyword); >+ >+ public String generateComment(ITask task, String completedTemplate, String progressTemplate); >+ >+ public String getTaskIDRegEx(String template); >+} >Index: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.java >diff -N src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExMessages.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,332 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylar.internal.team.ui.preferences.workaround; >+ >+import org.eclipse.osgi.util.NLS; >+ >+/** >+ * RegEx messages. Helper class to get NLSed messages. >+ * <p> >+ * Copied from org.eclipse.ui.texteditor.RegExMessages. >+ * <p> >+ * Needed by >+ * org.eclipse.mylar.internal.team.ui.preferences.workaround.RegExContentProposalProvider. >+ * <p> >+ * TODO Ask platform guys to open this API >+ * >+ * @since 3.1 >+ */ >+final class RegExMessages extends NLS { >+ >+ private static final String BUNDLE_NAME = RegExMessages.class.getName(); >+ >+ private RegExMessages() { >+ // Do not instantiate >+ } >+ >+ static { >+ reloadMessages(); >+ } >+ >+ static void reloadMessages() { >+ NLS.initializeMessages(BUNDLE_NAME, RegExMessages.class); >+ } >+ >+ // characters >+ public static String displayString_bs_bs; >+ >+ public static String additionalInfo_bs_bs; >+ >+ public static String displayString_bs_0; >+ >+ public static String additionalInfo_bs_0; >+ >+ public static String displayString_bs_x; >+ >+ public static String additionalInfo_bs_x; >+ >+ public static String displayString_bs_u; >+ >+ public static String additionalInfo_bs_u; >+ >+ public static String displayString_bs_t; >+ >+ public static String additionalInfo_bs_t; >+ >+ public static String displayString_bs_n; >+ >+ public static String additionalInfo_bs_n; >+ >+ public static String displayString_bs_r; >+ >+ public static String additionalInfo_bs_r; >+ >+ public static String displayString_bs_f; >+ >+ public static String additionalInfo_bs_f; >+ >+ public static String displayString_bs_a; >+ >+ public static String additionalInfo_bs_a; >+ >+ public static String displayString_bs_e; >+ >+ public static String additionalInfo_bs_e; >+ >+ public static String displayString_bs_c; >+ >+ public static String additionalInfo_bs_c; >+ >+ // character classes >+ public static String displayString_dot; >+ >+ public static String additionalInfo_dot; >+ >+ public static String displayString_bs_d; >+ >+ public static String additionalInfo_bs_d; >+ >+ public static String displayString_bs_D; >+ >+ public static String additionalInfo_bs_D; >+ >+ public static String displayString_bs_s; >+ >+ public static String additionalInfo_bs_s; >+ >+ public static String displayString_bs_S; >+ >+ public static String additionalInfo_bs_S; >+ >+ public static String displayString_bs_w; >+ >+ public static String additionalInfo_bs_w; >+ >+ public static String displayString_bs_W; >+ >+ public static String additionalInfo_bs_W; >+ >+ // boundary matchers >+ public static String displayString_start; >+ >+ public static String additionalInfo_start; >+ >+ public static String displayString_end; >+ >+ public static String additionalInfo_end; >+ >+ public static String displayString_bs_b; >+ >+ public static String additionalInfo_bs_b; >+ >+ public static String displayString_bs_B; >+ >+ public static String additionalInfo_bs_B; >+ >+ public static String displayString_bs_A; >+ >+ public static String additionalInfo_bs_A; >+ >+ public static String displayString_bs_G; >+ >+ public static String additionalInfo_bs_G; >+ >+ public static String displayString_bs_Z; >+ >+ public static String additionalInfo_bs_Z; >+ >+ public static String displayString_bs_z; >+ >+ public static String additionalInfo_bs_z; >+ >+ // greedy quantifiers >+ public static String displayString_quest; >+ >+ public static String additionalInfo_quest; >+ >+ public static String displayString_star; >+ >+ public static String additionalInfo_star; >+ >+ public static String displayString_plus; >+ >+ public static String additionalInfo_plus; >+ >+ public static String displayString_exact; >+ >+ public static String additionalInfo_exact; >+ >+ public static String displayString_least; >+ >+ public static String additionalInfo_least; >+ >+ public static String displayString_count; >+ >+ public static String additionalInfo_count; >+ >+ // lazy quantifiers >+ public static String displayString_questLazy; >+ >+ public static String additionalInfo_questLazy; >+ >+ public static String displayString_starLazy; >+ >+ public static String additionalInfo_starLazy; >+ >+ public static String displayString_plusLazy; >+ >+ public static String additionalInfo_plusLazy; >+ >+ public static String displayString_exactLazy; >+ >+ public static String additionalInfo_exactLazy; >+ >+ public static String displayString_leastLazy; >+ >+ public static String additionalInfo_leastLazy; >+ >+ public static String displayString_countLazy; >+ >+ public static String additionalInfo_countLazy; >+ >+ // possessive quantifiers >+ public static String displayString_questPoss; >+ >+ public static String additionalInfo_questPoss; >+ >+ public static String displayString_starPoss; >+ >+ public static String additionalInfo_starPoss; >+ >+ public static String displayString_plusPoss; >+ >+ public static String additionalInfo_plusPoss; >+ >+ public static String displayString_exactPoss; >+ >+ public static String additionalInfo_exactPoss; >+ >+ public static String displayString_leastPoss; >+ >+ public static String additionalInfo_leastPoss; >+ >+ public static String displayString_countPoss; >+ >+ public static String additionalInfo_countPoss; >+ >+ // alternative >+ public static String displayString_alt; >+ >+ public static String additionalInfo_alt; >+ >+ // capturing groups >+ public static String displayString_group; >+ >+ public static String additionalInfo_group; >+ >+ public static String displayString_bs_i; >+ >+ public static String additionalInfo_bs_i; >+ >+ // quoting >+ public static String displayString_bs; >+ >+ public static String additionalInfo_bs; >+ >+ public static String displayString_bs_Q; >+ >+ public static String additionalInfo_bs_Q; >+ >+ public static String displayString_bs_E; >+ >+ public static String additionalInfo_bs_E; >+ >+ // character sets >+ public static String displayString_set; >+ >+ public static String additionalInfo_set; >+ >+ public static String displayString_setExcl; >+ >+ public static String additionalInfo_setExcl; >+ >+ public static String displayString_setRange; >+ >+ public static String additionalInfo_setRange; >+ >+ public static String displayString_setInter; >+ >+ public static String additionalInfo_setInter; >+ >+ public static String displayString_posix; >+ >+ public static String additionalInfo_posix; >+ >+ public static String displayString_posixNot; >+ >+ public static String additionalInfo_posixNot; >+ >+ public static String displayString_flag; >+ >+ public static String additionalInfo_flag; >+ >+ public static String displayString_flagExpr; >+ >+ public static String additionalInfo_flagExpr; >+ >+ // non-capturing group >+ public static String displayString_nonCap; >+ >+ public static String additionalInfo_nonCap; >+ >+ public static String displayString_atomicCap; >+ >+ public static String additionalInfo_atomicCap; >+ >+ // look-ahead >+ public static String displayString_posLookahead; >+ >+ public static String additionalInfo_posLookahead; >+ >+ public static String displayString_negLookahead; >+ >+ public static String additionalInfo_negLookahead; >+ >+ public static String displayString_posLookbehind; >+ >+ public static String additionalInfo_posLookbehind; >+ >+ public static String displayString_negLookbehind; >+ >+ public static String additionalInfo_negLookbehind; >+ >+ // replace >+ public static String displayString_dollar; >+ >+ public static String additionalInfo_dollar; >+ >+ public static String additionalInfo_replace_bs; >+ >+ public static String displayString_replace_bs; >+ >+ public static String displayString_tab; >+ >+ public static String additionalInfo_tab; >+ >+ public static String displayString_nl; >+ >+ public static String additionalInfo_nl; >+ >+ public static String displayString_cr; >+ >+ public static String additionalInfo_cr; >+} >Index: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/README.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/README.java >diff -N src/org/eclipse/mylar/internal/team/ui/preferences/workaround/README.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/ui/preferences/workaround/README.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+/*************************************************************************** >+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany. >+ * 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: >+ * Eike Stepper - initial API and implementation >+ **************************************************************************/ >+package org.eclipse.mylar.internal.team.ui.preferences.workaround; >+ >+/** >+ * The classes in this package are copied from org.eclipse.ui.texteditor because >+ * the class org.eclipse.ui.texteditor.RegExContentProposalProvider is not >+ * public. TODO We should ask platform guys to open this API. >+ * >+ * @author Eike Stepper >+ */ >+public class README { >+} >Index: schema/templateHandlers.exsd >=================================================================== >RCS file: schema/templateHandlers.exsd >diff -N schema/templateHandlers.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/templateHandlers.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.mylar.team"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.mylar.team" id="templateHandlers" name="Mylar Template Handlers"/> >+ </appInfo> >+ <documentation> >+ [Enter description of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="templateHandler" minOccurs="1" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="templateHandler"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn="org.eclipse.mylar.team.ITemplateHandler"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="description" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ <attribute name="recognizedKeyword" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema> >Index: src/org/eclipse/mylar/team/ITemplateHandler.java >=================================================================== >RCS file: src/org/eclipse/mylar/team/ITemplateHandler.java >diff -N src/org/eclipse/mylar/team/ITemplateHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/team/ITemplateHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+/*************************************************************************** >+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany. >+ * 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: >+ * Eike Stepper - initial API and implementation >+ **************************************************************************/ >+package org.eclipse.mylar.team; >+ >+import org.eclipse.mylar.tasks.core.ITask; >+ >+/** >+ * @author Eike Stepper >+ */ >+public interface ITemplateHandler { >+ public String getDescription(); >+ >+ public String getRecognizedKeyword(); >+ >+ public String getValue(ITask task); >+} >Index: src/org/eclipse/mylar/internal/team/template/TemplateHandler.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/template/TemplateHandler.java >diff -N src/org/eclipse/mylar/internal/team/template/TemplateHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/template/TemplateHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,316 @@ >+/*************************************************************************** >+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany. >+ * 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: >+ * Eike Stepper - initial API and implementation >+ **************************************************************************/ >+package org.eclipse.mylar.internal.team.template; >+ >+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; >+import org.eclipse.mylar.tasks.core.ITask; >+import org.eclipse.mylar.team.ITemplateHandler; >+ >+import java.util.List; >+ >+/** >+ * @author Eike Stepper >+ */ >+public abstract class TemplateHandler implements ITemplateHandler { >+ protected String description; >+ >+ protected String recognizedKeyword; >+ >+ protected TemplateHandler() { >+ } >+ >+ public String getDescription() { >+ return description != null ? description : "Handler for '" + recognizedKeyword + "'"; >+ } >+ >+ public void setDescription(String description) { >+ this.description = description; >+ } >+ >+ public String getRecognizedKeyword() { >+ return recognizedKeyword; >+ } >+ >+ public void setRecognizedKeyword(String recognizedKeyword) { >+ if (recognizedKeyword == null) { >+ throw new IllegalArgumentException("Keyword to recognize must not be null"); //$NON-NLS-1$ >+ } >+ >+ this.recognizedKeyword = recognizedKeyword; >+ } >+ >+ public static String implode(List<String> list, String separator) { >+ StringBuilder builder = new StringBuilder(); >+ for (String cc : list) { >+ if (builder.length() != 0) { >+ builder.append(separator); >+ } >+ >+ builder.append(cc); >+ } >+ >+ return builder.toString(); >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class RepositoryKind extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getRepositoryKind(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class RepositoryURL extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getRepositoryUrl(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskProduct extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getProduct(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskAssignee extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getAssignedTo(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskReporter extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getReporter(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskResolution extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getResolution(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskStatus extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getStatus(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskCC extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ List<String> list = ((AbstractRepositoryTask) task).getTaskData().getCC(); >+ return implode(list, ", "); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskKeywords extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ List<String> list = ((AbstractRepositoryTask) task).getTaskData().getKeywords(); >+ return implode(list, ", "); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskLastModified extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getLastModified(); >+ } >+ >+ return null; >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskSummary extends TemplateHandler { >+ public String getValue(ITask task) { >+ if (task instanceof AbstractRepositoryTask) { >+ return ((AbstractRepositoryTask) task).getTaskData().getSummary(); >+ } >+ >+ return task.getDescription(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskDescription extends TemplateHandler { >+ public String getValue(ITask task) { >+ return task.getDescription(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskHandle extends TemplateHandler { >+ public String getValue(ITask task) { >+ return task.getHandleIdentifier(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskID extends TemplateHandler { >+ public String getValue(ITask task) { >+ return AbstractRepositoryTask.getTaskId(task.getHandleIdentifier()); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskNotes extends TemplateHandler { >+ public String getValue(ITask task) { >+ return task.getNotes(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskPriority extends TemplateHandler { >+ public String getValue(ITask task) { >+ return task.getPriority(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskType extends TemplateHandler { >+ public String getValue(ITask task) { >+ return task.getTaskType(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskURL extends TemplateHandler { >+ public String getValue(ITask task) { >+ return task.getUrl(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ protected static abstract class Date extends TemplateHandler { >+ public String getValue(ITask task) { >+ java.util.Date date = getDate(task); >+ return formatDate(date); >+ } >+ >+ protected String formatDate(java.util.Date date) { >+ return date.toString(); >+ } >+ >+ protected abstract java.util.Date getDate(ITask task); >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskCompletion extends Date { >+ @Override >+ protected java.util.Date getDate(ITask task) { >+ return task.getCompletionDate(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskCreation extends Date { >+ @Override >+ protected java.util.Date getDate(ITask task) { >+ return task.getCreationDate(); >+ } >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ public static class TaskReminder extends Date { >+ @Override >+ protected java.util.Date getDate(ITask task) { >+ return task.getReminderDate(); >+ } >+ } >+ } >+} >Index: src/org/eclipse/mylar/internal/team/template/TemplateHandlerContentProposalProvider.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/template/TemplateHandlerContentProposalProvider.java >diff -N src/org/eclipse/mylar/internal/team/template/TemplateHandlerContentProposalProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/template/TemplateHandlerContentProposalProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,132 @@ >+/*************************************************************************** >+ * Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany. >+ * 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: >+ * Eike Stepper - initial API and implementation >+ **************************************************************************/ >+package org.eclipse.mylar.internal.team.template; >+ >+import org.eclipse.jface.fieldassist.IContentProposal; >+import org.eclipse.jface.fieldassist.IContentProposalProvider; >+import org.eclipse.mylar.team.ITemplateHandlersManager; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+/** >+ * @author Eike Stepper >+ */ >+public class TemplateHandlerContentProposalProvider implements IContentProposalProvider { >+ public IContentProposal[] getProposals(String contents, int position) { >+ ProposalComputer proposalComputer = new ProposalComputer(contents, position); >+ return proposalComputer.computeProposals(); >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ protected static class ProposalComputer { >+ private String contents; >+ >+ private int position; >+ >+ private List<IContentProposal> result = new ArrayList<IContentProposal>(); >+ >+ private String[] keywords; >+ >+ private String prefix; >+ >+ public ProposalComputer(String contents, int position) { >+ this.contents = contents; >+ this.position = position; >+ initKeywords(); >+ initPrefix(); >+ } >+ >+ public IContentProposal[] computeProposals() { >+ for (String keyword : keywords) { >+ String proposal = getMatch(keyword); >+ if (proposal != null) { >+ addProposal(proposal, keyword); >+ } >+ } >+ >+ return result.toArray(new IContentProposal[result.size()]); >+ } >+ >+ protected ITemplateHandlersManager getTemplateHandlersManager() { >+ return ITemplateHandlersManager.INSTANCE; >+ } >+ >+ private void initKeywords() { >+ keywords = getTemplateHandlersManager().getRecognizedKeywords(); >+ } >+ >+ private void initPrefix() { >+ prefix = ""; >+ String beforePosition = contents.substring(0, position); >+ if (beforePosition.endsWith("$")) { >+ prefix = "$"; >+ } else { >+ int start = beforePosition.lastIndexOf("${"); >+ if (start >= 0) { >+ int end = contents.indexOf('}', start); >+ if (end >= position) { >+ prefix = contents.substring(start, position); >+ } >+ } >+ } >+ } >+ >+ private String getMatch(String keyword) { >+ String wholeProposal = "${" + keyword + "}"; >+ if (wholeProposal.startsWith(prefix)) { >+ return wholeProposal.substring(prefix.length()); >+ } >+ >+ return null; >+ } >+ >+ private void addProposal(String proposal, String keyword) { >+ String description = getTemplateHandlersManager().getHandlerDescription(keyword); >+ result.add(new Proposal(proposal, keyword, description)); >+ } >+ >+ /** >+ * @author Eike Stepper >+ */ >+ private static final class Proposal implements IContentProposal { >+ private final String proposal; >+ >+ private final String keyword; >+ >+ private final String description; >+ >+ private Proposal(String proposal, String keyword, String description) { >+ this.proposal = proposal; >+ this.keyword = keyword; >+ this.description = description; >+ } >+ >+ public String getContent() { >+ return proposal; >+ } >+ >+ public int getCursorPosition() { >+ return proposal.length(); >+ } >+ >+ public String getDescription() { >+ return description; >+ } >+ >+ public String getLabel() { >+ return "${" + keyword + "}"; >+ } >+ } >+ } >+} >Index: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExContentProposalProvider.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExContentProposalProvider.java >diff -N src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExContentProposalProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylar/internal/team/ui/preferences/workaround/RegExContentProposalProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,464 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylar.internal.team.ui.preferences.workaround; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.jface.fieldassist.IContentProposal; >+import org.eclipse.jface.fieldassist.IContentProposalProvider; >+ >+/** >+ * Content assist proposal provider for regular expressions. >+ * <p> >+ * Note: Replaces <code>RegExContentAssistProcessor</code> which was >+ * introduced in 3.0. >+ * </p> >+ * Copied from org.eclipse.ui.texteditor.RegExContentProposalProvider. >+ * <p> >+ * Needed by >+ * org.eclipse.mylar.internal.team.ui.preferences.workaround.MylarTeamPreferencePage. >+ * <p> >+ * TODO Ask platform guys to open this API >+ * >+ * @since 3.2 >+ */ >+public final class RegExContentProposalProvider implements IContentProposalProvider { >+ >+ /** >+ * Proposal computer. >+ */ >+ private static class ProposalComputer { >+ >+ private static class Proposal implements IContentProposal { >+ >+ private String fContent; >+ >+ private String fLabel; >+ >+ private String fDescription; >+ >+ private int fCursorPosition; >+ >+ Proposal(String content, String label, String description, int cursorPosition) { >+ fContent = content; >+ fLabel = label; >+ fDescription = description; >+ fCursorPosition = cursorPosition; >+ } >+ >+ public String getContent() { >+ return fContent; >+ } >+ >+ public String getLabel() { >+ return fLabel; >+ } >+ >+ public String getDescription() { >+ return fDescription; >+ } >+ >+ public int getCursorPosition() { >+ return fCursorPosition; >+ } >+ } >+ >+ /** >+ * The whole regular expression. >+ */ >+ private final String fExpression; >+ >+ /** >+ * The document offset. >+ */ >+ private final int fDocumentOffset; >+ >+ /** >+ * The high-priority proposals. >+ */ >+ private final ArrayList fPriorityProposals; >+ >+ /** >+ * The low-priority proposals. >+ */ >+ private final ArrayList fProposals; >+ >+ /** >+ * <code>true</code> iff <code>fExpression</code> ends with an open >+ * escape. >+ */ >+ private final boolean fIsEscape; >+ >+ /** >+ * Creates a new Proposal Computer. >+ * >+ * @param contents >+ * the contents of the subject control >+ * @param position >+ * the cursor position >+ */ >+ public ProposalComputer(String contents, int position) { >+ fExpression = contents; >+ fDocumentOffset = position; >+ fPriorityProposals = new ArrayList(); >+ fProposals = new ArrayList(); >+ >+ boolean isEscape = false; >+ esc: for (int i = position - 1; i >= 0; i--) { >+ if (fExpression.charAt(i) == '\\') >+ isEscape = !isEscape; >+ else >+ break esc; >+ } >+ fIsEscape = isEscape; >+ } >+ >+ /** >+ * Computes applicable proposals for the find field. >+ * >+ * @return the proposals >+ */ >+ public IContentProposal[] computeFindProposals() { >+ // characters >+ addBsProposal("\\\\", RegExMessages.displayString_bs_bs, RegExMessages.additionalInfo_bs_bs); //$NON-NLS-1$ >+ addBracketProposal("\\0", 2, RegExMessages.displayString_bs_0, RegExMessages.additionalInfo_bs_0); //$NON-NLS-1$ >+ addBracketProposal("\\x", 2, RegExMessages.displayString_bs_x, RegExMessages.additionalInfo_bs_x); //$NON-NLS-1$ >+ addBracketProposal("\\u", 2, RegExMessages.displayString_bs_u, RegExMessages.additionalInfo_bs_u); //$NON-NLS-1$ >+ addBsProposal("\\t", RegExMessages.displayString_bs_t, RegExMessages.additionalInfo_bs_t); //$NON-NLS-1$ >+ addBsProposal("\\n", RegExMessages.displayString_bs_n, RegExMessages.additionalInfo_bs_n); //$NON-NLS-1$ >+ addBsProposal("\\r", RegExMessages.displayString_bs_r, RegExMessages.additionalInfo_bs_r); //$NON-NLS-1$ >+ addBsProposal("\\f", RegExMessages.displayString_bs_f, RegExMessages.additionalInfo_bs_f); //$NON-NLS-1$ >+ addBsProposal("\\a", RegExMessages.displayString_bs_a, RegExMessages.additionalInfo_bs_a); //$NON-NLS-1$ >+ addBsProposal("\\e", RegExMessages.displayString_bs_e, RegExMessages.additionalInfo_bs_e); //$NON-NLS-1$ >+ addBsProposal("\\c", RegExMessages.displayString_bs_c, RegExMessages.additionalInfo_bs_c); //$NON-NLS-1$ >+ >+ if (!fIsEscape) >+ addBracketProposal(".", 1, RegExMessages.displayString_dot, RegExMessages.additionalInfo_dot); //$NON-NLS-1$ >+ addBsProposal("\\d", RegExMessages.displayString_bs_d, RegExMessages.additionalInfo_bs_d); //$NON-NLS-1$ >+ addBsProposal("\\D", RegExMessages.displayString_bs_D, RegExMessages.additionalInfo_bs_D); //$NON-NLS-1$ >+ addBsProposal("\\s", RegExMessages.displayString_bs_s, RegExMessages.additionalInfo_bs_s); //$NON-NLS-1$ >+ addBsProposal("\\S", RegExMessages.displayString_bs_S, RegExMessages.additionalInfo_bs_S); //$NON-NLS-1$ >+ addBsProposal("\\w", RegExMessages.displayString_bs_w, RegExMessages.additionalInfo_bs_w); //$NON-NLS-1$ >+ addBsProposal("\\W", RegExMessages.displayString_bs_W, RegExMessages.additionalInfo_bs_W); //$NON-NLS-1$ >+ >+ // back reference >+ addBsProposal("\\", RegExMessages.displayString_bs_i, RegExMessages.additionalInfo_bs_i); //$NON-NLS-1$ >+ >+ // quoting >+ addBsProposal("\\", RegExMessages.displayString_bs, RegExMessages.additionalInfo_bs); //$NON-NLS-1$ >+ addBsProposal("\\Q", RegExMessages.displayString_bs_Q, RegExMessages.additionalInfo_bs_Q); //$NON-NLS-1$ >+ addBsProposal("\\E", RegExMessages.displayString_bs_E, RegExMessages.additionalInfo_bs_E); //$NON-NLS-1$ >+ >+ // character sets >+ if (!fIsEscape) { >+ addBracketProposal("[]", 1, RegExMessages.displayString_set, RegExMessages.additionalInfo_set); //$NON-NLS-1$ >+ addBracketProposal("[^]", 2, RegExMessages.displayString_setExcl, RegExMessages.additionalInfo_setExcl); //$NON-NLS-1$ >+ addBracketProposal( >+ "[-]", 1, RegExMessages.displayString_setRange, RegExMessages.additionalInfo_setRange); //$NON-NLS-1$ >+ addProposal("&&", RegExMessages.displayString_setInter, RegExMessages.additionalInfo_setInter); //$NON-NLS-1$ >+ } >+ if (!fIsEscape && fDocumentOffset > 0 && fExpression.charAt(fDocumentOffset - 1) == '\\') { >+ addProposal("\\p{}", 3, RegExMessages.displayString_posix, RegExMessages.additionalInfo_posix); //$NON-NLS-1$ >+ addProposal("\\P{}", 3, RegExMessages.displayString_posixNot, RegExMessages.additionalInfo_posixNot); //$NON-NLS-1$ >+ } else { >+ addBracketProposal("\\p{}", 3, RegExMessages.displayString_posix, RegExMessages.additionalInfo_posix); //$NON-NLS-1$ >+ addBracketProposal( >+ "\\P{}", 3, RegExMessages.displayString_posixNot, RegExMessages.additionalInfo_posixNot); //$NON-NLS-1$ >+ } >+ >+ // addBsProposal("\\p{Lower}", >+ // RegExMessages.displayString_bs_p{Lower}, >+ // RegExMessages.additionalInfo_bs_p{Lower}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Upper}", >+ // RegExMessages.displayString_bs_p{Upper}, >+ // RegExMessages.additionalInfo_bs_p{Upper}); //$NON-NLS-1$ >+ // addBsProposal("\\p{ASCII}", >+ // RegExMessages.displayString_bs_p{ASCII}, >+ // RegExMessages.additionalInfo_bs_p{ASCII}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Alpha}", >+ // RegExMessages.displayString_bs_p{Alpha}, >+ // RegExMessages.additionalInfo_bs_p{Alpha}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Digit}", >+ // RegExMessages.displayString_bs_p{Digit}, >+ // RegExMessages.additionalInfo_bs_p{Digit}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Alnum}", >+ // RegExMessages.displayString_bs_p{Alnum}, >+ // RegExMessages.additionalInfo_bs_p{Alnum}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Punct}", >+ // RegExMessages.displayString_bs_p{Punct}, >+ // RegExMessages.additionalInfo_bs_p{Punct}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Graph}", >+ // RegExMessages.displayString_bs_p{Graph}, >+ // RegExMessages.additionalInfo_bs_p{Graph}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Print}", >+ // RegExMessages.displayString_bs_p{Print}, >+ // RegExMessages.additionalInfo_bs_p{Print}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Blank}", >+ // RegExMessages.displayString_bs_p{Blank}, >+ // RegExMessages.additionalInfo_bs_p{Blank}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Cntrl}", >+ // RegExMessages.displayString_bs_p{Cntrl}, >+ // RegExMessages.additionalInfo_bs_p{Cntrl}); //$NON-NLS-1$ >+ // addBsProposal("\\p{XDigit}", >+ // RegExMessages.displayString_bs_p{XDigit}, >+ // RegExMessages.additionalInfo_bs_p{XDigit}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Space}", >+ // RegExMessages.displayString_bs_p{Space}, >+ // RegExMessages.additionalInfo_bs_p{Space}); //$NON-NLS-1$ >+ // >+ // addBsProposal("\\p{InGreek}", >+ // RegExMessages.displayString_bs_p{InGreek}, >+ // RegExMessages.additionalInfo_bs_p{InGreek}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Lu}", RegExMessages.displayString_bs_p{Lu}, >+ // RegExMessages.additionalInfo_bs_p{Lu}); //$NON-NLS-1$ >+ // addBsProposal("\\p{Sc}", RegExMessages.displayString_bs_p{Sc}, >+ // RegExMessages.additionalInfo_bs_p{Sc}); //$NON-NLS-1$ >+ // addBsProposal("\\P{InGreek}", >+ // RegExMessages.displayString_bs_P{InGreek}, >+ // RegExMessages.additionalInfo_bs_P{InGreek}); //$NON-NLS-1$ >+ >+ // boundary matchers >+ if (fDocumentOffset == 0) { >+ addPriorityProposal("^", RegExMessages.displayString_start, RegExMessages.additionalInfo_start); //$NON-NLS-1$ >+ } else if (fDocumentOffset == 1 && fExpression.charAt(0) == '^') { >+ addBracketProposal("^", 1, RegExMessages.displayString_start, RegExMessages.additionalInfo_start); //$NON-NLS-1$ >+ } >+ if (fDocumentOffset == fExpression.length()) { >+ addProposal("$", RegExMessages.displayString_end, RegExMessages.additionalInfo_end); //$NON-NLS-1$ >+ } >+ addBsProposal("\\b", RegExMessages.displayString_bs_b, RegExMessages.additionalInfo_bs_b); //$NON-NLS-1$ >+ addBsProposal("\\B", RegExMessages.displayString_bs_B, RegExMessages.additionalInfo_bs_B); //$NON-NLS-1$ >+ addBsProposal("\\A", RegExMessages.displayString_bs_A, RegExMessages.additionalInfo_bs_A); //$NON-NLS-1$ >+ addBsProposal("\\G", RegExMessages.displayString_bs_G, RegExMessages.additionalInfo_bs_G); //$NON-NLS-1$ >+ addBsProposal("\\Z", RegExMessages.displayString_bs_Z, RegExMessages.additionalInfo_bs_Z); //$NON-NLS-1$ >+ addBsProposal("\\z", RegExMessages.displayString_bs_z, RegExMessages.additionalInfo_bs_z); //$NON-NLS-1$ >+ >+ if (!fIsEscape) { >+ // capturing groups >+ addBracketProposal("()", 1, RegExMessages.displayString_group, RegExMessages.additionalInfo_group); //$NON-NLS-1$ >+ >+ // flags >+ addBracketProposal("(?)", 2, RegExMessages.displayString_flag, RegExMessages.additionalInfo_flag); //$NON-NLS-1$ >+ addBracketProposal( >+ "(?:)", 3, RegExMessages.displayString_flagExpr, RegExMessages.additionalInfo_flagExpr); //$NON-NLS-1$ >+ >+ // non-capturing group >+ addBracketProposal("(?:)", 3, RegExMessages.displayString_nonCap, RegExMessages.additionalInfo_nonCap); //$NON-NLS-1$ >+ addBracketProposal( >+ "(?>)", 3, RegExMessages.displayString_atomicCap, RegExMessages.additionalInfo_atomicCap); //$NON-NLS-1$ >+ >+ // lookaraound >+ addBracketProposal( >+ "(?=)", 3, RegExMessages.displayString_posLookahead, RegExMessages.additionalInfo_posLookahead); //$NON-NLS-1$ >+ addBracketProposal( >+ "(?!)", 3, RegExMessages.displayString_negLookahead, RegExMessages.additionalInfo_negLookahead); //$NON-NLS-1$ >+ addBracketProposal( >+ "(?<=)", 4, RegExMessages.displayString_posLookbehind, RegExMessages.additionalInfo_posLookbehind); //$NON-NLS-1$ >+ addBracketProposal( >+ "(?<!)", 4, RegExMessages.displayString_negLookbehind, RegExMessages.additionalInfo_negLookbehind); //$NON-NLS-1$ >+ >+ // greedy quantifiers >+ addBracketProposal("?", 1, RegExMessages.displayString_quest, RegExMessages.additionalInfo_quest); //$NON-NLS-1$ >+ addBracketProposal("*", 1, RegExMessages.displayString_star, RegExMessages.additionalInfo_star); //$NON-NLS-1$ >+ addBracketProposal("+", 1, RegExMessages.displayString_plus, RegExMessages.additionalInfo_plus); //$NON-NLS-1$ >+ addBracketProposal("{}", 1, RegExMessages.displayString_exact, RegExMessages.additionalInfo_exact); //$NON-NLS-1$ >+ addBracketProposal("{,}", 1, RegExMessages.displayString_least, RegExMessages.additionalInfo_least); //$NON-NLS-1$ >+ addBracketProposal("{,}", 1, RegExMessages.displayString_count, RegExMessages.additionalInfo_count); //$NON-NLS-1$ >+ >+ // lazy quantifiers >+ addBracketProposal( >+ "??", 1, RegExMessages.displayString_questLazy, RegExMessages.additionalInfo_questLazy); //$NON-NLS-1$ >+ addBracketProposal("*?", 1, RegExMessages.displayString_starLazy, RegExMessages.additionalInfo_starLazy); //$NON-NLS-1$ >+ addBracketProposal("+?", 1, RegExMessages.displayString_plusLazy, RegExMessages.additionalInfo_plusLazy); //$NON-NLS-1$ >+ addBracketProposal( >+ "{}?", 1, RegExMessages.displayString_exactLazy, RegExMessages.additionalInfo_exactLazy); //$NON-NLS-1$ >+ addBracketProposal( >+ "{,}?", 1, RegExMessages.displayString_leastLazy, RegExMessages.additionalInfo_leastLazy); //$NON-NLS-1$ >+ addBracketProposal( >+ "{,}?", 1, RegExMessages.displayString_countLazy, RegExMessages.additionalInfo_countLazy); //$NON-NLS-1$ >+ >+ // possessive quantifiers >+ addBracketProposal( >+ "?+", 1, RegExMessages.displayString_questPoss, RegExMessages.additionalInfo_questPoss); //$NON-NLS-1$ >+ addBracketProposal("*+", 1, RegExMessages.displayString_starPoss, RegExMessages.additionalInfo_starPoss); //$NON-NLS-1$ >+ addBracketProposal("++", 1, RegExMessages.displayString_plusPoss, RegExMessages.additionalInfo_plusPoss); //$NON-NLS-1$ >+ addBracketProposal( >+ "{}+", 1, RegExMessages.displayString_exactPoss, RegExMessages.additionalInfo_exactPoss); //$NON-NLS-1$ >+ addBracketProposal( >+ "{,}+", 1, RegExMessages.displayString_leastPoss, RegExMessages.additionalInfo_leastPoss); //$NON-NLS-1$ >+ addBracketProposal( >+ "{,}+", 1, RegExMessages.displayString_countPoss, RegExMessages.additionalInfo_countPoss); //$NON-NLS-1$ >+ >+ // alternative >+ addBracketProposal("|", 1, RegExMessages.displayString_alt, RegExMessages.additionalInfo_alt); //$NON-NLS-1$ >+ } >+ >+ fPriorityProposals.addAll(fProposals); >+ return (IContentProposal[]) fPriorityProposals.toArray(new IContentProposal[fProposals.size()]); >+ } >+ >+ /** >+ * Computes applicable proposals for the replace field. >+ * >+ * @return the proposals >+ */ >+ public IContentProposal[] computeReplaceProposals() { >+ if (fDocumentOffset > 0 && '$' == fExpression.charAt(fDocumentOffset - 1)) { >+ addProposal("", RegExMessages.displayString_dollar, RegExMessages.additionalInfo_dollar); //$NON-NLS-1$ >+ } else { >+ addProposal("$", RegExMessages.displayString_dollar, RegExMessages.additionalInfo_dollar); //$NON-NLS-1$ >+ addBsProposal("\\", RegExMessages.displayString_replace_bs, RegExMessages.additionalInfo_replace_bs); //$NON-NLS-1$ >+ addProposal("\t", RegExMessages.displayString_tab, RegExMessages.additionalInfo_tab); //$NON-NLS-1$ >+ } >+ return (IContentProposal[]) fProposals.toArray(new IContentProposal[fProposals.size()]); >+ } >+ >+ /** >+ * Adds a proposal. >+ * >+ * @param proposal >+ * the string to be inserted >+ * @param displayString >+ * the proposal's label >+ * @param additionalInfo >+ * the additional information >+ */ >+ private void addProposal(String proposal, String displayString, String additionalInfo) { >+ fProposals.add(new Proposal(proposal, displayString, additionalInfo, proposal.length())); >+ } >+ >+ /** >+ * Adds a proposal. >+ * >+ * @param proposal >+ * the string to be inserted >+ * @param cursorPosition >+ * the cursor position after insertion, relative to the start >+ * of the proposal >+ * @param displayString >+ * the proposal's label >+ * @param additionalInfo >+ * the additional information >+ */ >+ private void addProposal(String proposal, int cursorPosition, String displayString, String additionalInfo) { >+ fProposals.add(new Proposal(proposal, displayString, additionalInfo, cursorPosition)); >+ } >+ >+ /** >+ * Adds a proposal to the priority proposals list. >+ * >+ * @param proposal >+ * the string to be inserted >+ * @param displayString >+ * the proposal's label >+ * @param additionalInfo >+ * the additional information >+ */ >+ private void addPriorityProposal(String proposal, String displayString, String additionalInfo) { >+ fPriorityProposals.add(new Proposal(proposal, displayString, additionalInfo, proposal.length())); >+ } >+ >+ /** >+ * Adds a proposal. Ensures that existing pre- and postfixes are not >+ * duplicated. >+ * >+ * @param proposal >+ * the string to be inserted >+ * @param cursorPosition >+ * the cursor position after insertion, relative to the start >+ * of the proposal >+ * @param displayString >+ * the proposal's label >+ * @param additionalInfo >+ * the additional information >+ */ >+ private void addBracketProposal(String proposal, int cursorPosition, String displayString, String additionalInfo) { >+ String prolog = fExpression.substring(0, fDocumentOffset); >+ if (!fIsEscape && prolog.endsWith("\\") && proposal.startsWith("\\")) { //$NON-NLS-1$//$NON-NLS-2$ >+ fProposals.add(new Proposal(proposal, displayString, additionalInfo, cursorPosition)); >+ return; >+ } >+ for (int i = 1; i <= cursorPosition; i++) { >+ String prefix = proposal.substring(0, i); >+ if (prolog.endsWith(prefix)) { >+ String postfix = proposal.substring(cursorPosition); >+ String epilog = fExpression.substring(fDocumentOffset); >+ if (epilog.startsWith(postfix)) { >+ fPriorityProposals.add(new Proposal(proposal.substring(i, cursorPosition), displayString, >+ additionalInfo, cursorPosition - i)); >+ } else { >+ fPriorityProposals.add(new Proposal(proposal.substring(i), displayString, additionalInfo, >+ cursorPosition - i)); >+ } >+ return; >+ } >+ } >+ fProposals.add(new Proposal(proposal, displayString, additionalInfo, cursorPosition)); >+ } >+ >+ /** >+ * Adds a proposal that starts with a backslash. Ensures that the >+ * backslash is not repeated if already typed. >+ * >+ * @param proposal >+ * the string to be inserted >+ * @param displayString >+ * the proposal's label >+ * @param additionalInfo >+ * the additional information >+ */ >+ private void addBsProposal(String proposal, String displayString, String additionalInfo) { >+ String prolog = fExpression.substring(0, fDocumentOffset); >+ int position = proposal.length(); >+ // If the string already contains the backslash, do not include in >+ // the proposal >+ if (prolog.endsWith("\\")) { //$NON-NLS-1$ >+ position--; >+ proposal = proposal.substring(1); >+ } >+ >+ if (fIsEscape) { >+ fPriorityProposals.add(new Proposal(proposal, displayString, additionalInfo, position)); >+ } else { >+ addProposal(proposal, position, displayString, additionalInfo); >+ } >+ } >+ } >+ >+ /** >+ * <code>true</code> iff the processor is for the find field. >+ * <code>false</code> iff the processor is for the replace field. >+ */ >+ private final boolean fIsFind; >+ >+ /** >+ * Creates a new completion proposal provider. >+ * >+ * @param isFind >+ * <code>true</code> if the provider is used for the 'find' >+ * field <code>false</code> if the provider is used for the >+ * 'reaplce' field >+ */ >+ public RegExContentProposalProvider(boolean isFind) { >+ fIsFind = isFind; >+ } >+ >+ /* >+ * @see org.eclipse.jface.fieldassist.IContentProposalProvider#getProposals(java.lang.String, >+ * int) >+ */ >+ public IContentProposal[] getProposals(String contents, int position) { >+ if (fIsFind) >+ return new ProposalComputer(contents, position).computeFindProposals(); >+ return new ProposalComputer(contents, position).computeReplaceProposals(); >+ } >+}
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 117517
:
49080
|
49343
|
49344
|
49347
|
49369
|
49380
| 50234 |
52014
|
52413