Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java96
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java115
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java209
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java168
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java360
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java67
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java116
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java181
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java160
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java51
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties17
11 files changed, 0 insertions, 1540 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java
deleted file mode 100644
index 303cdf34a..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaCcAttributeEditor.java
+++ /dev/null
@@ -1,96 +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.bugzilla.ui.editor;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
-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 BugzillaCcAttributeEditor extends AbstractAttributeEditor {
-
- private List list;
-
- private TaskAttribute attrRemoveCc;
-
- public BugzillaCcAttributeEditor(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(BugzillaAttribute.REMOVECC.getKey());
-
- if (attrRemoveCc == null) {
- attrRemoveCc = BugzillaTaskDataHandler.createAttribute(getModel().getTaskData(), BugzillaAttribute.REMOVECC);
- }
-
- 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.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java
deleted file mode 100644
index d3a1b5ea9..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaKeywordAttributeEditor.java
+++ /dev/null
@@ -1,115 +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.bugzilla.ui.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
-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.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Rob Elves
- */
-public class BugzillaKeywordAttributeEditor extends AbstractAttributeEditor {
-
- private Text keywordsText;
-
- public BugzillaKeywordAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.MULTIPLE));
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Composite keywordComposite = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 1;
- keywordComposite.setLayout(layout);
-
- keywordsText = toolkit.createText(keywordComposite, getTaskAttribute().getValue());
- GridData keywordsData = new GridData(GridData.FILL_HORIZONTAL);
- keywordsText.setLayoutData(keywordsData);
- keywordsText.setEditable(false);
-
- Button changeKeywordsButton = toolkit.createButton(keywordComposite, Messages.BugzillaKeywordAttributeEditor_Edit_, SWT.FLAT);
- GridData keyWordsButtonData = new GridData();
- changeKeywordsButton.setLayoutData(keyWordsButtonData);
- changeKeywordsButton.addSelectionListener(new SelectionListener() {
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
-
- String keywords = getTaskAttribute().getValue();
-
- Shell shell = null;
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
- shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- } else {
- shell = new Shell(PlatformUI.getWorkbench().getDisplay());
- }
-
- List<String> validKeywords = new ArrayList<String>();
- try {
- validKeywords = BugzillaCorePlugin.getRepositoryConfiguration(getModel().getTaskRepository(),
- false, new NullProgressMonitor()).getKeywords();
- } catch (Exception ex) {
- // ignore
- }
-
- KeywordsDialog keywordsDialog = new KeywordsDialog(shell, keywords, validKeywords);
- int responseCode = keywordsDialog.open();
-
- String newKeywords = keywordsDialog.getSelectedKeywordsString();
- if (responseCode == Window.OK && keywords != null) {
- keywordsText.setText(newKeywords);
- getAttributeMapper().setValue(getTaskAttribute(), newKeywords);
- attributeChanged();
- } else {
- return;
- }
-
- }
-
- });
- setControl(keywordComposite);
- }
-
- @Override
- protected void decorateIncoming(Color color) {
- if (keywordsText != null && !keywordsText.isDisposed()) {
- keywordsText.setBackground(color);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java
deleted file mode 100644
index dab471107..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPeoplePart.java
+++ /dev/null
@@ -1,209 +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.bugzilla.ui.editor;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
-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 Rob Elves
- */
-public class BugzillaPeoplePart extends AbstractTaskEditorPart {
-
- private static final int COLUMN_MARGIN = 5;
-
- public BugzillaPeoplePart() {
- setPartName(Messages.BugzillaPeoplePart_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 (attribute.getId().equals(BugzillaAttribute.CC.getKey())) {
- 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)
- .hint(130, SWT.DEFAULT)
- .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));
- TaskAttribute assignee = getTaskData().getRoot().getAttribute(BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey());
- if (assignee != null) {
- addAttribute(peopleComposite, toolkit, assignee);
- }
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(TaskAttribute.USER_REPORTER));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.QA_CONTACT.getKey()));
- addAttribute(peopleComposite, toolkit, getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.NEWCC.getKey()));
- addSelfToCC(peopleComposite);
- TaskAttribute cc = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.CC.getKey());
- if (cc != null) {
- addAttribute(peopleComposite, toolkit, cc);
- toolkit.createLabel(peopleComposite, ""); //$NON-NLS-1$
- Label label = toolkit.createLabel(peopleComposite, Messages.BugzillaPeoplePart__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.
- */
- protected 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;
- }
-
- FormToolkit toolkit = getManagedForm().getToolkit();
- TaskAttribute attrAddToCC = getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC);
- if (attrAddToCC == null) {
- attrAddToCC = BugzillaTaskDataHandler.createAttribute(getTaskData(), BugzillaAttribute.ADDSELFCC);
- }
- addAttribute(composite, toolkit, attrAddToCC);
- }
-
-// protected void addCCList(Composite attributesComposite) {
-//
-// RepositoryTaskAttribute addCCattribute = taskData.getAttribute(RepositoryTaskAttribute.NEW_CC);
-// if (addCCattribute == null) {
-// // TODO: remove once TRAC is priming taskData with NEW_CC attribute
-// taskData.setAttributeValue(RepositoryTaskAttribute.NEW_CC, "");
-// addCCattribute = taskData.getAttribute(RepositoryTaskAttribute.NEW_CC);
-// }
-// if (addCCattribute != null) {
-// Label label = createLabel(attributesComposite, addCCattribute);
-// GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
-// Text text = createTextField(attributesComposite, addCCattribute, SWT.FLAT);
-// GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).applyTo(text);
-//
-// if (hasContentAssist(addCCattribute)) {
-// ContentAssistCommandAdapter adapter = applyContentAssist(text,
-// createContentProposalProvider(addCCattribute));
-// ILabelProvider propsalLabelProvider = createProposalLabelProvider(addCCattribute);
-// if (propsalLabelProvider != null) {
-// adapter.setLabelProvider(propsalLabelProvider);
-// }
-// adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-// }
-// }
-//
-// TaskAttribute CCattribute = getTaskData().getAttribute(TaskAttribute.USER_CC);
-// if (CCattribute != null) {
-// Label label = createLabel(attributesComposite, CCattribute);
-// GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.TOP).applyTo(label);
-// ccList = new org.eclipse.swt.widgets.List(attributesComposite, SWT.MULTI | SWT.V_SCROLL);// SWT.BORDER
-// ccList.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
-// ccList.setFont(TEXT_FONT);
-// GridData ccListData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-// ccListData.horizontalSpan = 1;
-// ccListData.widthHint = 150;
-// ccListData.heightHint = 95;
-// ccList.setLayoutData(ccListData);
-// if (hasChanged(taskData.getAttribute(RepositoryTaskAttribute.USER_CC))) {
-// ccList.setBackground(colorIncoming);
-// }
-// java.util.List<String> ccs = taskData.getCc();
-// if (ccs != null) {
-// for (String cc : ccs) {
-// ccList.add(cc);
-// }
-// }
-// java.util.List<String> removedCCs = taskData.getAttributeValues(RepositoryTaskAttribute.REMOVE_CC);
-// if (removedCCs != null) {
-// for (String item : removedCCs) {
-// int i = ccList.indexOf(item);
-// if (i != -1) {
-// ccList.select(i);
-// }
-// }
-// }
-// ccList.addSelectionListener(new SelectionListener() {
-//
-// public void widgetSelected(SelectionEvent e) {
-// for (String cc : ccList.getItems()) {
-// int index = ccList.indexOf(cc);
-// if (ccList.isSelected(index)) {
-// List<String> remove = taskData.getAttributeValues(RepositoryTaskAttribute.REMOVE_CC);
-// if (!remove.contains(cc)) {
-// taskData.addAttributeValue(RepositoryTaskAttribute.REMOVE_CC, cc);
-// }
-// } else {
-// taskData.removeAttributeValue(RepositoryTaskAttribute.REMOVE_CC, cc);
-// }
-// }
-// attributeChanged(taskData.getAttribute(RepositoryTaskAttribute.REMOVE_CC));
-// }
-//
-// public void widgetDefaultSelected(SelectionEvent e) {
-// }
-// });
-// toolkit.createLabel(attributesComposite, "");
-// label = toolkit.createLabel(attributesComposite, "(Select to remove)");
-// GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(label);
-// }
-
-// }
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java
deleted file mode 100644
index 5dde706bf..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaPlanningEditorPart.java
+++ /dev/null
@@ -1,168 +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.bugzilla.ui.editor;
-
-import java.util.EnumSet;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
-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.GridData;
-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.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Rob Elves
- */
-public class BugzillaPlanningEditorPart extends AbstractTaskEditorPart {
-
- private boolean hasIncoming;
-
- private static final Set<BugzillaAttribute> PLANNING_ATTRIBUTES = EnumSet.of(BugzillaAttribute.ACTUAL_TIME,
- BugzillaAttribute.ESTIMATED_TIME, BugzillaAttribute.WORK_TIME, BugzillaAttribute.REMAINING_TIME,
- BugzillaAttribute.DEADLINE);
-
- public BugzillaPlanningEditorPart() {
- setPartName(Messages.BugzillaPlanningEditorPart_Team_Planning);
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- initialize();
- Section timeSection = createSection(parent, toolkit, hasIncoming);
-
- GridLayout gl = new GridLayout();
- GridData gd = new GridData(SWT.FILL, SWT.NONE, false, false);
- gd.horizontalSpan = 4;
- timeSection.setLayout(gl);
- timeSection.setLayoutData(gd);
-
- Composite timeComposite = toolkit.createComposite(timeSection);
- gl = new GridLayout(6, false);
- timeComposite.setLayout(gl);
- gd = new GridData();
- gd.horizontalSpan = 4;
- timeComposite.setLayoutData(gd);
-
- TaskAttribute attribute = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.DEADLINE.getKey());
- if (attribute != null) {
- AbstractAttributeEditor attributeEditor = createAttributeEditor(attribute);
- attributeEditor.createLabelControl(timeComposite, toolkit);
- attributeEditor.createControl(timeComposite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor);
- }
-
- attribute = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.ESTIMATED_TIME.getKey());
- AbstractAttributeEditor attributeEditor = createAttributeEditor(attribute);
- attributeEditor.createLabelControl(timeComposite, toolkit);
- attributeEditor.createControl(timeComposite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor);
-
- Label label = toolkit.createLabel(timeComposite, Messages.BugzillaPlanningEditorPart_Current_Estimate);
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- float total = 0;
- try {
- TaskAttribute attrActualTime = getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.ACTUAL_TIME.getKey());
- float actual = 0;
- if (attrActualTime != null) {
- actual = Float.parseFloat(attrActualTime.getValue());
- }
- TaskAttribute attrRemainingTime = getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.REMAINING_TIME.getKey());
- float remaining = 0;
- if (attrRemainingTime != null) {
- remaining = Float.parseFloat(attrRemainingTime.getValue());
- }
- total = actual + remaining;
- } catch (Exception e) {
- // ignore NumberFormatException
- }
-
- Text currentEstimate = toolkit.createText(timeComposite, "" + total, SWT.FLAT | SWT.READ_ONLY); //$NON-NLS-1$
- currentEstimate.setFont(TEXT_FONT);
- toolkit.adapt(currentEstimate, false, false);
- currentEstimate.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
- currentEstimate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- attribute = getTaskData().getRoot().getMappedAttribute(BugzillaAttribute.ACTUAL_TIME.getKey());
- if (attribute != null) {
- attributeEditor = createAttributeEditor(attribute);
- attributeEditor.createLabelControl(timeComposite, toolkit);
- attributeEditor.createControl(timeComposite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor);
- }
-
- // Add Time
- TaskAttribute addTimeAttribute = getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.WORK_TIME.getKey());
- if (addTimeAttribute == null) {
- addTimeAttribute = BugzillaTaskDataHandler.createAttribute(getTaskData(), BugzillaAttribute.WORK_TIME);
-
- }
- if (addTimeAttribute != null) {
- addTimeAttribute.setValue("0"); //$NON-NLS-1$
- attributeEditor = createAttributeEditor(addTimeAttribute);
- attributeEditor.createLabelControl(timeComposite, toolkit);
- attributeEditor.createControl(timeComposite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor);
- }
-
- attribute = getTaskData().getRoot().getAttribute(BugzillaAttribute.REMAINING_TIME.getKey());
- if (attribute != null) {
- attributeEditor = createAttributeEditor(attribute);
- attributeEditor.createLabelControl(timeComposite, toolkit);
- attributeEditor.createControl(timeComposite, toolkit);
- getTaskEditorPage().getAttributeEditorToolkit().adapt(attributeEditor);
- }
-
- timeSection.setClient(timeComposite);
- toolkit.paintBordersFor(timeComposite);
- setSection(toolkit, timeSection);
-
- }
-
- private void initialize() {
- hasIncoming = false;
- Map<String, TaskAttribute> attributes = getTaskData().getRoot().getAttributes();
- for (TaskAttribute attribute : attributes.values()) {
-
- BugzillaAttribute bugzillaAttribute = BugzillaAttribute.UNKNOWN;
- try {
- bugzillaAttribute = BugzillaAttribute.valueOf(attribute.getId().trim().toUpperCase(Locale.ENGLISH));
- } catch (RuntimeException e) {
- if (e instanceof IllegalArgumentException) {
- // ignore unrecognized tags
- continue;
- }
- throw e;
- }
-
- if (PLANNING_ATTRIBUTES.contains(bugzillaAttribute)) {
- if (getModel().hasIncomingChanges(attribute)) {
- hasIncoming = true;
- }
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
deleted file mode 100644
index 56a855f55..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ /dev/null
@@ -1,360 +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.bugzilla.ui.editor;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
-import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
-import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaUiPlugin;
-import org.eclipse.mylyn.tasks.core.RepositoryStatus;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModelListener;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-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.LayoutHint;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
-
-/**
- * @author Rob Elves
- * @since 3.0
- */
-public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
-
- public static final String ID_PART_BUGZILLA_PLANNING = "org.eclipse.mylyn.bugzilla.ui.editors.part.planning"; //$NON-NLS-1$
-
- public static final String ID_PART_BUGZILLA_FLAGS = "org.eclipse.mylyn.bugzilla.ui.editors.part.flags"; //$NON-NLS-1$
-
- private final Map<TaskAttribute, AbstractAttributeEditor> attributeEditorMap;
-
- private TaskDataModelListener productListener;
-
- public BugzillaTaskEditorPage(TaskEditor editor) {
- this(editor, BugzillaCorePlugin.CONNECTOR_KIND);
- }
-
- /**
- * Call this constructor if extending the Bugzilla connector
- *
- * @param editor
- * @param connectorKind
- */
- public BugzillaTaskEditorPage(TaskEditor editor, String connectorKind) {
- super(editor, connectorKind);
- this.attributeEditorMap = new HashMap<TaskAttribute, AbstractAttributeEditor>();
- }
-
- @Override
- protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
- Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors();
-
- // remove unnecessary default editor parts
- for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
- if (taskEditorPartDescriptor.getId().equals(ID_PART_PEOPLE)) {
- descriptors.remove(taskEditorPartDescriptor);
- break;
- }
- }
-
- // Add Bugzilla Planning part
- try {
- TaskData data = TasksUi.getTaskDataManager().getTaskData(getTask());
- if (data != null) {
- TaskAttribute attrEstimatedTime = data.getRoot().getMappedAttribute(
- BugzillaAttribute.ESTIMATED_TIME.getKey());
- if (attrEstimatedTime != null) {
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_BUGZILLA_PLANNING) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new BugzillaPlanningEditorPart();
- }
- }.setPath(PATH_ATTRIBUTES));
- }
- }
- } catch (CoreException e) {
- // ignore
- }
-
- // Add the updated Bugzilla people part
- descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) {
- @Override
- public AbstractTaskEditorPart createPart() {
- return new BugzillaPeoplePart();
- }
- }.setPath(PATH_PEOPLE));
-
- return descriptors;
- }
-
- @Override
- protected AttributeEditorFactory createAttributeEditorFactory() {
- AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
- @Override
- public AbstractAttributeEditor createEditor(String type, final TaskAttribute taskAttribute) {
- AbstractAttributeEditor editor;
- if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) {
- editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute);
- } else if (IBugzillaConstants.EDITOR_TYPE_REMOVECC.equals(type)) {
- editor = new BugzillaCcAttributeEditor(getModel(), taskAttribute);
- } else if (IBugzillaConstants.EDITOR_TYPE_VOTES.equals(type)) {
- editor = new BugzillaVotesEditor(getModel(), taskAttribute);
- } else if (IBugzillaConstants.EDITOR_TYPE_FLAG.equals(type)) {
- editor = new FlagAttributeEditor(getModel(), taskAttribute);
- } else {
- editor = super.createEditor(type, taskAttribute);
- if (TaskAttribute.TYPE_BOOLEAN.equals(type)) {
- editor.setDecorationEnabled(false);
- }
- }
-
- if (editor != null && taskAttribute.getId().startsWith(BugzillaCustomField.CUSTOM_FIELD_PREFIX)) {
- editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) {
-
- @Override
- public int getPriority() {
- return super.getPriority() * 10;
- }
- });
- }
-
- TaskAttributeMetaData properties = taskAttribute.getMetaData();
- if (editor != null && IBugzillaConstants.EDITOR_TYPE_FLAG.equals(properties.getType())) {
- editor.setLayoutHint(new LayoutHint(editor.getLayoutHint()) {
-
- @Override
- public int getPriority() {
- return super.getPriority() * 5;
- }
- });
- }
- BugzillaTaskEditorPage.this.addToAttributeEditorMap(taskAttribute, editor);
- return editor;
- }
- };
- return factory;
- }
-
- @Override
- public void doSubmit() {
- TaskAttribute summaryAttribute = getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.SUMMARY);
- if (summaryAttribute != null && summaryAttribute.getValue().length() == 0) {
- getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting,
- IMessageProvider.ERROR);
- AbstractTaskEditorPart part = getPart(ID_PART_SUMMARY);
- if (part != null) {
- part.setFocus();
- }
- return;
- }
-
- TaskAttribute componentAttribute = getModel().getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.COMPONENT.getKey());
- if (componentAttribute != null && componentAttribute.getValue().length() == 0) {
- getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_select_a_component_before_submitting,
- IMessageProvider.ERROR);
- AbstractTaskEditorPart part = getPart(ID_PART_ATTRIBUTES);
- if (part != null) {
- part.setFocus();
- }
- return;
- }
-
- TaskAttribute descriptionAttribute = getModel().getTaskData().getRoot().getMappedAttribute(
- TaskAttribute.DESCRIPTION);
- if (descriptionAttribute != null && descriptionAttribute.getValue().length() == 0
- && getModel().getTaskData().isNew()) {
- getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Please_enter_a_description_before_submitting,
- IMessageProvider.ERROR);
- AbstractTaskEditorPart descriptionPart = getPart(ID_PART_DESCRIPTION);
- if (descriptionPart != null) {
- descriptionPart.setFocus();
- }
- return;
- }
-
- if (getModel().getTaskData().isNew()) {
- TaskAttribute productAttribute = getModel().getTaskData().getRoot().getMappedAttribute(
- TaskAttribute.PRODUCT);
- if (productAttribute != null && productAttribute.getValue().length() > 0) {
- getModel().getTaskRepository().setProperty(IBugzillaConstants.LAST_PRODUCT_SELECTION,
- productAttribute.getValue());
- }
- }
-
- // Force the most recent known good token onto the outgoing task data to ensure submit
- // bug#263318
- TaskAttribute attrToken = getModel().getTaskData().getRoot().getAttribute(BugzillaAttribute.TOKEN.getKey());
- if (attrToken != null) {
- attrToken.setValue(getModel().getTask().getAttribute(BugzillaAttribute.TOKEN.getKey()));
- }
-
- super.doSubmit();
- }
-
- @Override
- protected void createParts() {
- attributeEditorMap.clear();
- super.createParts();
- }
-
- @Override
- protected TaskDataModel createModel(TaskEditorInput input) throws CoreException {
- TaskDataModel model = super.createModel(input);
- productListener = new ProductSelectionListener();
- model.addModelListener(productListener);
- return model;
- }
-
- /**
- * @since 3.1
- */
- private void addToAttributeEditorMap(TaskAttribute attribute, AbstractAttributeEditor editor) {
- if (attributeEditorMap.containsKey(attribute)) {
- attributeEditorMap.remove(attribute);
- }
- attributeEditorMap.put(attribute, editor);
- }
-
- /**
- * @since 3.1
- */
- private AbstractAttributeEditor getEditorForAttribute(TaskAttribute attribute) {
- return attributeEditorMap.get(attribute);
- }
-
- private void refresh(TaskAttribute attributeComponent) {
- AbstractAttributeEditor editor = getEditorForAttribute(attributeComponent);
- if (editor != null) {
- try {
- editor.refresh();
- } catch (UnsupportedOperationException e) {
- // ignore
- }
- }
- }
-
- private class ProductSelectionListener extends TaskDataModelListener {
- @Override
- public void attributeChanged(TaskDataModelEvent event) {
- TaskAttribute taskAttribute = event.getTaskAttribute();
- if (taskAttribute != null) {
- if (taskAttribute.getId().equals(BugzillaAttribute.PRODUCT.getKey())) {
- RepositoryConfiguration repositoryConfiguration = null;
- try {
- repositoryConfiguration = BugzillaCorePlugin.getRepositoryConfiguration(
- getModel().getTaskRepository(), false, new NullProgressMonitor());
- } catch (CoreException e) {
- StatusHandler.log(new RepositoryStatus(getTaskRepository(), IStatus.ERROR,
- BugzillaUiPlugin.ID_PLUGIN, 0, "Failed to obtain repository configuration", e)); //$NON-NLS-1$
- getTaskEditor().setMessage("Problem occured when updating attributes", IMessageProvider.ERROR); //$NON-NLS-1$
- return;
- }
-
- TaskAttribute attributeComponent = taskAttribute.getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.COMPONENT.getKey());
- if (attributeComponent != null) {
- List<String> optionValues = repositoryConfiguration.getComponents(taskAttribute.getValue());
- Collections.sort(optionValues);
- attributeComponent.clearOptions();
- for (String option : optionValues) {
- attributeComponent.putOption(option, option);
- }
- if (optionValues.size() == 1) {
- attributeComponent.setValue(optionValues.get(0));
- } else {
- attributeComponent.setValue(""); //$NON-NLS-1$
- }
- refresh(attributeComponent);
- }
-
- TaskAttribute attributeTargetMilestone = taskAttribute.getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.TARGET_MILESTONE.getKey());
- if (attributeTargetMilestone != null) {
- List<String> optionValues = repositoryConfiguration.getTargetMilestones(taskAttribute.getValue());
- Collections.sort(optionValues);
- attributeTargetMilestone.clearOptions();
- for (String option : optionValues) {
- attributeTargetMilestone.putOption(option, option);
- }
- if (optionValues.size() == 1) {
- attributeTargetMilestone.setValue(optionValues.get(0));
- } else {
- attributeTargetMilestone.setValue("---"); //$NON-NLS-1$
- }
- refresh(attributeTargetMilestone);
- }
-
- TaskAttribute attributeVersion = taskAttribute.getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.VERSION.getKey());
- if (attributeVersion != null) {
- List<String> optionValues = repositoryConfiguration.getVersions(taskAttribute.getValue());
- Collections.sort(optionValues);
- attributeVersion.clearOptions();
- for (String option : optionValues) {
- attributeVersion.putOption(option, option);
- }
- if (optionValues.size() == 1) {
- attributeVersion.setValue(optionValues.get(0));
- } else {
- attributeVersion.setValue("unspecified"); //$NON-NLS-1$
- }
- refresh(attributeVersion);
- }
-
- TaskAttribute attributeDefaultAssignee = taskAttribute.getTaskData().getRoot().getMappedAttribute(
- BugzillaAttribute.SET_DEFAULT_ASSIGNEE.getKey());
- if (attributeDefaultAssignee != null) {
- attributeDefaultAssignee.setValue("1"); //$NON-NLS-1$
- refresh(attributeDefaultAssignee);
- }
-
-/*
- * add confirm_product_change to avoid verification page on submit
- */
- TaskAttribute attributeConfirmeProductChange = taskAttribute.getTaskData()
- .getRoot()
- .getMappedAttribute(BugzillaAttribute.CONFIRM_PRODUCT_CHANGE.getKey());
- if (attributeConfirmeProductChange == null) {
- attributeConfirmeProductChange = BugzillaTaskDataHandler.createAttribute(
- taskAttribute.getTaskData().getRoot(), BugzillaAttribute.CONFIRM_PRODUCT_CHANGE);
- }
- if (attributeConfirmeProductChange != null) {
- attributeConfirmeProductChange.setValue("1"); //$NON-NLS-1$
- }
- }
- }
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java
deleted file mode 100644
index 23b977679..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPageFactory.java
+++ /dev/null
@@ -1,67 +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.bugzilla.ui.editor;
-
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
-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.TaskEditor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.forms.editor.IFormPage;
-
-/**
- * @author Rob Elves
- */
-public class BugzillaTaskEditorPageFactory extends AbstractTaskEditorPageFactory {
-
- @Override
- public boolean canCreatePageFor(TaskEditorInput input) {
- if (input.getTask().getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND)
- || TasksUiUtil.isOutgoingNewTask(input.getTask(), BugzillaCorePlugin.CONNECTOR_KIND)) {
- return true;
- }
- return false;
- }
-
- @Override
- public IFormPage createPage(TaskEditor parentEditor) {
- return new BugzillaTaskEditorPage(parentEditor);
- }
-
- @Override
- public String[] getConflictingIds(TaskEditorInput input) {
- if (!input.getTask().getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND)) {
- return new String[] { ITasksUiConstants.ID_PAGE_PLANNING };
- }
- return null;
- }
-
- @Override
- public int getPriority() {
- return PRIORITY_TASK;
- }
-
- @Override
- public Image getPageImage() {
- return CommonImages.getImage(TasksUiImages.REPOSITORY_SMALL);
- }
-
- @Override
- public String getPageText() {
- return "Bugzilla"; //$NON-NLS-1$
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java
deleted file mode 100644
index d2ba620e2..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaVotesEditor.java
+++ /dev/null
@@ -1,116 +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.bugzilla.ui.editor;
-
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-
-/**
- * @author Rob Elves
- */
-public class BugzillaVotesEditor extends AbstractAttributeEditor {
-
- // Copy from <code>TaskEditorAttributePart</code>
- private static final int LABEL_WIDTH = 100;
-
- // Copy from TaskEditorAttributePart
- private static final int COLUMN_GAP = 5;
-
- public BugzillaVotesEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- }
-
- private Hyperlink voteControl;
-
- private Label hiddenLabel;
-
- private Hyperlink showVotes;
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- ((GridData) getLabelControl().getLayoutData()).exclude = true;
- showVotes = toolkit.createHyperlink(parent, getTaskAttribute().getValue(), SWT.NONE);
- showVotes.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- showVotes.setToolTipText(Messages.BugzillaVotesEditor_Show_votes);
- showVotes.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openUrl(getTaskAttribute().getTaskData().getRepositoryUrl()
- + IBugzillaConstants.URL_SHOW_VOTES + getTaskAttribute().getTaskData().getTaskId());
- }
- });
- setControl(showVotes);
- }
-
- @Override
- public void createLabelControl(Composite composite, FormToolkit toolkit) {
- voteControl = toolkit.createHyperlink(composite, getLabel(), SWT.NONE);
- voteControl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- voteControl.setToolTipText(Messages.BugzillaVotesEditor_Vote);
- voteControl.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openUrl(getTaskAttribute().getTaskData().getRepositoryUrl() + IBugzillaConstants.URL_VOTE
- + getTaskAttribute().getTaskData().getTaskId());
- }
- });
-
- GridData gd = GridDataFactory.fillDefaults()
- .align(SWT.RIGHT, SWT.CENTER)
- .hint(LABEL_WIDTH, SWT.DEFAULT)
- .create();
-
- gd.horizontalIndent = COLUMN_GAP;
- gd.widthHint = LABEL_WIDTH + COLUMN_GAP;
-
- voteControl.setLayoutData(gd);
-
- hiddenLabel = toolkit.createLabel(composite, ""); //$NON-NLS-1$
- GridData data = new GridData();
- data.exclude = true;
- hiddenLabel.setLayoutData(data);
- }
-
- @Override
- protected void decorateOutgoing(Color color) {
- // ignore
- }
-
- @Override
- public Label getLabelControl() {
- return hiddenLabel;
- }
-
- public String getValue() {
- return getAttributeMapper().getValue(getTaskAttribute());
- }
-
- public void setValue(String text) {
- getAttributeMapper().setValue(getTaskAttribute(), text);
- attributeChanged();
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java
deleted file mode 100644
index 47bca654e..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/FlagAttributeEditor.java
+++ /dev/null
@@ -1,181 +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.bugzilla.ui.editor;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.Assert;
-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.custom.CCombo;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-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.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-
-/**
- * @author Frank Becker
- */
-public class FlagAttributeEditor extends AbstractAttributeEditor {
-
- private String[] values;
-
- private CCombo combo;
-
- private Text requesteeText;
-
- public FlagAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
- super(manager, taskAttribute);
- setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.SINGLE));
- if (taskAttribute.getAttribute("state") != null) { //$NON-NLS-1$
- setReadOnly(taskAttribute.getAttribute("state").getMetaData().isReadOnly()); //$NON-NLS-1$
- }
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Composite composite = toolkit.createComposite(parent);
- GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 1;
- composite.setLayout(layout);
- if (isReadOnly()) {
- Text text = new Text(composite, SWT.FLAT | SWT.READ_ONLY);
- toolkit.adapt(text, false, false);
- text.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
- text.setText(getValueLabel());
- String tooltip = getTaskAttribute().getMetaData().getLabel();
- if (tooltip != null) {
- text.setToolTipText(tooltip);
- }
- } else {
- combo = new CCombo(composite, SWT.FLAT | SWT.READ_ONLY);
- toolkit.adapt(combo, false, false);
- combo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
- String tooltip = getTaskAttribute().getMetaData().getLabel();
- if (tooltip != null) {
- combo.setToolTipText(tooltip);
- }
-
- Map<String, String> labelByValue = getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute())
- .getOptions();
- if (labelByValue != null) {
- values = labelByValue.keySet().toArray(new String[0]);
- for (String value : values) {
- combo.add(labelByValue.get(value));
- }
- }
-
- select(getValue(), getValueLabel());
-
- if (values != null) {
- combo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- int index = combo.getSelectionIndex();
- if (index > -1) {
- Assert.isNotNull(values);
- Assert.isLegal(index >= 0 && index <= values.length - 1);
- setValue(values[index]);
- if (requesteeText != null) {
- requesteeText.setEnabled(values[index].equals("?")); //$NON-NLS-1$
- }
- }
- }
- });
- }
- TaskAttribute requestee = getTaskAttribute().getAttribute("requestee"); //$NON-NLS-1$
- if (requestee != null && !requestee.getMetaData().isReadOnly()) {
- requesteeText = toolkit.createText(composite, requestee.getValue());
- requesteeText.setEnabled("?".equals(getValueLabel())); //$NON-NLS-1$
- GridData requesteeData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- requesteeData.widthHint = 78;
- requesteeText.setLayoutData(requesteeData);
- requesteeText.addFocusListener(new FocusListener() {
-
- public void focusGained(FocusEvent e) {
- }
-
- public void focusLost(FocusEvent e) {
- setRequestee(requesteeText.getText());
- }
- });
- }
- }
- toolkit.paintBordersFor(composite);
- setControl(composite);
- }
-
- public String getValue() {
-// return getAttributeMapper().getValue(getTaskAttribute());
- return getAttributeMapper().getValue(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute()));
- }
-
- public String getValueLabel() {
-// return getAttributeMapper().getValueLabel(getTaskAttribute());
- return getAttributeMapper().getValueLabel(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute()));
- }
-
- private void select(String value, String label) {
- if (values != null) {
- for (int i = 0; i < values.length; i++) {
- if (values[i].equals(value)) {
- combo.select(i);
- break;
- }
- }
- } else {
- combo.setText(label);
- }
- }
-
- public void setRequestee(String value) {
- TaskAttribute requestee = getTaskAttribute().getAttribute("requestee"); //$NON-NLS-1$
- if (requestee != null) {
- getAttributeMapper().setValue(getTaskAttribute().getAttribute("requestee"), value); //$NON-NLS-1$
- attributeChanged();
- }
- }
-
- public void setValue(String value) {
- getAttributeMapper().setValue(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute()), value);
- attributeChanged();
- }
-
- @Override
- public String getLabel() {
- String label = getAttributeMapper().getLabel(getAttributeMapper().getAssoctiatedAttribute(getTaskAttribute()));
- if (label != null) {
- label.replace("&", "&&"); //$NON-NLS-1$//$NON-NLS-2$
- } else {
- label = ""; //$NON-NLS-1$
- }
-
- TaskAttribute setter = getTaskAttribute().getAttribute("setter"); //$NON-NLS-1$
- if (setter != null) {
- String setterValue = setter.getValue();
- if (setterValue != null && !setterValue.equals("")) { //$NON-NLS-1$
- if (setterValue.indexOf("@") != 0) { //$NON-NLS-1$
- setterValue = setterValue.substring(0, setterValue.indexOf("@")); //$NON-NLS-1$
- }
- label = setterValue + ": " + label; //$NON-NLS-1$
- }
- }
- return label;
- }
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java
deleted file mode 100644
index 396920aff..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/KeywordsDialog.java
+++ /dev/null
@@ -1,160 +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.bugzilla.ui.editor;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * @author Shawn Minto
- */
-public class KeywordsDialog extends Dialog {
-
- private final List<String> selectedKeywords;
-
- private final List<String> validKeywords;
-
- private CheckboxTableViewer keyWordsList;
-
- public KeywordsDialog(Shell shell, String selectedKeywords, java.util.List<String> validKeywords) {
- super(shell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- StringTokenizer st = new StringTokenizer(selectedKeywords, ",", false); //$NON-NLS-1$
- this.selectedKeywords = new ArrayList<String>();
- while (st.hasMoreTokens()) {
- String s = st.nextToken().trim();
- this.selectedKeywords.add(s);
- }
-
- this.validKeywords = validKeywords;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- getShell().setText(Messages.KeywordsDialog_Select_Keywords);
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
- composite.setLayoutData(gd);
-
- keyWordsList = CheckboxTableViewer.newCheckList(composite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
- GridData keyWordsTextData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
- keyWordsTextData.heightHint = 175;
- keyWordsTextData.widthHint = 160;
- keyWordsList.getTable().setLayoutData(keyWordsTextData);
-
- if (validKeywords != null) {
-
- keyWordsList.setContentProvider(new ITreeContentProvider() {
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Collection<?>) {
- return ((Collection<?>) parentElement).toArray();
- }
- return null;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- });
-
- Set<String> invalidKeywords = new HashSet<String>();
-
- keyWordsList.setInput(validKeywords);
-
- for (String keyword : selectedKeywords) {
- if (!keyWordsList.setChecked(keyword, true)) {
- invalidKeywords.add(keyword);
- }
- }
-
- selectedKeywords.removeAll(invalidKeywords);
-
- }
-
- keyWordsList.addCheckStateListener(new KeywordListener());
-
- parent.pack();
-
- applyDialogFont(composite);
-
- return composite;
- }
-
- protected class KeywordListener implements ICheckStateListener {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getChecked()) {
- selectedKeywords.add((String) event.getElement());
- } else {
- selectedKeywords.remove(event.getElement());
- }
- }
-
- }
-
- public List<String> getSelectedKeywords() {
- return selectedKeywords;
- }
-
- public String getSelectedKeywordsString() {
- StringBuffer keywords = new StringBuffer();
-
- for (String sel : selectedKeywords) {
- keywords.append(sel);
- keywords.append(","); //$NON-NLS-1$
- }
-
- String keywordsString = keywords.toString();
-
- if (keywordsString.endsWith(",")) { //$NON-NLS-1$
- keywordsString = keywordsString.substring(0, keywordsString.length() - 1);
- }
-
- return keywordsString;
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
deleted file mode 100644
index edbecef51..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
+++ /dev/null
@@ -1,51 +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.bugzilla.ui.editor;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.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 BugzillaFlagPart_flags;
-
- public static String BugzillaKeywordAttributeEditor_Edit_;
-
- public static String BugzillaPeoplePart_People;
-
- public static String BugzillaPeoplePart__Select_to_remove_;
-
- public static String BugzillaPlanningEditorPart_Current_Estimate;
-
- public static String BugzillaPlanningEditorPart_Team_Planning;
-
- public static String BugzillaTaskEditorPage_Please_enter_a_description_before_submitting;
-
- public static String BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting;
-
- public static String BugzillaTaskEditorPage_Please_select_a_component_before_submitting;
-
- public static String BugzillaVotesEditor_Show_votes;
-
- public static String BugzillaVotesEditor_Vote;
-
- public static String KeywordsDialog_Select_Keywords;
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
deleted file mode 100644
index 1644c5bfc..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-BugzillaFlagPart_flags=Flags
-BugzillaKeywordAttributeEditor_Edit_=Edit...
-
-BugzillaPeoplePart_People=People
-BugzillaPeoplePart__Select_to_remove_=(Select to remove)
-
-BugzillaPlanningEditorPart_Current_Estimate=Current Estimate:
-BugzillaPlanningEditorPart_Team_Planning=Team Planning
-
-BugzillaTaskEditorPage_Please_enter_a_description_before_submitting=Please enter a description before submitting
-BugzillaTaskEditorPage_Please_enter_a_short_summary_before_submitting=Please enter a short summary before submitting
-BugzillaTaskEditorPage_Please_select_a_component_before_submitting=Please select a component before submitting
-
-BugzillaVotesEditor_Show_votes=Show votes
-BugzillaVotesEditor_Vote=Vote
-
-KeywordsDialog_Select_Keywords=Select Keywords

Back to the top