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

The following examples show how to use org.eclipse.swt.SWT#READ_ONLY . These examples are extracted from open source projects. 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
/**
 * Create the composite.
 * 
 * @param parent
 * @param style
 */
public ApiDocumentationResultView() {
	super(SWT.BORDER);
	setBackgroundMode(SWT.INHERIT_FORCE);
	setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
	GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.verticalSpacing = 0;
	setLayout(gridLayout);

	lblLabel = new CLabel(this, SWT.NONE);
	lblLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
	lblLabel.setFont(SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
	lblLabel.setText("<Title of the API documentation>");
	new Label(this, SWT.NONE);

	textUrl = new Text(this, SWT.READ_ONLY | SWT.WRAP);
	textUrl.setEditable(false);
	textUrl.setForeground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
	textUrl.setText("<url>");
	textUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

}
 
Example 2
Source Project: http4e   File: ItemView.java    License: Apache License 2.0 6 votes vote down vote up
private void initHttpCombo( Composite top){
   httpCombo = new Combo(top, SWT.READ_ONLY);
   httpCombo.setItems(CoreConstants.HTTP11_METHODS);
   httpCombo.setText(model.getHttpMethod());
   httpCombo.addSelectionListener(new SelectionAdapter() {

      private String prevMethod = model.getHttpMethod();


      public void widgetSelected( SelectionEvent e){
         // becomes GET, HEAD, PUT, etc
         if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
            state.setState(ItemState.POST_DISABLED);
            // becomes POST
         } else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
            state.setState(ItemState.POST_ENABLED);
            // no update
         } else {
            state.setState(ItemState.POST_NO_UPDATE);
         }
         prevMethod = httpCombo.getText();
         model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model));
      }
   });
}
 
Example 3
private void createContent(Composite parent) {
	Display display= parent.getDisplay();
	Color foreground= display.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
	Color background= display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
	addMoveSupport(fPopup, parent);

	StyledText hint= new StyledText(fPopup, SWT.READ_ONLY | SWT.SINGLE);
	String enterKeyName= getEnterBinding();
	String hintTemplate= ReorgMessages.RenameInformationPopup_EnterNewName;
	hint.setText(Messages.format(hintTemplate, enterKeyName));
	hint.setForeground(foreground);
	hint.setStyleRange(new StyleRange(hintTemplate.indexOf("{0}"), enterKeyName.length(), null, null, SWT.BOLD)); //$NON-NLS-1$
	hint.setEnabled(false); // text must not be selectable
	addMoveSupport(fPopup, hint);

	addViewMenu(parent);

	recursiveSetBackgroundColor(parent, background);

}
 
Example 4
private void createPriorityGroup(Composite parent) {
    Composite prioGroup = new Composite(parent, SWT.NONE);
    prioGroup.setLayout(new GridLayout(2, false));

    Label minPrioLabel = new Label(prioGroup, SWT.NONE);
    minPrioLabel.setText(getMessage("property.minPriority"));
    minPrioLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    minPriorityCombo = new Combo(prioGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
    minPriorityCombo.add(ProjectFilterSettings.HIGH_PRIORITY);
    minPriorityCombo.add(ProjectFilterSettings.MEDIUM_PRIORITY);
    minPriorityCombo.add(ProjectFilterSettings.LOW_PRIORITY);
    minPriorityCombo.setText(propertyPage.getOriginalUserPreferences().getFilterSettings().getMinPriority());
    minPriorityCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    minPriorityCombo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            String data = minPriorityCombo.getText();
            getCurrentProps().getFilterSettings().setMinPriority(data);
        }
    });


}
 
Example 5
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));

	Composite composite = new Composite(container, SWT.NONE);
	GridLayout gl_composite = new GridLayout(2, false);
	gl_composite.marginWidth = 0;
	gl_composite.marginHeight = 0;
	composite.setLayout(gl_composite);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));

	Label warningIcon = new Label(composite, SWT.NONE);
	warningIcon.setImage(Display.getDefault().getSystemImage(SWT.ICON_WARNING));

	Label msgLabel = new Label(composite, SWT.WRAP);
	GridData gd_lblNewLabel = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
	gd_lblNewLabel.heightHint = 75;
	gd_lblNewLabel.widthHint = 460;
	msgLabel.setLayoutData(gd_lblNewLabel);
	msgLabel.setText(Messages.getString("license.InvalidateDialog.msg1"));

	text = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP);
	text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
	text.setText(getValidateMessage());

	return container;
}
 
