Java Code Examples for org.eclipse.swt.SWT#TOP

The following examples show how to use org.eclipse.swt.SWT#TOP . 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: ComponentTitledBorder.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent
 * @param controller
 * @param title
 * @param id
 */
public ComponentTitledBorder(Composite parent, Controller controller, String title, String id){

    folder = new CTabFolder(parent, SWT.TOP | SWT.BORDER | SWT.FLAT);
    folder.setUnselectedCloseVisible(false);
    folder.setSimple(false);
    
    // Create help button
    if (controller != null) SWTUtil.createHelpButton(controller, folder, id);

    // Prevent closing
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(final CTabFolderEvent event) {
            event.doit = false;
        }
    });
    
    // Create general tab
    tab = new CTabItem(folder, SWT.NULL);
    tab.setText(title);
    tab.setShowClose(false);

    folder.setSelection(tab);
}
 
Example 2
Source File: AttributeViewPage.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private void buildUI( )
{

	FillLayout layout = new FillLayout( );
	setLayout( layout );

	Label label = new Label( this, SWT.LEFT | SWT.TOP | SWT.WRAP );
	String extendsString = "";//$NON-NLS-1$
	if ( model.get( 0 ) instanceof ModelClassWrapper )
	{

		extendsString = ( (ModelClassWrapper) model.get( 0 ) ).getExtendsString( );
	}

	label.setText( extendsString );
}
 
Example 3
Source File: SWTTabFolder.java    From tuxguitar with GNU Lesser General Public License v2.1 6 votes vote down vote up
public SWTTabFolder(SWTContainer<? extends Composite> container, boolean showClose) {
	super(new CTabFolder(container.getControl(), SWT.TOP), container);
	
	this.tabs = new ArrayList<SWTTabItem>();
	this.closeListener = new UICloseListenerManager();
	this.selectionListener = new SWTSelectionListenerManager(this);
	this.showClose = showClose;
	this.getControl().setTabHeight(TAB_HEIGHT);
	this.getControl().addCTabFolder2Listener(new CTabFolder2Adapter() {
		public void close(CTabFolderEvent event) {
			onTabClose(event);
		}
	});
	this.getControl().addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {
			onTabSelected();
		}
	});
}
 
Example 4
Source File: ExtractClassWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createParameterNameInput(Composite group) {
	Label l= new Label(group, SWT.NONE);
	l.setText(RefactoringMessages.ExtractClassWizard_field_name);

	final Text text= new Text(group, SWT.BORDER);
	fParameterNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD);
	text.setText(fDescriptor.getFieldName());
	text.addModifyListener(new ModifyListener() {

		public void modifyText(ModifyEvent e) {
			fDescriptor.setFieldName(text.getText());
			validateRefactoring();
		}

	});
	GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
	gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
	text.setLayoutData(gridData);
}
 
Example 5
Source File: BarManager.java    From pmTrans with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void createToolBar() {
	bar = new CoolBar(shell, SWT.FLAT | SWT.TOP);
	// bars
	bar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

	createFileSection();
	createEditBar();
	createFontSection();
	createSettingsBar();

	bar.pack();
	bar.addListener(SWT.Resize, new Listener() {

		@Override
		public void handleEvent(Event arg0) {
			pmTrans.adjustLayout();
		}
	});
}
 
Example 6
Source File: ServerPortExtension.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
public void createControl(UI_POSITION position, Composite parent) {
  // We add controls only to the BOTTOM position.
  if (position == UI_POSITION.BOTTOM) {
    portLabel = new Label(parent, SWT.NONE);
    portLabel.setVisible(false);
    portLabel.setText(Messages.getString("NEW_SERVER_DIALOG_PORT"));

    portText = new Text(parent, SWT.SINGLE | SWT.BORDER);
    portText.setVisible(false);
    portText.setText(String.valueOf(LocalAppEngineServerBehaviour.DEFAULT_SERVER_PORT));
    portText.addVerifyListener(new PortChangeMonitor());
    portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault();
    Image errorImage = registry.getFieldDecoration(FieldDecorationRegistry.DEC_ERROR).getImage();

    portDecoration = new ControlDecoration(portText, SWT.LEFT | SWT.TOP);
    portDecoration.setDescriptionText(Messages.getString("NEW_SERVER_DIALOG_INVALID_PORT_VALUE"));
    portDecoration.setImage(errorImage);
    portDecoration.hide();
  }
}
 
