Java Code Examples for org.eclipse.swt.widgets.List#addSelectionListener()

The following examples show how to use org.eclipse.swt.widgets.List#addSelectionListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyValueListFieldEditor.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates and returns the contents of an area of the dialog which appears
 * below the message and above the button bar.
 * 
 * This implementation creates two labels and two textfields.
 * 
 * @param parent parent composite to contain the custom area
 * @return the custom area control, or <code>null</code>
 */
protected Control createCustomArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout());
    
    envVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    envVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
    envVarList.setItems(items);
    envVarList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            selections = envVarList.getSelectionIndices();
        }});
    
    return composite;
}
 
Example 2
Source File: StyleListFieldEditor.java    From texlipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates and returns the contents of an area of the dialog which appears
 * below the message and above the button bar.
 * 
 * This implementation creates two labels and two textfields.
 * 
 * @param parent parent composite to contain the custom area
 * @return the custom area control, or <code>null</code>
 */
protected Control createCustomArea(Composite parent) {
    
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout());
    
    skVarList = new List(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    skVarList.setLayoutData(new GridData(GridData.FILL_BOTH));
    skVarList.setItems(items);
    skVarList.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            selections = skVarList.getSelectionIndices();
        }});
    
    return composite;
}
 
Example 3
Source File: Translator.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void addList() {
  Composite composite = new Composite( sashform, SWT.NONE );
  props.setLook( composite );
  FillLayout fillLayout = new FillLayout();
  fillLayout.marginWidth = Const.FORM_MARGIN;
  fillLayout.marginHeight = Const.FORM_MARGIN;
  composite.setLayout( fillLayout );

  // Make a listbox
  wList = new List( composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL );

  // Add a selection listener.
  wList.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      refreshGrid();
    }
  } );
}
 
Example 4
Source File: DisplayLabDokumenteDialog.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite composite = new Composite(parent, SWT.BORDER);
	composite.setLayout(new GridLayout(1, true));
	composite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	
	final List list = new List(composite, SWT.BORDER);
	GridDataFactory.fillDefaults().grab(true, true).applyTo(list);
	for (LabResult lr : this.labResultList) {
		list.add(lr.getResult());
	}
	
	list.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			if (docManager != null && list.getSelectionCount() > 0) {
				openDocument(list.getSelection()[0]);
			}
		}
	});
	
	SWTHelper.center(UiDesk.getTopShell(), getShell());
	return composite;
}
 
Example 5
Source File: ImageBuilder.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void buildEmbeddedImageList( )
{
	embeddedImageList = new List( inputArea, SWT.NONE
			| SWT.SINGLE
			| SWT.BORDER
			| SWT.V_SCROLL
			| SWT.H_SCROLL );
	embeddedImageList.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	embeddedImageList.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			preview( );
			modifyDialogContent( );
			updateButtons( );
		}
	} );

	initList( );
}
 
Example 6
Source File: ViewerListFieldEditor.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Add an additional SelectionListener to the list component.
 * This method call super and installs a SelectionListener,
 * which enables and disables the "edit"-button.
 */
public List getListControl(Composite parent) {
    List list = super.getListControl(parent);
    list.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            List listWidget = (List) event.widget;
            editButton.setEnabled(listWidget.getSelectionIndex() >= 0);
        }});
    return list;
}
 
Example 7
Source File: ShowDeclarationsHandler.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * This is the method that puts the content into the popup's
 * dialog area.  It puts an org.eclipse.swt.widgets.List
 * (note that this isn't an ordinary Java List) there.
 * 
 */
protected Control createDialogArea(Composite composite)
{
    // create the list
    list = new List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.RESIZE);

    // Populate the popup's display area.
    setList();

    // list.addKeyListener(listener);

    /* 
     *  To put a Composite instead of a List in the
     *  dialog area, do something like the following:
    Composite stuff = new Composite(composite, SWT.NONE);
    stuff.setLayoutData(new GridData());
    stuff.setLayout(new FillLayout(SWT.VERTICAL));
    Button button1 = new Button(stuff, SWT.FLAT);
    button1.setText("Button 1");
    // button1.setParent(stuff);
    Button button2 = new Button(stuff, SWT.PUSH);
    button2.setText("Button 2");
    */
    list.addSelectionListener(new ShowDeclarationsSelectionListener(EditorUtil.getTLAEditorWithFocus()));

    // Adding the KeyListener after the SelectionListener is necessary for the handling
    // of keystrokes to work. If they're added in the opposite order, some keys change
    // the selection and call the SelectionListener.

    list.addKeyListener(new ShowDeclarationsKeyListener(this)); // Testing

    // System.out.println("testing showAll = " + showAll);

    // It is necessary to select an item on the list if one is to be
    // able to listen for keystrokes. Otherwise, a keystroke causes the
    // current selection to change, calling the SelectionListener's widgetSelected()
    // method.
    list.setSelection(0);
    return list;
}
 
