Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-10-20 17:17:47 -0400
committerspingel2010-10-20 17:17:47 -0400
commit3f88b976e65c3c7da6a86d0e108a48c2b9a8d33a (patch)
tree671ab86cf99a54342e97d223a1712b818f8c6831
parent0f2b0a1196db1b381c58257d568e3e7018ad839a (diff)
downloadorg.eclipse.mylyn.tasks-3f88b976e65c3c7da6a86d0e108a48c2b9a8d33a.tar.gz
org.eclipse.mylyn.tasks-3f88b976e65c3c7da6a86d0e108a48c2b9a8d33a.tar.xz
org.eclipse.mylyn.tasks-3f88b976e65c3c7da6a86d0e108a48c2b9a8d33a.zip
NEW - bug 328209: calling dispose() from dispose listener causes crash on Gtk
https://bugs.eclipse.org/bugs/show_bug.cgi?id=328209
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java33
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java17
2 files changed, 20 insertions, 30 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java
index eba1c9eaa..29791ff74 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendControl.java
@@ -73,7 +73,11 @@ public class UiLegendControl extends Composite {
this.toolkit = toolkit;
toolkit.adapt(this);
- addListeners();
+ addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ doDispose();
+ }
+ });
TableWrapLayout layout = new TableWrapLayout();
layout.leftMargin = 0;
@@ -93,14 +97,6 @@ public class UiLegendControl extends Composite {
setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB));
}
- private void addListeners() {
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- doDispose();
- }
- });
- }
-
private void doDispose() {
for (LegendElement element : legendElements) {
element.dispose();
@@ -108,7 +104,6 @@ public class UiLegendControl extends Composite {
if (labelProvider != null) {
labelProvider.dispose();
}
- dispose();
}
public void setWindow(Window window) {
@@ -290,14 +285,16 @@ public class UiLegendControl extends Composite {
Label imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
Label labelToday = toolkit.createLabel(activityClient, Messages.UiLegendControl_Scheduled_for_today);
- labelToday.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_SCHEDULED_TODAY));
+ labelToday.setForeground(themeManager.getCurrentTheme()
+ .getColorRegistry()
+ .get(CommonThemes.COLOR_SCHEDULED_TODAY));
imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
Label labelOverdue = toolkit.createLabel(activityClient, Messages.UiLegendControl_Past_scheduled_date);
- labelOverdue.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_SCHEDULED_PAST));
+ labelOverdue.setForeground(themeManager.getCurrentTheme()
+ .getColorRegistry()
+ .get(CommonThemes.COLOR_SCHEDULED_PAST));
// imageLabel = toolkit.createLabel(activityClient, "");
// imageLabel.setImage(TasksUiImages.getImage(TasksUiImages.TASK));
@@ -319,8 +316,9 @@ public class UiLegendControl extends Composite {
imageLabel.setImage(CommonImages.getImage(TasksUiImages.TASK));
Label labelCompletedToday = toolkit.createLabel(activityClient, Messages.UiLegendControl_Completed_today);
labelCompletedToday.setFont(CommonFonts.STRIKETHROUGH);
- labelCompletedToday.setForeground(themeManager.getCurrentTheme().getColorRegistry().get(
- CommonThemes.COLOR_COMPLETED_TODAY));
+ labelCompletedToday.setForeground(themeManager.getCurrentTheme()
+ .getColorRegistry()
+ .get(CommonThemes.COLOR_COMPLETED_TODAY));
imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
imageLabel.setImage(CommonImages.getImage(CommonImages.OVERLAY_DATE_DUE));
@@ -333,7 +331,8 @@ public class UiLegendControl extends Composite {
imageLabel = toolkit.createLabel(activityClient, ""); //$NON-NLS-1$
imageLabel.setImage(CommonImages.getImage(CommonImages.BLANK));
- Hyperlink adjust = toolkit.createHyperlink(activityClient, Messages.UiLegendControl_Adjust_Colors_and_Fonts_, SWT.WRAP);
+ Hyperlink adjust = toolkit.createHyperlink(activityClient, Messages.UiLegendControl_Adjust_Colors_and_Fonts_,
+ SWT.WRAP);
adjust.addHyperlinkListener(new IHyperlinkListener() {
public void linkActivated(HyperlinkEvent e) {
PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(PlatformUI.getWorkbench()
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
index 67381727b..56bb2ed1c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/UiLegendDialog.java
@@ -14,6 +14,7 @@ package org.eclipse.mylyn.internal.tasks.ui.dialogs;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.PopupDialog;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -54,26 +55,16 @@ public class UiLegendDialog extends PopupDialog {
@Override
public boolean close() {
- if (form != null && !form.isDisposed()) {
- form.dispose();
- }
-
if (toolkit != null) {
- if (toolkit.getColors() != null) {
- toolkit.dispose();
- }
- }
-
- if (content != null && !content.isDisposed()) {
- content.dispose();
+ toolkit.dispose();
}
-
return super.close();
}
@Override
protected Control createDialogArea(Composite parent) {
- toolkit = new FormToolkit(parent.getDisplay());
+ toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
+
form = toolkit.createScrolledForm(parent);
form.setText(Messages.UiLegendControl_Tasks_UI_Legend);
form.getToolBarManager().add(new CloseDialogAction());

Back to the top