blob: 7e348cd6c995f9a547d4bf69cb0926eb64741648 [file] [log] [blame]
[comment encoding = UTF-8 /]
[comment
/*******************************************************************************
* Copyright (c) 2017 Jad El-khoury.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompanies this distribution.
*
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
*
* Jad El-khoury - Migrating complex queries into mtl files.
*
*******************************************************************************/
/]
[module queries('http://org.eclipse.lyo/oslc4j/adaptorInterface', 'http://www.eclipse.org/sirius/diagram/1.1.0')/]
[import org::eclipse::lyo::tools::toolchain::design::DialogInputServices/]
[query public visibleResources(diagram : DDiagram) : Sequence(Resource) =
(diagram.containers->select(c : DDiagramElementContainer |
(c.actualMapping.name = 'Specification.DomainSpecification.Resource')._and(c.visible))).target.oclAsType(Resource)
/]
[query public invisibleParentResources(aResource : Resource, diagram : DDiagram) : OrderedSet(Resource) =
aResource.extends->select(parent : Resource | not(visibleResources(diagram)->includes(parent)))
/]
[comment If at least one parent resource is not visible in the diagram, show textually the parent resources.
Show at least the first invisible parent resource./]
[query public labelInDomainSpecification(aResource : Resource, diagram : DDiagram) : String =
aResource.name +
(if (aResource.invisibleParentResources(diagram)->size() = 0)
then
''
else
(lineSeparator() + 'extends: ' + aResource.invisibleParentResources(diagram)->first().name)
+ (if (aResource.invisibleParentResources(diagram)->size() > 1) then ' & ...' else '' endif)
endif)
/]
[comment specificationDiagram/]
[query public promptForJavaFilesPath(aDomainSpecification : DomainSpecification) : String =
let userInput : String = aDomainSpecification.promptForString('Enter relative file path',
'For the resources of this domain specification, enter the relative file path for their corresponding java classes.' +
lineSeparator() +
'This path will override any setting on the whole Specification, and/or a specific adaptor',
aDomainSpecification.generationSetting.javaFilesPath) in
(if (userInput = null) then
aDomainSpecification.generationSetting.javaFilesPath
else
userInput
endif)
/]
[query public promptForJavaClassPackageName(aDomainSpecification : DomainSpecification) : String =
let userInput : String = aDomainSpecification.promptForString('Enter the java package name',
'For the resources of this domain specification, enter the package name for their corresponding java classes.' +
lineSeparator() +
'This package name will override any setting on the whole Specification, and/or a specific adaptor.',
aDomainSpecification.generationSetting.javaClassPackageName) in
(if (userInput = null) then
aDomainSpecification.generationSetting.javaClassPackageName
else
userInput
endif)
/]
[query public promptForJavaFilesPath(aSpecification : Specification) : String =
let userInput : String = aSpecification.promptForString('Enter relative file path',
'For the resources of this specification, enter the relative file path for their corresponding java classes.' +
lineSeparator() +
'This path will override any setting on a specific adaptor',
aSpecification.generationSetting.javaFilesPath) in
(if (userInput = null) then
aSpecification.generationSetting.javaFilesPath
else
userInput
endif)
/]
[query public promptForJavaClassPackageName(aSpecification : Specification) : String =
let userInput : String = aSpecification.promptForString('Enter the java package name',
'For the resources of this specification, enter the package name for their corresponding java classes.' +
lineSeparator() +
'This package name will override any setting on a specific adaptor.',
aSpecification.generationSetting.javaClassPackageName) in
(if (userInput = null) then
aSpecification.generationSetting.javaClassPackageName
else
userInput
endif)
/]