Example 8
Source File: WorkspaceWizardPage.java    From eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
  container = new Composite(parent, SWT.NONE);
  GridLayout layout = new GridLayout();
  layout.numColumns = 3;
  container.setLayout(layout);

  createWorkspaceSelectionControls();

  addLabel("Directories: ", 1, 5);
  directories = DirectoryTreeContentProvider.createTreeView(container);
  setControlGridData(directories.getTree(), 2, 5, true);
  directories.addCheckStateListener(e -> updateControls());

  new Label(container, SWT.NONE).setText("Targets:");
  createTargetTextField();
  setControlGridData(target, 1, 1, false);
  addTargetButton = createButton("+", e -> addTarget());

  targets = new List(container, SWT.SINGLE | SWT.BORDER);
  setControlGridData(targets, 2, 5, true);
  removeTargetButton = createButton("-", e -> deleteTarget());
  targets.addSelectionListener(createSelectionListener(
      e -> removeTargetButton.setEnabled(targets.getSelectionCount() > 0)));

  setControl(container);
  updateControls();
}
 
Example 9
Source File: DeleteColumnPage.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
 */
@Override
protected Control createDialogArea(final Composite parent) {
	final Composite container = (Composite) super.createDialogArea(parent);
	final GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 2;
	container.setLayout(gridLayout);
	final Label filterLabel = new Label(container, SWT.NONE);
	filterLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 2, 1));
	filterLabel.setText("Select the column that you want to delete:");

	final Label nameLabel = new Label(container, SWT.NONE);
	nameLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
	nameLabel.setText("Column:");

	final List columnList = new List(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
	columnList.setBounds(40, 20, 220, 100);
	columnList.setItems(columnTitle);

	columnList.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(final SelectionEvent e) {
			selectedColumn.clear();
			selectedColumn.addAll(Arrays.asList(columnList.getSelection()));
		}
	});

	return container;
}
 
Example 10
Source File: CopyTableWizardPage2.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void createControl( Composite parent ) {
  shell = parent.getShell();

  // create the composite to hold the widgets
  Composite composite = new Composite( parent, SWT.NONE );
  props.setLook( composite );

  FormLayout compLayout = new FormLayout();
  compLayout.marginHeight = Const.FORM_MARGIN;
  compLayout.marginWidth = Const.FORM_MARGIN;
  composite.setLayout( compLayout );

  // Source list to the left...
  wlListSource = new Label( composite, SWT.NONE );
  wlListSource.setText( BaseMessages.getString( PKG, "CopyTableWizardPage2.Dialog.TableList.Label" ) );
  props.setLook( wlListSource );
  FormData fdlListSource = new FormData();
  fdlListSource.left = new FormAttachment( 0, 0 );
  fdlListSource.top = new FormAttachment( 0, 0 );
  wlListSource.setLayoutData( fdlListSource );

  wListSource = new List( composite, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL );
  props.setLook( wListSource );
  wListSource.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      setPageComplete( canFlipToNextPage() );
    }
  } );

  FormData fdListSource = new FormData();
  fdListSource.left = new FormAttachment( 0, 0 );
  fdListSource.top = new FormAttachment( wlListSource, 0 );
  fdListSource.right = new FormAttachment( 100, 0 );
  fdListSource.bottom = new FormAttachment( 100, 0 );
  wListSource.setLayoutData( fdListSource );

  // Double click adds to destination.
  wListSource.addSelectionListener( new SelectionAdapter() {
    public void widgetDefaultSelected( SelectionEvent e ) {
      if ( canFinish() ) {
        getWizard().performFinish();
        shell.dispose();
      }
    }
  } );

  // set the composite as the control for this page
  setControl( composite );
}
 
