Package org.eclipse.php.internal.ui.preferences

Source Code of org.eclipse.php.internal.ui.preferences.PHPInterpreterPreferencePage

/*******************************************************************************
* Copyright (c) 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     IBM Corporation - initial API and implementation
*     Zend Technologies
*******************************************************************************/
package org.eclipse.php.internal.ui.preferences;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.php.internal.ui.IPHPHelpContextIds;
import org.eclipse.php.internal.ui.PHPUIMessages;
import org.eclipse.php.internal.ui.PHPUiPlugin;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;

public class PHPInterpreterPreferencePage extends PropertyAndPreferencePage {

  public static final String PREF_ID = "org.eclipse.php.ui.preferences.PHPInterpreterPreferencePage"; //$NON-NLS-1$
  public static final String PROP_ID = "org.eclipse.php.ui.propertyPages.PHPInterpreterPreferencePage"; //$NON-NLS-1$

  private PHPVersionConfigurationBlock fConfigurationBlock;

  public PHPInterpreterPreferencePage() {
    setPreferenceStore(PHPUiPlugin.getDefault().getPreferenceStore());

    // only used when page is shown programatically
    setTitle(PHPUIMessages.PHPInterpreterPreferencePage_title);
  }

  /*
   * @see
   * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
   * .Composite)
   */
  public void createControl(Composite parent) {
    IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
    fConfigurationBlock = new PHPVersionConfigurationBlock(
        getNewStatusChangedListener(), getProject(), container);

    super.createControl(parent);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent,
        IPHPHelpContextIds.PHP_INTERPRETER_PREFERENCES);

  }

  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#
   * createPreferenceContent(org.eclipse.swt.widgets.Composite)
   */
  protected Control createPreferenceContent(Composite composite) {
    return fConfigurationBlock.createContents(composite);
  }

  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#
   * hasProjectSpecificOptions(org.eclipse.core.resources.IProject)
   */
  protected boolean hasProjectSpecificOptions(IProject project) {
    return fConfigurationBlock.hasProjectSpecificOptions(project);
  }

  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#
   * getPreferencePageID()
   */
  protected String getPreferencePageID() {
    return PREF_ID;
  }

  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#
   * getPropertyPageID()
   */
  protected String getPropertyPageID() {
    return PROP_ID;
  }

  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#
   * enableProjectSpecificSettings(boolean)
   */
  protected void enableProjectSpecificSettings(
      boolean useProjectSpecificSettings) {
    if (fConfigurationBlock != null) {
      fConfigurationBlock
          .useProjectSpecificSettings(useProjectSpecificSettings);
    }
    super.enableProjectSpecificSettings(useProjectSpecificSettings);
  }

  /*
   * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
   */
  protected void performDefaults() {
    super.performDefaults();
    if (fConfigurationBlock != null) {
      fConfigurationBlock.performDefaults();
    }
  }

  /*
   * @see org.eclipse.jface.preference.IPreferencePage#performOk()
   */
  public boolean performOk() {
    if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) {
      return false;
    }
    return super.performOk();
  }

  /*
   * @see org.eclipse.jface.preference.IPreferencePage#performApply()
   */
  public void performApply() {
    if (fConfigurationBlock != null) {
      fConfigurationBlock.performApply();
    }
  }

  /*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.dialogs.DialogPage#dispose()
   */
  public void dispose() {
    if (fConfigurationBlock != null) {
      fConfigurationBlock.dispose();
    }
    super.dispose();
  }

  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#setElement
   * (org.eclipse.core.runtime.IAdaptable)
   */
  public void setElement(IAdaptable element) {
    super.setElement(element);
    setDescription(null); // no description for property page
  }

}
TOP

Related Classes of org.eclipse.php.internal.ui.preferences.PHPInterpreterPreferencePage

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.