KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > preferences > JavaEditorPropertyPage


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 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.preferences;
12
13 import org.eclipse.swt.SWT;
14 import org.eclipse.swt.events.SelectionAdapter;
15 import org.eclipse.swt.events.SelectionEvent;
16 import org.eclipse.swt.layout.GridData;
17 import org.eclipse.swt.layout.GridLayout;
18 import org.eclipse.swt.widgets.Composite;
19 import org.eclipse.swt.widgets.Control;
20 import org.eclipse.swt.widgets.Link;
21
22 import org.eclipse.ui.IWorkbenchPropertyPage;
23 import org.eclipse.ui.dialogs.PropertyPage;
24 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
25
26 public class JavaEditorPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
27     
28     public JavaEditorPropertyPage() {}
29     
30     protected Control createContents(Composite parent) {
31         final Composite composite= new Composite(parent, SWT.NONE);
32         composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
33         composite.setLayout(new GridLayout());
34         
35         Link link= new Link(composite, SWT.WRAP);
36         GridData data= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
37         data.widthHint= 300;
38         link.setLayoutData(data);
39         link.setText(PreferencesMessages.JavaEditorPropertyPage_SaveActionLink_Text);
40         link.addSelectionListener(new SelectionAdapter() {
41             public void widgetSelected(SelectionEvent e) {
42                 IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer)getContainer();
43                 container.openPage(SaveParticipantPreferencePage.PROPERTY_PAGE_ID, null);
44             }
45         });
46         
47         return composite;
48     }
49     
50 }
51
Popular Tags