Example 11
Source File: TransDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addLogTab() {
  // ////////////////////////
  // START OF LOG TAB///
  // /
  wLogTab = new CTabItem( wTabFolder, SWT.NONE );
  wLogTab.setText( BaseMessages.getString( PKG, "TransDialog.LogTab.Label" ) );

  FormLayout LogLayout = new FormLayout();
  LogLayout.marginWidth = Const.MARGIN;
  LogLayout.marginHeight = Const.MARGIN;

  wLogComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wLogComp );
  wLogComp.setLayout( LogLayout );

  // Add a log type List on the left hand side...
  //
  wLogTypeList = new List( wLogComp, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER );
  props.setLook( wLogTypeList );

  wLogTypeList.add( BaseMessages.getString( PKG, "TransDialog.LogTableType.Transformation" ) ); // Index 0
  wLogTypeList.add( BaseMessages.getString( PKG, "TransDialog.LogTableType.Step" ) ); // Index 1
  wLogTypeList.add( BaseMessages.getString( PKG, "TransDialog.LogTableType.Performance" ) ); // Index 2
  wLogTypeList.add( BaseMessages.getString( PKG, "TransDialog.LogTableType.LoggingChannels" ) ); // Index 3
  wLogTypeList.add( BaseMessages.getString( PKG, "TransDialog.LogTableType.Metrics" ) ); // Index 3

  FormData fdLogTypeList = new FormData();
  fdLogTypeList.left = new FormAttachment( 0, 0 );
  fdLogTypeList.top = new FormAttachment( 0, 0 );
  fdLogTypeList.right = new FormAttachment( middle / 2, 0 );
  fdLogTypeList.bottom = new FormAttachment( 100, 0 );
  wLogTypeList.setLayoutData( fdLogTypeList );

  wLogTypeList.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      showLogTypeOptions( wLogTypeList.getSelectionIndex() );
    }
  } );

  // On the right side we see a dynamic area : a composite...
  //
  wLogOptionsComposite = new Composite( wLogComp, SWT.BORDER );

  FormLayout logOptionsLayout = new FormLayout();
  logOptionsLayout.marginWidth = Const.MARGIN;
  logOptionsLayout.marginHeight = Const.MARGIN;
  wLogOptionsComposite.setLayout( logOptionsLayout );

  props.setLook( wLogOptionsComposite );
  FormData fdLogOptionsComposite = new FormData();
  fdLogOptionsComposite.left = new FormAttachment( wLogTypeList, margin );
  fdLogOptionsComposite.top = new FormAttachment( 0, 0 );
  fdLogOptionsComposite.right = new FormAttachment( 100, 0 );
  fdLogOptionsComposite.bottom = new FormAttachment( 100, 0 );
  wLogOptionsComposite.setLayoutData( fdLogOptionsComposite );

  FormData fdLogComp = new FormData();
  fdLogComp.left = new FormAttachment( 0, 0 );
  fdLogComp.top = new FormAttachment( 0, 0 );
  fdLogComp.right = new FormAttachment( 100, 0 );
  fdLogComp.bottom = new FormAttachment( 100, 0 );
  wLogComp.setLayoutData( fdLogComp );

  wLogComp.layout();
  wLogTab.setControl( wLogComp );

  // ///////////////////////////////////////////////////////////
  // / END OF LOG TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 12
Source File: JobDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addLogTab() {
  // ////////////////////////
  // START OF LOG TAB///
  // /
  wLogTab = new CTabItem( wTabFolder, SWT.NONE );
  wLogTab.setText( BaseMessages.getString( PKG, "JobDialog.LogTab.Label" ) );

  FormLayout LogLayout = new FormLayout();
  LogLayout.marginWidth = Const.MARGIN;
  LogLayout.marginHeight = Const.MARGIN;

  wLogComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wLogComp );
  wLogComp.setLayout( LogLayout );

  // Add a log type List on the left hand side...
  //
  wLogTypeList = new List( wLogComp, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER );
  props.setLook( wLogTypeList );

  for ( LogTableInterface logTable : logTables ) {
    wLogTypeList.add( logTable.getLogTableType() );
  }

  FormData fdLogTypeList = new FormData();
  fdLogTypeList.left = new FormAttachment( 0, 0 );
  fdLogTypeList.top = new FormAttachment( 0, 0 );
  fdLogTypeList.right = new FormAttachment( middle / 2, 0 );
  fdLogTypeList.bottom = new FormAttachment( 100, 0 );
  wLogTypeList.setLayoutData( fdLogTypeList );

  wLogTypeList.addSelectionListener( new SelectionAdapter() {
    public void widgetSelected( SelectionEvent arg0 ) {
      showLogTypeOptions( wLogTypeList.getSelectionIndex() );
    }
  } );

  // On the right side we see a dynamic area : a composite...
  //
  wLogOptionsComposite = new Composite( wLogComp, SWT.BORDER );

  FormLayout logOptionsLayout = new FormLayout();
  logOptionsLayout.marginWidth = Const.MARGIN;
  logOptionsLayout.marginHeight = Const.MARGIN;
  wLogOptionsComposite.setLayout( logOptionsLayout );

  props.setLook( wLogOptionsComposite );
  FormData fdLogOptionsComposite = new FormData();
  fdLogOptionsComposite.left = new FormAttachment( wLogTypeList, margin );
  fdLogOptionsComposite.top = new FormAttachment( 0, 0 );
  fdLogOptionsComposite.right = new FormAttachment( 100, 0 );
  fdLogOptionsComposite.bottom = new FormAttachment( 100, 0 );
  wLogOptionsComposite.setLayoutData( fdLogOptionsComposite );

  FormData fdLogComp = new FormData();
  fdLogComp.left = new FormAttachment( 0, 0 );
  fdLogComp.top = new FormAttachment( 0, 0 );
  fdLogComp.right = new FormAttachment( 100, 0 );
  fdLogComp.bottom = new FormAttachment( 100, 0 );
  wLogComp.setLayoutData( fdLogComp );

  wLogComp.layout();
  wLogTab.setControl( wLogComp );

  // ///////////////////////////////////////////////////////////
  // / END OF LOG TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 13