Example 7
Source File: FileCoverMsgDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite tparent = (Composite) super.createDialogArea(parent);
	Point defaultSpacing = LayoutConstants.getSpacing();
	GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins())
			.spacing(defaultSpacing.x * 2, defaultSpacing.y).numColumns(2).applyTo(tparent);
	
	Label imgLbl = new Label(tparent, SWT.TOP);
	imgLbl.setImage(warningImg);
	GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imgLbl);
	
	String message = MessageFormat.format(Messages.getString("dialog.FileCoverMsgDialog.message"), fileName);
	
	if (message != null) {
		Label messageLbl = new Label(tparent, SWT.WRAP);
		messageLbl.setText(message);
		GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint(
				convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
				SWT.DEFAULT).applyTo(messageLbl);
	}
	
	return tparent;
}
 
Example 8
Source File: StyledTextXtextAdapter.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
private ControlDecoration createContentAssistDecoration(StyledText styledText) {
	final ControlDecoration result = new ControlDecoration(styledText, SWT.TOP | SWT.LEFT);
	result.setShowHover(true);
	result.setShowOnlyOnFocus(true);

	final Image image = ImageDescriptor
			.createFromFile(XtextStyledTextCellEditor.class, "images/content_assist_cue.gif").createImage();
	result.setImage(image);
	result.setDescriptionText("Content Assist Available (CTRL + Space)");
	result.setMarginWidth(2);
	styledText.addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent e) {
			if (getDecoration() != null) {
				getDecoration().dispose();
			}
			if (image != null) {
				image.dispose();
			}
		}
	});
	return result;
}
 
Example 9
Source File: TSTitleAreaDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Set the layout values for the messageLabel, messageImageLabel and
 * fillerLabel for the case where there is a normal message.
 * 
 * @param verticalSpacing
 *            int The spacing between widgets on the vertical axis.
 * @param horizontalSpacing
 *            int The spacing between widgets on the horizontal axis.
 */
private void setLayoutsForNormalMessage(int verticalSpacing,
		int horizontalSpacing) {
	FormData messageImageData = new FormData();
	messageImageData.top = new FormAttachment(titleLabel, verticalSpacing);
	messageImageData.left = new FormAttachment(0, H_GAP_IMAGE);
	messageImageLabel.setLayoutData(messageImageData);
	FormData messageLabelData = new FormData();
	messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing);
	messageLabelData.right = new FormAttachment(titleImageLabel);
	messageLabelData.left = new FormAttachment(messageImageLabel,
			horizontalSpacing);
	messageLabelData.height = messageLabelHeight;
	if (titleImageLargest)
		messageLabelData.bottom = new FormAttachment(titleImageLabel, 0,
				SWT.BOTTOM);
	messageLabel.setLayoutData(messageLabelData);
	FormData fillerData = new FormData();
	fillerData.left = new FormAttachment(0, horizontalSpacing);
	fillerData.top = new FormAttachment(messageImageLabel, 0);
	fillerData.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
	bottomFillerLabel.setLayoutData(fillerData);
	FormData data = new FormData();
	data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP);
	data.left = new FormAttachment(0, 0);
	data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
	data.right = new FormAttachment(messageImageLabel, 0);
	leftFillerLabel.setLayoutData(data);
}
 
Example 10
Source File: EclipseTabProvider.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
public EclipseTabProvider ( final Composite parent )
{
    this.folder = new CTabFolder ( parent, SWT.TOP | SWT.FLAT | SWT.BORDER );
    this.folder.setTabHeight ( 24 );
    this.folder.setLayoutData ( new GridData ( SWT.FILL, SWT.FILL, true, true ) );

    this.mgr = new MenuManager ();
    final Menu menu = this.mgr.createContextMenu ( this.folder );
    this.folder.setMenu ( menu );
}
 
