Xtend comes with really convenient ways to deal with quickfixes, but when I do
acceptor.accept(issue, "Change to " + correction, 'Replace the parameter.', 'error.png') [ element, context |
...
]
the element is not the EObject targeted by the issue, but its container. How can I have access to this specific element?
Thank you by advance.
Please make sure that the EObject you report the error for and the one you expect inside the QuickFix are the same
warning('Name should start with a capital',
greeting,
MyDslPackage.Literals.GREETING__NAME,
INVALID_NAME)
Related
I have a list of elements (OData set) and use a binding to show this list.
One field is for a quantity value and this value could sometimes need some decimal places.
The requirement is: only show that amount of decimal numbers that is also available in the OData service.
Annotation techniques can't be used.
I 'hacked' something that is misusing a formatter to update the type of a binding. But this is 'a hack' and it is not possible to convert it to XML views. (The reason is a different handling of the scope the formatter will be called).
So I am searching for a working solution for XML views.
The following code would not work but shows the issue:
new sap.m.Input({ // looking for an XML solution with bindings
value: {
path: "Quantity",
type: new sap.ui.model.type.Float({
// formatOptions
maxFractionDigits: "{QuantityDecimals}",
// ...
}, {
// constraints
minimum: 0
}),
// ...
}
});
The maxFractionDigits : "{QuantityDecimals}" should be "dynamic" and not a constant value.
Setting formatOptions and constraints dynamically in XML (via bindings or a declared function) is unfortunately not (yet) supported. But IMHO this is a valid enhancement request that app developers would greatly benefit from, since it encourages declarative programming.
I already asked for the same feature some years ago but in a comment at https://github.com/SAP/openui5/issues/2449#issuecomment-474304965 (See my answer to Frank's question "If XMLViews would allow a way to specify the dynamic constraints as well (e.g. enhanced syntax), would that fix the problem?").
Please create a new issue via https://github.com/SAP/openui5/issues/new with a clear description of what kind of problems the feature would resolve and possibly other use cases (You can add a link to my comment). I'll add my 👍 to your GitHub issue, and hopefully others too.
I'll update this answer as soon as the feature is available.
Get your dynamic number from your model and store it in a JS variable.
var nQuantityDecimals = this.getModel().getProperty("/QuantityDecimals");
new sap.m.Input({
value : {
path : "Quantity",
type : new sap.ui.model.type.Float({
maxFractionDigits : nQuantityDecimals,
source : {
groupingSeparator: ",",
decimalSeparator: ".",
groupingEnabled: false
}
}, {
minimum:0
})
}
}),
What is the difference between LocatorGroupStrategy.CHAIN and ALL_POSSIBLE?
Can anyone explain with examples?
ALL_POSSIBLE: it will match the first locator strategy among the locators you have provided for example :
#HowToUseLocators(androidAutomation = ALL_POSSIBLE, iOSAutomation =
ALL_POSSIBLE)
#FindAll{#FindBy(someStrategy1), #FindBy(someStrategy2)})
#AndroidFindBy(fakeID1) #AndroidFindBy(someStrategy2)
#iOSFindBy(fakeID1) #iOSFindBy(someStrategy2)
MobileElement someElement;
So in above example if the locator is found by #FindBy(someStrategy1) then it will stop locating the next elements and perform the execution for the first found element.
CHAIN : first finding first locator then inside second and so on. for example,
#FindBys({#FindBy(someStrategy1),
#FindBy(someStrategy2)})
#AndroidFindBy(parent)
#AndroidFindBy(child)
#iOSFindBy(parent)
#iOSFindBy(child)
MobileElement someElement;
In above code, if you are automating android app, then it will first find the #AndroidFindBy(parent) and then it will find the #AndroidFindBy(child).
I hope this is clear to you.
I've encountered the following problem:
Before mods may click 'duplicate', it isn't. I've searched the problem, found 'solutions', applied 'solutions' and they didn't work. So the question could be 'Why is my 'solution' not working?' or the question could be 'What is the actual solution?'
The responsible code for this is
querySelector("#element").setInnerHtml(some_element.outerHtml, treeSanitizer: NodeTreeSanitizer.trusted);
What am I doing wrong?
I found out to apply the sanitizer to the Element.
Element element = new Element.html('<a data-tag="value">thing</a>'), treeSanitizer: NodeTreeSanitizer.trusted)
I haven't gone back recently to double check that is the best way, but we've ended up building a common NodeValidator that we keep up to date with our various custom attributes.
NodeValidator get commonValidator => _commonValidator;
/// Create a NodeValidator which passes common values.
final NodeValidator _commonValidator = new NodeValidatorBuilder.common()
..allowHtml5()
..allowInlineStyles()
..allowNavigation(_policy)
..allowImages()
..allowTextElements()
..allowElement("a", attributes: [
"data-version",
"data-attribute-add"])
..allowElement("div", attributes: [
"data-sec"]);
foo.setInnerHtml(someOddHtml, validator: commonValidator);
Just new in Prestashop (1.6.0.6), I've a problem with my product page in admin. All translatable-field are to display:none (I inspect the code with chrome).
So when I want to create a new product I can't because the name field is required.
I thought that it was simple to find the .js whose do that but it isn't.
If somebody could help me, I would be happy.
Thank you for your help
Hi,
I make some searches and see that the function hideOtherLanguage(id) hide and show translatable-field element.
function hideOtherLanguage(id)
{
console.log(id_language);
$('.translatable-field').hide();
$('.lang-' + id).show();
var id_old_language = id_language;
id_language = id;
if (id_old_language != id)
changeEmployeeLanguage();
updateCurrentText();
}
When I set the Id to 1 (default language), it works. It seems that when I load the page, the function is called twice and the last calling, the id value is undefined. So the show() function will not work.
If somebody could help me. Thank you.
In my console, I see only one error
undefined is not a function.
under index.php / Line 1002
...
$("#product_form").validate({
...
But I find the form.tpl template and set this lines in comment but nothing change.
EDIT: According to comment on this link http://forge.prestashop.com/browse/PSCFV-2928 this can possibly be caused by corrupted installation file(s) - so when on clean install - try to re-download and reinstall...
...otherwise:
I got into a similar problem - in module admin page, when creating configuration form using PrestaShop's HelperForm. I will provide most probable cases and their possible solutions.
The solution for HelperForm was tested on PS 1.6.0.14
Generally there are 2 cases when this will happen.
First, you have to check what html you recieve.
=> Display source code - NOT in developer tools/firebug/etc...!
=> I really mean the pure recieved (JavaScript untouched) html.
Check if your translatable-fields have already the inline style "display: none":
Case 1 - fields already have inline style(s) for "display: none"
This means the template/html was already prepared this way - most probably in some TPL file I saw codes similar to these:
<div class="translatable-field lang-{$language.id_lang}"
{if $language.id_lang != $id_lang_default}style="display:none"{/if}>
Or particularly in HelperForm template:
<div class="translatable-field lang-{$language.id_lang}"
{if $language.id_lang != $defaultFormLanguage}style="display:none"{/if}>
Case 1 is the most easy to solve, you just have to find, where to set this default language.
Solutions
HelperForm
Look where you've (or someone else) prepared the HelperForm object - something like:
$formHelper = new HelperForm();
...
Somewhere there will be something like $formHelper->default_form_language = ...;
My wrong first solution was to get default form language from context - which might not be set:
$this->context->controller->default_form_language; //THIS IS WRONG!
The correct way is to get the default language from configuration - something like:
$default_lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
$formHelper->default_form_language = $default_lang->id;
...this particularly solved my problem...
Other form-creations
If there is something else than HelperForm used for form creations, the problem is still very similar.
You have to find where in files(probably tpls) is a condition for printing display:none for your case - then find where is the check-against-variable set and set it correctly yourself.
Case 2 - fields don't have inline style(s) for "display: none"
This means it is done after loading HTML by JavaScript. There are two options:
There is a call for hideOtherLanguage(), but there is wrongly set input language - that means no language will be displayed and all hidden.Solution for this one can be often solved by solving Case 1 (see above). In addition there can be programming error in not setting the after-used language id variable at all... then you would have to set it yourself (assign in JavaScript).
Some script calls some sort of .hide() on .translatable-field - you will have to search for it the hard way and remove/comment it out.
PS: Of course you can set the language to whatever you want, it is just common to set it to default language, because it is the most easier and the most clear way how to set it.
I am having some issue with ezSearch (Umbraco) and it is very similar to this one
http://our.umbraco.org/projects/website-utilities/ezsearch/bugs-feedback-suggestions/48460-Search-error-when-searching-for-test-keyword?p=0#comment176864
Here is the screenshot of error
http://our.umbraco.org/media/upload/e08b702e-b738-42a4-81d8-382a4400b96a/error.jpg
Can anyone hep me with this please?
Thank you,
Adi
I'm using ezSearch, and from reading the ezSearch.cshtml this looks like a bug if the query passed to the macro is " ". That is to say, if the search is empty, it works ok, but if the search is an actual quoted space then the line in the cshtml: (line 60 in my version)
// Check the search term isn't empty
if(!string.IsNullOrWhiteSpace(model.SearchTerm))
{
// Tokenize the search term
model.SearchTerms = Tokenize(model.SearchTerm);
...
etc.
...
}
ends up with a bad set of tokens in model.SearchTerms.
it's a bit of a hack, but i think putting this before that if statement will help.
model.SearchTerm = model.SearchTerm.Replace("\"","").Replace(" ","").Replace("'","");
..hope that helps.
'ingie.