Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2008-06-13 06:27:07 -0400
committerspingel2008-06-13 06:27:07 -0400
commitb4996338b46ec9be20eddec644f74ccbc47bd42c (patch)
tree8a1b4007d8cd67d598802ec410a7b32215b22884 /org.eclipse.mylyn.trac.ui
parent6e6c278e32df5acf18d6c4636f8e0b86fe15a9ee (diff)
downloadorg.eclipse.mylyn.tasks-b4996338b46ec9be20eddec644f74ccbc47bd42c.tar.gz
org.eclipse.mylyn.tasks-b4996338b46ec9be20eddec644f74ccbc47bd42c.tar.xz
org.eclipse.mylyn.tasks-b4996338b46ec9be20eddec644f74ccbc47bd42c.zip
NEW - bug 235011: port Trac to Mylyn 3.0 APIs
https://bugs.eclipse.org/bugs/show_bug.cgi?id=235011
Diffstat (limited to 'org.eclipse.mylyn.trac.ui')
-rw-r--r--org.eclipse.mylyn.trac.ui/plugin.xml19
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java55
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracHyperlinkDetector.java2
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java (renamed from org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java)34
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListFactory.java80
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListMigrator.java66
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracUiPlugin.java7
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java77
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracCcAttributeEditor.java87
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracPeoplePart.java106
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java54
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorFactory.java101
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPage.java77
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java74
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/EditTracQueryWizard.java58
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracQueryWizard.java64
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracTaskPage.java139
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java (renamed from org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java)45
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java (renamed from org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java)50
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java2
20 files changed, 506 insertions, 691 deletions
diff --git a/org.eclipse.mylyn.trac.ui/plugin.xml b/org.eclipse.mylyn.trac.ui/plugin.xml
index a3d1beaa9..0fb189241 100644
--- a/org.eclipse.mylyn.trac.ui/plugin.xml
+++ b/org.eclipse.mylyn.trac.ui/plugin.xml
@@ -7,17 +7,17 @@
point="org.eclipse.mylyn.tasks.ui.repositories">
<connectorCore
class="org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector"
- id="org.eclipse.mylyn.trac.tasklist.repositories"
- name="Trac Repository Connector"/>
+ id="trac"
+ name="Trac Connector Core"/>
<connectorUi
brandingIcon="icons/eview16/trac-icon.gif"
class="org.eclipse.mylyn.internal.trac.ui.TracConnectorUi"
- id="Trac Repository UI"
+ id="trac"
+ name="Trac Connector UI"
overlayIcon="icons/eview16/overlay-trac.gif"/>
- <taskListFactory
- class="org.eclipse.mylyn.internal.trac.ui.TracTaskListFactory"
- id="org.eclipse.mylyn.trac.tasklist.taskListFactory"
- name="Trac Externalizer"/>
+ <taskListMigrator
+ class="org.eclipse.mylyn.internal.trac.ui.TracTaskListMigrator">
+ </taskListMigrator>
</extension>
<extension
point="org.eclipse.mylyn.tasks.core.templates">
@@ -31,7 +31,10 @@
</extension>
<extension
point="org.eclipse.mylyn.tasks.ui.editors">
- <editorFactory class="org.eclipse.mylyn.internal.trac.ui.editor.TracTaskEditorFactory"/>
+ <pageFactory
+ class="org.eclipse.mylyn.internal.trac.ui.editor.TracTaskEditorPageFactory"
+ id="org.eclipse.mylyn.trac.ui.pageFactory">
+ </pageFactory>
</extension>
<extension
point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
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
index af4e75053..a1bba5c70 100644
--- 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
@@ -18,22 +18,20 @@ import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylyn.internal.trac.core.ITracClient;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
-import org.eclipse.mylyn.internal.trac.core.TracTask;
-import org.eclipse.mylyn.internal.trac.core.TracTask.Kind;
-import org.eclipse.mylyn.internal.trac.ui.wizard.EditTracQueryWizard;
-import org.eclipse.mylyn.internal.trac.ui.wizard.NewTracQueryWizard;
-import org.eclipse.mylyn.internal.trac.ui.wizard.TracCustomQueryPage;
+import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector.TaskKind;
+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.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;
/**
* @author Mik Kersten
@@ -41,6 +39,11 @@ import org.eclipse.mylyn.tasks.ui.wizards.NewWebTaskWizard;
*/
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);
@@ -58,7 +61,7 @@ public class TracConnectorUi extends AbstractRepositoryConnectorUi {
@Override
public ITaskSearchPage getSearchPage(TaskRepository repository, IStructuredSelection selection) {
- return new TracCustomQueryPage(repository);
+ return new TracQueryPage(repository);
}
@Override
@@ -78,47 +81,35 @@ public class TracConnectorUi extends AbstractRepositoryConnectorUi {
@Override
public IWizard getQueryWizard(TaskRepository repository, IRepositoryQuery query) {
- if (query instanceof TracRepositoryQuery) {
- return new EditTracQueryWizard(repository, query);
- } else {
- return new NewTracQueryWizard(repository);
- }
+ RepositoryQueryWizard wizard = new RepositoryQueryWizard(repository);
+ wizard.addPage(new TracQueryPage(repository, query));
+ return wizard;
}
@Override
public String getConnectorKind() {
- return TracCorePlugin.REPOSITORY_KIND;
+ return TracCorePlugin.CONNECTOR_KIND;
}
@Override
public ImageDescriptor getTaskKindOverlay(ITask task) {
- Kind kind = Kind.fromString(task.getTaskKind());
- if (kind == Kind.DEFECT) {
+ TaskKind taskKind = TaskKind.fromString(task.getTaskKind());
+ if (taskKind == TaskKind.DEFECT) {
return TracImages.OVERLAY_DEFECT;
- } else if (kind == Kind.ENHANCEMENT) {
+ } else if (taskKind == TaskKind.ENHANCEMENT) {
return TracImages.OVERLAY_ENHANCEMENT;
- } else if (kind == Kind.TASK) {
+ } else if (taskKind == TaskKind.TASK) {
return null;
}
return super.getTaskKindOverlay(task);
}
@Override
- public List<ITask> getLegendItems() {
- List<ITask> legendItems = new ArrayList<ITask>();
-
- TracTask defect = new TracTask("", Kind.DEFECT.name(), Kind.DEFECT.toString());
- defect.setTaskKind(Kind.DEFECT.toString());
- legendItems.add(defect);
-
- TracTask enhancement = new TracTask("", Kind.ENHANCEMENT.name(), Kind.ENHANCEMENT.toString());
- enhancement.setTaskKind(Kind.ENHANCEMENT.toString());
- legendItems.add(enhancement);
-
- TracTask task = new TracTask("", Kind.TASK.name(), Kind.TASK.toString());
- task.setTaskKind(Kind.TASK.toString());
- legendItems.add(task);
-
+ 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;
}
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
index f4d10a8f1..d6c9e2173 100644
--- 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
@@ -27,7 +27,7 @@ public class TracHyperlinkDetector extends AbstractHyperlinkDetector {
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
TaskRepository taskRepository = (TaskRepository) getAdapter(TaskRepository.class);
- if (taskRepository != null && TracCorePlugin.REPOSITORY_KIND.equals(taskRepository.getConnectorKind())) {
+ if (taskRepository != null && TracCorePlugin.CONNECTOR_KIND.equals(taskRepository.getConnectorKind())) {
IDocument document = textViewer.getDocument();
if (document == null) {
return null;
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java
index 660f34e2d..77b03270b 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracDuplicateDetector.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracSearchHandler.java
@@ -6,41 +6,45 @@
* http://www.eclipse.org/legal/epl-v10.html
*******************************************************************************/
-package org.eclipse.mylyn.internal.trac.ui.editor;
+package org.eclipse.mylyn.internal.trac.ui;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyDuplicateDetector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
+import org.eclipse.mylyn.internal.tasks.core.AbstractSearchHandler;
import org.eclipse.mylyn.internal.trac.core.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
+import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
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;
-public class TracDuplicateDetector extends AbstractLegacyDuplicateDetector {
+@SuppressWarnings("restriction")
+public class TracSearchHandler extends AbstractSearchHandler {
@Override
- public RepositoryQuery getDuplicatesQuery(TaskRepository repository, RepositoryTaskData taskData) {
+ public String getConnectorKind() {
+ return TracCorePlugin.CONNECTOR_KIND;
+ }
+
+ @Override
+ public boolean queryForText(TaskRepository taskRepository, IRepositoryQuery query, TaskData taskData,
+ String searchString) {
TracSearchFilter filter = new TracSearchFilter("description");
filter.setOperator(CompareOperator.CONTAINS);
-
- String searchString = AbstractLegacyDuplicateDetector.getStackTraceFromDescription(taskData.getDescription());
-
filter.addValue(searchString);
TracSearch search = new TracSearch();
search.addFilter(filter);
- // TODO copied from TracCustomQueryPage.getQueryUrl()
+ // TODO copied from TracQueryPage.getQueryUrl()
StringBuilder sb = new StringBuilder();
- sb.append(repository.getRepositoryUrl());
+ sb.append(taskRepository.getRepositoryUrl());
sb.append(ITracClient.QUERY_URL);
sb.append(search.toUrl());
- TracRepositoryQuery query = new TracRepositoryQuery(repository.getRepositoryUrl(), sb.toString(),
- "<Duplicate Search>");
- return query;
+ query.setUrl(sb.toString());
+
+ return true;
}
}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListFactory.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListFactory.java
deleted file mode 100644
index 9d8d51740..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractTaskListFactory;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
-import org.eclipse.mylyn.internal.trac.core.TracTask;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.w3c.dom.Element;
-
-/**
- * @author Steffen Pingel
- * @author Mik Kersten
- */
-public class TracTaskListFactory extends AbstractTaskListFactory {
-
- private static final String KEY_TRAC = "Trac";
-
- private static final String KEY_TRAC_TASK = KEY_TRAC + AbstractTaskListFactory.KEY_TASK;
-
- private static final String KEY_TRAC_QUERY = KEY_TRAC + AbstractTaskListFactory.KEY_QUERY;
-
- private static final String KEY_SUPPORTS_SUBTASKS = "SupportsSubtasks";
-
- @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 boolean canCreate(ITask task) {
- return task instanceof TracTask;
- }
-
- @Override
- public boolean canCreate(IRepositoryQuery category) {
- return category instanceof TracRepositoryQuery;
- }
-
- @Override
- public String getQueryElementName(IRepositoryQuery query) {
- return query instanceof TracRepositoryQuery ? KEY_TRAC_QUERY : "";
- }
-
- @Override
- public AbstractTask createTask(String repositoryUrl, String taskId, String summary, Element element) {
- boolean supportsSubtasks = false;
- if (element.hasAttribute(KEY_SUPPORTS_SUBTASKS)) {
- supportsSubtasks = Boolean.valueOf(element.getAttribute(KEY_SUPPORTS_SUBTASKS));
- }
-
- TracTask task = new TracTask(repositoryUrl, taskId, summary);
- task.setSupportsSubtasks(supportsSubtasks);
- return task;
- }
-
- @Override
- public RepositoryQuery createQuery(String repositoryUrl, String queryString, String label, Element element) {
- return new TracRepositoryQuery(repositoryUrl, queryString, label);
- }
-}
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
new file mode 100644
index 000000000..c34921414
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracTaskListMigrator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.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.TracUtils;
+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";
+
+ 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";
+
+ @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) {
+ task.setModificationDate(TracUtils.parseDate(element.getAttribute(KEY_LAST_MOD_DATE)));
+ 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
index 6790a10d4..dc5f42f0f 100644
--- 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
@@ -21,10 +21,6 @@ public class TracUiPlugin extends AbstractUIPlugin {
public static final String ID_PLUGIN = "org.eclipse.mylyn.trac.ui";
- public final static String TITLE_MESSAGE_DIALOG = "Mylyn Trac Client";
-
- public static final String NEW_BUG_EDITOR_ID = ID_PLUGIN + ".newBugEditor";
-
private static TracUiPlugin plugin;
public TracUiPlugin() {
@@ -42,8 +38,7 @@ public class TracUiPlugin extends AbstractUIPlugin {
@Override
public void stop(BundleContext context) throws Exception {
- TasksUi.getRepositoryManager().removeListener(
- TracCorePlugin.getDefault().getConnector().getClientManager());
+ TasksUi.getRepositoryManager().removeListener(TracCorePlugin.getDefault().getConnector().getClientManager());
plugin = null;
super.stop(context);
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
deleted file mode 100644
index 2c010b438..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/NewTracTaskEditor.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.jface.fieldassist.ContentProposalAdapter;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyDuplicateDetector;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
-import org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractNewRepositoryTaskEditor;
-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.swt.widgets.Text;
-import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
-import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Steffen Pingel
- */
-public class NewTracTaskEditor extends AbstractNewRepositoryTaskEditor {
-
- public NewTracTaskEditor(FormEditor editor) {
- super(editor);
- }
-
- @Override
- public AbstractLegacyDuplicateDetector getDuplicateDetector(String name) {
- return new TracDuplicateDetector();
- }
-
- @Override
- protected void createPeopleLayout(Composite composite) {
- FormToolkit toolkit = getManagedForm().getToolkit();
- Section peopleSection = createSection(composite, getSectionLabel(SECTION_NAME.PEOPLE_SECTION));
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(peopleSection);
- Composite peopleComposite = toolkit.createComposite(peopleSection);
- GridLayout layout = new GridLayout(2, false);
- layout.marginRight = 5;
- peopleComposite.setLayout(layout);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(peopleComposite);
-
- Label label = toolkit.createLabel(peopleComposite, "Assign to:");
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
- Composite textFieldComposite = toolkit.createComposite(peopleComposite);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(textFieldComposite);
- GridLayout textLayout = new GridLayout();
- textFieldComposite.setLayout(textLayout);
-
- RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED);
-
- Text textField = createTextField(textFieldComposite, attribute, SWT.FLAT);
- toolkit.paintBordersFor(textFieldComposite);
- GridDataFactory.fillDefaults().grab(true, false).applyTo(textField);
- peopleSection.setClient(peopleComposite);
-
- ContentAssistCommandAdapter adapter = applyContentAssist(textField, createContentProposalProvider(attribute));
-
- ILabelProvider propsalLabelProvider = createProposalLabelProvider(attribute);
- if (propsalLabelProvider != null) {
- adapter.setLabelProvider(propsalLabelProvider);
- }
- adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-
- toolkit.paintBordersFor(peopleComposite);
- }
-
-}
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
new file mode 100644
index 000000000..94a0f7bb2
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracCcAttributeEditor.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.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
new file mode 100644
index 000000000..491c0bfcc
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracPeoplePart.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.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("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, "");
+ Label label = toolkit.createLabel(peopleComposite, "(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;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java
deleted file mode 100644
index b79d969f6..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryOperation;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskAttribute;
-import org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractRepositoryTaskEditor;
-import org.eclipse.mylyn.internal.trac.core.TracAttributeFactory;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractRenderingEngine;
-import org.eclipse.ui.forms.editor.FormEditor;
-
-/**
- * @author Steffen Pingel
- * @author Xiaoyang Guan (Wiki HTML preview)
- */
-public class TracTaskEditor extends AbstractRepositoryTaskEditor {
-
- private final TracRenderingEngine renderingEngine = new TracRenderingEngine();
-
- public TracTaskEditor(FormEditor editor) {
- super(editor);
- }
-
- @Override
- protected void validateInput() {
- }
-
- @Override
- protected AbstractRenderingEngine getRenderingEngine() {
- return renderingEngine;
- }
-
- public TaskRepository getRepository() {
- return repository;
- }
-
- @Override
- protected boolean hasContentAssist(RepositoryTaskAttribute attribute) {
- return TracAttributeFactory.Attribute.NEW_CC.getTaskKey().equals(attribute.getId());
- }
-
- @Override
- protected boolean hasContentAssist(RepositoryOperation repositoryOperation) {
- return "owner".equals(repositoryOperation.getInputName());
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorFactory.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorFactory.java
deleted file mode 100644
index 3b8d899bf..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorFactory.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-import org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractTaskEditorFactory;
-import org.eclipse.mylyn.internal.tasks.ui.deprecated.RepositoryTaskEditorInput;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.TracTask;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-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.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * @author Steffen Pingel
- */
-public class TracTaskEditorFactory extends AbstractTaskEditorFactory {
-
- private static final String TITLE = "Browser";
-
- @Override
- public boolean canCreateEditorFor(ITask task) {
- return (task instanceof TracTask);
- }
-
- @Override
- public boolean canCreateEditorFor(IEditorInput input) {
- if (input instanceof RepositoryTaskEditorInput) {
- RepositoryTaskEditorInput taskInput = (RepositoryTaskEditorInput) input;
- return taskInput.getTaskData() != null
- && TracCorePlugin.REPOSITORY_KIND.equals(taskInput.getRepository().getConnectorKind());
- } else if (input instanceof TaskEditorInput) {
- TaskEditorInput taskInput = (TaskEditorInput) input;
- return taskInput.getTask() instanceof TracTask;
- }
-
- return false;
- }
-
- @Override
- public IEditorPart createEditor(TaskEditor parentEditor, IEditorInput editorInput) {
- if (editorInput instanceof RepositoryTaskEditorInput) {
- RepositoryTaskEditorInput taskInput = (RepositoryTaskEditorInput) editorInput;
- if (taskInput.getTaskData().isNew()) {
- return new NewTracTaskEditor(parentEditor);
- } else {
- return new TracTaskEditor(parentEditor);
- }
- } else if (editorInput instanceof TaskEditorInput) {
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(TracCorePlugin.REPOSITORY_KIND,
- ((TaskEditorInput) editorInput).getTask().getRepositoryUrl());
- if (TracRepositoryConnector.hasRichEditor(repository)) {
- // the editor is actually initialized with a RepositoryTaskEditorInput, see bug 193430
- return new TracTaskEditor(parentEditor);
- } else {
- return new BrowserFormPage(parentEditor, TITLE);
- }
- }
- return null;
- }
-
- @Override
- public IEditorInput createEditorInput(ITask task) {
- TracTask tracTask = (TracTask) task;
- TaskRepository repository = TasksUi.getRepositoryManager().getRepository(TracCorePlugin.REPOSITORY_KIND,
- tracTask.getRepositoryUrl());
- if (TracRepositoryConnector.hasRichEditor(repository)) {
- return new RepositoryTaskEditorInput(repository, tracTask.getTaskId(), tracTask.getUrl());
- } else {
- return new TaskEditorInput(repository, task) {
- @Override
- public ImageDescriptor getImageDescriptor() {
- return CommonImages.BROWSER_SMALL;
- }
- };
- }
- }
-
- @Override
- public String getTitle() {
- return "Trac";
- }
-
- @Override
- public boolean providesOutline() {
- return true;
- }
-}
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
new file mode 100644
index 000000000..30d8ecf0a
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPage.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.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()) {
+ @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
new file mode 100644
index 000000000..ca760f35b
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/editor/TracTaskEditorPageFactory.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Mylyn project committers and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.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, "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);
+ }
+
+ @Override
+ public String getPageText() {
+ return "Trac";
+ }
+
+ @Override
+ public int getPriority() {
+ return PRIORITY_TASK;
+ }
+
+}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/EditTracQueryWizard.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/EditTracQueryWizard.java
deleted file mode 100644
index 7c39da879..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/EditTracQueryWizard.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import org.eclipse.mylyn.internal.tasks.ui.deprecated.AbstractRepositoryQueryWizard;
-import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-
-/**
- * @author Steffen Pingel
- */
-public class EditTracQueryWizard extends AbstractRepositoryQueryWizard {
-
-// private TracCustomQueryPage queryPage;
-
- public EditTracQueryWizard(TaskRepository repository, IRepositoryQuery query) {
- super(repository, query);
- }
-
- @Override
- public void addPages() {
- page = new TracCustomQueryPage(repository, query);
- page.setWizard(this);
- addPage(page);
- }
-
- @Override
- public boolean canFinish() {
- if (page.getNextPage() == null) {
- return page.isPageComplete();
- }
- return page.getNextPage().isPageComplete();
- }
-
-// @Override
-// public boolean performFinish() {
-// AbstractRepositoryQuery q = queryPage.getQuery();
-// if (q != null) {
-// TasksUiPlugin.getTaskList().deleteQuery(query);
-// TasksUiPlugin.getTaskList().addQuery(q);
-//
-// AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
-// repository.getKind());
-// if (connector != null) {
-// TasksUiPlugin.getSynchronizationManager().synchronize(connector, q, null);
-// }
-// }
-//
-// return true;
-// }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracQueryWizard.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracQueryWizard.java
deleted file mode 100644
index 0702dfffc..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracQueryWizard.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractLegacyRepositoryConnector;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiImages;
-
-/**
- * @author Steffen Pingel
- */
-public class NewTracQueryWizard extends Wizard {
-
- private static final String TITLE = "New Trac Query";
-
- private final TaskRepository repository;
-
- private TracCustomQueryPage queryPage;
-
- public NewTracQueryWizard(TaskRepository repository) {
- this.repository = repository;
-
- setNeedsProgressMonitor(true);
- setWindowTitle(TITLE);
- setDefaultPageImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
- }
-
- @Override
- public void addPages() {
- queryPage = new TracCustomQueryPage(repository);
- queryPage.setWizard(this);
- addPage(queryPage);
- }
-
- @Override
- public boolean canFinish() {
- return queryPage.isPageComplete();
- }
-
- @Override
- public boolean performFinish() {
- RepositoryQuery query = queryPage.getQuery();
- if (query != null) {
- TasksUiInternal.getTaskList().addQuery(query);
- AbstractLegacyRepositoryConnector connector = (AbstractLegacyRepositoryConnector) TasksUi.getRepositoryManager()
- .getRepositoryConnector(repository.getConnectorKind());
- if (connector != null) {
- TasksUiInternal.synchronizeQuery(connector, query, null, true);
- }
- }
- return true;
- }
-
-} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracTaskPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracTaskPage.java
deleted file mode 100644
index 5f44b670c..000000000
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/NewTracTaskPage.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Mylyn project committers and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-
-package org.eclipse.mylyn.internal.trac.ui.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.AbstractAttributeFactory;
-import org.eclipse.mylyn.internal.tasks.core.deprecated.RepositoryTaskData;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.internal.trac.core.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
-import org.eclipse.mylyn.internal.trac.core.TracException;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.TracTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Wizard page for creating new Trac tickets through a rich editor.
- *
- * @author Steffen Pingel
- */
-public class NewTracTaskPage extends WizardPage {
-
- // private boolean firstTime;
-
- private final TaskRepository taskRepository;
-
- private RepositoryTaskData taskData;
-
- public NewTracTaskPage(TaskRepository taskRepository) {
- super("New Task");
-
- setTitle("Create via Rich Editor");
- setDescription("This will open an editor that can be used to create a new task.");
-
- this.taskRepository = taskRepository;
- }
-
- public void createControl(Composite parent) {
- Text text = new Text(parent, SWT.WRAP);
- text.setEditable(false);
- setControl(text);
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- // 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()) {
- // updateAttributesFromRepository();
- // }
- // }
- // });
- // }
- // }
- updateAttributesFromRepository();
- }
-
- // private boolean hasAttributes() {
- // TracRepositoryConnector connector = (TracRepositoryConnector)
- // TasksUiPlugin.getRepositoryManager()
- // .getRepositoryConnector(TracCorePlugin.REPOSITORY_KIND);
- // try {
- // ITracClient client =
- // connector.getClientManager().getRepository(taskRepository);
- // return client.hasAttributes();
- // } catch (MalformedURLException e) {
- // return false;
- // }
- // }
-
- @Override
- public boolean isPageComplete() {
- return taskData != null;
- }
-
- private void updateAttributesFromRepository() {
- TracRepositoryConnector connector = (TracRepositoryConnector) TasksUi.getRepositoryManager()
- .getRepositoryConnector(TracCorePlugin.REPOSITORY_KIND);
- final ITracClient client = connector.getClientManager().getTracClient(taskRepository);
-
- if (!client.hasAttributes()) {
- try {
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- client.updateAttributes(monitor, true);
- } catch (TracException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
-
- getContainer().run(true, true, runnable);
- } catch (InvocationTargetException e) {
- TasksUiInternal.displayStatus("Error updating attributes", TracCorePlugin.toStatus(e.getCause(),
- taskRepository));
- return;
- } catch (InterruptedException e) {
- return;
- }
- }
-
- TracTaskDataHandler offlineHandler = (TracTaskDataHandler) connector.getLegacyTaskDataHandler();
- AbstractAttributeFactory attributeFactory = offlineHandler.getAttributeFactory(taskRepository.getRepositoryUrl(),
- taskRepository.getConnectorKind(), AbstractTask.DEFAULT_TASK_KIND);
- this.taskData = new RepositoryTaskData(attributeFactory, TracCorePlugin.REPOSITORY_KIND,
- taskRepository.getRepositoryUrl(), TasksUiPlugin.getDefault().getNextNewRepositoryTaskId());
- this.taskData.setNew(true);
- TracTaskDataHandler.createDefaultAttributes(taskData.getAttributeFactory(), taskData, client, false);
- }
-
- public RepositoryTaskData getRepositoryTaskData() {
- return taskData;
- }
-
-}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java
index a26f938c4..a34059130 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryWizardPage.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracFilterQueryPage.java
@@ -15,16 +15,16 @@ import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.trac.core.ITracClient;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
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.TracUtils;
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;
@@ -44,7 +44,7 @@ import org.eclipse.swt.widgets.Text;
/**
* @author Steffen Pingel
*/
-public class TracQueryWizardPage extends WizardPage {
+public class TracFilterQueryPage extends AbstractRepositoryQueryPage {
private static final String TITLE = "New Trac Query";
@@ -52,10 +52,6 @@ public class TracQueryWizardPage extends WizardPage {
private static final String TITLE_QUERY_TITLE = "Query Title";
- private final TaskRepository repository;
-
- private final TracRepositoryQuery query;
-
private Text titleText;
private Composite scrollComposite;
@@ -65,18 +61,16 @@ public class TracQueryWizardPage extends WizardPage {
private List<SearchField> searchFields;
- public TracQueryWizardPage(TaskRepository repository, IRepositoryQuery query) {
- super(TITLE);
-
- this.repository = repository;
- this.query = (TracRepositoryQuery) query;
-
+ public TracFilterQueryPage(TaskRepository repository, IRepositoryQuery query) {
+ super(TITLE, repository, query);
setTitle(TITLE);
setDescription(DESCRIPTION);
}
- public TracQueryWizardPage(TaskRepository repository) {
- this(repository, null);
+ @Override
+ public void applyTo(IRepositoryQuery query) {
+ query.setUrl(getQueryUrl(getTaskRepository().getRepositoryUrl()));
+ query.setSummary(getQueryTitle());
}
public void createControl(Composite parent) {
@@ -97,16 +91,23 @@ public class TracQueryWizardPage extends WizardPage {
createAddFilterGroup(composite);
- if (query != null) {
- titleText.setText(query.getSummary());
- restoreSearchFilterFromQuery(query);
+ if (getQuery() != null) {
+ titleText.setText(getQuery().getSummary());
+ TracSearch search = TracUtils.toTracSearch(getQuery());
+ if (search != null) {
+ restoreWidgetValues(search);
+ }
}
setControl(composite);
}
- private void restoreSearchFilterFromQuery(TracRepositoryQuery query) {
- TracSearch search = query.getTracSearch();
+ @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());
@@ -230,10 +231,6 @@ public class TracQueryWizardPage extends WizardPage {
return sb.toString();
}
- public TracRepositoryQuery getQuery() {
- return new TracRepositoryQuery(repository.getRepositoryUrl(), getQueryUrl(repository.getRepositoryUrl()), titleText.getText());
- }
-
private void hideSearchField(SearchField field) {
visibleSearchFields.remove(field);
}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
index 8c5d25ce8..d286ee1b6 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracCustomQueryPage.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracQueryPage.java
@@ -18,16 +18,14 @@ 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.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.internal.trac.core.ITracClient;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.internal.trac.core.TracException;
import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
-import org.eclipse.mylyn.internal.trac.core.TracRepositoryQuery;
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.TracUtils;
import org.eclipse.mylyn.internal.trac.ui.TracUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -57,7 +55,7 @@ import org.eclipse.ui.progress.IProgressService;
*
* @author Steffen Pingel
*/
-public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
+public class TracQueryPage extends AbstractRepositoryQueryPage {
private static final String TITLE = "Enter query parameters";
@@ -65,8 +63,6 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
private static final String TITLE_QUERY_TITLE = "Query Title:";
- private final TracRepositoryQuery query;
-
private Text titleText;
private static final int PRODUCT_HEIGHT = 60;
@@ -113,14 +109,13 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
//
// private UserSearchField ccField;
- public TracCustomQueryPage(TaskRepository repository, IRepositoryQuery query) {
- super(TITLE, repository);
- this.query = (TracRepositoryQuery) query;
+ public TracQueryPage(TaskRepository repository, IRepositoryQuery query) {
+ super(TITLE, repository, query);
setTitle(TITLE);
setDescription(DESCRIPTION);
}
- public TracCustomQueryPage(TaskRepository repository) {
+ public TracQueryPage(TaskRepository repository) {
this(repository, null);
}
@@ -150,9 +145,12 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
createUserGroup(control);
- if (query != null) {
- titleText.setText(query.getSummary());
- restoreWidgetValues(query.getTracSearch());
+ if (getQuery() != null) {
+ titleText.setText(getQuery().getSummary());
+ TracSearch search = TracUtils.toTracSearch(getQuery());
+ if (search != null) {
+ restoreWidgetValues(search);
+ }
}
setControl(control);
@@ -308,8 +306,8 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
if (getTaskRepository() != null) {
updateAttributesFromRepository(true);
} else {
- MessageDialog.openInformation(Display.getCurrent().getActiveShell(),
- TracUiPlugin.TITLE_MESSAGE_DIALOG, TaskRepositoryManager.MESSAGE_NO_REPOSITORY);
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Update Attributes Failed",
+ "No repository available, please add one using the Task Repositories view.");
}
}
});
@@ -348,7 +346,7 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
private void initializePage() {
updateAttributesFromRepository(false);
- boolean restored = (query != null);
+ boolean restored = (getQuery() != null);
if (inSearchContainer()) {
restored |= restoreWidgetValues();
}
@@ -359,14 +357,14 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
private boolean hasAttributes() {
TracRepositoryConnector connector = (TracRepositoryConnector) TasksUi.getRepositoryManager()
- .getRepositoryConnector(TracCorePlugin.REPOSITORY_KIND);
+ .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.REPOSITORY_KIND);
+ .getRepositoryConnector(TracCorePlugin.CONNECTOR_KIND);
final ITracClient client = connector.getClientManager().getTracClient(getTaskRepository());
if (!client.hasAttributes() || force) {
@@ -390,8 +388,7 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
service.busyCursorWhile(runnable);
}
} catch (InvocationTargetException e) {
- TasksUiInternal.displayStatus("Error updating attributes", TracCorePlugin.toStatus(e.getCause(),
- getTaskRepository()));
+ setErrorMessage(TracCorePlugin.toStatus(e.getCause(), getTaskRepository()).getMessage());
return;
} catch (InterruptedException e) {
return;
@@ -437,16 +434,6 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
return search;
}
- @Override
- public TracRepositoryQuery getQuery() {
- return new TracRepositoryQuery(getTaskRepository().getRepositoryUrl(),
- getQueryUrl(getTaskRepository().getRepositoryUrl()), getTitleText());
- }
-
- private String getTitleText() {
- return (titleText != null) ? titleText.getText() : "<search>";
- }
-
// public boolean performAction() {
//
// Proxy proxySettings = TasksUiPlugin.getDefault().getProxySettings();
@@ -764,7 +751,8 @@ public class TracCustomQueryPage extends AbstractRepositoryQueryPage {
@Override
public void applyTo(IRepositoryQuery query) {
- throw new UnsupportedOperationException();
+ 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
index 065a8f046..1bc3197bf 100644
--- 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
@@ -239,7 +239,7 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage {
@Override
public String getConnectorKind() {
- return TracCorePlugin.REPOSITORY_KIND;
+ return TracCorePlugin.CONNECTOR_KIND;
}
}

Back to the top