org.eclipse.jface.wizard.WizardDialog Java Examples

The following examples show how to use org.eclipse.jface.wizard.WizardDialog. 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: CalendarViewDropAction.java    From XPagesExtensionLibrary with Apache License 2.0 6 votes vote down vote up
private Element openConfigurationWizard(Document doc, String prefix) { 
    // We must create an element for the panelData
    // We might overwrite this depending on chosen wizard options
    Element element = super.createElement(doc, prefix);

    // Setup the Panel Data
    PanelExtraData panelData = new PanelExtraData();
    panelData.setDesignerProject(getDesignerProject());
    panelData.setNode(element);
    panelData.setDocument(doc);

    // Launch the Wizard
    Shell shell = getControl().getShell();
    CalendarViewDropWizard wiz = new CalendarViewDropWizard(shell, panelData);
    WizardDialog dialog = new WizardDialog(shell, wiz);
    dialog.addPageChangingListener(wiz);
    if (WizardDialog.OK != dialog.open()) {
        return null;
    }
    
    // Return the root element
    return (Element) panelData.getNode();
}
 
Example #2
Source File: NewLocationAction.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
  WizardDialog dialog = new WizardDialog(null, new Wizard() {
    private HadoopLocationWizard page = new HadoopLocationWizard();

    @Override
    public void addPages() {
      super.addPages();
      setWindowTitle("New Hadoop location...");
      addPage(page);
    }

    @Override
    public boolean performFinish() {
      page.performFinish();
      return true;
    }

  });

  dialog.create();
  dialog.setBlockOnOpen(true);
  dialog.open();

  super.run();
}
 
Example #3
Source File: ExportArtifactsToZip.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IRepository currentRepository = RepositoryManager.getInstance().getCurrentRepository();
    String defaultName = currentRepository.getName() + "_" + new SimpleDateFormat("ddMMyy_HHmm").format(new Date()) + ".bos";
    Set<Object> selectedFiles = new HashSet<Object>() ;
    for(IRepositoryStore store : currentRepository.getAllExportableStores()){
        List<IRepositoryFileStore> files = store.getChildren() ;
        if( files != null){
            files.remove(null) ;
            selectedFiles.addAll(files) ;
        }
    }

    ExportRepositoryWizard wizard = new ExportRepositoryWizard(currentRepository.getAllExportableStores(),true,selectedFiles,defaultName,Messages.exportRepositoryTitle) ;
    WizardDialog dialog = new WizardDialog(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            wizard ){
    	protected void initializeBounds() {
    		super.initializeBounds();
    		getShell().setSize(500, 500); 
    	}
    };
    dialog.setTitle(Messages.exportArtifactsWizard_title);
    dialog.open() ;
    return null;
}
 
Example #4
Source File: CreateRemoteFolderAction.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
protected void execute(IAction action){
         
       ISVNRemoteFolder remoteFolder = null;
                
       if (selection.getFirstElement() instanceof ISVNRemoteFolder)
           remoteFolder = (ISVNRemoteFolder)selection.getFirstElement();
       else
       if (selection.getFirstElement() instanceof ISVNRepositoryLocation)
           remoteFolder = ((ISVNRepositoryLocation)selection.getFirstElement()).getRootFolder();
       else
       if (selection.getFirstElement() instanceof ISVNRemoteFile)
           remoteFolder = ((ISVNRemoteFile)selection.getFirstElement()).getParent();
               
       NewRemoteFolderWizard wizard = new NewRemoteFolderWizard(remoteFolder);
       
       WizardDialog dialog = new ClosableWizardDialog(shell, wizard);
       wizard.setParentDialog(dialog);
       dialog.open();

}
 
