Java Code Examples for org.eclipse.jface.wizard.WizardDialog#getSelectedPage()

The following examples show how to use org.eclipse.jface.wizard.WizardDialog#getSelectedPage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaScriptVisualizeSelectedDiagramsHandler.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	JavaScriptVisualizeWizard wizard = new JavaScriptVisualizeWizard();
	WizardDialog wizardDialog = new WizardDialog(null, wizard);
	wizardDialog.create();

	VisualizeTxtUMLPage page = ((VisualizeTxtUMLPage) wizardDialog.getSelectedPage());

	// get selected files
	ISelection selection = HandlerUtil.getCurrentSelection(event);
	IStructuredSelection strSelection = (IStructuredSelection) selection;

	List<ICompilationUnit> selectedCompilationUnits = new ArrayList<>();
	Stream.of(strSelection.toArray()).forEach(s -> selectedCompilationUnits
			.add((ICompilationUnit) ((IAdaptable) s).getAdapter(ICompilationUnit.class)));
	try {
		List<IType> types = new ArrayList<>();
		for (ICompilationUnit cu : selectedCompilationUnits) {
			types.addAll(Arrays.asList(cu.getTypes()));
		}
		page.selectElementsInDiagramTree(types.toArray(), false);
		page.setExpandedLayouts(types);
	} catch (JavaModelException ex) {
	}

	wizardDialog.open();
	return null;
}
 
Example 2
Source File: PapyrusVisualizeSelectedDiagramsHandler.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	PapyrusVisualizeWizard wizard = new PapyrusVisualizeWizard();
	WizardDialog wizardDialog = new WizardDialog(null, wizard);
	wizardDialog.create();

	VisualizeTxtUMLPage page = ((VisualizeTxtUMLPage) wizardDialog.getSelectedPage());

	// get selected files
	ISelection selection = HandlerUtil.getCurrentSelection(event);
	IStructuredSelection strSelection = (IStructuredSelection) selection;

	List<ICompilationUnit> selectedCompilationUnits = new ArrayList<>();
	Stream.of(strSelection.toArray()).forEach(s -> selectedCompilationUnits
			.add((ICompilationUnit) ((IAdaptable) s).getAdapter(ICompilationUnit.class)));
	try {
		List<IType> types = new ArrayList<>();
		for (ICompilationUnit cu : selectedCompilationUnits) {
			types.addAll(Arrays.asList(cu.getTypes()));
		}
		page.selectElementsInDiagramTree(types.toArray(), false);
		page.setExpandedLayouts(types);
	} catch (JavaModelException ex) {
	}

	wizardDialog.open();
	return null;
}
 
Example 3
Source File: PlantUMLVisualizeSelectedDiagramsHandler.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	PlantUMLVisualizeWizard wizard = new PlantUMLVisualizeWizard();
	WizardDialog wizardDialog = new WizardDialog(null, wizard);
	wizardDialog.create();

	VisualizeTxtUMLPage page = ((VisualizeTxtUMLPage) wizardDialog.getSelectedPage());

	// get selected files
	ISelection selection = HandlerUtil.getCurrentSelection(event);
	IStructuredSelection strSelection = (IStructuredSelection) selection;

	List<ICompilationUnit> selectedCompilationUnits = new ArrayList<>();
	Stream.of(strSelection.toArray()).forEach(s -> selectedCompilationUnits
			.add((ICompilationUnit) ((IAdaptable) s).getAdapter(ICompilationUnit.class)));
	try {
		List<IType> types = new ArrayList<>();
		for (ICompilationUnit cu : selectedCompilationUnits) {
			types.addAll(Arrays.asList(cu.getTypes()));
		}
		page.selectElementsInDiagramTree(types.toArray(), false);
		page.setExpandedLayouts(types);
	} catch (JavaModelException ex) {
	}

	wizardDialog.open();
	return null;
}