Example 11
Source File: ClassPathsPageHelper.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createTabFolderArea( Composite composite )
{
	Composite tabArea = new Composite( composite, SWT.NONE );
	GridLayout layout = new GridLayout( 1, false );
	layout.marginWidth = 10;
	tabArea.setLayout( layout );
	GridData gd = new GridData( GridData.FILL_BOTH );
	tabArea.setLayoutData( gd );
	
	tabFolder = new TabFolder( tabArea, SWT.TOP );
	tabFolder.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	runtimePage = new POJOClassTabFolderPage( this,
			getApplResourceDir( ) );
	runtimePage.setPrompMessage( Messages.getString( "DataSource.POJOClassTabFolderPage.promptLabel.runtime" ) ); //$NON-NLS-1$
	TabItem runtimeTab = runtimePage.createContents( tabFolder );
	runtimeTab.setText( Messages.getString( "DataSource.POJOClasses.tab.runtime" ) ); //$NON-NLS-1$

	designtimePage = new POJOClassTabFolderPage( this,
			getApplResourceDir( ) );
	designtimePage.setPrompMessage( Messages.getString( "DataSource.POJOClassTabFolderPage.promptLabel.designtime" ) ); //$NON-NLS-1$
	TabItem designTimeTab = designtimePage.createContents( tabFolder );
	designTimeTab.setText( Messages.getString( "DataSource.POJOClasses.tab.designTime" ) ); //$NON-NLS-1$

	runtimePage.setFriendPage( designtimePage );
	designtimePage.setFriendPage( runtimePage );

	initControlValues( );
}
 
Example 12
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static Text createTextArea(final AbstractDialog dialog, final Composite composite, final String title, final int width, final int height, final int span, final boolean selectAll, final boolean imeOn, final boolean indent) {
    if (title != null) {
        final Label label = new Label(composite, SWT.NONE);

        final GridData labelGridData = new GridData();
        labelGridData.verticalAlignment = SWT.TOP;
        labelGridData.horizontalAlignment = SWT.LEFT;

        label.setLayoutData(labelGridData);

        label.setText(ResourceString.getResourceString(title));
    }

    final GridData textAreaGridData = new GridData();
    textAreaGridData.heightHint = height;
    textAreaGridData.horizontalSpan = span;

    if (width > 0) {
        textAreaGridData.widthHint = width;
    } else {
        textAreaGridData.horizontalAlignment = GridData.FILL;
        textAreaGridData.grabExcessHorizontalSpace = true;
    }

    if (title != null && indent) {
        textAreaGridData.horizontalIndent = Resources.INDENT;
    }

    final Text text = new Text(composite, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
    text.setLayoutData(textAreaGridData);

    ListenerAppender.addTextAreaListener(text, dialog, selectAll, imeOn);

    return text;
}
 
Example 13
Source File: CTabFolderExample.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);

    shell.setLayout(new GridLayout());
    // SWT.BOTTOM to show at the bottom
    CTabFolder folder = new CTabFolder(shell, SWT.TOP);
    GridData data = new GridData(SWT.FILL, 
            SWT.FILL, true, true,
            2, 1);
    folder.setLayoutData(data);
    CTabItem cTabItem1 = new CTabItem(folder, SWT.NONE);
    cTabItem1.setText("Tab1");
    CTabItem cTabItem2 = new CTabItem(folder, SWT.NONE);
    cTabItem2.setText("Tab2");
    CTabItem cTabItem3 = new CTabItem(folder, SWT.NONE);
    cTabItem3.setText("Tab3");
    CTabItem cTabItem4 = new CTabItem(folder, SWT.NONE);
    cTabItem4.setText("Tab4");

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
}
 
Example 14
Source File: FormPropertyDescriptor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void noUpDownLayout( )
{
	FormLayout layout = new FormLayout( );
	layout.marginBottom = WidgetUtil.SPACING;
	layout.marginTop = 1;
	layout.marginWidth = WidgetUtil.SPACING;
	layout.spacing = WidgetUtil.SPACING;
	formPanel.setLayout( layout );

	FormData data = new FormData( );
	data.right = new FormAttachment( 90 );
	data.top = new FormAttachment( 0, 0 );
	data.width = Math.max( btnWidth,
			btnAdd.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	btnAdd.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.BOTTOM );
	data.left = new FormAttachment( btnAdd, 0, SWT.LEFT );
	data.width = Math.max( btnWidth,
			btnEdit.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	btnEdit.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnEdit, 0, SWT.BOTTOM );
	data.left = new FormAttachment( btnEdit, 0, SWT.LEFT );
	data.width = Math.max( btnWidth,
			btnDel.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ).x );
	btnDel.setLayoutData( data );

	data = new FormData( );
	data.top = new FormAttachment( btnAdd, 0, SWT.TOP );
	data.bottom = new FormAttachment( 100 );
	data.left = new FormAttachment( 0, 0 );
	data.right = new FormAttachment( btnAdd, 0, SWT.LEFT );
	table.setLayoutData( data );
}
 
Example 15
Source File: UserControlDialog.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
	final Composite composite = (Composite) super.createDialogArea(parent);
	final GridLayout layout = (GridLayout) composite.getLayout();
	layout.numColumns = 3;
	// Label text = new Label(composite, SWT.None);
	// text.setBackground(SwtGui.COLOR_OK);
	// text.setForeground(SwtGui.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	// text.setText(title);
	// GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
	// text.setLayoutData(data);
	// Label sep = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
	// data = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
	// data.heightHint = 20;
	// sep.setLayoutData(data);
	for (final IStatement c : userCommands) {
		if (c instanceof UserCommandStatement) {
			final List<UserInputStatement> inputs = ((UserCommandStatement) c).getInputs();
			final int nbLines = inputs.size() > 1 ? inputs.size() : 1;
			final int nbCol = inputs.size() > 0 ? 1 : 3;
			final Button b = new Button(composite, SWT.PUSH);
			b.setText(c.getName());
			b.setEnabled(((UserCommandStatement) c).isEnabled(scope));
			final GridData gd = new GridData(SWT.LEFT, SWT.TOP, true, true, nbCol, nbLines);
			b.setLayoutData(gd);
			b.addSelectionListener(new SelectionAdapter() {

				@Override
				public void widgetSelected(final SelectionEvent e) {
					scope.execute(c);
					GAMA.getExperiment().refreshAllOutputs();
				}

			});
			for (final UserInputStatement i : inputs) {

				scope.addVarWithValue(i.getTempVarName(), i.value(scope));
				EditorFactory.create(scope, composite, i, newValue -> {
					i.setValue(scope, newValue);
					scope.execute(i);
				}, false, false);
			}

			final Label sep = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
			final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1);
			sep.setLayoutData(data);
		}
	}
	composite.layout();
	composite.pack();

	return composite;
}
 
Example 16
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected GridData getParameterGridData() {
	final GridData d = new GridData(SWT.FILL, SWT.TOP, true, false);
	d.minimumWidth = 100;
	return d;
}
 
Example 17
Source File: BibtexMergeDialog.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
private void buildPreview(Composite container) {
	GridData gridData = new GridData();
	gridData.horizontalAlignment = SWT.RIGHT;
	gridData.verticalAlignment = SWT.TOP;
	gridData.grabExcessVerticalSpace = true;
	gridData.horizontalSpan = 1;
	gridData.verticalSpan = 5;

	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new GridLayout(1, false));
	composite.setLayoutData(gridData);

	// create overview
	Table table = new Table(composite, SWT.BORDER);
	table.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1, 1));

	TableColumn intersection = new TableColumn(table, SWT.CENTER);
	TableColumn mergeConflicts = new TableColumn(table, SWT.CENTER);
	TableColumn unionWithoutConflicts = new TableColumn(table, SWT.CENTER);
	intersection.setText("Intersection");
	mergeConflicts.setText("Merge conflicts");
	unionWithoutConflicts.setText("Union without conflicts");
	intersection.setWidth(80);
	mergeConflicts.setWidth(100);
	unionWithoutConflicts.setWidth(140);
	table.setHeaderVisible(true);

	previewStats = new TableItem(table, SWT.NONE);

	Label label = new Label(composite, SWT.NONE);
	label.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, true, 1, 1));
	label.setText("Preview: ");

	preview = new StyledText(composite, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
	preview.setLayoutData(new GridData(GridData.FILL_BOTH));
	preview.setEditable(false);
	preview.setEnabled(false);
	preview.setBlockSelection(true);

	// highlight current conflict
	initializeConflictIterator();
	preview.addLineStyleListener(new LineStyleListener() {
		public void lineGetStyle(LineStyleEvent event) {
			if (currentConflictedField == null
					|| currentConflictedResource.getConflictForField(currentConflictedField) == null)
				return;

			String currentConflict = currentConflictedResource.getConflictForField(currentConflictedField);
			StyleRange styleRange = new StyleRange();
			styleRange.start = preview.getText().indexOf(currentConflict);
			styleRange.length = currentConflict.length();
			styleRange.background = getParentShell().getDisplay().getSystemColor(SWT.COLOR_YELLOW);
			event.styles = new StyleRange[] { styleRange };
		}
	});

	GridData textGrid = new GridData(500, 500);
	textGrid.horizontalSpan = 2;
	preview.setLayoutData(textGrid);

	updatePreview();
}
 
