org.eclipse.fx.ui.controls.filesystem.ResourceEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.eclipse.fx.ui.controls Show documentation
Show all versions of org.eclipse.fx.ui.controls Show documentation
Custom JavaFX controls like a styled text component, ...
/*******************************************************************************
* Copyright (c) 2015 BestSolution.at 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:
* Tom Schindl - initial API and implementation
*******************************************************************************/
package org.eclipse.fx.ui.controls.filesystem;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import javafx.event.Event;
import javafx.event.EventTarget;
import javafx.event.EventType;
import javafx.scene.Node;
/**
* A resource event
*
* @param
* the resource type
*/
public class ResourceEvent extends Event {
private static final EventType> OPEN_RESOURCE = new EventType<>(
"EFX_CONTROL_OPEN_RESOURCE"); //$NON-NLS-1$
/**
* @return the open resource type
*/
@SuppressWarnings("unchecked")
public static EventType> openResourceEvent() {
return (EventType>) OPEN_RESOURCE;
}
private final List resourceItems;
ResourceEvent(Object source, EventTarget target,
EventType> type, List resourceItems) {
super(source, target, type);
this.resourceItems = Collections.unmodifiableList(resourceItems);
}
/**
* Create a new event for resource opening
*
* @param view
* the view
* @param resourceItems
* the items
* @return a new event
*/
public static <@NonNull T extends ResourceItem> ResourceEvent createOpenResource(
Node view, List resourceItems) {
return new ResourceEvent<>(view, view, openResourceEvent(),
resourceItems);
}
/**
* Create a new event for resource opening
*
* @param view
* the view
* @param resourceItems
* the items
* @return a new event
*/
public static <@NonNull T extends ResourceItem> ResourceEvent createOpenResource(
DirectoryTreeView view, List resourceItems) {
return new ResourceEvent<>(view, view, openResourceEvent(),
resourceItems);
}
/**
* @return unmodifiable list of items
*/
public List getResourceItems() {
return this.resourceItems;
}
/**
*
*/
private static final long serialVersionUID = 1L;
}