org.eclipse.jface.layout.PixelConverter Java Examples

The following examples show how to use org.eclipse.jface.layout.PixelConverter. 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: JavaEditorCodeMiningConfigurationBlock.java    From jdt-codemining with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	fPixelConverter = new PixelConverter(parent);
	setShell(parent.getShell());

	Composite mainComp = new Composite(parent, SWT.NONE);
	mainComp.setFont(parent.getFont());
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	mainComp.setLayout(layout);

	createIgnoreOptionalProblemsLink(mainComp);

	Composite spacer = new Composite(mainComp, SWT.NONE);
	spacer.setLayoutData(new GridData(0, 0));

	Composite commonComposite = createStyleTabContent(mainComp);
	GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
	gridData.heightHint = fPixelConverter.convertHeightInCharsToPixels(30);
	commonComposite.setLayoutData(gridData);

	validateSettings(null, null, null);

	return mainComp;
}
 
Example #2
Source File: TodoTaskConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private Composite createMarkersTabContent(Composite folder) {
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 2;

	PixelConverter conv= new PixelConverter(folder);

	Composite markersComposite= new Composite(folder, SWT.NULL);
	markersComposite.setLayout(layout);
	markersComposite.setFont(folder.getFont());

	GridData data= new GridData(GridData.FILL_BOTH);
	data.widthHint= conv.convertWidthInCharsToPixels(50);
	Control listControl= fTodoTasksList.getListControl(markersComposite);
	listControl.setLayoutData(data);

	Control buttonsControl= fTodoTasksList.getButtonBox(markersComposite);
	buttonsControl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));

	fCaseSensitiveCheckBox.doFillIntoGrid(markersComposite, 2);

	return markersComposite;
}
 
Example #3
Source File: AbstractOpenWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();
	if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
		return;
	}
	try {
		INewWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), getSelection());

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK && wizard instanceof NewElementWizard) {
			fCreatedElement= ((NewElementWizard)wizard).getCreatedElement();
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example #4
Source File: HintTextGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Composite createControl(Composite parent) {
    fTopComposite= new Composite(parent, SWT.NONE);
    fTopComposite.setFont(parent.getFont());

    GridData gridData= new GridData(GridData.FILL_BOTH);
    PixelConverter converter= new PixelConverter(parent);
    gridData.heightHint= converter.convertHeightInCharsToPixels(12);
    gridData.widthHint= converter.convertWidthInCharsToPixels(25);
    GridLayout gridLayout= new GridLayout();
    gridLayout.marginWidth= 0;//-converter.convertWidthInCharsToPixels(2);
    gridLayout.marginHeight= 0;//= -4;
    fTopComposite.setLayout(gridLayout);
    fTopComposite.setLayoutData(gridData);
    fTopComposite.setData(null);
    fTopComposite.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            Collection<Image> collection= fImageMap.values();
            Iterator<Image> iterator= collection.iterator();
            while(iterator.hasNext()) {
                Image image= iterator.next();
                image.dispose();
            }
        }
    });
    return fTopComposite;
}
 
Example #5
Source File: InputPageUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates a signature preview viewer in a parent composite with a 1-column GridLayout.
 * 
 * @param parent the parent 
 * @return the preview viewer
 * @since 3.9
 */
public static JavaSourceViewer createSignaturePreview(Composite parent) {
	IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore();
	JavaSourceViewer signaturePreview= new JavaSourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP, store);
	signaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null));
	StyledText textWidget= signaturePreview.getTextWidget();
	textWidget.setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
	textWidget.setAlwaysShowScrollBars(false);
	signaturePreview.adaptBackgroundColor(parent);
	signaturePreview.setDocument(new Document());
	signaturePreview.setEditable(false);

	GridData gdata= new GridData(GridData.FILL_BOTH);
	gdata.widthHint= new PixelConverter(textWidget).convertWidthInCharsToPixels(50);
	gdata.heightHint= textWidget.getLineHeight() * 2;
	textWidget.setLayoutData(gdata);
	
	return signaturePreview;
}
 
Example #6
Source File: SWTFactory.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * @param parent
 * @param min
 * @param max
 * @param hspan
 * @param style
 * @return
 */
