Java Code Examples for org.eclipse.jface.wizard.WizardDialog#OK

The following examples show how to use org.eclipse.jface.wizard.WizardDialog#OK . 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: BranchTagAction.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) { 
    	action.setEnabled(true);
    } 
    else {
     IResource[] resources = getSelectedResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	SizePersistedWizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	wizard.setParentDialog(dialog);
    	if (dialog.open() == WizardDialog.OK) {	
    		SVNUrl[] sourceUrls = wizard.getUrls();
    		SVNUrl destinationUrl = wizard.getToUrl();
    		String message = wizard.getComment();
    		boolean createOnServer = wizard.isCreateOnServer();
         BranchTagOperation branchTagOperation = new BranchTagOperation(getTargetPart(), getSelectedResources(), sourceUrls, destinationUrl, createOnServer, wizard.getRevision(), message);
         branchTagOperation.setMakeParents(wizard.isMakeParents());
         branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
         branchTagOperation.setNewAlias(wizard.getNewAlias());
         branchTagOperation.switchAfterTagBranchOperation(wizard.isSwitchAfterBranchTag());
         branchTagOperation.setSvnExternals(wizard.getSvnExternals());
         branchTagOperation.run();        		
    	}
    }
}
 
Example 2
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 3
Source File: SdkEnvironmentControl.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
    if (selectedVar != null) {
        EditVarDlg dlg = new EditVarDlg(selectedVar, editedSdk.getEnvironmentVariableRaw(selectedVar));
        WizardDialog  dialog = new WizardDialog(getShell(), dlg);
        if (dialog.open() == WizardDialog.OK) {
            editedSdk.putEnvironmentVariable(selectedVar, dlg.getVal());
            tableViewer.setInput(editedSdk);
        }
    }
}
 
Example 4
Source File: SdkEnvironmentControl.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void widgetSelected(SelectionEvent e) {
    EditVarDlg dlg = new EditVarDlg("", ""); //$NON-NLS-1$ //$NON-NLS-2$
    WizardDialog  dialog = new WizardDialog(getShell(), dlg);
    if (dialog.open() == WizardDialog.OK) {
        editedSdk.putEnvironmentVariable(dlg.getVar(), dlg.getVal());
        tableViewer.setInput(editedSdk);
    }
}
 
Example 5
Source File: RepositoryBranchTagAction.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
		ISVNRemoteResource[] resources = getSelectedRemoteResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	WizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	if (dialog.open() == WizardDialog.OK) {	
    	  SVNUrl[] sourceUrls = wizard.getUrls();
          SVNUrl destinationUrl = wizard.getToUrl();
          String message = wizard.getComment();
          SVNRevision revision = wizard.getRevision();
          boolean makeParents = wizard.isMakeParents();
		  ISVNClientAdapter client = null;
		  try {
			  ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
			  if (repository != null)
			  	client = repository.getSVNClient();
			  if (client == null)
				client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
			  RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
			  branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
			  branchTagOperation.run();
		  } catch (Exception e) {
			  MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
		  } finally {
			  // BranchTagCommand will dispose.
//            SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
		  }
    	}
	}
 
Example 6
Source File: RouteInputProcessTypeController.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
protected Command createButtonCommand(Button button) {
	AssignJobWizard assignJobWizard = new AssignJobWizard();
	WizardDialog wizardDialog = new AssignJobWizardDialog(button.getShell(), assignJobWizard);
	if (wizardDialog.open() == WizardDialog.OK) {
		String id = assignJobWizard.getSelectedProcessId();
		if(id != null){
			String paramName = (String) button.getData(PARAMETER_NAME);
			return new PropertyChangeCommand(elem, paramName, id);
		}
	}
	return null;
}
 
Example 7
Source File: RegularExpressionPicker.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
@Override
public String callDialog(CompositeEditor parent, String value) {
    RegexWizard regExWizard = new RegexWizard(value);
    WizardDialog wizardDlg = new WizardDialog(parent.getShell(),regExWizard);
    int result = wizardDlg.open();
    if (result == WizardDialog.OK) {
        return regExWizard.getPattern();
    }
    return value;
}
 
Example 8
Source File: SinglePageAppDropAction.java    From XPagesExtensionLibrary with Apache License 2.0 5 votes vote down vote up
private Element openConfigurationWizard(Document doc, String prefix) {
    
    Shell shell = getControl().getShell();
    
    // Setup the Panel Data
    Element element = super.createElement(doc, prefix); 
    PanelExtraData panelData = new PanelExtraData();
    panelData.setDesignerProject(getDesignerProject());
    panelData.setNode(element);
            
    // Check that the mobile prefix has been configured
    // and that the XPage has the correct prefix
    if (checkXPagePrefix(panelData) == false) {
        return null;
    }
    
    // Launch the Wizard
    SinglePageAppDropWizard wiz = new SinglePageAppDropWizard(shell, panelData);
    WizardDialog dialog = new WizardDialog(shell, wiz);
    dialog.addPageChangingListener(wiz);
    dialog.addPageChangedListener(wiz);
    if (WizardDialog.OK != dialog.open()) {
           return null;
    }
    
    return element;
}
 