Source File: DBImportFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	DBImportWizard wiz = (DBImportWizard) getWizard();
	
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBImportFirstPage_Connection); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	tk.createLabel(body, Messages.DBImportFirstPage_EnterType); //$NON-NLS-1$
	dbTypes = new List(body, SWT.BORDER);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case MYSQL:
			case POSTGRESQL:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = ""; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			case H2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa";
				defaultPassword = "";
				break;
			case ODBC:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBImportSecondPage sec = (DBImportSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBImportFirstPage_serverAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBImportFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	if (wiz.preset != null && wiz.preset.length > 1) {
		int idx = StringTool.getIndex(supportedDB, wiz.preset[0]);
		if (idx < dbTypes.getItemCount()) {
			dbTypes.select(idx);
		}
		server.setText(wiz.preset[1]);
		dbName.setText(wiz.preset[2]);
	}
	setControl(form);
}
 
Example 14
Source File: PickTaeForTypesDialog.java    From uima-uimaj with Apache License 2.0 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
  Composite composite = (Composite) super.createDialogArea(parent);
  Label specialMsgLabel = new Label(composite, SWT.WRAP);
  AbstractSection.spacer(composite);

  // create m_taePrompt
  createWideLabel(composite, "Delegate Components:");

  delegateComponentListGUI = new List(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
  GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
  gridData.heightHint = 100;
  delegateComponentListGUI.setLayoutData(gridData);
  boolean bContainsConstituentsAlreadyInAggregate = false;
  boolean bContainsAggregate = false;
  for (int i = 0; i < m_DelegateComponentDescriptors.size(); i++) {
    String sAdditional = "";
    if (m_aggregateFileName.equals(m_DelegateComponentDescriptors.get(i))) {
      sAdditional = "**";
      bContainsAggregate = true;
    }
    delegateComponentListGUI.add((String) m_DelegateComponentDescriptors.get(i) + sAdditional);
  }
  delegateComponentListGUI.addSelectionListener(dialogSelectionListener);

  if (bContainsConstituentsAlreadyInAggregate && bContainsAggregate) {
    specialMsgLabel
            .setText("(* indicates delegate component is already part of aggregate, ** is aggregate currently being configured)");
  } else if (bContainsConstituentsAlreadyInAggregate) {
    specialMsgLabel.setText("(* indicates delegate component is already part of aggregate)");
  } else if (bContainsAggregate) {
    specialMsgLabel.setText("(** is aggregate currently being configured)");
  }

  createWideLabel(composite, "Delegate Component Description:");

  delegateComponentDescriptionText = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL
          | SWT.BORDER);
  delegateComponentDescriptionText.setLayoutData(new GridData(GridData.FILL_BOTH));
  GridData dcgd = new GridData(GridData.FILL_HORIZONTAL);
  dcgd.heightHint = 50;
  delegateComponentDescriptionText.setLayoutData(dcgd);
  delegateComponentDescriptionText.setEditable(false);

  createWideLabel(composite, "Input Types:");

  inputTypesList = new List(composite, SWT.BORDER | SWT.V_SCROLL);
  inputTypesList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  createWideLabel(composite, "Output Types:");

  outputTypesList = new List(composite, SWT.BORDER | SWT.V_SCROLL);
  outputTypesList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  // autoAddToFlowButton = new Button(composite, SWT.CHECK);
  // autoAddToFlowButton.setText("Add selected delegate components to end of flow");
  // autoAddToFlowButton.setSelection(true);
  // autoAddToFlowButton.setBackground(null);

  importByNameUI = newButton(composite, SWT.RADIO, "Import by Name",
          "Importing by name looks up the name on the classpath and datapath.");
  importByLocationUI = newButton(composite, SWT.RADIO, "Import by Location",
          "Importing by location requires a relative or absolute URL");

  String defaultBy = CDEpropertyPage.getImportByDefault(editor.getProject());
  if (defaultBy.equals("location")) {
    importByNameUI.setSelection(false);
    importByLocationUI.setSelection(true);
  } else {
    importByNameUI.setSelection(true);
    importByLocationUI.setSelection(false);
  }
  return composite;
}
 