Example #5
Source File: UpdateHandler.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
protected void doExecute(LoadMetadataRepositoryJob job){
	if (hasNoRepos) {
		return;
	}
	UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
	// check for updates
	operation.resolveModal(null);
	if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
		if (UpdateSingleIUWizard.validFor(operation)) {
			// Special case for only updating a single root
			UpdateSingleIUWizard wizard =
				new UpdateSingleIUWizard(getProvisioningUI(), operation);
			WizardDialog dialog = new WizardDialog(getShell(), wizard);
			dialog.create();
			dialog.open();
		} else {
			// Open the normal version of the update wizard
			getProvisioningUI().openUpdateWizard(false, operation, job);
		}
	}
}
 
Example #6
Source File: AbstractPythonWizard.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Must be called in the UI thread.
 * @param sel will define what appears initially in the project/source folder/name.
 */
public static void startWizard(AbstractPythonWizard wizard, String title, IStructuredSelection sel) {
    IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();

    wizard.init(part.getSite().getWorkbenchWindow().getWorkbench(), sel);
    wizard.setWindowTitle(title);

    Shell shell = part.getSite().getShell();
    if (shell == null) {
        shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    }
    WizardDialog dialog = new WizardDialog(shell, wizard);
    dialog.setPageSize(350, 500);
    dialog.setHelpAvailable(false);
    dialog.create();
    dialog.open();
}
 
Example #7
Source File: NewLocationAction.java    From RDFS with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
  WizardDialog dialog = new WizardDialog(null, new Wizard() {
    private HadoopLocationWizard page = new HadoopLocationWizard();

    @Override
    public void addPages() {
      super.addPages();
      setWindowTitle("New Hadoop location...");
      addPage(page);
    }

    @Override
    public boolean performFinish() {
      page.performFinish();
      return true;
    }

  });

  dialog.create();
  dialog.setBlockOnOpen(true);
  dialog.open();

  super.run();
}
 
Example #8
Source File: WizardDoubleClickListenerTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void should_not_go_to_next_page_or_exit_on_double_click() {
    IWizard wizard = mock(IWizard.class);
    when(wizard.canFinish()).thenReturn(false);

    IWizardPage currentPage = mock(IWizardPage.class);
    IWizardPage nextPage = mock(IWizardPage.class);
    when(currentPage.getWizard()).thenReturn(wizard);
    when(currentPage.getNextPage()).thenReturn(nextPage);
    when(currentPage.canFlipToNextPage()).thenReturn(false);

    WizardDialog wizardContainer = mock(WizardDialog.class);
    when(wizardContainer.getCurrentPage()).thenReturn(currentPage);

    WizardDoubleClickListener listener = new WizardDoubleClickListener(wizardContainer);

    DoubleClickEvent event = mock(DoubleClickEvent.class);
    listener.doubleClick(event);

    verify(wizardContainer, times(0)).close();
}
 
Example #9
Source File: EditFilterDefinitionHandler.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    SelectUserFilterDefinitionWizard selectWizard = new SelectUserFilterDefinitionWizard() ;
    WizardDialog selectDialog = new CustomWizardDialog(Display.getCurrent().getActiveShell(),selectWizard,Messages.edit) ;

    if(selectDialog.open() == Dialog.OK){
        final ActorFilterDefRepositoryStore defStore = (ActorFilterDefRepositoryStore) RepositoryManager.getInstance().getRepositoryStore(ActorFilterDefRepositoryStore.class) ;
        final DefinitionResourceProvider messageProvider = DefinitionResourceProvider.getInstance(defStore,ActorsPlugin.getDefault().getBundle());
        FilterDefinitionWizard wizard = new FilterDefinitionWizard(selectWizard.getDefinition(),messageProvider) ;
        WizardDialog wd = new ConnectorDefinitionWizardDialog(Display.getCurrent().getActiveShell(),wizard,messageProvider) ;
        wd.open();
    }


    return null ;
}
 
