Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Create new project wizard
Create new project wizard [message #330673] Fri, 08 August 2008 05:10 Go to next message
Eclipse UserFriend
Hi all,

I want to great a new project wizard for my plugin, I assume I will have
to do something in plugin.xml and then possibly a listener which extends
the basic project wizard. Does anyone know how to do this? I found this
http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on the
newsgroups but I dont really understand how Dan Armbrust, who posts the
query gets it to work?

Any ideas - thanks,
Mark
Re: Create new project wizard [message #330675 is a reply to message #330673] Fri, 08 August 2008 06:13 Go to previous messageGo to next message
Eclipse UserFriend
The article mentioned gives details with respect to the code of the wizard.

You need to add an extension in your plugin.xml of type -
org.eclipse.ui.newwizards and specify - category and wizard elements.

Refer to:
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/dialogs_wizards_newWizards.htm
and
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/extension-points/org_eclipse_ui _newWizards.html
(search for org.eclipse.ui.newwizards)

Rahul

"Mark Melia" <mark.melia@gmail.com> wrote in message
news:a694e6ec314d450bdd4bd9d1b405e189$1@www.eclipse.org...
> Hi all,
>
> I want to great a new project wizard for my plugin, I assume I will have
> to do something in plugin.xml and then possibly a listener which extends
> the basic project wizard. Does anyone know how to do this? I found this
> http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on the
> newsgroups but I dont really understand how Dan Armbrust, who posts the
> query gets it to work?
>
> Any ideas - thanks,
> Mark
>
Re: Create new project wizard [message #330690 is a reply to message #330675] Fri, 08 August 2008 09:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rahul,

Thanks for your response, I think I sort of get it. I have done everything
in plugin.xml now, and have a wizard class which does the following in the
doFinish() method

private void doFinish(
String projectName,
IProgressMonitor monitor)
throws CoreException {
BasicNewProjectResourceWizard newProjectPage_ = new
BasicNewProjectResourceWizard();
newProjectPage_.init(this.workbench, null);
WizardDialog dialog = new WizardDialog(new Shell(Display.getDefault()),
newProjectPage_);
dialog.open();

but I get an error popup - "invalid thread access" - any idea what I am
doing wrong. Am I using the above code correctly?

Thanks,
Mark

Rahul Kamdar wrote:

> The article mentioned gives details with respect to the code of the wizard.

> You need to add an extension in your plugin.xml of type -
> org.eclipse.ui.newwizards and specify - category and wizard elements.

> Refer to:
>
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/dialogs_wizards_newWizards.htm
> and
>
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/extension-points/org_eclipse_ui _newWizards.html
> (search for org.eclipse.ui.newwizards)

> Rahul

> "Mark Melia" <mark.melia@gmail.com> wrote in message
> news:a694e6ec314d450bdd4bd9d1b405e189$1@www.eclipse.org...
>> Hi all,
>>
>> I want to great a new project wizard for my plugin, I assume I will have
>> to do something in plugin.xml and then possibly a listener which extends
>> the basic project wizard. Does anyone know how to do this? I found this
>> http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on the
>> newsgroups but I dont really understand how Dan Armbrust, who posts the
>> query gets it to work?
>>
>> Any ideas - thanks,
>> Mark
>>
Re: Create new project wizard [message #330692 is a reply to message #330690] Fri, 08 August 2008 10:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I found this code:

IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(page.getName());
project.create(null);
project.open(null);
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
//newNatures[natures.length] = JavaCore.NATURE_ID;
//description.setNatureIds(newNatures);
project.setDescription(description, null);

i stuck it into the dofinish method and hey presto i got my basic project
to create. I could be doing something horribly wrong so if you have any
feedback I would appriciate it.

Thanks,
Mark

Mark Melia wrote:

> Hi Rahul,

> Thanks for your response, I think I sort of get it. I have done everything
> in plugin.xml now, and have a wizard class which does the following in the
> doFinish() method

> private void doFinish(
> String projectName,
> IProgressMonitor monitor)
> throws CoreException {
> BasicNewProjectResourceWizard newProjectPage_ = new
> BasicNewProjectResourceWizard();
> newProjectPage_.init(this.workbench, null);
> WizardDialog dialog = new WizardDialog(new Shell(Display.getDefault()),
> newProjectPage_);
> dialog.open();

> but I get an error popup - "invalid thread access" - any idea what I am
> doing wrong. Am I using the above code correctly?

> Thanks,
> Mark

> Rahul Kamdar wrote:

>> The article mentioned gives details with respect to the code of the wizard.

>> You need to add an extension in your plugin.xml of type -
>> org.eclipse.ui.newwizards and specify - category and wizard elements.

>> Refer to:
>>
>
http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/dialogs_wizards_newWizards.htm
>> and
>>
>
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/extension-points/org_eclipse_ui _newWizards.html
>> (search for org.eclipse.ui.newwizards)

>> Rahul

>> "Mark Melia" <mark.melia@gmail.com> wrote in message
>> news:a694e6ec314d450bdd4bd9d1b405e189$1@www.eclipse.org...
>>> Hi all,
>>>
>>> I want to great a new project wizard for my plugin, I assume I will have
>>> to do something in plugin.xml and then possibly a listener which extends
>>> the basic project wizard. Does anyone know how to do this? I found this
>>> http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on the
>>> newsgroups but I dont really understand how Dan Armbrust, who posts the
>>> query gets it to work?
>>>
>>> Any ideas - thanks,
>>> Mark
>>>
Re: Create new project wizard [message #330701 is a reply to message #330690] Sun, 10 August 2008 20:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chingyichan.tw.gmail.com

Hi Mark,

Why do you create an instance of Wizard when finish? You can simply add
new WizardPage at the addPages callback. Using IWizardPage is easier
then Dialog.


Mark Melia 提到:
> Hi Rahul,
>
> Thanks for your response, I think I sort of get it. I have done
> everything in plugin.xml now, and have a wizard class which does the
> following in the doFinish() method
>
> private void doFinish(
> String projectName,
> IProgressMonitor monitor)
> throws CoreException {
> BasicNewProjectResourceWizard newProjectPage_ = new
> BasicNewProjectResourceWizard();
> newProjectPage_.init(this.workbench, null);
> WizardDialog dialog = new WizardDialog(new
> Shell(Display.getDefault()), newProjectPage_);
> dialog.open();
>
> but I get an error popup - "invalid thread access" - any idea what I am
> doing wrong. Am I using the above code correctly?
>
> Thanks,
> Mark
>
> Rahul Kamdar wrote:
>
>> The article mentioned gives details with respect to the code of the
>> wizard.
>
>> You need to add an extension in your plugin.xml of type -
>> org.eclipse.ui.newwizards and specify - category and wizard elements.
>
>> Refer to:
> http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/dialogs_wizards_newWizards.htm
>
>> and
> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/extension-points/org_eclipse_ui _newWizards.html
>
>> (search for org.eclipse.ui.newwizards)
>
>> Rahul
>
>> "Mark Melia" <mark.melia@gmail.com> wrote in message
>> news:a694e6ec314d450bdd4bd9d1b405e189$1@www.eclipse.org...
>>> Hi all,
>>>
>>> I want to great a new project wizard for my plugin, I assume I will
>>> have to do something in plugin.xml and then possibly a listener which
>>> extends the basic project wizard. Does anyone know how to do this? I
>>> found this
>>> http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on
>>> the newsgroups but I dont really understand how Dan Armbrust, who
>>> posts the query gets it to work?
>>>
>>> Any ideas - thanks,
>>> Mark
>>>
>
>
Re: Create new project wizard [message #330702 is a reply to message #330692] Sun, 10 August 2008 20:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: chingyichan.tw.gmail.com

I have a method for creating java project. Maybe it will help you.


private IJavaProject createJavaProject(IProject project) throws
CoreException,
JavaModelException {
IProjectDescription desc = project.getDescription();
desc.setNatureIds(new String[] { JavaCore.NATURE_ID });
project.setDescription(desc, null);

IJavaProject javaProject = JavaCore.create(project);
IFolder binDir = project.getFolder("bin");
IPath binPath = binDir.getFullPath();
javaProject.setOutputLocation(binPath, null);

Set<IClasspathEntry> entries = new HashSet<IClasspathEntry>();
entries.add(JavaRuntime.getDefaultJREContainerEntry());
javaProject.setRawClasspath(entries
.toArray(new IClasspathEntry[entries.size()]), null);

return javaProject;
}

Mark Melia 提到:
> Hi
> I found this code:
>
> IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
> IProject project = root.getProject(page.getName());
> project.create(null);
> project.open(null);
> IProjectDescription description = project.getDescription();
> String[] natures = description.getNatureIds();
> String[] newNatures = new String[natures.length + 1];
> System.arraycopy(natures, 0, newNatures, 0, natures.length);
> //newNatures[natures.length] = JavaCore.NATURE_ID;
> //description.setNatureIds(newNatures);
> project.setDescription(description, null);
>
> i stuck it into the dofinish method and hey presto i got my basic
> project to create. I could be doing something horribly wrong so if you
> have any feedback I would appriciate it.
>
> Thanks,
> Mark
>
> Mark Melia wrote:
>
>> Hi Rahul,
>
>> Thanks for your response, I think I sort of get it. I have done
>> everything in plugin.xml now, and have a wizard class which does the
>> following in the doFinish() method
>
>> private void doFinish(
>> String projectName,
>> IProgressMonitor monitor)
>> throws CoreException {
>> BasicNewProjectResourceWizard newProjectPage_ = new
>> BasicNewProjectResourceWizard();
>> newProjectPage_.init(this.workbench, null);
>> WizardDialog dialog = new WizardDialog(new
>> Shell(Display.getDefault()), newProjectPage_);
>> dialog.open();
>
>> but I get an error popup - "invalid thread access" - any idea what I
>> am doing wrong. Am I using the above code correctly?
>
>> Thanks,
>> Mark
>
>> Rahul Kamdar wrote:
>
>>> The article mentioned gives details with respect to the code of the
>>> wizard.
>
>>> You need to add an extension in your plugin.xml of type -
>>> org.eclipse.ui.newwizards and specify - category and wizard elements.
>
>>> Refer to:
>>
> http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/dialogs_wizards_newWizards.htm
>
>>> and
>>
> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/extension-points/org_eclipse_ui _newWizards.html
>
>>> (search for org.eclipse.ui.newwizards)
>
>>> Rahul
>
>>> "Mark Melia" <mark.melia@gmail.com> wrote in message
>>> news:a694e6ec314d450bdd4bd9d1b405e189$1@www.eclipse.org...
>>>> Hi all,
>>>>
>>>> I want to great a new project wizard for my plugin, I assume I will
>>>> have to do something in plugin.xml and then possibly a listener
>>>> which extends the basic project wizard. Does anyone know how to do
>>>> this? I found this
>>>> http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on
>>>> the newsgroups but I dont really understand how Dan Armbrust, who
>>>> posts the query gets it to work?
>>>>
>>>> Any ideas - thanks,
>>>> Mark
>>>>
>
>
Re: Create new project wizard [message #330729 is a reply to message #330692] Tue, 12 August 2008 05:09 Go to previous message
Eclipse UserFriend
Hi Mark,

Sorry for a late response.

I agree with Chan - why are you using the dialog? You could use the
WizardPage for whatever you wish to do. The invalid thread access is
probably due to the access to UI components from a non-UI thread. In case
you want to do anything with eclipse UI, it's a good practice to invoke it
in the Eclipse UI thread using the
PlatformUI.getWorkbench().getDisplay().syncExec/asyncExec (Runnable {public
void run () {your code here}}).

What do you need to do exactly? Just create a plain new project or do some
configuration/processing after that is done? Try describing your problem if
possible.

Rahul

"Mark Melia" <mark.melia@gmail.com> wrote in message
news:c2851aa485b1aafc7d8da546a7badf70$1@www.eclipse.org...
> Hi
> I found this code:
>
> IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
> IProject project = root.getProject(page.getName());
> project.create(null);
> project.open(null);
> IProjectDescription description = project.getDescription();
> String[] natures = description.getNatureIds();
> String[] newNatures = new String[natures.length + 1];
> System.arraycopy(natures, 0, newNatures, 0, natures.length);
> //newNatures[natures.length] = JavaCore.NATURE_ID;
> //description.setNatureIds(newNatures);
> project.setDescription(description, null);
>
> i stuck it into the dofinish method and hey presto i got my basic project
> to create. I could be doing something horribly wrong so if you have any
> feedback I would appriciate it.
>
> Thanks,
> Mark
>
> Mark Melia wrote:
>
>> Hi Rahul,
>
>> Thanks for your response, I think I sort of get it. I have done
>> everything in plugin.xml now, and have a wizard class which does the
>> following in the doFinish() method
>
>> private void doFinish(
>> String projectName,
>> IProgressMonitor monitor)
>> throws CoreException {
>> BasicNewProjectResourceWizard newProjectPage_ = new
>> BasicNewProjectResourceWizard();
>> newProjectPage_.init(this.workbench, null);
>> WizardDialog dialog = new WizardDialog(new Shell(Display.getDefault()),
>> newProjectPage_);
>> dialog.open();
>
>> but I get an error popup - "invalid thread access" - any idea what I am
>> doing wrong. Am I using the above code correctly?
>
>> Thanks,
>> Mark
>
>> Rahul Kamdar wrote:
>
>>> The article mentioned gives details with respect to the code of the
>>> wizard.
>
>>> You need to add an extension in your plugin.xml of type -
>>> org.eclipse.ui.newwizards and specify - category and wizard elements.
>
>>> Refer to:
>>
> http://help.eclipse.org/help21/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/dialogs_wizards_newWizards.htm
>>> and
>>
> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/reference/extension-points/org_eclipse_ui _newWizards.html
>>> (search for org.eclipse.ui.newwizards)
>
>>> Rahul
>
>>> "Mark Melia" <mark.melia@gmail.com> wrote in message
>>> news:a694e6ec314d450bdd4bd9d1b405e189$1@www.eclipse.org...
>>>> Hi all,
>>>>
>>>> I want to great a new project wizard for my plugin, I assume I will
>>>> have to do something in plugin.xml and then possibly a listener which
>>>> extends the basic project wizard. Does anyone know how to do this? I
>>>> found this
>>>> http://dev.eclipse.org/newslists/news.eclipse.tools/msg54739 .html on
>>>> the newsgroups but I dont really understand how Dan Armbrust, who posts
>>>> the query gets it to work?
>>>>
>>>> Any ideas - thanks,
>>>> Mark
>>>>
>
>
Previous Topic:Debug Button is Disabled
Next Topic:How to get a list of jars in a project's classPath
Goto Forum:
  


Current Time: Thu Mar 13 13:43:06 EDT 2025

Powered by FUDForum. Page generated in 0.04670 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top