Home » Language IDEs » C / C++ IDE (CDT) » Making a Custom New Project Wizard
Making a Custom New Project Wizard [message #198025] |
Mon, 23 July 2007 15:12  |
Eclipse User |
|
|
|
Originally posted by: chris.jamieson.rowebots.net
Hello,
I am currently attempting to make a custom New Project Wizard for my product
which is based on Eclipse for C/C++ Europa (CDT). After investigating how
CDT contributes it's new project wizard I have come accross the
org.eclipse.ui.newWizards externtion point. Now in CDT this extention point
is declared in org.eclipse.cdt.ui and it is said to use the class
org.eclipse.cdt.ui.wizards.CProjectWizard.
Now I have no problem telling my plugins new extention at
org.eclipse.ui.newWizards to use org.eclipse.cdt.ui.wizards.CProjectWizard
and this opens the same dialogue however I am having difficulty with making
my own class to run my own wizard. This is partially because I don't
understand what org.eclipse.cdt.ui.wizards.CProjectWizard. It is also
because there are a whole bunch more classes which I came accross which I
can't figure out. One of which is org.eclipse.cdt.ui.wizards.CNewWizard
which as I am writing this I can't remember how I came accross.
Basically I am looking for someone to give me a break down or at least point
me to some resources where I can figure out how to add a custom new project
wizard as I have been unsuccessful in finding them.
Thanks in advance,
Chris Jamieson
|
|
| | | | | | | |
Re: Making a Custom New Project Wizard [message #198397 is a reply to message #198350] |
Thu, 26 July 2007 17:20   |
Eclipse User |
|
|
|
Originally posted by: chris.jamieson.rowebots.net
Oh, I didn't realize that the MBS would pick up the class like that.
That is pretty cool.
Ok so now I have my extension pointing to my classes and my classes
extending their proper parents. My question now is how do I actually
make them do anything? Right now no extra pages show up and even if
they did I don't think anything would happen. I understand how to use
the MBSCustomPageData and the (s/g)etPageProperty so that I can get the
info and do things in the operation class but how do I actually get
things from the user?
For example how do I make a simple text box in my new page? Do I have
to make direct SWT calls? Is there a specific place to put this which
defines what the page looks like? All I have seen from looking through
the various classes (MBSCustomPage, MSBCustomPageData, etc.) is things
describing the page (i.e. pageID and wizard) and methods used when using
the page. However, I have seen nothing that actually specifies what the
page actually does.
I have been searching through all the different classes that extend
IWizardPage and IWizardPage itself and have come to the interface
IDialogPage and it's public void createControl(Composite parent);
method. I THINK this is what I will be using to make a text box but
I'll be damned if I know how to. The composite class has an array of
Control types. Now Control is implemented in a whole bunch of things
(such as Button, Label, and ProgressBar in org.eclipse.swt.widgets) but
I don't see a text box style control.
Also once I do have a text box type of control I am still not quite sure
how to use it. I am assuming that I will create a new instance of a
text box class and pass it to the createControl method. I also assume
that I will have to set a layout in it as that is specified in the
Composite class.
Am I on the right track? What am I missing? What is the actual
entering text class?
Thanks for all your assistance, it has been immensely helpful.
Chris
Derek Morris wrote:
> You define it to the MBS by having an entry in your plugin.xml,
> something like this:
>
> <extension
> point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
> <!-- this defines the Page and the Runnable -->
> <wizardPage ID='MyCustomPage'
> operationClass='com.xxx.MyCustomPageRunnable'
> pageClass='com.xxx.MyCustomPage' >
> <!-- this defines which projecttype(s) it is valid for -->
> <projectType projectTypeID='com.xxx.projecttype.exe' />
> <projectType projectTypeID='com.xxx.projecttype.lib' />
> </wizardPage>
> </extension>
>
> Then, the MBS will create your CustomPage (very early) and you get
> 'control' when your setVisible method is called.
>
> HTH
|
|
|
Re: Making a Custom New Project Wizard [message #198404 is a reply to message #198397] |
Thu, 26 July 2007 17:38   |
Eclipse User |
|
|
|
Originally posted by: chris.jamieson.rowebots.net
Ok here is an update. I found the Text class and used it to make an
instance and sent it to createControl. However I am not sure if this
will make the page show up. How do I specify where the page goes (i.e.
I want it to be the first page of the c wizard.
I also now get an error when attempting to run my plugin as an Eclipse
application.
The error is as follows:
org.eclipse.cdt.managedbuilder.core.BuildException: Plug-in <myplugin>
was unable to load class <myplugin>.test3.
at
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadWizardPage(MBSCustomPageManager.java:209)
at
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensionsSynchronized(MBSCustomPageManager.java:165)
at
org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensions(MBSCustomPageManager.java:129)
at
org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.addCustomPages(CDTConfigWizardPage.java:97)
at
org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.getNextPage(CDTConfigWizardPage.java:335)
at
org.eclipse.jface.wizard.WizardPage.canFlipToNextPage(Wizard Page.java:115)
at
org.eclipse.jface.wizard.WizardDialog.updateButtons(WizardDi alog.java:1250)
at org.eclipse.jface.wizard.WizardPage.setPageComplete(WizardPa ge.java:299)
at
org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.setVisible(CDTConfigWizardPage.java:277)
at
org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDi alog.java:1161)
at org.eclipse.jface.wizard.WizardDialog.access$2(WizardDialog. java:1139)
at org.eclipse.jface.wizard.WizardDialog$4.run(WizardDialog.jav a:1128)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog. java:1126)
at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDial og.java:820)
at
org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:369)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:616)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:227)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:820 )
at org.eclipse.jface.window.Window.open(Window.java:796)
at
org.eclipse.ui.internal.actions.NewWizardShortcutAction.run( NewWizardShortcutAction.java:135)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:545)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
at
org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
Any ideas?
Chris Jamieson wrote:
> Oh, I didn't realize that the MBS would pick up the class like that.
> That is pretty cool.
>
> Ok so now I have my extension pointing to my classes and my classes
> extending their proper parents. My question now is how do I actually
> make them do anything? Right now no extra pages show up and even if
> they did I don't think anything would happen. I understand how to use
> the MBSCustomPageData and the (s/g)etPageProperty so that I can get the
> info and do things in the operation class but how do I actually get
> things from the user?
>
> For example how do I make a simple text box in my new page? Do I have
> to make direct SWT calls? Is there a specific place to put this which
> defines what the page looks like? All I have seen from looking through
> the various classes (MBSCustomPage, MSBCustomPageData, etc.) is things
> describing the page (i.e. pageID and wizard) and methods used when using
> the page. However, I have seen nothing that actually specifies what the
> page actually does.
>
> I have been searching through all the different classes that extend
> IWizardPage and IWizardPage itself and have come to the interface
> IDialogPage and it's public void createControl(Composite parent);
> method. I THINK this is what I will be using to make a text box but
> I'll be damned if I know how to. The composite class has an array of
> Control types. Now Control is implemented in a whole bunch of things
> (such as Button, Label, and ProgressBar in org.eclipse.swt.widgets) but
> I don't see a text box style control.
>
> Also once I do have a text box type of control I am still not quite sure
> how to use it. I am assuming that I will create a new instance of a
> text box class and pass it to the createControl method. I also assume
> that I will have to set a layout in it as that is specified in the
> Composite class.
>
> Am I on the right track? What am I missing? What is the actual
> entering text class?
>
> Thanks for all your assistance, it has been immensely helpful.
>
> Chris
>
> Derek Morris wrote:
>> You define it to the MBS by having an entry in your plugin.xml,
>> something like this:
>>
>> <extension
>> point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
>> <!-- this defines the Page and the Runnable -->
>> <wizardPage ID='MyCustomPage'
>> operationClass='com.xxx.MyCustomPageRunnable'
>> pageClass='com.xxx.MyCustomPage' >
>> <!-- this defines which projecttype(s) it is valid for -->
>> <projectType projectTypeID='com.xxx.projecttype.exe' />
>> <projectType projectTypeID='com.xxx.projecttype.lib' />
>> </wizardPage>
>> </extension>
>>
>> Then, the MBS will create your CustomPage (very early) and you get
>> 'control' when your setVisible method is called.
>>
>> HTH
|
|
|
Re: Making a Custom New Project Wizard [message #198418 is a reply to message #198404] |
Fri, 27 July 2007 03:28   |
Eclipse User |
|
|
|
Originally posted by: dmsubs.NOSPAM.consertum.com
You really need to read about SWT. This is absolutely fundamental if you are
going to be doing any UI work in Eclipse.
One book I have found useful about Eclipse, including a little on SWT is:
http://www.qualityeclipse.com/
Specifically on your question: You have this the wrong way round. The framework
calls *your* createControl method and you instantiate your controls within there.
--
Derek
Chris Jamieson wrote:
> Ok here is an update. I found the Text class and used it to make an
> instance and sent it to createControl. However I am not sure if this
> will make the page show up. How do I specify where the page goes (i.e.
> I want it to be the first page of the c wizard.
>
> I also now get an error when attempting to run my plugin as an Eclipse
> application.
>
> The error is as follows:
>
> org.eclipse.cdt.managedbuilder.core.BuildException: Plug-in <myplugin>
> was unable to load class <myplugin>.test3.
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadWizardPage(MBSCustomPageManager.java:209)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensionsSynchronized(MBSCustomPageManager.java:165)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManag er.loadExtensions(MBSCustomPageManager.java:129)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.addCustomPages(CDTConfigWizardPage.java:97)
>
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.getNextPage(CDTConfigWizardPage.java:335)
>
> at
> org.eclipse.jface.wizard.WizardPage.canFlipToNextPage(Wizard Page.java:115)
> at
> org.eclipse.jface.wizard.WizardDialog.updateButtons(WizardDi alog.java:1250)
> at
> org.eclipse.jface.wizard.WizardPage.setPageComplete(WizardPa ge.java:299)
> at
> org.eclipse.cdt.managedbuilder.ui.wizards.CDTConfigWizardPag e.setVisible(CDTConfigWizardPage.java:277)
>
> at
> org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDi alog.java:1161)
> at
> org.eclipse.jface.wizard.WizardDialog.access$2(WizardDialog. java:1139)
> at org.eclipse.jface.wizard.WizardDialog$4.run(WizardDialog.jav a:1128)
> at
> org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator .java:67)
> at
> org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog. java:1126)
> at
> org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDial og.java:820)
> at
> org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDi alog.java:369)
> at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.jav a:616)
> at
> org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:227)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
> at org.eclipse.jface.window.Window.runEventLoop(Window.java:820 )
> at org.eclipse.jface.window.Window.open(Window.java:796)
> at
> org.eclipse.ui.internal.actions.NewWizardShortcutAction.run( NewWizardShortcutAction.java:135)
>
> at org.eclipse.jface.action.Action.runWithEvent(Action.java:498 )
> at
> org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:545)
>
> at
> org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:490)
>
> at
> org.eclipse.jface.action.ActionContributionItem$5.handleEven t(ActionContributionItem.java:402)
>
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
> at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3682)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3293)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2389)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:22 19)
> at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault (Realm.java:289)
>
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:461)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start (IDEApplication.java:106)
>
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(Eclips eAppHandle.java:153)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:106)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:76)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:363)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:176)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java: 504)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1144)
>
>
>
> Any ideas?
>
>
>
> Chris Jamieson wrote:
>> Oh, I didn't realize that the MBS would pick up the class like that.
>> That is pretty cool.
>>
>> Ok so now I have my extension pointing to my classes and my classes
>> extending their proper parents. My question now is how do I actually
>> make them do anything? Right now no extra pages show up and even if
>> they did I don't think anything would happen. I understand how to use
>> the MBSCustomPageData and the (s/g)etPageProperty so that I can get
>> the info and do things in the operation class but how do I actually
>> get things from the user?
>>
>> For example how do I make a simple text box in my new page? Do I have
>> to make direct SWT calls? Is there a specific place to put this which
>> defines what the page looks like? All I have seen from looking
>> through the various classes (MBSCustomPage, MSBCustomPageData, etc.)
>> is things describing the page (i.e. pageID and wizard) and methods
>> used when using the page. However, I have seen nothing that actually
>> specifies what the page actually does.
>>
>> I have been searching through all the different classes that extend
>> IWizardPage and IWizardPage itself and have come to the interface
>> IDialogPage and it's public void createControl(Composite parent);
>> method. I THINK this is what I will be using to make a text box but
>> I'll be damned if I know how to. The composite class has an array of
>> Control types. Now Control is implemented in a whole bunch of things
>> (such as Button, Label, and ProgressBar in org.eclipse.swt.widgets)
>> but I don't see a text box style control.
>>
>> Also once I do have a text box type of control I am still not quite
>> sure how to use it. I am assuming that I will create a new instance
>> of a text box class and pass it to the createControl method. I also
>> assume that I will have to set a layout in it as that is specified in
>> the Composite class.
>>
>> Am I on the right track? What am I missing? What is the actual
>> entering text class?
>>
>> Thanks for all your assistance, it has been immensely helpful.
>>
>> Chris
>>
>> Derek Morris wrote:
>>> You define it to the MBS by having an entry in your plugin.xml,
>>> something like this:
>>>
>>> <extension
>>> point='org.eclipse.cdt.managedbuilder.ui.newWizardPages' >
>>> <!-- this defines the Page and the Runnable -->
>>> <wizardPage ID='MyCustomPage'
>>> operationClass='com.xxx.MyCustomPageRunnable'
>>> pageClass='com.xxx.MyCustomPage' >
>>> <!-- this defines which projecttype(s) it is valid for -->
>>> <projectType projectTypeID='com.xxx.projecttype.exe' />
>>> <projectType projectTypeID='com.xxx.projecttype.lib' />
>>> </wizardPage>
>>> </extension>
>>>
>>> Then, the MBS will create your CustomPage (very early) and you get
>>> 'control' when your setVisible method is called.
>>>
>>> HTH
|
|
| |
Re: Making a Custom New Project Wizard [message #896092 is a reply to message #896088] |
Tue, 17 July 2012 04:57  |
Eclipse User |
|
|
|
By the way I'm trying to create a default C project with some generated files inside but I want my project to be in special category and the templates way is not fitting my needs.
I think I can override some CDT project creation Wizard but I can't find the good one...
I tried to override org.eclipse.cdt.ui.wizards.NewCProjectWizard but the created project doesn't have Includes or Toolchains.
Any idea?
Edit:
I found the solution:
-Extends the org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard and add it to plugin.xml with the org.eclipse.ui.newWizards extension point
-add my custom wizard page to the wizard to get some specific information
-use this code found in ManagedBuildTestHelper in org.eclipse.cdt.managedbuilder.core.tests with new project created gy the extended wizard
public IProject createNewManagedProject()
{
IProject newProjectHandle = getNewProject();
final IPath location = getNewProject().getLocation();
final String projectId = getNewProject().getName();
//TODO make this platform dependent
final String projectTypeId = "cdt.managedbuild.target.gnu.exe";
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
final IProject project = newProjectHandle;
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
// Create the base project
IWorkspaceDescription workspaceDesc = workspace.getDescription();
//workspaceDesc.setAutoBuilding(false);
workspace.setDescription(workspaceDesc);
IProjectDescription description = workspace.newProjectDescription(project.getName());
if (location != null) {
description.setLocation(location);
}
CCorePlugin.getDefault().createCProject(description, project, monitor, projectId);
// Add the managed build nature and builder
addManagedBuildNature(project);
// Find the base project type definition
IProjectType projType = ManagedBuildManager.getProjectType(projectTypeId);
Assert.assertNotNull(projType);
// Create the managed-project (.cdtbuild) for our project that builds an executable.
IManagedProject newProject = null;
try {
newProject = ManagedBuildManager.createManagedProject(project, projType);
} catch (Exception e) {
Assert.fail("Failed to create managed project for: " + project.getName());
return;
}
Assert.assertEquals(newProject.getName(), projType.getName());
Assert.assertFalse(newProject.equals(projType));
ManagedBuildManager.setNewProjectVersion(project);
// Copy over the configs
IConfiguration defaultConfig = null;
IConfiguration[] configs = projType.getConfigurations();
for (int i = 0; i < configs.length; ++i) {
// Make the first configuration the default
if (i == 0) {
defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
} else {
newProject.createConfiguration(configs[i], projType.getId() + "." + i);
}
}
ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
IConfiguration cfgs[] = newProject.getConfigurations();
for(int i = 0; i < cfgs.length; i++){
cfgs[i].setArtifactName(newProject.getDefaultArtifactName());
}
ManagedBuildManager.getBuildInfo(project).setValid(true);
}
};
NullProgressMonitor monitor = new NullProgressMonitor();
try {
workspace.run(runnable, root, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e2) {
Assert.fail(e2.getLocalizedMessage());
}
// CDT opens the Project with BACKGROUND_REFRESH enabled which causes the
// refresh manager to refresh the project 200ms later. This Job interferes
// with the resource change handler firing see: bug 271264
try {
// CDT opens the Project with BACKGROUND_REFRESH enabled which causes the
// refresh manager to refresh the project 200ms later. This Job interferes
// with the resource change handler firing see: bug 271264
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_REFRESH, null);
} catch (Exception e) {
// Ignore
}
// Initialize the path entry container
IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
if (initResult.getCode() != IStatus.OK) {
Assert.fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
}
return project;
}
static private void addManagedBuildNature (IProject project) {
// Create the buildinformation object for the project
IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
Assert.assertNotNull(info);
// Add the managed build nature
try {
ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
} catch (CoreException e) {
Assert.fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
}
// Associate the project with the managed builder so the clients can get proper information
ICDescriptor desc = null;
try {
desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
} catch (CoreException e) {
Assert.fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
return;
}
try {
desc.saveProjectData();
} catch (CoreException e) {
Assert.fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
// Associate the project with the managed builder so the clients can get proper information data: " + e.getLocalizedMessage()); }
}
you must choose the right projectID in the list below to get the good toolchain:
cdt.managedbuild.target.gnu.cygwin.exe, cdt.managedbuild.target.gnu.cygwin.lib, cdt.managedbuild.target.gnu.cygwin.so, cdt.managedbuild.target.gnu.exe, cdt.managedbuild.target.gnu.lib, cdt.managedbuild.target.gnu.mingw.exe, cdt.managedbuild.target.gnu.mingw.lib, cdt.managedbuild.target.gnu.mingw.so, cdt.managedbuild.target.gnu.so, cdt.managedbuild.target.gnu.solaris.exe, cdt.managedbuild.target.gnu.solaris.lib, cdt.managedbuild.target.gnu.solaris.so, cdt.managedbuild.target.macosx.exe, cdt.managedbuild.target.macosx.lib, cdt.managedbuild.target.macosx.so
If someone have an idea to replace the deprecated part of addManagedBuildNature I haven't found the good way yet...
[Updated on: Wed, 18 July 2012 04:52] by Moderator
|
|
|
Goto Forum:
Current Time: Fri May 09 16:28:53 EDT 2025
Powered by FUDForum. Page generated in 0.10268 seconds
|