Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-03-30 03:10:09 +0000
committerrelves2007-03-30 03:10:09 +0000
commit1102b9cd81fd116e8816e8ab97775d931004cc34 (patch)
treeb7a4f9fd506089ffd04fc04a75007e245f3acd4b
parentc5e57e9aeb380c636e4b63f704e4d26aa7752d8c (diff)
downloadorg.eclipse.mylyn.tasks-1102b9cd81fd116e8816e8ab97775d931004cc34.tar.gz
org.eclipse.mylyn.tasks-1102b9cd81fd116e8816e8ab97775d931004cc34.tar.xz
org.eclipse.mylyn.tasks-1102b9cd81fd116e8816e8ab97775d931004cc34.zip
NEW - bug 179999: make task editor have common title header
https://bugs.eclipse.org/bugs/show_bug.cgi?id=179999
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java143
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorInput.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java149
7 files changed, 218 insertions, 103 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index f3ed3df22..55bd68e14 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -406,7 +406,7 @@ public class BugzillaClient {
if (responseTypeHeader.getValue().toLowerCase(Locale.ENGLISH).contains(type)) {
taskData = new RepositoryTaskData(new BugzillaAttributeFactory(),
BugzillaCorePlugin.REPOSITORY_KIND, repositoryUrl.toString(), "" + id,
- Task.DEFAULT_TASK_KIND);
+ IBugzillaConstants.BUGZILLA_TASK_KIND);
setupExistingBugAttributes(repositoryUrl.toString(), taskData);
RepositoryReportFactory reportFactory = new RepositoryReportFactory(method
.getResponseBodyAsStream(), characterEncoding);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java
index 832b710f8..8cf4ac01e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditorInput.java
@@ -13,7 +13,6 @@
*/
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
@@ -51,10 +50,10 @@ public class BugzillaTaskEditorInput extends RepositoryTaskEditorInput {
return true;
}
- @Override
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
+// @Override
+// public ImageDescriptor getImageDescriptor() {
+// return null;
+// }
@Override
public IPersistableElement getPersistable() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
index c3342650b..4f6be5640 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java
@@ -298,8 +298,8 @@ public class TaskPlanningEditor extends TaskFormPage {
form = managedForm.getForm();
toolkit = managedForm.getToolkit();
- form.setImage(TaskListImages.getImage(TaskListImages.CALENDAR));
- toolkit.decorateFormHeading(form.getForm());
+// form.setImage(TaskListImages.getImage(TaskListImages.CALENDAR));
+// toolkit.decorateFormHeading(form.getForm());
editorComposite = form.getBody();
GridLayout editorLayout = new GridLayout();
@@ -308,10 +308,10 @@ public class TaskPlanningEditor extends TaskFormPage {
editorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// try {
if (task instanceof AbstractRepositoryTask) {
- form.setText("Planning");
+ //form.setText("Planning");
} else {
createSummarySection(editorComposite);
- form.setText("Task: " + task.getSummary());
+ //form.setText("Task: " + task.getSummary());
}
createPlanningSection(editorComposite);
createNotesSection(editorComposite);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java
index cdc100a64..1d41d0a7b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractNewRepositoryTaskEditor.java
@@ -59,7 +59,6 @@ import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.themes.IThemeManager;
/**
@@ -110,11 +109,7 @@ public abstract class AbstractNewRepositoryTaskEditor extends AbstractRepository
newSummary = taskData.getSummary();
repository = editorInput.getRepository();
connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(repository.getKind());
- isDirty = false;
- IWorkbenchSiteProgressService progressService = getProgressService();
- if (progressService != null) {
- progressService.showBusyForFamily(FAMILY_SUBMIT);
- }
+ isDirty = false;
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
index 156feba8c..96bae9572 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
@@ -42,7 +42,6 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.jface.util.SafeRunnable;
@@ -89,7 +88,6 @@ import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskComment;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
-import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
import org.eclipse.swt.SWT;
@@ -150,7 +148,6 @@ import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.internal.ObjectActionContributorManager;
-import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import org.eclipse.ui.themes.IThemeManager;
import org.eclipse.ui.views.contentoutline.ContentOutline;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -217,8 +214,6 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
private static final String LABEL_BUTTON_SUBMIT = "Submit";
- protected final Object FAMILY_SUBMIT = new Object();
-
protected RepositoryTaskEditorInput editorInput;
private TaskEditor parentEditor = null;
@@ -361,7 +356,8 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
// "Editor will refresh with new incoming
// changes.");
- form.setMessage("Task has new incoming changes. Synchronize to see new changes.",
+
+ parentEditor.setMessage("Task has new incoming changes. Synchronize to see new changes.",
IMessageProvider.WARNING);
setSubmitEnabled(false);
@@ -518,23 +514,13 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
hasAttributeChanges = hasVisibleAttributeChanges();
isDirty = false;
TasksUiPlugin.getTaskListManager().getTaskList().addChangeListener(TASKLIST_CHANGE_LISTENER);
- IWorkbenchSiteProgressService progressService = getProgressService();
- if (progressService != null) {
- progressService.showBusyForFamily(FAMILY_SUBMIT);
- }
+
}
public AbstractRepositoryTask getRepositoryTask() {
return repositoryTask;
}
- protected IWorkbenchSiteProgressService getProgressService() {
- Object siteService = getSite().getAdapter(IWorkbenchSiteProgressService.class);
- if (siteService != null)
- return (IWorkbenchSiteProgressService) siteService;
- return null;
- }
-
@Override
public void markDirty(boolean dirty) {
if (repositoryTask != null) {
@@ -593,12 +579,15 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
toolkit = managedForm.getToolkit();
registerDropListener(form);
- ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(repository.getKind());
- ImageDescriptor imageDescriptor = TaskListImages.createWithOverlay(TaskListImages.REPOSITORY, overlay, false,
- false);
- form.setImage(TaskListImages.getImage(imageDescriptor));
+ // ImageDescriptor overlay =
+ // TasksUiPlugin.getDefault().getOverlayIcon(repository.getKind());
+ // ImageDescriptor imageDescriptor =
+ // TaskListImages.createWithOverlay(TaskListImages.REPOSITORY, overlay,
+ // false,
+ // false);
+ // form.setImage(TaskListImages.getImage(imageDescriptor));
- toolkit.decorateFormHeading(form.getForm());
+ // toolkit.decorateFormHeading(form.getForm());
editorComposite = form.getBody();
GridLayout editorLayout = new GridLayout();
@@ -607,7 +596,8 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
if (taskData == null) {
- form.setMessage("Task data not available. Press synchronize button (right) to retrieve latest data.",
+ parentEditor.setMessage(
+ "Task data not available. Press synchronize button (right) to retrieve latest data.",
IMessageProvider.WARNING);
} else {
@@ -616,39 +606,39 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
}
- setFormHeaderLabel();
+ // setFormHeaderLabel();
addHeaderControls();
if (summaryText != null) {
summaryText.setFocus();
}
-
}
- private void setFormHeaderLabel() {
-
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getRepositoryUi(repository.getKind());
- kindLabel = "";
- if (connectorUi != null) {
- kindLabel = connectorUi.getTaskKindLabel(repositoryTask);
- }
-
- String idLabel = "";
-
- if (repositoryTask != null) {
- idLabel = repositoryTask.getTaskKey();
- } else if (taskData != null) {
- idLabel = taskData.getId();
- }
-
- if (taskData != null && taskData.isNew()) {
- form.setText("New " + kindLabel);
- } else if (idLabel != null) {
- form.setText(kindLabel + " " + idLabel);
- } else {
- form.setText(kindLabel);
- }
- }
+ // private void setFormHeaderLabel() {
+ //
+ // AbstractRepositoryConnectorUi connectorUi =
+ // TasksUiPlugin.getRepositoryUi(repository.getKind());
+ // kindLabel = "";
+ // if (connectorUi != null) {
+ // kindLabel = connectorUi.getTaskKindLabel(repositoryTask);
+ // }
+ //
+ // String idLabel = "";
+ //
+ // if (repositoryTask != null) {
+ // idLabel = repositoryTask.getTaskKey();
+ // } else if (taskData != null) {
+ // idLabel = taskData.getId();
+ // }
+ //
+ // if (taskData != null && taskData.isNew()) {
+ // form.setText("New " + kindLabel);
+ // } else if (idLabel != null) {
+ // form.setText(kindLabel + " " + idLabel);
+ // } else {
+ // form.setText(kindLabel);
+ // }
+ // }
protected void addHeaderControls() {
ControlContribution repositoryLabelControl = new ControlContribution("Title") { //$NON-NLS-1$
@@ -680,20 +670,38 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
return composite;
}
};
- if (form.getToolBarManager() != null) {
- form.getToolBarManager().add(repositoryLabelControl);
+
+ if (parentEditor.getTopForm() != null) {
+ parentEditor.getTopForm().getToolBarManager().add(repositoryLabelControl);
if (repositoryTask != null) {
SynchronizeEditorAction synchronizeEditorAction = new SynchronizeEditorAction();
synchronizeEditorAction.selectionChanged(new StructuredSelection(this));
- form.getToolBarManager().add(synchronizeEditorAction);
+ parentEditor.getTopForm().getToolBarManager().add(synchronizeEditorAction);
}
// Header drop down menu additions:
// form.getForm().getMenuManager().add(new
// SynchronizeSelectedAction());
- form.getToolBarManager().update(true);
+ parentEditor.getTopForm().getToolBarManager().update(true);
}
+
+ // if (form.getToolBarManager() != null) {
+ // form.getToolBarManager().add(repositoryLabelControl);
+ // if (repositoryTask != null) {
+ // SynchronizeEditorAction synchronizeEditorAction = new
+ // SynchronizeEditorAction();
+ // synchronizeEditorAction.selectionChanged(new
+ // StructuredSelection(this));
+ // form.getToolBarManager().add(synchronizeEditorAction);
+ // }
+ //
+ // // Header drop down menu additions:
+ // // form.getForm().getMenuManager().add(new
+ // // SynchronizeSelectedAction());
+ //
+ // form.getToolBarManager().update(true);
+ // }
}
protected void createSections() {
@@ -1781,8 +1789,14 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
}
protected void createNewCommentLayout(Composite composite) {
- Section newCommentSection = createSection(composite, getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION));
-
+ //Section newCommentSection = createSection(composite, getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION));
+
+ Section newCommentSection = toolkit.createSection(composite, ExpandableComposite.TITLE_BAR);
+ newCommentSection.setText(getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION));
+ newCommentSection.setLayout(new GridLayout());
+ newCommentSection.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+
Composite newCommentsComposite = toolkit.createComposite(newCommentSection);
newCommentsComposite.setLayout(new GridLayout());
@@ -1795,9 +1809,10 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
| SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
newCommentTextViewer.setEditable(true);
- GridData addCommentsTextData = new GridData(GridData.FILL_HORIZONTAL);
+ GridData addCommentsTextData = new GridData(GridData.FILL_BOTH);
addCommentsTextData.widthHint = DESCRIPTION_WIDTH;
- addCommentsTextData.heightHint = DESCRIPTION_HEIGHT;
+ //addCommentsTextData.heightHint = DESCRIPTION_HEIGHT;
+ addCommentsTextData.minimumHeight = DESCRIPTION_HEIGHT;
addCommentsTextData.grabExcessHorizontalSpace = true;
newCommentTextViewer.getControl().setLayoutData(addCommentsTextData);
newCommentTextViewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
@@ -2490,8 +2505,8 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
}
public void showBusy(boolean busy) {
- if (!form.isDisposed() && busy != formBusy) {
- form.setBusy(busy);
+ if (busy != formBusy) {
+ parentEditor.showBusy(busy);
if (busy) {
setEnabledState(editorComposite, false);
// regularCursor = form.getCursor();
@@ -2532,9 +2547,9 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
Job submitJob = new Job(LABEL_JOB_SUBMIT) {
- public boolean belongsTo(Object family) {
- return family == FAMILY_SUBMIT;
- }
+ // public boolean belongsTo(Object family) {
+ // return family == parentEditor.FAMILY_SUBMIT;
+ // }
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -2647,9 +2662,9 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
removeSections();
editorComposite.setMenu(menu);
createSections();
- setFormHeaderLabel();
+ // setFormHeaderLabel();
markDirty(false);
- form.setMessage(null, 0);
+ parentEditor.setMessage(null, 0);
AbstractRepositoryTaskEditor.this.getEditor().setActivePage(
AbstractRepositoryTaskEditor.this.getId());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorInput.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorInput.java
index 863e82167..b1064aa35 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorInput.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorInput.java
@@ -14,6 +14,7 @@ package org.eclipse.mylar.tasks.ui.editors;
import java.util.Set;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskRepository;
@@ -78,7 +79,7 @@ public abstract class AbstractTaskEditorInput implements IEditorInput {
}
public ImageDescriptor getImageDescriptor() {
- return null;
+ return TaskListImages.REPOSITORY;
}
public IPersistableElement getPersistable() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index 1ba625881..fa9f2ca62 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylar.core.MylarStatusHandler;
@@ -28,12 +29,13 @@ import org.eclipse.mylar.internal.tasks.ui.editors.TaskPlanningEditor;
import org.eclipse.mylar.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.ITask;
+import org.eclipse.mylar.tasks.core.RepositoryTaskData;
+import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.TasksUiUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
@@ -45,16 +47,19 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.editor.IFormPage;
-import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.editor.SharedHeaderFormEditor;
+import org.eclipse.ui.forms.widgets.Form;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
/**
* @author Mik Kersten
* @author Eric Booth (initial prototype)
+ * @author Rob Elves
*/
-public class TaskEditor extends FormEditor {
+public class TaskEditor extends SharedHeaderFormEditor {
private static final String ISSUE_WEB_PAGE_LABEL = "Browser";
@@ -76,6 +81,8 @@ public class TaskEditor extends FormEditor {
private int browserPageIndex = -1;
+ public final Object FAMILY_SUBMIT = new Object();
+
public TaskEditor() {
super();
taskPlanningEditor = new TaskPlanningEditor(this);
@@ -120,13 +127,13 @@ public class TaskEditor extends FormEditor {
webBrowser = new Browser(getContainer(), SWT.NONE);
int index = addPage(webBrowser);
setPageText(index, ISSUE_WEB_PAGE_LABEL);
-
-
+
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
webBrowser.setUrl(url);
- }});
+ }
+ });
boolean openWithBrowser = TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
TaskListPreferenceConstants.REPORT_OPEN_INTERNAL);
@@ -167,19 +174,27 @@ public class TaskEditor extends FormEditor {
return (IFormPage[]) formPages.toArray(new IFormPage[formPages.size()]);
}
-
/**
* Refresh editor with new contents (if any)
*/
public void refreshEditorContents() {
- for (IFormPage page: getPages()) {
- if(page instanceof AbstractRepositoryTaskEditor) {
- AbstractRepositoryTaskEditor editor = (AbstractRepositoryTaskEditor)page;
+ for (IFormPage page : getPages()) {
+ if (page instanceof AbstractRepositoryTaskEditor) {
+ AbstractRepositoryTaskEditor editor = (AbstractRepositoryTaskEditor) page;
editor.refreshEditor();
}
}
+ // if (webBrowser != null) {
+ // PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ //
+ // public void run() {
+ // refresh to original url?
+ // webBrowser.refresh();
+ // }
+ // });
+ // }
}
-
+
/**
* HACK: perform real check
*/
@@ -397,8 +412,9 @@ public class TaskEditor extends FormEditor {
taskEditorInput = (TaskEditorInput) getEditorInput();
task = taskEditorInput.getTask();
setPartName(taskEditorInput.getLabel());
+ setPageImage(0, TaskListImages.getImage(TaskListImages.CALENDAR));
}
-
+
int selectedIndex = index;
for (ITaskEditorFactory factory : TasksUiPlugin.getDefault().getTaskEditorFactories()) {
if (factory.canCreateEditorFor(task) || factory.canCreateEditorFor(getEditorInput())) {
@@ -407,11 +423,15 @@ public class TaskEditor extends FormEditor {
IEditorInput input = task != null ? factory.createEditorInput(task) : getEditorInput();
if (editor != null && input != null) {
FormPage taskEditor = (FormPage) editor;
- // repositoryTaskEditor.setParentEditor(this);
editor.init(getEditorSite(), input);
- //taskEditor.createPartControl(getContainer());
index = addPage(taskEditor);
+ if (input.getImageDescriptor() != null) {
+ setPageImage(index, TaskListImages.getImage(input.getImageDescriptor()));
+ }
if (editor instanceof AbstractRepositoryTaskEditor) {
+
+ ((AbstractRepositoryTaskEditor) editor).setParentEditor(this);
+
if (getEditorInput() instanceof RepositoryTaskEditorInput) {
RepositoryTaskEditorInput existingInput = (RepositoryTaskEditorInput) getEditorInput();
setPartName(existingInput.getName());
@@ -421,7 +441,7 @@ public class TaskEditor extends FormEditor {
}
setPageText(index, factory.getTitle());
selectedIndex = index;
- }
+ }
}
// HACK: overwrites if multiple present
@@ -436,6 +456,7 @@ public class TaskEditor extends FormEditor {
String urlToOpen = getUrl();
if (urlToOpen != null && !urlToOpen.equals("")) {
browserPageIndex = createBrowserPage(urlToOpen);
+ setPageImage(browserPageIndex, TaskListImages.getImage(TaskListImages.OVERLAY_WEB));
if (selectedIndex == 0 && taskEditorInput != null && !taskEditorInput.isNewTask()) {
selectedIndex = browserPageIndex;
}
@@ -452,17 +473,12 @@ public class TaskEditor extends FormEditor {
} else if (getUrl() != null) {
setTitleImage(TaskListImages.getImage(TaskListImages.TASK_WEB));
}
+
} catch (PartInitException e) {
MylarStatusHandler.fail(e, "failed to create task editor pages", false);
}
}
- @Override
- protected FormToolkit createToolkit(Display display) {
- // Create a toolkit that shares colors between editors.
- return new FormToolkit(PlatformUI.getWorkbench().getDisplay());
- }
-
/**
* Update the title of the editor
*/
@@ -472,6 +488,12 @@ public class TaskEditor extends FormEditor {
setTitleToolTip(name);
}
+ public void showBusy(boolean busy) {
+ if (!this.getHeaderForm().getForm().isDisposed()) {
+ this.getHeaderForm().getForm().setBusy(busy);
+ }
+ }
+
public ISelection getSelection() {
if (getSite() != null && getSite().getSelectionProvider() != null) {
return getSite().getSelectionProvider().getSelection();
@@ -479,4 +501,87 @@ public class TaskEditor extends FormEditor {
return StructuredSelection.EMPTY;
}
}
+
+ @Override
+ protected void createHeaderContents(IManagedForm headerForm) {
+ getToolkit().decorateFormHeading(headerForm.getForm().getForm());
+ headerForm.getForm().setImage(TaskListImages.getImage(TaskListImages.TASK));
+
+ IEditorInput input = getEditorInput();
+ if (input instanceof TaskEditorInput) {
+ ITask task = ((TaskEditorInput) input).getTask();
+ if (task instanceof AbstractRepositoryTask) {
+ setFormHeaderImage(((AbstractRepositoryTask) task).getRepositoryKind());
+ setFormHeaderLabel((AbstractRepositoryTask) task);
+ return;
+ } else {
+ getHeaderForm().getForm().setText("Task: " + task.getSummary());
+ }
+ } else if (input instanceof RepositoryTaskEditorInput) {
+ ITask task = ((RepositoryTaskEditorInput) input).getRepositoryTask();
+ if (task != null && task instanceof AbstractRepositoryTask) {
+ setFormHeaderImage(((AbstractRepositoryTask) task).getRepositoryKind());
+ setFormHeaderLabel((AbstractRepositoryTask) task);
+ return;
+ } else {
+ RepositoryTaskData data = ((RepositoryTaskEditorInput) input).getTaskData();
+ if (data != null) {
+ setFormHeaderImage(data.getRepositoryKind());
+ setFormHeaderLabel(data);
+ }
+ }
+ }
+ }
+
+ private void setFormHeaderImage(String repositoryKind) {
+ ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(repositoryKind);
+ ImageDescriptor imageDescriptor = TaskListImages.createWithOverlay(TaskListImages.REPOSITORY, overlay, false,
+ false);
+ getHeaderForm().getForm().setImage(TaskListImages.getImage(imageDescriptor));
+ }
+
+ public Form getTopForm() {
+ return this.getHeaderForm().getForm().getForm();
+ }
+
+ public void setMessage(String message, int type) {
+ this.getHeaderForm().getForm().setMessage(message, type);
+ }
+
+ protected IWorkbenchSiteProgressService getProgressService() {
+ Object siteService = getEditorSite().getAdapter(IWorkbenchSiteProgressService.class);
+ if (siteService != null)
+ return (IWorkbenchSiteProgressService) siteService;
+ return null;
+ }
+
+ private void setFormHeaderLabel(RepositoryTaskData taskData) {
+
+ String kindLabel = taskData.getTaskKind();
+ String idLabel = taskData.getId();
+
+ if (idLabel != null) {
+ getHeaderForm().getForm().setText(kindLabel + " " + idLabel);
+ } else {
+ getHeaderForm().getForm().setText(kindLabel);
+ }
+ }
+
+ private void setFormHeaderLabel(AbstractRepositoryTask repositoryTask) {
+
+ AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getRepositoryUi(repositoryTask.getRepositoryKind());
+ String kindLabel = "";
+ if (connectorUi != null) {
+ kindLabel = connectorUi.getTaskKindLabel(repositoryTask);
+ }
+
+ String idLabel = repositoryTask.getTaskKey();
+
+ if (idLabel != null) {
+ getHeaderForm().getForm().setText(kindLabel + " " + idLabel);
+ } else {
+ getHeaderForm().getForm().setText(kindLabel);
+ }
+ }
+
}

Back to the top