blob: eedc41755601d22d847626fecd34030f914c9fa9 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010-2011, Istvan Rath and Zoltan Ujhelyi
* 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:
* Zoltan Ujhelyi - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.visualisation;
/**
* The visualisation manager stores and manages different visualisations. It can
* be used to detect whether a specific visualisation had been initialized.
* @author Zoltan Ujhelyi
*/
public class VisualisationManager {
// Currently only a single source-descriptor pair is supported
// HashMap<Object, IVisualisationDescriptor> descriptors;
Object source = null;
IVisualisationDescriptor descriptor = null;
/**
* Loads a visualisation descriptor together with its source element to the
* manager
* @param source
* @param descriptor
*/
public void loadDescriptor(Object source,
IVisualisationDescriptor descriptor) {
this.source = source;
this.descriptor = descriptor;
}
/**
* Removes a visualisation descriptor from the manager
* @param source
*/
public void unloadDescriptor(Object source) {
if (this.source != null && this.source.equals(source)) {
source = null;
descriptor = null;
}
}
/**
* Returns the corresponding visualisation descriptor to its source element
* @param source
* @return the visualisation descriptor
*/
public IVisualisationDescriptor getVisualisation(Object source) {
if (this.source != null && this.source.equals(source)) {
return descriptor;
}
return null;
}
}