Search in sources :

Example 11 with Viewpoint

use of org.eclipse.sirius.viewpoint.description.Viewpoint in project Palladio-Editors-Sirius by PalladioSimulator.

the class NewPalladioProjectWizard method activateViewpoints.

/**
 * Activate viewpoints.
 */
private void activateViewpoints(final IProject projectHandle, final SubMonitor subMonitor) {
    final URI representationsURI = SiriusCustomUtil.getRepresentationsURI(projectHandle);
    final Session session = SessionManager.INSTANCE.getSession(representationsURI, subMonitor);
    final Set<Viewpoint> registry = ViewpointRegistry.getInstance().getViewpoints();
    final HashSet<Viewpoint> viewpoints = new HashSet<>();
    final List<String> extensions = getExtensions(session);
    for (final Viewpoint viewpoint : registry) {
        final String ext = viewpoint.getModelFileExtension();
        if (extensions.contains(ext)) {
            viewpoints.add(viewpoint);
        }
    }
    SiriusCustomUtil.selectViewpoints(session, viewpoints, true, subMonitor);
}
Also used : Viewpoint(org.eclipse.sirius.viewpoint.description.Viewpoint) URI(org.eclipse.emf.common.util.URI) Session(org.eclipse.sirius.business.api.session.Session) HashSet(java.util.HashSet)

Example 12 with Viewpoint

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;
        }
    }
}
Also used : RepresentationDescription(org.eclipse.sirius.viewpoint.description.RepresentationDescription) Viewpoint(org.eclipse.sirius.viewpoint.description.Viewpoint)

Example 13 with Viewpoint

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;
        }
    }
}
Also used : RepresentationDescription(org.eclipse.sirius.viewpoint.description.RepresentationDescription) Viewpoint(org.eclipse.sirius.viewpoint.description.Viewpoint)

Example 14 with Viewpoint

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);
}
Also used : Viewpoint(org.eclipse.sirius.viewpoint.description.Viewpoint)

Example 15 with Viewpoint

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;
    viewpoints = new HashSet<Viewpoint>();
    viewpoints.addAll(ViewpointRegistry.getInstance().registerFromPlugin(PLUGIN_ID + "/description/seff.odesign"));
    // 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;
        }
    }
}
Also used : RepresentationDescription(org.eclipse.sirius.viewpoint.description.RepresentationDescription) Viewpoint(org.eclipse.sirius.viewpoint.description.Viewpoint)

Aggregations

Viewpoint (org.eclipse.sirius.viewpoint.description.Viewpoint)18 RepresentationDescription (org.eclipse.sirius.viewpoint.description.RepresentationDescription)8 HashSet (java.util.HashSet)3 Session (org.eclipse.sirius.business.api.session.Session)3 URI (org.eclipse.emf.common.util.URI)2 DRepresentation (org.eclipse.sirius.viewpoint.DRepresentation)2 ArrayList (java.util.ArrayList)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Command (org.eclipse.emf.common.command.Command)1 EObject (org.eclipse.emf.ecore.EObject)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 CreateRepresentationCommand (org.eclipse.sirius.business.api.dialect.command.CreateRepresentationCommand)1 ViewpointSelectionCallback (org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelectionCallback)1 ChangeViewpointSelectionCommand (org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand)1