Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » programmatically call Import->Existing projects into workspace
programmatically call Import->Existing projects into workspace [message #329461] Wed, 25 June 2008 10:26 Go to next message
Eclipse UserFriend
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 #329463 is a reply to message #329461] Wed, 25 June 2008 10:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Derek,

We use ImportOperation directly.


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?
>
> Thanks
Re: programmatically call Import->Existing projects into workspace [message #329464 is a reply to message #329463] Wed, 25 June 2008 11:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

Hi Ed,

Thanks for the tip. However, I'd like to usethe Import Project dialog UI
- I'm (effectively) trying to provide a shortcut.

Ed Merks wrote:
> Derek,
>
> We use ImportOperation directly.
>
>
> 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?
>>
>> Thanks


--
Derek
Re: programmatically call Import->Existing projects into workspace [message #329474 is a reply to message #329461] Wed, 25 June 2008 14:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

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();
Re: programmatically call Import->Existing projects into workspace [message #329477 is a reply to message #329474] Wed, 25 June 2008 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: subs._nospam_consertum.com

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()?

--
Derek
Re: programmatically call Import->Existing projects into workspace [message #329483 is a reply to message #329477] Wed, 25 June 2008 20:12 Go to previous message
Eclipse UserFriend
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
Previous Topic:Window Preferences General WebBrowser Use external web browser Parameters ignored?
Next Topic:Migrating Launch Configurations
Goto Forum:
  


Current Time: Thu Sep 26 22:14:02 GMT 2024

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

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

Back to the top