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 148528 Details for
Bug 290860
only fetch configuration for projects as needed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Version 3
clipboard.txt (text/plain), 40.90 KB, created by
Pawel Niewiadomski
on 2009-10-01 09:32:49 EDT
(
hide
)
Description:
Version 3
Filename:
MIME Type:
Creator:
Pawel Niewiadomski
Created:
2009-10-01 09:32:49 EDT
Size:
40.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.jira.core >Index: src/org/eclipse/mylyn/internal/jira/core/model/Project.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/model/Project.java,v >retrieving revision 1.15 >diff -u -r1.15 Project.java >--- src/org/eclipse/mylyn/internal/jira/core/model/Project.java 24 Jul 2009 12:04:22 -0000 1.15 >+++ src/org/eclipse/mylyn/internal/jira/core/model/Project.java 1 Oct 2009 13:32:35 -0000 >@@ -14,7 +14,9 @@ > > import java.io.Serializable; > import java.util.ArrayList; >+import java.util.HashMap; > import java.util.List; >+import java.util.Map; > > /** > * TODO need mapping statuses -> actions -> fields TODO need mapping statuses -> fields >@@ -48,6 +50,10 @@ > > private SecurityLevel[] securityLevels; > >+ private Map<String, IssueType> issueTypesById; >+ >+ private boolean details; >+ > public Project(String id) { > this.id = id; > } >@@ -212,6 +218,12 @@ > > public void setIssueTypes(IssueType[] issueTypes) { > this.issueTypes = issueTypes; >+ this.issueTypesById = new HashMap<String, IssueType>(); >+ if (issueTypes != null) { >+ for (IssueType type : issueTypes) { >+ issueTypesById.put(type.getId(), type); >+ } >+ } > } > > public SecurityLevel[] getSecurityLevels() { >@@ -222,4 +234,18 @@ > this.securityLevels = securityLevels; > } > >+ public void setDetails(boolean details) { >+ this.details = details; >+ } >+ >+ public boolean hasDetails() { >+ return details; >+ } >+ >+ public IssueType getIssueTypeById(String typeId) { >+ if (issueTypesById != null) { >+ return issueTypesById.get(typeId); >+ } >+ return null; >+ } > } >Index: src/org/eclipse/mylyn/internal/jira/core/model/JiraVersion.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/model/JiraVersion.java,v >retrieving revision 1.14 >diff -u -r1.14 JiraVersion.java >--- src/org/eclipse/mylyn/internal/jira/core/model/JiraVersion.java 24 Jul 2009 12:04:22 -0000 1.14 >+++ src/org/eclipse/mylyn/internal/jira/core/model/JiraVersion.java 1 Oct 2009 13:32:35 -0000 >@@ -113,4 +113,8 @@ > return sb.toString(); > } > >+ public boolean supportsPerProjectIssueTypes() { >+ return this.compareTo(JiraVersion.JIRA_3_12) >= 0; >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/jira/core/service/JiraClientCache.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/service/JiraClientCache.java,v >retrieving revision 1.16 >diff -u -r1.16 JiraClientCache.java >--- src/org/eclipse/mylyn/internal/jira/core/service/JiraClientCache.java 30 Sep 2009 19:38:06 -0000 1.16 >+++ src/org/eclipse/mylyn/internal/jira/core/service/JiraClientCache.java 1 Oct 2009 13:32:36 -0000 >@@ -12,10 +12,7 @@ > > package org.eclipse.mylyn.internal.jira.core.service; > >-import java.util.Arrays; > import java.util.HashMap; >-import java.util.HashSet; >-import java.util.Set; > > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.SubMonitor; >@@ -75,8 +72,6 @@ > > submonitor.setWorkRemaining(data.projects.length); > for (Project project : data.projects) { >- initializeProject(project, submonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); >- > data.projectsById.put(project.getId(), project); > data.projectsByKey.put(project.getKey(), project); > } >@@ -87,12 +82,12 @@ > project.getKey()), 5); > > synchronized (project) { >- final String version = data.serverInfo.getVersion(); >+ final JiraVersion version = new JiraVersion(data.serverInfo.getVersion()); > > project.setComponents(jiraClient.getComponents(project.getKey(), subMonitor.newChild(1))); > project.setVersions(jiraClient.getVersions(project.getKey(), subMonitor.newChild(1))); > >- if (supportsPerProjectIssueTypes(version) >= 0) { >+ if (version.supportsPerProjectIssueTypes()) { > IssueType[] issueTypes = jiraClient.getIssueTypes(project.getId(), subMonitor.newChild(1)); > IssueType[] subTaskIssueTypes = jiraClient.getSubTaskIssueTypes(project.getId(), subMonitor.newChild(1)); > for (IssueType issueType : subTaskIssueTypes) { >@@ -105,7 +100,7 @@ > > project.setIssueTypes(projectIssueTypes); > } >- if (new JiraVersion(version).compareTo(JiraVersion.JIRA_3_13) >= 0) { >+ if (version.compareTo(JiraVersion.JIRA_3_13) >= 0) { > try { > SecurityLevel[] securityLevels = jiraClient.getAvailableSecurityLevels(project.getKey(), > subMonitor.newChild(1)); >@@ -120,6 +115,8 @@ > project.setSecurityLevels(null); > } > } >+ >+ project.setDetails(true); > } > } > >@@ -161,45 +158,28 @@ > SubMonitor submonitor = SubMonitor.convert(monitor, Messages.JiraClientCache_getting_issue_types, 2); > > String version = data.serverInfo.getVersion(); >- if (supportsPerProjectIssueTypes(version) >= 0) { >- // collect issue types from all projects to avoid additional SOAP request >- Set<IssueType> issueTypes = new HashSet<IssueType>(); >- for (Project project : data.projects) { >- IssueType[] projectIssueTypes = project.getIssueTypes(); >- if (projectIssueTypes != null) { >- issueTypes.addAll(Arrays.asList(projectIssueTypes)); >- } >- } >- >- data.issueTypes = issueTypes.toArray(new IssueType[0]); >- data.issueTypesById = new HashMap<String, IssueType>(data.issueTypes.length); >- for (IssueType issueType : data.issueTypes) { >- data.issueTypesById.put(issueType.getId(), issueType); >- } >+ IssueType[] issueTypes = jiraClient.getIssueTypes(submonitor.newChild(1)); >+ IssueType[] subTaskIssueTypes; >+ if (new JiraVersion(version).compareTo(JiraVersion.JIRA_3_3) >= 0) { >+ subTaskIssueTypes = jiraClient.getSubTaskIssueTypes(submonitor.newChild(1)); > } else { >- IssueType[] issueTypes = jiraClient.getIssueTypes(submonitor.newChild(1)); >- IssueType[] subTaskIssueTypes; >- if (new JiraVersion(version).compareTo(JiraVersion.JIRA_3_3) >= 0) { >- subTaskIssueTypes = jiraClient.getSubTaskIssueTypes(submonitor.newChild(1)); >- } else { >- subTaskIssueTypes = new IssueType[0]; >- } >- >- data.issueTypesById = new HashMap<String, IssueType>(issueTypes.length + subTaskIssueTypes.length); >+ subTaskIssueTypes = new IssueType[0]; >+ } > >- for (IssueType issueType : issueTypes) { >- data.issueTypesById.put(issueType.getId(), issueType); >- } >+ data.issueTypesById = new HashMap<String, IssueType>(issueTypes.length + subTaskIssueTypes.length); > >- for (IssueType issueType : subTaskIssueTypes) { >- issueType.setSubTaskType(true); >- data.issueTypesById.put(issueType.getId(), issueType); >- } >+ for (IssueType issueType : issueTypes) { >+ data.issueTypesById.put(issueType.getId(), issueType); >+ } > >- data.issueTypes = new IssueType[issueTypes.length + subTaskIssueTypes.length]; >- System.arraycopy(issueTypes, 0, data.issueTypes, 0, issueTypes.length); >- System.arraycopy(subTaskIssueTypes, 0, data.issueTypes, issueTypes.length, subTaskIssueTypes.length); >+ for (IssueType issueType : subTaskIssueTypes) { >+ issueType.setSubTaskType(true); >+ data.issueTypesById.put(issueType.getId(), issueType); > } >+ >+ data.issueTypes = new IssueType[issueTypes.length + subTaskIssueTypes.length]; >+ System.arraycopy(issueTypes, 0, data.issueTypes, 0, issueTypes.length); >+ System.arraycopy(subTaskIssueTypes, 0, data.issueTypes, issueTypes.length, subTaskIssueTypes.length); > } > > private void initializeStatuses(JiraClientData data, IProgressMonitor monitor) throws JiraException { >@@ -213,7 +193,9 @@ > } > > private void initializeProjectRoles(JiraClientData data, IProgressMonitor monitor) throws JiraException { >- data.projectRoles = jiraClient.getProjectRoles(monitor); >+ SubMonitor submonitor = SubMonitor.convert(monitor, Messages.JiraClientCache_getting_project_roles, 1); >+ >+ data.projectRoles = jiraClient.getProjectRoles(submonitor.newChild(1)); > } > > private void initializeResolutions(JiraClientData data, IProgressMonitor monitor) throws JiraException { >@@ -253,19 +235,19 @@ > > public synchronized void refreshDetails(IProgressMonitor monitor) throws JiraException { > SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.JiraClientCache_Updating_repository_configuration, >- 20); >+ 7); > > final JiraClientData newData = new JiraClientData(); > > refreshServerInfo(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); > data.serverInfo = newData.serverInfo; > >- initializeProjects(newData, subMonitor.newChild(15, SubMonitor.SUPPRESS_NONE)); > initializePriorities(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); > initializeIssueTypes(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); > initializeResolutions(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); > initializeStatuses(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); > initializeProjectRoles(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); >+ initializeProjects(newData, subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE)); > > newData.lastUpdate = System.currentTimeMillis(); > this.data = newData; >@@ -276,8 +258,8 @@ > * to complete and should not be called from a UI thread. > */ > public synchronized void refreshServerInfo(JiraClientData data, IProgressMonitor monitor) throws JiraException { >- monitor = SubMonitor.convert(monitor, Messages.JiraClientCache_Getting_server_information, 1); >- data.serverInfo = jiraClient.getServerInfo(monitor); >+ SubMonitor submonitor = SubMonitor.convert(monitor, Messages.JiraClientCache_Getting_server_information, 1); >+ data.serverInfo = jiraClient.getServerInfo(submonitor.newChild(1)); > } > > public synchronized void refreshServerInfo(IProgressMonitor monitor) throws JiraException { >@@ -324,8 +306,4 @@ > return user; > } > >- private int supportsPerProjectIssueTypes(String version) { >- return new JiraVersion(version).compareTo(JiraVersion.JIRA_3_12); >- } >- > } >Index: src/org/eclipse/mylyn/internal/jira/core/service/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/service/messages.properties,v >retrieving revision 1.3 >diff -u -r1.3 messages.properties >--- src/org/eclipse/mylyn/internal/jira/core/service/messages.properties 29 Sep 2009 17:51:40 -0000 1.3 >+++ src/org/eclipse/mylyn/internal/jira/core/service/messages.properties 1 Oct 2009 13:32:36 -0000 >@@ -17,3 +17,4 @@ > JiraClientCache_getting_server_info=Getting server info > JiraClientCache_getting_statuses=Getting statuses > JiraClientCache_project_details_for=Getting project details for {0} >+JiraClientCache_getting_project_roles=Getting project roles >\ No newline at end of file >Index: src/org/eclipse/mylyn/internal/jira/core/service/FilterDefinitionConverter.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/service/FilterDefinitionConverter.java,v >retrieving revision 1.4 >diff -u -r1.4 FilterDefinitionConverter.java >--- src/org/eclipse/mylyn/internal/jira/core/service/FilterDefinitionConverter.java 18 Sep 2009 01:07:58 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/jira/core/service/FilterDefinitionConverter.java 1 Oct 2009 13:32:36 -0000 >@@ -187,6 +187,9 @@ > Set<Version> versions = new LinkedHashSet<Version>(); > > for (Project project : projects) { >+ if (!project.hasDetails()) { >+ continue; >+ } > for (String componentId : componentIds) { > Component[] projectComponents = project.getComponents(); > for (Component component : projectComponents) { >@@ -209,7 +212,21 @@ > List<String> typeIds = getIds(params, TYPE_KEY); > List<IssueType> issueTypes = new ArrayList<IssueType>(); > for (String typeId : typeIds) { >- IssueType issueType = client.getCache().getIssueTypeById(typeId); >+ IssueType issueType = null; >+ if (projects.size() > 0) { >+ for (Project project : projects) { >+ issueType = project.getIssueTypeById(typeId); >+ if (issueType != null) { >+ break; >+ } >+ } >+ } >+ >+ // fallback - if there are no projects or project issue types are not supported >+ if (issueType == null) { >+ issueType = client.getCache().getIssueTypeById(typeId); >+ } >+ > if (issueType != null) { > issueTypes.add(issueType); > } else if (validate) { >Index: src/org/eclipse/mylyn/internal/jira/core/service/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/service/Messages.java,v >retrieving revision 1.2 >diff -u -r1.2 Messages.java >--- src/org/eclipse/mylyn/internal/jira/core/service/Messages.java 29 Sep 2009 17:51:40 -0000 1.2 >+++ src/org/eclipse/mylyn/internal/jira/core/service/Messages.java 1 Oct 2009 13:32:36 -0000 >@@ -43,4 +43,5 @@ > > public static String JiraClientCache_project_details_for; > >+ public static String JiraClientCache_getting_project_roles; > } >Index: src/org/eclipse/mylyn/internal/jira/core/JiraAttributeMapper.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/JiraAttributeMapper.java,v >retrieving revision 1.25 >diff -u -r1.25 JiraAttributeMapper.java >--- src/org/eclipse/mylyn/internal/jira/core/JiraAttributeMapper.java 24 Jul 2009 12:04:22 -0000 1.25 >+++ src/org/eclipse/mylyn/internal/jira/core/JiraAttributeMapper.java 1 Oct 2009 13:32:35 -0000 >@@ -128,7 +128,7 @@ > JiraAttribute.PROJECT.id()); > if (projectAttribute != null) { > Project project = client.getCache().getProjectById(projectAttribute.getValue()); >- if (project != null) { >+ if (project != null && project.hasDetails()) { > if (JiraAttribute.COMPONENTS.id().equals(attribute.getId())) { > for (Component component : project.getComponents()) { > options.put(component.getId(), component.getName()); >Index: src/org/eclipse/mylyn/internal/jira/core/service/web/rss/JiraRssHandler.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.core/src/org/eclipse/mylyn/internal/jira/core/service/web/rss/JiraRssHandler.java,v >retrieving revision 1.13 >diff -u -r1.13 JiraRssHandler.java >--- src/org/eclipse/mylyn/internal/jira/core/service/web/rss/JiraRssHandler.java 24 Jul 2009 12:54:45 -0000 1.13 >+++ src/org/eclipse/mylyn/internal/jira/core/service/web/rss/JiraRssHandler.java 1 Oct 2009 13:32:36 -0000 >@@ -23,6 +23,7 @@ > > import org.apache.commons.lang.StringEscapeUtils; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.core.runtime.Status; > import org.eclipse.mylyn.commons.core.StatusHandler; >@@ -40,6 +41,7 @@ > import org.eclipse.mylyn.internal.jira.core.model.Version; > import org.eclipse.mylyn.internal.jira.core.model.filter.IssueCollector; > import org.eclipse.mylyn.internal.jira.core.service.JiraClient; >+import org.eclipse.mylyn.internal.jira.core.service.JiraException; > import org.xml.sax.Attributes; > import org.xml.sax.SAXException; > import org.xml.sax.helpers.DefaultHandler; >@@ -267,11 +269,11 @@ > > private final ArrayList<Comment> currentComments = new ArrayList<Comment>(); > >- private ArrayList<Version> currentFixVersions = null; >+ private final ArrayList<Version> currentFixVersions = new ArrayList<Version>(); > >- private ArrayList<Version> currentReportedVersions = null; >+ private final ArrayList<Version> currentReportedVersions = new ArrayList<Version>(); > >- private ArrayList<Component> currentComponents = null; >+ private final ArrayList<Component> currentComponents = new ArrayList<Component>(); > > private final ArrayList<Attachment> currentAttachments = new ArrayList<Attachment>(); > >@@ -384,7 +386,12 @@ > currentIssue.setParentId(attributes.getValue(ID_ATTR)); > } else if (TYPE.equals(localName)) { > // FIXME bug 280834: handle case where cache is outdated >- currentIssue.setType(client.getCache().getIssueTypeById(attributes.getValue(ID_ATTR))); >+ if (currentIssue.getProject() != null >+ && currentIssue.getProject().getIssueTypeById(attributes.getValue(ID_ATTR)) != null) { >+ currentIssue.setType(currentIssue.getProject().getIssueTypeById(attributes.getValue(ID_ATTR))); >+ } else { >+ currentIssue.setType(client.getCache().getIssueTypeById(attributes.getValue(ID_ATTR))); >+ } > } else if (PRIORITY.equals(localName)) { > currentIssue.setPriority(client.getCache().getPriorityById(attributes.getValue(ID_ATTR))); > } else if (STATUS.equals(localName)) { >@@ -623,13 +630,13 @@ > if (CHANNEL.equals(localName)) { > state = LOOKING_FOR_CHANNEL; > } else if (ITEM.equals(localName)) { >- if (currentReportedVersions != null) { >+ if (currentReportedVersions.size() > 0) { > currentIssue.setReportedVersions(currentReportedVersions.toArray(new Version[currentReportedVersions.size()])); > } >- if (currentFixVersions != null) { >+ if (currentFixVersions.size() > 0) { > currentIssue.setFixVersions(currentFixVersions.toArray(new Version[currentFixVersions.size()])); > } >- if (currentComponents != null) { >+ if (currentComponents.size() > 0) { > currentIssue.setComponents(currentComponents.toArray(new Component[currentComponents.size()])); > } > currentIssue.setComments(currentComments.toArray(new Comment[currentComments.size()])); >@@ -645,9 +652,9 @@ > currentCustomFields.clear(); > currentAttachments.clear(); > currentComments.clear(); >- currentFixVersions = null; >- currentReportedVersions = null; >- currentComponents = null; >+ currentFixVersions.clear(); >+ currentReportedVersions.clear(); >+ currentComponents.clear(); > markupDetected = false; > state = LOOKING_FOR_ITEM; > } else if (TITLE.equals(localName)) { >@@ -674,6 +681,13 @@ > //throw new SAXException("No project with key '" + projectKey + "' found"); > break; > } >+ if (!project.hasDetails()) { >+ try { >+ client.getCache().refreshProjectDetails(project.getId(), new NullProgressMonitor()); >+ } catch (JiraException e) { >+ break; >+ } >+ } > currentIssue.setProject(project); > } else if (PARENT.equals(localName)) { > currentIssue.setParentKey(getCurrentElementText()); >@@ -684,47 +698,21 @@ > } else if (UPDATED.equals(localName)) { > currentIssue.setUpdated(convertToDate(getCurrentElementText())); > } else if (VERSION.equals(localName)) { >- if (currentIssue.getProject() == null) { >+ if (currentIssue.getProject() == null >+ || !addVersionTo(currentReportedVersions, getCurrentElementText())) { > //throw new SAXException("Issue " + currentIssue.getId() + " does not have a valid project"); > break; > } >- Version version = currentIssue.getProject().getVersion(getCurrentElementText()); >- // TODO add better handling of unknown versions >- if (version != null) { >- // throw new SAXException("No version with name '" + getCurrentElementText() + "' found"); >- if (currentReportedVersions == null) { >- currentReportedVersions = new ArrayList<Version>(); >- } >- currentReportedVersions.add(version); >- } > } else if (FIX_VERSION.equals(localName)) { >- if (currentIssue.getProject() == null) { >+ if (currentIssue.getProject() == null || !addVersionTo(currentFixVersions, getCurrentElementText())) { > //throw new SAXException("Issue " + currentIssue.getId() + " does not have a valid project"); > break; > } >- Version version = currentIssue.getProject().getVersion(getCurrentElementText()); >- // TODO add better handling of unknown versions >- if (version != null) { >- // throw new SAXException("No version with name '" + getCurrentElementText() + "' found"); >- if (currentFixVersions == null) { >- currentFixVersions = new ArrayList<Version>(); >- } >- currentFixVersions.add(version); >- } > } else if (COMPONENT.equals(localName)) { >- if (currentIssue.getProject() == null) { >+ if (currentIssue.getProject() == null || !addComponentTo(currentComponents, getCurrentElementText())) { > //throw new SAXException("Issue " + currentIssue.getId() + " does not have a valid project"); > break; > } >- Component component = currentIssue.getProject().getComponent(getCurrentElementText()); >- // TODO add better handling of unknown components >- if (component != null) { >- // throw new SAXException("No component with name '" + getCurrentElementText() + "' found"); >- if (currentComponents == null) { >- currentComponents = new ArrayList<Component>(); >- } >- currentComponents.add(component); >- } > } else if (DUE.equals(localName)) { > currentIssue.setDue(convertToSimpleDate(getCurrentElementText())); > } else if (VOTES.equals(localName)) { >@@ -778,6 +766,48 @@ > } > } > >+ private boolean addVersionTo(ArrayList<Version> versions, String currentElementText) { >+ Version version = currentIssue.getProject().getVersion(currentElementText); >+ if (version != null) { >+ versions.add(version); >+ return true; >+ } else { >+ try { >+ client.getCache().refreshProjectDetails(currentIssue.getProject().getId(), new NullProgressMonitor()); >+ } catch (JiraException e) { >+ return false; >+ } >+ currentIssue.setProject(client.getCache().getProjectById(currentIssue.getProject().getId())); >+ version = currentIssue.getProject().getVersion(currentElementText); >+ if (version != null) { >+ versions.add(version); >+ return true; >+ } >+ } >+ return false; >+ } >+ >+ private boolean addComponentTo(ArrayList<Component> versions, String currentElementText) { >+ Component version = currentIssue.getProject().getComponent(currentElementText); >+ if (version != null) { >+ versions.add(version); >+ return true; >+ } else { >+ try { >+ client.getCache().refreshProjectDetails(currentIssue.getProject().getId(), new NullProgressMonitor()); >+ } catch (JiraException e) { >+ return false; >+ } >+ currentIssue.setProject(client.getCache().getProjectById(currentIssue.getProject().getId())); >+ version = currentIssue.getProject().getComponent(currentElementText); >+ if (version != null) { >+ versions.add(version); >+ return true; >+ } >+ } >+ return false; >+ } >+ > @Override > public void characters(char[] ch, int start, int length) throws SAXException { > currentElementText.append(ch, start, length); >#P org.eclipse.mylyn.jira.ui >Index: src/org/eclipse/mylyn/internal/jira/ui/wizards/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/wizards/messages.properties,v >retrieving revision 1.5 >diff -u -r1.5 messages.properties >--- src/org/eclipse/mylyn/internal/jira/ui/wizards/messages.properties 17 Sep 2009 02:16:07 -0000 1.5 >+++ src/org/eclipse/mylyn/internal/jira/ui/wizards/messages.properties 1 Oct 2009 13:32:39 -0000 >@@ -67,6 +67,7 @@ > JiraProjectPage_Pick_a_project_to_open_the_new_bug_editor=Pick a project to open the new bug editor.\n\ > Press the Update button if the project is not in the list. > JiraProjectPage_Update_Projects_from_Repository=Update Projects from Repository >+JiraProjectPage_This_project_has_details_missing=You need to be online to create a task for this project as it is missing required details which will be downloaded > > JiraRepositorySettingsPage_Advanced_Configuration=Advanced &Configuration > JiraRepositorySettingsPage_Authentication_credentials_are_valid_character_encodeing=Authentication credentials are valid. Note: The character encoding could not be determined, verify 'Additional Settings'. >Index: src/org/eclipse/mylyn/internal/jira/ui/wizards/NewJiraTaskWizard.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/wizards/NewJiraTaskWizard.java,v >retrieving revision 1.42 >diff -u -r1.42 NewJiraTaskWizard.java >--- src/org/eclipse/mylyn/internal/jira/ui/wizards/NewJiraTaskWizard.java 13 Jan 2009 07:05:45 -0000 1.42 >+++ src/org/eclipse/mylyn/internal/jira/ui/wizards/NewJiraTaskWizard.java 1 Oct 2009 13:32:39 -0000 >@@ -12,8 +12,17 @@ > > package org.eclipse.mylyn.internal.jira.ui.wizards; > >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; > import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.mylyn.internal.jira.core.JiraClientFactory; >+import org.eclipse.mylyn.internal.jira.core.JiraCorePlugin; > import org.eclipse.mylyn.internal.jira.core.model.Project; >+import org.eclipse.mylyn.internal.jira.core.service.JiraClient; >+import org.eclipse.mylyn.internal.jira.core.service.JiraException; >+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil; >+import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable; > import org.eclipse.mylyn.tasks.core.ITaskMapping; > import org.eclipse.mylyn.tasks.core.TaskMapping; > import org.eclipse.mylyn.tasks.core.TaskRepository; >@@ -47,10 +56,38 @@ > @Override > protected ITaskMapping getInitializationData() { > final Project project = projectPage.getSelectedProject(); >+ if (project != null && !project.hasDetails()) { >+ ICoreRunnable runner = new ICoreRunnable() { >+ public void run(IProgressMonitor monitor) throws CoreException { >+ try { >+ JiraClient client = JiraClientFactory.getDefault().getJiraClient(getTaskRepository()); >+ client.getCache().refreshProjectDetails(project.getId(), monitor); >+ } catch (JiraException e) { >+ throw new CoreException(JiraCorePlugin.toStatus(getTaskRepository(), e)); >+ } >+ } >+ }; >+ >+ try { >+ if (getContainer().getShell().isVisible()) { >+ CommonUiUtil.run(getContainer(), runner); >+ } else { >+ CommonUiUtil.busyCursorWhile(runner); >+ } >+ } catch (OperationCanceledException e) { >+ return null; >+ } catch (CoreException e) { >+ return null; >+ } >+ } > return new TaskMapping() { > @Override > public String getProduct() { >- return project.getKey(); >+ if (project != null) { >+ return project.getKey(); >+ } else { >+ return null; >+ } > } > }; > } >Index: src/org/eclipse/mylyn/internal/jira/ui/wizards/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/wizards/Messages.java,v >retrieving revision 1.5 >diff -u -r1.5 Messages.java >--- src/org/eclipse/mylyn/internal/jira/ui/wizards/Messages.java 17 Sep 2009 02:16:07 -0000 1.5 >+++ src/org/eclipse/mylyn/internal/jira/ui/wizards/Messages.java 1 Oct 2009 13:32:39 -0000 >@@ -194,4 +194,6 @@ > public static String JiraRepositorySettingsPage_working_hours_per_day; > > public static String JiraRepositorySettingsPage_Validate_server_settings; >+ >+ public static String JiraProjectPage_This_project_has_details_missing; > } >Index: src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraFilterDefinitionPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraFilterDefinitionPage.java,v >retrieving revision 1.11 >diff -u -r1.11 JiraFilterDefinitionPage.java >--- src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraFilterDefinitionPage.java 18 Sep 2009 01:07:55 -0000 1.11 >+++ src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraFilterDefinitionPage.java 1 Oct 2009 13:32:39 -0000 >@@ -189,6 +189,10 @@ > > private static final Project[] NO_PROJECTS = new Project[0]; > >+ private static final int HEIGHT_HINT = 50; >+ >+ private static final int WIDTH_HINT = 150; >+ > final Placeholder ALL_PROJECTS = new Placeholder(Messages.JiraFilterDefinitionPage_All_Projects); > > final Placeholder ANY_ASSIGNEE = new Placeholder(Messages.JiraFilterDefinitionPage_Any); >@@ -626,8 +630,8 @@ > private void createComponentsViewer(Composite c) { > components = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > components.getControl().setLayoutData(gridData); > > components.setContentProvider(new IStructuredContentProvider() { >@@ -642,14 +646,14 @@ > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > Project[] projects = (Project[]) newInput; >- if (projects == null || projects.length == 0) { >+ if (projects == null || projects.length == 0 || projects.length > 1) { > currentElements = new Object[] { ANY_COMPONENT }; > } else { > Set<Object> elements = new LinkedHashSet<Object>(); > elements.add(ANY_COMPONENT); > elements.add(NO_COMPONENT); > for (Project project : projects) { >- if (project != null) { >+ if (project != null && project.hasDetails()) { > elements.addAll(Arrays.asList(project.getComponents())); > } > } >@@ -740,12 +744,6 @@ > { > SashForm cc = new SashForm(sashForm, SWT.NONE); > >- ISelectionChangedListener selectionChangeListener = new ISelectionChangedListener() { >- public void selectionChanged(SelectionChangedEvent event) { >- // validatePage(); >- } >- }; >- > { > Composite comp = new Composite(cc, SWT.NONE); > GridLayout gridLayout = new GridLayout(); >@@ -757,26 +755,7 @@ > typeLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); > typeLabel.setText(Messages.JiraFilterDefinitionPage_Type); > >- issueType = new ListViewer(comp, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); >- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >- issueType.getList().setLayoutData(gridData); >- >- issueType.setLabelProvider(new LabelProvider() { >- >- @Override >- public String getText(Object element) { >- if (element instanceof Placeholder) { >- return ((Placeholder) element).getText(); >- } >- >- return ((IssueType) element).getName(); >- } >- >- }); >- >- issueType.addSelectionChangedListener(selectionChangeListener); >+ createIssueTypesViewer(comp); > } > > { >@@ -792,8 +771,8 @@ > > status = new ListViewer(comp, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > status.getList().setLayoutData(gridData); > > status.setLabelProvider(new LabelProvider() { >@@ -808,8 +787,6 @@ > } > > }); >- >- status.addSelectionChangedListener(selectionChangeListener); > } > > { >@@ -825,8 +802,8 @@ > > resolution = new ListViewer(comp, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > resolution.getList().setLayoutData(gridData); > > resolution.setLabelProvider(new LabelProvider() { >@@ -841,8 +818,6 @@ > } > > }); >- >- resolution.addSelectionChangedListener(selectionChangeListener); > } > > { >@@ -858,8 +833,8 @@ > > priority = new ListViewer(comp, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > priority.getList().setLayoutData(gridData); > > priority.setLabelProvider(new LabelProvider() { >@@ -874,7 +849,6 @@ > } > > }); >- priority.addSelectionChangedListener(selectionChangeListener); > } > > cc.setWeights(new int[] { 1, 1, 1, 1 }); >@@ -1118,6 +1092,58 @@ > Dialog.applyDialogFont(parent); > } > >+ private void createIssueTypesViewer(Composite comp) { >+ issueType = new ListViewer(comp, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); >+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; >+ issueType.getList().setLayoutData(gridData); >+ >+ issueType.setContentProvider(new IStructuredContentProvider() { >+ private Object[] currentElements; >+ >+ public Object[] getElements(Object inputElement) { >+ return currentElements; >+ } >+ >+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >+ final Project[] projects = (Project[]) newInput; >+ IssueType[] types = null; >+ >+ if (projects == null || projects.length == 0 || projects.length > 1) { >+ types = client.getCache().getIssueTypes(); >+ } else if (projects[0].hasDetails()) { >+ types = projects[0].getIssueTypes(); >+ } >+ >+ if (types != null) { >+ Object[] elements = new Object[types.length + 1]; >+ System.arraycopy(types, 0, elements, 1, types.length); >+ elements[0] = ANY_ISSUE_TYPE; >+ currentElements = elements; >+ } >+ } >+ >+ public void dispose() { >+ } >+ }); >+ >+ issueType.setLabelProvider(new LabelProvider() { >+ >+ @Override >+ public String getText(Object element) { >+ if (element instanceof Placeholder) { >+ return ((Placeholder) element).getText(); >+ } >+ >+ return ((IssueType) element).getName(); >+ } >+ >+ }); >+ >+ issueType.setInput(NO_PROJECTS); >+ } >+ > // @Override > // public boolean isPageComplete() { > // // XXX workaround for bad implementation of AbstractRepositoryQueryPage.isPageComplete() >@@ -1142,8 +1168,8 @@ > private void createFixForViewer(Composite c) { > fixFor = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > fixFor.getControl().setLayoutData(gridData); > > fixFor.setContentProvider(new IStructuredContentProvider() { >@@ -1158,7 +1184,7 @@ > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > Project[] projects = (Project[]) newInput; >- if (projects == null || projects.length == 0) { >+ if (projects == null || projects.length == 0 || projects.length > 1) { > currentElements = new Object[] { ANY_FIX_VERSION }; > } else { > List<Object> elements = new ArrayList<Object>(); >@@ -1169,7 +1195,7 @@ > Set<Version> unreleasedVersions = new LinkedHashSet<Version>(); > > for (Project project : projects) { >- if (project != null) { >+ if (project != null && project.hasDetails()) { > releasedVersions.addAll(Arrays.asList(project.getReleasedVersions())); > unreleasedVersions.addAll(Arrays.asList(project.getUnreleasedVersions())); > } >@@ -1191,8 +1217,8 @@ > private void createProjectsViewer(Composite c) { > project = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > project.getControl().setLayoutData(gridData); > > project.setLabelProvider(new LabelProvider() { >@@ -1226,8 +1252,8 @@ > private void createReportedInViewer(Composite c) { > reportedIn = new ListViewer(c, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL); > GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); >- gridData.heightHint = 50; >- gridData.widthHint = 90; >+ gridData.heightHint = HEIGHT_HINT; >+ gridData.widthHint = WIDTH_HINT; > reportedIn.getControl().setLayoutData(gridData); > > reportedIn.setContentProvider(new IStructuredContentProvider() { >@@ -1242,7 +1268,7 @@ > > public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { > Project[] projects = (Project[]) newInput; >- if (projects == null || projects.length == 0) { >+ if (projects == null || projects.length == 0 || projects.length > 1) { > currentElements = new Object[] { ANY_REPORTED_VERSION }; > } else { > List<Object> elements = new ArrayList<Object>(); >@@ -1253,7 +1279,7 @@ > Set<Object> unreleasedVersions = new LinkedHashSet<Object>(); > > for (Project project : projects) { >- if (project != null) { >+ if (project != null && project.hasDetails()) { > releasedVersions.addAll(Arrays.asList(project.getReleasedVersions())); > unreleasedVersions.addAll(Arrays.asList(project.getUnreleasedVersions())); > } >@@ -1330,26 +1356,6 @@ > }); > project.setInput(client); > >- issueType.setContentProvider(new IStructuredContentProvider() { >- >- public void dispose() { >- } >- >- public Object[] getElements(Object inputElement) { >- JiraClient server = (JiraClient) inputElement; >- Object[] elements = new Object[server.getCache().getIssueTypes().length + 1]; >- elements[0] = ANY_ISSUE_TYPE; >- System.arraycopy(server.getCache().getIssueTypes(), 0, elements, 1, >- server.getCache().getIssueTypes().length); >- >- return elements; >- } >- >- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { >- } >- }); >- issueType.setInput(client); >- > status.setContentProvider(new IStructuredContentProvider() { > > public void dispose() { >@@ -1699,8 +1705,46 @@ > } > > void updateCurrentProjects(Project[] projects) { >+ if (projects != null) { >+ for (final Project project : projects) { >+ if (!project.hasDetails()) { >+ IRunnableWithProgress updateProjectDetails = new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, >+ InterruptedException { >+ try { >+ client.getCache().refreshProjectDetails(project.getId(), monitor); >+ } catch (final JiraException e) { >+ Display.getDefault().asyncExec(new Runnable() { >+ public void run() { >+ JiraFilterDefinitionPage.this.setErrorMessage(NLS.bind( >+ Messages.JiraFilterDefinitionPage_Error_updating_attributes_X, >+ e.getMessage())); >+ } >+ }); >+ } >+ } >+ }; >+ >+ try { >+ if (getContainer() != null) { >+ getContainer().run(true, true, updateProjectDetails); >+ } else if (getSearchContainer() != null) { >+ getSearchContainer().getRunnableContext().run(true, true, updateProjectDetails); >+ } else { >+ IProgressService service = PlatformUI.getWorkbench().getProgressService(); >+ service.busyCursorWhile(updateProjectDetails); >+ } >+ } catch (Exception e) { >+ JiraFilterDefinitionPage.this.setErrorMessage(NLS.bind( >+ Messages.JiraFilterDefinitionPage_Error_updating_attributes_X, e.getMessage())); >+ } >+ } >+ } >+ } >+ > this.fixFor.setInput(projects); > this.components.setInput(projects); > this.reportedIn.setInput(projects); >+ this.issueType.setInput(projects); > } > } >Index: src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraProjectPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.jira.ui/src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraProjectPage.java,v >retrieving revision 1.43 >diff -u -r1.43 JiraProjectPage.java >--- src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraProjectPage.java 20 Aug 2009 21:39:45 -0000 1.43 >+++ src/org/eclipse/mylyn/internal/jira/ui/wizards/JiraProjectPage.java 1 Oct 2009 13:32:39 -0000 >@@ -44,6 +44,7 @@ > import org.eclipse.mylyn.internal.jira.core.service.JiraException; > import org.eclipse.mylyn.internal.jira.core.util.JiraUtil; > import org.eclipse.mylyn.internal.jira.ui.JiraUiPlugin; >+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; > import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil; > import org.eclipse.mylyn.internal.provisional.commons.ui.EnhancedFilteredTree; > import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable; >@@ -57,6 +58,7 @@ > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.SelectionAdapter; > import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.graphics.Image; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; >@@ -127,6 +129,17 @@ > } > return ""; //$NON-NLS-1$ > } >+ >+ @Override >+ public Image getImage(Object element) { >+ if (element instanceof Project) { >+ Project project = (Project) element; >+ if (!project.hasDetails()) { >+ return CommonImages.getImage(CommonImages.DISCOVERY); >+ } >+ } >+ return super.getImage(element); >+ } > }); > > projectTreeViewer.setContentProvider(new ITreeContentProvider() { >@@ -181,8 +194,11 @@ > public void selectionChanged(SelectionChangedEvent event) { > if (getSelectedProject() == null) { > setErrorMessage(Messages.JiraProjectPage_You_must_select_a_project); >+ } else if (!getSelectedProject().hasDetails()) { >+ setMessage(Messages.JiraProjectPage_This_project_has_details_missing); > } else { > setErrorMessage(null); >+ setMessage(null); > } > getWizard().getContainer().updateButtons(); > }
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 290860
:
148434
|
148435
|
148500
|
148501
|
148528
|
148529
|
148621
|
148622
|
148669