Example 6
@Override
protected CellEditor getCellEditor(Object element) {
    ComboBoxViewerCellEditor cellEditor = new ComboBoxViewerCellEditor((Composite) getViewer().getControl(),
            SWT.READ_ONLY);
    cellEditor.getControl().setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, QUERY_PARAM_TYPE_COMBO_EDITOR_ID);
    cellEditor.setContentProvider(ArrayContentProvider.getInstance());
    cellEditor.setActivationStyle(ComboBoxViewerCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION);
    cellEditor.getControl().addListener(SWT.Selection, e -> getViewer().getControl().getParent().setFocus());
    cellEditor.setLabelProvider(new LabelProviderBuilder<QueryParameterTypes>()
            .withTextProvider(QueryParameterTypes::getName)
            .createLabelProvider());
    cellEditor.setInput(QueryParameterTypes.values());
    return cellEditor;
}
 
Example 7
protected Control createDialogArea( Composite parent )
{
	Composite composite = (Composite) super.createDialogArea( parent );
	new Label( composite, SWT.NONE ).setText( Messages.getString( "dataset.editor.label.selectDataSource" ) ); //$NON-NLS-1$
	combo = new Combo( composite, SWT.BORDER | SWT.READ_ONLY );
	combo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	combo.setVisibleItemCount( 30 );
	combo.setItems( dataSourceNames );

	UIUtil.bindHelp( parent,
			IHelpContextIds.ADD_DATA_SOURCE_SELECTION_DIALOG_ID );
	return composite;
}
 
Example 8
/**
 * Create a new ComboPreference.
 * @param composite The composite on which the SWT widgets are added.
 * @param numColumns The number of columns in the composite's GridLayout.
 * @param preferences The map to store the values.
 * @param key The key to store the values.
 * @param values An array of n elements indicating the values to store for each selection.
 * @param text The label text for this Preference.
 * @param items An array of n elements indicating the text to be written in the combo box.
 */
public ComboPreference(Composite composite, int numColumns,
						  Map<String, String> preferences, String key,
						  String [] values, String text, String [] items) {
    super(preferences, key);
    if (values == null || items == null || text == null)
        throw new IllegalArgumentException(FormatterMessages.ModifyDialogTabPage_error_msg_values_items_text_unassigned);
	fValues= values;
	fItems= items;
	createLabel(numColumns - 1, composite, text);
	fCombo= new Combo(composite, SWT.SINGLE | SWT.READ_ONLY);
	fCombo.setFont(composite.getFont());
	SWTUtil.setDefaultVisibleItemCount(fCombo);
	fCombo.setItems(items);

	int max= 0;
	for (int i= 0; i < items.length; i++)
	    if (items[i].length() > max) max= items[i].length();

	fCombo.setLayoutData(createGridData(1, GridData.HORIZONTAL_ALIGN_FILL, fCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x));

	updateWidget();

	fCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			comboSelected(((Combo)e.widget).getSelectionIndex());
		}
	});
}
 
Example 9
/**
 * 创建分段规则选择组
 * @param contents
 *            ;
 */
private void createSegmentationGroup(Composite contents) {
	Group segmentation = new Group(contents, SWT.NONE);
	segmentation.setText(Messages.getString("ConversionWizardPage.10")); //$NON-NLS-1$
	segmentation.setLayout(new GridLayout(3, false));
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.widthHint = 500;
	segmentation.setLayoutData(data);

	Label segLabel = new Label(segmentation, SWT.NONE);
	segLabel.setText(Messages.getString("ConversionWizardPage.11")); //$NON-NLS-1$

	srxFile = new Text(segmentation, SWT.BORDER | SWT.READ_ONLY);
	srxFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	srxFile.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
				conversionConfigBean.setInitSegmenter(srxFile.getText());
			}

			validate();
		}
	});

	final Button segBrowse = new Button(segmentation, SWT.PUSH);
	segBrowse.setText(Messages.getString("ConversionWizardPage.12")); //$NON-NLS-1$
	segBrowse.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent arg0) {
			IConversionItemDialog conversionItemDialog = FileDialogFactoryFacade.createFileDialog(getShell(),
					SWT.NONE);
			int result = conversionItemDialog.open();
			if (result == IDialogConstants.OK_ID) {
				IConversionItem conversionItem = conversionItemDialog.getConversionItem();
				srxFile.setText(conversionItem.getLocation().toOSString());
			}
		}
	});
}
 
