当前位置: 首页>>代码示例>>Java>>正文


Java Dialog.convertHorizontalDLUsToPixels方法代码示例

本文整理汇总了Java中org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.convertHorizontalDLUsToPixels方法的具体用法?Java Dialog.convertHorizontalDLUsToPixels怎么用?Java Dialog.convertHorizontalDLUsToPixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.dialogs.Dialog的用法示例。


在下文中一共展示了Dialog.convertHorizontalDLUsToPixels方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeMetrics

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
private void computeMetrics() {
    Control control = getControl();

    if (control == null && Display.getCurrent() != null) {
        control = Display.getCurrent().getActiveShell();
    }

    if (control == null) {
        return;
    }

    /* Compute metrics in pixels */
    final GC gc = new GC(control);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);

    spacing = Math.max(horizontalSpacing, verticalSpacing);

    horizontalMargin = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    verticalMargin = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:25,代码来源:BasePreferencePage.java

示例2: BaseControl

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
public BaseControl(final Composite parent, final int style) {
    super(parent, style);

    /* Compute metrics in pixels */
    final GC gc = new GC(this);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);

    spacing = Math.max(horizontalSpacing, verticalSpacing);

    horizontalMargin = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    verticalMargin = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);

    minimumMessageAreaWidth =
        Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:20,代码来源:BaseControl.java

示例3: computeMetrics

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
private final void computeMetrics() {
    Control control = getControl();

    if (control == null && Display.getCurrent() != null) {
        control = Display.getCurrent().getActiveShell();
    }

    if (control == null) {
        return;
    }

    /* Compute metrics in pixels */
    final GC gc = new GC(control);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);

    spacing = Math.max(horizontalSpacing, verticalSpacing);

    horizontalMargin = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    verticalMargin = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);

    initializedMetrics = true;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:27,代码来源:BaseWizardPage.java

示例4: setButtonLayoutData

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
protected void setButtonLayoutData(FontMetrics metrics, Control button,
		boolean visible) {
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	int widthHint = Dialog.convertHorizontalDLUsToPixels(metrics,
			IDialogConstants.BUTTON_WIDTH);
	Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	data.widthHint = Math.max(widthHint, minSize.x);
	data.exclude = !visible;
	button.setLayoutData(data);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:HydrographInstallationDialog.java

示例5: setButtonLayoutData

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
/**
 * Set the layout data of the button to a GridData with appropriate heights and widths.
 *
 * @param button The button to set the layoutdata
 * @param data   The GridData to use
 */
protected static void setButtonLayoutData(Button button, GridData data) {
    /* GC to retrieve fontmetrics object */
    GC gc = new GC(button);
    FontMetrics fontMetrics = gc.getFontMetrics();
    /* Apply appropiate gridata */
    int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
    data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    button.setLayoutData(data);
    /* Dispose GC */
    gc.dispose();
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:18,代码来源:GridComposite.java

示例6: createPartControl

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
@Override
public final void createPartControl(final Composite parent) {
    /* Compute metrics in pixels */
    final GC gc = new GC(parent);
    final FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    final GridLayout layout = new GridLayout(2, false);
    layout.horizontalSpacing =
        Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING) * 2;
    layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    parent.setLayout(layout);

    final Label imageLabel = new Label(parent, SWT.NONE);
    imageLabel.setImage(Display.getCurrent().getSystemImage(SWT.ICON_INFORMATION));

    final Link textLabel = new Link(parent, SWT.READ_ONLY | SWT.WRAP);
    textLabel.setText(Messages.getString("DeprecatedByTeamExplorerView.DeprecatedText")); //$NON-NLS-1$
    textLabel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            try {
                final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                page.showView(TeamExplorerView.ID);
            } catch (final Exception f) {
                log.warn("Could not open Team Explorer View", f); //$NON-NLS-1$

                MessageDialog.openError(
                    getSite().getShell(),
                    Messages.getString("DeprecatedByTeamExplorerView.OpenViewFailedTitle"), //$NON-NLS-1$
                    Messages.getString("DeprecatedByTeamExplorerView.OpenViewFailedMessage")); //$NON-NLS-1$
            }
        }
    });
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(textLabel);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:39,代码来源:DeprecatedByTeamExplorerView.java

示例7: setButtonToButtonBarSize

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
public static final void setButtonToButtonBarSize(final Button button) {
    final GC gc = new GC(button);
    final FontMetrics fm = gc.getFontMetrics();
    gc.dispose();

    final int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    final Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);

    size.x = Math.max(widthHint, size.x);

    ControlSize.setSizeHints(button, size);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:13,代码来源:ButtonHelper.java

示例8: wButtonHint

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
public GridDataBuilder wButtonHint(final Control control) {
    final int widthHint =
        Dialog.convertHorizontalDLUsToPixels(ControlSize.getFontMetrics(control), IDialogConstants.BUTTON_WIDTH);
    final Point minSize = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    gridData.widthHint = Math.max(widthHint, minSize.x);

    return this;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:9,代码来源:GridDataBuilder.java

示例9: createButton

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
protected Button createButton(Composite parent, String label, int style) {
	Button button = new Button(parent, SWT.PUSH);
	button.setText(label);
	// we need to explicitly set the font to the parent's font for dialogs
	button.setFont(parent.getFont());
	GridData data = new GridData(style);
	int widthHint = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
	data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
	button.setLayoutData(data);
	return button;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:12,代码来源:DialogArea.java

示例10: convertHorizontalDLUsToPixels

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
public int convertHorizontalDLUsToPixels(int dlus) {
	return Dialog.convertHorizontalDLUsToPixels(fFontMetrics, dlus);
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:4,代码来源:DwprofilePixelConverter.java

示例11: createOkButton

import org.eclipse.jface.dialogs.Dialog; //导入方法依赖的package包/类
private void createOkButton(final Composite parent) {
    okButton = MenuButtonFactory.getMenuButton(parent, SWT.NONE);
    okButton.setText(Messages.getString("ApplyLabelDialog.OkButtonText")); //$NON-NLS-1$

    final GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    okButton.setLayoutData(data);

    /* Set to default size */
    final GC gc = new GC(okButton);
    final FontMetrics fm = gc.getFontMetrics();
    gc.dispose();

    final int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    final Point okSize = okButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    okSize.x = Math.max(widthHint, okSize.x);
    ControlSize.setSizeHints(okButton, okSize);

    /* Create menu */
    okButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            editLabel = false;
            okPressed();
        }
    });

    final IAction createLabelAction = new Action() {
        @Override
        public void run() {
            editLabel = false;
            okPressed();
        }
    };
    createLabelAction.setText(Messages.getString("ApplyLabelDialog.CreateLabelActionText")); //$NON-NLS-1$

    final IAction createAndEditLabelAction = new Action() {
        @Override
        public void run() {
            editLabel = true;
            okPressed();
        }
    };
    createAndEditLabelAction.setText(Messages.getString("ApplyLabelDialog.EditLabelActionText")); //$NON-NLS-1$

    okButton.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            manager.add(createLabelAction);
            manager.add(createAndEditLabelAction);
        }
    });

    getShell().setDefaultButton(okButton.getButton());

    validate();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:57,代码来源:ApplyLabelDialog.java


注:本文中的org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。