Example usage for org.eclipse.jface.wizard IWizardNode IWizardNode

List of usage examples for org.eclipse.jface.wizard IWizardNode IWizardNode

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard IWizardNode IWizardNode.

Prototype

IWizardNode

Source Link

Usage

From source file:com.atlassian.connector.eclipse.internal.crucible.ui.wizards.ReviewTypeSelectionPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(GridLayoutFactory.fillDefaults().margins(5, 5).create());

    new Label(composite, SWT.NONE).setText("Select how you want to add files to the review:");

    Composite buttonComp = new Composite(composite, SWT.NONE);
    buttonComp.setLayout(GridLayoutFactory.fillDefaults().margins(10, 5).create());

    changesetReview = new Button(buttonComp, SWT.CHECK);
    changesetReview.setText("From a Changeset");
    changesetReview.setSelection(plugin.getPreviousChangesetReviewSelection());
    changesetReview.addSelectionListener(new SelectionAdapter() {
        @Override/*from   w  w  w .  ja  va2s .c  o m*/
        public void widgetSelected(SelectionEvent e) {
            plugin.setPreviousChangesetReviewSelection(changesetReview.getSelection());
        }
    });

    patchReview = new Button(buttonComp, SWT.CHECK);
    patchReview.setText("From a Patch");
    patchReview.setSelection(plugin.getPreviousPatchReviewSelection());
    patchReview.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            plugin.setPreviousPatchReviewSelection(patchReview.getSelection());
        }
    });

    workspacePatchReview = new Button(buttonComp, SWT.CHECK);
    workspacePatchReview.setText("From Workspace Changes");
    workspacePatchReview.setSelection(plugin.getPreviousWorkspacePatchReviewSelection());
    workspacePatchReview.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            plugin.setPreviousWorkspacePatchReviewSelection(workspacePatchReview.getSelection());
        }
    });

    Set<ITeamUiResourceConnector> teamConnectors = AtlassianTeamUiPlugin.getDefault().getTeamResourceManager()
            .getTeamConnectors();

    if (teamConnectors.size() == 0) {
        disablePreCommits();
        showScmRelatedWarning(buttonComp,
                "You don't have any SCM integration installed for Atlassian Connector for Eclipse. "
                        + "You need to install at least Subversion or Perforce integration to be able to create reviews. "
                        + "<A href=\"http://confluence.atlassian.com/display/IDEPLUGIN/Installing+the+Eclipse+Connector\">"
                        + "Check installation guide for details</A>. "
                        + "\n\nIf you need <A href=\"https://studio.atlassian.com/browse/PLE-728\">CVS</A>"
                        + " integration help us prioritize our backlog by voting for it.");
    } else {
        final int[] repoCount = { 0 };
        final IRunnableWithProgress getRepositories = new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                repoCount[0] = TeamUiUtils.getRepositories(monitor).size();
            }
        };
        try {
            getContainer().run(true, true, getRepositories);
        } catch (InvocationTargetException e) {
            StatusHandler.log(new Status(IStatus.WARNING, CrucibleUiPlugin.PLUGIN_ID,
                    "Failed to retrieve repositories", e));
        } catch (InterruptedException e) {
            StatusHandler.log(new Status(IStatus.WARNING, CrucibleUiPlugin.PLUGIN_ID,
                    "Failed to retrieve repositories", e));
        }
        if (repoCount[0] == 0) {
            disablePreCommits();
            showScmRelatedWarning(buttonComp,
                    "In order to create regular pre- or post-commit review you need to have at least one "
                            + "supported SCM repository configured in your Eclipse workspace.\n"
                            + "If you use SVN, make sure that your \"SVN Repositories\" View contain at least one entry.");
        }
    }

    GridDataFactory.fillDefaults().grab(true, true).applyTo(buttonComp);
    setControl(composite);

    setSelectedNode(new IWizardNode() {
        private ReviewWizard wizard;

        public boolean isContentCreated() {
            // re-create this wizard every time
            return false;
        }

        public IWizard getWizard() {
            dispose();
            wizard = new ReviewWizard(taskRepository, getTypes());
            return wizard;
        }

        public Point getExtent() {
            return null;
        }

        public void dispose() {
            if (wizard != null) {
                wizard.dispose();
            }
        }
    });

}

From source file:org.eclipse.jst.pagedesigner.dnd.internal.SimpleWizardSelectionPage.java

License:Open Source License

/**
 * @param obj//from   w w  w. j  a va 2s  .  c  om
 * @return
 */
private Object getWizardNodeOrHandler(Object obj) {
    final ILocalDropHandler dropHandler = (ILocalDropHandler) _feedbackToHandlers.get(obj);
    if (dropHandler.useWizard(_localData, _viewer)) {
        return new IWizardNode() {
            IWizard _wizard = null;

            public void dispose() {
                // nothing to dispose
            }

            public Point getExtent() {
                return null;
            }

            public IWizard getWizard() {
                if (_wizard == null) {
                    if (_updateWidget) {
                        _wizard = dropHandler.getWizard(_localData, _widget, _viewer);
                    } else {
                        _wizard = dropHandler.getWizard(_localData, _position, _viewer);
                    }
                }
                return _wizard;
            }

            public boolean isContentCreated() {
                return _wizard != null;
            }
        };
    }
    return dropHandler;
}

From source file:org.ect.codegen.reo2ea.wizards.EaSelectionPage.java

License:Open Source License

private IWizardNode getNode(final TransformExt transformExt) {
    setPageComplete(true);/*from  w  w  w.  ja va2s.  co  m*/
    return new IWizardNode() {

        public void dispose() {
            if (transformExt.wizard != null)
                transformExt.wizard.dispose();
        }

        public Point getExtent() {
            return new Point(-1, -1);
        }

        public IWizard getWizard() {
            if (transformExt.wizard == null)
                try {
                    transformExt.create();
                    if (transformExt.wizard instanceof IComposeAction) {
                        IComposeAction wizard = (IComposeAction) transformExt.wizard;
                        wizard.setComposition(transformExt.composition);
                        wizard.setConnector(connector);
                    } else
                        throw new RuntimeException("Can't create wizard!");
                } catch (CoreException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            return transformExt.wizard;
        }

        public boolean isContentCreated() {
            return transformExt.wizard != null;
        }

    };
}