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

org.eclipse.jface.dialogs.PageChangingEvent Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 * Copyright (c) 2006, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     Chris Gross ([email protected]) - initial API and implementation for bug 16179
 *     IBM Corporation - revisions to initial contribution
 *******************************************************************************/
package org.eclipse.jface.dialogs;

import java.util.EventObject;

import org.eclipse.core.runtime.Assert;

/**
 * Event object describing an IDialogPage in the midst of changing.
 *
 * @see IPageChangingListener
 * @since 3.3
 */
public class PageChangingEvent extends EventObject {


	private static final long serialVersionUID = 1L;

	private Object currentPage;

	private Object targetPage;

	/**
	 * Public field that dictates if the page change will successfully change.
	 *
	 * Set this field to false to prevent the page from changing.
	 *
	 * Default value is true.
	 */
	public boolean doit = true;

	/**
	 * Creates a new event for the given source, selected (current) page and
	 * direction.
	 *
	 * @param source
	 *            the page changing provider (the source of this event)
	 * @param currentPage
	 *            the current page. In the JFace provided dialogs this will be
	 *            an IDialogPage.
	 * @param targetPage
	 *            the target page. In the JFace provided dialogs this will be an
	 *            IDialogPage.
	 */
	public PageChangingEvent(Object source, Object currentPage, Object targetPage) {
		super(source);
		Assert.isNotNull(currentPage);
		Assert.isNotNull(targetPage);
		this.currentPage = currentPage;
		this.targetPage = targetPage;
	}

	/**
	 * Returns the current page from which the page change originates.
	 *
	 * @return the current page. In dialogs implemented by JFace,
	 * 		this will be an IDialogPage.
	 */
	public Object getCurrentPage() {
		return currentPage;
	}

	/**
	 * Returns the target page to change to.
	 *
	 * @return the target page. In dialogs implemented by JFace,
	 * 		this will be an IDialogPage.
	 */
	public Object getTargetPage() {
		return targetPage;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy