1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.preferences;
13 import net.sourceforge.phpdt.internal.ui.IJavaHelpContextIds;
14 import net.sourceforge.phpdt.internal.ui.dialogs.StatusUtil;
15 import net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener;
16 //import net.sourceforge.phpeclipse.PHPeclipsePlugin;
17 import net.sourceforge.phpeclipse.ui.WebUI;
19 import org.eclipse.core.runtime.IStatus;
20 import org.eclipse.jface.dialogs.Dialog;
21 import org.eclipse.jface.preference.PreferencePage;
22 import org.eclipse.swt.widgets.Composite;
23 import org.eclipse.swt.widgets.Control;
24 import org.eclipse.ui.IWorkbench;
25 import org.eclipse.ui.IWorkbenchPreferencePage;
26 import org.eclipse.ui.PlatformUI;
29 * The page to configure the code formatter options.
31 public class CodeTemplatePreferencePage extends PreferencePage implements
32 IWorkbenchPreferencePage, IStatusChangeListener {
34 private CodeTemplateBlock fCodeTemplateConfigurationBlock;
36 public CodeTemplatePreferencePage() {
37 setPreferenceStore(WebUI.getDefault().getPreferenceStore());
38 // setDescription(PreferencesMessages.getString("CodeTemplatesPreferencePage.description"));
41 // only used when page is shown programatically
42 setTitle(PreferencesMessages
43 .getString("CodeTemplatesPreferencePage.title")); //$NON-NLS-1$
45 fCodeTemplateConfigurationBlock = new CodeTemplateBlock();
49 * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
51 public void init(IWorkbench workbench) {
55 * @see PreferencePage#createControl(Composite)
57 public void createControl(Composite parent) {
58 super.createControl(parent);
59 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
60 IJavaHelpContextIds.CODE_MANIPULATION_PREFERENCE_PAGE);
64 * @see PreferencePage#createContents(Composite)
66 protected Control createContents(Composite parent) {
67 Control composite = fCodeTemplateConfigurationBlock
68 .createContents(parent);
69 Dialog.applyDialogFont(composite);
74 * @see IPreferencePage#performOk()
76 public boolean performOk() {
77 if (!fCodeTemplateConfigurationBlock.performOk(true)) {
80 return super.performOk();
84 * @see PreferencePage#performDefaults()
86 protected void performDefaults() {
87 fCodeTemplateConfigurationBlock.performDefaults();
88 super.performDefaults();
94 * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
96 public void statusChanged(IStatus status) {
97 setValid(!status.matches(IStatus.ERROR));
98 StatusUtil.applyToStatusLine(this, status);
104 * @see org.eclipse.jface.preference.IPreferencePage#performCancel()
106 public boolean performCancel() {
107 fCodeTemplateConfigurationBlock.performCancel();
109 return super.performCancel();