[398367] Adds Papyrus CSS customization support.
[EMFCompare2.git] / plugins / org.eclipse.emf.compare.diagram.ide.ui.papyrus / src / org / eclipse / emf / compare / diagram / ide / ui / papyrus / internal / CssInstallationHook.java
blob7a693092ed6cb9c7179f1a94e5e35afd4ba24760
1 /*******************************************************************************
2 * Copyright (c) 2014 Obeo.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Obeo - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.emf.compare.diagram.ide.ui.papyrus.internal;
13 import java.util.Collection;
15 import org.eclipse.emf.common.util.URI;
16 import org.eclipse.emf.compare.ide.hook.IResourceSetHook;
17 import org.eclipse.emf.ecore.resource.ResourceSet;
18 import org.eclipse.papyrus.infra.gmfdiag.css.helper.CSSHelper;
20 /**
21 * Hook in the EMF Compare {@link ResourceSet} in order to make it able to handle papyrus CSS features.
23 * @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
25 public class CssInstallationHook implements IResourceSetHook {
27 /**
28 * {@inheritDoc}
30 * @see org.eclipse.emf.compare.ide.internal.utils.IResourceSetHook#handle(java.lang.Iterable)
32 public boolean isHookFor(Collection<? extends URI> uris) {
33 // Looks for a papyrus notation file.
34 for (URI uri : uris) {
35 // FIXME this is a realy weak test. We can not use the
36 // triple of papyrus file "x.di", "x.notation" and "x.uml" since one or more of these files might
37 // not be part of the uri list. This might change soon since we might need to force loading uml if
38 // the notation file is loaded see https://bugs.eclipse.org/bugs/show_bug.cgi?id=443187.
39 if ("notation".equals(uri.fileExtension())) { //$NON-NLS-1$
40 return true;
43 return false;
46 /**
47 * {@inheritDoc}
49 * @see org.eclipse.emf.compare.ide.hook.IResourceSetHook#preLoadingHook(org.eclipse.emf.ecore.resource.ResourceSet,
50 * java.util.Collection)
52 public void preLoadingHook(ResourceSet resourceSet, Collection<? extends URI> uris) {
53 if (!CSSHelper.isCSSSupported(resourceSet)) {
54 CSSHelper.installCSSSupport(resourceSet);
59 /**
60 * {@inheritDoc}
62 * @see org.eclipse.emf.compare.ide.hook.IResourceSetHook#postLoadingHook(org.eclipse.emf.ecore.resource.ResourceSet,
63 * java.util.Collection)
65 public void postLoadingHook(ResourceSet resourceSet, Collection<? extends URI> uris) {
66 // Nothing to do