diff options
Diffstat (limited to 'plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus')
9 files changed, 0 insertions, 699 deletions
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSS.xtext b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSS.xtext deleted file mode 100644 index 005d09ed8c0..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSS.xtext +++ /dev/null @@ -1,208 +0,0 @@ -/***************************************************************************** - * 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 - *****************************************************************************/ -/** - * CSS 2.1 Grammar - */ -grammar org.eclipse.papyrus.infra.gmfdiag.CSS hidden(ML_COMMENT) -//with org.eclipse.xtext.common.Terminals -import "http://www.eclipse.org/emf/2002/Ecore" as ecore -generate css "http://www.eclipse.org/papyrus/infra/gmfdiag/CSS" - -//Do not create a Stylesheet for WS* (This seems to cause a serialization problem when editing an EMF Model from an Empty file) -//Do not ignore WS as @charset must be followed by exactly one Space. -Stylesheet: - ('@charset ' charset=STRING ';')? - (WS | CDO | CDC)* (imports+=Import (CDO WS* | CDC WS*)*)* - (contents+=Content (CDO WS* | CDC WS*)*)*; - -Content: - Ruleset | Media | Page; - -Import: - '@import' (WS* string=STRING | WS uri=Uri) WS* (media+=ID WS* (',' WS* media+=ID)*)? ';' WS*; - -Media: - '@media' WS media+=ID WS* (',' WS* media+=ID)* '{' WS* (rules+=Ruleset)* '}' WS*; - -Page: - {Page} - '@page' WS* pseudo=PseudoPage? '{' WS* declarations+=Declaration? (';' WS* declarations+=Declaration?)* '}' WS*; - -PseudoPage: - ':' id=ID WS*; - -Ruleset: - selectors+=Selector (',' WS* selectors+=Selector)* '{' WS* properties+=Declaration? (';' WS* - properties+=Declaration?)* '}' WS*; - -Selector: - (SimpleSelector WS* | CompositeSelector); - - //left=SimpleSelector (combinator=Combinator right=Selector | WS+ (combinator=Combinator? right=Selector)?)?; -CompositeSelector: - left=SimpleSelector (WS+ | WS* combinator=Combinator) right=Selector; - -SimpleSelector: - (elementName=(ID | '*') condition+=(SelectorCondition)*) | (condition+=(SelectorCondition)+); - -SelectorCondition: - CSSId | Class | Attribute | Pseudo; - -Combinator: - kind=KIND WS*; - -Declaration: - property=ID WS* ':' WS* expression=Expression (important?=T_IMPORTANT WS*)?; - -Expression: - terms=Term (subterms+=Subterm)*; - -Subterm: - operator=Operator? term=Term; - -Term: - (Number | Percentage | Length | Ems | Exs | Angle | Time | Frequency | Name | StringValue | Uri | HexColor | Function) - WS*; - -Function: - name=ID '(' WS* args=Expression ')'; - -Name: - value=ID; - - //Terms -Number: - op=UnaryOperator? value=T_NUM; - -Percentage: - op=UnaryOperator? value=T_NUM unit=PC_UNIT; - -Length: - op=UnaryOperator? value=T_NUM unit=LEN_UNIT; - -Ems: - op=UnaryOperator? value=T_NUM unit=EM_UNIT; - -Exs: - op=UnaryOperator? value=T_NUM unit=EX_UNIT; - -Angle: - op=UnaryOperator? value=T_NUM unit=ANGLE_UNIT; - -Time: - op=UnaryOperator? value=T_NUM unit=TIME_UNIT; - -Frequency: - op=UnaryOperator? value=T_NUM unit=FREQ_UNIT; - -Uri: - 'url(' WS? value=STRING WS? ')' /* | 'url(' WS? url=URL WS? ')' */; //TODO -StringValue: - value=STRING; - - //terminal URL: -// (('!' | '#' | '$' | '%' | '&' | '*' | '-' | '~') /* | NON_ASCII | ESCAPE */)*; - -//terminal NON_ASCII: -// (\0240..\0377) //Chars 160 to 255 -//; -//terminal UNICODE: -// '\\' HEXA (HEXA (HEXA (HEXA (HEXA (HEXA)?)?)?)?)? ('\r\n' | ' ' | '\t' | '\r' | '\n')?; -// -//terminal ESCAPE: -// UNICODE | ('\\' !('\r' | '\n' | '0'..'9' | 'a'..'f' | 'A'..'F')); -HexColor: - value=HASH; - -Operator: - '/' WS* | ',' WS*; - -Class: - class=T_CLASS; - -Attribute: - '[' WS* name=ID WS* value=AttributeValue? ']'; - -AttributeValue: - operator=ATTRIBUTE_OP WS* value=(ID | STRING) WS*; - -Pseudo: - ':' (pseudo=ID | (pseudo=ID '(' WS* (args=ID WS*)? ')')); - -CSSId: - value=HASH; - -UnaryOperator: - operator=UNARY; - -enum UNARY: - NEG='-' | PLUS='+'; - -enum KIND: - FIRST_CHILD='>' | SIBLING='+'; - -enum ATTRIBUTE_OP: - EQUALS='=' | CONTAINS='~=' | UNEQUALS='!='; - -terminal HASH: - '#' ('A'..'Z' | 'a'..'z' | '0'..'9')+; - -terminal T_CLASS: - '.' ID; - -terminal T_IMPORTANT: - '!important'; //This is not the exact CSS Grammar -terminal PC_UNIT: - '%'; - -terminal LEN_UNIT: - 'px' | 'cm' | 'mm' | 'in' | 'pt' | 'pc'; - -terminal EM_UNIT: - 'em'; - -terminal EX_UNIT: - 'ex'; - -terminal ANGLE_UNIT: - 'deg' | 'rad' | 'grad'; - -terminal TIME_UNIT: - 's' | 'ms'; - -terminal FREQ_UNIT: - 'hz' | 'mhz'; - -terminal T_NUM: - ('0'..'9')+ | ('0'..'9')* "." ('0'..'9')+; - -terminal ID: - '-'? ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9' | '-')*; - -terminal STRING: - '"' ('\\' ('b' | 't' | 'n' | 'f' | 'r' | 'u' | '"' | "'" | '\\') | !('\\' | '"'))* '"' | - "'" ('\\' ('b' | 't' | 'n' | 'f' | 'r' | 'u' | '"' | "'" | '\\') | !('\\' | "'"))* "'"; - -terminal CDO: - '<!--'; - -terminal CDC: - '-->'; - -terminal ML_COMMENT: - '/*'->'*/'; //Doesn't exactly match CSS Comments... */ can be protected by \ : \*/ doesn't close the comment in XText, while it does in CSS -terminal WS: - (' ' | '\t' | '\r' | '\n')+; - -terminal ANY_OTHER: - .; - diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSSRuntimeModule.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSSRuntimeModule.java deleted file mode 100644 index 54d7b442532..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSSRuntimeModule.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * generated by Xtext - */ -package org.eclipse.papyrus.infra.gmfdiag; - -import org.eclipse.papyrus.infra.gmfdiag.converter.CSSTerminalConverter; -import org.eclipse.xtext.conversion.IValueConverterService; - -/** - * Use this class to register components to be used at runtime / without the Equinox extension registry. - */ -public class CSSRuntimeModule extends org.eclipse.papyrus.infra.gmfdiag.AbstractCSSRuntimeModule { - - @Override - public Class<? extends IValueConverterService> bindIValueConverterService() { - return CSSTerminalConverter.class; - } -} diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSSStandaloneSetup.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSSStandaloneSetup.java deleted file mode 100644 index a9b3e35e973..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/CSSStandaloneSetup.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.papyrus.infra.gmfdiag; - -/** - * Initialization support for running Xtext languages - * without equinox extension registry - */ -public class CSSStandaloneSetup extends CSSStandaloneSetupGenerated { - - public static void doSetup() { - new CSSStandaloneSetup().createInjectorAndDoEMFRegistration(); - } -} diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/GenerateCSS.mwe2 b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/GenerateCSS.mwe2 deleted file mode 100644 index 4060f4a2ca2..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/GenerateCSS.mwe2 +++ /dev/null @@ -1,138 +0,0 @@ -module org.eclipse.papyrus.infra.gmfdiag.GenerateCSS - -import org.eclipse.emf.mwe.utils.* -import org.eclipse.xtext.generator.* -import org.eclipse.xtext.ui.generator.* - -var grammarURI = "classpath:/org/eclipse/papyrus/infra/gmfdiag/CSS.xtext" -var file.extensions = "css" -var projectName = "org.eclipse.papyrus.infra.gmfdiag.css.xtext" -var runtimeProject = "../${projectName}" - -Workflow { - bean = StandaloneSetup { - scanClassPath = true - platformUri = "${runtimeProject}/.." - // The following two lines can be removed, if Xbase is not used. - registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage" - registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel" - } - - component = DirectoryCleaner { - directory = "${runtimeProject}/src-gen" - } - - component = DirectoryCleaner { - directory = "${runtimeProject}.ui/src-gen" - } - - component = Generator { - pathRtProject = runtimeProject - pathUiProject = "${runtimeProject}.ui" - pathTestProject = "${runtimeProject}.tests" - projectNameRt = projectName - projectNameUi = "${projectName}.ui" - language = { - uri = grammarURI - fileExtensions = file.extensions - - // Java API to access grammar elements (required by several other fragments) - fragment = grammarAccess.GrammarAccessFragment {} - - // generates Java API for the generated EPackages - fragment = ecore.EcoreGeneratorFragment { - // referencedGenModels = " - // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel, - // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel - // " - } - - // Serializer 2.0 - fragment = serializer.SerializerFragment { - generateStub = false - } - - // the serialization component (1.0) - // fragment = parseTreeConstructor.ParseTreeConstructorFragment {} - - // a custom ResourceFactory for use with EMF - fragment = resourceFactory.ResourceFactoryFragment { - fileExtensions = file.extensions - } - - // The antlr parser generator fragment. - fragment = parser.antlr.XtextAntlrGeneratorFragment { - // options = { - // backtrack = true - // } - } - - // java-based API for validation - fragment = validation.JavaValidatorFragment { - // composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" - // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" - } - - // scoping and exporting API - // fragment = scoping.ImportURIScopingFragment {} - // fragment = exporting.SimpleNamesFragment {} - - // scoping and exporting API - fragment = scoping.ImportNamespacesScopingFragment {} - fragment = exporting.QualifiedNamesFragment {} - fragment = builder.BuilderIntegrationFragment {} - - // generator API - fragment = generator.GeneratorFragment { - generateMwe = false - generateJavaMain = false - } - - // formatter API - fragment = formatting.FormatterFragment {} - - // labeling API - fragment = labeling.LabelProviderFragment {} - - // outline API - fragment = outline.OutlineTreeProviderFragment {} - fragment = outline.QuickOutlineFragment {} - - // quickfix API - fragment = quickfix.QuickfixProviderFragment {} - - // content assist API - fragment = contentAssist.JavaBasedContentAssistFragment {} - - // generates a more lightweight Antlr parser and lexer tailored for content assist - fragment = parser.antlr.XtextAntlrUiGeneratorFragment {} - - // generates junit test support classes into Generator#pathTestProject - fragment = junit.Junit4Fragment {} - - // project wizard (optional) - // fragment = projectWizard.SimpleProjectWizardFragment { - // generatorProjectName = "${projectName}" - // modelFileExtension = file.extensions - // } - - // rename refactoring - fragment = refactoring.RefactorElementNameFragment {} - - // provides the necessary bindings for java types integration - fragment = types.TypesGeneratorFragment {} - - // generates the required bindings only if the grammar inherits from Xbase - fragment = xbase.XbaseGeneratorFragment {} - - // provides a preference page for template proposals - fragment = templates.CodetemplatesGeneratorFragment {} - - // provides a compare view - fragment = compare.CompareFragment { - fileExtensions = file.extensions - } - - } - } -} diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/converter/CSSTerminalConverter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/converter/CSSTerminalConverter.java deleted file mode 100644 index be726bb03cd..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/converter/CSSTerminalConverter.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.papyrus.infra.gmfdiag.converter;
-
-import org.eclipse.xtext.common.services.DefaultTerminalConverters;
-import org.eclipse.xtext.conversion.IValueConverter;
-import org.eclipse.xtext.conversion.ValueConverter;
-import org.eclipse.xtext.conversion.ValueConverterException;
-import org.eclipse.xtext.conversion.impl.AbstractNullSafeConverter;
-import org.eclipse.xtext.nodemodel.INode;
-
-
-public class CSSTerminalConverter extends DefaultTerminalConverters {
-
- @ValueConverter(rule = "HASH")
- public IValueConverter<String> HASH() {
- return new AbstractNullSafeConverter<String>() {
-
- @Override
- protected String internalToString(String value) {
- return '#' + value;
- }
-
- @Override
- protected String internalToValue(String string, INode node) throws ValueConverterException {
- return string.substring(1);
- }
-
- };
- }
-
- @ValueConverter(rule = "T_CLASS")
- public IValueConverter<String> T_CLASS() {
- return new AbstractNullSafeConverter<String>() {
-
- @Override
- protected String internalToString(String value) {
- return '.' + value;
- }
-
- @Override
- protected String internalToValue(String string, INode node) throws ValueConverterException {
- return string.substring(1);
- }
-
- };
- }
-
- @Override
- @ValueConverter(rule = "ID")
- public IValueConverter<String> ID() {
- return new AbstractNullSafeConverter<String>() {
-
- @Override
- protected String internalToString(String value) {
- return value;
- }
-
- @Override
- protected String internalToValue(String string, INode node) throws ValueConverterException {
- return string;
- }
-
- };
- }
-}
diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/formatting/CSSFormatter.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/formatting/CSSFormatter.java deleted file mode 100644 index e6bc62976c8..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/formatting/CSSFormatter.java +++ /dev/null @@ -1,103 +0,0 @@ -/***************************************************************************** - * 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.formatting; - -import org.eclipse.papyrus.infra.gmfdiag.services.CSSGrammarAccess; -import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter; -import org.eclipse.xtext.formatting.impl.FormattingConfig; - -/** - * This class contains custom formatting description. - * - * see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting - * on how and when to use it - * - * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an example - */ -public class CSSFormatter extends AbstractDeclarativeFormatter { - - - @Override - protected void configureFormatting(FormattingConfig c) { - // It's usually a good idea to activate the following three statements. - // They will add and preserve newlines around comments - // c.setLinewrap(0, 1, 2).before(getGrammarAccess().getSL_COMMENTRule()); - // c.setLinewrap(0, 1, 2).before(getGrammarAccess().getML_COMMENTRule()); - // c.setLinewrap(0, 1, 1).after(getGrammarAccess().getML_COMMENTRule()); - - // Semantic formatting (Prevent XText from adding invalid spaces) - - // c.setWhitespaceRule(getGrammarAccess().getWSRule()); - // c.setNoSpace().around(getGrammarAccess().getWSRule()); - c.setNoSpace().around(getGrammarAccess().getANY_OTHERRule()); - - // Preserve the charset spaces - c.setNoSpace().after(getGrammarAccess().getStylesheetAccess().getCharsetKeyword_0_0()); - c.setNoSpace().before(getGrammarAccess().getStylesheetAccess().getSemicolonKeyword_0_2()); - - // No spaces before units - c.setNoSpace().before(getGrammarAccess().getEM_UNITRule()); - c.setNoSpace().before(getGrammarAccess().getFREQ_UNITRule()); - c.setNoSpace().before(getGrammarAccess().getTIME_UNITRule()); - c.setNoSpace().before(getGrammarAccess().getEX_UNITRule()); - c.setNoSpace().before(getGrammarAccess().getPC_UNITRule()); - c.setNoSpace().before(getGrammarAccess().getANGLE_UNITRule()); - c.setNoSpace().before(getGrammarAccess().getLEN_UNITRule()); - - // No spaces between unary operator and number - c.setNoSpace().after(getGrammarAccess().getUnaryOperatorRule()); - c.setNoSpace().before(getGrammarAccess().getNumberRule()); - - // No spaces before simpleSelector condition - c.setNoSpace().before(getGrammarAccess().getSelectorConditionRule()); - c.setNoSpace().around(getGrammarAccess().getPseudoAccess().getColonKeyword_0()); - c.setNoSpace().after(getGrammarAccess().getPseudoAccess().getPseudoAssignment_1_1_0()); - - // Pretty printing - - // c.setWrappedLineIndentation(4); - - // Charset - c.setLinewrap(2).after(getGrammarAccess().getStylesheetAccess().getSemicolonKeyword_0_2()); - - - // Declarations - c.setNoSpace().after(getGrammarAccess().getDeclarationRule()); - c.setNoSpace().before(getGrammarAccess().getDeclarationAccess().getColonKeyword_2()); - c.setSpace(" ").after(getGrammarAccess().getDeclarationAccess().getColonKeyword_2()); - // c.setNoSpace().around(getGrammarAccess().getTermRule()); - c.setNoLinewrap().before(getGrammarAccess().getRulesetAccess().getSemicolonKeyword_5_0()); - c.setNoSpace().before(getGrammarAccess().getRulesetAccess().getSemicolonKeyword_5_0()); - - c.setIndentationIncrement().after(getGrammarAccess().getRulesetAccess().getLeftCurlyBracketKeyword_2()); - c.setLinewrap().after(getGrammarAccess().getRulesetAccess().getLeftCurlyBracketKeyword_2()); - - - // Attribute - c.setNoSpace().after(getGrammarAccess().getAttributeAccess().getLeftSquareBracketKeyword_0()); - c.setNoSpace().before(getGrammarAccess().getAttributeAccess().getRightSquareBracketKeyword_5()); - c.setNoSpace().around(getGrammarAccess().getAttributeValueAccess().getOperatorAssignment_0()); - - // Ruleset - c.setIndentationDecrement().before(getGrammarAccess().getRulesetAccess().getRightCurlyBracketKeyword_6()); - c.setLinewrap().before(getGrammarAccess().getRulesetAccess().getRightCurlyBracketKeyword_6()); - // c.setLinewrap(2).after(getGrammarAccess().getContentRule()); - c.setLinewrap(2).after(getGrammarAccess().getRulesetAccess().getRightCurlyBracketKeyword_6()); - - c.setLinewrap().after(getGrammarAccess().getRulesetAccess().getSemicolonKeyword_5_0()); - } - - @Override - public CSSGrammarAccess getGrammarAccess() { - return (CSSGrammarAccess) super.getGrammarAccess(); - } -} diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.xtend b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.xtend deleted file mode 100644 index 2c6d3225ca7..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/generator/CSSGenerator.xtend +++ /dev/null @@ -1,15 +0,0 @@ -/* - * generated by Xtext - */ -package org.eclipse.papyrus.infra.gmfdiag.generator - -import org.eclipse.emf.ecore.resource.Resource -import org.eclipse.xtext.generator.IGenerator -import org.eclipse.xtext.generator.IFileSystemAccess - -class CSSGenerator implements IGenerator { - - override void doGenerate(Resource resource, IFileSystemAccess fsa) { - //TODO implement me - } -} diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/scoping/CSSScopeProvider.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/scoping/CSSScopeProvider.java deleted file mode 100644 index 0434fc9806c..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/scoping/CSSScopeProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * generated by Xtext - */ -package org.eclipse.papyrus.infra.gmfdiag.scoping; - -import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider; - -/** - * This class contains custom scoping description. - * - * see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#scoping - * on how and when to use it - * - */ -public class CSSScopeProvider extends AbstractDeclarativeScopeProvider { - -} diff --git a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/validation/CSSJavaValidator.java b/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/validation/CSSJavaValidator.java deleted file mode 100644 index 7baf546c762..00000000000 --- a/plugins/infra/gmfdiag/css/org.eclipse.papyrus.infra.gmfdiag.css.xtext/src/org/eclipse/papyrus/infra/gmfdiag/validation/CSSJavaValidator.java +++ /dev/null @@ -1,124 +0,0 @@ -/***************************************************************************** - * 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.validation; - - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.papyrus.infra.gmfdiag.css.Attribute; -import org.eclipse.papyrus.infra.gmfdiag.css.CssPackage; -import org.eclipse.papyrus.infra.gmfdiag.css.Expression; -import org.eclipse.papyrus.infra.gmfdiag.css.Function; -import org.eclipse.papyrus.infra.gmfdiag.css.HexColor; -import org.eclipse.papyrus.infra.gmfdiag.css.Number; -import org.eclipse.papyrus.infra.gmfdiag.css.SimpleSelector; -import org.eclipse.papyrus.infra.gmfdiag.css.Subterm; -import org.eclipse.papyrus.infra.gmfdiag.css.Term; -import org.eclipse.papyrus.infra.gmfdiag.css.UNARY; -import org.eclipse.xtext.validation.Check; - - -public class CSSJavaValidator extends AbstractCSSJavaValidator { - - public static final String INVALID_HEX_COLOR = "InvalidHexColor"; - - public static final String EMPTY_ELEMENT_NAME = "EmptyElementName"; - - // //////////////////////// - // EMF + XText // - // //////////////////////// - @Check - public void checkHexColor(HexColor color) { - if (!color.getValue().matches("[0-9A-Fa-f]{6}")) { - error("Invalid color. The color must be a 6-digit Hexadecimal number", CssPackage.Literals.HEX_COLOR__VALUE); - } - } - - @Check - public void checkRGBColor(Function function) { - if ("rgb".equals(function.getName().toLowerCase())) { - if (function.getArgs().getSubterms().size() != 2) { // 3 Args: 1 Term + 2 Subterms - warning("Invalid color. The RGB color must have exactly 3 arguments", CssPackage.Literals.FUNCTION__ARGS); - } - - - } - } - - @Check - public void checkRGBTerm(Term term) { - Expression owningExpression = findExpression(term); - if (owningExpression == null) { - return; - } - - if (owningExpression.eContainer() instanceof Function) { - if ("rgb".equals(((Function) owningExpression.eContainer()).getName().toLowerCase())) { - if (!(term instanceof Number)) { - warning("The RGB color arguments must be integers. Actual type: " + term.eClass().getName(), term.eClass().getEStructuralFeature("value")); - } else { - Number number = (Number) term; - - boolean validValue = true; - try { - int absoluteValue = Integer.parseInt(number.getValue()); - validValue = (number.getOp() == null || number.getOp().getOperator() == UNARY.PLUS) && absoluteValue <= 255; - } catch (NumberFormatException ex) { - validValue = false; - } - - if (!validValue) { - warning("The RGB color arguments must be integers between 0 and 255", term.eClass().getEStructuralFeature("value")); - } - } - } - } - } - - protected Expression findExpression(EObject term) { - if (term.eContainer() instanceof Expression) { - return (Expression) term.eContainer(); - } - - if (term.eContainer() instanceof Subterm) { - return findExpression(term.eContainer()); - } - - return null; - } - - // //////////////////////// - // EMF Only // - // //////////////////////// - @Check - public void checkElementName(SimpleSelector selector) { - if ("".equals(selector.getElementName())) { - error("The selector's name should either be null or non-empty", CssPackage.Literals.SIMPLE_SELECTOR__ELEMENT_NAME); - } - } - - @Check - public void checkSimpleSelector(SimpleSelector selector) { - if (!selector.eIsSet(CssPackage.Literals.SIMPLE_SELECTOR__ELEMENT_NAME)) { - if (selector.getCondition().isEmpty()) { - error("The SimpleSelector should have either a non-empty name or at least one condition", CssPackage.Literals.SIMPLE_SELECTOR__ELEMENT_NAME); - } - } - } - - @Check - public void checkAttribute(Attribute attribute) { - if ("".equals(attribute.getName())) { - error("The attribute's name should not be empty", CssPackage.Literals.ATTRIBUTE__NAME); - } - } - -} |