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 54696 Details for
Bug 165581
Improve Open Correspond Task action
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]
Second iteration
aaa2.patch (text/plain), 49.41 KB, created by
Eugene Kuleshov
on 2006-11-29 06:06:14 EST
(
hide
)
Description:
Second iteration
Filename:
MIME Type:
Creator:
Eugene Kuleshov
Created:
2006-11-29 06:06:14 EST
Size:
49.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylar.jira.ui >Index: src/org/eclipse/mylar/internal/jira/core/JiraRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.jira.ui/src/org/eclipse/mylar/internal/jira/core/JiraRepositoryConnector.java,v >retrieving revision 1.8 >diff -u -r1.8 JiraRepositoryConnector.java >--- src/org/eclipse/mylar/internal/jira/core/JiraRepositoryConnector.java 29 Nov 2006 01:11:09 -0000 1.8 >+++ src/org/eclipse/mylar/internal/jira/core/JiraRepositoryConnector.java 29 Nov 2006 10:55:44 -0000 >@@ -13,7 +13,10 @@ > > import java.net.UnknownHostException; > import java.util.ArrayList; >+import java.util.HashSet; > import java.util.List; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; > > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >@@ -37,6 +40,7 @@ > import org.tigris.jira.core.model.Issue; > import org.tigris.jira.core.model.IssueType; > import org.tigris.jira.core.model.Priority; >+import org.tigris.jira.core.model.Project; > import org.tigris.jira.core.model.Version; > import org.tigris.jira.core.service.JiraServer; > >@@ -213,6 +217,32 @@ > public String getTaskWebUrl(String repositoryUrl, String taskId) { > return repositoryUrl + DELIM_URL + taskId; > } >+ >+ @Override >+ public String[] getTaskIdsFromComment(TaskRepository repository, String comment) { >+ JiraServer server = JiraServerFacade.getDefault().getJiraServer(repository); >+ if (server != null) { >+ // (?:(MNGECLIPSE-\d+?)|(SPR-\d+?))\D >+ StringBuffer sb = new StringBuffer("("); >+ String sep = ""; >+ for (Project project : server.getProjects()) { >+ sb.append(sep).append("(?:"+project.getKey()+"\\-\\d+?)"); >+ sep = "|"; >+ } >+ sb.append(")\\D"); >+ >+ Pattern p = Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE | Pattern.DOTALL | Pattern.MULTILINE); >+ Matcher m = p.matcher(comment); >+ HashSet<String> ids = new HashSet<String>(); >+ while(m.find()) { >+ ids.add(m.group(1)); >+ } >+ return ids.toArray(new String[ids.size()]); >+ } >+ >+ return super.getTaskIdsFromComment(repository, comment); >+ } >+ > > public static void updateTaskDetails(String repositoryUrl, JiraTask task, Issue issue, boolean notifyOfChange) { > if (issue.getKey() != null) { >#P org.eclipse.mylar.sandbox >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/sandbox/org.eclipse.mylar.sandbox/META-INF/MANIFEST.MF,v >retrieving revision 1.72 >diff -u -r1.72 MANIFEST.MF >--- META-INF/MANIFEST.MF 29 Nov 2006 01:09:34 -0000 1.72 >+++ META-INF/MANIFEST.MF 29 Nov 2006 10:55:44 -0000 >@@ -22,12 +22,7 @@ > org.eclipse.core.resources, > org.eclipse.search, > org.eclipse.mylar.monitor.reports, >- org.eclipse.mylar.monitor.usage, >- org.eclipse.mylar.team, >- org.eclipse.team.core, >- org.eclipse.team.ui, >- org.tigris.subversion.subclipse.core, >- org.eclipse.compare >+ org.eclipse.mylar.monitor.usage > Eclipse-AutoStart: true > Bundle-Vendor: Eclipse.org > Export-Package: org.eclipse.mylar.internal.sandbox, >Index: src/org/eclipse/mylar/internal/sandbox/team/SubclipseLinkedTaskInfoWrapper.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/sandbox/team/SubclipseLinkedTaskInfoWrapper.java >diff -N src/org/eclipse/mylar/internal/sandbox/team/SubclipseLinkedTaskInfoWrapper.java >--- src/org/eclipse/mylar/internal/sandbox/team/SubclipseLinkedTaskInfoWrapper.java 29 Nov 2006 01:09:34 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,105 +0,0 @@ >-///******************************************************************************* >-// * Copyright (c) 2004 - 2006 Mylar committers and others. >-// * All rights reserved. This program and the accompanying materials >-// * are made available under the terms of the Eclipse Public License v1.0 >-// * which accompanies this distribution, and is available at >-// * http://www.eclipse.org/legal/epl-v10.html >-// *******************************************************************************/ >-// >-//package org.eclipse.mylar.internal.sandbox.team; >-// >-//import org.eclipse.core.resources.IResource; >-//import org.eclipse.core.runtime.IAdapterFactory; >-//import org.eclipse.core.runtime.IAdapterManager; >-//import org.eclipse.mylar.internal.team.ILinkedTaskInfo; >-//import org.eclipse.mylar.internal.team.LinkedTaskInfo; >-//import org.eclipse.mylar.tasks.core.TaskRepository; >-//import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >-//import org.eclipse.team.core.TeamException; >-//import org.eclipse.team.internal.core.subscribers.ChangeSet; >-//import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode; >-//import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement; >-//import org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement; >-//import org.tigris.subversion.subclipse.core.ISVNRemoteResource; >-//import org.tigris.subversion.subclipse.core.sync.SVNStatusSyncInfo; >-// >-///** >-// * Wrapper class used to isolate Subclibse dependencies >-// * >-// * @author Eugene Kuleshov >-// */ >-//public class SubclipseLinkedTaskInfoWrapper { >-// >-// public static void init(IAdapterManager adapterManager, IAdapterFactory factory) { >-// // XXX put back >-// Class logEntryClass = org.tigris.subversion.subclipse.core.history.LogEntry.class; >-// adapterManager.registerAdapters(FACTORY, logEntryClass); >-// } >-// >-// private static ILinkedTaskInfo adaptSubclipseChangeset(ChangeSetDiffNode diff, ChangeSet set) { >-// SynchronizeModelElement diffContainer = (SynchronizeModelElement) diff.getChildren()[0]; >-// >-// IResource res = diffContainer.getResource(); >-// >-// SyncInfoModelElement melement = (SyncInfoModelElement) diffContainer.getChildren()[0]; >-// >-// // Specific to Subclipse >-// SVNStatusSyncInfo info = (SVNStatusSyncInfo) melement.getSyncInfo(); >-// >-// ISVNRemoteResource remoteResource = (ISVNRemoteResource) info.getRemote(); >-// SVNRevision rev = remoteResource.getLastChangedRevision(); >-// >-// String comment; >-// try { >-// ISVNLogMessage[] messages = remoteResource.getLogMessages(rev, rev, SVNRevision.START, false, false, 1); >-// comment = messages[0].getMessage(); >-// } catch (TeamException ex) { >-// comment = diff.getSet().getComment(); >-// } >-// return adaptFromComment(diff, res, comment); >-// } >-// >-// private static ILinkedTaskInfo adaptSubclipseLogEntry(Object object) { >-// org.tigris.subversion.subclipse.core.history.LogEntry logEntry = >-// (org.tigris.subversion.subclipse.core.history.LogEntry) object; >-// >-// String comment = logEntry.getComment(); >-// IResource res = logEntry.getResource().getResource(); >-// >-// return adaptFromComment(object, res, comment); >-// } >-// >-// private static ILinkedTaskInfo adaptFromComment(Object object, IResource res, String comment) { >-// ProjectProperties props = null; >-// try { >-// props = ProjectProperties.getProjectProperties(res); >-// } catch (TeamException ex) { >-// // ignore? >-// } >-// >-// String[] urls = null; >-// String repositoryUrl = null; >-// if(props!=null) { >-// repositoryUrl = getRepositoryUrl(props.getUrl()); >-// urls = props.getLinkList(comment).getUrls(); >-// } >-// if (urls == null || urls.length == 0) { >-// // we can do better job then this method >-// urls = ProjectProperties.getUrls(comment).getUrls(); >-// } >-// if (urls != null && urls.length > 0) { >-// return new LinkedTaskInfo(repositoryUrl, null, urls[0]); >-// } >-// return null; >-// } >-// >-// private static String getRepositoryUrl(String url) { >-// for (TaskRepository repository : TasksUiPlugin.getRepositoryManager().getAllRepositories()) { >-// if(url.startsWith(repository.getUrl())) { >-// return repository.getUrl(); >-// } >-// } >-// return null; >-// } >-// >-//} >\ No newline at end of file >#P org.eclipse.mylar.tasks.core >Index: src/org/eclipse/mylar/tasks/core/AbstractRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.tasks.core/src/org/eclipse/mylar/tasks/core/AbstractRepositoryConnector.java,v >retrieving revision 1.17 >diff -u -r1.17 AbstractRepositoryConnector.java >--- src/org/eclipse/mylar/tasks/core/AbstractRepositoryConnector.java 29 Nov 2006 01:11:31 -0000 1.17 >+++ src/org/eclipse/mylar/tasks/core/AbstractRepositoryConnector.java 29 Nov 2006 10:55:45 -0000 >@@ -63,6 +63,10 @@ > > public abstract String getTaskWebUrl(String repositoryUrl, String taskId); > >+ public String[] getTaskIdsFromComment(TaskRepository repository, String comment) { >+ return null; >+ } >+ > public abstract boolean canCreateTaskFromKey(TaskRepository repository); > > public abstract boolean canCreateNewTask(TaskRepository repository); >#P org.eclipse.mylar.team >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.12 >diff -u -r1.12 OpenCorrespondingTaskAction.java >--- src/org/eclipse/mylar/internal/team/ui/actions/OpenCorrespondingTaskAction.java 27 Nov 2006 20:23:11 -0000 1.12 >+++ src/org/eclipse/mylar/internal/team/ui/actions/OpenCorrespondingTaskAction.java 29 Nov 2006 10:55:46 -0000 >@@ -11,52 +11,46 @@ > > package org.eclipse.mylar.internal.team.ui.actions; > >-import org.eclipse.compare.structuremergeviewer.IDiffElement; >-import org.eclipse.core.resources.IProject; >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.resources.IWorkspaceRoot; >-import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.IAdaptable; >-import org.eclipse.core.runtime.Path; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.jface.action.Action; > import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.mylar.internal.tasks.ui.TaskListImages; > import org.eclipse.mylar.internal.tasks.ui.TasksUiUtil; >-import org.eclipse.mylar.internal.team.ContextChangeSet; >+import org.eclipse.mylar.internal.team.ILinkedTaskInfo; >+import org.eclipse.mylar.internal.team.LinkedTaskInfo; >+import org.eclipse.mylar.internal.team.template.CommitTemplateManager; > import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; > import org.eclipse.mylar.tasks.core.ITask; > import org.eclipse.mylar.tasks.core.TaskRepository; >-import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi; >+import org.eclipse.mylar.tasks.core.TaskRepositoryManager; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > import org.eclipse.mylar.team.MylarTeamPlugin; >-import org.eclipse.team.core.history.IFileRevision; >-import org.eclipse.team.core.variants.IResourceVariant; >-import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry; >-import org.eclipse.team.internal.ccvs.core.mapping.CVSCheckedInChangeSet; >-import org.eclipse.team.internal.ccvs.core.resources.RemoteResource; >-import org.eclipse.team.internal.core.subscribers.DiffChangeSet; >-import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode; >-import org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement; > import org.eclipse.ui.IViewActionDelegate; > import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.PlatformUI; > import org.eclipse.ui.internal.ObjectPluginAction; > > /** >+ * Action used to open linked task >+ * > * @author Mik Kersten >+ * @author Eugene Kuleshov > */ > public class OpenCorrespondingTaskAction extends Action implements IViewActionDelegate { > > private static final String LABEL = "Open Corresponding Task"; > >- private ISelection selection; >- > private static final String PREFIX_HTTP = "http://"; > > private static final String PREFIX_HTTPS = "https://"; > >+ private ISelection selection; >+ > public OpenCorrespondingTaskAction() { > setText(LABEL); > setToolTipText(LABEL); >@@ -86,121 +80,130 @@ > > private void run(StructuredSelection selection) { > Object element = selection.getFirstElement(); >- boolean opened = false; > >- if (element instanceof ChangeSetDiffNode) { >- ChangeSetDiffNode diffNode = (ChangeSetDiffNode) element; >- if (diffNode.getSet() instanceof ContextChangeSet) { >- ITask task = ((ContextChangeSet) diffNode.getSet()).getTask(); >- TasksUiUtil.openEditor(task, false); >- opened = true; >- } >- } else if (element instanceof ContextChangeSet) { >- ITask task = ((ContextChangeSet) element).getTask(); >- if (task != null) { >- TasksUiUtil.openEditor(task, false); >- opened = true; >- } >+ ILinkedTaskInfo info = null; >+ if (element instanceof ILinkedTaskInfo) { >+ info = (ILinkedTaskInfo) element; >+ } else if (element instanceof IAdaptable) { >+ info = (ILinkedTaskInfo) ((IAdaptable) element).getAdapter(ILinkedTaskInfo.class); >+ } >+ if (info == null) { >+ info = (ILinkedTaskInfo) Platform.getAdapterManager().getAdapter(element, ILinkedTaskInfo.class); > } > >- if (!opened) { >- IProject project = findCorrespondingProject(element); >- String comment = getCommentFromSelection(element); >- >- if (comment != null) { >- String id = MylarTeamPlugin.getDefault().getCommitTemplateManager() >- .getTaskIdFromCommentOrLabel(comment); >- if (id == null) { >- id = getTaskIdFromLegacy07Label(comment); >- } >- >- if (project != null) { >- TaskRepository repository = TasksUiPlugin.getDefault().getRepositoryForResource(project, false); >- if (repository != null) { >- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getRepositoryUi(repository.getKind()); >- if (connectorUi != null && id != null) { >- opened = TasksUiUtil.openRepositoryTask(repository, id); >- } >+ if (info != null) { >+ info = reconsile(info); >+ if (info.getTask() != null) { >+ // XXX which one to use? >+ // TaskUiUtil.openEditor(info.getTask(), false); >+ TasksUiUtil.refreshAndOpenTaskListElement(info.getTask()); >+ return; >+ } >+ if (info.getRepositoryUrl() != null && info.getTaskId() != null) { >+ TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(info.getRepositoryUrl()); >+ if (repository != null) { >+ if (TasksUiUtil.openRepositoryTask(repository, info.getTaskId())) { >+ return; > } > } >+ } >+ if (info.getTaskFullUrl() != null) { >+ TasksUiUtil.openUrl(info.getTaskFullUrl()); >+ return; >+ } >+ } > >- // try opening via URL if present >- if (!opened) { >- String fullUrl = getUrlFromComment(comment); >- >- String repositoryUrl = null; >- if (fullUrl != null) { >- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() >- .getConnectorForRepositoryTaskUrl(fullUrl); >- if (connector != null) { >- repositoryUrl = connector.getRepositoryUrlFromTaskUrl(fullUrl); >- } >- } else { >- ITask task = TasksUiPlugin.getTaskListManager().getTaskList().getActiveTask(); >- if (task instanceof AbstractRepositoryTask) { >- repositoryUrl = ((AbstractRepositoryTask) task).getRepositoryUrl(); >- } else if (TasksUiPlugin.getRepositoryManager().getAllRepositories().size() == 1) { >- repositoryUrl = TasksUiPlugin.getRepositoryManager().getAllRepositories().get(0).getUrl(); >- } >- } >+ // TODO show Open Remote Task dialog? >+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), >+ "Unable to open correspond task", "Unable to open correspond task"); >+ } > >- opened = TasksUiUtil.openRepositoryTask(repositoryUrl, id, fullUrl); >- if (!opened) { >- TasksUiUtil.openUrl(fullUrl); >- } >- } >+ public void selectionChanged(IAction action, ISelection selection) { >+ this.selection = selection; >+ } >+ >+ /** >+ * Reconcile <code>ILinkedTaskInfo</code> data. >+ * >+ * This is used in order to keep LinkedTaskInfo lightweight with minimal >+ * dependencies. >+ */ >+ private ILinkedTaskInfo reconsile(ILinkedTaskInfo info) { >+ ITask task = info.getTask(); >+ if (task != null) { >+ return info; >+ } >+ >+ String repositoryUrl = info.getRepositoryUrl(); >+ String taskId = info.getTaskId(); >+ String taskFullUrl = info.getTaskFullUrl(); >+ String comment = info.getComment(); >+ >+ TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager(); >+ >+ TaskRepository repository = null; >+ if(repositoryUrl!=null) { >+ repository = repositoryManager.getRepository(repositoryUrl); >+ } >+ >+ AbstractRepositoryConnector connector = null; >+ if(taskFullUrl!=null) { >+ connector = repositoryManager.getConnectorForRepositoryTaskUrl(taskFullUrl); >+ } >+ if (connector == null && repository!=null) { >+ connector = repositoryManager.getRepositoryConnector(repository.getKind()); >+ } >+ >+ if (repositoryUrl == null && connector != null) { >+ repositoryUrl = connector.getRepositoryUrlFromTaskUrl(taskFullUrl); >+ } >+ >+ if (taskId == null && connector != null) { >+ taskId = connector.getTaskIdFromTaskUrl(taskFullUrl); >+ } >+ if (taskId == null && repository != null && comment != null) { >+ String[] ids = connector.getTaskIdsFromComment(repository, comment); >+ if (ids != null && ids.length > 0) { >+ taskId = ids[0]; >+ } >+ } >+ if (taskId == null && comment!=null) { >+ CommitTemplateManager commitTemplateManager = MylarTeamPlugin.getDefault().getCommitTemplateManager(); >+ taskId = commitTemplateManager.getTaskIdFromCommentOrLabel(comment); >+ if (taskId == null) { >+ taskId = getTaskIdFromLegacy07Label(comment); > } > } >- } > >- private String getCommentFromSelection(Object element) { >- if (element instanceof DiffChangeSet) { >- return ((CVSCheckedInChangeSet) element).getComment(); >- } else if (element instanceof ChangeSetDiffNode) { >- return ((ChangeSetDiffNode) element).getName(); >- } else if (element instanceof LogEntry) { >- return ((LogEntry) element).getComment(); >- } else if (element instanceof IFileRevision) { >- return ((IFileRevision) element).getComment(); >+ if (taskFullUrl == null && repositoryUrl != null && taskId != null && connector != null) { >+ taskFullUrl = connector.getTaskWebUrl(repositoryUrl, taskId); > } >- return null; >- } > >- private IProject findCorrespondingProject(Object element) { >- if (element instanceof DiffChangeSet) { >- IResource[] resources = ((DiffChangeSet) element).getResources(); >- if (resources.length > 0) { >- // TODO: only checks first resource >- return resources[0].getProject(); >- } >- } else if (element instanceof SynchronizeModelElement) { >- SynchronizeModelElement modelElement = (SynchronizeModelElement)element; >- IResource resource = modelElement.getResource(); >- if (resource != null) { >- return resource.getProject(); >- } else { >- IDiffElement[] elements = modelElement.getChildren(); >- if (elements.length > 0) { >- // TODO: only checks first diff >- if (elements[0] instanceof SynchronizeModelElement) { >- return ((SynchronizeModelElement)elements[0]).getResource().getProject(); >- } >+ if (task == null) { >+ if (taskId != null && repositoryUrl != null) { >+ // XXX fix this hack (jira ids don't work here) >+ if(!taskId.contains(AbstractRepositoryTask.HANDLE_DELIM)) { >+ String handle = AbstractRepositoryTask.getHandle(repositoryUrl, taskId); >+ task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(handle); > } > } >- } else if (element instanceof IAdaptable) { >- // TODO: there must be a better way to get at the local resource >- IResourceVariant resourceVariant = (IResourceVariant) ((IAdaptable) element) >- .getAdapter(IResourceVariant.class); >- if (resourceVariant != null && resourceVariant instanceof RemoteResource) { >- RemoteResource remoteResource = (RemoteResource) resourceVariant; >- String path = remoteResource.getRepositoryRelativePath(); >- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >- return root.getProject(new Path(path).removeFirstSegments(1).uptoSegment(1).toString()); >+ if (task == null && taskFullUrl != null) { >+ // search by fullUrl >+ for (ITask currTask : TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks()) { >+ if (currTask instanceof AbstractRepositoryTask) { >+ String currUrl = ((AbstractRepositoryTask) currTask).getUrl(); >+ if (taskFullUrl.equals(currUrl)) { >+ return new LinkedTaskInfo(currTask); >+ } >+ } >+ } > } >- } else { >- > } >- return null; >+ if (task != null) { >+ return new LinkedTaskInfo(task); >+ } >+ >+ return new LinkedTaskInfo(repositoryUrl, taskId, taskFullUrl, comment); > } > > public static String getUrlFromComment(String comment) { >@@ -247,20 +250,5 @@ > } > return null; > } >- >- >-// private Object findParent(ISynchronizeModelElement element) { >-// if (element instanceof ChangeSetDiffNode) { >-// return element; >-// } else if (element.getParent() instanceof ISynchronizeModelElement) { >-// return findParent((ISynchronizeModelElement) element.getParent()); >-// } >-// return null; >-// } >- >- >- public void selectionChanged(IAction action, ISelection selection) { >- this.selection = selection; >- } > > } >Index: src/org/eclipse/mylar/internal/team/LinkedTaskInfo.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/LinkedTaskInfo.java,v >retrieving revision 1.1 >diff -u -r1.1 LinkedTaskInfo.java >--- src/org/eclipse/mylar/internal/team/LinkedTaskInfo.java 29 Nov 2006 01:10:01 -0000 1.1 >+++ src/org/eclipse/mylar/internal/team/LinkedTaskInfo.java 29 Nov 2006 10:55:45 -0000 >@@ -11,12 +11,7 @@ > > package org.eclipse.mylar.internal.team; > >-import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector; >-import org.eclipse.mylar.tasks.core.AbstractRepositoryTask; > import org.eclipse.mylar.tasks.core.ITask; >-import org.eclipse.mylar.tasks.core.TaskRepository; >-import org.eclipse.mylar.tasks.core.TaskRepositoryManager; >-import org.eclipse.mylar.tasks.ui.TasksUiPlugin; > > /** > * Default implementation of {@link ILinkedTaskInfo} >@@ -25,80 +20,30 @@ > */ > public class LinkedTaskInfo implements ILinkedTaskInfo { > >+ private ITask task; >+ >+ private String repositoryUrl; >+ > private String taskId; > > private String taskFullUrl; > >- private String repositoryUrl; >- >- private ITask task; >+ private String comment; >+ > > public LinkedTaskInfo(ITask task) { >- init(task, // >- AbstractRepositoryTask.getRepositoryUrl(task.getHandleIdentifier()), // >- AbstractRepositoryTask.getTaskId(task.getHandleIdentifier()), // >- task.getUrl()); >+ this.task = task; > } > > public LinkedTaskInfo(String taskFullUrl) { >- init(null, null, null, taskFullUrl); >- } >- >- public LinkedTaskInfo(String repositoryUrl, String taskId, String taskFullUrl) { >- init(null, repositoryUrl, taskId, taskFullUrl); >+ this.taskFullUrl = taskFullUrl; > } > >- private void init(ITask task, String repositoryUrl, String taskId, String taskFullUrl) { >- // TODO should this even be here? >- >- TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager(); >- AbstractRepositoryConnector connector = repositoryManager.getConnectorForRepositoryTaskUrl(taskFullUrl); >- if (connector == null && repositoryUrl != null) { >- TaskRepository repository = repositoryManager.getRepository(repositoryUrl); >- if (repository != null) { >- connector = repositoryManager.getRepositoryConnector(repository.getKind()); >- } >- } >- >- if (repositoryUrl == null && connector != null) { >- repositoryUrl = connector.getRepositoryUrlFromTaskUrl(taskFullUrl); >- } >- >- if (taskId == null && connector != null) { >- taskId = connector.getTaskIdFromTaskUrl(taskFullUrl); >- } >- >- if (taskFullUrl == null && repositoryUrl != null && taskId != null && connector != null) { >- taskFullUrl = connector.getTaskWebUrl(repositoryUrl, taskId); >- } >- >- if (task == null) { >- if (taskId != null && repositoryUrl != null) { >- String handle = AbstractRepositoryTask.getHandle(repositoryUrl, taskId); >- task = TasksUiPlugin.getTaskListManager().getTaskList().getTask(handle); >- } >- if (task == null && taskFullUrl != null) { >- // search by fullUrl >- for (ITask currTask : TasksUiPlugin.getTaskListManager().getTaskList().getAllTasks()) { >- if (currTask instanceof AbstractRepositoryTask) { >- String currUrl = ((AbstractRepositoryTask) currTask).getUrl(); >- if (taskFullUrl.equals(currUrl)) { >- task = currTask; >- break; >- } >- } >- } >- } >- } >- >- if (taskFullUrl == null && task != null) { >- taskFullUrl = task.getUrl(); >- } >- >- this.task = task; >+ public LinkedTaskInfo(String repositoryUrl, String taskId, String taskFullUrl, String comment) { > this.repositoryUrl = repositoryUrl; > this.taskId = taskId; > this.taskFullUrl = taskFullUrl; >+ this.comment = comment; > } > > public String getRepositoryUrl() { >@@ -117,4 +62,9 @@ > return taskId; > } > >+ public String getComment() { >+ return comment; >+ } >+ > } >+ >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.8 >diff -u -r1.8 ContextChangeSet.java >--- src/org/eclipse/mylar/internal/team/ContextChangeSet.java 27 Nov 2006 17:47:56 -0000 1.8 >+++ src/org/eclipse/mylar/internal/team/ContextChangeSet.java 29 Nov 2006 10:55:45 -0000 >@@ -210,6 +210,8 @@ > return new ChangeSetResourceMapping(this); > } else if (adapter == ITask.class) { > return task; >+ } else if (adapter == ILinkedTaskInfo.class) { >+ return new LinkedTaskInfo(getTask()); > } else { > return null; > } >Index: src/org/eclipse/mylar/internal/team/LinkedTaskInfoAdapterFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/LinkedTaskInfoAdapterFactory.java,v >retrieving revision 1.1 >diff -u -r1.1 LinkedTaskInfoAdapterFactory.java >--- src/org/eclipse/mylar/internal/team/LinkedTaskInfoAdapterFactory.java 29 Nov 2006 01:10:01 -0000 1.1 >+++ src/org/eclipse/mylar/internal/team/LinkedTaskInfoAdapterFactory.java 29 Nov 2006 10:55:45 -0000 >@@ -11,7 +11,6 @@ > > package org.eclipse.mylar.internal.team; > >-import org.eclipse.compare.structuremergeviewer.DiffNode; > import org.eclipse.compare.structuremergeviewer.IDiffElement; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; >@@ -20,14 +19,13 @@ > import org.eclipse.core.runtime.IAdapterFactory; > import org.eclipse.core.runtime.IAdapterManager; > import org.eclipse.core.runtime.Platform; >-import org.eclipse.mylar.internal.team.template.CommitTemplateManager; > import org.eclipse.mylar.tasks.core.TaskRepository; > import org.eclipse.mylar.tasks.ui.TasksUiPlugin; >-import org.eclipse.mylar.team.MylarTeamPlugin; > import org.eclipse.team.core.history.IFileRevision; > import org.eclipse.team.core.variants.IResourceVariant; > import org.eclipse.team.internal.ccvs.core.CVSException; > import org.eclipse.team.internal.ccvs.core.ICVSResource; >+import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry; > import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; > import org.eclipse.team.internal.ccvs.core.resources.RemoteResource; > import org.eclipse.team.internal.core.subscribers.ChangeSet; >@@ -35,9 +33,8 @@ > import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode; > import org.eclipse.team.internal.ui.synchronize.SynchronizeModelElement; > >- > /** >- * Adapter factory used to create adapters for <code>LinkedTaskInfo</code> >+ * Adapter factory used to create adapters for <code>LinkedTaskInfo</code> > * > * @author Eugene Kuleshov > */ >@@ -48,12 +45,7 @@ > > private static IAdapterFactory FACTORY = new LinkedTaskInfoAdapterFactory(); > >- private static final String PREFIX_HTTP = "http://"; >- >- private static final String PREFIX_HTTPS = "https://"; > >-// private static boolean haveSubclipse; >- > public static void registerAdapters() { > IAdapterManager adapterManager = Platform.getAdapterManager(); > >@@ -62,55 +54,33 @@ > > // Team public > adapterManager.registerAdapters(FACTORY, IFileRevision.class); >- adapterManager.registerAdapters(FACTORY, DiffNode.class); > > // Team internal >- adapterManager.registerAdapters(FACTORY, DiffChangeSet.class); // CVSCheckedInChangeSet ??? >+ adapterManager.registerAdapters(FACTORY, DiffChangeSet.class); // CVSCheckedInChangeSet > adapterManager.registerAdapters(FACTORY, ChangeSetDiffNode.class); > adapterManager.registerAdapters(FACTORY, SynchronizeModelElement.class); >- >+ > // Team CVS internal; is it used? Maybe CVS History view in Eclipse 3.1? >- adapterManager.registerAdapters(FACTORY, org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry.class); >- >- // Subclipse >-// try { >-// SubclipseWrapper.init(adapterManager, FACTORY); >-// haveSubclipse = true; >-// } catch (Throwable ex) { >-// // ignore >-// } >+ adapterManager.registerAdapters(FACTORY, LogEntry.class); > } >- >+ > public static void unregisterAdapters() { >- Platform.getAdapterManager().unregisterAdapters(FACTORY); >+ Platform.getAdapterManager().unregisterAdapters(FACTORY); > } >- >- >+ > private LinkedTaskInfoAdapterFactory() { > } >- >+ > @SuppressWarnings("unchecked") > public Object getAdapter(Object object, Class adapterType) { >- if(!ILinkedTaskInfo.class.equals(adapterType)) { >+ if (!ILinkedTaskInfo.class.equals(adapterType)) { > return null; > } >- >- if(object instanceof ChangeSetDiffNode) { >+ >+ if (object instanceof ChangeSetDiffNode) { > return adaptChangeSetDiffNode(object); > } >- >- if(object instanceof DiffNode) { >- return getAdapter(((DiffNode) object).getParent(), adapterType); >- } >- >-// if(haveSubclipse && >-// "org.tigris.subversion.subclipse.core.history.LogEntry".equals(object.getClass().getName())) { >-// ILinkedTaskInfo info = SubclipseWrapper.adaptSubclipseLogEntry(object); >-// if(info!=null) { >-// return info; >-// } >-// } >- >+ > // TODO add other adapted types > > return adaptFromComment(object); >@@ -122,157 +92,102 @@ > } > > private ILinkedTaskInfo adaptChangeSetDiffNode(Object object) { >- ChangeSetDiffNode diffNode = (ChangeSetDiffNode) object; >- ChangeSet set = diffNode.getSet(); >- if (set instanceof ContextChangeSet) { >- return new LinkedTaskInfo(((ContextChangeSet) set).getTask()); >- } >-// else if(haveSubclipse && set.getClass().getName().startsWith("org.tigris")) { >-// ILinkedTaskInfo info = SubclipseWrapper.adaptSubclipseChangeset(diffNode, set); >-// if(info!=null) { >-// return info; >-// } >-// } >+ ChangeSetDiffNode diffNode = (ChangeSetDiffNode) object; >+ ChangeSet set = diffNode.getSet(); >+ >+ Object adapter = null; >+ if (set instanceof IAdaptable) { >+ adapter = ((IAdaptable) set).getAdapter(ILinkedTaskInfo.class); >+ } >+ if (adapter == null) { >+ adapter = Platform.getAdapterManager().getAdapter(set, ILinkedTaskInfo.class); >+ } >+ if (adapter != null) { >+ return (ILinkedTaskInfo) adapter; >+ } > >- return adaptFromComment(object); >+ return adaptFromComment(object); > } > > private ILinkedTaskInfo adaptFromComment(Object object) { >- String comment = getCommentFromElement(object); >+ String comment = getCommentForElement(object); >+ if (comment == null) { >+ return null; >+ } > >- CommitTemplateManager commitTemplateManager = MylarTeamPlugin.getDefault().getCommitTemplateManager(); >- String taskId = commitTemplateManager.getTaskIdFromCommentOrLabel(comment); >- if (taskId == null) { >- taskId = getTaskIdFromLegacy07Label(comment); >+ IResource resource = getResourceForElement(object); >+ if (resource != null) { >+ TaskRepository repository = TasksUiPlugin.getDefault().getRepositoryForResource(resource, false); >+ if (repository != null) { >+ return new LinkedTaskInfo(repository.getUrl(), null, null, comment); >+ } > } > >- IProject project = findCorrespondingProject(object); >- if (project != null) { >- TaskRepository repository = TasksUiPlugin.getDefault().getRepositoryForResource(project, false); >- if (repository != null && taskId!=null) { >- return new LinkedTaskInfo(repository.getUrl(), taskId, null); >- } >+ return new LinkedTaskInfo(null, null, null, comment); >+ } >+ >+ private static String getCommentForElement(Object element) { >+ if (element instanceof DiffChangeSet) { >+ return ((DiffChangeSet) element).getComment(); >+ } else if (element instanceof ChangeSetDiffNode) { >+ return ((ChangeSetDiffNode) element).getName(); >+ } else if (element instanceof IFileRevision) { >+ return ((IFileRevision) element).getComment(); >+ } else if (element instanceof LogEntry) { >+ return ((LogEntry) element).getComment(); > } >- >- String fullTaskUrl = getUrlFromComment(comment); >- if(fullTaskUrl!=null) { >- return new LinkedTaskInfo(fullTaskUrl); >- } >- >- return null; >+ return null; > } >- >- private String getCommentFromElement(Object element) { >- if (element instanceof DiffChangeSet) { >- return ((DiffChangeSet) element).getComment(); >- } else if (element instanceof ChangeSetDiffNode) { >- return ((ChangeSetDiffNode) element).getName(); >- } else if (element instanceof IFileRevision) { >- return ((IFileRevision) element).getComment(); >- } else if (element instanceof org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry) { >- return ((org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry) element).getComment(); >- } else if (element instanceof org.tigris.subversion.subclipse.core.history.LogEntry) { >- return ((org.tigris.subversion.subclipse.core.history.LogEntry) element).getComment(); >- } >- return null; >- } >- >- >- // > >- public static String getUrlFromComment(String comment) { >- int httpIndex = comment.indexOf(PREFIX_HTTP); >- int httpsIndex = comment.indexOf(PREFIX_HTTPS); >- int idStart = -1; >- if (httpIndex != -1) { >- idStart = httpIndex; >- } else if (httpsIndex != -1) { >- idStart = httpsIndex; >- } >- if (idStart != -1) { >- int idEnd = comment.indexOf(' ', idStart); >- if (idEnd == -1) { >- return comment.substring(idStart); >- } else if (idEnd != -1 && idStart < idEnd) { >- return comment.substring(idStart, idEnd); >- } >- } >- return null; >- } >- >- public static String getTaskIdFromLegacy07Label(String comment) { >- String PREFIX_DELIM = ":"; >- String PREFIX_START_1 = "Progress on:"; >- String PREFIX_START_2 = "Completed:"; >- String usedPrefix = PREFIX_START_1; >- int firstDelimIndex = comment.indexOf(PREFIX_START_1); >- if (firstDelimIndex == -1) { >- firstDelimIndex = comment.indexOf(PREFIX_START_2); >- usedPrefix = PREFIX_START_2; >- } >- if (firstDelimIndex != -1) { >- int idStart = firstDelimIndex + usedPrefix.length(); >- int idEnd = comment.indexOf(PREFIX_DELIM, firstDelimIndex + usedPrefix.length());// comment.indexOf(PREFIX_DELIM); >- if (idEnd != -1 && idStart < idEnd) { >- String id = comment.substring(idStart, idEnd); >- if (id != null) { >- return id.trim(); >- } >- } else { >- return comment.substring(0, firstDelimIndex); >- } >- } >- return null; >- } >- >- private static IProject findCorrespondingProject(Object element) { >- if (element instanceof DiffChangeSet) { >- IResource[] resources = ((DiffChangeSet) element).getResources(); >- if (resources.length > 0) { >- // TODO: only checks first resource >- return resources[0].getProject(); >- } >- } else if (element instanceof SynchronizeModelElement) { >- SynchronizeModelElement modelElement = (SynchronizeModelElement)element; >- IResource resource = modelElement.getResource(); >- if (resource != null) { >- return resource.getProject(); >- } else { >- IDiffElement[] elements = modelElement.getChildren(); >- if (elements.length > 0) { >- // TODO: only checks first diff >- if (elements[0] instanceof SynchronizeModelElement) { >- return ((SynchronizeModelElement)elements[0]).getResource().getProject(); >- } >- } >- } >- } else if (element instanceof IAdaptable) { >- IAdaptable adaptable = (IAdaptable) element; >+ private static IResource getResourceForElement(Object element) { >+ if (element instanceof DiffChangeSet) { >+ IResource[] resources = ((DiffChangeSet) element).getResources(); >+ if (resources.length > 0) { >+ // TODO: only checks first resource >+ return resources[0]; >+ } >+ } >+ if (element instanceof SynchronizeModelElement) { >+ SynchronizeModelElement modelElement = (SynchronizeModelElement) element; >+ IResource resource = modelElement.getResource(); >+ if (resource != null) { >+ return resource; >+ } else { >+ IDiffElement[] elements = modelElement.getChildren(); >+ if (elements.length > 0) { >+ // TODO: only checks first diff >+ if (elements[0] instanceof SynchronizeModelElement) { >+ return ((SynchronizeModelElement) elements[0]).getResource(); >+ } >+ } >+ } >+ } >+ if (element instanceof IAdaptable) { >+ IAdaptable adaptable = (IAdaptable) element; > IResourceVariant resourceVariant = (IResourceVariant) adaptable.getAdapter(IResourceVariant.class); >- if (resourceVariant != null && resourceVariant instanceof RemoteResource) { >- RemoteResource remoteResource = (RemoteResource) resourceVariant; >- // TODO is there a better way then iterating trough all projects? >- String path = remoteResource.getRepositoryRelativePath(); >- for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { >- if(project.isAccessible()) { >- ICVSResource cvsResource = CVSWorkspaceRoot.getCVSFolderFor(project); >- try { >- if(cvsResource!=null && path.startsWith(cvsResource.getRepositoryRelativePath())) { >+ if (resourceVariant != null && resourceVariant instanceof RemoteResource) { >+ RemoteResource remoteResource = (RemoteResource) resourceVariant; >+ // TODO is there a better way then iterating trough all projects? >+ String path = remoteResource.getRepositoryRelativePath(); >+ for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) { >+ if (project.isAccessible()) { >+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSFolderFor(project); >+ try { >+ if (cvsResource != null && path.startsWith(cvsResource.getRepositoryRelativePath())) { > return project; > } > } catch (CVSException ex) { > // ignore > } >- } >- } >- >- return null; >- } >- } else { >- // TODO >- >- } >- return null; >- } >+ } >+ } >+ } >+ } >+ >+ // TODO any other resource types? >+ >+ return null; >+ } >+ > } > >Index: src/org/eclipse/mylar/internal/team/ILinkedTaskInfo.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/src/org/eclipse/mylar/internal/team/ILinkedTaskInfo.java,v >retrieving revision 1.1 >diff -u -r1.1 ILinkedTaskInfo.java >--- src/org/eclipse/mylar/internal/team/ILinkedTaskInfo.java 29 Nov 2006 01:10:01 -0000 1.1 >+++ src/org/eclipse/mylar/internal/team/ILinkedTaskInfo.java 29 Nov 2006 10:55:45 -0000 >@@ -30,4 +30,6 @@ > > ITask getTask(); > >+ String getComment(); >+ > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/META-INF/MANIFEST.MF,v >retrieving revision 1.60 >diff -u -r1.60 MANIFEST.MF >--- META-INF/MANIFEST.MF 28 Nov 2006 15:00:43 -0000 1.60 >+++ META-INF/MANIFEST.MF 29 Nov 2006 10:55:45 -0000 >@@ -10,8 +10,6 @@ > org.eclipse.team.cvs.ui, > org.eclipse.team.cvs.core, > org.eclipse.team.ui, >- org.tigris.subversion.subclipse.core;resolution:=optional, >- org.tigris.subversion.subclipse.ui;resolution:=optional, > org.eclipse.jface, > org.eclipse.core.resources, > org.eclipse.core.runtime, >@@ -27,7 +25,6 @@ > Eclipse-LazyStart: true > Export-Package: org.eclipse.mylar.internal.team, > org.eclipse.mylar.internal.team.ccvs, >- org.eclipse.mylar.internal.team.subclipse, > org.eclipse.mylar.internal.team.template, > org.eclipse.mylar.internal.team.ui, > org.eclipse.mylar.internal.team.ui.actions, >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.mylar/org.eclipse.mylar.team/plugin.xml,v >retrieving revision 1.14 >diff -u -r1.14 plugin.xml >--- plugin.xml 29 Nov 2006 01:10:02 -0000 1.14 >+++ plugin.xml 29 Nov 2006 10:55:45 -0000 >@@ -8,7 +8,6 @@ > <extension > point="org.eclipse.mylar.team.providers"> > <repository class="org.eclipse.mylar.internal.team.ccvs.CvsRepositoryProvider"/> >- <repository class="org.eclipse.mylar.internal.team.subclipse.SubclipseTeamRepositoryProvider"/> > </extension> > > <extension >@@ -29,6 +28,23 @@ > </extension> > > <extension point="org.eclipse.ui.popupMenus"> >+ >+ <objectContribution >+ id="org.eclipse.mylar.ui.team.synchronize.open.report" >+ objectClass="org.eclipse.mylar.internal.team.ILinkedTaskInfo" >+ adaptable="true"> >+ <action >+ class="org.eclipse.mylar.internal.team.ui.actions.OpenCorrespondingTaskAction" >+ enablesFor="1" >+ icon="icons/elcl16/task-repository.gif" >+ id="org.eclipse.mylar.ui.team.synchronize.contribution.open.report" >+ label="Open Corresponding Task" >+ menubarPath="mylar" >+ tooltip="Open Corresponding Task"> >+ </action> >+ </objectContribution> >+ >+ <!-- > <objectContribution > objectClass="org.eclipse.team.ui.synchronize.ISynchronizeModelElement" > id="org.eclipse.mylar.ui.team.synchronize.open.report"> >@@ -42,6 +58,9 @@ > tooltip="Open Corresponding Task"> > </action> > </objectContribution> >+ --> >+ >+ <!-- is this from Eclipse 3.1 History view? > <objectContribution > objectClass="org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry" > id="org.eclipse.mylar.ui.team.history.open.report"> >@@ -55,6 +74,9 @@ > tooltip="Open Corresponding Task"> > </action> > </objectContribution> >+ --> >+ >+ <!-- > <objectContribution > objectClass="org.eclipse.team.core.history.IFileRevision" > id="org.eclipse.mylar.ui.team.synchronize.open.report"> >@@ -68,22 +90,8 @@ > tooltip="Open Corresponding Task"> > </action> > </objectContribution> >+ --> > >- <!-- Subclipse History view --> >- <objectContribution >- objectClass="org.tigris.subversion.subclipse.core.history.LogEntry" >- id="org.eclipse.mylar.ui.team.synchronize.open.report"> >- <action >- class="org.eclipse.mylar.internal.team.ui.actions.OpenCorrespondingTaskAction" >- enablesFor="1" >- icon="icons/elcl16/task-repository.gif" >- id="org.eclipse.mylar.ui.team.synchronize.contribution.open.report" >- label="Open Corresponding Task" >- menubarPath="mylar" >- tooltip="Open Corresponding Task"> >- </action> >- </objectContribution> >- > <!-- > <objectContribution > objectClass="org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode" >Index: src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java >=================================================================== >RCS file: src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java >diff -N src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java >--- src/org/eclipse/mylar/internal/team/subclipse/SubclipseTeamRepositoryProvider.java 27 Nov 2006 17:47:55 -0000 1.5 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,97 +0,0 @@ >-/******************************************************************************* >- * 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 >- * Gunnar Wagenknecht - initial API and implementation >- *******************************************************************************/ >-package org.eclipse.mylar.internal.team.subclipse; >- >-import java.lang.reflect.Constructor; >-import java.lang.reflect.Method; >- >-import org.eclipse.core.resources.IResource; >-import org.eclipse.core.runtime.Platform; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.mylar.team.AbstractTeamRepositoryProvider; >-import org.eclipse.team.internal.core.subscribers.ActiveChangeSetManager; >-import org.osgi.framework.Bundle; >- >-/** >- * Subclipse integration for Mylar. >- */ >-public class SubclipseTeamRepositoryProvider extends AbstractTeamRepositoryProvider { >- >- @SuppressWarnings("unchecked") >- @Override >- public ActiveChangeSetManager getActiveChangeSetManager() { >- // collectors.add((CVSActiveChangeSetCollector)CVSUIPlugin.getPlugin().getChangeSetManager()); >- 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]); >- if (manager instanceof ActiveChangeSetManager) { >- return (ActiveChangeSetManager) manager; >- } >- } catch (Throwable t) { >- // intore missing tigris collector >- } >- } >- return null; >- } >- >- @SuppressWarnings("unchecked") >- @Override >- public boolean hasOutgoingChanges(IResource[] resources) { >- if (Platform.getBundle("org.tigris.subversion.subclipse.core") == null) >- 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]); >- >- return hasOutgoingChanges.booleanValue(); >- } catch (Throwable t) { >- // Noting we can do >- } >- >- return false; >- } >- >- @SuppressWarnings("unchecked") >- @Override >- public void commit(IResource[] resources) { >- if (Platform.getBundle("org.tigris.subversion.subclipse.core") == null) >- 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 }); >- >- Method executeMethod = commitActionClass.getMethod("execute", new Class[] { IAction.class }); >- executeMethod.invoke(commitAction, new Object[] { null }); >- } catch (Throwable t) { >- // nothing we can do >- } >- } >-}
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 165581
:
54525
|
54527
|
54587
| 54696 |
54697
|
54698
|
54925
|
55032
|
55033