當前位置: 首頁>>代碼示例>>Java>>正文


Java Dialog.convertVerticalDLUsToPixels方法代碼示例

本文整理匯總了Java中org.eclipse.jface.dialogs.Dialog.convertVerticalDLUsToPixels方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.convertVerticalDLUsToPixels方法的具體用法?Java Dialog.convertVerticalDLUsToPixels怎麽用?Java Dialog.convertVerticalDLUsToPixels使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.dialogs.Dialog的用法示例。


在下文中一共展示了Dialog.convertVerticalDLUsToPixels方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getTooltipSize

import org.eclipse.jface.dialogs.Dialog; //導入方法依賴的package包/類
protected Point getTooltipSize(final Shell tooltipShell) {
    if (maxTooltipSize == null) {
        final GC gc = new GC(tooltipShell);

        final int max =
            Dialog.convertVerticalDLUsToPixels(gc.getFontMetrics(), IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        maxTooltipSize = new Point(max, max);

        gc.dispose();
    }

    Point tooltipSize = tooltipShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);

    if (tooltipSize.x > maxTooltipSize.x) {
        tooltipSize = tooltipShell.computeSize(maxTooltipSize.x, SWT.DEFAULT);
    }
    if (tooltipSize.y > maxTooltipSize.y) {
        tooltipSize = tooltipShell.computeSize(maxTooltipSize.x, maxTooltipSize.y);
    }

    return tooltipSize;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:23,代碼來源:TableTooltipManager.java

示例5: 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

示例6: convertVerticalDLUsToPixels

import org.eclipse.jface.dialogs.Dialog; //導入方法依賴的package包/類
public int convertVerticalDLUsToPixels(int dlus) {
	return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:4,代碼來源:DwprofilePixelConverter.java


注:本文中的org.eclipse.jface.dialogs.Dialog.convertVerticalDLUsToPixels方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。