1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-12 10:45:37 +02:00

bug 230165: renaming a project doesn't update it's default artifact name

Based on patches from Alex Freidin and Irit Belezko
This commit is contained in:
Andrew Gvozdev 2009-08-12 13:45:55 +00:00
parent 1f40e10f38
commit 220b55c636
6 changed files with 9 additions and 12 deletions

View file

@ -417,13 +417,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* @see org.eclipse.cdt.managedbuilder.core.IManagedProject#(getDefaultArtifactName) * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#(getDefaultArtifactName)
*/ */
public String getDefaultArtifactName(){ public String getDefaultArtifactName(){
String name = new String(); return "${ProjName}"; //$NON-NLS-1$
// Check for spaces
String[] tokens = getOwner().getName().split("\\s"); //$NON-NLS-1$
for (int index = 0; index < tokens.length; ++index) {
name += tokens[index];
}
return name;
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -135,7 +135,7 @@ public class ProjectCreatedActions {
} }
configuration.setName(config.getName()); configuration.setName(config.getName());
configuration.setArtifactName(project.getName()); configuration.setArtifactName(newManagedProject.getDefaultArtifactName());
IBuildProperty buildProperty = configuration.getBuildProperties().getProperty(PROPERTY); IBuildProperty buildProperty = configuration.getBuildProperties().getProperty(PROPERTY);
if (buildProperty != null && buildProperty.getValue() != null && PROP_VAL.equals(buildProperty.getValue().getId())) { if (buildProperty != null && buildProperty.getValue() != null && PROP_VAL.equals(buildProperty.getValue().getId())) {

View file

@ -23,7 +23,6 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration; import org.eclipse.cdt.managedbuilder.core.IMultiConfiguration;
import org.eclipse.cdt.managedbuilder.core.ITool; import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.ui.wizards.CWizardHandler;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyEvent;
@ -170,7 +169,7 @@ public class ArtifactTab extends AbstractCBuildPropertyTab {
String s = fCfg.getArtifactName(); String s = fCfg.getArtifactName();
if (! page.isMultiCfg() && (s == null || s.trim().length() == 0)) { if (! page.isMultiCfg() && (s == null || s.trim().length() == 0)) {
s = getResDesc().getConfiguration().getProjectDescription().getName(); s = getResDesc().getConfiguration().getProjectDescription().getName();
getCfg().setArtifactName(CWizardHandler.removeSpaces(s)); getCfg().setArtifactName(s);
} }
canModify = false; canModify = false;

View file

@ -579,7 +579,7 @@ public class MBSWizardHandler extends CWizardHandler {
if (bld != null) { bld.setManagedBuildOn(true); } if (bld != null) { bld.setManagedBuildOn(true); }
config.setName(cfgs[i].getName()); config.setName(cfgs[i].getName());
config.setArtifactName(removeSpaces(project.getName())); config.setArtifactName(mProj.getDefaultArtifactName());
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY); IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId())) if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))

View file

@ -92,7 +92,7 @@ public class STDWizardHandler extends MBSWizardHandler {
} else { } else {
System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$ System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
} }
cfg.setArtifactName(removeSpaces(project.getName())); cfg.setArtifactName(mProj.getDefaultArtifactName());
CConfigurationData data = cfg.getConfigurationData(); CConfigurationData data = cfg.getConfigurationData();
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
monitor.worked(work); monitor.worked(work);

View file

@ -253,6 +253,10 @@ public class CWizardHandler implements Cloneable {
} catch (CloneNotSupportedException e) { return null; } } catch (CloneNotSupportedException e) { return null; }
} }
/**
* @deprecated since CDT 6.1.
*/
@Deprecated
public static String removeSpaces(String s) { public static String removeSpaces(String s) {
char[] cs = s.toCharArray(); char[] cs = s.toCharArray();
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();