Example 10
public HorizontalAlignmentPicker(Composite parent, HorizontalAlignmentEnum alignment) {
    super(parent, SWT.NONE);
    setLayout(new RowLayout());

    combo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN);
    combo.setItems(new String[] { "Center", "Left", "Right" });

    update(alignment);
}
 
Example 11
private void createGeneratorCombo(Composite container) {
	Label lblGenerator = new Label(container, SWT.NONE);
	lblGenerator.setText("Generator");
	generatorCombo = new ComboViewer(container, SWT.READ_ONLY);
	generatorCombo.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	generatorCombo.setLabelProvider(new GeneratorDescriptorLabelProvider());
	generatorCombo.setContentProvider(new ArrayContentProvider());
	List<IGeneratorDescriptor> descriptors = Lists.newArrayList(GeneratorExtensions.getGeneratorDescriptors());
	Collections.sort(descriptors, CoreGenerator.generatorOrder);
	generatorCombo.setInput(descriptors);
	generatorCombo.getCombo().select(0);
	generatorCombo.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			Object element = ((IStructuredSelection) event.getSelection()).getFirstElement();
			if (element instanceof InstallMoreGeneratorsItem) {
				try {
					getContainer().run(true, true, (monitor) -> {
						((InstallMoreGeneratorsItem) element).openInstallWizard(monitor);
					});
				} catch (InvocationTargetException | InterruptedException e) {
					e.printStackTrace();
				}
				generatorCombo.getCombo().select(0);
			} else {
				refreshInput();
			}
		}

	});
	generatorCombo.add(new InstallMoreGeneratorsItem());
}
 
Example 12
Source Project: elexis-3-core   File: RnDialogs.java    License: Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	ret.setLayout(new GridLayout());
	ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	cbStates = new Combo(ret, SWT.READ_ONLY);
	cbStates.setItems(RnStatus.getStatusTexts());
	cbStates.setVisibleItemCount(RnStatus.getStatusTexts().length);
	cbStates.select(rn.getStatus());
	cbStates.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	new Label(ret, SWT.WRAP).setText(Messages.RnDialogs_warningDontChangeManually); //$NON-NLS-1$
	return ret;
}
 
Example 13
Source Project: nebula   File: Header.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Create the description
 */
private void createDescription() {
	final StyledText labelDescription = new StyledText(this, SWT.WRAP | SWT.READ_ONLY);
	labelDescription.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
	labelDescription.setEnabled(false);
	labelDescription.setFont(getFont());
	labelDescription.setForeground(getForeground());
	labelDescription.setText(description);
	SWTGraphicUtil.applyHTMLFormating(labelDescription);
}
 
Example 14
Source Project: thym   File: IOSSimOptionsTab.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @wbp.parser.entryPoint
 */
