From 0a5d9f9217a15aaabab2bcebabbf76c2fe202865 Mon Sep 17 00:00:00 2001 From: Paul Weingardt Date: Wed, 12 Mar 2014 02:38:50 +0100 Subject: [PATCH] moved get(TaskRepository) method into GitlabPluginCore, which is now a GitlabConnection manager, will be changed later * this fixes the issue, where the gitlab project has been updated (new milestones etc) and the local repository configuration is not up to date --- .../META-INF/MANIFEST.MF | 2 +- .../mylyn/gitlab/core/GitlabAttribute.java | 2 +- .../gitlab/core/GitlabAttributeMapper.java | 44 +++++----- .../mylyn/gitlab/core/GitlabConnection.java | 22 +++++ .../mylyn/gitlab/core/GitlabConnector.java | 55 ++---------- .../mylyn/gitlab/core/GitlabIssueSearch.java | 56 +++++++++++-- .../mylyn/gitlab/core/GitlabPlugin.java | 42 ---------- .../mylyn/gitlab/core/GitlabPluginCore.java | 84 +++++++++++++++++++ .../gitlab/core/GitlabTaskDataHandler.java | 19 ++--- .../core/exceptions/GitlabException.java | 4 +- .../mylyn/gitlab/ui/GitlabConnectorUI.java | 4 +- .../gitlab/ui/GitlabEditorPageFactory.java | 4 +- .../mylyn/gitlab/ui/GitlabQueryPage.java | 16 ++++ .../ui/GitlabRepositorySettingsPage.java | 4 +- 14 files changed, 220 insertions(+), 138 deletions(-) delete mode 100644 de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPlugin.java create mode 100644 de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPluginCore.java diff --git a/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF b/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF index 73325e5..6c3b5fb 100644 --- a/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF +++ b/de.weingardt.mylyn.gitlab.core/META-INF/MANIFEST.MF @@ -16,4 +16,4 @@ Bundle-ClassPath: lib/gitlab-java.jar, lib/jackson-core-asl-1.9.9.jar, lib/jackson-mapper-asl-1.9.9.jar, . -Bundle-Activator: de.weingardt.mylyn.gitlab.core.GitlabPlugin +Bundle-Activator: de.weingardt.mylyn.gitlab.core.GitlabPluginCore diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttribute.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttribute.java index bc2d980..c94b312 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttribute.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttribute.java @@ -18,7 +18,7 @@ public enum GitlabAttribute { TaskAttribute.TYPE_SHORT_TEXT, GitlabFlag.ATTRIBUTE, GitlabFlag.READ_ONLY), LABELS("Labels", GitlabAttributeKeys.labelsKey, - TaskAttribute.TYPE_SHORT_TEXT, GitlabFlag.ATTRIBUTE), + TaskAttribute.TYPE_LONG_TEXT, GitlabFlag.ATTRIBUTE), UPDATED("Updated", TaskAttribute.DATE_MODIFICATION, TaskAttribute.TYPE_DATETIME, GitlabFlag.READ_ONLY, GitlabFlag.ATTRIBUTE), diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttributeMapper.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttributeMapper.java index 89032c5..f5d9d94 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttributeMapper.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabAttributeMapper.java @@ -10,25 +10,15 @@ import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper; -import org.gitlab.api.GitlabAPI; import org.gitlab.api.models.GitlabMilestone; import org.gitlab.api.models.GitlabProjectMember; public class GitlabAttributeMapper extends TaskAttributeMapper { - - private List milestones; - private List members; public GitlabAttributeMapper(TaskRepository taskRepository) throws CoreException, IOException { super(taskRepository); } - public void update(GitlabConnection connection) throws IOException { - GitlabAPI api = connection.api(); - milestones = api.getMilestones(connection.project); - members = api.getProjectMembers(connection.project); - } - @Override public Map getOptions(TaskAttribute attribute) { switch(attribute.getId()) { @@ -38,28 +28,44 @@ public Map getOptions(TaskAttribute attribute) { return super.getOptions(attribute); } + private GitlabConnection getConnection() throws CoreException { + return GitlabPluginCore.get().get(getTaskRepository()); + } + public GitlabProjectMember findProjectMemberByName(String name) { - for(GitlabProjectMember member : members) { - if(member.getName().equals(name) || member.getUsername().equals(name)) { - return member; + try { + List members = getConnection().getProjectMembers(); + for(GitlabProjectMember member : members) { + if(member.getName().equals(name) || member.getUsername().equals(name)) { + return member; + } } - } + } catch (CoreException e) { + } return null; } public GitlabMilestone findMilestoneByName(String name) { - for(GitlabMilestone m : milestones) { - if(m.getTitle().equals(name)) { - return m; + try { + List milestones = getConnection().getMilestones(); + for(GitlabMilestone m : milestones) { + if(m.getTitle().equals(name)) { + return m; + } } + } catch (CoreException e) { } return null; } private List getMilestones() { List target = new ArrayList<>(); - for(GitlabMilestone m : milestones) { - target.add(m.getTitle()); + try { + List milestones = getConnection().getMilestones(); + for(GitlabMilestone m : milestones) { + target.add(m.getTitle()); + } + } catch (CoreException e) { } return target; } diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnection.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnection.java index 9cd9c4e..fa56699 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnection.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnection.java @@ -1,7 +1,13 @@ package de.weingardt.mylyn.gitlab.core; +import java.io.IOException; +import java.util.Collections; +import java.util.List; + import org.gitlab.api.GitlabAPI; +import org.gitlab.api.models.GitlabMilestone; import org.gitlab.api.models.GitlabProject; +import org.gitlab.api.models.GitlabProjectMember; import org.gitlab.api.models.GitlabSession; @@ -12,6 +18,9 @@ public class GitlabConnection { public final GitlabProject project; public final GitlabAttributeMapper mapper; + private List milestones; + private List members; + public GitlabConnection(String host, GitlabProject project, GitlabSession session, GitlabAttributeMapper mapper) { this.host = host; @@ -24,4 +33,17 @@ public GitlabAPI api() { return GitlabAPI.connect(host, session.getPrivateToken()); } + public void update() throws IOException { + milestones = api().getMilestones(project); + members = api().getProjectMembers(project); + } + + public List getMilestones() { + return Collections.unmodifiableList(milestones); + } + + public List getProjectMembers() { + return Collections.unmodifiableList(members); + } + } diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnector.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnector.java index 6a50a9e..a2053fe 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnector.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabConnector.java @@ -1,15 +1,12 @@ package de.weingardt.mylyn.gitlab.core; import java.io.IOException; -import java.net.URL; -import java.util.HashMap; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.mylyn.commons.net.AuthenticationType; import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; import org.eclipse.mylyn.tasks.core.IRepositoryQuery; import org.eclipse.mylyn.tasks.core.ITask; @@ -20,52 +17,12 @@ import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession; import org.gitlab.api.GitlabAPI; import org.gitlab.api.models.GitlabIssue; -import org.gitlab.api.models.GitlabProject; -import org.gitlab.api.models.GitlabSession; import de.weingardt.mylyn.gitlab.core.exceptions.GitlabException; public class GitlabConnector extends AbstractRepositoryConnector { - - private HashMap connections = new HashMap<>(); - - private GitlabTaskDataHandler handler = new GitlabTaskDataHandler(this); - - public GitlabConnection get(TaskRepository repository) throws CoreException { - return get(repository, false); - } - private GitlabConnection get(TaskRepository repository, boolean forceUpdate) throws GitlabException { - if(connections.containsKey(repository.getUrl()) && !forceUpdate) { - return connections.get(repository.getUrl()); - } else { - try { - URL url = new URL(repository.getUrl()); - String projectPath = url.getPath().substring(1); - String host = url.getProtocol() + "://" + url.getHost() + ":" + url.getPort(); - String username = repository.getCredentials(AuthenticationType.REPOSITORY).getUserName(); - String password= repository.getCredentials(AuthenticationType.REPOSITORY).getPassword(); - - GitlabSession session = GitlabAPI.connect(host, username, password); - - GitlabAPI api = GitlabAPI.connect(host, session.getPrivateToken()); - - List projects = api.getProjects(); - for(GitlabProject p : projects) { - if(p.getPathWithNamespace().equals(projectPath)) { - GitlabConnection connection = new GitlabConnection(host, p, session, - new GitlabAttributeMapper(repository)); - connection.mapper.update(connection); - connections.put(repository.getUrl(), connection); - return connection; - } - } - } catch(Exception | Error e) { - throw new GitlabException("Failed to connect to: " + repository.getUrl()); - } - } - throw new GitlabException("Failed to connect to: " + repository.getUrl()); - } + private GitlabTaskDataHandler handler = new GitlabTaskDataHandler(); @Override public boolean canCreateNewTask(TaskRepository repository) { @@ -79,7 +36,7 @@ public boolean canCreateTaskFromKey(TaskRepository repository) { @Override public String getConnectorKind() { - return GitlabPlugin.CONNECTOR_KIND; + return GitlabPluginCore.CONNECTOR_KIND; } @Override @@ -119,7 +76,7 @@ public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, IProgressMonitor monitor) { try { - GitlabConnection connection = get(repository); + GitlabConnection connection = GitlabPluginCore.get().get(repository); GitlabAPI api = connection.api(); GitlabIssueSearch search = new GitlabIssueSearch(query); @@ -135,13 +92,13 @@ public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, } catch (CoreException | Error | IOException e) { } - return new Status(Status.ERROR, GitlabPlugin.ID_PLUGIN, "Unable to execute Query!"); + return new Status(Status.ERROR, GitlabPluginCore.ID_PLUGIN, "Unable to execute Query!"); } @Override public void updateRepositoryConfiguration(TaskRepository repository, IProgressMonitor monitor) throws CoreException { - get(repository, true); + GitlabPluginCore.get().get(repository, true); } @Override @@ -153,7 +110,7 @@ public void updateTaskFromTaskData(TaskRepository repository, ITask task, TaskDa public static void validate(TaskRepository taskRepo) throws CoreException { try { - GitlabPlugin.get().getConnector().get(taskRepo); + GitlabPluginCore.get().get(taskRepo); } catch (Exception | Error e) { throw new GitlabException("Connection not successful or repository not found!"); } diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabIssueSearch.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabIssueSearch.java index f6462b4..dc333da 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabIssueSearch.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabIssueSearch.java @@ -1,5 +1,9 @@ package de.weingardt.mylyn.gitlab.core; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.regex.Pattern; import org.eclipse.mylyn.tasks.core.IRepositoryQuery; @@ -7,20 +11,43 @@ public class GitlabIssueSearch { + private final static String priorityPatternFormat = "priority:(%s)"; + private final static String typePatternFormat = "type:(%s)"; + + private Pattern titlePattern; private Pattern descriptionPattern; - private Pattern labelPattern; - private Pattern assigneePattern; + + private String assignee; + private String milestone; private String state; + private List labelPatterns = new ArrayList(); + private static int flags = Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE; public GitlabIssueSearch(IRepositoryQuery query) { titlePattern = Pattern.compile(query.getAttribute("title"), flags); descriptionPattern = Pattern.compile(query.getAttribute("description"), flags); - labelPattern = Pattern.compile(query.getAttribute("label"), flags); - assigneePattern = Pattern.compile(query.getAttribute("assignee"), flags); + + if(!query.getAttribute("label").equals("")) { + labelPatterns.add(Pattern.compile(query.getAttribute("label"), flags)); + } + + if(!query.getAttribute("priority").equals("")) { + labelPatterns.add( + Pattern.compile(String.format(priorityPatternFormat, query.getAttribute("priority")), + flags)); + } + if(!query.getAttribute("type").equals("")) { + labelPatterns.add( + Pattern.compile(String.format(typePatternFormat, query.getAttribute("type")), + flags)); + } + + milestone = query.getAttribute("milestone"); + assignee = query.getAttribute("assignee"); state = query.getAttribute("state"); } @@ -29,15 +56,30 @@ public boolean doesMatch(GitlabIssue issue) { return false; } - if(!descriptionPattern.pattern().equals("") && !descriptionPattern.matcher(issue.getTitle()).find()) { + if(!descriptionPattern.pattern().equals("") && !descriptionPattern.matcher(issue.getDescription()).find()) { return false; } - if(!labelPattern.pattern().equals("") && !labelPattern.matcher(issue.getTitle()).find()) { + Set matches = new HashSet<>(); + for(Pattern p : labelPatterns) { + for(String label : issue.getLabels()) { + if(p.matcher(label).find()) { + matches.add(p); + } + } + } + if(matches.size() != labelPatterns.size()) { return false; } - if(!assigneePattern.pattern().equals("") && !assigneePattern.matcher(issue.getTitle()).find()) { + if(!assignee.equals("") && + (issue.getAssignee() == null || !assignee.equals(issue.getAssignee().getUsername()))) { + return false; + } + + + if(!milestone.equals("") && + (issue.getMilestone() == null || !milestone.equals(issue.getMilestone().getTitle()))) { return false; } diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPlugin.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPlugin.java deleted file mode 100644 index 9a96731..0000000 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPlugin.java +++ /dev/null @@ -1,42 +0,0 @@ -package de.weingardt.mylyn.gitlab.core; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class GitlabPlugin extends Plugin { - - private static GitlabPlugin plugin; - - public static final String ID_PLUGIN = "de.weingardt.gitlab.core"; - - public static final String CONNECTOR_KIND = "gitlab"; - - public static final String ENCODING_UTF_8 = "UTF-8"; - - private GitlabConnector connector; - - public GitlabPlugin() { - connector = new GitlabConnector(); - } - - public GitlabConnector getConnector() { - return connector; - } - - public static GitlabPlugin get() { - return plugin; - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - -} diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPluginCore.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPluginCore.java new file mode 100644 index 0000000..4b55fb8 --- /dev/null +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabPluginCore.java @@ -0,0 +1,84 @@ +package de.weingardt.mylyn.gitlab.core; + +import java.net.URL; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.core.runtime.Plugin; +import org.eclipse.mylyn.commons.net.AuthenticationType; +import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.gitlab.api.GitlabAPI; +import org.gitlab.api.models.GitlabProject; +import org.gitlab.api.models.GitlabSession; +import org.osgi.framework.BundleContext; + +import de.weingardt.mylyn.gitlab.core.exceptions.GitlabException; + +public class GitlabPluginCore extends Plugin { + + private static GitlabPluginCore plugin; + + public static final String ID_PLUGIN = "de.weingardt.gitlab.core"; + + public static final String CONNECTOR_KIND = "gitlab"; + + public static final String ENCODING_UTF_8 = "UTF-8"; + + private HashMap connections = new HashMap<>(); + + public GitlabPluginCore() { + } + + public GitlabConnection get(TaskRepository repository) throws GitlabException { + return get(repository, false); + } + + GitlabConnection get(TaskRepository repository, boolean forceUpdate) throws GitlabException { + if(connections.containsKey(repository.getUrl()) && !forceUpdate) { + return connections.get(repository.getUrl()); + } else { + try { + URL url = new URL(repository.getUrl()); + String projectPath = url.getPath().substring(1); + String host = url.getProtocol() + "://" + url.getHost() + ":" + url.getPort(); + String username = repository.getCredentials(AuthenticationType.REPOSITORY).getUserName(); + String password= repository.getCredentials(AuthenticationType.REPOSITORY).getPassword(); + + GitlabSession session = GitlabAPI.connect(host, username, password); + + GitlabAPI api = GitlabAPI.connect(host, session.getPrivateToken()); + + List projects = api.getProjects(); + for(GitlabProject p : projects) { + if(p.getPathWithNamespace().equals(projectPath)) { + GitlabConnection connection = new GitlabConnection(host, p, session, + new GitlabAttributeMapper(repository)); + connection.update(); + connections.put(repository.getUrl(), connection); + return connection; + } + } + } catch(Exception | Error e) { + throw new GitlabException("Failed to connect to: " + repository.getUrl()); + } + } + throw new GitlabException("Failed to connect to: " + repository.getUrl()); + } + + public static GitlabPluginCore get() { + return plugin; + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + +} diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabTaskDataHandler.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabTaskDataHandler.java index f18b8fc..bfe613d 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabTaskDataHandler.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/GitlabTaskDataHandler.java @@ -37,17 +37,14 @@ public class GitlabTaskDataHandler extends AbstractTaskDataHandler { private static Pattern priorityPattern = Pattern.compile("priority:(high|normal|low)"); private static Pattern typePattern = Pattern.compile("type:(bug|feature|story)"); - - private GitlabConnector connector; - - public GitlabTaskDataHandler(GitlabConnector gitlabConnector) { - this.connector = gitlabConnector; + + public GitlabTaskDataHandler() { } @Override public TaskAttributeMapper getAttributeMapper(TaskRepository repository) { try { - return GitlabPlugin.get().getConnector().get(repository).mapper; + return GitlabPluginCore.get().get(repository).mapper; } catch (CoreException e) { return null; } @@ -58,7 +55,7 @@ public boolean initializeTaskData(TaskRepository repository, TaskData data, ITaskMapping mapping, IProgressMonitor monitor) throws CoreException { createDefaultAttributes(data, false); - GitlabConnection connection = GitlabPlugin.get().getConnector().get(repository); + GitlabConnection connection = GitlabPluginCore.get().get(repository); TaskAttribute root = data.getRoot(); root.getAttribute(GitlabAttribute.PROJECT.getTaskKey()).setValue(connection.project.getName()); @@ -101,7 +98,7 @@ public RepositoryResponse postTaskData(TaskRepository repository, TaskData data, root.getAttribute(GitlabAttribute.MILESTONE.getTaskKey()).getValue()); Integer milestoneId = (milestone == null ? 0 : milestone.getId()); - GitlabConnection connection = connector.get(repository); + GitlabConnection connection = GitlabPluginCore.get().get(repository); GitlabAPI api = connection.api(); try { @@ -141,7 +138,7 @@ public TaskData getTaskData(TaskRepository repository, String id, public TaskData downloadTaskData(TaskRepository repository, Integer ticketId) throws CoreException { try { - GitlabConnection connection = connector.get(repository); + GitlabConnection connection = GitlabPluginCore.get().get(repository); GitlabAPI api = connection.api(); GitlabIssue issue = api.getIssue(connection.project.getId(), ticketId); List notes = api.getNotes(issue); @@ -154,8 +151,8 @@ public TaskData downloadTaskData(TaskRepository repository, Integer ticketId) th public TaskData createTaskDataFromGitlabIssue(GitlabIssue issue, TaskRepository repository, List notes) throws CoreException { - GitlabConnection connection = connector.get(repository); - TaskData data = new TaskData(connection.mapper, GitlabPlugin.CONNECTOR_KIND, repository.getUrl(), + GitlabConnection connection = GitlabPluginCore.get().get(repository); + TaskData data = new TaskData(connection.mapper, GitlabPluginCore.CONNECTOR_KIND, repository.getUrl(), "" + issue.getId()); String labels = StringUtils.join(issue.getLabels(), ", "); diff --git a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/exceptions/GitlabException.java b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/exceptions/GitlabException.java index 6b8f675..d188b15 100644 --- a/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/exceptions/GitlabException.java +++ b/de.weingardt.mylyn.gitlab.core/src/de/weingardt/mylyn/gitlab/core/exceptions/GitlabException.java @@ -3,7 +3,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Status; -import de.weingardt.mylyn.gitlab.core.GitlabPlugin; +import de.weingardt.mylyn.gitlab.core.GitlabPluginCore; public class GitlabException extends CoreException { @@ -13,7 +13,7 @@ public class GitlabException extends CoreException { private static final long serialVersionUID = 8626757701151868815L; public GitlabException(String message) { - super(new Status(Status.ERROR, GitlabPlugin.ID_PLUGIN, message)); + super(new Status(Status.ERROR, GitlabPluginCore.ID_PLUGIN, message)); } } diff --git a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabConnectorUI.java b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabConnectorUI.java index eaad86f..65f5b12 100644 --- a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabConnectorUI.java +++ b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabConnectorUI.java @@ -13,13 +13,13 @@ import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard; import de.weingardt.mylyn.gitlab.core.GitlabAttribute; -import de.weingardt.mylyn.gitlab.core.GitlabPlugin; +import de.weingardt.mylyn.gitlab.core.GitlabPluginCore; public class GitlabConnectorUI extends AbstractRepositoryConnectorUi { @Override public String getConnectorKind() { - return GitlabPlugin.CONNECTOR_KIND; + return GitlabPluginCore.CONNECTOR_KIND; } @Override diff --git a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabEditorPageFactory.java b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabEditorPageFactory.java index ea4dbce..fbd7f76 100644 --- a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabEditorPageFactory.java +++ b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabEditorPageFactory.java @@ -9,7 +9,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.ui.forms.editor.IFormPage; -import de.weingardt.mylyn.gitlab.core.GitlabPlugin; +import de.weingardt.mylyn.gitlab.core.GitlabPluginCore; public class GitlabEditorPageFactory extends AbstractTaskEditorPageFactory { @@ -20,7 +20,7 @@ public boolean canCreatePageFor(TaskEditorInput arg0) { @Override public IFormPage createPage(TaskEditor editor) { - return new GitlabEditorPage(editor, GitlabPlugin.CONNECTOR_KIND); + return new GitlabEditorPage(editor, GitlabPluginCore.CONNECTOR_KIND); } @Override diff --git a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabQueryPage.java b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabQueryPage.java index 20974ec..7ae1c8c 100644 --- a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabQueryPage.java +++ b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabQueryPage.java @@ -24,6 +24,10 @@ public class GitlabQueryPage extends AbstractRepositoryQueryPage implements private TextSearchField label; private TextSearchField assignee; + private TextSearchField priority; + private TextSearchField type; + private TextSearchField milestone; + private ComboSearchField state; private List issueStates = Arrays.asList("opened", "closed"); @@ -66,6 +70,10 @@ private void createDefaultGroup(Composite parent) { label = new TextSearchField(parent, "Labels: "); assignee = new TextSearchField(parent, "Assignee: "); + priority = new TextSearchField(parent, "Priority: "); + type = new TextSearchField(parent, "Type: "); + milestone = new TextSearchField(parent, "Milestone: "); + state = new ComboSearchField(parent, "State: ", issueStates); } @@ -77,6 +85,10 @@ public void applyTo(IRepositoryQuery query) { query.setAttribute("label", label.get()); query.setAttribute("assignee", assignee.get()); + query.setAttribute("priority", priority.get()); + query.setAttribute("type", type.get()); + query.setAttribute("milestone", milestone.get()); + query.setAttribute("state", state.get()); } @@ -87,6 +99,10 @@ private void updateControls(IRepositoryQuery query) { label.set(query.getAttribute("label")); assignee.set(query.getAttribute("assignee")); + priority.set(query.getAttribute("priority")); + type.set(query.getAttribute("type")); + milestone.set(query.getAttribute("milestone")); + state.set(query.getAttribute("state")); } diff --git a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java index 60f93a9..4c80920 100644 --- a/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java +++ b/de.weingardt.mylyn.gitlab.ui/src/de/weingardt/mylyn/gitlab/ui/GitlabRepositorySettingsPage.java @@ -7,7 +7,7 @@ import org.eclipse.swt.widgets.Composite; import de.weingardt.mylyn.gitlab.core.GitlabConnector; -import de.weingardt.mylyn.gitlab.core.GitlabPlugin; +import de.weingardt.mylyn.gitlab.core.GitlabPluginCore; public class GitlabRepositorySettingsPage extends AbstractRepositorySettingsPage { @@ -25,7 +25,7 @@ protected void createAdditionalControls(Composite composite) { @Override public String getConnectorKind() { - return GitlabPlugin.CONNECTOR_KIND; + return GitlabPluginCore.CONNECTOR_KIND; } @Override