Example 9
Source File: NewDataSetAction.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createNewDataSet( )
{
	DefaultDataSetWizard wizard = new DefaultDataSetWizard( );
	wizard.setWindowTitle( Messages.getString( "dataset.new" ) );//$NON-NLS-1$
	WizardDialog dialog = new BaseWizardDialog( PlatformUI.getWorkbench( )
			.getDisplay( )
			.getActiveShell( ), wizard );

	if ( dialog.open( ) == WizardDialog.OK )
	{
		DataSetHandle ds = wizard.getNewCreateDataSetHandle( );
		if ( editDataSet( ds ) )
		{
			notifyResult( true );
		}
		else
		{
			notifyResult( false );
		}
		ReportRequest request = new ReportRequest( ReportRequest.CREATE_ELEMENT );
		List selectionObjects = new ArrayList( );
		selectionObjects.add( dataSetHandle );
		request.setSelectionObject( selectionObjects );
		SessionHandleAdapter.getInstance( )
				.getMediator( )
				.notifyRequest( request );
		SessionHandleAdapter.getInstance( ).getCommandStack( ).commit( );
	}
	else
	{
		notifyResult( false );
		SessionHandleAdapter.getInstance( ).getCommandStack( ).rollback( );
	}
}
 
Example 10
Source File: SdkToolsControl.java    From xds-ide with Eclipse Public License 1.0 4 votes vote down vote up
private void handleAdd() {
     int curIdx = getSelectedIdx();
     int[] curRZ = null;
     String curGroup = ""; //$NON-NLS-1$
     if (curIdx >= 0) {
         curRZ = getRootZone(treeModel.get(curIdx));
         if (curRZ != null) {
             curGroup = treeModel.get(curRZ[0]).rootName;
         }
     }
     int newIdx = -1;

     SdkTool newTool = new SdkTool(editedSdk);
     newTool.setMenuGroup(curGroup);
     SdkToolsControlAddDialog addDlg = new SdkToolsControlAddDialog(newTool, editedSdk, collectGroups());
     WizardDialog  addWDlg = new WizardDialog(getShell(), addDlg);
     if (addWDlg.open() == WizardDialog.OK) {
         switch (addDlg.getResult()) {
         case TOOL:
             newIdx = curIdx + 1;
             treeModel.add(newIdx, new ModelItem(newTool));
             break;
         case SEPARATOR: {
             SdkTool sep = new SdkTool(); // new SdkTool() makes separator, not a tool
             sep.setMenuGroup(curGroup);
             newIdx = curIdx + 1;
             treeModel.add(newIdx, new ModelItem(sep)); 
             break;
         }
         case GROUP:
         {
             String name = addDlg.getGroupName();
             if (!StringUtils.isEmpty(name)) {
                 newIdx = curRZ == null ? curIdx + 1 : curRZ[1] + 1;
                 treeModel.add(newIdx, new ModelItem(name));
                 treeViewer.refresh();
             }
         }
default:
	break;
         } // SWITCH

         updateTree(newIdx);
     }
 }
 
Example 11
Source File: NewJointDataSetAction.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void run( )
{
	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "New joint data set action >> Run ..." ); //$NON-NLS-1$
	}
	if (SessionHandleAdapter.getInstance( ).getReportDesignHandle( ) == null)
	{
		return;
	}
	// Get the list of data sets before inserting a new Data Set
	List existingDataSets = getDataSets( );

	// Check if data sets are available
	if ( existingDataSets.isEmpty( ) )
	{
		MessageDialog.openError( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "JointDataSetPage.error.nodataset.title" ), Messages.getString( "JointDataSetPage.error.nodataset.title" ) );//$NON-NLS-1$ //$NON-NLS-2$
		notifyResult( false );
	}
	else
	{
		if (SessionHandleAdapter.getInstance( ).getReportDesignHandle( ) == null)
		{
			return;
		}
		HandleAdapterFactory.getInstance( )
				.getReportDesignHandleAdapter( )
				.getModuleHandle( )
				.getCommandStack( )
				.startPersistentTrans( Messages.getString( "dataset.join.new" ) ); //$NON-NLS-1$

		JointDataSetWizard wizard = new JointDataSetWizard( );
		wizard.setWindowTitle( Messages.getString( "dataset.join.new" ) );//$NON-NLS-1$
		WizardDialog dialog = new BaseWizardDialog( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ), wizard ){
			
			protected void configureShell( Shell newShell )
			{
				super.configureShell( newShell );
				newShell.setSize( 750, 650 );
				Rectangle rect = Display.getDefault( ).getBounds( );
				newShell.setLocation( ( rect.width - 750 ) / 2,
						( rect.height - 650 ) / 2 );
			}
			
		};

		if ( dialog.open( ) == WizardDialog.OK )
		{
			// Get the list of data sets after inserting a new Data Set
			List newDataSets = getDataSets( );

			editDataSet( existingDataSets, newDataSets );

			HandleAdapterFactory.getInstance( )
					.getReportDesignHandleAdapter( )
					.getModuleHandle( )
					.getCommandStack( )
					.commit( );

			ReportRequest request = new ReportRequest( ReportRequest.CREATE_ELEMENT );
			List selectionObjects = new ArrayList( );
			selectionObjects.add( dataSetHandle );
			request.setSelectionObject( selectionObjects );
			SessionHandleAdapter.getInstance( )
					.getMediator( )
					.notifyRequest( request );

			notifyResult( true );
		}

		else
		{
			HandleAdapterFactory.getInstance( )
					.getReportDesignHandleAdapter( )
					.getModuleHandle( )
					.getCommandStack( )
					.rollback( );
			notifyResult( false );
		}
	}
}
 
