]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/wizards/buildpaths/ClasspathOrderingWorkbookPage.java
60e93a14fab04e79f58d6b29b56dd08023e5ca81
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / wizards / buildpaths / ClasspathOrderingWorkbookPage.java
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
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;
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.layout.PixelConverter;
20 import org.eclipse.jface.viewers.StructuredSelection;
21
22 import org.eclipse.jdt.core.IJavaProject;
23
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<CPListElement> fClassPathList;
32
33         public ClasspathOrderingWorkbookPage(ListDialogField<CPListElement> classPathList) {
34                 fClassPathList= classPathList;
35         }
36
37         @Override
38         public Control getControl(Composite parent) {
39                 PixelConverter converter= new PixelConverter(parent);
40
41                 Composite composite= new Composite(parent, SWT.NONE);
42                 composite.setFont(parent.getFont());
43
44                 LayoutUtil.doDefaultLayout(composite, new DialogField[] { fClassPathList }, true, SWT.DEFAULT, SWT.DEFAULT);
45                 LayoutUtil.setHorizontalGrabbing(fClassPathList.getListControl(null));
46
47                 int buttonBarWidth= converter.convertWidthInCharsToPixels(24);
48                 fClassPathList.setButtonsMinWidth(buttonBarWidth);
49
50                 return composite;
51         }
52
53         /*
54          * @see BuildPathBasePage#getSelection
55          */
56         @Override
57         public List<?> getSelection() {
58                 return fClassPathList.getSelectedElements();
59         }
60
61         /*
62          * @see BuildPathBasePage#setSelection
63          */
64         @Override
65         public void setSelection(List<?> selElements, boolean expand) {
66                 fClassPathList.selectElements(new StructuredSelection(selElements));
67         }
68
69         /* (non-Javadoc)
70          * @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathBasePage#isEntryKind(int)
71          */
72         @Override
73         public boolean isEntryKind(int kind) {
74                 return true;
75         }
76
77         /* (non-Javadoc)
78          * @see org.eclipse.jdt.internal.ui.wizards.buildpaths.BuildPathBasePage#init(org.eclipse.jdt.core.IJavaProject)
79          */
80         @Override
81         public void init(IJavaProject javaProject) {
82         }
83
84         /**
85      * {@inheritDoc}
86      */
87     @Override
88         public void setFocus() {
89         fClassPathList.setFocus();
90     }
91
92 }