1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
12 package org.eclipse.jdt.internal.ui.preferences;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.swt.widgets.Control;
17 import org.eclipse.core.resources.IProject;
19 import org.eclipse.ui.PlatformUI;
20 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
22 import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
26 * Content Assist preference page.
28 * Note: Must be public since it is referenced from plugin.xml
33 public class CodeAssistPreferencePage extends PropertyAndPreferencePage {
35 private CodeAssistConfigurationBlock fConfigurationBlock;
38 public void createControl(Composite parent) {
39 IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer();
40 fConfigurationBlock= new CodeAssistConfigurationBlock(getNewStatusChangedListener(), container);
42 super.createControl(parent);
43 PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.JAVA_EDITOR_PREFERENCE_PAGE);
47 protected Control createPreferenceContent(Composite composite) {
48 return fConfigurationBlock.createContents(composite);
52 protected boolean hasProjectSpecificOptions(IProject project) {
57 protected String getPreferencePageID() {
58 return "org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage"; //$NON-NLS-1$
62 protected String getPropertyPageID() {
67 * @see org.eclipse.jface.dialogs.DialogPage#dispose()
70 public void dispose() {
71 if (fConfigurationBlock != null) {
72 fConfigurationBlock.dispose();
78 * @see org.eclipse.jface.preference.IPreferencePage#performDefaults()
81 protected void performDefaults() {
82 super.performDefaults();
83 if (fConfigurationBlock != null) {
84 fConfigurationBlock.performDefaults();
89 * @see org.eclipse.jface.preference.IPreferencePage#performOk()
92 public boolean performOk() {
93 if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) {
96 return super.performOk();
100 * @see org.eclipse.jface.preference.IPreferencePage#performApply()
103 public void performApply() {
104 if (fConfigurationBlock != null) {
105 fConfigurationBlock.performApply();