Example 18
Source File: SWTLabelWidget.java    From atdl4j with MIT License 4 votes vote down vote up
/**
	 * 2/9/2010 Scott Atwell @see AbstractAtdl4jWidget.init(ControlT aControl,
	 * ParameterT aParameter, Atdl4jOptions aAtdl4jOptions) throws JAXBException
	 * public SWTLabelWidget(LabelT control) { super(control); }
	 **/

	public Widget createWidget(Composite parent, int style)
	{

		// label
		label = new Label( parent, SWT.NONE );

/*** initValue should take precedence over label property on Label control per JIRA item ATDL-146 and FPL Algo Trading Working Group meeting held 10/13/2010 		
		if ( control.getLabel() != null )
		{
			label.setText( control.getLabel() );
		}
		else if ( ControlHelper.getInitValue( control, getAtdl4jOptions() ) != null )
		{
			label.setText( (String) ControlHelper.getInitValue( control, getAtdl4jOptions() ) );
		}
***/
		// -- initValue should take precedence over label property on Label control per JIRA item ATDL-146 and FPL Algo Trading Working Group meeting held 10/13/2010 --
		if ( ControlHelper.getInitValue( control, getAtdl4jOptions() ) != null )
		{
			label.setText( (String) ControlHelper.getInitValue( control, getAtdl4jOptions() ) );
		}
		else if ( control.getLabel() != null )
		{
			label.setText( control.getLabel() );
		}
		else
		{
			label.setText( "" );
		}
		GridData gd = new GridData( SWT.LEFT, SWT.TOP, false, false );
		gd.horizontalSpan = 2;
		label.setLayoutData( gd );

		// tooltip
		String tooltip = getTooltip();
		if ( tooltip != null )
			label.setToolTipText( tooltip );

		return parent;
	}
 
Example 19
Source File: AbstractEditor.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected Composite createToolbar2() {
	final Composite t = new Composite(composite, SWT.NONE);
	final GridData d = new GridData(SWT.FILL, SWT.TOP, false, false);
	t.setLayoutData(d);
	t.setBackground(HOVERED_BACKGROUND);
	final GridLayout id =
			GridLayoutFactory.fillDefaults().equalWidth(false).extendedMargins(0, 0, 0, 0).spacing(0, 0).create();
	final GridData gd =
			GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).indent(0, -1).create();
	t.setLayout(id);
	final String unitText = computeUnitLabel();
	if (!unitText.isEmpty()) {
		unitItem = new Text(t, SWT.READ_ONLY | SWT.FLAT);
		unitItem.setText(unitText);
		unitItem.setBackground(HOVERED_BACKGROUND);
		unitItem.setEnabled(false);
	}
	if (isEditable) {
		final int[] codes = this.getToolItems();
		for (final int i : codes) {
			Button item = null;
			switch (i) {
				case REVERT:
					item = createItem(t, "Revert to original value", GamaIcons.create("small.revert").image());
					break;
				case PLUS:
					item = createPlusItem(t);
					break;
				case MINUS:
					item = createItem(t, "Decrement the parameter",
							GamaIcons.create(IGamaIcons.SMALL_MINUS).image());
					break;
				case EDIT:
					item = createItem(t, "Edit the parameter", GamaIcons.create("small.edit").image());
					break;
				case INSPECT:
					item = createItem(t, "Inspect the agent", GamaIcons.create("small.inspect").image());
					break;
				case BROWSE:
					item = createItem(t, "Browse the list of agents", GamaIcons.create("small.browse").image());
					break;
				case CHANGE:
					item = createItem(t, "Choose another agent", GamaIcons.create("small.change").image());
					break;
				case DEFINE:
					item = createItem(t, "Set the parameter to undefined",
							GamaIcons.create("small.undefine").image());
			}
			if (item != null) {
				items[i] = item;
				item.setBackground(HOVERED_BACKGROUND);
				item.setLayoutData(GridDataFactory.copyData(gd));
				;
				item.addSelectionListener(new ItemSelectionListener(i));

			}
		}
	}
	id.numColumns = t.getChildren().length;
	t.layout();
	t.pack();
	return t;

}
 
