blob: ffd02b307f85b306f51d3940032ba9c3f391b357 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
* 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:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.css.engine;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.e4.ui.css.core.dom.IElementProvider;
import org.eclipse.e4.ui.css.core.engine.CSSElementContext;
import org.eclipse.papyrus.infra.gmfdiag.common.handler.IRefreshHandlerPart;
import org.eclipse.papyrus.infra.gmfdiag.common.handler.RefreshHandler;
import org.eclipse.papyrus.infra.gmfdiag.css.Activator;
import org.eclipse.ui.IEditorPart;
import org.w3c.dom.Element;
/**
* The base CSS Engine. It contains the default stylesheet, which will be applied
* in all cases (With the lowest priority).
*
* It should not be used directly.
*
* @author Camille Letavernier
*
* @see DiagramCSSEngine
*/
@SuppressWarnings("restriction")
public class BaseCSSEngine extends ExtendedCSSEngineImpl implements IRefreshHandlerPart {
private BaseCSSEngine() {
RefreshHandler.register(this);
try {
styleSheetURLs.add(new URL("platform:/plugin/" + Activator.PLUGIN_ID + "/resources/base.css")); //$NON-NLS-1$ //$NON-NLS-2$
} catch (MalformedURLException ex) {
Activator.log.error(ex);
}
}
/**
* The Singleton instance of BaseCSSEngine
*/
public static final ExtendedCSSEngine INSTANCE = new BaseCSSEngine();
/**
* @see org.eclipse.papyrus.infra.gmfdiag.common.handler.IRefreshHandlerPart#refresh(org.eclipse.ui.IEditorPart)
*/
@Override
public void refresh(IEditorPart editorPart) {
// Resets this engine, regardless of the current editor
this.reset();
}
// Unsupported operations. The BaseCSSEngine should never be used directly.
@Override
public Element getElement(Object node) {
throw new UnsupportedOperationException();
}
@Override
public IElementProvider getElementProvider() {
throw new UnsupportedOperationException();
}
@Override
public void setElementProvider(IElementProvider elementProvider) {
throw new UnsupportedOperationException();
}
@Override
public CSSElementContext getCSSElementContext(Object node) {
throw new UnsupportedOperationException();
}
}
|