Skip to main content
summaryrefslogtreecommitdiffstats
blob: acaf5b57d38db84798e6e145ed42d20b03c26596 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/**********************************************************************
 * Copyright (c) 2004 Intel Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors: 
 * Intel Corporation - Initial API and implementation
 **********************************************************************/
package org.eclipse.cdt.managedbuilder.core;

import org.eclipse.core.resources.IResource;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

/**
 * This class represents a project instance in the managed build system.
 * Project instances are stored in the .cdtbuild file.  Note that there 
 * is no reason to define a project element in a manifest file – it 
 * would never be used.
 * <p>
 * The following steps occur when a CDT user creates a new Managed Build 
 * project:
 * 1. A new project element is created.  Its projectType attribute is set
 *    to the projectType that the user selected.  Its name attribute is 
 *    set to the project name that the user entered.
 * 2. When the user adds a default configuration, a configuration
 *    element is created as a child of the project element created in 
 *    step 1.
 * 3. Add a tool-chain element that specifies as its superClass the 
 *    tool-chain that is the child of the selected configuration element.
 * 4. For each tool element child of the tool-chain that is the child of 
 *    the selected configuration element, create a tool element child of 
 *    the cloned configuration’s tool-chain element that specifies the 
 *    original tool element as its superClass.
 * This prepares the new project/configurations for modification by the user. 
 * 
 * @since 2.1
 */
public interface IManagedProject extends IBuildObject {
	public static final String MANAGED_PROJECT_ELEMENT_NAME = "project";	//$NON-NLS-1$
	public static final String PROJECTTYPE = "projectType";					//$NON-NLS-1$
	
	/**
	 * Creates a configuration for this project populated with the tools
	 * and options settings from the parent configuration.  As options and 
	 * tools change in the parent, unoverridden values are updated in the 
	 * child configuration as well.
	 * <p>
	 * This method performs steps 3 & 4 described above.
	 * 
	 * @param parent The <code>IConfiguration</code> to use as a settings template
	 * @param id The unique id the new configuration will have
	 * @return IConfiguration of the new configuration
	 */
	public IConfiguration createConfiguration(IConfiguration parent, String id);
	
	/**
	 * Creates a configuration for this project populated with the tools
	 * and options settings from the parent configuration.  As opposed to the 
	 * <code>createConfiguration</code> method, this method creates a configuration
	 * from an existing configuration in the project.
	 * <p>
	 * In this case, the new configuration is cloned from the existing configuration,
	 * and does not retain a pointer to the existing configuration.
	 * 
	 * @param parent The <code>IConfiguration</code> to clone
	 * @param id The unique id the new configuration will have
	 * @return IConfiguration of the new configuration
	 */
	public IConfiguration createConfigurationClone(IConfiguration parent, String id);

	/**
	 * Removes the configuration with the ID specified in the argument.
	 * 
	 * @param id The unique id of the configuration
	 */
	public void removeConfiguration(String id);

	/**
	 * Returns all of the configurations defined by this project-type.
	 * 
	 * @return IConfiguration[]
	 */
	public IConfiguration[] getConfigurations();

	/**
	 * Returns the configuration with the given id, or <code>null</code> if not found.
	 * 
	 * @param id The unique id of the configuration
	 * @return IConfiguration
	 */
	public IConfiguration getConfiguration(String id);

	/**
	 * Answers the <code>IProjectType</code> that is the superclass of this
	 * project-type, or <code>null</code> if the attribute was not specified.
	 * 
	 * @return IProjectType
	 */
	public IProjectType getProjectType();

	/**
	 * Returns the owner of the managed project (an IProject).
	 * 
	 * @return IResource
	 */
	public IResource getOwner();

	/**
	 * Sets the owner of the managed project.
	 * 
	 * @param resource
	 */
	public void updateOwner(IResource resource);

	/**
	 * Returns <code>true</code> if this project has changes that need to 
	 * be saved in the project file, else <code>false</code>.
	 * 
	 * @return boolean 
	 */
	public boolean isDirty();
	
	/**
	 * Sets the element's "dirty" (have I been modified?) flag.
	 * 
	 * @param isDirty
	 */
	public void setDirty(boolean isDirty);

	/**
	 * Returns <code>true</code> if this project is valid 
	 * else <code>false</code>.
	 * 
	 * @return boolean 
	 */
	public boolean isValid();
	
	/**
	 * Sets the element's "Valid" flag.
	 * 
	 * @param isValid
	 */
	public void setValid(boolean isValid);

	/**
	 * Persist the managed project to the project file (.cdtbuild).
	 * 
	 * @param doc
	 * @param element
	 */
	public void serialize(Document doc, Element element);

	/**
	 * Returns the default build artifact name for the project
	 * 
	 * @return String
	 */
	public String getDefaultArtifactName();
}

Back to the top