Example 20
Source File: WorkflowExecutionConfigurationDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
protected void optionsSectionControls() {

    wlLogLevel = new Label( gDetails, SWT.RIGHT );
    wlLogLevel.setText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.LogLevel.Label" ) );
    wlLogLevel.setToolTipText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.LogLevel.Tooltip" ) );
    props.setLook( wlLogLevel );
    FormData fdlLogLevel = new FormData();
    fdlLogLevel.top = new FormAttachment( 0, 10 );
    fdlLogLevel.left = new FormAttachment( 0, 10 );
    wlLogLevel.setLayoutData( fdlLogLevel );

    wLogLevel = new CCombo( gDetails, SWT.READ_ONLY | SWT.BORDER );
    wLogLevel.setToolTipText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.LogLevel.Tooltip" ) );
    props.setLook( wLogLevel );
    FormData fdLogLevel = new FormData();
    fdLogLevel.top = new FormAttachment( wlLogLevel, -2, SWT.TOP );
    fdLogLevel.width = 350;
    fdLogLevel.left = new FormAttachment( wlLogLevel, 6 );
    wLogLevel.setLayoutData( fdLogLevel );
    wLogLevel.setItems( LogLevel.getLogLevelDescriptions() );

    wClearLog = new Button( gDetails, SWT.CHECK );
    wClearLog.setText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.ClearLog.Label" ) );
    wClearLog.setToolTipText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.ClearLog.Tooltip" ) );
    props.setLook( wClearLog );
    FormData fdClearLog = new FormData();
    fdClearLog.top = new FormAttachment( wLogLevel, 10 );
    fdClearLog.left = new FormAttachment( 0, 10 );
    wClearLog.setLayoutData( fdClearLog );

    Label wlStartAction = new Label( gDetails, SWT.RIGHT );
    wlStartAction.setText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.StartCopy.Label" ) );
    wlStartAction.setToolTipText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.StartCopy.Tooltip" ) );
    props.setLook( wlStartAction );
    FormData fdlStartAction = new FormData();
    fdlStartAction.top = new FormAttachment( wClearLog, props.getMargin() );
    fdlStartAction.left = new FormAttachment( 0, 10 );
    wlStartAction.setLayoutData( fdlStartAction );

    wStartAction = new CCombo( gDetails, SWT.READ_ONLY | SWT.BORDER );
    wStartAction.setToolTipText( BaseMessages.getString( PKG, "WorkflowExecutionConfigurationDialog.StartCopy.Tooltip" ) );
    props.setLook( wStartAction );
    FormData fd_startJobCombo = new FormData();
    fd_startJobCombo.top = new FormAttachment( wlStartAction, 0, SWT.CENTER );
    fd_startJobCombo.left = new FormAttachment( wlStartAction, props.getMargin() );
    fd_startJobCombo.right = new FormAttachment( 100, 0 );
    wStartAction.setLayoutData( fd_startJobCombo );

    WorkflowMeta workflowMeta = (WorkflowMeta) super.abstractMeta;

    String[] names = new String[ workflowMeta.getActionCopies().size() ];
    for ( int i = 0; i < names.length; i++ ) {
      ActionCopy copy = workflowMeta.getActionCopies().get( i );
      names[ i ] = getActionCopyName( copy );
    }
    wStartAction.setItems( names );
  }