Example #10
Source File: PublishLibraryToResourceFolderAction.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public void run( )
{

	if ( isEnable( ) == false )
	{
		return;
	}

	ModuleHandle module = SessionHandleAdapter.getInstance( )
			.getReportDesignHandle( );

	String filePath = module.getFileName( );
	String fileName = filePath.substring( filePath.lastIndexOf( File.separator ) + 1 );

	PublishLibraryWizard publishLibrary = new PublishLibraryWizard( (LibraryHandle) module,
			fileName,
			ReportPlugin.getDefault( ).getResourceFolder( ) );

	WizardDialog dialog = new BaseWizardDialog( UIUtil.getDefaultShell( ),
			publishLibrary );

	dialog.setPageSize( 500, 250 );
	dialog.open( );

}
 
Example #11
Source File: FlowInfoPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void openProcessWizard() {
	Flow flow = getModel();
	try {
		String wizardId = "wizards.new.process";
		IWorkbenchWizard w = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardId).createWizard();
		if (!(w instanceof ProcessWizard))
			return;
		ProcessWizard wizard = (ProcessWizard) w;
		wizard.setRefFlow(flow);
		WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
		if (dialog.open() == Window.OK) {
			Navigator.refresh(Navigator.findElement(ModelType.PROCESS));
		}
	} catch (Exception e) {
		Logger log = LoggerFactory.getLogger(getClass());
		log.error("failed to open process dialog from flow " + flow, e);
	}
}
 
Example #12
Source File: AbstractActorsPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createAddActorButton(final Composite mainComposite) {
    final Button addActor = new Button(mainComposite, SWT.FLAT);
    addActor.setText(Messages.addActor);
    addActor.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            super.widgetSelected(e);
            final AddActorWizard actorWizard = new AddActorWizard(getEObject(), getEditingDomain());
            final WizardDialog wizardDialog = new WizardDialog(Display.getCurrent().getActiveShell(), actorWizard);
            if(wizardDialog.open() == Dialog.OK){
                if(actorWizard.getNewActor()!=null){
                    actorComboViewer.setSelection(new StructuredSelection(actorWizard.getNewActor()));
                }
            }
        }
    });
}
 
Example #13
Source File: SamplePart.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent) {
	parent.setLayout(new GridLayout(1, false));

	Button button = new Button(parent, SWT.PUSH);
	button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
			false));
	button.setText("Show Sample Wizard");
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			WizardDialog wizardDialog = new WizardDialog(shell,
					new SampleWizard());
			wizardDialog.open();
		}
	});
	
}
 
Example #14
Source File: OpenExampleIntroAction.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public void openWizard(String id) {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench()
			.getNewWizardRegistry().findWizard(id);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
				.findWizard(id);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry()
				.findWizard(id);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault()
					.getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
Example #15
Source File: TestNewCargoProjectWizard.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testCreateNewProject() {
	Collection<IProject> initialProjects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
	NewCargoProjectWizard wizard = new NewCargoProjectWizard();
	WizardDialog dialog = new WizardDialog(getShell(), wizard);
	wizard.init(getWorkbench(), new StructuredSelection());
	dialog.create();

	assertTrue(wizard.canFinish());
	assertTrue(wizard.performFinish());
	dialog.close();
	new DisplayHelper() {

		@Override
		protected boolean condition() {
			return ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0;
		}
	}.waitForCondition(getShell().getDisplay(), 15000);
	Set<IProject> newProjects = new HashSet<>(Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects()));
	newProjects.removeAll(initialProjects);
	assertEquals(1, newProjects.size());
	assertTrue(newProjects.iterator().next().getFile("Cargo.toml").exists());
}
 
Example #16
Source File: ChangeColorAction.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void run() {

  ColorChooserWizard wizard = new ColorChooserWizard();

  WizardDialog dialog = new WizardDialog(SWTUtils.getShell(), wizard);
  dialog.setHelpAvailable(false);

  dialog.setBlockOnOpen(true);
  dialog.create();

  if (dialog.open() != Window.OK) return;

  ISarosSession session = sessionManager.getSession();

  if (session == null) return;

  int colorID = wizard.getChosenColor();

  if (!session.getUnavailableColors().contains(colorID)) session.changeColor(colorID);
  else
    MessageDialog.openInformation(
        SWTUtils.getShell(),
        Messages.ChangeColorAction_message_title,
        Messages.ChangeColorAction_message_text);
}
 
