1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.ui.wizards.buildpaths;
13 import java.util.List;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.widgets.Composite;
17 import org.eclipse.swt.widgets.Control;
19 import org.eclipse.jface.layout.PixelConverter;
20 import org.eclipse.jface.viewers.StructuredSelection;
22 import org.eclipse.jdt.core.IJavaProject;
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;
29 public class ClasspathOrderingWorkbookPage extends BuildPathBasePage {
31 private ListDialogField<CPListElement> fClassPathList;
33 public ClasspathOrderingWorkbookPage(ListDialogField<CPListElement> classPathList) {
34 fClassPathList= classPathList;
38 public Control getControl(Composite parent) {
39 PixelConverter converter= new PixelConverter(parent);
41 Composite composite= new Composite(parent, SWT.NONE);
42 composite.setFont(parent.getFont());
44 LayoutUtil.doDefaultLayout(composite, new DialogField[] { fClassPathList }, true, SWT.DEFAULT, SWT.DEFAULT);
45 LayoutUtil.setHorizontalGrabbing(fClassPathList.getListControl(null));
47 int buttonBarWidth= converter.convertWidthInCharsToPixels(24);
48 fClassPathList.setButtonsMinWidth(buttonBarWidth);
54 * @see BuildPathBasePage#getSelection
57 public List<?> getSelection() {
58 return fClassPathList.getSelectedElements();
62 * @see BuildPathBasePage#setSelection
65 public void setSelection(List<?> selElements, boolean expand) {
66 fClassPathList.selectElements(new StructuredSelection(selElements));
70 * @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathBasePage#isEntryKind(int)
73 public boolean isEntryKind(int kind) {
78 * @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathBasePage#init(org.eclipse.jdt.core.IJavaProject)
81 public void init(IJavaProject javaProject) {
88 public void setFocus() {
89 fClassPathList.setFocus();