Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a5dc3f25138b91a56dec7e90ca4ae2ebc0f907f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*******************************************************************************
 * Copyright (c) 2016 Obeo.
 * 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:
 *    Obeo - initial API and implementation
 *******************************************************************************/
package org.eclipse.eef.ide.ui.internal.widgets.quickfix;

import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;

/**
 * The hyperlink listener will be used to display the quick fix to run when the user click on a message.
 *
 * @author sbegaudeau
 */
public class EEFMessageHyperlinkListener implements IHyperlinkListener {

	/**
	 * The shell.
	 */
	private Shell shell;

	/**
	 * The constructor.
	 *
	 * @param shell
	 *            The shell used to display the page
	 */
	public EEFMessageHyperlinkListener(Shell shell) {
		this.shell = shell;
	}

	/**
	 * {@inheritDoc}
	 *
	 * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org.eclipse.ui.forms.events.HyperlinkEvent)
	 */
	@Override
	public void linkEntered(HyperlinkEvent event) {
		// do nothing
	}

	/**
	 * {@inheritDoc}
	 *
	 * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org.eclipse.ui.forms.events.HyperlinkEvent)
	 */
	@Override
	public void linkExited(HyperlinkEvent event) {
		// do nothing
	}

	/**
	 * {@inheritDoc}
	 *
	 * @see org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent)
	 */
	@Override
	public void linkActivated(HyperlinkEvent event) {
		Object data = event.data;
		if (data instanceof IMessage[]) {
			IMessage[] messages = (IMessage[]) data;
			Wizard wizard = new EEFQuickFixWizard(messages);
			WizardDialog wizardDialog = new WizardDialog(shell, wizard);
			wizardDialog.open();
		}
	}

}

Back to the top