Example #17
Source File: SharedPart.java    From codeexamples-eclipse with Eclipse Public License 1.0 6 votes vote down vote up
@PostConstruct
public void createComposite(Composite parent) {
	parent.setLayout(new GridLayout(1, false));

	Button button = new Button(parent, SWT.PUSH);
	button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
			false));
	button.setText("Shared");
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			part.getCurSharedRef().getTags().add(IPresentationEngine.NO_CLOSE);
			part.getTags().add(IPresentationEngine.NO_CLOSE);
			WizardDialog wizardDialog = new WizardDialog(shell,
					new SampleWizard());
			wizardDialog.open();
		}
	});
	
}
 
Example #18
Source File: ResolveTreeConflictWizard.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void partClosed(IWorkbenchPartReference partRef) {
	IWorkbenchPart part = partRef.getPart(false);
	if (part instanceof CompareEditor) {
		CompareEditor editor = (CompareEditor)part;
		IEditorInput input = editor.getEditorInput();
		String name = input.getName();
		if (name != null && name.startsWith(compareName)) {
			targetPart.getSite().getPage().removePartListener(this);
			if (MessageDialog.openQuestion(getShell(), Messages.ResolveTreeConflictWizard_editorClosed, Messages.ResolveTreeConflictWizard_promptToReolve + treeConflict.getResource().getName() + "?")) { //$NON-NLS-1$
				ResolveTreeConflictWizard wizard = new ResolveTreeConflictWizard(treeConflict, targetPart);
				WizardDialog dialog = new SizePersistedWizardDialog(Display.getDefault().getActiveShell(), wizard, "ResolveTreeConflict"); //$NON-NLS-1$
				dialog.open();
			}
		}
	}
}
 
Example #19
Source File: SelectTracesHandler.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

    // Check if we are closing down
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return null;
    }

    // Fire the Select Traces Wizard
    IWorkbench workbench = PlatformUI.getWorkbench();
    Shell shell = workbench.getActiveWorkbenchWindow().getShell();
    TmfExperimentElement experiment = fExperiment;
    if (experiment != null) {
        TmfExperimentFolder experiments = (TmfExperimentFolder) experiment.getParent();
        TmfProjectElement project = (TmfProjectElement) experiments.getParent();
        SelectTracesWizard wizard = new SelectTracesWizard(project, experiment);
        wizard.init(PlatformUI.getWorkbench(), null);
        WizardDialog dialog = new WizardDialog(shell, wizard);
        dialog.open();
    }

    return null;
}
 
Example #20
Source File: AbstractStandardImportWizardTest.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Open the import wizard
 */
public void openImportWizard() {
    fWizard = new ImportTraceWizard();

    UIThreadRunnable.asyncExec(new VoidResult() {
        @Override
        public void run() {
            final IWorkbench workbench = PlatformUI.getWorkbench();
            // Fire the Import Trace Wizard
            if (workbench != null) {
                final IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
                Shell shell = activeWorkbenchWindow.getShell();
                assertNotNull(shell);
                ((ImportTraceWizard) fWizard).init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
                WizardDialog dialog = new WizardDialog(shell, fWizard);
                dialog.open();
            }
        }
    });

    fBot.waitUntil(ConditionHelpers.isWizardReady(fWizard));
}
 
Example #21
Source File: WorkingSetConfigurationDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createWorkingSet() {
	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	IWorkingSetNewWizard wizard= manager.createWorkingSetNewWizard(new String[] {IWorkingSetIDs.JAVA});
	// the wizard can't be null since we have at least the Java working set.
	WizardDialog dialog= new WizardDialog(getShell(), wizard);
	dialog.create();
	if (dialog.open() == Window.OK) {
		IWorkingSet workingSet= wizard.getSelection();
		if (WorkingSetModel.isSupportedAsTopLevelElement(workingSet)) {
			fAllWorkingSets.add(workingSet);
			fTableViewer.add(workingSet);
			fTableViewer.setSelection(new StructuredSelection(workingSet), true);
			fTableViewer.setChecked(workingSet, true);
			manager.addWorkingSet(workingSet);
			fAddedWorkingSets.add(workingSet);
		}
	}
}
 
