Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-01-04 03:58:24 +0000
committermkersten2006-01-04 03:58:24 +0000
commitd0ca1cfb061ff9b2db84a68d7af2de97a83bedf3 (patch)
treebc82e92d691a4ad103f936912f294604629cc1f4
parentf3e3d6e722698d51cbdffe200959c2f9efe02aa2 (diff)
downloadorg.eclipse.mylyn.tasks-d0ca1cfb061ff9b2db84a68d7af2de97a83bedf3.tar.gz
org.eclipse.mylyn.tasks-d0ca1cfb061ff9b2db84a68d7af2de97a83bedf3.tar.xz
org.eclipse.mylyn.tasks-d0ca1cfb061ff9b2db84a68d7af2de97a83bedf3.zip
Progress on: Bug 120952: provide task/issue repository view and extension points
https://bugs.eclipse.org/bugs/show_bug.cgi?id=120952
-rw-r--r--org.eclipse.mylyn.bugzilla.core/plugin.xml2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/AddTaskRepositoryAction.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/DeleteTaskRepositoryAction.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoriesView.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoryPropertiesAction.java71
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/EditRepositoryWizard.java60
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/RepositorySettingsPage.java24
8 files changed, 161 insertions, 23 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/plugin.xml b/org.eclipse.mylyn.bugzilla.core/plugin.xml
index 21547b90f..19849f870 100644
--- a/org.eclipse.mylyn.bugzilla.core/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.core/plugin.xml
@@ -23,7 +23,7 @@
<extension point="org.eclipse.ui.preferencePages">
<page
- name="Bugzilla"
+ name="Bugzilla Client"
class="org.eclipse.mylar.bugzilla.core.BugzillaPreferencePage"
id="org.eclipse.mylar.bugzilla.bugzillaPreferences"
category="org.eclipse.mylar.ui.preferences"/>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/AddTaskRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/AddTaskRepositoryAction.java
index abb20f39e..776b79230 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/AddTaskRepositoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/AddTaskRepositoryAction.java
@@ -45,12 +45,9 @@ public class AddTaskRepositoryAction extends Action {
AddRepositoryWizard wizard = new AddRepositoryWizard();
Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
-// wizard.loadSize();
WizardDialog dialog = new WizardDialog(shell, wizard);
-// dialog.setMinimumPageSize(wizard.loadSize());
dialog.create();
-// dialog.setTitle(WIZARD_LABEL);
- dialog.getShell().setText("Mylar Tasks");
+// dialog.getShell().setText("Mylar Tasks");
dialog.setBlockOnOpen(true);
if (dialog.open() == Dialog.CANCEL) {
dialog.close();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/DeleteTaskRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/DeleteTaskRepositoryAction.java
index 3558d2305..7e28f5af0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/DeleteTaskRepositoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/DeleteTaskRepositoryAction.java
@@ -47,13 +47,13 @@ public class DeleteTaskRepositoryAction extends Action {
public void run() {
try {
boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
- .getShell(), "Confirm delete", "Delete the selected task repositories?");
- if (!deleteConfirmed)
- return;
- IStructuredSelection selection = (IStructuredSelection)repositoriesView.getViewer().getSelection();
- for (Object selectedObject: selection.toList()) {
- if (selectedObject instanceof TaskRepository) {
- MylarTaskListPlugin.getRepositoryManager().removeRepository((TaskRepository)selectedObject);
+ .getShell(), "Confirm Delete", "Delete the selected task repositories?");
+ if (deleteConfirmed) {
+ IStructuredSelection selection = (IStructuredSelection)repositoriesView.getViewer().getSelection();
+ for (Object selectedObject: selection.toList()) {
+ if (selectedObject instanceof TaskRepository) {
+ MylarTaskListPlugin.getRepositoryManager().removeRepository((TaskRepository)selectedObject);
+ }
}
}
} catch (Exception e) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoriesView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoriesView.java
index 7a8f4f310..d63bdd09a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoriesView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoriesView.java
@@ -36,6 +36,8 @@ public class TaskRepositoriesView extends ViewPart {
private Action deleteRepositoryAction = new DeleteTaskRepositoryAction(this);
+ private Action repositoryPropertiesAction = new TaskRepositoryPropertiesAction(this);
+
private final ITaskRepositoryListener REPOSITORY_LISTENER = new ITaskRepositoryListener() {
public void repositorySetUpdated() {
@@ -106,6 +108,8 @@ public class TaskRepositoriesView extends ViewPart {
private void fillContextMenu(IMenuManager manager) {
manager.add(addRepositoryAction);
manager.add(deleteRepositoryAction);
+ manager.add(new Separator());
+ manager.add(repositoryPropertiesAction);
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoryPropertiesAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoryPropertiesAction.java
new file mode 100644
index 000000000..8db27d972
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/repositories/ui/TaskRepositoryPropertiesAction.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 University Of British Columbia 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:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.tasklist.repositories.ui;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.mylar.core.util.ErrorLogger;
+import org.eclipse.mylar.tasklist.repositories.TaskRepository;
+import org.eclipse.mylar.tasklist.ui.wizards.EditRepositoryWizard;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.internal.Workbench;
+
+/**
+ * @author Mik Kersten
+ */
+public class TaskRepositoryPropertiesAction extends Action {
+
+ private static final String ID = "org.eclipse.mylar.tasklist.repositories.properties";
+
+ private TaskRepositoriesView repositoriesView;
+
+ public TaskRepositoryPropertiesAction(TaskRepositoriesView repositoriesView) {
+ this.repositoriesView = repositoriesView;
+ setText("Properties");
+ setId(ID);
+ }
+
+ public void init(IViewPart view) {
+ // ignore
+ }
+
+ public void run() {
+ try {
+ IStructuredSelection selection = (IStructuredSelection)repositoriesView.getViewer().getSelection();
+ if (selection.getFirstElement() instanceof TaskRepository) {
+ EditRepositoryWizard wizard = new EditRepositoryWizard((TaskRepository)selection.getFirstElement());
+ Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ if (wizard != null && shell != null && !shell.isDisposed()) {
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+// dialog.getShell().setText("Mylar Tasks");
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Dialog.CANCEL) {
+ dialog.close();
+ return;
+ }
+ }
+ }
+ } catch (Exception e) {
+ ErrorLogger.fail(e, e.getMessage(), true);
+ }
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ // TODO Auto-generated method stub
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java
index 8c77090d5..f9432455b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/actions/DeleteAction.java
@@ -65,7 +65,7 @@ public class DeleteAction extends Action {
String message = genDeleteConfirmationMessage(task);
boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
- .getShell(), "Confirm delete", message);
+ .getShell(), "Confirm Delete", message);
if (!deleteConfirmed) {
return;
}
@@ -86,7 +86,7 @@ public class DeleteAction extends Action {
view.getViewer().refresh();
} else if (selectedObject instanceof TaskCategory) {
boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
- .getShell(), "Confirm delete", "Delete the selected category and all contained tasks?");
+ .getShell(), "Confirm Delete", "Delete the selected category and all contained tasks?");
if (!deleteConfirmed)
return;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/EditRepositoryWizard.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/EditRepositoryWizard.java
new file mode 100644
index 000000000..07123f4ee
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/EditRepositoryWizard.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2005 University Of British Columbia 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:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.tasklist.ui.wizards;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
+import org.eclipse.mylar.tasklist.repositories.TaskRepository;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author Mik Kersten
+ */
+public class EditRepositoryWizard extends Wizard implements INewWizard {
+
+ private RepositorySettingsPage repositorySettingsPage = new RepositorySettingsPage();
+
+ public EditRepositoryWizard(TaskRepository repository) {
+ super();
+// super.setForcePreviousAndNextButtons(true);
+ repositorySettingsPage.setRepository(repository);
+ repositorySettingsPage.setWizard(this);
+ }
+
+ @Override
+ public boolean performFinish() {
+ if (canFinish()) {
+ TaskRepository repository = new TaskRepository(repositorySettingsPage.getServerUrl());
+ if (repository != null) {
+ repository.setAuthenticationCredentials(repositorySettingsPage.getUserName(), repositorySettingsPage.getPassword());
+ MylarTaskListPlugin.getRepositoryManager().addRepository(repository);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+ @Override
+ public void addPages() {
+ addPage(repositorySettingsPage);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return repositorySettingsPage.isPageComplete();
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/RepositorySettingsPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/RepositorySettingsPage.java
index 04bd4b71b..a709e6d79 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/RepositorySettingsPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/wizards/RepositorySettingsPage.java
@@ -17,6 +17,7 @@ import java.net.URL;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.core.util.ErrorLogger;
+import org.eclipse.mylar.tasklist.repositories.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
@@ -50,6 +51,8 @@ public class RepositorySettingsPage extends WizardPage {
private RepositoryStringFieldEditor passwordEditor;
+ private TaskRepository repository;
+
public RepositorySettingsPage() {
super(LABEL);
super.setTitle(TITLE);
@@ -60,7 +63,7 @@ public class RepositorySettingsPage extends WizardPage {
Composite container = new Composite(parent, SWT.NULL);
FillLayout layout = new FillLayout();
container.setLayout(layout);
-
+
serverUrlEditor = new StringFieldEditor("", LABEL_SERVER,
StringFieldEditor.UNLIMITED, container) {
@@ -75,18 +78,17 @@ public class RepositorySettingsPage extends WizardPage {
getWizard().getContainer().updateButtons();
}
};
-
- // set the error message for if the server name check fails
serverUrlEditor.setErrorMessage("Server path must be a valid http(s):// url");
-
+
userNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, container);
passwordEditor = new RepositoryStringFieldEditor("", LABEL_PASSWORD, StringFieldEditor.UNLIMITED, container);
passwordEditor.getTextControl().setEchoChar('*');
- // put the password and user name values into the field editors
-// getCachedData();
-// userNameEditor.setStringValue(user);
-// passwordEditor.setStringValue(password);
+ if (repository != null) {
+ serverUrlEditor.setStringValue(repository.getServerUrl().toExternalForm());
+ userNameEditor.setStringValue(repository.getUserName());
+ passwordEditor.setStringValue(repository.getPassword());
+ }
setControl(container);
}
@@ -151,5 +153,9 @@ public class RepositorySettingsPage extends WizardPage {
@Override
public boolean isPageComplete() {
return isValidURl(serverUrlEditor.getStringValue());
- }
+ }
+
+ public void setRepository(TaskRepository repository) {
+ this.repository = repository;
+ }
}

Back to the top