diff options
Diffstat (limited to 'org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubTaskEditorPage.java')
-rw-r--r-- | org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubTaskEditorPage.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubTaskEditorPage.java b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubTaskEditorPage.java new file mode 100644 index 00000000..a24d8cb1 --- /dev/null +++ b/org.eclipse.mylyn.github.ui/src/org/eclipse/mylyn/github/ui/internal/GitHubTaskEditorPage.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2011 Red Hat 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: + * David Green <david.green@tasktop.com> - initial contribution + * Christian Trutz <christian.trutz@gmail.com> - initial contribution + * Chris Aniszczyk <caniszczyk@gmail.com> - initial contribution + *******************************************************************************/ +package org.eclipse.mylyn.github.ui.internal; + +import java.util.Iterator; +import java.util.Set; + +import org.eclipse.mylyn.github.internal.GitHub; +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.AttributeEditorFactory; +import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; +import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor; + +/** + * Editor page for GitHub. + */ +public class GitHubTaskEditorPage extends AbstractTaskEditorPage { + + /** + * Constructor for the GitHubTaskEditorPage + * + * @param editor + * The task editor to create for GitHub + */ + public GitHubTaskEditorPage(final TaskEditor editor) { + super(editor, GitHub.CONNECTOR_KIND); + setNeedsPrivateSection(true); + setNeedsSubmitButton(true); + } + + @Override + protected Set<TaskEditorPartDescriptor> createPartDescriptors() { + Set<TaskEditorPartDescriptor> partDescriptors = super.createPartDescriptors(); + Iterator<TaskEditorPartDescriptor> descriptorIt = partDescriptors.iterator(); + while (descriptorIt.hasNext()) { + TaskEditorPartDescriptor partDescriptor = descriptorIt.next(); + if (partDescriptor.getId().equals(ID_PART_ATTRIBUTES)) { + descriptorIt.remove(); + } else if (partDescriptor.getId().equals(ID_PART_COMMENTS)) { + // currently the API doesn't support reading existing comments, + // though it does allow for creating them. Silly really. + // see http://support.github.com/discussions/feature-requests/696-issues-api-improvement + descriptorIt.remove(); + } + } + return partDescriptors; + } + + + @Override + protected AttributeEditorFactory createAttributeEditorFactory() { + return new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) { + @Override + public AbstractAttributeEditor createEditor(String type, + TaskAttribute taskAttribute) { + // TODO Auto-generated method stub + return super.createEditor(type, taskAttribute); + } + }; + } +} |