Search in sources :

Example 1 with ModifyURLPrefixCommand

use of org.eclipse.wst.server.http.core.internal.command.ModifyURLPrefixCommand in project webtools.servertools by eclipse.

the class HttpSection method createSection.

public void createSection(Composite parent) {
    super.createSection(parent);
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());
    Section section = toolkit.createSection(parent, ExpandableComposite.TITLE_BAR | Section.DESCRIPTION);
    section.setText(Messages.editorSectionTitle);
    section.setDescription(Messages.editorSectionDescription);
    section.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
    Composite composite = toolkit.createComposite(section);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 8;
    layout.marginWidth = 8;
    layout.numColumns = 2;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL));
    toolkit.paintBordersFor(composite);
    section.setClient(composite);
    // URL prefix
    Label label = createLabel(toolkit, composite, Messages.editorURLPrefix);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    // data.horizontalSpan = 2;
    label.setLayoutData(data);
    urlPrefixText = toolkit.createText(composite, "");
    data = new GridData(GridData.FILL_HORIZONTAL);
    // data.horizontalSpan = 2;
    urlPrefixText.setLayoutData(data);
    urlPrefixText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating)
                return;
            updating = true;
            execute(new ModifyURLPrefixCommand(httpServer, urlPrefixText.getText()));
            updating = false;
        }
    });
    // port
    createLabel(toolkit, composite, Messages.editorPort);
    portSpinner = new Spinner(composite, SWT.BORDER);
    portSpinner.setMinimum(0);
    portSpinner.setMaximum(MAXIMUM_PORT);
    portSpinner.setTextLimit((Integer.toString(MAXIMUM_PORT)).length());
    data = new GridData(GridData.FILL_HORIZONTAL);
    portSpinner.setLayoutData(data);
    portSpinner.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating)
                return;
            updating = true;
            execute(new ModifyPortCommand(httpServer, portSpinner.getSelection()));
            updating = false;
        }
    });
    // is publishing
    publishCheckBox = new Button(composite, SWT.CHECK);
    publishCheckBox.setText(Messages.editorShouldPublish);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    publishCheckBox.setLayoutData(data);
    publishCheckBox.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent se) {
            Button b = (Button) se.getSource();
            if (updating)
                return;
            updating = true;
            execute(new ModifyPublishingCommand(httpServer, b.getSelection()));
            updating = false;
        }
    });
    initialize();
}
Also used : ModifyURLPrefixCommand(org.eclipse.wst.server.http.core.internal.command.ModifyURLPrefixCommand) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) Spinner(org.eclipse.swt.widgets.Spinner) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ServerEditorSection(org.eclipse.wst.server.ui.editor.ServerEditorSection) Section(org.eclipse.ui.forms.widgets.Section) ModifyPortCommand(org.eclipse.wst.server.http.core.internal.command.ModifyPortCommand) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ModifyPublishingCommand(org.eclipse.wst.server.http.core.internal.command.ModifyPublishingCommand)

Aggregations

ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)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 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Spinner (org.eclipse.swt.widgets.Spinner)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1 Section (org.eclipse.ui.forms.widgets.Section)1 ModifyPortCommand (org.eclipse.wst.server.http.core.internal.command.ModifyPortCommand)1 ModifyPublishingCommand (org.eclipse.wst.server.http.core.internal.command.ModifyPublishingCommand)1 ModifyURLPrefixCommand (org.eclipse.wst.server.http.core.internal.command.ModifyURLPrefixCommand)1 ServerEditorSection (org.eclipse.wst.server.ui.editor.ServerEditorSection)1