KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > sourcelookup > browsers > ProjectSourceContainerDialog


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.debug.internal.ui.sourcelookup.browsers;
12 import org.eclipse.debug.internal.ui.IDebugHelpContextIds;
13 import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages;
14 import org.eclipse.jface.viewers.ILabelProvider;
15 import org.eclipse.jface.viewers.IStructuredContentProvider;
16 import org.eclipse.swt.SWT;
17 import org.eclipse.swt.events.SelectionAdapter;
18 import org.eclipse.swt.events.SelectionEvent;
19 import org.eclipse.swt.graphics.Font;
20 import org.eclipse.swt.widgets.Button;
21 import org.eclipse.swt.widgets.Composite;
22 import org.eclipse.swt.widgets.Control;
23 import org.eclipse.swt.widgets.Shell;
24 import org.eclipse.ui.PlatformUI;
25 import org.eclipse.ui.dialogs.ListSelectionDialog;
26
27 /**
28  * The dialog for selecting the project for which a source container will be created.
29  *
30  * @since 3.0
31  */

32 public class ProjectSourceContainerDialog extends ListSelectionDialog {
33     
34     private boolean fAddRequiredProjects = false;
35     
36     public ProjectSourceContainerDialog(
37             Shell parentShell,
38             Object JavaDoc input,
39             IStructuredContentProvider contentProvider,
40             ILabelProvider labelProvider,
41             String JavaDoc message) {
42         super(parentShell, input, contentProvider, labelProvider, message);
43     }
44     
45     
46     /**
47      * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
48      */

49     protected Control createDialogArea(Composite parent) {
50         Font font = parent.getFont();
51         
52         Composite composite = (Composite)super.createDialogArea(parent);
53         
54         final Button addRequired = new Button(composite, SWT.CHECK);
55         addRequired.setText(SourceLookupUIMessages.projectSelection_requiredLabel);
56         addRequired.addSelectionListener(new SelectionAdapter() {
57             public void widgetSelected(SelectionEvent e) {
58                 fAddRequiredProjects = addRequired.getSelection();
59             }
60         });
61         addRequired.setSelection(fAddRequiredProjects);
62         addRequired.setFont(font);
63         
64         applyDialogFont(composite);
65         PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(), IDebugHelpContextIds.ADD_PROJECT_CONTAINER_DIALOG);
66         return composite;
67     }
68     
69     
70     /**
71      * Returns whether the user has selected to add required projects.
72      *
73      * @return whether the user has selected to add required projects
74      */

75     public boolean isAddRequiredProjects() {
76         return fAddRequiredProjects;
77     }
78 }
79
Popular Tags