use of org.eclipse.sirius.viewpoint.description.Viewpoint in project Palladio-Editors-Sirius by PalladioSimulator.
the class Activator method start.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.
* BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
Set<Viewpoint> viewpoints = ViewpointRegistry.getInstance().getViewpoints();
// Set viewpoint constants
for (final Viewpoint v : viewpoints) {
if (v.getName().equals(VIEWPOINT_NAME)) {
this.viewpoint = v;
break;
}
}
// Set diagram description constants
for (final RepresentationDescription representationDescription : this.viewpoint.getOwnedRepresentations()) {
if (representationDescription.getName().equals(REPRESENTATION_NAME)) {
this.representationDescription = representationDescription;
break;
}
}
}
use of org.eclipse.sirius.viewpoint.description.Viewpoint in project Palladio-Editors-Sirius by PalladioSimulator.
the class Activator method start.
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
Activator.plugin = this;
Set<Viewpoint> viewpoints = ViewpointRegistry.getInstance().getViewpoints();
// Set viewpoint constants
for (final Viewpoint v : viewpoints) {
if (v.getName().equals(VIEWPOINT_NAME)) {
this.viewpoint = v;
break;
}
}
// Set diagram description constants
for (final RepresentationDescription representationDescription : this.viewpoint.getOwnedRepresentations()) {
if (representationDescription.getName().equals(REPRESENTATION_NAME)) {
this.representationDescription = representationDescription;
break;
}
}
}
use of org.eclipse.sirius.viewpoint.description.Viewpoint in project Palladio-Editors-Sirius by PalladioSimulator.
the class Activator method stop.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(final BundleContext context) throws Exception {
plugin = null;
if (viewpoints != null) {
for (final Viewpoint viewpoint : viewpoints) {
ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint);
}
viewpoints.clear();
viewpoints = null;
}
super.stop(context);
}
use of org.eclipse.sirius.viewpoint.description.Viewpoint in project Palladio-Editors-Sirius by PalladioSimulator.
the class Activator method stop.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.
* BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
if (viewpoints != null) {
for (final Viewpoint viewpoint : viewpoints) {
ViewpointRegistry.getInstance().disposeFromPlugin(viewpoint);
}
viewpoints.clear();
viewpoints = null;
}
super.stop(context);
}
use of org.eclipse.sirius.viewpoint.description.Viewpoint in project Palladio-Editors-Sirius by PalladioSimulator.
the class NewModelWizard method createModel.
private void createModel(final IProject project, final boolean createRepresentation, final String representationName, final IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Creating Model File", 6000);
if (!project.hasNature(ModelingProject.NATURE_ID)) {
ModelingProjectManager.INSTANCE.convertToModelingProject(project, SubMonitor.convert(monitor, "Converting to Modeling Project", 1000));
}
final URI representationsURI = SiriusCustomUtil.getRepresentationsURI(project);
final Session session = SessionManager.INSTANCE.getSession(representationsURI, SubMonitor.convert(monitor, "Getting Session", 1000));
createResource(session, SubMonitor.convert(monitor, "Creating Resource", 1000));
HashSet<Viewpoint> selectedViewpoints = new HashSet<Viewpoint>();
selectedViewpoints.add(viewpoint);
SiriusCustomUtil.selectViewpoints(session, selectedViewpoints, false, SubMonitor.convert(monitor, "Selecting Viewpoint", 1000));
// Apparently the selected viewpoint's instance is not the same as the passed instance
// We retrieve here the actually selected Viewpoint
Viewpoint selectedViewpoint = SiriusCustomUtil.getSelectedViewpointByName(session, viewpoint.getName());
RepresentationDescription actualRepresentationDescription = SiriusCustomUtil.findDescription(selectedViewpoint, representationDescription.getName());
if (createRepresentation) {
final DRepresentation createdRepresentation = SiriusCustomUtil.createRepresentation(session, representationName, actualRepresentationDescription, this.modelObject, SubMonitor.convert(monitor, "Creating Representation", 1000));
DialectUIManager.INSTANCE.openEditor(session, createdRepresentation, SubMonitor.convert(monitor, "Opening representation", 1000));
}
monitor.done();
}
Aggregations