KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > wizards > buildpaths > ClasspathOrderingWorkbookPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.jdt.internal.ui.wizards.buildpaths;
12
13 import java.util.List JavaDoc;
14
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Control;
18
19 import org.eclipse.jface.viewers.StructuredSelection;
20
21 import org.eclipse.jdt.core.IJavaProject;
22
23 import org.eclipse.jdt.internal.ui.util.PixelConverter;
24 import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
25 import org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil;
26 import org.eclipse.jdt.internal.ui.wizards.dialogfields.ListDialogField;
27
28
29 public class ClasspathOrderingWorkbookPage extends BuildPathBasePage {
30     
31     private ListDialogField fClassPathList;
32     
33     public ClasspathOrderingWorkbookPage(ListDialogField classPathList) {
34         fClassPathList= classPathList;
35     }
36     
37     public Control getControl(Composite parent) {
38         PixelConverter converter= new PixelConverter(parent);
39         
40         Composite composite= new Composite(parent, SWT.NONE);
41         composite.setFont(parent.getFont());
42         
43         LayoutUtil.doDefaultLayout(composite, new DialogField[] { fClassPathList }, true, SWT.DEFAULT, SWT.DEFAULT);
44         LayoutUtil.setHorizontalGrabbing(fClassPathList.getListControl(null));
45
46         int buttonBarWidth= converter.convertWidthInCharsToPixels(24);
47         fClassPathList.setButtonsMinWidth(buttonBarWidth);
48             
49         return composite;
50     }
51     
52     /*
53      * @see BuildPathBasePage#getSelection
54      */

55     public List JavaDoc getSelection() {
56         return fClassPathList.getSelectedElements();
57     }
58
59     /*
60      * @see BuildPathBasePage#setSelection
61      */

62     public void setSelection(List JavaDoc selElements, boolean expand) {
63         fClassPathList.selectElements(new StructuredSelection(selElements));
64     }
65         
66     /* (non-Javadoc)
67      * @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathBasePage#isEntryKind(int)
68      */

69     public boolean isEntryKind(int kind) {
70         return true;
71     }
72
73     /* (non-Javadoc)
74      * @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathBasePage#init(org.eclipse.jdt.core.IJavaProject)
75      */

76     public void init(IJavaProject javaProject) {
77     }
78
79     /**
80      * {@inheritDoc}
81      */

82     public void setFocus() {
83         fClassPathList.setFocus();
84     }
85
86 }
87
Popular Tags