本文整理匯總了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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例6: convertVerticalDLUsToPixels
import org.eclipse.jface.dialogs.Dialog; //導入方法依賴的package包/類
public int convertVerticalDLUsToPixels(int dlus) {
return Dialog.convertVerticalDLUsToPixels(fFontMetrics, dlus);
}