1 /*******************************************************************************
2 * Copyright (c) 2009 QNX Software Systems and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * QNX Software Systems - initial API and implementation
10 *******************************************************************************/
12 package org.eclipse.cdt.internal.ui.workingsets;
14 import java.util.Collection;
16 import org.eclipse.core.resources.IProject;
17 import org.eclipse.core.resources.IResource;
18 import org.eclipse.core.runtime.IProgressMonitor;
19 import org.eclipse.core.runtime.IStatus;
21 import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
25 * The protocol for project configurations in a working set configuration. At a minimum, the project
26 * configuration specifies which build configuration is {@linkplain #getSelectedConfigurationID() selected} to
27 * be set as the project's active configuration. Implementations are free to add more configuration
28 * information than the selected build configuration.
31 * Note that project configurations are owned by working set configurations. Thus, different configurations of
32 * the same (or different) working set may specify different settings for the same project.
35 * @author Christian W. Damus (cdamus)
39 public interface IWorkingSetProjectConfiguration extends IWorkingSetConfigurationElement {
41 * Obtains the working set configuration element that owns me.
43 * @return my working set configuration
45 IWorkingSetConfiguration getWorkingSetConfiguration();
48 * Queries the name of the project that I configure.
50 * @return my project name
52 String getProjectName();
55 * Resolves my project name to the actual project resource in the workspace.
57 * @return my referenced project, or <code>null</code> if the project is not
58 * {@linkplain IResource#isAccessible() accessible} in the workspace
60 IProject resolveProject();
63 * Queries the ID of the build configuration that is currently selected for my project.
65 * @return my selected build configuration ID
67 String getSelectedConfigurationID();
71 * Resolves my selected configuration reference to the C model's description handle for it.
74 * <b>Note</b> that, in the general case, it is possible for the configuration to resolve to a different
75 * object from one call to the next, but always representing the same configuration. However, in the case
76 * of a working-copy {@linkplain IWorkingSetProjectConfiguration.ISnapshot snapshot} of me, the result
77 * will always be the same object.
80 * @return the C model representation of my selected build configuration
82 * @see #resolveConfigurations()
84 ICConfigurationDescription resolveSelectedConfiguration();
88 * Resolves the set of available configurations of my project.
91 * <b>Note</b> that, in the general case, it is possible for these configurations to resolve to different
92 * objects from one call to the next, but always representing the same configurations. However, in the
93 * case of a working-copy {@linkplain IWorkingSetProjectConfiguration.ISnapshot snapshot} of me, the
94 * results will always be the same objects.
97 * @return the C model representation of my selected available build configurations
99 * @see #resolveSelectedConfiguration()
101 Collection<ICConfigurationDescription> resolveConfigurations();
104 * Queries whether my project currently has my selected configuration active in the workspace.
106 * @return whether I am my project's active configuration
108 * @see #getSelectedConfigurationID()
114 * Activates my selected configuration in the workspace, for my project.
116 * @see #getSelectedConfigurationID()
117 * @see ISnapshot#setSelectedConfigurationID(String)
123 * Builds my selected configuration in the workspace, for my project. If building the configuration
124 * actually requires activating it, and it was not already active, then it would be a good idea to return
125 * a warning status indicating that the active configuration had to be changed in order to effect the
129 * a progress monitor to report build progress
130 * @return a status indicating any error or warning conditions in the invocation of the build
132 IStatus build(IProgressMonitor monitor);
135 * Creates a <i>snapshot</i> (also known as a "working copy") of myself, providing a mutable view suitable
138 * @param workingSetConfig
139 * my parent working set configuration snapshot
141 * a workspace snapshot that captures the baseline state of the workspace and the working set
142 * configurations that are to be edited
144 * @return a working-copy snapshot of myself
146 ISnapshot createSnapshot(IWorkingSetConfiguration.ISnapshot workingSetConfig, WorkspaceSnapshot workspace);
153 * The snapshot ("working copy") view of a working set project configuration.
155 * @author Christian W. Damus (cdamus)
159 interface ISnapshot extends IWorkingSetProjectConfiguration, IWorkingSetConfigurationElement.ISnapshot {
160 IWorkingSetConfiguration.ISnapshot getWorkingSetConfiguration();
163 * Sets the ID of the build configuration that is currently selected for my project.
166 * my selected build configuration ID
168 void setSelectedConfigurationID(String id);