Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: dc5a9a619e33cdc4aa7cc202ce35eebd0a5423d4 (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
/*****************************************************************
 * Copyright (c) 2011 Texas Instruments 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:
 *     Winnie Lai (Texas Instruments) - Individual Element Number Format (Bug 202556)
 *****************************************************************/
package org.eclipse.cdt.dsf.debug.ui.viewmodel.numberformat;

import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
import org.eclipse.cdt.dsf.ui.viewmodel.IVMContext;
import org.eclipse.cdt.dsf.ui.viewmodel.IVMNode;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.jface.viewers.TreePath;

/**
 * Element format provider - an optional interface that provides individual element format
 * A view model provider (org.eclipse.cdt.dsf.ui.viewmodel.IVMProvider) can optionally implement this interface.
 * If there is a requirement to persist individual format settings, this provider can
 * add an persistable (IPersistable) property to PresentationContext so that when presentation context
 * is invoked to persist its properties, the individual format settings are persisted as well.
 *
 * @since 2.2
 */
public interface IElementFormatProvider {
	/**
	 * Get active format for a given element.
	 * @param context presentation context
	 * @param node view model node
	 * @param viewerInput viewer input
	 * @param elementPath element path of the given element
	 * @param rm request monitor
	 * @return active format if available. Calls rm.setData(null) if there is no active format.
	 *         The caller will use the active format if the returned format is available,
	 *         and will use preference format if the returned format is null or not available.
	 *         Note that if caller finds that the preference format is not available from service,
	 *         it will use the first available format from service. See FormattedValueRetriever.
	 */
	public void getActiveFormat(IPresentationContext context, IVMNode node, Object viewerInput, TreePath elementPath,
			DataRequestMonitor<String> rm);

	/**
	 * Set active format for given elements. The caller will not fire any event to update view.
	 * The implementation of this method should fire proper events to refresh impacted elements.
	 * One way is to refresh the view through IVMCachingProvider.refresh but it will
	 * refresh other non-impacted elements.
	 * Another way that may be more optimal is to fire ElementFormatEvent that stores exactly the
	 * impacted elements. The view model can then handle the event more efficiently.
	 * @param context presentation context
	 * @param node view model nodes
	 * @param viewerInput viewer input
	 * @param elementPath element path of given elements
	 * @param format format
	 */
	public void setActiveFormat(IPresentationContext context, IVMNode[] node, Object viewerInput,
			TreePath[] elementPath, String format);

	/**
	 * Test if this provider supports individual element format for a given context
	 * @param context given context
	 * @return true if this provider supports individual element format.
	 */
	public boolean supportFormat(IVMContext context);
}

Back to the top