Example #22
Source File: TraceExplorerComposite.java    From tlaplus with MIT License 6 votes vote down vote up
/**
   * Opens a dialog for formula processing and returns the edited formula  
   * @param formula initial formula, can be <code>null</code>
   * @return result of editing or <code>null</code>, if editing canceled
   */
  protected Formula doEditFormula(Formula formula)
  {
      // Create the wizard
FormulaWizard wizard = new FormulaWizard(section.getText(),
		"Enter an expression to be evaluated at each state of the trace.",
		String.format(
				"The expression may be named and may include the %s and %s operators (click question mark below for details).",
				TLAConstants.TraceExplore.TRACE, TLAConstants.TraceExplore.POSITION),
		"ErrorTraceExplorerExpression");
wizard.setFormula(formula);

      // Create the wizard dialog
      WizardDialog dialog = new WizardDialog(getTableViewer().getTable().getShell(), wizard);
      dialog.setHelpAvailable(true);

      // Open the wizard dialog
      if (Window.OK == dialog.open())
      {
          return wizard.getFormula();
      } else
      {
          return null;
      }
  }
 
Example #23
Source File: AbstractOpenWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();
	if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
		return;
	}
	try {
		INewWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), getSelection());

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK && wizard instanceof NewElementWizard) {
			fCreatedElement= ((NewElementWizard)wizard).getCreatedElement();
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example #24
Source File: RemoteBotShell.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getMessage() throws RemoteException {
  activate();
  final String message =
      UIThreadRunnable.syncExec(
          new StringResult() {
            @Override
            public String run() {
              WizardDialog dialog = (WizardDialog) widget.widget.getData();
              return dialog.getMessage();
            }
          });
  if (message == null) {
    throw new WidgetNotFoundException("could not find message!");
  }
  return message;
}
 
Example #25
Source File: ExportServiceAction.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
 protected void doRun() {
 	try {
if (!isAllOperationsAssignedJob(serviceItem)) {
	boolean isContinue = MessageDialog
			.openQuestion(shell, Messages.ExportServiceAction_noJobDialogTitle,
					Messages.ExportServiceAction_noJobDialogMsg);
	if (!isContinue) {
		return;
	}
}
 	} catch (PersistenceException e) {
 		ExceptionHandler.process(e);
 	}

     ServiceExportWizard processWizard = new ServiceExportWizard(serviceItem);
     IWorkbench workbench = getWorkbench();
     processWizard.setWindowTitle(EXPORT_SERVICE_LABEL);

     WizardDialog dialog = new WizardDialog(shell, processWizard);
     workbench.saveAllEditors(true);
     dialog.open();
 }
 
Example #26
Source File: WizardUtils.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Open a wizard in the SWT thread and returns the {@link WizardDialog}'s return code.
 *
 * @param parentShell
 * @param wizard
 * @return
 */
public static Integer openWizard(final Shell parentShell, final Wizard wizard) {
  try {
    return SWTUtils.runSWTSync(
        new Callable<Integer>() {
          @Override
          public Integer call() {
            WizardDialog wizardDialog = new WizardDialog(parentShell, wizard);
            wizardDialog.setHelpAvailable(false);
            return wizardDialog.open();
          }
        });
  } catch (Exception e) {
    log.warn("Error opening wizard " + wizard.getWindowTitle(), e);
  }
  return null;
}
 
Example #27
Source File: EditWorkingSetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();
	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	IWorkingSet workingSet= fActionGroup.getWorkingSet();
	if (workingSet == null || workingSet.isAggregateWorkingSet()) {
		setEnabled(false);
		return;
	}
	IWorkingSetEditWizard wizard= manager.createWorkingSetEditWizard(workingSet);
	if (wizard == null) {
		String title= WorkingSetMessages.EditWorkingSetAction_error_nowizard_title;
		String message= WorkingSetMessages.EditWorkingSetAction_error_nowizard_message;
		MessageDialog.openError(shell, title, message);
		return;
	}
	WizardDialog dialog= new WizardDialog(shell, wizard);
 	dialog.create();
	if (dialog.open() == Window.OK)
		fActionGroup.setWorkingSet(wizard.getSelection(), true);
}
 