Example 15
Source File: SeriesPageBar.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
public SeriesPageBar(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	compositeFirst = new Composite(this, SWT.NONE);
	compositeFirst.setLayout(new GridLayout(2, false));
	compositeFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	
	btnNewButton = new Button(compositeFirst, SWT.NONE);
	btnNewButton.setText("Select Term");
	
	lblSelectedTermIs = new Label(compositeFirst, SWT.CENTER);
	GridData gd_lblSelectedTermIs = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblSelectedTermIs.widthHint = 367;
	lblSelectedTermIs.setLayoutData(gd_lblSelectedTermIs);
	lblSelectedTermIs.setText("No Term Selected");
	btnNewButton.addSelectionListener(this);
	
	
	
	Composite compositeCentre = new Composite(this, SWT.NONE);
	compositeCentre.setLayout(new GridLayout(1, false));
	compositeCentre.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
	
	list = new List(compositeCentre, SWT.BORDER | SWT.V_SCROLL);
	GridData gd_list = new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1);
	gd_list.widthHint = 400;
	list.setLayoutData(gd_list);
	list.setBounds(0, 0, 71, 68);
	list.addSelectionListener(this);
	
	Composite compositeNorth = new Composite(this, SWT.NONE);
	compositeNorth.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	FillLayout fl_compositeNorth = new FillLayout(SWT.HORIZONTAL);
	fl_compositeNorth.marginWidth = 5;
	fl_compositeNorth.spacing = 5;
	compositeNorth.setLayout(fl_compositeNorth);
	
	lblColor = new Label(compositeNorth, SWT.NONE);
	lblColor.setText("Color: ");
	
	btnRadioButtonGrey = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonGrey.setText("Grey");
	btnRadioButtonGrey.addSelectionListener(this);
	
	btnRadioButtonCustom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonCustom.setText("Custom");
	btnRadioButtonCustom.addSelectionListener(this);
	
	btnRadioButtonRandom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonRandom.setSelection(true);
	btnRadioButtonRandom.setText("Random");
	
	btnOneColor = new Button(compositeNorth, SWT.RADIO);
	btnOneColor.setText("One Color");
	btnOneColor.addSelectionListener(this);
	
	btnRadioButtonRandom.addSelectionListener(this);
	
	Composite compositeSouth = new Composite(this, SWT.NONE);
	compositeSouth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	compositeSouth.setLayout(new GridLayout(5, false));
	
	btnCheckButton = new Button(compositeSouth, SWT.CHECK);
	btnCheckButton.setBounds(0, 0, 111, 20);
	btnCheckButton.setText("Show in Chart");
	btnCheckButton.addSelectionListener(this);
	
	labelShowColor = new Label(compositeSouth, SWT.BORDER);
	GridData gd_labelShowColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelShowColor.widthHint = 100;
	labelShowColor.setLayoutData(gd_labelShowColor);
	labelShowColor.setBounds(0, 0, 70, 20);
	labelShowColor.setText(" ");
	labelShowColor.addMouseListener(this);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	
	loadSettings();

}
 
