mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
new ICDescriptor method getDescritor(IProject project, boolean create)
This commit is contained in:
parent
1d2f0a957b
commit
95eca12e8f
4 changed files with 74 additions and 2 deletions
|
@ -1,3 +1,12 @@
|
|||
2004-06-09 David Inglis
|
||||
|
||||
added new ICDescriptor manager method to get a descriptor with the option of creating
|
||||
one if it does not exists.
|
||||
|
||||
* src/org/eclipse/cdt/core/ICDescriptorManager.java
|
||||
* src/org/eclipse/cdt/core/CCorePlugin.java
|
||||
* src/org/eclipse/cdt/internal/core/CDescriptorManager.java
|
||||
|
||||
2004-06-08 Tanya Wolff
|
||||
|
||||
Fix for I18N defect 66136
|
||||
|
|
|
@ -703,10 +703,29 @@ public class CCorePlugin extends Plugin {
|
|||
return fCoreModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return
|
||||
* @throws CoreException
|
||||
* @deprecated use getCProjetDescription(IProject project, boolean create)
|
||||
*/
|
||||
public ICDescriptor getCProjectDescription(IProject project) throws CoreException {
|
||||
return fDescriptorManager.getDescriptor(project);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ICDescriptor for the given project, if <b>create</b> is <b>true</b> then a descriptor will be created
|
||||
* if one does not exist.
|
||||
*
|
||||
* @param project
|
||||
* @param create
|
||||
* @return ICDescriptor or <b>null</b> if <b>create</b> is <b>false</b> and no .cdtproject file exists on disk.
|
||||
* @throws CoreException
|
||||
*/
|
||||
public ICDescriptor getCProjectDescription(IProject project, boolean create) throws CoreException {
|
||||
return fDescriptorManager.getDescriptor(project, create);
|
||||
}
|
||||
|
||||
public void mapCProjectOwner(IProject project, String id, boolean override) throws CoreException {
|
||||
if (!override) {
|
||||
fDescriptorManager.configure(project, id);
|
||||
|
|
|
@ -14,13 +14,50 @@ import org.eclipse.core.runtime.CoreException;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
public interface ICDescriptorManager {
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @param id
|
||||
* @throws CoreException
|
||||
*/
|
||||
public void configure(IProject project, String id) throws CoreException;
|
||||
/**
|
||||
* @param project
|
||||
* @param id
|
||||
* @throws CoreException
|
||||
*/
|
||||
public void convert(IProject project, String id) throws CoreException;
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return
|
||||
* @throws CoreException
|
||||
*/
|
||||
public ICDescriptor getDescriptor(IProject project) throws CoreException;
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @param forceCreation
|
||||
* @return
|
||||
* @throws CoreException
|
||||
*/
|
||||
public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException;
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @param op
|
||||
* @param monitor
|
||||
* @throws CoreException
|
||||
*/
|
||||
public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException;
|
||||
|
||||
/**
|
||||
* @param listener
|
||||
*/
|
||||
public void addDescriptorListener(ICDescriptorListener listener);
|
||||
|
||||
/**
|
||||
* @param listener
|
||||
*/
|
||||
public void removeDescriptorListener(ICDescriptorListener listener);
|
||||
}
|
||||
|
|
|
@ -231,8 +231,12 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
|
|||
}
|
||||
|
||||
synchronized public ICDescriptor getDescriptor(IProject project) throws CoreException {
|
||||
return getDescriptor(project, true);
|
||||
}
|
||||
|
||||
synchronized public ICDescriptor getDescriptor(IProject project, boolean create) throws CoreException {
|
||||
CDescriptor descriptor = (CDescriptor)fDescriptorMap.get(project);
|
||||
if (descriptor == null) {
|
||||
if (descriptor == null && create) {
|
||||
descriptor = new CDescriptor(this, project);
|
||||
fDescriptorMap.put(project, descriptor);
|
||||
}
|
||||
|
@ -338,7 +342,10 @@ public class CDescriptorManager implements ICDescriptorManager, IResourceChangeL
|
|||
}
|
||||
|
||||
public void runDescriptorOperation(IProject project, ICDescriptorOperation op, IProgressMonitor monitor) throws CoreException {
|
||||
ICDescriptor descriptor = getDescriptor(project);
|
||||
ICDescriptor descriptor = getDescriptor(project, false);
|
||||
if (descriptor == null) {
|
||||
throw new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, "Project does not have descriptor", null)); //$NON-NLS-1$
|
||||
}
|
||||
CDescriptorEvent event = null;
|
||||
synchronized (descriptor) {
|
||||
beginOperation(descriptor);
|
||||
|
|
Loading…
Add table
Reference in a new issue