mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
project conversion fixes
This commit is contained in:
parent
97d6043d03
commit
3add45dbdf
9 changed files with 211 additions and 82 deletions
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.core;
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -32,6 +34,16 @@ import java.util.TreeMap;
|
||||||
|
|
||||||
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
import javax.xml.parsers.DocumentBuilderFactory;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.FactoryConfigurationError;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerConfigurationException;
|
||||||
|
import javax.xml.transform.TransformerException;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.TransformerFactoryConfigurationError;
|
||||||
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.AbstractCExtension;
|
import org.eclipse.cdt.core.AbstractCExtension;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -86,6 +98,7 @@ import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.resources.IResourceStatus;
|
||||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||||
import org.eclipse.core.resources.IWorkspaceRunnable;
|
import org.eclipse.core.resources.IWorkspaceRunnable;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
|
@ -113,6 +126,7 @@ import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
import org.w3c.dom.ProcessingInstruction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the main entry point for getting at the build information
|
* This is the main entry point for getting at the build information
|
||||||
|
@ -1237,6 +1251,132 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean saveBuildInfoLegacy(IProject project, boolean force) {
|
||||||
|
// Create document
|
||||||
|
Exception err = null;
|
||||||
|
try {
|
||||||
|
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
|
Document doc = builder.newDocument();
|
||||||
|
|
||||||
|
// Get the build information for the project
|
||||||
|
ManagedBuildInfo buildInfo = (ManagedBuildInfo) getBuildInfo(project);
|
||||||
|
|
||||||
|
// Save the build info
|
||||||
|
if (buildInfo != null &&
|
||||||
|
!buildInfo.isReadOnly() &&
|
||||||
|
buildInfo.isValid() &&
|
||||||
|
(force == true || buildInfo.isDirty())) {
|
||||||
|
// For post-2.0 projects, there will be a version
|
||||||
|
String projectVersion = buildInfo.getVersion();
|
||||||
|
if (projectVersion != null) {
|
||||||
|
ProcessingInstruction instruction = doc.createProcessingInstruction(VERSION_ELEMENT_NAME, projectVersion);
|
||||||
|
doc.appendChild(instruction);
|
||||||
|
}
|
||||||
|
Element rootElement = doc.createElement(ROOT_NODE_NAME);
|
||||||
|
doc.appendChild(rootElement);
|
||||||
|
buildInfo.serializeLegacy(doc, rootElement);
|
||||||
|
|
||||||
|
// Transform the document to something we can save in a file
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
Transformer transformer = TransformerFactory.newInstance().newTransformer();
|
||||||
|
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
|
||||||
|
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
|
||||||
|
DOMSource source = new DOMSource(doc);
|
||||||
|
StreamResult result = new StreamResult(stream);
|
||||||
|
transformer.transform(source, result);
|
||||||
|
|
||||||
|
// Save the document
|
||||||
|
IFile projectFile = project.getFile(SETTINGS_FILE_NAME);
|
||||||
|
String utfString = stream.toString("UTF-8"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
if (projectFile.exists()) {
|
||||||
|
if (projectFile.isReadOnly()) {
|
||||||
|
// If we are not running headless, and there is a UI Window around, grab it
|
||||||
|
// and the associated shell
|
||||||
|
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||||
|
if (window == null) {
|
||||||
|
IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
|
||||||
|
window = windows[0];
|
||||||
|
}
|
||||||
|
Shell shell = null;
|
||||||
|
if (window != null) {
|
||||||
|
shell = window.getShell();
|
||||||
|
}
|
||||||
|
// Inform Eclipse that we are intending to modify this file
|
||||||
|
// This will provide the user the opportunity, via UI prompts, to fetch the file from source code control
|
||||||
|
// reset a read-only file protection to write etc.
|
||||||
|
// If there is no shell, i.e. shell is null, then there will be no user UI interaction
|
||||||
|
IStatus status = projectFile.getWorkspace().validateEdit(new IFile[]{projectFile}, shell);
|
||||||
|
// If the file is still read-only, then we should not attempt the write, since it will
|
||||||
|
// just fail - just throw an exception, to be caught below, and inform the user
|
||||||
|
// For other non-successful status, we take our chances, attempt the write, and pass
|
||||||
|
// along any exception thrown
|
||||||
|
if (!status.isOK()) {
|
||||||
|
if (status.getCode() == IResourceStatus.READ_ONLY_LOCAL) {
|
||||||
|
stream.close();
|
||||||
|
throw new IOException(ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_READ_ONLY, projectFile.getFullPath().toString())); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
projectFile.setContents(new ByteArrayInputStream(utfString.getBytes("UTF-8")), IResource.FORCE, new NullProgressMonitor()); //$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
projectFile.create(new ByteArrayInputStream(utfString.getBytes("UTF-8")), IResource.FORCE, new NullProgressMonitor()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close the streams
|
||||||
|
stream.close();
|
||||||
|
}
|
||||||
|
} catch (ParserConfigurationException e) {
|
||||||
|
err = e;
|
||||||
|
} catch (FactoryConfigurationError e) {
|
||||||
|
err = e.getException();
|
||||||
|
} catch (TransformerConfigurationException e) {
|
||||||
|
err = e;
|
||||||
|
} catch (TransformerFactoryConfigurationError e) {
|
||||||
|
err = e.getException();
|
||||||
|
} catch (TransformerException e) {
|
||||||
|
err = e;
|
||||||
|
} catch (IOException e) {
|
||||||
|
// The save failed
|
||||||
|
err = e;
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// Save to IFile failed
|
||||||
|
err = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err != null) {
|
||||||
|
// Put out an error message indicating that the attempted write to the .cdtbuild project file failed
|
||||||
|
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||||
|
if (window == null) {
|
||||||
|
IWorkbenchWindow windows[] = PlatformUI.getWorkbench().getWorkbenchWindows();
|
||||||
|
window = windows[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
final Shell shell = window.getShell();
|
||||||
|
if (shell != null) {
|
||||||
|
final String exceptionMsg = err.getMessage();
|
||||||
|
shell.getDisplay().syncExec( new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
MessageDialog.openError(shell,
|
||||||
|
ManagedMakeMessages.getResourceString("ManagedBuildManager.error.write_failed_title"), //$NON-NLS-1$
|
||||||
|
ManagedMakeMessages.getFormattedString(MANIFEST_ERROR_WRITE_FAILED, //$NON-NLS-1$
|
||||||
|
exceptionMsg));
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If we return an honest status when the operation fails, there are instances when the UI behavior
|
||||||
|
// is not very good
|
||||||
|
// Specifically, if "OK" is clicked by the user from the property page UI, and the return status
|
||||||
|
// from this routine is false, the property page UI will not be closed (note: this is Eclispe code) and
|
||||||
|
// the OK button will simply be grayed out
|
||||||
|
// At this point, the only way out is to click "Cancel" to get the UI to go away; note however that any
|
||||||
|
// property page changes will be sticky, in the UI, which is nonintuitive and confusing
|
||||||
|
// Therefore, just always return success, i.e. true, from this routine
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean saveBuildInfo(IProject project, boolean force) {
|
public static boolean saveBuildInfo(IProject project, boolean force) {
|
||||||
try {
|
try {
|
||||||
return updateBuildInfo(project, force);
|
return updateBuildInfo(project, force);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
import org.eclipse.cdt.core.settings.model.WriteAccessException;
|
||||||
|
import org.eclipse.cdt.core.settings.model.util.XmlStorageElement;
|
||||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
import org.eclipse.cdt.managedbuilder.core.IBuilder;
|
||||||
|
@ -58,8 +59,8 @@ import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -728,13 +729,13 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
* @param doc
|
* @param doc
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
/* public void serialize(Document doc, Element element) {
|
public void serializeLegacy(Document doc, Element element) {
|
||||||
// Write out the managed build project
|
// Write out the managed build project
|
||||||
|
|
||||||
if(managedProject != null){
|
if(managedProject != null){
|
||||||
Element projElement = doc.createElement(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
|
Element projElement = doc.createElement(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
|
||||||
element.appendChild(projElement);
|
element.appendChild(projElement);
|
||||||
managedProject.serialize(doc, projElement);
|
((ManagedProject)managedProject).serialize(new XmlStorageElement(projElement), true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Iterator iter = getTargets().listIterator();
|
Iterator iter = getTargets().listIterator();
|
||||||
|
@ -751,12 +752,12 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
|
|
||||||
|
|
||||||
// Remember the default configuration
|
// Remember the default configuration
|
||||||
persistDefaultConfiguration();
|
// persistDefaultConfiguration();
|
||||||
|
|
||||||
// I'm clean now
|
// I'm clean now
|
||||||
setDirty(false);
|
setDirty(false);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
|
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
import org.eclipse.cdt.core.settings.model.ICStorageElement;
|
||||||
import org.eclipse.cdt.core.settings.model.util.XmlStorageElement;
|
|
||||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyType;
|
||||||
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
|
||||||
|
@ -37,9 +36,6 @@ import org.eclipse.cdt.utils.envvar.StorableEnvironment;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
import org.eclipse.core.runtime.PluginVersionIdentifier;
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import org.w3c.dom.Node;
|
|
||||||
import org.w3c.dom.NodeList;
|
|
||||||
|
|
||||||
public class ManagedProject extends BuildObject implements IManagedProject, IBuildPropertiesRestriction, IBuildPropertyChangeListener {
|
public class ManagedProject extends BuildObject implements IManagedProject, IBuildPropertiesRestriction, IBuildPropertyChangeListener {
|
||||||
|
|
||||||
|
@ -229,42 +225,36 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.managedbuilder.core.IManagedProject#serialize()
|
* @see org.eclipse.cdt.managedbuilder.core.IManagedProject#serialize()
|
||||||
*/
|
*/
|
||||||
/* public void serialize(Document doc, Element element) {
|
public void serialize(ICStorageElement element, boolean saveChildren) {
|
||||||
element.setAttribute(IBuildObject.ID, id);
|
serializeProjectInfo(element);
|
||||||
|
|
||||||
if (name != null) {
|
if(saveChildren){
|
||||||
element.setAttribute(IBuildObject.NAME, name);
|
Collection configElements = getConfigurationCollection();
|
||||||
}
|
Iterator iter = configElements.iterator();
|
||||||
|
|
||||||
if (projectType != null) {
|
|
||||||
element.setAttribute(PROJECTTYPE, projectType.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serialize my children
|
|
||||||
List configElements = getConfigurationList();
|
|
||||||
Iterator iter = configElements.listIterator();
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Configuration config = (Configuration) iter.next();
|
Configuration config = (Configuration) iter.next();
|
||||||
Element configElement = doc.createElement(IConfiguration.CONFIGURATION_ELEMENT_NAME);
|
ICStorageElement configElement = element.createChild(IConfiguration.CONFIGURATION_ELEMENT_NAME);
|
||||||
element.appendChild(configElement);
|
config.serialize(configElement);
|
||||||
config.serialize(doc, configElement);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//serialize user-defined macros
|
|
||||||
if(userDefinedMacros != null){
|
|
||||||
Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
|
|
||||||
element.appendChild(macrosElement);
|
|
||||||
userDefinedMacros.serialize(doc,macrosElement);
|
|
||||||
}
|
}
|
||||||
|
// Serialize my children
|
||||||
|
|
||||||
if(userDefinedEnvironment != null){
|
// //serialize user-defined macros
|
||||||
EnvironmentVariableProvider.fUserSupplier.storeEnvironment(this,true);
|
// if(userDefinedMacros != null){
|
||||||
}
|
// Element macrosElement = doc.createElement(StorableMacros.MACROS_ELEMENT_NAME);
|
||||||
|
// element.appendChild(macrosElement);
|
||||||
|
// userDefinedMacros.serialize(doc,macrosElement);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(userDefinedEnvironment != null){
|
||||||
|
// EnvironmentVariableProvider.fUserSupplier.storeEnvironment(this,true);
|
||||||
|
// }
|
||||||
|
|
||||||
// I am clean now
|
// I am clean now
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/*
|
/*
|
||||||
* P A R E N T A N D C H I L D H A N D L I N G
|
* P A R E N T A N D C H I L D H A N D L I N G
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 Intel Corporation and others.
|
* Copyright (c) 2004, 2007 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -763,7 +763,7 @@ class UpdateManagedProject12 {
|
||||||
// if (treeLock) {
|
// if (treeLock) {
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
ManagedBuildManager.saveBuildInfoLegacy(project, false);
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2005 Intel Corporation and others.
|
* Copyright (c) 2004, 2007 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -114,7 +114,7 @@ class UpdateManagedProject20 {
|
||||||
//initiate the job in all cases
|
//initiate the job in all cases
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
ManagedBuildManager.saveBuildInfo(project, false);
|
ManagedBuildManager.saveBuildInfoLegacy(project, false);
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2005, 2006 Intel Corporation and others.
|
* Copyright (c) 2005, 2007 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -83,7 +83,7 @@ class UpdateManagedProject21 {
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
checkForCPPWithC(monitor, project);
|
checkForCPPWithC(monitor, project);
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
ManagedBuildManager.saveBuildInfoLegacy(project, true);
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,24 +12,13 @@ package org.eclipse.cdt.managedbuilder.projectconverter;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IBuildObjectProperties;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
|
||||||
import org.eclipse.core.resources.WorkspaceJob;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
|
||||||
import org.eclipse.core.runtime.jobs.MultiRule;
|
|
||||||
|
|
||||||
public class UpdateManagedProject30 {
|
public class UpdateManagedProject30 {
|
||||||
|
|
||||||
|
@ -57,28 +46,29 @@ public class UpdateManagedProject30 {
|
||||||
((ManagedBuildInfo)info).setVersion("3.1.0");
|
((ManagedBuildInfo)info).setVersion("3.1.0");
|
||||||
// info.setValid(true);
|
// info.setValid(true);
|
||||||
|
|
||||||
// Save the updated file.
|
//no need to persist data here
|
||||||
IWorkspace workspace = project.getWorkspace();
|
// // Save the updated file.
|
||||||
// boolean treeLock = workspace.isTreeLocked();
|
// IWorkspace workspace = project.getWorkspace();
|
||||||
ISchedulingRule rule1 = workspace.getRuleFactory().createRule(project);
|
//// boolean treeLock = workspace.isTreeLocked();
|
||||||
ISchedulingRule rule2 = workspace.getRuleFactory().refreshRule(project);
|
// ISchedulingRule rule1 = workspace.getRuleFactory().createRule(project);
|
||||||
ISchedulingRule rule = MultiRule.combine(rule1, rule2);
|
// ISchedulingRule rule2 = workspace.getRuleFactory().refreshRule(project);
|
||||||
//since the java synchronized mechanism is now used for the build info loadding,
|
// ISchedulingRule rule = MultiRule.combine(rule1, rule2);
|
||||||
//initiate the job in all cases
|
// //since the java synchronized mechanism is now used for the build info loadding,
|
||||||
// if (treeLock) {
|
// //initiate the job in all cases
|
||||||
WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
//// if (treeLock) {
|
||||||
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
// WorkspaceJob job = new WorkspaceJob(ConverterMessages.getResourceString("UpdateManagedProject.notice")) { //$NON-NLS-1$
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
// public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
job.setRule(rule);
|
|
||||||
job.schedule();
|
|
||||||
// } else {
|
|
||||||
// checkForCPPWithC(monitor, project);
|
|
||||||
// ManagedBuildManager.saveBuildInfo(project, true);
|
// ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
|
// return Status.OK_STATUS;
|
||||||
// }
|
// }
|
||||||
monitor.done();
|
// };
|
||||||
|
// job.setRule(rule);
|
||||||
|
// job.schedule();
|
||||||
|
//// } else {
|
||||||
|
//// checkForCPPWithC(monitor, project);
|
||||||
|
//// ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
|
//// }
|
||||||
|
// monitor.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2007 Intel Corporation and others.
|
* Copyright (c) 2007 Intel Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
|
|
@ -428,6 +428,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
eDes = project.getDescription();
|
eDes = project.getDescription();
|
||||||
des = getConvertedDescription(project, eDes);
|
des = getConvertedDescription(project, eDes);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,7 +600,12 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
r.add(new IWorkspaceRunnable(){
|
r.add(new IWorkspaceRunnable(){
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
|
try {
|
||||||
proj.setDescription(eDes, monitor);
|
proj.setDescription(eDes, monitor);
|
||||||
|
} catch (CoreException e){
|
||||||
|
CCorePlugin.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -767,11 +773,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
|
|
||||||
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CProjectConverterDesciptor.PROJECT_CONVERTER_EXTPOINT_ID);
|
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CProjectConverterDesciptor.PROJECT_CONVERTER_EXTPOINT_ID);
|
||||||
IExtension exts[] = extensionPoint.getExtensions();
|
IExtension exts[] = extensionPoint.getExtensions();
|
||||||
fConverters = new CProjectConverterDesciptor[exts.length];
|
CProjectConverterDesciptor[] dess = new CProjectConverterDesciptor[exts.length];
|
||||||
|
|
||||||
for(int i = 0; i < exts.length; i++){
|
for(int i = 0; i < exts.length; i++){
|
||||||
fConverters[i] = new CProjectConverterDesciptor(exts[i]);
|
dess[i] = new CProjectConverterDesciptor(exts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fConverters = dess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue