Search in sources :

Example 1 with WebHooksDialog

use of org.jboss.tools.openshift.internal.ui.webhooks.WebHooksDialog in project jbosstools-openshift by jbosstools.

the class ShowWebHooksHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    ISelection selection = UIUtils.getCurrentSelection(event);
    IBuildConfig buildConfig = UIUtils.getFirstElement(selection, IBuildConfig.class);
    if (buildConfig == null) {
        return Status.OK_STATUS;
    }
    WebHooksDialog dialog = new WebHooksDialog(HandlerUtil.getActiveShell(event), buildConfig);
    dialog.open();
    return Status.OK_STATUS;
}
Also used : IBuildConfig(com.openshift.restclient.model.IBuildConfig) WebHooksDialog(org.jboss.tools.openshift.internal.ui.webhooks.WebHooksDialog) ISelection(org.eclipse.jface.viewers.ISelection)

Example 2 with WebHooksDialog

use of org.jboss.tools.openshift.internal.ui.webhooks.WebHooksDialog in project jbosstools-openshift by jbosstools.

the class NewApplicationSummaryFromTemplateDialog method createAreaAfterResourceSummary.

@Override
protected void createAreaAfterResourceSummary(Composite parent) {
    Composite area = new Composite(parent, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(area);
    GridLayoutFactory.fillDefaults().margins(10, 10).applyTo(area);
    final Collection<IBuildConfig> buildConfigs = findBuildConfigsWithWebHooks();
    if (!buildConfigs.isEmpty()) {
        Link webHooksLink = new Link(area, SWT.NONE);
        webHooksLink.setText("Click <a>here</a> to display the webhooks available to automatically trigger builds.");
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(webHooksLink);
        webHooksLink.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                WebHooksDialog dialog = new WebHooksDialog(getParentShell(), buildConfigs);
                dialog.open();
            }
        });
    }
    if (job.getParameters().isEmpty()) {
        return;
    }
    Label lblParams = new Label(area, SWT.WRAP);
    lblParams.setText("Please make note of the following parameters which may include values required to administer your resources:");
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).hint(100, SWT.DEFAULT).grab(true, false).applyTo(lblParams);
    Composite container = new Composite(parent, SWT.NONE);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, true).applyTo(container);
    GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 10).equalWidth(false).applyTo(container);
    Composite parameters = new Composite(container, SWT.NONE);
    GridDataFactory.fillDefaults().hint(100, 200).grab(true, true).applyTo(parameters);
    TableViewer viewer = createTable(parameters);
    viewer.setInput(job.getParameters());
    Button copyToClipboard = new Button(container, SWT.PUSH);
    copyToClipboard.setImage(OpenShiftImages.COPY_TO_CLIPBOARD_IMG);
    copyToClipboard.setToolTipText("Copy parameters to clipboard");
    copyToClipboard.addSelectionListener(onClickCopyButton(lblParams));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(false, false).applyTo(copyToClipboard);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Button(org.eclipse.swt.widgets.Button) WebHooksDialog(org.jboss.tools.openshift.internal.ui.webhooks.WebHooksDialog) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label) TableViewer(org.eclipse.jface.viewers.TableViewer) Link(org.eclipse.swt.widgets.Link)

Aggregations

IBuildConfig (com.openshift.restclient.model.IBuildConfig)2 WebHooksDialog (org.jboss.tools.openshift.internal.ui.webhooks.WebHooksDialog)2 ISelection (org.eclipse.jface.viewers.ISelection)1 TableViewer (org.eclipse.jface.viewers.TableViewer)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Link (org.eclipse.swt.widgets.Link)1