Example #28
Source File: AbstractDataSection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
protected void moveData(final IStructuredSelection structuredSelection) {
    final MoveDataWizard moveDataWizard = new MoveDataWizard((DataAware) getEObject());
    if (new WizardDialog(Display.getDefault().getActiveShell(), moveDataWizard).open() == Dialog.OK) {
        final DataAware dataAware = moveDataWizard.getSelectedDataAwareElement();
        try {
            final MoveDataCommand cmd = new MoveDataCommand(getEditingDomain(), (DataAware) getEObject(), structuredSelection.toList(), dataAware);
            OperationHistoryFactory.getOperationHistory().execute(cmd, null, null);

            if (!(cmd.getCommandResult().getStatus().getSeverity() == Status.OK)) {
                final List<Object> data = (List<Object>) cmd.getCommandResult().getReturnValue();
                String dataNames = "";
                for (final Object d : data) {
                    dataNames = dataNames + ((Element) d).getName() + ",";
                }
                dataNames = dataNames.substring(0, dataNames.length() - 1);
                MessageDialog.openWarning(Display.getDefault().getActiveShell(), Messages.PromoteDataWarningTitle,
                        Messages.bind(Messages.PromoteDataWarningMessage, dataNames));
            }

        } catch (final ExecutionException e1) {
            BonitaStudioLog.error(e1);
        }
        refresh();
    }
}
 
Example #29
Source File: ProcessToolbar.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
static void createSystem(Process process) {
	if (process == null)
		return;
	try {
		String wizardId = "wizards.new.productsystem";
		IWorkbenchWizard wizard = PlatformUI.getWorkbench()
				.getNewWizardRegistry().findWizard(wizardId).createWizard();
		if (!(wizard instanceof ProductSystemWizard))
			return;
		ProductSystemWizard systemWizard = (ProductSystemWizard) wizard;
		systemWizard.setProcess(process);
		WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
		if (dialog.open() == Window.OK) {
			Navigator.refresh(Navigator.findElement(ModelType.PRODUCT_SYSTEM));
		}
	} catch (Exception e) {
		Logger log = LoggerFactory.getLogger(ProcessToolbar.class);
		log.error("failed to open product system dialog for process", e);
	}
}
 
Example #30
Source File: CreateXtendTypeQuickfixes.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
protected void newXtendClassQuickfix(final String typeName, final String explicitPackage, final XtextResource resource, Issue issue,
		IssueResolutionAcceptor issueResolutionAcceptor) {
	String packageDescription = getPackageDescription(explicitPackage);
	issueResolutionAcceptor.accept(issue, "Create Xtend class '" + typeName + "'" + packageDescription,
			"Opens the new Xtend class wizard to create the type '" + typeName + "'" + packageDescription, "xtend_file.png",
			new IModification() {
				@Override
				public void apply(/* @Nullable */ IModificationContext context) throws Exception {
					runAsyncInDisplayThread(new Runnable() {
						@Override
						public void run() {
							NewElementWizard newXtendClassWizard = newXtendClassWizardProvider.get();
							WizardDialog dialog = createWizardDialog(newXtendClassWizard);
							NewXtendClassWizardPage page = (NewXtendClassWizardPage) newXtendClassWizard.getStartingPage();
							configureWizardPage(page, resource.getURI(), typeName, explicitPackage);
							dialog.open();
						}
					});
				}
			});
}