001: /*******************************************************************************
002: * Copyright (c) 2007 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.resources.IProject;
013:
014: import org.eclipse.swt.widgets.Composite;
015: import org.eclipse.swt.widgets.Control;
016:
017: import org.eclipse.ui.IWorkbenchPreferencePage;
018: import org.eclipse.ui.PlatformUI;
019: import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
020:
021: import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
022:
023: /**
024: * Content Assist > Static Members preference page.
025: * <p>
026: * Note: Must be public since it is referenced from plugin.xml
027: * </p>
028: *
029: * @since 3.3
030: */
031: public class CodeAssistFavoritesPreferencePage extends
032: PropertyAndPreferencePage implements IWorkbenchPreferencePage {
033:
034: private CodeAssistFavoritesConfigurationBlock fConfigurationBlock;
035:
036: public void createControl(Composite parent) {
037: IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
038: fConfigurationBlock = new CodeAssistFavoritesConfigurationBlock(
039: getNewStatusChangedListener(), container);
040:
041: super .createControl(parent);
042: PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
043: IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
044: }
045:
046: protected Control createPreferenceContent(Composite composite) {
047: return fConfigurationBlock.createContents(composite);
048: }
049:
050: protected boolean hasProjectSpecificOptions(IProject project) {
051: return false;
052: }
053:
054: protected String getPreferencePageID() {
055: return "org.eclipse.jdt.ui.preferences.CodeAssistStaticMembersPreferencePage"; //$NON-NLS-1$
056: }
057:
058: protected String getPropertyPageID() {
059: return null;
060: }
061:
062: /* (non-Javadoc)
063: * @see org.eclipse.jface.dialogs.DialogPage#dispose()
064: */
065: public void dispose() {
066: if (fConfigurationBlock != null) {
067: fConfigurationBlock.dispose();
068: }
069: super .dispose();
070: }
071:
072: /*
073: * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
074: */
075: protected void performDefaults() {
076: super .performDefaults();
077: if (fConfigurationBlock != null) {
078: fConfigurationBlock.performDefaults();
079: }
080: }
081:
082: /*
083: * @see org.eclipse.jface.preference.IPreferencePage#performOk()
084: */
085: public boolean performOk() {
086: if (fConfigurationBlock != null
087: && !fConfigurationBlock.performOk()) {
088: return false;
089: }
090: return super .performOk();
091: }
092:
093: /*
094: * @see org.eclipse.jface.preference.IPreferencePage#performApply()
095: */
096: public void performApply() {
097: if (fConfigurationBlock != null) {
098: fConfigurationBlock.performApply();
099: }
100: }
101:
102: }
|