當前位置: 首頁>>代碼示例>>Java>>正文


Java IWorkbenchWizard.init方法代碼示例

本文整理匯總了Java中org.eclipse.ui.IWorkbenchWizard.init方法的典型用法代碼示例。如果您正苦於以下問題:Java IWorkbenchWizard.init方法的具體用法?Java IWorkbenchWizard.init怎麽用?Java IWorkbenchWizard.init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.IWorkbenchWizard的用法示例。


在下文中一共展示了IWorkbenchWizard.init方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openWizard

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
public static void openWizard(final String id, final IStructuredSelection selection) {
	// First see if this is a "new wizard".
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(id);
	// If not check if it is an "import wizard".
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(id);
	}
	// Or maybe an export wizard
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(id);
	}
	try {
		// Then if we have a wizard, open it.
		if (descriptor != null) {
			final IWorkbenchWizard wizard = descriptor.createWizard();
			wizard.init(PlatformUI.getWorkbench(), selection);
			final WizardDialog wd = new WizardDialog(WorkbenchHelper.getDisplay().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (final CoreException e) {
		e.printStackTrace();
	}
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:25,代碼來源:GamaNavigatorMenu.java

示例2: execute

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Execute
public void execute(@Named("eu.cloudscaleproject.env.common.command.openwizard.param.id") String wizardID) {
	
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
			.findWizard(wizardID);
	
	if(descriptor != null){
		try {
			IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
			wizard.init(PlatformUI.getWorkbench(), null);
			
			WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		} catch (CoreException e) {
			e.printStackTrace();
		}
	}
	
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:21,代碼來源:OpenWizardHandler.java

示例3: execute

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Execute
public void execute(CommandExecutor commandExecutor) {
	
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
			.findWizard("eu.cloudscaleproject.env.product.wizard.newproject");
	
	if(descriptor != null){
		try {
			IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
			wizard.init(PlatformUI.getWorkbench(), null);
			
			WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		} catch (CoreException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:21,代碼來源:CreateNewProjectHadler.java

示例4: execute

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Execute
public void execute(CommandExecutor commandExecutor) {
	
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
			.findWizard("eu.cloudscaleproject.env.product.wizard.exampleproject");
	
	if(descriptor != null){
		try {
			IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
			wizard.init(PlatformUI.getWorkbench(), null);
			
			WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		} catch (CoreException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
 
開發者ID:CloudScale-Project,項目名稱:Environment,代碼行數:21,代碼來源:CreateNewExampleProjectHandler.java

示例5: createTheProject

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Override
protected IProject createTheProject() throws Exception {
    final IWorkbench theWorkbench = get_the_workbench();
    final IWizardRegistry theNewWizardRegistry = theWorkbench.getNewWizardRegistry();
    final IWizardDescriptor wizardDescriptor = theNewWizardRegistry.findWizard(Activator.EXAMPLE_WIZARD_ID);

    final IWorkbenchWizard theWizard = wizardDescriptor.createWizard();
    theWizard.init(theWorkbench, StructuredSelection.EMPTY);

    final WizardDialog theDialog = new WizardDialog(null, theWizard);
    theDialog.setBlockOnOpen(false);
    theDialog.open();

    select_the_default_button(theDialog);

    return get_the_project(getTheProjectName());
}
 
開發者ID:info-sharing-environment,項目名稱:NIEM-Modeling-Tool,代碼行數:18,代碼來源:CreatesAnExampleProject.java

示例6: getInstanceWizard

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
/**
 * Gets an editor instance creation wizard for this editor type.
 * 
 * @param initialSelection
 *            The selection used to initialize the wizard.
 * @return The editor creation wizard.
 * @throws MMINTException
 *             if the editor creation wizard couln't be found or
 *             initialized.
 * @generated NOT
 */
protected IWorkbenchWizard getInstanceWizard(IStructuredSelection initialSelection) throws MMINTException {

    Model modelType = MIDTypeRegistry.<Model>getType(getModelUri());
    IWorkbenchWizard wizard;
    if (getWizardId() == null) {
        EClass rootEClass = (EClass) modelType.getEMFTypeRoot().getEClassifiers().get(0);
        wizard = new DynamicModelWizard(rootEClass);
    }
    else {
        IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(getWizardId());
        if (descriptor == null) {
            throw new MMINTException("Wizard " + getId() + " not found");
        }
        try {
            wizard = descriptor.createWizard();
        }
        catch (CoreException e) {
            throw new MMINTException("Error creating the wizard", e);
        }
    }
    wizard.init(PlatformUI.getWorkbench(), initialSelection);

    return wizard;
}
 
開發者ID:adisandro,項目名稱:MMINT,代碼行數:36,代碼來源:EditorImpl.java

示例7: openWizardForModule

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
/**
 * Opens the wizard with the given id and passes it the selection.
 *
 * @param wizardId
 *            The wizard id of the eclipse newWizard registry
 * @param selection
 *            The selection
 */
private void openWizardForModule(String wizardId, IStructuredSelection selection, boolean nested) {

	// Retrieve wizard from registry
	IWizardDescriptor wizardDescriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardId);

	if (wizardDescriptor == null) {
		return;
	}

	try {
		IWorkbenchWizard wizard = wizardDescriptor.createWizard();

		// Inject wizard members
		injector.injectMembers(wizard);

		// Create and open a new wizard dialog
		WizardDialog wizardDialog = new WizardDialog(UIUtils.getShell(), wizard);

		// If the wizard supports it, enable in module option
		if (wizard instanceof N4JSNewClassifierWizard<?>) {
			((N4JSNewClassifierWizard<?>) wizard).init(PlatformUI.getWorkbench(), selection, nested);
		} else {
			// Otherwise just pass it the initial selection
			wizard.init(PlatformUI.getWorkbench(), selection);
		}

		// wizardDialog.setTitle(wizard.getWindowTitle());
		wizardDialog.open();

	} catch (CoreException e) {
		/** Failed to create the wizard */
		Shell workbenchShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
		MessageDialog.open(MessageDialog.ERROR, workbenchShell, "Failed to launch wizard",
				String.format("Failed to launch wizard %s", wizardId), SWT.SHEET);
		return;
	}

}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:47,代碼來源:CreateNewN4JSElementInModuleHandler.java

示例8: runWithStructuredSelection

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Override
public void runWithStructuredSelection(IStructuredSelection selection) {
    IWorkbenchWizard wizard = getWizard(selection);
    wizard.init(getWorkbench(), selection);
    WizardDialog wizardDialog = new WizardDialog(getActiveShell(), wizard);

    wizardDialog.setBlockOnOpen(true);
    wizardDialog.open();
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:10,代碼來源:BaseWizardAction.java

示例9: run

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Override
public void run ( final IAction action )
{
    if ( this.selection == null )
    {
        return;
    }

    final IWorkbenchWizard wiz = new WriteAttributesOperationWizard ();
    wiz.init ( this.site.getWorkbenchWindow ().getWorkbench (), this.selection );

    // Embed the wizard into a dialog
    final WizardDialog dialog = new WizardDialog ( this.site.getShell (), wiz );
    dialog.open ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:16,代碼來源:WriteAttributesOperationAction.java

示例10: run

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Override
public void run ( final IAction action )
{
    if ( this.selection == null )
    {
        return;
    }

    final IWorkbenchWizard wiz = new WriteOperationWizard ();
    wiz.init ( this.site.getWorkbenchWindow ().getWorkbench (), this.selection );

    // Embed the wizard into a dialog
    final WizardDialog dialog = new WizardDialog ( this.site.getShell (), wiz );
    dialog.open ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:16,代碼來源:WriteOperationAction.java

示例11: execute

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	String wizardId = getWizardIdParameterId();

	IWorkbenchWindow activeWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);

	if (wizardId == null) {
		IAction wizardAction = createWizardChooserDialogAction(activeWindow);
		wizardAction.run();
	} else {

		IWizardRegistry wizardRegistry = getWizardRegistry();
		IWizardDescriptor wizardDescriptor = wizardRegistry.findWizard(wizardId);
		if (wizardDescriptor == null) {
			throw new ExecutionException("unknown wizard: " + wizardId); //$NON-NLS-1$
		}

		try {
			IWorkbenchWizard wizard = wizardDescriptor.createWizard();
			ISelection selection = activeWindow.getSelectionService().getSelection();
			IStructuredSelection ss = selection instanceof IStructuredSelection ? (IStructuredSelection) selection
					: StructuredSelection.EMPTY;
			wizard.init(PlatformUI.getWorkbench(), ss);

			if (wizardDescriptor.canFinishEarly() && !wizardDescriptor.hasPages()) {
				wizard.performFinish();
				return null;
			}

			Shell parent = activeWindow.getShell();
			createAndOpenWizardDialog(parent, wizard);

		} catch (CoreException ex) {
			throw new ExecutionException("error creating wizard", ex); //$NON-NLS-1$
		}

	}

	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:41,代碼來源:JSSWizardHandler.java

示例12: run

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
@Override
public void run() {
	IWorkbenchWizard createWizard;
	try {
		createWizard = descriptor.createWizard();
		IWorkbench workbench = workbenchWindow.getWorkbench();
		IStructuredSelection sselection = StructuredSelection.EMPTY;
		if( selection instanceof StructuredSelection ){
			sselection = (StructuredSelection)selection;	
		}else {
			List<EnsembleCommonNavigator> navigators = EnsembleCommonNavigator.getExistingInstances(EnsembleCommonNavigator.class);
			for (EnsembleCommonNavigator navigator : navigators) {
				IWorkbenchPartSite site = navigator.getSite();
				if(site != null) {
					ISelectionProvider selectionProvider = site.getSelectionProvider();
					ISelection potentialSelection = selectionProvider.getSelection();
					if(potentialSelection instanceof IStructuredSelection) {
						sselection = (IStructuredSelection) potentialSelection;
						break;
					}
					
				}
			}
		}
		createWizard.init(workbench, sselection);
		
	} catch (CoreException e) {
		MessageDialog.openError(null, "Error creating wizard", e.getMessage());
		return;
	}
	WizardDialog dialog = new WizardDialog(null, createWizard);
	dialog.open();
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:34,代碼來源:OpenWizardDialogAction.java

示例13: openNewElementWizard

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
private IWizardPage[] openNewElementWizard(IWorkbenchWizard wizard, Shell shell, Object selection) {
	wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

	WizardDialog dialog= new WizardDialog(shell, wizard);
	PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
	dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
	dialog.create();
	dialog.open();
	IWizardPage[] pages= wizard.getPages();
	return pages;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:12,代碼來源:CreateTargetQueries.java

示例14: openAlreadyCreatedWizard

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
/*******************************************************
 * Initializes and opens an already created wizard object
 * 
 * @param wizard
 *            The wizard desired to be opened
 * @throws IllegalArgumentException
 *             If wizard is null
 *******************************************************/
public static void openAlreadyCreatedWizard(IWorkbenchWizard wizard)
{
	if (wizard == null)
	{
		throw new IllegalArgumentException();
	}

	// Initialize the wizard, wrap it in a wizard dialog, and open
	// it
	wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
	WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
	wd.setTitle(wizard.getWindowTitle());
	wd.open();
}
 
開發者ID:ArchieProject,項目名稱:Archie-Smart-IDE,代碼行數:23,代碼來源:EclipsePlatformUtils.java

示例15: create_a_niem_model

import org.eclipse.ui.IWorkbenchWizard; //導入方法依賴的package包/類
public void create_a_niem_model(final String theModelName) throws CoreException {
    final IWorkbench theWorkbench = get_the_workbench();
    final IWorkbenchWizard theWizard = theWorkbench.getNewWizardRegistry().findWizard(NewNiemModelWizard.ID)
            .createWizard();
    theWizard.init(theWorkbench, new StructuredSelection(projectProvider.get()));

    final WizardDialog theDialog = new WizardDialog(null, theWizard);
    theDialog.setBlockOnOpen(false);
    theDialog.open();

    final WizardNewFileCreationPage theNewModelFilePage = (WizardNewFileCreationPage) theWizard.getPages()[0];
    theNewModelFilePage.setFileName(theModelName + ".di");

    select_the_default_button(theDialog);
    select_the_default_button(theDialog);

    final SetMPDValuesPage theSecondMpdValuesPage = (SetMPDValuesPage) theWizard.getPages()[2];
    theSecondMpdValuesPage.setDomains(asList("Test Domain"));
    theSecondMpdValuesPage.setKeywords(asList("Test Keyword"));
    theSecondMpdValuesPage.setAuthoritativeSourceName("Test Name");
    select_the_default_button(theDialog);

    final SetPOCValuesPage thePOCValuesPage = (SetPOCValuesPage) theWizard.getPages()[3];
    thePOCValuesPage.setPointsOfContact(singletonList(new PointOfContact("Test POC Name",
            singletonList("[email protected]"), singletonList("555-5555"))));
    select_the_default_button(theDialog);
}
 
開發者ID:info-sharing-environment,項目名稱:NIEM-Modeling-Tool,代碼行數:28,代碼來源:CreatesATemporaryNiemUmlModel.java


注:本文中的org.eclipse.ui.IWorkbenchWizard.init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。