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/action')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java24
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java23
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.java115
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java40
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java156
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties6
6 files changed, 0 insertions, 364 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java
deleted file mode 100644
index 9919b5cbf..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaNotObsoleteAttachmentAction.java
+++ /dev/null
@@ -1,24 +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.action;
-
-/**
- * @author Frank Becker
- */
-public class BugzillaNotObsoleteAttachmentAction extends BugzillaUpdateAttachmentAction {
-
- public BugzillaNotObsoleteAttachmentAction() {
- super(false);
- // ignore
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java
deleted file mode 100644
index c39f1f698..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaObsoleteAttachmentAction.java
+++ /dev/null
@@ -1,23 +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.action;
-
-/**
- * @author Frank Becker
- */
-public class BugzillaObsoleteAttachmentAction extends BugzillaUpdateAttachmentAction {
-
- public BugzillaObsoleteAttachmentAction() {
- super(true);
- }
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.java
deleted file mode 100644
index 2d1736dcf..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/BugzillaUpdateAttachmentAction.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.action;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-import org.eclipse.ui.forms.editor.IFormPage;
-
-/**
- * @author Frank Becker
- */
-public class BugzillaUpdateAttachmentAction extends BaseSelectionListenerAction implements IViewActionDelegate {
-
- private ISelection currentSelection;
-
- private final boolean obsolete;
-
- public BugzillaUpdateAttachmentAction(boolean obsolete) {
- super("UpdateAttachmentAction"); //$NON-NLS-1$
- this.obsolete = obsolete;
- }
-
- public void init(IViewPart view) {
- // ignore
- }
-
- @SuppressWarnings("unchecked")
- public void run(IAction action) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
- IEditorPart activeEditor = page.getActiveEditor();
- if (activeEditor instanceof TaskEditor) {
- final TaskEditor taskEditor = (TaskEditor) activeEditor;
- IStructuredSelection selection = null;
- if (currentSelection instanceof IStructuredSelection) {
- selection = (IStructuredSelection) currentSelection;
- }
- if (selection == null || selection.isEmpty()) {
- return;
- }
- List<ITaskAttachment> attachment = selection.toList();
- if (attachment != null) {
- final UpdateAttachmentJob job = new UpdateAttachmentJob(attachment, taskEditor, obsolete);
- job.setUser(true);
- job.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- if (job.getError() != null) {
- IFormPage formPage = taskEditor.getActivePageInstance();
- if (formPage instanceof BugzillaTaskEditorPage) {
- final BugzillaTaskEditorPage bugzillaPage = (BugzillaTaskEditorPage) formPage;
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- bugzillaPage.getTaskEditor().setMessage(job.getError().getMessage(),
- IMessageProvider.ERROR);
- }
- });
- }
- }
- }
- });
- job.schedule();
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public void selectionChanged(IAction action, ISelection selection) {
- this.currentSelection = selection;
- IStructuredSelection sructuredSelection = null;
- if (selection instanceof IStructuredSelection) {
- sructuredSelection = (IStructuredSelection) currentSelection;
- }
- if (sructuredSelection == null || sructuredSelection.isEmpty()) {
- return;
- }
- List<ITaskAttachment> attachmentList = sructuredSelection.toList();
- action.setEnabled(false);
- for (ITaskAttachment taskAttachment : attachmentList) {
- TaskAttribute taskAttribute = taskAttachment.getTaskAttribute();
- TaskAttribute deprecated = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED);
- if (deprecated != null && deprecated.getValue().equals("1") != obsolete) { //$NON-NLS-1$
- action.setEnabled(true);
- break;
- }
- }
- }
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java
deleted file mode 100644
index a61722195..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/Messages.java
+++ /dev/null
@@ -1,40 +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.action;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.bugzilla.ui.action.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 BugzillaUpdateAttachmentAction_mark_not_obsolete;
-
- public static String BugzillaUpdateAttachmentAction_mark_obsolete;
-
- public static String UpdateAttachmentJob_obsolete_not_toggled;
-
- public static String UpdateAttachmentJob_obsolete_toggled_successfully;
-
- public static String UpdateAttachmentJob_update_attachments;
-
- public static String UpdateAttachmentJob_update_attachment;
-
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java
deleted file mode 100644
index 0fa6516ca..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/UpdateAttachmentJob.java
+++ /dev/null
@@ -1,156 +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.action;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
-import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage;
-import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.forms.widgets.Section;
-
-/**
- * @author Frank Becker
- */
-@SuppressWarnings("restriction")
-public class UpdateAttachmentJob extends Job {
-
- private final List<ITaskAttachment> attachment;
-
- private final TaskEditor editor;
-
- private final boolean obsolete;
-
- private IStatus error;
-
- public UpdateAttachmentJob(List<ITaskAttachment> attachment, TaskEditor editor, boolean obsolete) {
- super(Messages.UpdateAttachmentJob_update_attachment);
- this.attachment = attachment;
- this.editor = editor;
- this.obsolete = obsolete;
- }
-
- public IStatus getError() {
- return error;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- final ITask task;
- task = editor.getTaskEditorInput().getTask();
-
- if (!task.getConnectorKind().equals(BugzillaCorePlugin.CONNECTOR_KIND)) {
- return Status.OK_STATUS;
- }
- AbstractRepositoryConnector connector = TasksUi.getRepositoryManager().getRepositoryConnector(
- task.getConnectorKind());
- monitor.beginTask(Messages.UpdateAttachmentJob_update_attachments, attachment.size() * 10 + 10);
- try {
- for (ITaskAttachment taskAttachment : attachment) {
- TaskAttribute taskAttribute = taskAttachment.getTaskAttribute();
- TaskAttribute deprecated = taskAttribute.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED);
- if (deprecated != null) {
- if (deprecated.getValue().equals("1") && !obsolete) { //$NON-NLS-1$
- try {
- deprecated.setValue("0"); //$NON-NLS-1$
- ((BugzillaTaskDataHandler) connector.getTaskDataHandler()).postUpdateAttachment(
- taskAttachment.getTaskRepository(), taskAttribute, "update", monitor); //$NON-NLS-1$
- } catch (CoreException e) {
- error = e.getStatus();
- deprecated.setValue("1"); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
- } else if (deprecated.getValue().equals("0") && obsolete) { //$NON-NLS-1$
- try {
- deprecated.setValue("1"); //$NON-NLS-1$
- ((BugzillaTaskDataHandler) connector.getTaskDataHandler()).postUpdateAttachment(
- taskAttachment.getTaskRepository(), taskAttribute, "update", monitor); //$NON-NLS-1$
- } catch (CoreException e) {
- error = e.getStatus();
- deprecated.setValue("0"); //$NON-NLS-1$
- return Status.OK_STATUS;
- }
- }
- }
- monitor.worked(10);
- }
-
- if (task != null) {
- if (connector != null) {
- TasksUiInternal.synchronizeTask(connector, task, true, new JobChangeAdapter() {
- @Override
- public void done(IJobChangeEvent event) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- if (editor != null) {
- editor.refreshPages();
- editor.getEditorSite().getPage().activate(editor);
- IFormPage formPage = editor.getActivePageInstance();
- if (formPage instanceof BugzillaTaskEditorPage) {
- BugzillaTaskEditorPage bugzillaPage = (BugzillaTaskEditorPage) formPage;
- Control control = bugzillaPage.getPart(
- AbstractTaskEditorPage.ID_PART_ATTACHMENTS).getControl();
- if (control instanceof Section) {
- Section section = (Section) control;
- EditorUtil.toggleExpandableComposite(true, section);
- }
- }
-
- }
- } finally {
- if (editor != null) {
- editor.showBusy(false);
- }
- }
- }
- });
- }
- });
- }
- monitor.worked(10);
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (editor != null) {
- editor.showBusy(true);
- }
- }
- });
- }
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } finally {
- monitor.done();
- }
- return Status.OK_STATUS;
- }
-}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties
deleted file mode 100644
index 80f5eed5f..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/action/messages.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-BugzillaUpdateAttachmentAction_mark_not_obsolete=Mark not obsolete
-BugzillaUpdateAttachmentAction_mark_obsolete=Mark obsolete
-UpdateAttachmentJob_obsolete_not_toggled=Obsolete not toggled successful
-UpdateAttachmentJob_obsolete_toggled_successfully=Obsolete toggeled successfully
-UpdateAttachmentJob_update_attachment=Update attachment
-UpdateAttachmentJob_update_attachments=Update attachments

Back to the top