|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2009 Eric Rizzo 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 |
* Eric Rizzo - initial API and implementation |
| 10 |
*******************************************************************************/ |
| 11 |
package org.eclipse.ui.internal.ide.application.dialogs; |
| 12 |
|
| 13 |
import org.eclipse.swt.SWT; |
| 14 |
import org.eclipse.swt.layout.GridData; |
| 15 |
import org.eclipse.swt.layout.GridLayout; |
| 16 |
import org.eclipse.swt.widgets.Button; |
| 17 |
import org.eclipse.swt.widgets.Composite; |
| 18 |
import org.eclipse.swt.widgets.Control; |
| 19 |
import org.eclipse.swt.widgets.Group; |
| 20 |
import org.eclipse.swt.widgets.Label; |
| 21 |
import org.eclipse.swt.widgets.List; |
| 22 |
import org.eclipse.swt.widgets.Spinner; |
| 23 |
import org.eclipse.ui.IWorkbench; |
| 24 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
| 25 |
import org.eclipse.ui.internal.dialogs.StartupPreferencePage; |
| 26 |
|
| 27 |
|
| 28 |
/** |
| 29 |
* Preference page for editing the list of recent workspaces and whether or not |
| 30 |
* the user is prompted at startup. |
| 31 |
* |
| 32 |
* @since 3.5 |
| 33 |
*/ |
| 34 |
public class RecentWorkspacesPreferencePage extends StartupPreferencePage |
| 35 |
implements IWorkbenchPreferencePage { |
| 36 |
|
| 37 |
private Button removeButton; |
| 38 |
private Spinner maxWorkspacesField; |
| 39 |
private Button promptButton; |
| 40 |
private List workspacesList; |
| 41 |
|
| 42 |
|
| 43 |
public Control createContents(Composite parent) { |
| 44 |
Composite container = new Composite(parent, SWT.NULL); |
| 45 |
final GridLayout gridLayout = new GridLayout(); |
| 46 |
gridLayout.numColumns = 2; |
| 47 |
gridLayout.marginHeight = 0; |
| 48 |
gridLayout.marginWidth = 0; |
| 49 |
container.setLayout(gridLayout); |
| 50 |
|
| 51 |
promptButton = new Button(container, SWT.CHECK); |
| 52 |
promptButton.setText("Prompt for &workspace on startup"); //$NON-NLS-1$ |
| 53 |
new Label(container, SWT.NONE); |
| 54 |
|
| 55 |
final Label numberOfLabel = new Label(container, SWT.NONE); |
| 56 |
numberOfLabel.setText("&Number of recent workspaces to remember:"); //$NON-NLS-1$ |
| 57 |
|
| 58 |
maxWorkspacesField = new Spinner(container, SWT.BORDER); |
| 59 |
maxWorkspacesField.setTextLimit(2); |
| 60 |
maxWorkspacesField.setMinimum(1); |
| 61 |
maxWorkspacesField.setMaximum(99); |
| 62 |
|
| 63 |
final Group recentWorkspacesGroup = new Group(container, SWT.NONE); |
| 64 |
recentWorkspacesGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); |
| 65 |
recentWorkspacesGroup.setText("Recent workspaces"); //$NON-NLS-1$ |
| 66 |
final GridLayout gridLayout_1 = new GridLayout(); |
| 67 |
gridLayout_1.numColumns = 2; |
| 68 |
recentWorkspacesGroup.setLayout(gridLayout_1); |
| 69 |
|
| 70 |
workspacesList = new List(recentWorkspacesGroup, SWT.BORDER); |
| 71 |
final GridData gd_workspacesList = new GridData(SWT.FILL, SWT.FILL, true, true); |
| 72 |
workspacesList.setLayoutData(gd_workspacesList); |
| 73 |
|
| 74 |
removeButton = new Button(recentWorkspacesGroup, SWT.NONE); |
| 75 |
final GridData gd_removeButton = new GridData(SWT.CENTER, SWT.TOP, false, false); |
| 76 |
removeButton.setLayoutData(gd_removeButton); |
| 77 |
removeButton.setText("&Remove"); //$NON-NLS-1$ |
| 78 |
|
| 79 |
return container; |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
public void init(IWorkbench workbench) { |
| 84 |
// Initialize the preference page |
| 85 |
} |
| 86 |
|
| 87 |
} |