1 /******************************************************************************* 2 * Copyright (c) 2000, 2015 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.ui.internal.ide.dialogs; 15 16 import org.eclipse.swt.SWT; 17 import org.eclipse.swt.layout.GridData; 18 import org.eclipse.swt.widgets.Composite; 19 import org.eclipse.swt.widgets.Control; 20 import org.eclipse.ui.dialogs.PreferenceLinkArea; 21 import org.eclipse.ui.internal.dialogs.EditorsPreferencePage; 22 import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; 23 import org.eclipse.ui.internal.tweaklets.TabBehaviour; 24 import org.eclipse.ui.internal.tweaklets.Tweaklets; 25 import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; 26 27 /** 28 * Extends the Editors preference page with IDE-specific settings. 29 * 30 * Note: want IDE settings to appear in main Editors preference page (via 31 * subclassing), however the superclass, EditorsPreferencePage, is internal 32 */ 33 public class IDEEditorsPreferencePage extends EditorsPreferencePage { 34 35 @Override createContents(Composite parent)36 protected Control createContents(Composite parent) { 37 Composite composite = createComposite(parent); 38 39 PreferenceLinkArea fileEditorsArea = new PreferenceLinkArea(composite, SWT.NONE, 40 "org.eclipse.ui.preferencePages.FileEditors", IDEWorkbenchMessages.IDEEditorsPreferencePage_WorkbenchPreference_FileEditorsRelatedLink,//$NON-NLS-1$ 41 (IWorkbenchPreferenceContainer) getContainer(),null); 42 43 GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); 44 fileEditorsArea.getControl().setLayoutData(data); 45 46 PreferenceLinkArea contentTypeArea = new PreferenceLinkArea(composite, SWT.NONE, 47 "org.eclipse.ui.preferencePages.ContentTypes", IDEWorkbenchMessages.IDEEditorsPreferencePage_WorkbenchPreference_contentTypesRelatedLink,//$NON-NLS-1$ 48 (IWorkbenchPreferenceContainer) getContainer(),null); 49 50 data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); 51 contentTypeArea.getControl().setLayoutData(data); 52 53 PreferenceLinkArea appearanceArea = new PreferenceLinkArea(composite, SWT.NONE, 54 "org.eclipse.ui.preferencePages.Views", IDEWorkbenchMessages.IDEEditorsPreferencePage_WorkbenchPreference_viewsRelatedLink,//$NON-NLS-1$ 55 (IWorkbenchPreferenceContainer) getContainer(),null); 56 57 data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); 58 appearanceArea.getControl().setLayoutData(data); 59 60 createEditorHistoryGroup(composite); 61 62 createSpace(composite); 63 createShowMultipleEditorTabsPref(composite); 64 createAllowInplaceEditorPref(composite); 65 createUseIPersistablePref(composite); 66 createPromptWhenStillOpenPref(composite); 67 createEditorReuseGroup(composite); 68 ((TabBehaviour)Tweaklets.get(TabBehaviour.KEY)).setPreferenceVisibility(editorReuseGroup, showMultipleEditorTabs); 69 70 applyDialogFont(composite); 71 72 super.setHelpContext(parent); 73 74 return composite; 75 } 76 77 } 78