@Override
public void createControl(Composite parent) {
	Composite comp = new Composite(parent, SWT.NONE);
	setControl(comp);
	comp.setLayout(new GridLayout(1, false));
	
	Group grpProject = new Group(comp, SWT.NONE);
	grpProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	grpProject.setText("Project");
	grpProject.setLayout(new GridLayout(3, false));
	
	Label lblProject = new Label(grpProject, SWT.NONE);
	lblProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblProject.setText("Project:");
	
	textProject = new Text(grpProject, SWT.BORDER);
	textProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textProject.addListener(SWT.Modify, dirtyFlagListener);
	
	
	Button btnProjectBrowse = new Button(grpProject, SWT.NONE);
	btnProjectBrowse.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ElementListSelectionDialog es = new ElementListSelectionDialog(getShell(), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
			es.setElements(HybridCore.getHybridProjects().toArray());
			es.setTitle("Project Selection");
			es.setMessage("Select a project to run");
			if (es.open() == Window.OK) {			
				HybridProject project = (HybridProject) es.getFirstResult();
				textProject.setText(project.getProject().getName());
			}		
		}
	});
	btnProjectBrowse.setText("Browse...");
	
	Group grpSimulator = new Group(comp, SWT.NONE);
	grpSimulator.setLayout(new GridLayout(2, false));
	grpSimulator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	grpSimulator.setText("Simulator");
	
	Label lblSdkVersion = new Label(grpSimulator, SWT.NONE);
	lblSdkVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblSdkVersion.setText("Device:");
	
	comboSDKVer = new Combo(grpSimulator, SWT.READ_ONLY);
	
	comboSDKVer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	comboSDKVer.addListener(SWT.Selection, dirtyFlagListener);

	comboViewer = new ComboViewer(comboSDKVer);
	comboViewer.setContentProvider(new SDKContentProvider());
	comboViewer.setLabelProvider( new LabelProvider() {
		@Override
		public String getText(Object element) {
			IOSDevice device = (IOSDevice) element;
			return NLS.bind("{0} ({1})", new String[]{device.getDeviceName(), device.getiOSName()});
		}
	});
	comboViewer.setInput(getSimulatorDevices());
}
 
Example 15
protected Control createDialogArea(Composite parent) {
	setTitleImage(CodewindUIPlugin.getImage(CodewindUIPlugin.CODEWIND_BANNER));
	setTitle(Messages.LogLevelDialogTitle);
	setMessage(Messages.LogLevelDialogMessage);
	
	final Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.marginHeight = 11;
	layout.marginWidth = 9;
	layout.horizontalSpacing = 5;
	layout.verticalSpacing = 7;
	layout.numColumns = 2;
	composite.setLayout(layout);
	GridData data = new GridData(GridData.FILL_BOTH);
	data.widthHint = 200;
	composite.setLayoutData(data);
	composite.setFont(parent.getFont());
	
	Label label = new Label(composite, SWT.NONE);
	label.setText(Messages.LogLevelDialogLogLabel);
	
	initLevels();
	
	Combo logLevelCombo = new Combo(composite, SWT.READ_ONLY);
	logLevelCombo.setItems(levelLabels.toArray(new String[levelLabels.size()]));
	logLevelCombo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	
	logLevelCombo.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent event) {
			int index = logLevelCombo.getSelectionIndex();
			if (index >= 0)
				selectedLevel = levelList.get(index);
		}
	});

	// Add Context Sensitive Help
	PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CodewindUIPlugin.MAIN_CONTEXTID);
	
	if (currentLevel >= 0) {
		logLevelCombo.select(currentLevel);
	}
	
	logLevelCombo.setFocus();
	
	return composite;
}
 
Example 16
/**
 * Create the composite.
 * @param parent
 * @param style
 */
public AxisPageBubble(Composite parent, int style) {
	super(parent, style);
	setLayout(new FillLayout(SWT.VERTICAL));
	
	
	Group xAxisGroup = new Group(this, SWT.NONE);
	xAxisGroup.setText("X -Axis");
	xAxisGroup.setLayout(new GridLayout(2, false));
	
	Label lblTitle = new Label(xAxisGroup, SWT.NONE);
	GridData gd_lblTitle = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
	gd_lblTitle.widthHint = 150;
	lblTitle.setLayoutData(gd_lblTitle);
	lblTitle.setText("Title");
	
	xTitle = new Text(xAxisGroup, SWT.BORDER);
	xTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	Label lblTitleSize = new Label(xAxisGroup, SWT.NONE);
	lblTitleSize.setText("Title Size");
	
	comboTitleSizeX = new Combo(xAxisGroup, SWT.READ_ONLY);
	comboTitleSizeX.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboTitleSizeX.add("12");
	comboTitleSizeX.add("14");
	comboTitleSizeX.add("16");
	comboTitleSizeX.add("18");
	comboTitleSizeX.add("20");
	comboTitleSizeX.add("22");
	comboTitleSizeX.add("24");
	comboTitleSizeX.add("26");
	comboTitleSizeX.add("28");
	comboTitleSizeX.add("36");
	comboTitleSizeX.add("48");
	comboTitleSizeX.add("72");
	comboTitleSizeX.select(0);
	
	Label lblRotation = new Label(xAxisGroup, SWT.NONE);
	lblRotation.setText("Rotation");
	
	Composite composite = new Composite(xAxisGroup, SWT.NONE);
	composite.setLayout(new GridLayout(6, false));
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
	
	btnAutoX = new Button(composite, SWT.RADIO);
	btnAutoX.setText("Auto");
	
	button0 = new Button(composite, SWT.RADIO);
	button0.setText("0\u00B0");
	
	button30 = new Button(composite, SWT.RADIO);
	button30.setText("30\u00B0");
	
	button45 = new Button(composite, SWT.RADIO);
	button45.setText("45\u00B0");
	
	button60 = new Button(composite, SWT.RADIO);
	button60.setText("60\u00B0");
	
	button90 = new Button(composite, SWT.RADIO);
	button90.setText("90\u00B0");
	
	Group yAxisGroup = new Group(this, SWT.NONE);
	yAxisGroup.setText("Y - Axis");
	yAxisGroup.setLayout(new GridLayout(2, false));
	
	Label lblTitle_1 = new Label(yAxisGroup, SWT.NONE);
	GridData gd_lblTitle_1 = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
	gd_lblTitle_1.widthHint = 150;
	lblTitle_1.setLayoutData(gd_lblTitle_1);
	lblTitle_1.setText("Title");
	
	yTitle = new Text(yAxisGroup, SWT.BORDER);
	yTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	
	Label lblTitleSize_1 = new Label(yAxisGroup, SWT.NONE);
	lblTitleSize_1.setText("Title Size");
	
	comboTitleSizeY = new Combo(yAxisGroup, SWT.READ_ONLY);
	comboTitleSizeY.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
	comboTitleSizeY.add("12");
	comboTitleSizeY.add("14");
	comboTitleSizeY.add("16");
	comboTitleSizeY.add("18");
	comboTitleSizeY.add("20");
	comboTitleSizeY.add("22");
	comboTitleSizeY.add("24");
	comboTitleSizeY.add("26");
	comboTitleSizeY.add("28");
	comboTitleSizeY.add("36");
	comboTitleSizeY.add("48");
	comboTitleSizeY.add("72");
	comboTitleSizeY.select(0);
	
	loadSettings();
}
 
Example 17
Source Project: thym   File: WinOptionsTab.java    License: Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Composite comp = new Composite(parent, SWT.NONE);
	setControl(comp);
	comp.setLayout(new GridLayout(1, false));

	Group projectGroup = new Group(comp, SWT.NONE);
	projectGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
			false, 1, 1));
	projectGroup.setText(Messages.WinOptionsTab_ProjectGroup);
	projectGroup.setLayout(new GridLayout(3, false));

	Label projectLabel = new Label(projectGroup, SWT.NONE);
	projectLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
			false, 1, 1));
	projectLabel.setText(Messages.WinOptionsTab_ProjectLabel);

	projectText = new Text(projectGroup, SWT.BORDER);
	projectText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
			false, 1, 1));
	projectText.addListener(SWT.Modify, dirtyListener);

	Button browseButton = new Button(projectGroup, SWT.NONE);
	browseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ElementListSelectionDialog dialog = new ElementListSelectionDialog(
					getShell(), WorkbenchLabelProvider
							.getDecoratingWorkbenchLabelProvider());
			dialog.setTitle(Messages.WinOptionsTab_ProjectSelection);
			dialog.setMessage(Messages.WinOptionsTab_SelectonDesc);
			dialog.setElements(HybridCore.getHybridProjects().toArray());
			if (dialog.open() == Window.OK) {
				HybridProject project = (HybridProject) dialog
						.getFirstResult();
				projectText.setText(project.getProject().getName());
			}
		}
	});
	browseButton.setText(Messages.WinOptionsTab_BrowseLabel);

	Group emulatorGroup = new Group(comp, SWT.NONE);
	emulatorGroup.setLayout(new GridLayout(2, false));
	emulatorGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
			false, 1, 1));
	emulatorGroup.setText(Messages.WinOptionsTab_EmulatorGroup);

	Label deviceLabel = new Label(emulatorGroup, SWT.NONE);
	deviceLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false,
			false, 1, 1));
	deviceLabel.setText(Messages.WinOptionsTab_DeviceName);

	devicesCombo = new Combo(emulatorGroup, SWT.READ_ONLY);
	devicesCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
			false, 1, 1));
	devicesCombo.addListener(SWT.Selection, dirtyListener);

	if (devices != null && !devices.isEmpty()) {
		devicesCombo.add(DEFAULT_EMULATOR);
	}
}
 
