org.eclipse.jface.dialogs.IPageChangeProvider Java Examples

The following examples show how to use org.eclipse.jface.dialogs.IPageChangeProvider. 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: ActiveDocumentAgent.java    From eclipse-encoding-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void partActivated(IWorkbenchPart part) {
	if (part instanceof IPageChangeProvider) {
		((IPageChangeProvider) part).addPageChangedListener(this);
	}
	checkActiveEditor();
}
 
Example #2
Source File: ActiveDocumentAgent.java    From eclipse-encoding-plugin with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void partDeactivated(IWorkbenchPart part) {
	if (part instanceof IPageChangeProvider) {
		((IPageChangeProvider) part).removePageChangedListener(this);
	}
	// Unnecessary: Call partActivated after this
	//checkActiveEditor();
}
 
Example #3
Source File: BirtWebProjectWizardConfigurationPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create Configuration Page
 * 
 * @see org.eclipse.ui.dialogs.WizardNewProjectCreationPage#createControl(org.eclipse.swt.widgets.Composite)
 */
public void createControl( Composite parent )
{
	Composite composite = new Composite( parent, SWT.NULL );
	composite.setFont( parent.getFont( ) );

	initializeDialogUnits( parent );

	composite.setLayout( new GridLayout( ) );
	composite.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	// create folder configuration group
	Group paths = new Group( composite, SWT.NULL );
	paths.setLayout( new GridLayout( ) );
	paths.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	paths.setText( BirtWTPMessages.BIRTConfiguration_group_paths );
	paths.setEnabled( true );

	// Initialize UI Utility
	UIUtil uit = new UIUtil( properties );

	// create resource folder setting group
	this.txtResourceFolder = uit.createResourceFolderGroup( paths );

	// create working folder setting group
	this.txtWorkingFolder = uit.createWorkingFolderGroup( paths );

	// create document folder setting group
	this.txtDocumentFolder = uit.createDocumentFolderGroup( paths );

	// create image folder setting group
	this.txtImageFolder = uit.createImageFolderGroup( paths );

	// create scriptlib folder setting group
	this.txtScriptlibFolder = uit.createScriptLibFolderGroup( paths );

	// create log folder setting group
	this.txtLogFolder = uit.createLogFolderGroup( paths );

	// create other configuration group
	Group others = new Group( composite, SWT.NULL );
	others.setLayout( new GridLayout( ) );
	others.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	others.setText( BirtWTPMessages.BIRTConfiguration_group_others );
	others.setEnabled( true );

	// create ifaccess only setting group
	this.btAccessOnly = uit.createAccessOnlyGroup( others );

	// create log level setting group
	this.cbLogLevel = uit.createLogLevelGroup( others );

	// create print server setting group
	this.cbPrintServer = uit.createPrintServerGroup( others );

	// create max rows setting group
	this.txtMaxRows = uit.createMaxRowsGroup( others );

	// create max cube fetching row levels setting group
	this.txtMaxRowLevels = uit.createMaxRowLevelsGroup( others );

	// create max cube fetching column levels setting group
	this.txtMaxColumnLevels = uit.createMaxColumnLevelsGroup( others );

	// create max cube memory size setting group
	this.txtCubeMemorySize = uit.createCubeMemorySizeGroup( others );

	// initialize page properties map
	initializeProperties( );

	setControl( composite );

	IWizardContainer container = getContainer( );
	if ( container instanceof IPageChangeProvider )
	{
		IPageChangeProvider pageChangeProvider = (IPageChangeProvider) container;
		pageChangeProvider
				.addPageChangedListener( new WizardPageChangedListener(
						this ) );
	}
}
 
Example #4
Source File: WizardBuilder.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create an instance of {@link Wizard} from the builder
 */
public Wizard asWizard() {
    final Wizard wizard = new Wizard() {

        @Override
        public boolean performFinish() {
            pages.stream()
                    .map(WizardPageBuilder::getControlSupplier)
                    .filter(Objects::nonNull)
                    .forEachOrdered(controlSupplier -> controlSupplier.saveSettings(getDialogSettings()));
            try {
                if (finishHandler != null) {
                    finishResult = finishHandler.finish(getContainer());
                    return finishResult.isPresent();
                }
                return true;
            } catch (final Throwable t) {
                new ExceptionDialogHandler().openErrorDialog(getShell(), Messages.errorOccuredDuringFinish, t);
                return false;
            }
        }

        @Override
        public void setContainer(IWizardContainer wizardContainer) {
            super.setContainer(wizardContainer);
            if (wizardContainer instanceof IPageChangeProvider) {
                IWizardPage startingPage = getStartingPage();
                if (startingPage instanceof IPageChangedListener) {
                    ((IPageChangeProvider) wizardContainer)
                            .addPageChangedListener((IPageChangedListener) startingPage);
                }
            }
        }

    };
    pages.stream().forEachOrdered(page -> wizard.addPage(page.asPage()));
    wizard.setNeedsProgressMonitor(needProgress);
    wizard.setWindowTitle(windowTitle);
    wizard.setDefaultPageImageDescriptor(imageDescriptor);
    wizard.setDialogSettings(WorkbenchPlugin.getDefault().getDialogSettings());
    return wizard;
}