Honor workbench setting for Dialog font
[egit.git] / org.eclipse.egit.ui / src / org / eclipse / egit / ui / internal / fetch / FetchResultDialog.java
blob2e48cbb1cb8ba98514e59df3d8851b8969acf314
1 /*******************************************************************************
2 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org.eclipse.egit.ui.internal.fetch;
11 import org.eclipse.egit.ui.UIText;
12 import org.eclipse.jface.dialogs.Dialog;
13 import org.eclipse.jface.dialogs.IDialogConstants;
14 import org.eclipse.osgi.util.NLS;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.layout.GridData;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19 import org.eclipse.swt.widgets.Label;
20 import org.eclipse.swt.widgets.Shell;
21 import org.eclipse.jgit.lib.Repository;
22 import org.eclipse.jgit.transport.FetchResult;
24 /**
25 * Dialog displaying result of fetch operation.
27 class FetchResultDialog extends Dialog {
28 private final Repository localDb;
30 private final FetchResult result;
32 private final String sourceString;
34 FetchResultDialog(final Shell parentShell, final Repository localDb,
35 final FetchResult result, final String sourceString) {
36 super(parentShell);
37 setShellStyle(getShellStyle() | SWT.RESIZE);
38 this.localDb = localDb;
39 this.result = result;
40 this.sourceString = sourceString;
43 @Override
44 protected void createButtonsForButtonBar(final Composite parent) {
45 createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,
46 true);
49 @Override
50 protected Control createDialogArea(final Composite parent) {
51 final Composite composite = (Composite) super.createDialogArea(parent);
53 final Label label = new Label(composite, SWT.NONE);
54 final String text;
55 if (!result.getTrackingRefUpdates().isEmpty())
56 text = NLS.bind(UIText.FetchResultDialog_labelNonEmptyResult,
57 sourceString);
58 else
59 text = NLS.bind(UIText.FetchResultDialog_labelEmptyResult,
60 sourceString);
61 label.setText(text);
62 label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
64 final FetchResultTable table = new FetchResultTable(composite);
65 table.setData(localDb, result);
66 final Control tableControl = table.getControl();
67 final GridData tableLayout = new GridData(SWT.FILL, SWT.FILL, true,
68 true);
69 tableLayout.widthHint = 600;
70 tableLayout.heightHint = 300;
71 tableControl.setLayoutData(tableLayout);
73 getShell().setText(
74 NLS.bind(UIText.FetchResultDialog_title, sourceString));
75 applyDialogFont(composite);
76 return composite;