Example 16
Source File: SeriesPageBubble.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
public SeriesPageBubble(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	compositeFirst = new Composite(this, SWT.NONE);
	compositeFirst.setLayout(new GridLayout(4, true));
	compositeFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	btnGetYTerm = new Button(compositeFirst, SWT.NONE);
	btnGetYTerm.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	btnGetYTerm.setText("Select Y Term");
	btnGetYTerm.addSelectionListener(this);
	
	lblySelectedTermIs = new Label(compositeFirst, SWT.NONE);
	lblySelectedTermIs.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	lblySelectedTermIs.setText("No Term Selected");
	
	btnGetXTerm = new Button(compositeFirst, SWT.NONE);
	btnGetXTerm.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	btnGetXTerm.setText("Select X Term");
	btnGetXTerm.addSelectionListener(this);
	
	lblxNewLabel = new Label(compositeFirst, SWT.NONE);
	lblxNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	lblxNewLabel.setText("No Term Selected");
	
	
	Composite compositeCentre = new Composite(this, SWT.NONE);
	compositeCentre.setLayout(new FillLayout(SWT.HORIZONTAL));
	GridData gd_compositeCentre = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
	gd_compositeCentre.widthHint = 218;
	compositeCentre.setLayoutData(gd_compositeCentre);
	
	list_y = new List(compositeCentre, SWT.BORDER | SWT.V_SCROLL);
	list_y.setBounds(0, 0, 71, 68);
	list_y.addSelectionListener(this);
	
	list_x = new List(compositeCentre, SWT.BORDER | SWT.V_SCROLL);
	list_x.addSelectionListener(this);
	
	Composite compositeNorth = new Composite(this, SWT.NONE);
	compositeNorth.setLayout(new GridLayout(2, false));
	compositeNorth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	btnShowInChartY = new Button(compositeNorth, SWT.CHECK);
	btnShowInChartY.setBounds(0, 0, 111, 20);
	btnShowInChartY.setText("Show in Chart");
	btnShowInChartY.addSelectionListener(this);
	
	btnShowInChartX = new Button(compositeNorth, SWT.CHECK);
	btnShowInChartX.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1));
	btnShowInChartX.setText("Show in Chart");
	btnShowInChartX.addSelectionListener(this);
	
	Composite compositeSouth = new Composite(this, SWT.NONE);
	compositeSouth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	compositeSouth.setLayout(new GridLayout(6, false));
	
	lblColorYSeries = new Label(compositeSouth, SWT.NONE);
	GridData gd_lblColorYSeries = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblColorYSeries.widthHint = 100;
	lblColorYSeries.setLayoutData(gd_lblColorYSeries);
	lblColorYSeries.setText("Color Y Series:");
	
	labelShowColor = new Label(compositeSouth, SWT.BORDER);
	GridData gd_labelShowColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelShowColor.widthHint = 100;
	labelShowColor.setLayoutData(gd_labelShowColor);
	labelShowColor.setBounds(0, 0, 70, 20);
	labelShowColor.setText(" ");
	
	btnRadioButtonGrey = new Button(compositeSouth, SWT.RADIO);
	btnRadioButtonGrey.setText("Grey");
	
	btnRadioButtonCustom = new Button(compositeSouth, SWT.RADIO);
	btnRadioButtonCustom.setText("Custom");
	
	btnRadioButtonRandom = new Button(compositeSouth, SWT.RADIO);
	btnRadioButtonRandom.setSelection(true);
	btnRadioButtonRandom.setText("Random");
	
	btnOneColor = new Button(compositeSouth, SWT.RADIO);
	btnOneColor.setText("One color");
	btnOneColor.addSelectionListener(this);
	btnRadioButtonRandom.addSelectionListener(this);
	btnRadioButtonCustom.addSelectionListener(this);
	btnRadioButtonGrey.addSelectionListener(this);
	labelShowColor.addMouseListener(this);
	
	loadSettings();

}
 
