1 /*******************************************************************************
 
   2  * Copyright (c) 2000, 2003 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;
 
  18 import org.eclipse.core.runtime.IStatus;
 
  19 import org.eclipse.jface.dialogs.Dialog;
 
  20 import org.eclipse.jface.preference.PreferencePage;
 
  21 import org.eclipse.swt.widgets.Composite;
 
  22 import org.eclipse.swt.widgets.Control;
 
  23 import org.eclipse.ui.IWorkbench;
 
  24 import org.eclipse.ui.IWorkbenchPreferencePage;
 
  25 import org.eclipse.ui.PlatformUI;
 
  28  * The page to configure the compiler options.
 
  30 public class CompilerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IStatusChangeListener {
 
  32         private CompilerConfigurationBlock fConfigurationBlock;
 
  34         public CompilerPreferencePage() {
 
  35                 setPreferenceStore(PHPeclipsePlugin.getDefault().getPreferenceStore());
 
  36                 setDescription(PreferencesMessages.getString("CompilerPreferencePage.description")); //$NON-NLS-1$
 
  38                 // only used when page is shown programatically
 
  39                 setTitle(PreferencesMessages.getString("CompilerPreferencePage.title"));                 //$NON-NLS-1$
 
  41                 fConfigurationBlock= new CompilerConfigurationBlock(this, null);
 
  45          * @see IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
 
  47         public void init(IWorkbench workbench) {
 
  51          * @see PreferencePage#createControl(Composite)
 
  53         public void createControl(Composite parent) {
 
  54                 super.createControl(parent);
 
  55                 PlatformUI.getWorkbench().getHelpSystem().
 
  56                 setHelp(getControl(), IJavaHelpContextIds.COMPILER_PREFERENCE_PAGE);
 
  60          * @see PreferencePage#createContents(Composite)
 
  62         protected Control createContents(Composite parent) {
 
  63                 Control result= fConfigurationBlock.createContents(parent);
 
  64                 Dialog.applyDialogFont(result);
 
  69          * @see IPreferencePage#performOk()
 
  71         public boolean performOk() {
 
  72                 if (!fConfigurationBlock.performOk(true)) {
 
  75                 return super.performOk();
 
  79          * @see PreferencePage#performDefaults()
 
  81         protected void performDefaults() {
 
  82                 fConfigurationBlock.performDefaults();
 
  83                 super.performDefaults();
 
  87          * @see net.sourceforge.phpdt.internal.ui.wizards.IStatusChangeListener#statusChanged(org.eclipse.core.runtime.IStatus)
 
  89         public void statusChanged(IStatus status) {
 
  90                 setValid(!status.matches(IStatus.ERROR));
 
  91                 StatusUtil.applyToStatusLine(this, status);