001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.internal.ui.preferences;
011:
012: import org.eclipse.core.runtime.IAdaptable;
013:
014: import org.eclipse.core.resources.IProject;
015:
016: import org.eclipse.swt.widgets.Composite;
017: import org.eclipse.swt.widgets.Control;
018:
019: import org.eclipse.ui.PlatformUI;
020: import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
021:
022: import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
023: import org.eclipse.jdt.internal.ui.JavaPlugin;
024:
025: /**
026: * Page used to configure both workspace and project specific compiler settings
027: */
028: public class JavadocProblemsPreferencePage extends
029: PropertyAndPreferencePage {
030:
031: public static final String PREF_ID = "org.eclipse.jdt.ui.preferences.JavadocProblemsPreferencePage"; //$NON-NLS-1$
032: public static final String PROP_ID = "org.eclipse.jdt.ui.propertyPages.JavadocProblemsPreferencePage"; //$NON-NLS-1$
033:
034: private JavadocProblemsConfigurationBlock fConfigurationBlock;
035:
036: public JavadocProblemsPreferencePage() {
037: setPreferenceStore(JavaPlugin.getDefault().getPreferenceStore());
038: //setDescription(PreferencesMessages.getString("JavadocProblemsPreferencePage.description")); //$NON-NLS-1$
039:
040: // only used when page is shown programatically
041: setTitle(PreferencesMessages.JavadocProblemsPreferencePage_title);
042: }
043:
044: /*
045: * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
046: */
047: public void createControl(Composite parent) {
048: IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
049: fConfigurationBlock = new JavadocProblemsConfigurationBlock(
050: getNewStatusChangedListener(), getProject(), container);
051:
052: super .createControl(parent);
053: if (isProjectPreferencePage()) {
054: PlatformUI.getWorkbench().getHelpSystem().setHelp(
055: getControl(),
056: IJavaHelpContextIds.JAVADOC_PROBLEMS_PROPERTY_PAGE);
057: } else {
058: PlatformUI
059: .getWorkbench()
060: .getHelpSystem()
061: .setHelp(
062: getControl(),
063: IJavaHelpContextIds.JAVADOC_PROBLEMS_PREFERENCE_PAGE);
064: }
065: }
066:
067: protected Control createPreferenceContent(Composite composite) {
068: return fConfigurationBlock.createContents(composite);
069: }
070:
071: protected boolean hasProjectSpecificOptions(IProject project) {
072: return fConfigurationBlock.hasProjectSpecificOptions(project);
073: }
074:
075: /* (non-Javadoc)
076: * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
077: */
078: protected String getPreferencePageID() {
079: return PREF_ID;
080: }
081:
082: /* (non-Javadoc)
083: * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
084: */
085: protected String getPropertyPageID() {
086: return PROP_ID;
087: }
088:
089: /* (non-Javadoc)
090: * @see org.eclipse.jface.dialogs.DialogPage#dispose()
091: */
092: public void dispose() {
093: if (fConfigurationBlock != null) {
094: fConfigurationBlock.dispose();
095: }
096: super .dispose();
097: }
098:
099: /* (non-Javadoc)
100: * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#enableProjectSpecificSettings(boolean)
101: */
102: protected void enableProjectSpecificSettings(
103: boolean useProjectSpecificSettings) {
104: super .enableProjectSpecificSettings(useProjectSpecificSettings);
105: if (fConfigurationBlock != null) {
106: fConfigurationBlock
107: .useProjectSpecificSettings(useProjectSpecificSettings);
108: }
109: }
110:
111: /*
112: * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
113: */
114: protected void performDefaults() {
115: super .performDefaults();
116: if (fConfigurationBlock != null) {
117: fConfigurationBlock.performDefaults();
118: }
119: }
120:
121: /*
122: * @see org.eclipse.jface.preference.IPreferencePage#performOk()
123: */
124: public boolean performOk() {
125: if (fConfigurationBlock != null
126: && !fConfigurationBlock.performOk()) {
127: return false;
128: }
129: return super .performOk();
130: }
131:
132: /*
133: * @see org.eclipse.jface.preference.IPreferencePage#performApply()
134: */
135: public void performApply() {
136: if (fConfigurationBlock != null) {
137: fConfigurationBlock.performApply();
138: }
139: }
140:
141: /* (non-Javadoc)
142: * @see org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#setElement(org.eclipse.core.runtime.IAdaptable)
143: */
144: public void setElement(IAdaptable element) {
145: super .setElement(element);
146: setDescription(null); // no description for property page
147: }
148:
149: }
|