Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.trac.ui/src')
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/Messages.java37
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java133
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkDetector.java39
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java309
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java55
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java53
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListMigrator.java71
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracUiPlugin.java55
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/WebHyperlink.java57
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/Messages.java32
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracCcAttributeEditor.java90
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracPeoplePart.java109
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracRenderingEngine.java75
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPage.java80
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java77
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/messages.properties4
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/messages.properties6
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java111
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java449
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java759
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java248
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties44
22 files changed, 0 insertions, 2893 deletions
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/Messages.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/Messages.java
deleted file mode 100644
index 5825d3b24..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/Messages.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.ui.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TracConnectorUi_Replying_to__comment_X_X_;
-
- public static String TracConnectorUi_Replying_to__comment_ticket_X_X_X_;
-
- public static String TracConnectorUi_Replying_to__ticket_X_X_;
-
- public static String TracConnectorUi_Ticket;
-
- public static String WebHyperlink_Open_URL_X;
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java
deleted file mode 100644
index 4b44e763a..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector.TaskKind;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.internal.trac.ui.wizard.TracQueryPage;
-import org.eclipse.mylyn.internal.trac.ui.wizard.TracRepositorySettingsPage;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
-import org.eclipse.mylyn.tasks.core.ITaskMapping;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
-import org.eclipse.mylyn.tasks.ui.LegendElement;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
-import org.eclipse.mylyn.tasks.ui.wizards.ITaskSearchPage;
-import org.eclipse.mylyn.tasks.ui.wizards.NewTaskWizard;
-import org.eclipse.mylyn.tasks.ui.wizards.NewWebTaskWizard;
-import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class TracConnectorUi extends AbstractRepositoryConnectorUi {
-
- @SuppressWarnings("restriction")
- public TracConnectorUi() {
- org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin.getDefault().addSearchHandler(new TracSearchHandler());
- }
-
- @Override
- public IHyperlink[] findHyperlinks(TaskRepository repository, String text, int lineOffset, int regionOffset) {
- return TracHyperlinkUtil.findTicketHyperlinks(repository, text, lineOffset, regionOffset);
- }
-
- @Override
- public String getTaskKindLabel(ITask repositoryTask) {
- return Messages.TracConnectorUi_Ticket;
- }
-
- @Override
- public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) {
- return new TracRepositorySettingsPage(taskRepository);
- }
-
- @Override
- public ITaskSearchPage getSearchPage(TaskRepository repository, IStructuredSelection selection) {
- return new TracQueryPage(repository);
- }
-
- @Override
- public boolean hasSearchPage() {
- return true;
- }
-
- @Override
- public IWizard getNewTaskWizard(TaskRepository repository, ITaskMapping selection) {
- if (TracRepositoryConnector.hasRichEditor(repository)) {
- return new NewTaskWizard(repository, selection);
- } else {
- return new NewWebTaskWizard(repository, repository.getRepositoryUrl() + ITracClient.NEW_TICKET_URL,
- selection);
- }
- }
-
- @Override
- public IWizard getQueryWizard(TaskRepository repository, IRepositoryQuery query) {
- RepositoryQueryWizard wizard = new RepositoryQueryWizard(repository);
- wizard.addPage(new TracQueryPage(repository, query));
- return wizard;
- }
-
- @Override
- public String getConnectorKind() {
- return TracCorePlugin.CONNECTOR_KIND;
- }
-
- @Override
- public ImageDescriptor getTaskKindOverlay(ITask task) {
- TaskKind taskKind = TaskKind.fromString(task.getTaskKind());
- if (taskKind == TaskKind.DEFECT) {
- return TracImages.OVERLAY_DEFECT;
- } else if (taskKind == TaskKind.ENHANCEMENT) {
- return TracImages.OVERLAY_ENHANCEMENT;
- } else if (taskKind == TaskKind.TASK) {
- return null;
- }
- return super.getTaskKindOverlay(task);
- }
-
- @Override
- public List<LegendElement> getLegendElements() {
- List<LegendElement> legendItems = new ArrayList<LegendElement>();
- legendItems.add(LegendElement.createTask(TaskKind.DEFECT.toString(), TracImages.OVERLAY_DEFECT));
- legendItems.add(LegendElement.createTask(TaskKind.ENHANCEMENT.toString(), TracImages.OVERLAY_ENHANCEMENT));
- legendItems.add(LegendElement.createTask(TaskKind.TASK.toString(), null));
- return legendItems;
- }
-
- @Override
- public String getReplyText(TaskRepository taskRepository, ITask task, ITaskComment taskComment, boolean includeTask) {
- if (taskComment == null) {
- return NLS.bind(Messages.TracConnectorUi_Replying_to__ticket_X_X_, task.getTaskKey(), task.getOwner());
- } else if (includeTask) {
- return NLS.bind(Messages.TracConnectorUi_Replying_to__comment_ticket_X_X_X_, new Object[] {
- task.getTaskKey(), taskComment.getNumber(), taskComment.getAuthor().getPersonId() });
- } else {
- return NLS.bind(Messages.TracConnectorUi_Replying_to__comment_X_X_, taskComment.getNumber(),
- taskComment.getAuthor().getPersonId());
- }
- }
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkDetector.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkDetector.java
deleted file mode 100644
index c8a0336c7..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkDetector.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.util.List;
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.AbstractTaskHyperlinkDetector;
-
-/**
- * @author Steffen Pingel
- */
-public class TracHyperlinkDetector extends AbstractTaskHyperlinkDetector {
-
- public TracHyperlinkDetector() {
- }
-
- @Override
- protected List<IHyperlink> detectHyperlinks(ITextViewer textViewer, String content, int index, int contentOffset) {
- TaskRepository taskRepository = getTaskRepository(textViewer);
- if (taskRepository != null && TracCorePlugin.CONNECTOR_KIND.equals(taskRepository.getConnectorKind())) {
- return TracHyperlinkUtil.findTracHyperlinks(taskRepository, content, index, contentOffset);
- }
- return null;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java
deleted file mode 100644
index 57568e65e..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkUtil.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- * David Green - fix for bug 244017
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TaskHyperlink;
-
-/**
- * Utility class for detecting Trac hyperlinks.
- *
- * @author Steffen Pingel
- */
-public class TracHyperlinkUtil {
-
- static Pattern ticketPattern = createPattern("(ticket:|#)(\\d+)"); //$NON-NLS-1$
-
- static Pattern commentPattern = createPattern("comment:ticket:(\\d+):(\\d+)"); //$NON-NLS-1$
-
- static Pattern reportPattern1 = createPattern("report:(\\d+)"); //$NON-NLS-1$
-
- static Pattern reportPattern2 = createPattern("\\{(\\d+)\\}"); //$NON-NLS-1$
-
- static Pattern changesetPattern1 = createPattern("(r|changeset:)(\\d+)(/\\w+)?"); //$NON-NLS-1$
-
- static Pattern changesetPattern2 = createPattern("\\[(\\d+)(/\\w+)?\\]"); //$NON-NLS-1$
-
- static Pattern revisionLogPattern1 = createPattern("r(\\d+):(\\d+)"); //$NON-NLS-1$
-
- static Pattern revisionLogPattern2 = createPattern("\\[(\\d+):(\\d+)\\]"); //$NON-NLS-1$
-
- static Pattern revisionLogPattern3 = createPattern("log:(\\w+)?@(\\d+):(\\d+)"); //$NON-NLS-1$
-
- static Pattern diffPattern1 = createPattern("diff:@(\\d+):(\\d+)"); //$NON-NLS-1$
-
- static Pattern diffPattern2 = createPattern("diff:([\\w\\./-]+)(@(\\d+))?//([\\w\\./-]+)(@(\\d+))?"); //$NON-NLS-1$
-
- static Pattern wikiPattern1 = createPattern("wiki:(\\w+)"); //$NON-NLS-1$
-
- static Pattern wikiPattern2 = Pattern.compile("(?<![!.a-z])[A-Z][a-z0-9]+[A-Z]\\w*"); //$NON-NLS-1$
-
- static Pattern milestonePattern = createPattern("milestone:([\\w\\.]+)"); //$NON-NLS-1$
-
- static Pattern attachmentPattern = createPattern("attachment:ticket:(\\d+):([\\w\\.]+)"); //$NON-NLS-1$
-
- static Pattern filesPattern = createPattern("source:/*([\\w\\./\\-_]+)(@(\\d+)(#L(\\d+))?)?"); //$NON-NLS-1$
-
- private static Pattern createPattern(String regexp) {
- // hyperlink patterns prefixed with "!" are not links
- return Pattern.compile("(?<!!)" + regexp); //$NON-NLS-1$
- }
-
- /**
- * Detects hyperlinks to Trac tickets.
- */
- public static IHyperlink[] findTicketHyperlinks(TaskRepository repository, String text, int lineOffset,
- int regionOffset) {
- List<IHyperlink> links = null;
- Matcher m = ticketPattern.matcher(text);
- while (m.find()) {
- if (isInRegion(lineOffset, m)) {
- String id = m.group(2);
- if (links == null) {
- links = new ArrayList<IHyperlink>();
- }
- links.add(new TaskHyperlink(determineRegion(regionOffset, m), repository, id));
- }
- }
- return links == null ? null : links.toArray(new IHyperlink[0]);
- }
-
- /**
- * Detects Trac hyperlinks.
- *
- * <ul>
- * <li>Ticket comments: comment:ticket:1:2
- * <li>Reports: {1} or report:1
- * <li>Changesets: r1, [1], changeset:1 or (restricted) [1/trunk], changeset:1/trunk
- * <li>Revision log: r1:3, [1:3] or log:@1:3, log:trunk@1:3
- * <li>Diffs: diff:@1:3, diff:tags/trac-0.9.2/wiki-default//tags/trac-0.9.3/wiki-default or
- * diff:trunk/trac@3538//sandbox/vc-refactoring@3539
- * <li>Wiki pages: CamelCase or wiki:CamelCase
- * <li>Milestones: milestone:1.0
- * <li>Attachment: attachment:ticket:944:attachment.1073.diff
- * <li>Files: source:trunk/COPYING
- * <li>A specific file revision: source:/trunk/COPYING@200
- * <li>A particular line of a specific file revision: source:/trunk/COPYING@200#L25
- * </ul>
- *
- * @see http://trac.edgewall.org/wiki/TracLinks
- */
- public static List<IHyperlink> findTracHyperlinks(TaskRepository repository, String text, int offsetInText,
- int textOffset) {
- List<IHyperlink> links = new ArrayList<IHyperlink>();
-
- Matcher m = commentPattern.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String id = m.group(1);
- // String comment = m.group(2);
- links.add(new TaskHyperlink(determineRegion(textOffset, m), repository, id));
- }
- }
-
- m = reportPattern1.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String id = m.group(1);
- links.add(new WebHyperlink(determineRegion(textOffset, m), repository.getRepositoryUrl()
- + ITracClient.REPORT_URL + id));
- }
- }
-
- m = reportPattern2.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String id = m.group(1);
- links.add(new WebHyperlink(determineRegion(textOffset, m), repository.getRepositoryUrl()
- + ITracClient.REPORT_URL + id));
- }
- }
-
- m = revisionLogPattern1.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String rev = m.group(1);
- String stopRev = m.group(2);
- String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL + "?rev=" + rev //$NON-NLS-1$
- + "&stop_rev=" + stopRev; //$NON-NLS-1$
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = revisionLogPattern2.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String rev = m.group(1);
- String stopRev = m.group(2);
- String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL + "?rev=" + rev //$NON-NLS-1$
- + "&stop_rev=" + stopRev; //$NON-NLS-1$
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = revisionLogPattern3.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String branch = m.group(1);
- String rev = m.group(2);
- String stopRev = m.group(3);
- String url = repository.getRepositoryUrl() + ITracClient.REVISION_LOG_URL;
- if (branch != null) {
- url += branch;
- }
- url += "?rev=" + rev + "&stop_rev=" + stopRev; //$NON-NLS-1$ //$NON-NLS-2$
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = changesetPattern1.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String rev = m.group(2);
- String branch = m.group(3);
- String url = repository.getRepositoryUrl() + ITracClient.CHANGESET_URL + rev;
- if (branch != null) {
- url += branch;
- }
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = changesetPattern2.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String rev = m.group(1);
- String branch = m.group(2);
- String url = repository.getRepositoryUrl() + ITracClient.CHANGESET_URL + rev;
- if (branch != null) {
- url += branch;
- }
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = diffPattern1.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String old_rev = m.group(1);
- String new_rev = m.group(2);
- String url = repository.getRepositoryUrl() + ITracClient.CHANGESET_URL;
- url += "?new=" + new_rev + "&old=" + old_rev; //$NON-NLS-1$ //$NON-NLS-2$
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = diffPattern2.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String old_path = m.group(1);
- String old_rev = m.group(3);
- String new_path = m.group(4);
- String new_rev = m.group(6);
- String url = repository.getRepositoryUrl() + ITracClient.CHANGESET_URL;
- try {
- url += "?new_path=" + URLEncoder.encode(new_path, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- url += "&old_path=" + URLEncoder.encode(old_path, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (UnsupportedEncodingException e) {
- StatusHandler.log(new Status(IStatus.WARNING, TracUiPlugin.ID_PLUGIN, "Unexcpected exception", e)); //$NON-NLS-1$
- continue;
- }
- if (new_rev != null) {
- url += "&new=" + new_rev; //$NON-NLS-1$
- }
- if (old_rev != null) {
- url += "&old=" + old_rev; //$NON-NLS-1$
- }
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- m = wikiPattern1.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String page = m.group(1);
- links.add(new WebHyperlink(determineRegion(textOffset, m), repository.getRepositoryUrl()
- + ITracClient.WIKI_URL + page));
- }
- }
-
- m = wikiPattern2.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String page = m.group(0);
- links.add(new WebHyperlink(determineRegion(textOffset, m), repository.getRepositoryUrl()
- + ITracClient.WIKI_URL + page));
- }
- }
-
- m = milestonePattern.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String milestone = m.group(1);
- links.add(new WebHyperlink(determineRegion(textOffset, m), repository.getRepositoryUrl()
- + ITracClient.MILESTONE_URL + milestone));
- }
- }
-
- m = attachmentPattern.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String id = m.group(1);
- // String attachment = m.group(2);
- links.add(new TaskHyperlink(determineRegion(textOffset, m), repository, id));
- }
- }
-
- m = filesPattern.matcher(text);
- while (m.find()) {
- if (isInRegion(offsetInText, m)) {
- String filename = m.group(1);
- String rev = m.group(3);
- String line = m.group(5);
- String url = repository.getRepositoryUrl() + ITracClient.BROWSER_URL + filename;
- if (rev != null) {
- url += "?rev=" + rev; //$NON-NLS-1$
- if (line != null) {
- url += "#L" + line; //$NON-NLS-1$
- }
- }
- links.add(new WebHyperlink(determineRegion(textOffset, m), url));
- }
- }
-
- return links;
- }
-
- private static boolean isInRegion(int offsetInText, Matcher m) {
- return (offsetInText == -1) || (offsetInText >= m.start() && offsetInText <= m.end());
- }
-
- private static IRegion determineRegion(int textOffset, Matcher m) {
- return new Region(textOffset + m.start(), m.end() - m.start());
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java
deleted file mode 100644
index b783ce233..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * @author Shawn Minto
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class TracImages {
-
- private static final URL baseURL = TracUiPlugin.getDefault().getBundle().getEntry("/icons/"); //$NON-NLS-1$
-
- public static final String T_VIEW = "eview16"; //$NON-NLS-1$
-
- public static final ImageDescriptor OVERLAY_DEFECT = create(T_VIEW, "overlay-critical.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor OVERLAY_ENHANCEMENT = create(T_VIEW, "overlay-enhancement.gif"); //$NON-NLS-1$
-
- private static ImageDescriptor create(String prefix, String name) {
- try {
- return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
- } catch (MalformedURLException e) {
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
- private static URL makeIconFileURL(String prefix, String name) throws MalformedURLException {
- if (baseURL == null) {
- throw new MalformedURLException();
- }
-
- StringBuilder buffer = new StringBuilder(prefix);
- if (prefix != "") { //$NON-NLS-1$
- buffer.append('/');
- }
- buffer.append(name);
- return new URL(baseURL, buffer.toString());
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java
deleted file mode 100644
index 5f995310f..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter.CompareOperator;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-@SuppressWarnings("restriction")
-public class TracSearchHandler extends AbstractSearchHandler {
-
- @Override
- public String getConnectorKind() {
- return TracCorePlugin.CONNECTOR_KIND;
- }
-
- @Override
- public boolean queryForText(TaskRepository taskRepository, IRepositoryQuery query, TaskData taskData,
- String searchString) {
- TracSearchFilter filter = new TracSearchFilter("description"); //$NON-NLS-1$
- filter.setOperator(CompareOperator.CONTAINS);
- filter.addValue(searchString);
-
- TracSearch search = new TracSearch();
- search.addFilter(filter);
-
- // TODO copied from TracQueryPage.getQueryUrl()
- StringBuilder sb = new StringBuilder();
- sb.append(taskRepository.getRepositoryUrl());
- sb.append(ITracClient.QUERY_URL);
- sb.append(search.toUrl());
-
- query.setUrl(sb.toString());
-
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListMigrator.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListMigrator.java
deleted file mode 100644
index 696495545..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListMigrator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.util.TracUtil;
-import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.w3c.dom.Element;
-
-/**
- * @author Steffen Pingel
- */
-public class TracTaskListMigrator extends AbstractTaskListMigrator {
-
- private static final String KEY_TRAC = "Trac"; //$NON-NLS-1$
-
- private static final String KEY_TRAC_TASK = KEY_TRAC + KEY_TASK;
-
- private static final String KEY_TRAC_QUERY = KEY_TRAC + KEY_QUERY;
-
- private static final String KEY_SUPPORTS_SUBTASKS = "SupportsSubtasks"; //$NON-NLS-1$
-
- @Override
- public String getConnectorKind() {
- return TracCorePlugin.CONNECTOR_KIND;
- }
-
- @Override
- public String getTaskElementName() {
- return KEY_TRAC_TASK;
- }
-
- @Override
- public Set<String> getQueryElementNames() {
- Set<String> names = new HashSet<String>();
- names.add(KEY_TRAC_QUERY);
- return names;
- }
-
- @Override
- public void migrateQuery(IRepositoryQuery query, Element element) {
- // nothing to do
- }
-
- @Override
- public void migrateTask(ITask task, Element element) {
- String lastModDate = element.getAttribute(KEY_LAST_MOD_DATE);
- task.setModificationDate(TracUtil.parseDate(lastModDate));
- task.setAttribute(TracRepositoryConnector.TASK_KEY_UPDATE_DATE, lastModDate);
- if (element.hasAttribute(KEY_SUPPORTS_SUBTASKS)) {
- task.setAttribute(TracRepositoryConnector.TASK_KEY_SUPPORTS_SUBTASKS, Boolean.valueOf(
- element.getAttribute(KEY_SUPPORTS_SUBTASKS)).toString());
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracUiPlugin.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracUiPlugin.java
deleted file mode 100644
index d39701d79..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracUiPlugin.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.tasks.ui.TaskRepositoryLocationUiFactory;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * @author Mik Kersten
- * @author Steffen Pingel
- */
-public class TracUiPlugin extends AbstractUIPlugin {
-
- public static final String ID_PLUGIN = "org.eclipse.mylyn.trac.ui"; //$NON-NLS-1$
-
- private static TracUiPlugin plugin;
-
- public TracUiPlugin() {
- plugin = this;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
-
- TracCorePlugin.getDefault().getConnector().setTaskRepositoryLocationFactory(
- new TaskRepositoryLocationUiFactory());
- TasksUi.getRepositoryManager().addListener(TracCorePlugin.getDefault().getConnector().getClientManager());
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- TasksUi.getRepositoryManager().removeListener(TracCorePlugin.getDefault().getConnector().getClientManager());
-
- plugin = null;
- super.stop(context);
- }
-
- public static TracUiPlugin getDefault() {
- return plugin;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/WebHyperlink.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/WebHyperlink.java
deleted file mode 100644
index a6bf140ad..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/WebHyperlink.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-
-/**
- * Encapsulates link from text to a URL.
- *
- * @author Steffen Pingel
- * @since 2.0
- */
-public class WebHyperlink implements IHyperlink {
-
- private final IRegion region;
-
- private final String url;
-
- public WebHyperlink(IRegion region, String url) {
- this.region = region;
- this.url = url;
- }
-
- public IRegion getHyperlinkRegion() {
- return region;
- }
-
- public String getTypeLabel() {
- return null;
- }
-
- public String getHyperlinkText() {
- return MessageFormat.format(Messages.WebHyperlink_Open_URL_X, url);
- }
-
- public void open() {
- TasksUiUtil.openTask(url);
- }
-
- public String getURLString() {
- return url;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/Messages.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/Messages.java
deleted file mode 100644
index 7ec02f46b..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/Messages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.ui.editor.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TracPeoplePart_People;
- public static String TracPeoplePart__Select_to_remove_;
-
- public static String TracTaskEditorPageFactory_Browser;
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracCcAttributeEditor.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracCcAttributeEditor.java
deleted file mode 100644
index df787ef83..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracCcAttributeEditor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.mylyn.internal.trac.core.TracAttributeMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
-import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Rob Elves
- */
-public class TracCcAttributeEditor extends AbstractAttributeEditor {
-
- private List list;
-
- private TaskAttribute attrRemoveCc;
-
- public TracCcAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.MULTIPLE, ColumnSpan.SINGLE));
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- list = new List(parent, SWT.FLAT | SWT.MULTI | SWT.V_SCROLL);
- toolkit.adapt(list, true, true);
- list.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- list.setFont(JFaceResources.getDefaultFont());
- GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(list);
-
- TaskAttribute attrUserCC = getTaskAttribute();
- if (attrUserCC != null) {
- for (String value : attrUserCC.getValues()) {
- list.add(value);
- }
- }
-
- attrRemoveCc = getModel().getTaskData().getRoot().getMappedAttribute(TracAttributeMapper.REMOVE_CC);
- for (String item : attrRemoveCc.getValues()) {
- int i = list.indexOf(item);
- if (i != -1) {
- list.select(i);
- }
- }
-
- list.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- for (String cc : list.getItems()) {
- int index = list.indexOf(cc);
- if (list.isSelected(index)) {
- java.util.List<String> remove = attrRemoveCc.getValues();
- if (!remove.contains(cc)) {
- attrRemoveCc.addValue(cc);
- }
- } else {
- attrRemoveCc.removeValue(cc);
- }
- }
- getModel().attributeChanged(attrRemoveCc);
- }
- });
-
- list.showSelection();
-
- setControl(list);
- }
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracPeoplePart.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracPeoplePart.java
deleted file mode 100644
index 434596536..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracPeoplePart.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.trac.core.TracAttribute;
-import org.eclipse.mylyn.internal.trac.core.TracAttributeMapper;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Robert Elves
- */
-public class TracPeoplePart extends AbstractTaskEditorPart {
-
- private static final int COLUMN_MARGIN = 5;
-
- public TracPeoplePart() {
- setPartName(Messages.TracPeoplePart_People);
- }
-
- private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) {
- AbstractAttributeEditor editor = createAttributeEditor(attribute);
- if (editor != null) {
- editor.createLabelControl(composite, toolkit);
- GridDataFactory.defaultsFor(editor.getLabelControl()).indent(COLUMN_MARGIN, 0).applyTo(
- editor.getLabelControl());
- editor.createControl(composite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
- if (editor instanceof TracCcAttributeEditor) {
- GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(130, 95).applyTo(
- editor.getControl());
- } else {
- GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP).applyTo(editor.getControl());
- }
- }
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Section section = createSection(parent, toolkit, true);
- Composite peopleComposite = toolkit.createComposite(section);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 5;
- peopleComposite.setLayout(layout);
-
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_REPORTER));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TracAttributeMapper.NEW_CC));
- addSelfToCC(peopleComposite);
- TaskAttribute cc = getTaskData().getRoot().getMappedAttribute(TracAttribute.CC.getTaskKey());
- TaskAttribute removeCc = getTaskData().getRoot().getMappedAttribute(TracAttributeMapper.REMOVE_CC);
- if (cc != null && removeCc != null) {
- addAttribute(peopleComposite, toolkit, cc);
- toolkit.createLabel(peopleComposite, ""); //$NON-NLS-1$
- Label label = toolkit.createLabel(peopleComposite, Messages.TracPeoplePart__Select_to_remove_);
- GridDataFactory.fillDefaults().indent(0, 5).align(SWT.CENTER, SWT.CENTER).applyTo(label);
- }
-
- toolkit.paintBordersFor(peopleComposite);
- section.setClient(peopleComposite);
- setSection(toolkit, section);
- }
-
- /**
- * Creates a check box for adding the repository user to the cc list. Does nothing if the repository does not have a
- * valid username, the repository user is the assignee, reporter or already on the the cc list.
- */
- private void addSelfToCC(Composite composite) {
- TaskRepository repository = this.getTaskEditorPage().getTaskRepository();
- if (repository.getUserName() == null) {
- return;
- }
-
- TaskAttribute root = getTaskData().getRoot();
- TaskAttribute owner = root.getMappedAttribute(TaskAttribute.USER_ASSIGNED);
- if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) {
- return;
- }
-
- TaskAttribute reporter = root.getMappedAttribute(TaskAttribute.USER_REPORTER);
- if (reporter != null && reporter.getValue().indexOf(repository.getUserName()) != -1) {
- return;
- }
-
- TaskAttribute ccAttribute = root.getMappedAttribute(TaskAttribute.USER_CC);
- if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) {
- return;
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracRenderingEngine.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracRenderingEngine.java
deleted file mode 100644
index 493e5b23e..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracRenderingEngine.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Xiaoyang Guan - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.client.TracException;
-import org.eclipse.mylyn.internal.trac.core.client.TracXmlRpcClient;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractRenderingEngine;
-
-/**
- *
- * @author Xiaoyang Guan
- * @since 2.1
- */
-public class TracRenderingEngine extends AbstractRenderingEngine {
-
- /**
- * generate HTML preview page for <code>text</code>
- */
- @Override
- public String renderAsHtml(TaskRepository repository, String text, IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("Render HTML Preview", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- try {
- ITracClient client = TracCorePlugin.getDefault()
- .getConnector()
- .getClientManager()
- .getTracClient(repository);
- if (client instanceof TracXmlRpcClient) {
- TracXmlRpcClient tracXmlRpcClient = (TracXmlRpcClient) client;
- String htmlText = tracXmlRpcClient.wikiToHtml(text, monitor);
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
-
- String htmlHeader = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">" //$NON-NLS-1$
- + "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">" //$NON-NLS-1$
- + "<head>" //$NON-NLS-1$
- + "<link rel=\"stylesheet\" href=\"REPOSITORY_URL/chrome/common/css/trac.css\" type=\"text/css\" />" //$NON-NLS-1$
- + "<link rel=\"stylesheet\" href=\"REPOSITORY_URL/chrome/common/css/wiki.css\" type=\"text/css\" />" //$NON-NLS-1$
- + "<link rel=\"icon\" href=\"REPOSITORY_URL/chrome/common/trac.ico\" type=\"image/x-icon\" />" //$NON-NLS-1$
- + "<link rel=\"shortcut icon\" href=\"EPOSITORY_URL/chrome/common/trac.ico\" type=\"image/x-icon\" />" //$NON-NLS-1$
- + "<style type=\"text/css\">body {background: #f4f4f4 url(REPOSITORY_URL/chrome/common/draft.png);margin: 0;padding: 0;}</style>" //$NON-NLS-1$
- + "</head>"; //$NON-NLS-1$
- String htmlBody = "<body> " + htmlText + "</body>"; //$NON-NLS-1$ //$NON-NLS-2$
- String htmlFooter = "</html>"; //$NON-NLS-1$
-
- String html = htmlHeader.replace("REPOSITORY_URL", repository.getRepositoryUrl()) + htmlBody //$NON-NLS-1$
- + htmlFooter;
- return html;
- } else {
- throw new CoreException(TracCorePlugin.toStatus(new TracException(
- "Preview is available only in XML-RPC access mode"), repository)); //$NON-NLS-1$
- }
- } catch (TracException e) {
- throw new CoreException(TracCorePlugin.toStatus(e, repository));
- } finally {
- monitor.done();
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPage.java
deleted file mode 100644
index d9e1c9a05..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPage.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.trac.core.TracAttribute;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
-
-/**
- * @author Steffen Pingel
- */
-public class TracTaskEditorPage extends AbstractTaskEditorPage {
-
- private TracRenderingEngine renderingEngine;
-
- public TracTaskEditorPage(TaskEditor editor) {
- super(editor, TracCorePlugin.CONNECTOR_KIND);
- }
-
- @Override
- protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
- Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors();
- // remove unnecessary default editor parts
- for (Iterator<TaskEditorPartDescriptor> it = descriptors.iterator(); it.hasNext();) {
- TaskEditorPartDescriptor taskEditorPartDescriptor = it.next();
- if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) {
- it.remove();
- }
- }
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new TracPeoplePart();
- }
- }.setPath(PATH_PEOPLE));
- return descriptors;
- }
-
- @Override
- protected void createParts() {
- if (renderingEngine == null) {
- renderingEngine = new TracRenderingEngine();
- }
- getAttributeEditorToolkit().setRenderingEngine(renderingEngine);
- super.createParts();
- }
-
- @Override
- protected AttributeEditorFactory createAttributeEditorFactory() {
- AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
- @Override
- public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) {
- if (TracAttribute.CC.getTracKey().equals(taskAttribute.getId())) {
- return new TracCcAttributeEditor(getModel(), taskAttribute);
- }
- return super.createEditor(type, taskAttribute);
- }
- };
- return factory;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java
deleted file mode 100644
index 69d5e49e1..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.tasks.ui.ITasksUiConstants;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory;
-import org.eclipse.mylyn.tasks.ui.editors.BrowserFormPage;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.forms.editor.FormPage;
-
-/**
- * @author Steffen Pingel
- */
-public class TracTaskEditorPageFactory extends AbstractTaskEditorPageFactory {
-
- @Override
- public boolean canCreatePageFor(TaskEditorInput input) {
- if (input.getTask().getConnectorKind().equals(TracCorePlugin.CONNECTOR_KIND)) {
- return true;
- } else if (TasksUiUtil.isOutgoingNewTask(input.getTask(), TracCorePlugin.CONNECTOR_KIND)) {
- return true;
- }
- return false;
- }
-
- @Override
- public FormPage createPage(TaskEditor parentEditor) {
- TaskEditorInput input = parentEditor.getTaskEditorInput();
- if (TasksUiUtil.isOutgoingNewTask(input.getTask(), TracCorePlugin.CONNECTOR_KIND)) {
- return new TracTaskEditorPage(parentEditor);
- } else if (TracRepositoryConnector.hasRichEditor(input.getTaskRepository())) {
- return new TracTaskEditorPage(parentEditor);
- } else {
- return new BrowserFormPage(parentEditor, Messages.TracTaskEditorPageFactory_Browser);
- }
- }
-
- @Override
- public String[] getConflictingIds(TaskEditorInput input) {
- if (!input.getTask().getConnectorKind().equals(TracCorePlugin.CONNECTOR_KIND)) {
- return new String[] { ITasksUiConstants.ID_PAGE_PLANNING };
- }
- return null;
- }
-
- @Override
- public Image getPageImage() {
- return CommonImages.getImage(TasksUiImages.REPOSITORY_SMALL);
- }
-
- @Override
- public String getPageText() {
- return "Trac"; //$NON-NLS-1$
- }
-
- @Override
- public int getPriority() {
- return PRIORITY_TASK;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/messages.properties b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/messages.properties
deleted file mode 100644
index 9375dba7a..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/messages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-TracPeoplePart_People=People
-TracPeoplePart__Select_to_remove_=(Select to remove)
-
-TracTaskEditorPageFactory_Browser=Browser
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/messages.properties b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/messages.properties
deleted file mode 100644
index 49118f301..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/messages.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-TracConnectorUi_Replying_to__comment_X_X_=Replying to [comment:{0} {1}]:
-TracConnectorUi_Replying_to__comment_ticket_X_X_X_=Replying to [comment:ticket:{0}:{1} {2}]:
-TracConnectorUi_Replying_to__ticket_X_X_=Replying to [ticket:{0} {1}]:
-TracConnectorUi_Ticket=Ticket
-
-WebHyperlink_Open_URL_X=Open URL {0}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java
deleted file mode 100644
index 3df17dd34..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/Messages.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 Tasktop Technologies 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.trac.ui.wizard.messages"; //$NON-NLS-1$
-
- static {
- // load message values from bundle file
- reloadMessages();
- }
-
- public static void reloadMessages() {
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- public static String TracFilterQueryPage_Add_search_filters_to_define_query;
-
- public static String TracFilterQueryPage_CC;
-
- public static String TracFilterQueryPage_Component;
-
- public static String TracFilterQueryPage_Keywords;
-
- public static String TracFilterQueryPage_Milestone;
-
- public static String TracFilterQueryPage_New_Trac_Query;
-
- public static String TracFilterQueryPage_or;
-
- public static String TracFilterQueryPage_Owner;
-
- public static String TracFilterQueryPage_Priority;
-
- public static String TracFilterQueryPage_Query_Title;
-
- public static String TracFilterQueryPage_Reporter;
-
- public static String TracFilterQueryPage_Resolution;
-
- public static String TracFilterQueryPage_Select_to_add_filter;
-
- public static String TracFilterQueryPage_Status;
-
- public static String TracFilterQueryPage_Summary;
-
- public static String TracFilterQueryPage_Type;
-
- public static String TracFilterQueryPage_Version;
-
- public static String TracQueryPage_CC;
-
- public static String TracQueryPage_Component;
-
- public static String TracQueryPage_Description;
-
- public static String TracQueryPage_Enter_query_parameters;
-
- public static String TracQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button;
-
- public static String TracQueryPage_Keywords;
-
- public static String TracQueryPage_Milestone;
-
- public static String TracQueryPage_No_repository_available;
-
- public static String TracQueryPage_Owner;
-
- public static String TracQueryPage_Priority;
-
- public static String TracQueryPage_Query_Title;
-
- public static String TracQueryPage_Reporter;
-
- public static String TracQueryPage_Resolution;
-
- public static String TracQueryPage_Status;
-
- public static String TracQueryPage_Summary;
-
- public static String TracQueryPage_Type;
-
- public static String TracQueryPage_Update_Attributes_Failed;
-
- public static String TracQueryPage_Update_Attributes_from_Repository;
-
- public static String TracQueryPage_Version;
-
- public static String TracRepositorySettingsPage_Access_Type_;
-
- public static String TracRepositorySettingsPage_Authentication_credentials_are_valid;
-
- public static String TracRepositorySettingsPage_Automatic__Use_Validate_Settings_;
-
- public static String TracRepositorySettingsPage_EXAMPLE_HTTP_TRAC_EDGEWALL_ORG;
-
- public static String TracRepositorySettingsPage_No_Trac_repository_found_at_url;
-
- public static String TracRepositorySettingsPage_Trac_Repository_Settings;
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java
deleted file mode 100644
index 18553c803..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import java.util.ArrayList;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter.CompareOperator;
-import org.eclipse.mylyn.internal.trac.core.util.TracUtil;
-import org.eclipse.mylyn.internal.trac.ui.TracUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Steffen Pingel
- */
-public class TracFilterQueryPage extends AbstractRepositoryQueryPage {
-
- private static final String TITLE = Messages.TracFilterQueryPage_New_Trac_Query;
-
- private static final String DESCRIPTION = Messages.TracFilterQueryPage_Add_search_filters_to_define_query;
-
- private static final String TITLE_QUERY_TITLE = Messages.TracFilterQueryPage_Query_Title;
-
- private Text titleText;
-
- private Composite scrollComposite;
-
- /* Maintain order of criterions in order to be able to restore this later. */
- private final Set<SearchField> visibleSearchFields = new LinkedHashSet<SearchField>();
-
- private List<SearchField> searchFields;
-
- public TracFilterQueryPage(TaskRepository repository, IRepositoryQuery query) {
- super(TITLE, repository, query);
- setTitle(TITLE);
- setDescription(DESCRIPTION);
- }
-
- @Override
- public void applyTo(IRepositoryQuery query) {
- query.setUrl(getQueryUrl(getTaskRepository().getRepositoryUrl()));
- query.setSummary(getQueryTitle());
- }
-
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData());
- composite.setLayout(new GridLayout(1, false));
-
- createTitleGroup(composite);
-
- ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL | SWT.BORDER);
- GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true);
- scrolledComposite.setExpandHorizontal(true);
- scrolledComposite.setLayoutData(gd);
-
- scrollComposite = new Composite(scrolledComposite, SWT.None);
- scrolledComposite.setContent(scrollComposite);
- scrollComposite.setLayout(new GridLayout(4, false));
-
- createAddFilterGroup(composite);
-
- if (getQuery() != null) {
- titleText.setText(getQuery().getSummary());
- TracSearch search = TracUtil.toTracSearch(getQuery());
- if (search != null) {
- restoreWidgetValues(search);
- }
- }
-
- Dialog.applyDialogFont(composite);
- setControl(composite);
- }
-
- @Override
- public String getQueryTitle() {
- return (titleText != null) ? titleText.getText() : null;
- }
-
- private void restoreWidgetValues(TracSearch search) {
- List<TracSearchFilter> filters = search.getFilters();
- for (TracSearchFilter filter : filters) {
- SearchField field = getSearchField(filter.getFieldName());
- if (field != null) {
- showSearchField(field, filter);
- } else {
- StatusHandler.log(new Status(IStatus.WARNING, TracUiPlugin.ID_PLUGIN,
- "Ignoring invalid search filter: " + filter)); //$NON-NLS-1$
- }
- }
- }
-
- private SearchField getSearchField(String fieldName) {
- for (SearchField searchField : searchFields) {
- if (searchField.getFieldName().equals(fieldName)) {
- return searchField;
- }
- }
- return null;
- }
-
- private void createAddFilterGroup(Composite parent) {
- GridLayout layout;
- GridData gd;
-
- Composite composite = new Composite(parent, SWT.NONE);
- layout = new GridLayout(2, false);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- gd = new GridData(GridData.BEGINNING | GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- composite.setLayoutData(gd);
-
- Label label = new Label(composite, SWT.LEFT);
- label.setText(Messages.TracFilterQueryPage_Select_to_add_filter);
-
- // condition
- final Combo filterCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
-
- searchFields = new ArrayList<SearchField>();
- searchFields.add(new TextSearchField("summary", Messages.TracFilterQueryPage_Summary)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("reporter", Messages.TracFilterQueryPage_Reporter)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("owner", Messages.TracFilterQueryPage_Owner)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("type", Messages.TracFilterQueryPage_Type)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("status", Messages.TracFilterQueryPage_Status)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("priority", Messages.TracFilterQueryPage_Priority)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("milestone", Messages.TracFilterQueryPage_Milestone)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("component", Messages.TracFilterQueryPage_Component)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("version", Messages.TracFilterQueryPage_Version)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("resoution", Messages.TracFilterQueryPage_Resolution)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("keywords", Messages.TracFilterQueryPage_Keywords)); //$NON-NLS-1$
- searchFields.add(new TextSearchField("cc", Messages.TracFilterQueryPage_CC)); //$NON-NLS-1$
-
- filterCombo.add(""); //$NON-NLS-1$
- for (SearchField field : searchFields) {
- filterCombo.add(field.getDisplayName());
- }
-
- filterCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- if (filterCombo.getText().length() > 0) {
- SearchField field = searchFields.get(filterCombo.getSelectionIndex() - 1);
- showSearchField(field, null);
- filterCombo.setText(""); //$NON-NLS-1$
- }
- }
- });
- }
-
- private void createTitleGroup(Composite composite) {
- Group group = new Group(composite, SWT.NONE);
- group.setText(TITLE_QUERY_TITLE);
- group.setLayout(new GridLayout(1, false));
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayoutData(gd);
-
- titleText = new Text(group, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- titleText.setLayoutData(gd);
-
- titleText.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- // ignore
- }
-
- public void keyReleased(KeyEvent e) {
- getContainer().updateButtons();
- }
- });
- }
-
- @Override
- public boolean isPageComplete() {
- if (titleText != null && titleText.getText().length() > 0) {
- return true;
- }
- return false;
- }
-
- private void showSearchField(SearchField field, TracSearchFilter filter) {
- assert filter == null || !visibleSearchFields.contains(field);
-
- if (!visibleSearchFields.contains(field)) {
- field.createControls(scrollComposite, filter);
- visibleSearchFields.add(field);
- } else {
- field.addControl(scrollComposite);
- }
- updateScrollPane();
- }
-
- public String getQueryUrl(String repsitoryUrl) {
- TracSearch search = new TracSearch();
- for (SearchField field : visibleSearchFields) {
- search.addFilter(field.getFilter());
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append(repsitoryUrl);
- sb.append(ITracClient.QUERY_URL);
- sb.append(search.toUrl());
- return sb.toString();
- }
-
- private void hideSearchField(SearchField field) {
- visibleSearchFields.remove(field);
- }
-
- private void updateScrollPane() {
- scrollComposite.setSize(scrollComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- scrollComposite.layout();
- }
-
- private abstract class SearchField {
-
- protected String fieldName;
-
- private final String displayName;
-
- public SearchField(String fieldName, String displayName) {
- this.fieldName = fieldName;
- this.displayName = displayName;
- }
-
- public abstract void createControls(Composite parent, TracSearchFilter filter);
-
- public abstract void addControl(Composite parent);
-
- public String getFieldName() {
- return fieldName;
- }
-
- public String getDisplayName() {
- return displayName;
- }
-
- public abstract TracSearchFilter getFilter();
-
- }
-
- private class TextSearchField extends SearchField {
-
- private final CompareOperator[] compareOperators = { CompareOperator.CONTAINS, CompareOperator.CONTAINS_NOT,
- CompareOperator.BEGINS_WITH, CompareOperator.ENDS_WITH, CompareOperator.IS, CompareOperator.IS_NOT, };
-
- private List<TextCriterion> criterions;
-
- public TextSearchField(String fieldName, String displayName) {
- super(fieldName, displayName);
- }
-
- @Override
- public void createControls(Composite parent, TracSearchFilter filter) {
- if (filter != null) {
- TextCriterion first = addCriterion(parent);
- first.setCondition(filter.getOperator());
- List<String> values = filter.getValues();
- if (!values.isEmpty()) {
- first.setSearchText(values.get(0));
- for (int i = 1; i < values.size(); i++) {
- TextCriterion criterion = addCriterion(parent);
- criterion.setSearchText(values.get(1));
- }
- }
- } else {
- addCriterion(parent);
- }
-
- }
-
- @Override
- public void addControl(Composite parent) {
- addCriterion(parent);
- }
-
- public TextCriterion addCriterion(Composite parent) {
- TextCriterion criterion = new TextCriterion();
- if (criterions == null) {
- criterions = new ArrayList<TextCriterion>();
- criterion.createControl(parent);
- } else {
- criterion.createControl(parent, criterions.get(criterions.size() - 1));
- }
- criterions.add(criterion);
- return criterion;
- }
-
- @Override
- public TracSearchFilter getFilter() {
- TracSearchFilter newFilter = new TracSearchFilter(getFieldName());
- newFilter.setOperator(criterions.get(0).getCondition());
- for (TextCriterion criterion : criterions) {
- newFilter.addValue(criterion.getSearchText());
- }
- return newFilter;
- }
-
- public void removeCriterion(TextCriterion criterion) {
- int i = criterions.indexOf(criterion);
- if (i == -1) {
- throw new RuntimeException();
- }
- if (i == 0) {
- // the first criterion is special since it contains the compare
- // operator combo
- if (criterions.size() > 1) {
- // copy the value from the second criterion to the first
- TextCriterion sourceCriterion = criterions.get(1);
- criterion.searchText.setText(sourceCriterion.searchText.getText());
- removeCriterionByIndex(1);
- } else {
- // no more criterions, remove all controls
- removeCriterionByIndex(0);
- hideSearchField(this);
- }
- } else {
- removeCriterionByIndex(i);
- }
- }
-
- private void removeCriterionByIndex(int i) {
- criterions.get(i).remove();
- criterions.remove(i);
- updateScrollPane();
- }
-
- private class TextCriterion {
-
- private Combo conditionCombo;
-
- private Text searchText;
-
- private Label label;
-
- private Button removeButton;
-
- public void createControl(Composite parent) {
- label = new Label(parent, SWT.LEFT);
- label.setText(getDisplayName() + ": "); //$NON-NLS-1$
-
- conditionCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- for (CompareOperator op : compareOperators) {
- conditionCombo.add(op.toString());
- }
- conditionCombo.setText(compareOperators[0].toString());
-
- createSearchTextAndRemoveButton(parent);
- }
-
- public void createControl(Composite parent, TextCriterion top) {
- label = new Label(parent, SWT.RIGHT);
- GridData gd = new GridData();
- gd.horizontalAlignment = SWT.END;
- gd.horizontalSpan = 2;
- label.setLayoutData(gd);
- label.setText(Messages.TracFilterQueryPage_or);
-
- createSearchTextAndRemoveButton(parent);
-
- label.moveBelow(top.removeButton);
- searchText.moveBelow(label);
- removeButton.moveBelow(searchText);
- }
-
- private void createSearchTextAndRemoveButton(Composite parent) {
- searchText = new Text(parent, SWT.BORDER);
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- searchText.setLayoutData(gd);
-
- removeButton = new Button(parent, SWT.PUSH);
- removeButton.setText("-"); //$NON-NLS-1$
- removeButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
- TextSearchField.this.removeCriterion(TextCriterion.this);
- }
- });
- }
-
- public void remove() {
- label.dispose();
- if (conditionCombo != null) {
- conditionCombo.dispose();
- }
- searchText.dispose();
- removeButton.dispose();
- }
-
- public CompareOperator getCondition() {
- return (conditionCombo != null) ? compareOperators[conditionCombo.getSelectionIndex()] : null;
- }
-
- public String getSearchText() {
- return searchText.getText();
- }
-
- public boolean setCondition(CompareOperator operator) {
- if (conditionCombo != null) {
- int i = conditionCombo.indexOf(operator.toString());
- if (i != -1) {
- conditionCombo.select(i);
- return true;
- }
- }
- return false;
- }
-
- public void setSearchText(String text) {
- searchText.setText(text);
- }
-
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
deleted file mode 100644
index ebdbf9444..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
+++ /dev/null
@@ -1,759 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.client.TracException;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter;
-import org.eclipse.mylyn.internal.trac.core.model.TracSearchFilter.CompareOperator;
-import org.eclipse.mylyn.internal.trac.core.util.TracUtil;
-import org.eclipse.mylyn.internal.trac.ui.TracUiPlugin;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-
-/**
- * Trac search page. Provides a form similar to the one the Bugzilla connector uses.
- *
- * @author Steffen Pingel
- */
-public class TracQueryPage extends AbstractRepositoryQueryPage {
-
- private Text titleText;
-
- private static final int PRODUCT_HEIGHT = 60;
-
- private static final int STATUS_HEIGHT = 40;
-
- protected final static String PAGE_NAME = "TracSearchPage"; //$NON-NLS-1$
-
- private static final String SEARCH_URL_ID = PAGE_NAME + ".SEARCHURL"; //$NON-NLS-1$
-
- protected Combo summaryText = null;
-
- protected Combo repositoryCombo = null;
-
- private TextSearchField summaryField;
-
- private TextSearchField descriptionField;
-
- private ListSearchField componentField;
-
- private ListSearchField versionField;
-
- private ListSearchField milestoneField;
-
- private ListSearchField priorityField;
-
- private ListSearchField typeField;
-
- private ListSearchField resolutionField;
-
- private ListSearchField statusField;
-
- private Button updateButton;
-
- private TextSearchField keywordsField;
-
- private final Map<String, SearchField> searchFieldByName = new HashMap<String, SearchField>();
-
- private boolean firstTime = true;
-
- // private UserSearchField ownerField;
- //
- // private UserSearchField reporterField;
- //
- // private UserSearchField ccField;
-
- public TracQueryPage(TaskRepository repository, IRepositoryQuery query) {
- super(Messages.TracQueryPage_Enter_query_parameters, repository, query);
- setTitle(Messages.TracQueryPage_Enter_query_parameters);
- setDescription(Messages.TracQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button);
- }
-
- public TracQueryPage(TaskRepository repository) {
- this(repository, null);
- }
-
- public void createControl(Composite parent) {
- Composite control = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- control.setLayoutData(gd);
- GridLayout layout = new GridLayout(4, false);
- if (inSearchContainer()) {
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- }
- control.setLayout(layout);
-
- createTitleGroup(control);
-
- summaryField = new TextSearchField("summary"); //$NON-NLS-1$
- summaryField.createControls(control, Messages.TracQueryPage_Summary);
-
- descriptionField = new TextSearchField("description"); //$NON-NLS-1$
- descriptionField.createControls(control, Messages.TracQueryPage_Description);
-
- keywordsField = new TextSearchField("keywords"); //$NON-NLS-1$
- keywordsField.createControls(control, Messages.TracQueryPage_Keywords);
-
- createOptionsGroup(control);
-
- createUserGroup(control);
-
- if (getQuery() != null) {
- titleText.setText(getQuery().getSummary());
- TracSearch search = TracUtil.toTracSearch(getQuery());
- if (search != null) {
- restoreWidgetValues(search);
- }
- }
-
- Dialog.applyDialogFont(control);
- setControl(control);
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return false;
- }
-
- private void restoreWidgetValues(TracSearch search) {
- java.util.List<TracSearchFilter> filters = search.getFilters();
- for (TracSearchFilter filter : filters) {
- SearchField field = searchFieldByName.get(filter.getFieldName());
- if (field != null) {
- field.setFilter(filter);
- } else {
- StatusHandler.log(new Status(IStatus.WARNING, TracUiPlugin.ID_PLUGIN,
- "Ignoring invalid search filter: " + filter)); //$NON-NLS-1$
- }
- }
- }
-
- private void createTitleGroup(Composite control) {
- if (inSearchContainer()) {
- return;
- }
-
- Label titleLabel = new Label(control, SWT.NONE);
- titleLabel.setText(Messages.TracQueryPage_Query_Title);
-
- titleText = new Text(control, SWT.BORDER);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalSpan = 3;
- titleText.setLayoutData(gd);
- titleText.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- // ignore
- }
-
- public void keyReleased(KeyEvent e) {
- getContainer().updateButtons();
- }
- });
- }
-
- protected Control createOptionsGroup(Composite control) {
- Group group = new Group(control, SWT.NONE);
- // group.setText("Ticket Attributes");
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- group.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 4;
- group.setLayoutData(gd);
-
- createProductAttributes(group);
- createTicketAttributes(group);
- createUpdateButton(group);
-
- return group;
- }
-
- protected void createUserGroup(Composite control) {
- UserSearchField userField = new UserSearchField();
- userField.createControls(control);
- }
-
- /**
- * Creates the area for selection on product attributes component/version/milestone.
- */
- protected Control createProductAttributes(Composite control) {
- Composite group = new Composite(control, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- group.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 1;
- group.setLayoutData(gd);
-
- Label label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Component);
-
- label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Version);
-
- label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Milestone);
-
- componentField = new ListSearchField("component"); //$NON-NLS-1$
- componentField.createControls(group, PRODUCT_HEIGHT);
-
- versionField = new ListSearchField("version"); //$NON-NLS-1$
- versionField.createControls(group, PRODUCT_HEIGHT);
-
- milestoneField = new ListSearchField("milestone"); //$NON-NLS-1$
- milestoneField.createControls(group, PRODUCT_HEIGHT);
-
- return group;
- }
-
- /**
- * Creates the area for selection of ticket attributes status/resolution/priority.
- */
- protected Control createTicketAttributes(Composite control) {
- Composite group = new Composite(control, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- group.setLayout(layout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 1;
- group.setLayoutData(gd);
-
- Label label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Status);
-
- label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Resolution);
-
- label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Type);
-
- label = new Label(group, SWT.LEFT);
- label.setText(Messages.TracQueryPage_Priority);
-
- statusField = new ListSearchField("status"); //$NON-NLS-1$
- statusField.createControls(group, STATUS_HEIGHT);
-
- resolutionField = new ListSearchField("resolution"); //$NON-NLS-1$
- resolutionField.createControls(group, STATUS_HEIGHT);
-
- typeField = new ListSearchField("type"); //$NON-NLS-1$
- typeField.createControls(group, STATUS_HEIGHT);
-
- priorityField = new ListSearchField("priority"); //$NON-NLS-1$
- priorityField.createControls(group, STATUS_HEIGHT);
-
- return group;
- }
-
- protected Control createUpdateButton(final Composite control) {
- Composite group = new Composite(control, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- group.setLayout(layout);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- updateButton = new Button(group, SWT.PUSH);
- updateButton.setText(Messages.TracQueryPage_Update_Attributes_from_Repository);
- updateButton.setLayoutData(new GridData());
- updateButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (getTaskRepository() != null) {
- updateAttributesFromRepository(true);
- } else {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
- Messages.TracQueryPage_Update_Attributes_Failed,
- Messages.TracQueryPage_No_repository_available);
- }
- }
- });
-
- return group;
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- if (getSearchContainer() != null) {
- getSearchContainer().setPerformActionEnabled(true);
- }
-
- if (visible && firstTime) {
- firstTime = false;
- if (!hasAttributes()) {
- // delay the execution so the dialog's progress bar is visible
- // when the attributes are updated
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl() != null && !getControl().isDisposed()) {
- initializePage();
- }
- }
-
- });
- } else {
- // no remote connection is needed to get attributes therefore do
- // not use delayed execution to avoid flickering
- initializePage();
- }
- }
- }
-
- private void initializePage() {
- updateAttributesFromRepository(false);
- boolean restored = (getQuery() != null);
- if (inSearchContainer()) {
- restored |= restoreWidgetValues();
- }
- if (!restored) {
- // initialize with default values
- }
- }
-
- private boolean hasAttributes() {
- TracRepositoryConnector connector = (TracRepositoryConnector) TasksUi.getRepositoryManager()
- .getRepositoryConnector(TracCorePlugin.CONNECTOR_KIND);
- ITracClient client = connector.getClientManager().getTracClient(getTaskRepository());
- return client.hasAttributes();
- }
-
- private void updateAttributesFromRepository(final boolean force) {
- TracRepositoryConnector connector = (TracRepositoryConnector) TasksUi.getRepositoryManager()
- .getRepositoryConnector(TracCorePlugin.CONNECTOR_KIND);
- final ITracClient client = connector.getClientManager().getTracClient(getTaskRepository());
-
- if (!client.hasAttributes() || force) {
- try {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- client.updateAttributes(monitor, force);
- } catch (TracException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
-
- if (getContainer() != null) {
- getContainer().run(true, true, runnable);
- } else if (getSearchContainer() != null) {
- getSearchContainer().getRunnableContext().run(true, true, runnable);
- } else {
- IProgressService service = PlatformUI.getWorkbench().getProgressService();
- service.busyCursorWhile(runnable);
- }
- } catch (InvocationTargetException e) {
- setErrorMessage(TracCorePlugin.toStatus(e.getCause(), getTaskRepository()).getMessage());
- return;
- } catch (InterruptedException e) {
- return;
- }
- }
-
- statusField.setValues(client.getTicketStatus());
- resolutionField.setValues(client.getTicketResolutions());
- typeField.setValues(client.getTicketTypes());
- priorityField.setValues(client.getPriorities());
-
- componentField.setValues(client.getComponents());
- versionField.setValues(client.getVersions());
- milestoneField.setValues(client.getMilestones());
- }
-
- @Override
- public boolean isPageComplete() {
- if (titleText != null && titleText.getText().length() > 0) {
- return true;
- }
- return false;
- }
-
- public String getQueryUrl(String repsitoryUrl) {
- TracSearch search = getTracSearch();
-
- StringBuilder sb = new StringBuilder();
- sb.append(repsitoryUrl);
- sb.append(ITracClient.QUERY_URL);
- sb.append(search.toUrl());
- return sb.toString();
- }
-
- private TracSearch getTracSearch() {
- TracSearch search = new TracSearch();
- for (SearchField field : searchFieldByName.values()) {
- TracSearchFilter filter = field.getFilter();
- if (filter != null) {
- search.addFilter(filter);
- }
- }
- return search;
- }
-
- // public boolean performAction() {
- //
- // Proxy proxySettings = TasksUiPlugin.getDefault().getProxySettings();
- // SearchHitCollector collector = new
- // SearchHitCollector(TasksUiPlugin.getTaskList(),
- // repository, getQuery(), proxySettings);
- // NewSearchUI.runQueryInBackground(collector);
- //
- // return true;
- // }
-
- @Override
- public boolean performSearch() {
- if (inSearchContainer()) {
- saveState();
- }
-
- return super.performSearch();
- }
-
- @Override
- public IDialogSettings getDialogSettings() {
- IDialogSettings settings = TracUiPlugin.getDefault().getDialogSettings();
- IDialogSettings dialogSettings = settings.getSection(PAGE_NAME);
- if (dialogSettings == null) {
- dialogSettings = settings.addNewSection(PAGE_NAME);
- }
- return dialogSettings;
- }
-
- private boolean restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- String repoId = "." + getTaskRepository().getRepositoryUrl(); //$NON-NLS-1$
-
- String searchUrl = settings.get(SEARCH_URL_ID + repoId);
- if (searchUrl == null) {
- return false;
- }
-
- restoreWidgetValues(new TracSearch(searchUrl));
- return true;
- }
-
- @Override
- public void saveState() {
- String repoId = "." + getTaskRepository().getRepositoryUrl(); //$NON-NLS-1$
- IDialogSettings settings = getDialogSettings();
- settings.put(SEARCH_URL_ID + repoId, getTracSearch().toUrl());
- }
-
- private abstract class SearchField {
-
- protected String fieldName;
-
- public SearchField(String fieldName) {
- this.fieldName = fieldName;
-
- if (fieldName != null) {
- assert !searchFieldByName.containsKey(fieldName);
- searchFieldByName.put(fieldName, this);
- }
- }
-
- public String getFieldName() {
- return fieldName;
- }
-
- public abstract TracSearchFilter getFilter();
-
- public abstract void setFilter(TracSearchFilter filter);
-
- }
-
- private class TextSearchField extends SearchField {
-
- private Combo conditionCombo;
-
- protected Text searchText;
-
- private Label label;
-
- private final CompareOperator[] compareOperators = { CompareOperator.CONTAINS, CompareOperator.CONTAINS_NOT,
- CompareOperator.BEGINS_WITH, CompareOperator.ENDS_WITH, CompareOperator.IS, CompareOperator.IS_NOT, };
-
- public TextSearchField(String fieldName) {
- super(fieldName);
- }
-
- public void createControls(Composite parent, String labelText) {
- if (labelText != null) {
- label = new Label(parent, SWT.LEFT);
- label.setText(labelText);
- }
-
- conditionCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- for (CompareOperator op : compareOperators) {
- conditionCombo.add(op.toString());
- }
- conditionCombo.setText(compareOperators[0].toString());
-
- searchText = new Text(parent, SWT.BORDER);
- GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
- // the user search field has additional controls and no fieldName
- if (fieldName != null) {
- gd.horizontalSpan = 2;
- }
- searchText.setLayoutData(gd);
- }
-
- public CompareOperator getCondition() {
- return compareOperators[conditionCombo.getSelectionIndex()];
- }
-
- public String getSearchText() {
- return searchText.getText();
- }
-
- public boolean setCondition(CompareOperator operator) {
- if (conditionCombo != null) {
- int i = conditionCombo.indexOf(operator.toString());
- if (i != -1) {
- conditionCombo.select(i);
- return true;
- }
- }
- return false;
- }
-
- public void setSearchText(String text) {
- searchText.setText(text);
- }
-
- @Override
- public TracSearchFilter getFilter() {
- String text = getSearchText();
- if (text.length() == 0) {
- return null;
- }
-
- TracSearchFilter newFilter = new TracSearchFilter(getFieldName());
- newFilter.setOperator(getCondition());
- newFilter.addValue(getSearchText());
- return newFilter;
- }
-
- @Override
- public void setFilter(TracSearchFilter filter) {
- setCondition(filter.getOperator());
- java.util.List<String> values = filter.getValues();
- setSearchText(values.get(0));
- }
-
- public void setFieldName(String fieldName) {
- this.fieldName = fieldName;
- }
-
- }
-
- private class ListSearchField extends SearchField {
-
- private List list;
-
- public ListSearchField(String fieldName) {
- super(fieldName);
- }
-
- public void setValues(Object[] items) {
- // preserve selected values
- TracSearchFilter filter = getFilter();
-
- list.removeAll();
- if (items != null) {
- list.setEnabled(true);
- for (Object item : items) {
- list.add(item.toString());
- }
-
- // restore selected values
- if (filter != null) {
- setFilter(filter);
- }
- } else {
- list.setEnabled(false);
- }
- }
-
- public void createControls(Composite parent, int height) {
- list = new List(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.heightHint = height;
- list.setLayoutData(gd);
- }
-
- @Override
- public TracSearchFilter getFilter() {
- int[] indicies = list.getSelectionIndices();
- if (indicies.length == 0) {
- return null;
- }
-
- TracSearchFilter newFilter = new TracSearchFilter(getFieldName());
- newFilter.setOperator(CompareOperator.IS);
- for (int i : indicies) {
- newFilter.addValue(list.getItem(i));
- }
- return newFilter;
- }
-
- @Override
- public void setFilter(TracSearchFilter filter) {
- list.deselectAll();
- java.util.List<String> values = filter.getValues();
- for (String item : values) {
- int i = list.indexOf(item);
- if (i != -1) {
- list.select(i);
- } else {
- list.add(item, 0);
- list.select(0);
- }
- }
- }
-
- public void selectItems(String[] items) {
- list.deselectAll();
- for (String item : items) {
- int i = list.indexOf(item);
- if (i != -1) {
- list.select(i);
- }
- }
- }
-
- }
-
- private class UserSearchField extends SearchField {
-
- private final TextSearchField textField;
-
- private Combo userCombo;
-
- public UserSearchField() {
- super(null);
-
- textField = new TextSearchField(null);
-
- new UserSelectionSearchField("owner", 0); //$NON-NLS-1$
-
- new UserSelectionSearchField("reporter", 1); //$NON-NLS-1$
-
- new UserSelectionSearchField("cc", 2); //$NON-NLS-1$
- }
-
- public void createControls(Composite parent) {
- userCombo = new Combo(parent, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
- userCombo.add(Messages.TracQueryPage_Owner);
- userCombo.add(Messages.TracQueryPage_Reporter);
- userCombo.add(Messages.TracQueryPage_CC);
- userCombo.select(0);
-
- textField.createControls(parent, null);
- }
-
- @Override
- public TracSearchFilter getFilter() {
- return null;
- }
-
- @Override
- public void setFilter(TracSearchFilter filter) {
- }
-
- private void setSelection(int index) {
- userCombo.select(index);
- }
-
- private int getSelection() {
- return userCombo.getSelectionIndex();
- }
-
- class UserSelectionSearchField extends SearchField {
-
- private final int index;
-
- public UserSelectionSearchField(String fieldName, int index) {
- super(fieldName);
-
- this.index = index;
- }
-
- @Override
- public TracSearchFilter getFilter() {
- if (index == getSelection()) {
- textField.setFieldName(fieldName);
- return textField.getFilter();
- }
- return null;
- }
-
- @Override
- public void setFilter(TracSearchFilter filter) {
- textField.setFieldName(fieldName);
- textField.setFilter(filter);
- setSelection(index);
- }
-
- }
-
- }
-
- @Override
- public String getQueryTitle() {
- return (titleText != null) ? titleText.getText() : null;
- }
-
- @Override
- public void applyTo(IRepositoryQuery query) {
- query.setUrl(getQueryUrl(getTaskRepository().getRepositoryUrl()));
- query.setSummary(getQueryTitle());
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java
deleted file mode 100644
index 5952282d4..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel 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:
- * Tasktop Technologies - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.mylyn.commons.net.AbstractWebLocation;
-import org.eclipse.mylyn.internal.trac.core.TracClientFactory;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.client.TracException;
-import org.eclipse.mylyn.internal.trac.core.client.TracLoginException;
-import org.eclipse.mylyn.internal.trac.core.client.TracPermissionDeniedException;
-import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
-import org.eclipse.mylyn.internal.trac.ui.TracUiPlugin;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;
-import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * @author Steffen Pingel
- */
-public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage {
-
- private static final String TITLE = Messages.TracRepositorySettingsPage_Trac_Repository_Settings;
-
- private static final String DESCRIPTION = Messages.TracRepositorySettingsPage_EXAMPLE_HTTP_TRAC_EDGEWALL_ORG;
-
- private Combo accessTypeCombo;
-
- /** Supported access types. */
- private Version[] versions;
-
- public TracRepositorySettingsPage(TaskRepository taskRepository) {
- super(TITLE, DESCRIPTION, taskRepository);
- setNeedsAnonymousLogin(true);
- setNeedsEncoding(false);
- setNeedsTimeZone(false);
- }
-
- @Override
- protected void repositoryTemplateSelected(RepositoryTemplate template) {
- repositoryLabelEditor.setStringValue(template.label);
- setUrl(template.repositoryUrl);
- setAnonymous(template.anonymous);
-
- try {
- Version version = Version.valueOf(template.version);
- setTracVersion(version);
- } catch (RuntimeException ex) {
- setTracVersion(Version.TRAC_0_9);
- }
-
- getContainer().updateButtons();
- }
-
- @Override
- protected void createAdditionalControls(final Composite parent) {
- addRepositoryTemplatesToServerUrlCombo();
-
- Label accessTypeLabel = new Label(parent, SWT.NONE);
- accessTypeLabel.setText(Messages.TracRepositorySettingsPage_Access_Type_);
- accessTypeCombo = new Combo(parent, SWT.READ_ONLY);
-
- accessTypeCombo.add(Messages.TracRepositorySettingsPage_Automatic__Use_Validate_Settings_);
- versions = Version.values();
- for (Version version : versions) {
- accessTypeCombo.add(version.toString());
- }
- if (repository != null) {
- setTracVersion(Version.fromVersion(repository.getVersion()));
- } else {
- setTracVersion(null);
- }
- accessTypeCombo.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- if (accessTypeCombo.getSelectionIndex() > 0) {
- setVersion(versions[accessTypeCombo.getSelectionIndex() - 1].name());
- }
- getWizard().getContainer().updateButtons();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- // ignore
- }
- });
- }
-
- @Override
- public boolean isPageComplete() {
- // make sure "Automatic" is not selected as a version
- return super.isPageComplete() && accessTypeCombo != null && accessTypeCombo.getSelectionIndex() != 0;
- }
-
- @Override
- protected boolean isValidUrl(String name) {
- if ((name.startsWith(URL_PREFIX_HTTPS) || name.startsWith(URL_PREFIX_HTTP)) && !name.endsWith("/")) { //$NON-NLS-1$
- try {
- new URL(name);
- return true;
- } catch (MalformedURLException e) {
- }
- }
- return false;
- }
-
- public Version getTracVersion() {
- if (accessTypeCombo.getSelectionIndex() == 0) {
- return null;
- } else {
- return versions[accessTypeCombo.getSelectionIndex() - 1];
- }
- }
-
- public void setTracVersion(Version version) {
- if (version == null) {
- // select "Automatic"
- accessTypeCombo.select(0);
- } else {
- int i = accessTypeCombo.indexOf(version.toString());
- if (i != -1) {
- accessTypeCombo.select(i);
- }
- setVersion(version.name());
- }
- }
-
- @Override
- protected void applyValidatorResult(Validator validator) {
- super.applyValidatorResult(validator);
-
- if (((TracValidator) validator).getResult() != null) {
- setTracVersion(((TracValidator) validator).getResult());
- }
- }
-
- // public for testing
- public class TracValidator extends Validator {
-
- private final String repositoryUrl;
-
- private final TaskRepository taskRepository;
-
- private final Version version;
-
- private Version result;
-
- public TracValidator(TaskRepository taskRepository, Version version) {
- this.repositoryUrl = taskRepository.getRepositoryUrl();
- this.taskRepository = taskRepository;
- this.version = version;
- }
-
- @Override
- public void run(IProgressMonitor monitor) throws CoreException {
- try {
- //validate(Provider.of(monitor));
- validate(monitor);
- } catch (MalformedURLException e) {
- throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR,
- TracUiPlugin.ID_PLUGIN, INVALID_REPOSITORY_URL));
- } catch (TracLoginException e) {
- throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR,
- TracUiPlugin.ID_PLUGIN, INVALID_LOGIN));
- } catch (TracPermissionDeniedException e) {
- throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR,
- TracUiPlugin.ID_PLUGIN, "Insufficient permissions for selected access type.")); //$NON-NLS-1$
- } catch (TracException e) {
- String message = Messages.TracRepositorySettingsPage_No_Trac_repository_found_at_url;
- if (e.getMessage() != null) {
- message += ": " + e.getMessage(); //$NON-NLS-1$
- }
- throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR,
- TracUiPlugin.ID_PLUGIN, message));
- }
- }
-
- public void validate(IProgressMonitor monitor) throws MalformedURLException, TracException {
- AbstractWebLocation location = new TaskRepositoryLocationFactory().createWebLocation(taskRepository);
-
- if (version != null) {
- ITracClient client = TracClientFactory.createClient(location, version);
- client.validate(monitor);
- } else {
- // probe version: XML-RPC access first, then web
- // access
- try {
- ITracClient client = TracClientFactory.createClient(location, Version.XML_RPC);
- client.validate(monitor);
- result = Version.XML_RPC;
- } catch (TracException e) {
- try {
- ITracClient client = TracClientFactory.createClient(location, Version.TRAC_0_9);
- client.validate(monitor);
- result = Version.TRAC_0_9;
-
- if (e instanceof TracPermissionDeniedException) {
- setStatus(RepositoryStatus.createStatus(repositoryUrl, IStatus.INFO,
- TracUiPlugin.ID_PLUGIN,
- Messages.TracRepositorySettingsPage_Authentication_credentials_are_valid));
- }
- } catch (TracLoginException e2) {
- throw e;
- } catch (TracException e2) {
- throw new TracException();
- }
- }
- }
- }
-
- public Version getResult() {
- return result;
- }
-
- }
-
- @Override
- protected Validator getValidator(TaskRepository repository) {
- return new TracValidator(repository, getTracVersion());
- }
-
- @Override
- public String getConnectorKind() {
- return TracCorePlugin.CONNECTOR_KIND;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties
deleted file mode 100644
index 5d39ba92d..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/messages.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-TracFilterQueryPage_Add_search_filters_to_define_query=Add search filters to define query.
-TracFilterQueryPage_CC=CC
-TracFilterQueryPage_Component=Component
-TracFilterQueryPage_Keywords=Keywords
-TracFilterQueryPage_Milestone=Milestone
-TracFilterQueryPage_New_Trac_Query=New Trac Query
-TracFilterQueryPage_or=or
-TracFilterQueryPage_Owner=Owner
-TracFilterQueryPage_Priority=Priority
-TracFilterQueryPage_Query_Title=Query Title
-TracFilterQueryPage_Reporter=Reporter
-TracFilterQueryPage_Resolution=Resolution
-TracFilterQueryPage_Select_to_add_filter=Select to add filter:
-TracFilterQueryPage_Status=Status
-TracFilterQueryPage_Summary=Summary
-TracFilterQueryPage_Type=Type
-TracFilterQueryPage_Version=Version
-
-TracQueryPage_CC=CC
-TracQueryPage_Component=Component
-TracQueryPage_Description=Description
-TracQueryPage_Enter_query_parameters=Enter query parameters
-TracQueryPage_If_attributes_are_blank_or_stale_press_the_Update_button=If attributes are blank or stale press the Update button.
-TracQueryPage_Keywords=Keywords
-TracQueryPage_Milestone=Milestone
-TracQueryPage_No_repository_available=No repository available, please add one using the Task Repositories view.
-TracQueryPage_Owner=Owner
-TracQueryPage_Priority=Priority
-TracQueryPage_Query_Title=Query Title:
-TracQueryPage_Reporter=Reporter
-TracQueryPage_Resolution=Resolution
-TracQueryPage_Status=Status
-TracQueryPage_Summary=Summary
-TracQueryPage_Type=Type
-TracQueryPage_Update_Attributes_Failed=Update Attributes Failed
-TracQueryPage_Update_Attributes_from_Repository=Update Attributes from Repository
-TracQueryPage_Version=Version
-
-TracRepositorySettingsPage_Access_Type_=Access Type:
-TracRepositorySettingsPage_Authentication_credentials_are_valid=Authentication credentials are valid. Note: Insufficient permissions for XML-RPC access, falling back to web access.
-TracRepositorySettingsPage_Automatic__Use_Validate_Settings_=Automatic (Use Validate Settings)
-TracRepositorySettingsPage_EXAMPLE_HTTP_TRAC_EDGEWALL_ORG=Example: http://trac.edgewall.org
-TracRepositorySettingsPage_No_Trac_repository_found_at_url=No Trac repository found at url
-TracRepositorySettingsPage_Trac_Repository_Settings=Trac Repository Settings

Back to the top