public static Spinner createSpinner(Composite parent, int min, int max, int hspan, int style)
{
	Spinner spinner = new Spinner(parent, SWT.BORDER | style);
	spinner.setMinimum(min);
	spinner.setMaximum(max);

	GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false, hspan, 1);
	PixelConverter pc = new PixelConverter(spinner);
	// See http://jira.appcelerator.org/browse/APSTUD-3215
	// We need to add some extra spacing to the MacOSX spinner in order to adjust the size to the way Mac draws
	// spinners.
	int extraWidth = Platform.OS_MACOSX.equals(Platform.getOS()) ? 25 : 0;
	gd.widthHint = pc.convertWidthInCharsToPixels(2) + extraWidth;
	spinner.setLayoutData(gd);
	return spinner;
}
 
Example #7
Source File: JavaBuildConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	fPixelConverter= new PixelConverter(parent);
	setShell(parent.getShell());

	Composite mainComp= new Composite(parent, SWT.NONE);
	mainComp.setFont(parent.getFont());
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	mainComp.setLayout(layout);

	Composite othersComposite= createBuildPathTabContent(mainComp);
	GridData gridData= new GridData(GridData.FILL, GridData.FILL, true, true);
	gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(20);
	othersComposite.setLayoutData(gridData);

	validateSettings(null, null, null);

	return mainComp;
}
 
Example #8
Source File: AbstractGeneratorConfigurationBlock.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
protected Control doCreateContents(Composite parent) {
	final PixelConverter pixelConverter = new PixelConverter(parent);
	setShell(parent.getShell());
	final Composite mainComp = new Composite(parent, SWT.NONE);
	mainComp.setFont(parent.getFont());
	final GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	mainComp.setLayout(layout);
	final Composite othersComposite = createGeneratorContent(mainComp);
	final GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
	gridData.heightHint = pixelConverter.convertHeightInCharsToPixels(HEIGHT);
	othersComposite.setLayoutData(gridData);
	validateSettings(null, null, null);
	return mainComp;
}
 
Example #9
Source File: CodeAssistFavoritesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createFavoriteList(Composite parent) {
	String[] buttonLabels= new String[] {
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_newType_button,
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_newMember_button,
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_edit_button,
			PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_remove_button
	};

	ListAdapter adapter= new ListAdapter();

	fList= new ListDialogField<String>(adapter, buttonLabels, new ListLabelProvider());
	fList.setDialogFieldListener(adapter);
	fList.setLabelText(PreferencesMessages.CodeAssistStaticMembersConfigurationBlock_description);
	fList.setRemoveButtonIndex(IDX_REMOVE);
	fList.enableButton(IDX_EDIT, false);
	fList.setViewerComparator(new ViewerComparator());

	PixelConverter pixelConverter= new PixelConverter(parent);

	fList.doFillIntoGrid(parent, 3);
	LayoutUtil.setHorizontalSpan(fList.getLabelControl(null), 2);
	LayoutUtil.setWidthHint(fList.getLabelControl(null), pixelConverter.convertWidthInCharsToPixels(60));
	LayoutUtil.setHorizontalGrabbing(fList.getListControl(null));
}
 
Example #10
Source File: ProblemSeveritiesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	fPixelConverter= new PixelConverter(parent);
	setShell(parent.getShell());

	Composite mainComp= new Composite(parent, SWT.NONE);
	mainComp.setFont(parent.getFont());
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	mainComp.setLayout(layout);

	createIgnoreOptionalProblemsLink(mainComp);
	
	Composite spacer= new Composite(mainComp, SWT.NONE);
	spacer.setLayoutData(new GridData(0, 0));
	
	Composite commonComposite= createStyleTabContent(mainComp);
	GridData gridData= new GridData(SWT.FILL, SWT.FILL, true, true);
	gridData.heightHint= fPixelConverter.convertHeightInCharsToPixels(30);
	commonComposite.setLayoutData(gridData);

	validateSettings(null, null, null);

	return mainComp;
}
 
Example #11
Source File: ClassPathBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Control createContents( Composite parent )
{
	setShell( parent.getShell( ) );
	PixelConverter converter = new PixelConverter( parent );

	Composite composite = new Composite( parent, SWT.NONE );

	LayoutUtil.doDefaultLayout( composite, new DialogField[]{
		fLibrariesList
	}, true, SWT.DEFAULT, SWT.DEFAULT );
	LayoutUtil.setHorizontalGrabbing( fLibrariesList.getTreeControl( null ) );

	int buttonBarWidth = converter.convertWidthInCharsToPixels( 24 );
	fLibrariesList.setButtonsMinWidth( buttonBarWidth );

	return composite;
}
 
