Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: f89e38d8af4bf6ae5448919f445ee97021531bc5 (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) 2001, 2005 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
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Jens Lukowski/Innoopract - initial renaming/restructuring
 *     
 *******************************************************************************/
package org.eclipse.wst.sse.ui.views.properties;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.IPropertySourceProvider;


/**
 * Configuration class for Property Sheet Pages. Not finalized.
 * 
 * @since 1.0
 */
public abstract class PropertySheetConfiguration {
	/**
	 * Create new instance of PropertySheetConfiguration
	 */
	public PropertySheetConfiguration() {
		// Must have empty constructor to createExecutableExtension
		super();
	}

	/**
	 * Adds contribution menu items to the given menuManager, toolbarManager,
	 * statusLineManager.
	 * 
	 * @param menuManager
	 *            the local menu manager of the property sheet
	 * @param toolBarManager
	 *            the local toolbar manager of the property sheet
	 * @param statusLineManager
	 *            the status line manager of the property sheet
	 */
	public void addContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
		// do nothing
	}

	/**
	 * Allows for filteration of selection before being sent to the viewer.
	 * 
	 * @param selectingPart
	 *            may be null
	 * @param selection
	 *            model selection
	 * @return the (filtered) selection to be sent to the viewer
	 */
	public ISelection getInputSelection(IWorkbenchPart selectingPart, ISelection selection) {
		ISelection preferredSelection = selection;
		if (selection instanceof IStructuredSelection) {
			// don't support more than one selected node
			if (((IStructuredSelection) selection).size() > 1)
				preferredSelection = StructuredSelection.EMPTY;
		}
		return preferredSelection;
	}

	/**
	 * Returns the correct IPropertySourceProvider.
	 * 
	 * @param page
	 *            the page to be configured by this configuration
	 * @return the IPropertySourceProvider for the given page
	 */
	public abstract IPropertySourceProvider getPropertySourceProvider(IPropertySheetPage page);

	/**
	 * Removes contribution menu items from the given menuManager,
	 * toolbarManager, statusLineManager.
	 * 
	 * @param menuManager
	 *            the local menu manager of the property sheet
	 * @param toolBarManager
	 *            the local toolbar manager of the property sheet
	 * @param statusLineManager
	 *            the status line manager of the property sheet
	 */
	public void removeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
		// do nothing
	}

	/**
	 * General hook for resource releasing and listener removal when
	 * configurations change.
	 */
	public void unconfigure() {
	}
}

Back to the top