Example 17
Source File: SeriesPagePie.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
public SeriesPagePie(Composite parent, int style) {
	super(parent, style);
	setLayout(new GridLayout(1, false));
	
	compositeFirst = new Composite(this, SWT.NONE);
	compositeFirst.setLayout(new GridLayout(2, false));
	compositeFirst.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	
	btnNewButton = new Button(compositeFirst, SWT.NONE);
	btnNewButton.setText("Select Term");
	
	lblSelectedTermIs = new Label(compositeFirst, SWT.CENTER);
	GridData gd_lblSelectedTermIs = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_lblSelectedTermIs.widthHint = 367;
	lblSelectedTermIs.setLayoutData(gd_lblSelectedTermIs);
	lblSelectedTermIs.setText("No Term Selected");
	btnNewButton.addSelectionListener(this);
	
	
	
	Composite compositeCentre = new Composite(this, SWT.NONE);
	compositeCentre.setLayout(new GridLayout(1, false));
	compositeCentre.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
	
	list = new List(compositeCentre, SWT.BORDER | SWT.V_SCROLL);
	GridData gd_list = new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1);
	gd_list.widthHint = 400;
	list.setLayoutData(gd_list);
	list.setBounds(0, 0, 71, 68);
	list.addSelectionListener(this);
	
	Composite compositeNorth = new Composite(this, SWT.NONE);
	compositeNorth.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	FillLayout fl_compositeNorth = new FillLayout(SWT.HORIZONTAL);
	fl_compositeNorth.marginWidth = 5;
	fl_compositeNorth.spacing = 5;
	compositeNorth.setLayout(fl_compositeNorth);
	
	lblColor = new Label(compositeNorth, SWT.NONE);
	lblColor.setText("Color:");
	
	btnRadioButtonGrey = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonGrey.setText("Grey");
	btnRadioButtonGrey.addSelectionListener(this);
	
	btnRadioButtonCustom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonCustom.setText("Custom");
	btnRadioButtonCustom.addSelectionListener(this);
	
	btnRadioButtonRandom = new Button(compositeNorth, SWT.RADIO);
	btnRadioButtonRandom.setSelection(true);
	btnRadioButtonRandom.setText("Random");
	
	btnOneColor = new Button(compositeNorth, SWT.RADIO);
	btnOneColor.setText("One Color");
	btnOneColor.addSelectionListener(this);
	
	btnRadioButtonRandom.addSelectionListener(this);
	
	Composite compositeSouth = new Composite(this, SWT.NONE);
	compositeSouth.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
	compositeSouth.setLayout(new GridLayout(5, false));
	
	btnCheckButton = new Button(compositeSouth, SWT.CHECK);
	btnCheckButton.setBounds(0, 0, 111, 20);
	btnCheckButton.setText("Show in Chart");
	btnCheckButton.addSelectionListener(this);
	
	labelShowColor = new Label(compositeSouth, SWT.BORDER);
	GridData gd_labelShowColor = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
	gd_labelShowColor.widthHint = 100;
	labelShowColor.setLayoutData(gd_labelShowColor);
	labelShowColor.setBounds(0, 0, 70, 20);
	labelShowColor.setText(" ");
	labelShowColor.addMouseListener(this);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	new Label(compositeSouth, SWT.NONE);
	
	loadSettings();

}
 
Example 18
Source File: EditboxPreferencePage.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected Control createCategoryControl(final Composite parent) {
	final Composite c = new Composite(parent, SWT.NONE);
	c.setLayout(new GridLayout(2, true));

	final Label categoryLabel = new Label(c, SWT.NONE);
	categoryLabel.setText("Themes");

	final Label namesLabel = new Label(c, SWT.NONE);
	namesLabel.setText("Associated file names");
	namesLabel.setAlignment(SWT.RIGHT);

	categoryList = new List(c, SWT.V_SCROLL | SWT.BORDER);
	categoryList.setLayoutData(new GridData(GridData.FILL_BOTH));
	categoryList.addSelectionListener(new SelectCategory());
	namesList = new List(c, SWT.V_SCROLL | SWT.BORDER);
	namesList.setLayoutData(new GridData(GridData.FILL_BOTH));

	final Composite cLeft = new Composite(c, SWT.NONE);
	cLeft.setLayout(new GridLayout(2, true));
	final Button bAddCategory = new Button(cLeft, SWT.NONE);
	bAddCategory.setText("Add");
	bAddCategory.addSelectionListener(new AddCategory());
	bAddCategory.setLayoutData(new GridData(GridData.FILL_BOTH));
	final Button bRemoveCategory = new Button(cLeft, SWT.NONE);
	bRemoveCategory.setText("Remove");
	bRemoveCategory.setLayoutData(new GridData(GridData.FILL_BOTH));
	bRemoveCategory.addSelectionListener(new RemoveCategory());

	final Composite cRight = new Composite(c, SWT.NONE);
	cRight.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
	cRight.setLayout(new GridLayout(2, true));
	bAddFile = new Button(cRight, SWT.NONE);
	bAddFile.setText("Add");
	bAddFile.setLayoutData(new GridData(GridData.FILL_BOTH));
	bAddFile.addSelectionListener(new AddFile());
	bAddFile.setEnabled(false);
	final Button bRemoveFile = new Button(cRight, SWT.NONE);
	bRemoveFile.setText("Remove");
	bRemoveFile.setLayoutData(new GridData(GridData.FILL_BOTH));
	bRemoveFile.addSelectionListener(new RemoveFile());

	loadData();

	return c;
}
 