Example 12
Source File: NewDataSourceAction.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void run( )
{
	if ( !isEnabled( ) )
	{
		MessageDialog.openError( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ),
				Messages.getString( "datasource.error.title.noReportDesign" ), Messages.getString( "datasource.error.msg.noReportDesign" ) );//$NON-NLS-1$ //$NON-NLS-2$
		return;
	}

	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "New data source action >> Run ..." ); //$NON-NLS-1$
	}

	// Get the list of data sets before inserting a new Data Set
	List existingDataSources = getDataSources( );

	// Fix Bugzilla Bug 192360
	// Start a persistent transaction. This is to make sure transaction
	// of creating data source is consistent with creating data set
	CommandStack stack = SessionHandleAdapter.getInstance( )
			.getCommandStack( );

	stack.startPersistentTrans( Messages.getString( "datasource.new" ) ); //$NON-NLS-1$
	DefaultDataSourceWizard wizard = new DefaultDataSourceWizard( );
	String wizardTitle = Messages.getString( "datasource.new" );//$NON-NLS-1$
	wizard.setWindowTitle( wizardTitle );
	WizardDialog dialog = new BaseWizardDialog( PlatformUI.getWorkbench( )
			.getDisplay( )
			.getActiveShell( ), wizard );

	if ( dialog.open( ) == WizardDialog.OK )
	{
		List newDataSources = getDataSources( );
		DataSourceHandle dataSource = findNewDataSource( existingDataSources,
				newDataSources );

		stack.commit( );

		ReportRequest request = new ReportRequest( ReportRequest.CREATE_ELEMENT );
		List selectionObjects = new ArrayList( );
		selectionObjects.add( dataSource );
		request.setSelectionObject( selectionObjects );
		SessionHandleAdapter.getInstance( )
				.getMediator( )
				.notifyRequest( request );
		notifyResult( true );
	}
	else
	{
		stack.rollback( );
		notifyResult( false );
	}

}
 
Example 13
Source File: NewCubeAction.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void run( )
{
	if ( Policy.TRACING_ACTIONS )
	{
		System.out.println( "New cube action >> Run ..." ); //$NON-NLS-1$
	}
	if ( SessionHandleAdapter.getInstance( ).getReportDesignHandle( ) == null )
	{
		return;
	}
	// Get the list of data sets before inserting a new Data Set
	List existingCubes = getCubes( );

	CommandStack stack = getActionStack( );
	stack.startPersistentTrans( Messages.getString( "NewCubeAction.trans.cube.new" ) ); //$NON-NLS-1$

	TabularCubeHandle newCube = DesignElementFactory.getInstance( )
			.newTabularCube( Messages.getString( "NewCubeAction.DataCube" ) ); //$NON-NLS-1$

	boolean isFailed = true;
	try
	{
		SessionHandleAdapter.getInstance( )
				.getReportDesignHandle( )
				.getCubes( )
				.add( newCube );

		CubeBuilder builder = new CubeBuilder( PlatformUI.getWorkbench( )
				.getDisplay( )
				.getActiveShell( ), newCube );

		String wizardTitle = Messages.getString( "cube.new" );//$NON-NLS-1$
		builder.setTitle( wizardTitle );

		int result = builder.open( );

		notifyResult( result == WizardDialog.OK );

		if ( result == WizardDialog.OK )
		{
			isFailed = false;
		}
	}
	catch ( Exception e )
	{
		ExceptionUtil.handle( e );
	}

	if ( !isFailed )
	{
		stack.commit( );
	}
	else
	{
		stack.rollback( );
		return;
	}
	List newCubes = getCubes( );
	CubeHandle cube = findNewCube( existingCubes, newCubes );

	ReportRequest request = new ReportRequest( ReportRequest.CREATE_ELEMENT );
	List selectionObjects = new ArrayList( );
	selectionObjects.add( cube );
	request.setSelectionObject( selectionObjects );
	SessionHandleAdapter.getInstance( )
			.getMediator( )
			.notifyRequest( request );

}