Skip to main content
summaryrefslogtreecommitdiffstats
blob: 4b6083aa55df9e2c9f2b0dda07d3f75ae9693dcf (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.texteditor.spelling;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;


/**
 * Contributors to the <code>org.eclipse.ui.texteditor.spellingEngine</code>
 * extension point can specify an implementation of this interface to be
 * displayed on the spelling preference page, if the corresponding engine is
 * selected.
 * <p>
 * This interface is intended to be implemented by clients.
 * </p>
 *
 * @since 3.1
 */
public interface ISpellingPreferenceBlock {

	/**
	 * Creates the control that will be displayed on the preference page.
	 *
	 * @param parent the parent composite to which to add the preferences control
	 * @return the control that was added to <code>parent</code>
	 */
	Control createControl(Composite parent);

	/**
	 * Called after creating the control. Implementations should load the
	 * preferences values and update the controls accordingly. A status
	 * monitor is supplied to allow for status reporting to the user.
	 *
	 * @param statusMonitor the status monitor
	 */
	void initialize(IPreferenceStatusMonitor statusMonitor);

	/**
	 * Sets the enablement of all controls of this preference block.
	 *
	 * @param enabled <code>true</code> iff the controls should be enabled
	 */
	void setEnabled(boolean enabled);

	/**
	 * Returns <code>true</code> iff {@link #performOk()} may be called. A
	 * preference block may, for example, return <code>false</code> if
	 * some user supplied value is not valid (and validation is an expensive
	 * operation, use {@link IPreferenceStatusMonitor} to report validation
	 * results on-the-fly). A preference block may also request additional
	 * user input and cancel the initiated {@link #performOk()}, based on
	 * that input.
	 * <p>
	 * Note that this method is guaranteed to be called only on an enabled
	 * spelling engine, any spelling engine should be prepared to store its
	 * settings on {@link #performOk()} without a preceding call to this
	 * method.
	 * </p>
	 *
	 * @return <code>true</code> iff <code>performOk()</code> may be
	 *         called
	 */
	boolean canPerformOk();

	/**
	 * Called when the <code>OK</code> button is pressed on the preference
	 * page. Implementations should commit the configured preference
	 * settings into their form of preference storage.
	 */
	void performOk();

	/**
	 * Called when the <code>Defaults</code> button is pressed on the
	 * preference page. Implementation should reset any preference settings to
	 * their default values and adjust the controls accordingly.
	 */
	void performDefaults();

	/**
	 * Called when the user decided to dismiss all changes. Implementation
	 * should reset any working copy changes to their previous values and
	 * adjust the controls accordingly.
	 */
	void performRevert();

	/**
	 * Called when the preference page is being disposed. Implementations should
	 * free any resources they are holding on to.
	 */
	void dispose();

}

Back to the top