All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.ui.preferences.ViewSettingsDialog Maven / Gradle / Ivy

There is a newer version: 3.108.0.v20160602-1232
Show newest version
/*******************************************************************************
 * Copyright (c) 2005, 2006 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.ui.preferences;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

/**
 * The ViewSettingsDialog is an abstract class that
 * provides some common functionality for view preferences.
 *
 * @since 3.1
 */
public class ViewSettingsDialog extends Dialog {

	private static int DEFAULTS_BUTTON_ID = 25;

	/**
	 * Create a new instance of the receiver.
	 * @param parentShell
	 */
	public ViewSettingsDialog(Shell parentShell) {
		super(parentShell);
	}

	@Override
	protected void buttonPressed(int buttonId) {
		if (buttonId == DEFAULTS_BUTTON_ID) {
			performDefaults();
		}
		super.buttonPressed(buttonId);
	}

	 /**
     * Performs special processing when this dialog Defaults button has been pressed.
     * 

* This is a framework hook method for subclasses to do special things when * the Defaults button has been pressed. * Subclasses may override, but should call super.performDefaults. *

*/ protected void performDefaults() { //Do nothing by default } @Override protected void createButtonsForButtonBar(Composite parent) { parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createButton(parent, DEFAULTS_BUTTON_ID, JFaceResources.getString("defaults"), false); //$NON-NLS-1$ Label l = new Label(parent, SWT.NONE); l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l = new Label(parent, SWT.NONE); l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = (GridLayout) parent.getLayout(); layout.numColumns += 2; layout.makeColumnsEqualWidth = false; super.createButtonsForButtonBar(parent); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy