com.buglabs.dragonfly.ui.editors.NewEventTriggerDialog.java Source code

Java tutorial

Introduction

Here is the source code for com.buglabs.dragonfly.ui.editors.NewEventTriggerDialog.java

Source

/*******************************************************************************
 * Copyright (c) 2006, 2007 Bug Labs, Inc..
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.buglabs.net/legal/epl_license.html
 *******************************************************************************/
package com.buglabs.dragonfly.ui.editors;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
 * This dialog gets an Event URI from the user.
 * 
 * @author ken
 * 
 */
public class NewEventTriggerDialog extends Dialog {

    private String eventURI;

    protected NewEventTriggerDialog(Shell parentShell) {
        super(parentShell);
    }

    protected Control createDialogArea(Composite parent) {

        Composite main = new Composite(parent, SWT.NONE);
        main.setLayout(new GridLayout());
        main.setLayoutData(new GridData(GridData.FILL_BOTH));

        Label l = new Label(main, SWT.NONE);
        l.setText("Enter Event URI"); //$NON-NLS-1$

        final Text t = new Text(main, SWT.BORDER);
        t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        t.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent arg0) {
                eventURI = t.getText();
            }

        });

        return main;
    }

    public String getEventURI() {
        return eventURI;
    }
}