Search in sources :

Example 1 with NewServerWizard

use of org.eclipse.wst.server.ui.internal.wizard.NewServerWizard in project webtools.servertools by eclipse.

the class WizardTestCase method testNewServerWizard.

public void testNewServerWizard() throws Exception {
    Shell shell = UITestHelper.getShell();
    NewServerWizard wiz = new NewServerWizard();
    WizardDialog dialog = new WizardDialog(shell, wiz);
    UITestHelper.assertDialog(dialog);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) NewServerWizard(org.eclipse.wst.server.ui.internal.wizard.NewServerWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with NewServerWizard

use of org.eclipse.wst.server.ui.internal.wizard.NewServerWizard in project webtools.servertools by eclipse.

the class ServersView2 method createDefaultPage.

/**
 * Creates a page displayed when there are no servers defined.
 *
 * @param kit
 * @return Control
 */
private Control createDefaultPage(FormToolkit kit) {
    Form form = kit.createForm(book);
    Composite body = form.getBody();
    GridLayout layout = new GridLayout(2, false);
    body.setLayout(layout);
    Link hlink = new Link(body, SWT.NONE);
    hlink.setText(Messages.ServersView2_noServers);
    hlink.setBackground(book.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    GridData gd = new GridData(SWT.LEFT, SWT.FILL, true, false);
    hlink.setLayoutData(gd);
    hlink.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            NewServerWizard wizard = new NewServerWizard();
            WizardDialog wd = new WizardDialog(book.getShell(), wizard);
            if (wd.open() == Window.OK) {
                toggleDefultPage();
            }
        }
    });
    // Create the context menu for the default page
    final CommonViewer commonViewer = this.getCommonViewer();
    if (commonViewer != null) {
        ICommonViewerSite commonViewerSite = CommonViewerSiteFactory.createCommonViewerSite(this.getViewSite());
        if (commonViewerSite != null) {
            // Note: actionService cannot be null
            final NavigatorActionService actionService = new NavigatorActionService(commonViewerSite, commonViewer, commonViewer.getNavigatorContentService());
            MenuManager menuManager = new MenuManager("#PopupMenu");
            menuManager.addMenuListener(new IMenuListener() {

                public void menuAboutToShow(IMenuManager mgr) {
                    ISelection selection = commonViewer.getSelection();
                    actionService.setContext(new ActionContext(selection));
                    actionService.fillContextMenu(mgr);
                }
            });
            Menu menu = menuManager.createContextMenu(body);
            // It is necessary to set the menu in two places:
            // 1. The white space in the server view
            // 2. The text and link in the server view. If this menu is not set, if the
            // user right clicks on the text or uses shortcut keys to open the context menu,
            // the context menu will not come up
            body.setMenu(menu);
            hlink.setMenu(menu);
        } else {
            if (Trace.FINEST) {
                Trace.trace(Trace.STRING_FINEST, "The commonViewerSite is null");
            }
        }
    } else {
        if (Trace.FINEST) {
            Trace.trace(Trace.STRING_FINEST, "The commonViewer is null");
        }
    }
    return form;
}
Also used : Form(org.eclipse.ui.forms.widgets.Form) NewServerWizard(org.eclipse.wst.server.ui.internal.wizard.NewServerWizard) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ActionContext(org.eclipse.ui.actions.ActionContext) IMenuListener(org.eclipse.jface.action.IMenuListener) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) ISelection(org.eclipse.jface.viewers.ISelection) IMenuManager(org.eclipse.jface.action.IMenuManager) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 3 with NewServerWizard

use of org.eclipse.wst.server.ui.internal.wizard.NewServerWizard in project webtools.servertools by eclipse.

the class NewServerAction method run.

/**
 * Performs this action.
 * <p>
 * This method is called when the delegating action has been triggered.
 * Implement this method to do the actual work.
 * </p>
 *
 * @param action the action proxy that handles the presentation portion of the
 *   action
 */
public void run(IAction action) {
    NewServerWizard wizard = null;
    if (ids == null)
        wizard = new NewServerWizard();
    else
        wizard = new NewServerWizard(ids, values);
    wizard.init(workbench, selection);
    WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
    dialog.setMinimumPageSize(300, 480);
    dialog.open();
}
Also used : NewServerWizard(org.eclipse.wst.server.ui.internal.wizard.NewServerWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 NewServerWizard (org.eclipse.wst.server.ui.internal.wizard.NewServerWizard)3 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 ISelection (org.eclipse.jface.viewers.ISelection)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Shell (org.eclipse.swt.widgets.Shell)1 ActionContext (org.eclipse.ui.actions.ActionContext)1 Form (org.eclipse.ui.forms.widgets.Form)1