Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-03-28 06:14:41 +0000
committerAlexander Kurtakov2018-03-28 06:14:41 +0000
commit6217ccaf33afec8688f6e8fc2fa9b02219b655a1 (patch)
tree823260dfead85b3cb7a54edb5b5b0d34fdd7a1a7
parentef45b0d79f051a5b94373fe2b75d93344df9a570 (diff)
downloadeclipse.platform.ua-6217ccaf33afec8688f6e8fc2fa9b02219b655a1.tar.gz
eclipse.platform.ua-6217ccaf33afec8688f6e8fc2fa9b02219b655a1.tar.xz
eclipse.platform.ua-6217ccaf33afec8688f6e8fc2fa9b02219b655a1.zip
Bug 532977 - Use system cursors to prevent manual disposal
Change-Id: Id30de44a8f00e01acf79282ddbd43487846e648e Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HyperlinkHandler.java37
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java7
-rw-r--r--org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java6
3 files changed, 12 insertions, 38 deletions
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HyperlinkHandler.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HyperlinkHandler.java
index f23f2328d..d5b31b234 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HyperlinkHandler.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/HyperlinkHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -29,12 +29,7 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
-public class HyperlinkHandler
- implements
- MouseListener,
- MouseTrackListener,
- PaintListener,
- Listener {
+public class HyperlinkHandler implements MouseListener, MouseTrackListener, PaintListener, Listener {
public static final int UNDERLINE_NEVER = 1;
public static final int UNDERLINE_ROLLOVER = 2;
public static final int UNDERLINE_ALWAYS = 3;
@@ -53,14 +48,8 @@ public class HyperlinkHandler
*/
public HyperlinkHandler() {
hyperlinkListeners = new Hashtable<>();
- hyperlinkCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
- busyCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);
- }
- /**
- */
- public void dispose() {
- hyperlinkCursor.dispose();
- busyCursor.dispose();
+ hyperlinkCursor = Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND);
+ busyCursor = Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT);
}
/**
* @return org.eclipse.swt.graphics.Color
@@ -81,24 +70,12 @@ public class HyperlinkHandler
return background;
}
/**
- * @return org.eclipse.swt.graphics.Cursor
- */
- public Cursor getBusyCursor() {
- return busyCursor;
- }
- /**
* @return org.eclipse.swt.graphics.Color
*/
public Color getForeground() {
return foreground;
}
/**
- * @return org.eclipse.swt.graphics.Cursor
- */
- public Cursor getHyperlinkCursor() {
- return hyperlinkCursor;
- }
- /**
* @return int
*/
public int getHyperlinkUnderlineMode() {
@@ -255,16 +232,18 @@ public class HyperlinkHandler
public void setForeground(Color newForeground) {
foreground = newForeground;
}
+
/**
* @param newHyperlinkCursorUsed
- * boolean
+ * boolean
*/
public void setHyperlinkCursorUsed(boolean newHyperlinkCursorUsed) {
hyperlinkCursorUsed = newHyperlinkCursorUsed;
}
+
/**
* @param newHyperlinkUnderlineMode
- * int
+ * int
*/
public void setHyperlinkUnderlineMode(int newHyperlinkUnderlineMode) {
hyperlinkUnderlineMode = newHyperlinkUnderlineMode;
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java
index 94662a7e3..afa5a7b24 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/HyperlinkTreePart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation 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
@@ -105,8 +105,6 @@ public abstract class HyperlinkTreePart extends AbstractFormPart implements
private TreeItem lastItem;
- private Cursor handCursor;
-
private ScopeObserver scopeObserver;
/**
@@ -116,7 +114,7 @@ public abstract class HyperlinkTreePart extends AbstractFormPart implements
*/
public HyperlinkTreePart(Composite parent, final FormToolkit toolkit,
IToolBarManager tbm) {
- handCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
+ Cursor handCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
/*
container = toolkit.createComposite(parent);
GridLayout layout = new GridLayout();
@@ -242,7 +240,6 @@ public abstract class HyperlinkTreePart extends AbstractFormPart implements
@Override
public void dispose() {
- handCursor.dispose();
if (scopeObserver != null) {
ScopeState.getInstance().getScopeSetManager().deleteObserver(scopeObserver);
}
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
index 6be2b2be3..a4d7a5bdf 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/views/CheatSheetViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2017 IBM Corporation and others.
+ * Copyright (c) 2002, 2018 IBM Corporation 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
@@ -640,7 +640,7 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
Display display = parent.getDisplay();
- busyCursor = new Cursor(display, SWT.CURSOR_WAIT);
+ busyCursor = display.getSystemCursor(SWT.CURSOR_WAIT);
if(contentElement != null) {
initCheatSheetView();
@@ -698,8 +698,6 @@ public class CheatSheetViewer implements ICheatSheetViewer, IMenuContributor {
*/
private void dispose() {
internalDispose();
- if (busyCursor != null)
- busyCursor.dispose();
}
/*

Back to the top