1 /**********************************************************************
 
   2  * Copyright (c) 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 - Initial API and implementation
 
  10  **********************************************************************/
 
  11 package net.sourceforge.phpdt.httpquery.preferences;
 
  13 import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
 
  15 import org.eclipse.jface.dialogs.Dialog;
 
  16 import org.eclipse.jface.preference.PreferencePage;
 
  17 import org.eclipse.swt.SWT;
 
  18 import org.eclipse.swt.layout.GridData;
 
  19 import org.eclipse.swt.layout.GridLayout;
 
  20 import org.eclipse.swt.widgets.Composite;
 
  21 import org.eclipse.swt.widgets.Control;
 
  22 import org.eclipse.swt.widgets.Label;
 
  23 import org.eclipse.ui.IWorkbench;
 
  24 import org.eclipse.ui.IWorkbenchPreferencePage;
 
  27  * The preference page that holds monitor properties.
 
  29 public class ConfigurationPreferencePage extends PreferencePage implements
 
  30                 IWorkbenchPreferencePage {
 
  33          * ConfigurationPreferencePage constructor comment.
 
  35         public ConfigurationPreferencePage() {
 
  37                 noDefaultAndApplyButton();
 
  41          * Create the preference options.
 
  44          *            org.eclipse.swt.widgets.Composite
 
  45          * @return org.eclipse.swt.widgets.Control
 
  47         protected Control createContents(Composite parent) {
 
  48                 initializeDialogUnits(parent);
 
  50                 Composite composite = new Composite(parent, SWT.NONE);
 
  51                 GridLayout layout = new GridLayout();
 
  52                 layout.numColumns = 1;
 
  53                 layout.horizontalSpacing = convertHorizontalDLUsToPixels(4);
 
  54                 layout.verticalSpacing = convertVerticalDLUsToPixels(4);
 
  55                 layout.marginWidth = 0;
 
  56                 layout.marginHeight = 0;
 
  57                 composite.setLayout(layout);
 
  58                 GridData data = new GridData(GridData.FILL_HORIZONTAL
 
  59                                 | GridData.VERTICAL_ALIGN_FILL);
 
  60                 composite.setLayoutData(data);
 
  61                 // WorkbenchHelp.setHelp(composite, ContextIds.PREF);
 
  63                 Label label = new Label(composite, SWT.WRAP);
 
  64                 label.setText(PHPHelpPlugin.getResource("%preferenceDescription"));
 
  65                 data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
 
  66                 label.setLayoutData(data);
 
  68                 label = new Label(composite, SWT.NONE);
 
  71                 ConfigurationComposite monitorComp = new ConfigurationComposite(
 
  73                 data = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
 
  74                 monitorComp.setLayoutData(data);
 
  76                 Dialog.applyDialogFont(composite);
 
  82          * Initializes this preference page using the passed desktop.
 
  87         public void init(IWorkbench workbench) {
 
  91          * Performs special processing when this page's Defaults button has been
 
  94          * This is a framework hook method for sublcasses to do special things when
 
  95          * the Defaults button has been pressed. Subclasses may override, but should
 
  96          * call <code>super.performDefaults</code>.
 
  99         protected void performDefaults() {
 
 100                 // displayButton.setSelection(WikiEditorPlugin.getDefaultShowOnActivityPreference());
 
 101                 super.performDefaults();
 
 105          * Method declared on IPreferencePage. Subclasses should override
 
 107         public boolean performOk() {
 
 108                 // WikiEditorPlugin.setShowOnActivityPreference(displayButton.getSelection());
 
 109                 PHPHelpPlugin.getDefault().savePluginPreferences();