Example 19
Source File: SDViewerPage.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    parent.setLayout(gl);
    Composite page = new Composite(parent, SWT.NONE);
    GridLayout pageLayout = new GridLayout();
    pageLayout.numColumns = 2;
    GridData pageLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    page.setLayoutData(pageLayoutdata);
    page.setLayout(pageLayout);

    fTooltip = new BooleanFieldEditor(ISDPreferences.PREF_TOOLTIP, Messages.SequenceDiagram_ShowTooltips, page);
    fTooltip.setPreferenceStore(fPreferences.getPreferenceStore());
    fTooltip.load();

    // link font with zoom pref
    fLink = new BooleanFieldEditor(ISDPreferences.PREF_LINK_FONT, Messages.SequenceDiagram_IncreaseFontSizeWhenZooming, page);
    fLink.setPreferenceStore(fPreferences.getPreferenceStore());
    fLink.load();

    fNoExternalTime = new BooleanFieldEditor(ISDPreferences.PREF_EXCLUDE_EXTERNAL_TIME, Messages.SequenceDiagram_ExcludeExternalTime, page);
    fNoExternalTime.setPreferenceStore(fPreferences.getPreferenceStore());
    fNoExternalTime.load();

    // use gradient color pref
    fUseGrad = new BooleanFieldEditor(ISDPreferences.PREF_USE_GRADIENT, Messages.SequenceDiagram_UseGradientColor, page);
    fUseGrad.setPreferenceStore(fPreferences.getPreferenceStore());
    fUseGrad.load();

    Label separator = new Label(page, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    GridData sepData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    separator.setLayoutData(sepData);

    Composite prefPage = new Composite(page, SWT.NONE);
    GridLayout prefPageLayout = new GridLayout();
    prefPage.setLayoutData(pageLayoutdata);
    prefPageLayout.numColumns = 1;
    prefPage.setLayout(prefPageLayout);

    // swimLane width pref
    fLifelineWidth = new IntegerFieldEditor(ISDPreferences.PREF_LIFELINE_WIDTH, Messages.SequenceDiagram_LifelineWidth, prefPage);
    fLifelineWidth.setPreferenceStore(fPreferences.getPreferenceStore());
    fLifelineWidth.setValidRange(119, 500);
    fLifelineWidth.load();

    // not very nice
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);

    // Font list pref
    fClassItemList = new List(prefPage, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fClassItemList.setLayoutData(tabItemLayoutdata);

    String[] fontList2 = SDViewPref.getFontList2();
    for (int i = 0; i < fontList2.length; i++) {
        fClassItemList.add(fontList2[i]);
    }
    fClassItemList.setSelection(0);
    fClassItemList.addSelectionListener(this);
    fButtonArea = new Composite(prefPage, SWT.NONE);
    GridData tabItemLayoutdata2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL/* |GridData.GRAB_HORIZONTAL */| GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fButtonArea.setLayoutData(tabItemLayoutdata2);
    GridLayout buttonAreaLayout = new GridLayout();
    buttonAreaLayout.numColumns = 1;
    fButtonArea.setLayout(buttonAreaLayout);

    // font selector initialise for the lifeline font pref
    String[] fontList = SDViewPref.getFontList();
    fFont = new FontFieldEditor(fontList[0], "",//$NON-NLS-1$
            Messages.SequenceDiagram_AaBbYyZz, fButtonArea);
    fFont.getPreviewControl().setSize(500, 500);
    fFont.setPreferenceStore(fPreferences.getPreferenceStore());
    fFont.load();

    fBackGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX, Messages.SequenceDiagram_Background, fButtonArea);
    fBackGroundColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fBackGroundColor.load();

    fLineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX, Messages.SequenceDiagram_Lines, fButtonArea);
    fLineColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fLineColor.load();

    fTextColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX, Messages.SequenceDiagram_Text, fButtonArea);
    fTextColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fTextColor.load();
    swapPref(true);
    Dialog.applyDialogFont(page);

    return page;
}
 
Example 20
Source File: ShowUsesHandler.java    From tlaplus with MIT License 3 votes vote down vote up
/**
 * This is the method that puts the content into the popup's
 * dialog area.  It puts an org.eclipse.swt.widgets.List
 * (note that this isn't an ordinary Java List) there.
 * 
 * This is identical to the corresponding method in 
 * ShowDeclarationsHandler except for the obvious name changes
 * and the different setList method.  See that method
 * for the comments.
 * 
 */
protected Control createDialogArea(Composite composite)
{
    list = new List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.RESIZE);
    setList();
    list.addSelectionListener(new ShowUsesSelectionListener(this.showUses, this.moduleList)); // EditorUtil.getTLAEditorWithFocus()));
    list.addKeyListener(new ShowUsesKeyListener(this)); // Testing
    list.setSelection(0);
    return list;
}