Example 18
@Override
protected CellEditor getCellEditor(final Object element) {
    ComboBoxCellEditor editor = new ComboBoxCellEditor((Composite) getViewer().getControl(), mandatoryChoices,
            SWT.READ_ONLY);
    return editor;
}
 
Example 19
@Override
protected Control createContents(Composite parent) {
	initializeDialogUnits(parent);

	Composite result= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginHeight= convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	layout.marginWidth= 0;
	layout.verticalSpacing= convertVerticalDLUsToPixels(10);
	layout.horizontalSpacing= convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	layout.numColumns= 2;
	result.setLayout(layout);

	GridData gd= new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan= 2;

	Group sourceFolderGroup= new Group(result, SWT.NONE);
	layout= new GridLayout();
	layout.numColumns= 2;
	sourceFolderGroup.setLayout(layout);
	sourceFolderGroup.setLayoutData(gd);
	sourceFolderGroup.setText(PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_label);

	int indent= 0;

	fProjectAsSourceFolder= addRadioButton(sourceFolderGroup, PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.FALSE, indent);
	fProjectAsSourceFolder.addSelectionListener(fSelectionListener);

	fFoldersAsSourceFolder= addRadioButton(sourceFolderGroup, PreferencesMessages.NewJavaProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ, IPreferenceStore.TRUE, indent);
	fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);

	indent= convertWidthInCharsToPixels(4);

	fSrcFolderNameLabel= new Label(sourceFolderGroup, SWT.NONE);
	fSrcFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_src);
	fSrcFolderNameText= addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent);
	fSrcFolderNameText.addModifyListener(fModifyListener);

	fBinFolderNameLabel= new Label(sourceFolderGroup, SWT.NONE);
	fBinFolderNameLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_folders_bin);
	fBinFolderNameText= addTextControl(sourceFolderGroup, fBinFolderNameLabel, SRCBIN_BINNAME, indent);
	fBinFolderNameText.addModifyListener(fModifyListener);

	String[] jreNames= getJRENames();
	if (jreNames.length > 0) {
		Label jreSelectionLabel= new Label(result, SWT.NONE);
		jreSelectionLabel.setText(PreferencesMessages.NewJavaProjectPreferencePage_jrelibrary_label);
		jreSelectionLabel.setLayoutData(new GridData());

		int index= getPreferenceStore().getInt(CLASSPATH_JRELIBRARY_INDEX);
		fJRECombo= new Combo(result, SWT.READ_ONLY);
		fJRECombo.setItems(jreNames);
		fJRECombo.select(index);
		fJRECombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	}

	validateFolders();

	Dialog.applyDialogFont(result);
	return result;
}
 
Example 20
Source Project: birt   File: SWTHighlightViewer.java    License: Eclipse Public License 1.0 4 votes vote down vote up
/**
 * main() method for constructing the layout.
 * 
 * @param args
 */
public static void main( String[] args )
{
	Display display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 600, 400 );
	shell.setLayout( new GridLayout( ) );

	SWTHighlightViewer siv = new SWTHighlightViewer(
			shell,
			SWT.NO_BACKGROUND );
	siv.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	siv.addPaintListener( siv );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cBottom.setLayout( new RowLayout( ) );

	Label la = new Label( cBottom, SWT.NONE );

	la.setText( "Choose: " );//$NON-NLS-1$
	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "Area Chart" ); //$NON-NLS-1$
	cbType.add( "Bar Chart" ); //$NON-NLS-1$
	cbType.add( "Line Chart" );//$NON-NLS-1$
	cbType.add( "Meter Chart" );//$NON-NLS-1$
	cbType.add( "Pie Chart" );//$NON-NLS-1$
	cbType.add( "Scatter Chart" );//$NON-NLS-1$
	cbType.add( "Stock Chart" );//$NON-NLS-1$
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "Update" );//$NON-NLS-1$
	btn.addSelectionListener( siv );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}