programmatically call Import->Existing projects into workspace [message #329461] |
Wed, 25 June 2008 06:26  |
Eclipse User |
|
|
|
Originally posted by: subs._nospam_consertum.com
Hi,
I am trying to find a way to directly invoke the Import Projects page of
the Import wizard. I can invoke the Import wizard but I can't find a way
to programmatically select "Existing projects into workspace" and then
select Next. Is there a way to do this directly?
While we are on the subject, once opened, I'd like to pre-populate some
of the fields on the Import Projects page - is that possible too?
Thanks
--
Derek
|
|
|
|
|
|
|
Re: programmatically call Import->Existing projects into workspace [message #329483 is a reply to message #329477] |
Wed, 25 June 2008 16:12  |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Derek wrote:
> Eric Rizzo wrote:
>> Derek wrote:
>>> Hi,
>>>
>>> I am trying to find a way to directly invoke the Import Projects page
>>> of the Import wizard. I can invoke the Import wizard but I can't find
>>> a way to programmatically select "Existing projects into workspace"
>>> and then select Next. Is there a way to do this directly?
>>>
>>> While we are on the subject, once opened, I'd like to pre-populate
>>> some of the fields on the Import Projects page - is that possible too?
>>
>> I think the wizard class you want to create is
>> org.eclipse.ui.wizards.datatransfer.ExternalProjectImportWiz ard
>>
>> You'll have to create a WizardDialog to contain it, too. Here is a
>> snippet of code that we use to do this for our own Wizards:
>>
>>
>> // Grab the selection out of the tree and convert it to a
>> // StructuredSelection for use by the wizard.
>> StructuredSelection currentSelection = null;
>> if (activeSelection != null && activeSelection instanceof
>> TreeSelection) {
>> currentSelection = new StructuredSelection(((TreeSelection)
>> activeSelection).toArray());
>> }
>>
>> // get the wizard from the child class.
>> IWorkbenchWizard wizard = constructWizard();
>>
>> // Get the workbench and initialize, the wizard.
>> IWorkbench workbench = PlatformUI.getWorkbench();
>> wizard.init(workbench, currentSelection);
>>
>> // Open the wizard dialog with the given wizard.
>> WizardDialog dialog = new
>> WizardDialog(workbench.getActiveWorkbenchWindow().getShell() , wizard);
>> dialog.open();
>
> Thanks Eric - is there anything special in constructWizard()?
>
No, it is just an abstract method in the class that I pulled this from,
so that subclasses can control exactly what kind of wizard gets created.
In your case, you'd just need an instance of ExternalProjectImportWizard
(I think).
Eric
|
|
|
Powered by
FUDForum. Page generated in 0.03120 seconds