Example #12
Source File: IDEClassPathBlock.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Control createContents( Composite parent )
{
	setShell( parent.getShell( ) );
	PixelConverter converter = new PixelConverter( parent );

	Composite composite = new Composite( parent, SWT.NONE );
	if ( getProject( ) == null )
	{
		fLibrariesList.removeButton( IDX_ADDPROJECT );
	}
	LayoutUtil.doDefaultLayout( composite, new DialogField[]{
		fLibrariesList
	}, true, SWT.DEFAULT, SWT.DEFAULT );
	LayoutUtil.setHorizontalGrabbing( fLibrariesList.getTreeControl( null ) );

	int buttonBarWidth = converter.convertWidthInCharsToPixels( 24 );
	fLibrariesList.setButtonsMinWidth( buttonBarWidth );

	//fSWTControl = composite;

	return composite;
}
 
Example #13
Source File: CodeTemplateBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	fPixelConverter=  new PixelConverter(parent);

	setShell(parent.getShell());

	Composite composite=  new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());

	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 2;
	composite.setLayout(layout);

	fCodeTemplateTree.doFillIntoGrid(composite, 3);
	LayoutUtil.setHorizontalSpan(fCodeTemplateTree.getLabelControl(null), 2);
	LayoutUtil.setHorizontalGrabbing(fCodeTemplateTree.getTreeControl(null));

	fPatternViewer= createViewer(composite, 2);

	fGenerateComments.doFillIntoGrid(composite, 2);

	return composite;
}
 
Example #14
Source File: CodeAssistAdvancedConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createKeysLink(Composite composite, int h_span) {
   Link link= new Link(composite, SWT.NONE | SWT.WRAP);
link.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_key_binding_hint);
link.addSelectionListener(new SelectionAdapter() {
	@Override
	public void widgetSelected(SelectionEvent e) {
		PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null);
	}
});

PixelConverter pixelConverter= new PixelConverter(composite);
int width= pixelConverter.convertWidthInCharsToPixels(40);

// limit the size of the Link as it would take all it can get
GridData gd= new GridData(GridData.FILL, GridData.FILL, false, false, h_span, 1);
gd.widthHint= width;
link.setLayoutData(gd);
  }
 
Example #15
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control doCreateContents(Composite parent) {
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.numColumns = 2;

	PixelConverter conv = new PixelConverter(parent);

	Composite markersComposite = new Composite(parent, SWT.NULL);
	markersComposite.setLayout(layout);
	markersComposite.setFont(parent.getFont());

	GridData data = new GridData(GridData.FILL_BOTH);
	data.widthHint = conv.convertWidthInCharsToPixels(50);
	Control listControl = taskTags.getListControl(markersComposite);
	listControl.setLayoutData(data);

	Control buttonsControl = taskTags.getButtonBox(markersComposite);
	buttonsControl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));

	caseSensitiveCheckBox.doFillIntoGrid(markersComposite, 2);

	return markersComposite;
}
 
