forked from dsldevkit/dsl-devkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dsldevkit#51: Autocorrect to add check to configuration does not put …
…string params in quotes Autocorrect to add check to configuration now does put string params in quotes. It also now handles default string parameters containing whitespace; previously it did not. Issue-Id: dsldevkit#51
- Loading branch information
1 parent
d95db3f
commit aeb04c0
Showing
4 changed files
with
91 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...eckcfg.ui/src/com/avaloq/tools/ddk/checkcfg/ui/templates/CheckCfgTemplateContextType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Avaloq Evolution AG and others. | ||
* 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: | ||
* Avaloq Evolution AG - initial API and implementation | ||
*******************************************************************************/ | ||
package com.avaloq.tools.ddk.checkcfg.ui.templates; | ||
|
||
import org.eclipse.xtext.ui.editor.templates.XtextTemplateContextType; | ||
|
||
import com.avaloq.tools.ddk.xtext.ui.templates.SimpleEnumTemplateVariableResolver; | ||
|
||
|
||
/** | ||
* Used for adding custom template variable resolvers. | ||
*/ | ||
public class CheckCfgTemplateContextType extends XtextTemplateContextType { | ||
|
||
@Override | ||
protected void addDefaultTemplateVariables() { | ||
super.addDefaultTemplateVariables(); | ||
addResolver(new SimpleEnumTemplateVariableResolver()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...xt.ui/src/com/avaloq/tools/ddk/xtext/ui/templates/SimpleEnumTemplateVariableResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.avaloq.tools.ddk.xtext.ui.templates; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import org.eclipse.jface.text.templates.TemplateVariable; | ||
import org.eclipse.xtext.ui.editor.templates.AbstractTemplateVariableResolver; | ||
import org.eclipse.xtext.ui.editor.templates.XtextTemplateContext; | ||
|
||
|
||
/** | ||
* Simple enumeration template where enumeration is passed as string arguments to the template. | ||
*/ | ||
public class SimpleEnumTemplateVariableResolver extends AbstractTemplateVariableResolver { | ||
|
||
public SimpleEnumTemplateVariableResolver() { | ||
super("SimpleEnum", ""); //$NON-NLS-1$ //$NON-NLS-2$ | ||
} | ||
|
||
@Override | ||
public List<String> resolveValues(final TemplateVariable variable, final XtextTemplateContext castedContext) { | ||
return variable.getVariableType().getParams().stream().filter(param -> param instanceof String).collect(Collectors.toList()); | ||
} | ||
|
||
} |