mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
bug 250982 - add progress reporting to new project wizard
This commit is contained in:
parent
d60c8570b9
commit
926ee25abb
7 changed files with 220 additions and 96 deletions
|
@ -55,6 +55,7 @@ import org.eclipse.cdt.ui.wizards.EntryDescriptor;
|
||||||
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
import org.eclipse.cdt.ui.wizards.IWizardItemsListListener;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
|
@ -520,54 +521,63 @@ public class MBSWizardHandler extends CWizardHandler {
|
||||||
full_tcs.put(tc.getUniqueRealName(), tc);
|
full_tcs.put(tc.getUniqueRealName(), tc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createProject(IProject project, boolean defaults, boolean onFinish) throws CoreException {
|
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
|
||||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
try {
|
||||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
monitor.beginTask("", 100); //$NON-NLS-1$
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
|
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||||
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
|
monitor.worked(10);
|
||||||
|
cfgs = fConfigPage.getCfgItems(false);
|
||||||
|
if (cfgs == null || cfgs.length == 0)
|
||||||
|
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
|
||||||
|
|
||||||
cfgs = fConfigPage.getCfgItems(false);
|
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
|
||||||
if (cfgs == null || cfgs.length == 0)
|
throw new CoreException(new Status(IStatus.ERROR,
|
||||||
cfgs = CDTConfigWizardPage.getDefaultCfgs(this);
|
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
||||||
|
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
Configuration cf = (Configuration)cfgs[0].getConfiguration();
|
||||||
|
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
|
||||||
|
info.setManagedProject(mProj);
|
||||||
|
monitor.worked(10);
|
||||||
|
cfgs = CfgHolder.unique(cfgs);
|
||||||
|
cfgs = CfgHolder.reorder(cfgs);
|
||||||
|
|
||||||
if (cfgs == null || cfgs.length == 0 || cfgs[0].getConfiguration() == null) {
|
ICConfigurationDescription cfgDebug = null;
|
||||||
throw new CoreException(new Status(IStatus.ERROR,
|
ICConfigurationDescription cfgFirst = null;
|
||||||
ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
|
||||||
Messages.getString("CWizardHandler.6"))); //$NON-NLS-1$
|
int work = 50/cfgs.length;
|
||||||
|
|
||||||
|
for(int i = 0; i < cfgs.length; i++){
|
||||||
|
cf = (Configuration)cfgs[i].getConfiguration();
|
||||||
|
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
|
||||||
|
Configuration config = new Configuration(mProj, cf, id, false, true);
|
||||||
|
CConfigurationData data = config.getConfigurationData();
|
||||||
|
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
config.setConfigurationDescription(cfgDes);
|
||||||
|
config.exportArtifactInfo();
|
||||||
|
|
||||||
|
IBuilder bld = config.getEditableBuilder();
|
||||||
|
if (bld != null) { bld.setManagedBuildOn(true); }
|
||||||
|
|
||||||
|
config.setName(cfgs[i].getName());
|
||||||
|
config.setArtifactName(removeSpaces(project.getName()));
|
||||||
|
|
||||||
|
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
||||||
|
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
|
||||||
|
cfgDebug = cfgDes;
|
||||||
|
if (cfgFirst == null) // select at least first configuration
|
||||||
|
cfgFirst = cfgDes;
|
||||||
|
monitor.worked(work);
|
||||||
|
}
|
||||||
|
mngr.setProjectDescription(project, des);
|
||||||
|
doTemplatesPostProcess(project);
|
||||||
|
doCustom(project);
|
||||||
|
monitor.worked(30);
|
||||||
|
} finally {
|
||||||
|
monitor.done();
|
||||||
}
|
}
|
||||||
Configuration cf = (Configuration)cfgs[0].getConfiguration();
|
|
||||||
ManagedProject mProj = new ManagedProject(project, cf.getProjectType());
|
|
||||||
info.setManagedProject(mProj);
|
|
||||||
|
|
||||||
cfgs = CfgHolder.unique(cfgs);
|
|
||||||
cfgs = CfgHolder.reorder(cfgs);
|
|
||||||
|
|
||||||
ICConfigurationDescription cfgDebug = null;
|
|
||||||
ICConfigurationDescription cfgFirst = null;
|
|
||||||
|
|
||||||
for(int i = 0; i < cfgs.length; i++){
|
|
||||||
cf = (Configuration)cfgs[i].getConfiguration();
|
|
||||||
String id = ManagedBuildManager.calculateChildId(cf.getId(), null);
|
|
||||||
Configuration config = new Configuration(mProj, cf, id, false, true);
|
|
||||||
CConfigurationData data = config.getConfigurationData();
|
|
||||||
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
|
||||||
config.setConfigurationDescription(cfgDes);
|
|
||||||
config.exportArtifactInfo();
|
|
||||||
|
|
||||||
IBuilder bld = config.getEditableBuilder();
|
|
||||||
if (bld != null) { bld.setManagedBuildOn(true); }
|
|
||||||
|
|
||||||
config.setName(cfgs[i].getName());
|
|
||||||
config.setArtifactName(removeSpaces(project.getName()));
|
|
||||||
|
|
||||||
IBuildProperty b = config.getBuildProperties().getProperty(PROPERTY);
|
|
||||||
if (cfgDebug == null && b != null && b.getValue() != null && PROP_VAL.equals(b.getValue().getId()))
|
|
||||||
cfgDebug = cfgDes;
|
|
||||||
if (cfgFirst == null) // select at least first configuration
|
|
||||||
cfgFirst = cfgDes;
|
|
||||||
}
|
|
||||||
mngr.setProjectDescription(project, des);
|
|
||||||
doTemplatesPostProcess(project);
|
|
||||||
doCustom(project);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doTemplatesPostProcess(IProject prj) {
|
protected void doTemplatesPostProcess(IProject prj) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
package org.eclipse.cdt.managedbuilder.ui.wizards;
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ import org.eclipse.cdt.managedbuilder.ui.properties.Messages;
|
||||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.wizard.IWizard;
|
import org.eclipse.jface.wizard.IWizard;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
@ -48,40 +50,49 @@ public class STDWizardHandler extends MBSWizardHandler {
|
||||||
/**
|
/**
|
||||||
* Note that configurations parameter is ignored
|
* Note that configurations parameter is ignored
|
||||||
*/
|
*/
|
||||||
public void createProject(IProject project, boolean defaults, boolean onFinish) throws CoreException {
|
@Override
|
||||||
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
public void createProject(IProject project, boolean defaults, boolean onFinish, IProgressMonitor monitor) throws CoreException {
|
||||||
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
try {
|
||||||
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
monitor.beginTask("", 100);//$NON-NLS-1$
|
||||||
ManagedProject mProj = new ManagedProject(des);
|
|
||||||
info.setManagedProject(mProj);
|
|
||||||
|
|
||||||
cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
|
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
|
||||||
cfgs = CfgHolder.reorder(cfgs);
|
ICProjectDescription des = mngr.createProjectDescription(project, false, !onFinish);
|
||||||
|
ManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
|
||||||
for (int i=0; i<cfgs.length; i++) {
|
ManagedProject mProj = new ManagedProject(des);
|
||||||
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
info.setManagedProject(mProj);
|
||||||
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
monitor.worked(20);
|
||||||
IBuilder bld = cfg.getEditableBuilder();
|
cfgs = CfgHolder.unique(fConfigPage.getCfgItems(defaults));
|
||||||
if (bld != null) {
|
cfgs = CfgHolder.reorder(cfgs);
|
||||||
if(bld.isInternalBuilder()){
|
int work = 50/cfgs.length;
|
||||||
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
for (int i=0; i<cfgs.length; i++) {
|
||||||
IBuilder prefBuilder = prefCfg.getBuilder();
|
String s = (cfgs[i].getToolChain() == null) ? "0" : ((ToolChain)(cfgs[i].getToolChain())).getId(); //$NON-NLS-1$
|
||||||
cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
|
Configuration cfg = new Configuration(mProj, (ToolChain)cfgs[i].getToolChain(), ManagedBuildManager.calculateChildId(s, null), cfgs[i].getName());
|
||||||
bld = cfg.getEditableBuilder();
|
IBuilder bld = cfg.getEditableBuilder();
|
||||||
bld.setBuildPath(null);
|
if (bld != null) {
|
||||||
|
if(bld.isInternalBuilder()){
|
||||||
|
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
||||||
|
IBuilder prefBuilder = prefCfg.getBuilder();
|
||||||
|
cfg.changeBuilder(prefBuilder, ManagedBuildManager.calculateChildId(cfg.getId(), null), prefBuilder.getName());
|
||||||
|
bld = cfg.getEditableBuilder();
|
||||||
|
bld.setBuildPath(null);
|
||||||
|
}
|
||||||
|
bld.setManagedBuildOn(false);
|
||||||
|
} else {
|
||||||
|
System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
bld.setManagedBuildOn(false);
|
cfg.setArtifactName(removeSpaces(project.getName()));
|
||||||
} else {
|
CConfigurationData data = cfg.getConfigurationData();
|
||||||
System.out.println(UIMessages.getString("StdProjectTypeHandler.3")); //$NON-NLS-1$
|
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
||||||
|
monitor.worked(work);
|
||||||
}
|
}
|
||||||
cfg.setArtifactName(removeSpaces(project.getName()));
|
mngr.setProjectDescription(project, des);
|
||||||
CConfigurationData data = cfg.getConfigurationData();
|
|
||||||
des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
|
|
||||||
}
|
|
||||||
mngr.setProjectDescription(project, des);
|
|
||||||
|
|
||||||
doTemplatesPostProcess(project);
|
doTemplatesPostProcess(project);
|
||||||
doCustom(project);
|
doCustom(project);
|
||||||
|
monitor.worked(30);
|
||||||
|
} finally {
|
||||||
|
monitor.done();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public boolean canCreateWithoutToolchain() { return true; }
|
public boolean canCreateWithoutToolchain() { return true; }
|
||||||
|
|
||||||
|
|
|
@ -526,6 +526,8 @@ NewCfgDialog.4=Import from projects
|
||||||
NewCfgDialog.5=Import predefined
|
NewCfgDialog.5=Import predefined
|
||||||
CDTMainWizardPage.0=Project name cannot contain '\#' symbol
|
CDTMainWizardPage.0=Project name cannot contain '\#' symbol
|
||||||
CDTMainWizardPage.1=Project category is selected. Expand the category and select a concrete project type.
|
CDTMainWizardPage.1=Project category is selected. Expand the category and select a concrete project type.
|
||||||
|
CProjectWizard.0=Add C Project Nature
|
||||||
|
CCProjectWizard.0=Add CC Project Nature
|
||||||
WorkingSetConfigAction.0=Symbols '
|
WorkingSetConfigAction.0=Symbols '
|
||||||
WorkingSetConfigAction.1=Choose active configs for Working Sets
|
WorkingSetConfigAction.1=Choose active configs for Working Sets
|
||||||
WorkingSetConfigAction.10=-- CURRENT --
|
WorkingSetConfigAction.10=-- CURRENT --
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2008 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
|
||||||
|
@ -7,12 +7,14 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCProjectNature;
|
import org.eclipse.cdt.core.CCProjectNature;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -32,10 +34,16 @@ public class CCProjectWizard extends CDTCommonProjectWizard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProject continueCreation(IProject prj) {
|
protected IProject continueCreation(IProject prj) {
|
||||||
|
if (continueCreationMonitor == null) {
|
||||||
|
continueCreationMonitor = new NullProgressMonitor();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CProjectNature.addCNature(prj, new NullProgressMonitor());
|
continueCreationMonitor.beginTask(UIMessages.getString("CCProjectWizard.0"), 2); //$NON-NLS-1$
|
||||||
CCProjectNature.addCCNature(prj, new NullProgressMonitor());
|
CProjectNature.addCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
|
||||||
|
CCProjectNature.addCCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
|
||||||
} catch (CoreException e) {}
|
} catch (CoreException e) {}
|
||||||
|
finally {continueCreationMonitor.done();}
|
||||||
return prj;
|
return prj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.eclipse.core.runtime.IExecutableExtension;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
import org.eclipse.core.runtime.content.IContentType;
|
import org.eclipse.core.runtime.content.IContentType;
|
||||||
import org.eclipse.core.runtime.content.IContentTypeManager;
|
import org.eclipse.core.runtime.content.IContentTypeManager;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
@ -230,23 +231,70 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
final boolean defaults = _defaults;
|
final boolean defaults = _defaults;
|
||||||
return new IRunnableWithProgress() {
|
return new IRunnableWithProgress() {
|
||||||
public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
|
public void run(IProgressMonitor imonitor) throws InvocationTargetException, InterruptedException {
|
||||||
|
final Exception except[] = new Exception[1];
|
||||||
getShell().getDisplay().syncExec(new Runnable() {
|
getShell().getDisplay().syncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||||
|
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||||
|
final IProgressMonitor fMonitor;
|
||||||
|
if (monitor == null) {
|
||||||
|
fMonitor= new NullProgressMonitor();
|
||||||
|
} else {
|
||||||
|
fMonitor = monitor;
|
||||||
|
}
|
||||||
|
fMonitor.beginTask(CUIPlugin.getResourceString("CProjectWizard.op_description"), 100); //$NON-NLS-1$
|
||||||
|
fMonitor.worked(10);
|
||||||
|
try {
|
||||||
|
newProject = createIProject(lastProjectName, lastProjectLocation, new SubProgressMonitor(fMonitor, 40));
|
||||||
|
if (newProject != null)
|
||||||
|
fMainPage.h_selected.createProject(newProject, defaults, onFinish, new SubProgressMonitor(fMonitor, 40));
|
||||||
|
fMonitor.worked(10);
|
||||||
|
} catch (CoreException e) { CUIPlugin.log(e); }
|
||||||
|
finally {
|
||||||
|
fMonitor.done();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
newProject = createIProject(lastProjectName, lastProjectLocation);
|
getContainer().run(false, true, op);
|
||||||
if (newProject != null)
|
} catch (InvocationTargetException e) {
|
||||||
fMainPage.h_selected.createProject(newProject, defaults, onFinish);
|
except[0] = e;
|
||||||
} catch (CoreException e) { CUIPlugin.log(e); }
|
} catch (InterruptedException e) {
|
||||||
|
except[0] = e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (except[0] != null) {
|
||||||
|
if (except[0] instanceof InvocationTargetException) {
|
||||||
|
throw (InvocationTargetException)except[0];
|
||||||
|
}
|
||||||
|
if (except[0] instanceof InterruptedException) {
|
||||||
|
throw (InterruptedException)except[0];
|
||||||
|
}
|
||||||
|
throw new InvocationTargetException(except[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IProject createIProject(final String name, final URI location) throws CoreException{
|
||||||
|
return createIProject(name, location, new NullProgressMonitor());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @since 5.1
|
||||||
|
*/
|
||||||
|
protected IProgressMonitor continueCreationMonitor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param monitor
|
||||||
|
* @since 5.1
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public IProject createIProject(final String name, final URI location) throws CoreException{
|
public IProject createIProject(final String name, final URI location, IProgressMonitor monitor) throws CoreException{
|
||||||
|
|
||||||
|
monitor.beginTask("createIProject", 100);
|
||||||
|
|
||||||
if (newProject != null) return newProject;
|
if (newProject != null) return newProject;
|
||||||
|
|
||||||
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
IWorkspace workspace = ResourcesPlugin.getWorkspace();
|
||||||
|
@ -260,23 +308,28 @@ implements IExecutableExtension, IWizardWithMemory
|
||||||
IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
|
IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
|
||||||
if(location != null)
|
if(location != null)
|
||||||
description.setLocationURI(location);
|
description.setLocationURI(location);
|
||||||
newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new NullProgressMonitor());
|
newProject = CCorePlugin.getDefault().createCDTProject(description, newProjectHandle, new SubProgressMonitor(monitor,25));
|
||||||
} else {
|
} else {
|
||||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, monitor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
NullProgressMonitor monitor = new NullProgressMonitor();
|
workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, new SubProgressMonitor(monitor,25));
|
||||||
workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor);
|
|
||||||
newProject = newProjectHandle;
|
newProject = newProjectHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open the project if we have to
|
// Open the project if we have to
|
||||||
if (!newProject.isOpen()) {
|
if (!newProject.isOpen()) {
|
||||||
newProject.open(new NullProgressMonitor());
|
newProject.open(new SubProgressMonitor(monitor,25));
|
||||||
}
|
}
|
||||||
return continueCreation(newProject);
|
|
||||||
|
continueCreationMonitor = new SubProgressMonitor(monitor,25);
|
||||||
|
IProject proj = continueCreation(newProject);
|
||||||
|
|
||||||
|
monitor.done();
|
||||||
|
|
||||||
|
return proj;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IProject continueCreation(IProject prj);
|
protected abstract IProject continueCreation(IProject prj);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Intel Corporation and others.
|
* Copyright (c) 2007, 2008 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
|
||||||
|
@ -7,12 +7,14 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
|
@ -32,9 +34,15 @@ public class CProjectWizard extends CDTCommonProjectWizard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IProject continueCreation(IProject prj) {
|
protected IProject continueCreation(IProject prj) {
|
||||||
|
if (continueCreationMonitor == null) {
|
||||||
|
continueCreationMonitor = new NullProgressMonitor();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CProjectNature.addCNature(prj, new NullProgressMonitor());
|
continueCreationMonitor.beginTask(UIMessages.getString("CProjectWizard.0"), 1); //$NON-NLS-1$
|
||||||
|
CProjectNature.addCNature(prj, new SubProgressMonitor(continueCreationMonitor, 1));
|
||||||
} catch (CoreException e) {}
|
} catch (CoreException e) {}
|
||||||
|
finally {continueCreationMonitor.done();}
|
||||||
return prj;
|
return prj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Intel Corporation - initial API and implementation
|
* Intel Corporation - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.ui.wizards;
|
package org.eclipse.cdt.ui.wizards;
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.wizard.IWizardPage;
|
import org.eclipse.jface.wizard.IWizardPage;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
@ -148,7 +150,7 @@ public class CWizardHandler implements Cloneable {
|
||||||
* @param proj - simple project to be used as base
|
* @param proj - simple project to be used as base
|
||||||
* @param defaults - true if called from 1st Wizard page
|
* @param defaults - true if called from 1st Wizard page
|
||||||
* @param onFinish - true when the project creation is performed on finish. false -otherwise
|
* @param onFinish - true when the project creation is performed on finish. false -otherwise
|
||||||
* false means that the project created is actually a temporary one that can be removed in case cancell is pressed
|
* false means that the project created is actually a temporary one that can be removed in case cancel is pressed
|
||||||
*
|
*
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
|
@ -156,6 +158,36 @@ public class CWizardHandler implements Cloneable {
|
||||||
throws CoreException {
|
throws CoreException {
|
||||||
createProject(proj, defaults);
|
createProject(proj, defaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates project
|
||||||
|
*
|
||||||
|
* @param proj - simple project to be used as base
|
||||||
|
* @param defaults - true if called from 1st Wizard page
|
||||||
|
* @param monitor - progress monitor to track the creation process
|
||||||
|
* @throws CoreException
|
||||||
|
* @since 5.1
|
||||||
|
*/
|
||||||
|
public void createProject(IProject proj, boolean defaults, IProgressMonitor monitor)
|
||||||
|
throws CoreException {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates project
|
||||||
|
*
|
||||||
|
* @param proj - simple project to be used as base
|
||||||
|
* @param defaults - true if called from 1st Wizard page
|
||||||
|
* @param onFinish - true when the project creation is performed on finish. false -otherwise
|
||||||
|
* false means that the project created is actually a temporary one that can be removed in case cancel is pressed
|
||||||
|
* @param monitor - progress monitor to track the creation process
|
||||||
|
*
|
||||||
|
* @throws CoreException
|
||||||
|
* @since 5.1
|
||||||
|
*/
|
||||||
|
public void createProject(IProject proj, boolean defaults, boolean onFinish, IProgressMonitor monitor)
|
||||||
|
throws CoreException {
|
||||||
|
createProject(proj, defaults, monitor);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return true if settings were changed
|
* @return true if settings were changed
|
||||||
|
|
Loading…
Add table
Reference in a new issue