Example #16
Source File: EditFilterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();

	try {
		EditFilterWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(getSelectedElements().get(0)));

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK) {
			BuildpathDelta delta= new BuildpathDelta(getToolTipText());

			ArrayList<CPListElement> newEntries= wizard.getExistingEntries();
			delta.setNewEntries(newEntries.toArray(new CPListElement[newEntries.size()]));

			IResource resource= wizard.getCreatedElement().getCorrespondingResource();
			delta.addCreatedResource(resource);

			delta.setDefaultOutputLocation(wizard.getOutputLocation());

			informListeners(delta);

			selectAndReveal(new StructuredSelection(wizard.getCreatedElement()));
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example #17
Source File: SWTUtil.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a width hint for a button control.
 * @param button the button
 * @return the width hint
 */
public static int getButtonWidthHint(Button button) {
	button.setFont(JFaceResources.getDialogFont());
	PixelConverter converter= new PixelConverter(button);
	int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
 
Example #18
Source File: PropertiesPage.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private Button createButton(Composite parent, String label) {
	Button button = formToolkit.createButton( parent, label, SWT.NULL);
	button.setFont(JFaceResources.getDialogFont());
	
	PixelConverter converter = new PixelConverter(button);
	int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
	GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).hint(widthHint, SWT.DEFAULT).applyTo(button);

	return button;
}
 
Example #19
Source File: SWTUtil.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a width hint for a button control.
 * @param button the button
 * @return the width hint
 */
public static int getButtonWidthHint(Button button) {
    button.setFont(JFaceResources.getDialogFont());
    PixelConverter converter = new PixelConverter(button);
    int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
 
Example #20
Source File: PyEditorHoverConfigurationBlock.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void addFiller(Composite composite) {
    PixelConverter pixelConverter = new PixelConverter(composite);
    Label filler = new Label(composite, SWT.LEFT);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.heightHint = pixelConverter.convertHeightInCharsToPixels(1) / 2;
    filler.setLayoutData(gd);
}
 
Example #21
Source File: SWTFactory.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a width hint for a button control.
 */
public static int getButtonWidthHint(Button button) {
	/*button.setFont(JFaceResources.getDialogFont());*/
	PixelConverter converter= new PixelConverter(button);
	int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
}
 
Example #22
Source File: TextFieldExt.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void createContents_layout() {
	SWTLayoutUtil.layoutControls(array(label, text), null, text);
	
	GridData textGD = (GridData) text.getLayoutData();
	PixelConverter pixelConverter = new PixelConverter(text.getParent());
	textGD.widthHint = pixelConverter.convertWidthInCharsToPixels(textLimit + 1);
}
 
Example #23
Source File: EssentialsPage.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private Label createFormFieldLabel(final Composite composite, final String labelText) {
	Label label = formToolkit.createLabel(composite, labelText, SWT.NONE);
	PixelConverter converter = new PixelConverter(label);
	int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	widthHint = Math.max(widthHint, label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
	GridDataFactory.swtDefaults().hint(widthHint, SWT.DEFAULT).applyTo(label);
	return label;
}
 
Example #24
Source File: JavaEditorHoverConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addFiller(Composite composite) {
	PixelConverter pixelConverter= new PixelConverter(composite);
	Label filler= new Label(composite, SWT.LEFT );
	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan= 2;
	gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 2;
	filler.setLayoutData(gd);
}
 
Example #25
Source File: ClasspathContainerWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static int openWizard(Shell shell, ClasspathContainerWizard wizard) {
	WizardDialog dialog= new WizardDialog(shell, wizard);
	PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
	dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
	dialog.create();
	return dialog.open();
}
 
Example #26
Source File: NativeLibrariesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Control createContents(Composite parent) {
	fShell= parent.getShell();

	Composite inner= new Composite(parent, SWT.NONE);
	inner.setFont(parent.getFont());
	inner.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	int nColumns= 3;

	GridLayout layout= new GridLayout(nColumns, false);
	layout.marginWidth= 0;
	layout.marginWidth= 0;
	inner.setLayout(layout);

	PixelConverter converter= new PixelConverter(parent);

	Label desc= new Label(inner, SWT.WRAP);
	desc.setFont(inner.getFont());
	desc.setText(Messages.format(NewWizardMessages.NativeLibrariesDialog_description, new String[] { BasicElementLabels.getResourceName(fEntry.getPath().lastSegment()) }));
	GridData gridData= new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1);
	gridData.widthHint= converter.convertWidthInCharsToPixels(80);
	desc.setLayoutData(gridData);

	fPathField.doFillIntoGrid(inner, 2);
	LayoutUtil.setHorizontalGrabbing(fPathField.getTextControl(null));
	LayoutUtil.setWidthHint(fPathField.getTextControl(null), converter.convertWidthInCharsToPixels(50));

	fBrowseExternal.doFillIntoGrid(inner, 1);

	DialogField.createEmptySpace(inner, 2);
	fBrowseWorkspace.doFillIntoGrid(inner, 1);

	fPathField.setFocus();

	return parent;
}
 
Example #27
Source File: ButtonFactory.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
public static Button newPushButton(Composite parent, String label) {
  Button button = new Button(parent, SWT.PUSH);
  button.setText(label);

  PixelConverter converter = new PixelConverter(button);
  int width = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);

  GridData buttonGridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
  buttonGridData.widthHint =
      Math.max(width, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);

  button.setLayoutData(buttonGridData);
  return button;
}
 
Example #28
Source File: ComplianceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	fPixelConverter= new PixelConverter(parent);
	setShell(parent.getShell());

	Composite complianceComposite= createComplianceTabContent(parent);

	validateSettings(null, null, null);

	return complianceComposite;
}
 
Example #29
Source File: MarkOccurrencesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addFiller(Composite composite) {
	PixelConverter pixelConverter= new PixelConverter(composite);

	Label filler= new Label(composite, SWT.LEFT );
	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan= 2;
	gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 2;
	filler.setLayoutData(gd);
}
 
Example #30
Source File: JavaEditorColoringConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addFiller(Composite composite, int horizontalSpan) {
	PixelConverter pixelConverter= new PixelConverter(composite);
	Label filler= new Label(composite, SWT.LEFT );
	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan= horizontalSpan;
	gd.heightHint= pixelConverter.convertHeightInCharsToPixels(1) / 2;
	filler.setLayoutData(gd);
}