org.eclipse.ui.dialogs.ListSelectionDialog input options? - eclipse

i try to display a dialog for selection the fields of a source.
i like to use the ListSelectionDialog, but i'm not sure what to use for the input parameter.
all the examples in the web uses the
ResourcesPlugin.getWorkspace().getRoot()
as input and yeah, all the projects are displayed.
but i have a list of Fields (IField[]) that i want to show for selection.
the constructor of ListSelectionDialog accept the parameter, but the dialog shows nothing... :(
does anybody has an idea?
thanks a lot!
Sven

I don't think using BaseWorkbenchContentProvider is right. Try ArrayContentProvider.
So something like:
new ListSelectionDialog(shell, fields, new ArrayContentProvider(), labelProvider, msg);

Related

Angular-material. Autocomplete directive

I have some problem with autocomplete. And my question is: Can I send my own personally typed text instead object from autocomplete list?
When I send object from list to "person.eamil" it's ok, but
when I send normal text to "person.email" I get null instead my text.
Here is my HTML code:
<md-autocomplete
ng-model="person.email"
ng-disabled="false"
md-no-cache="true"
md-selected-item="person.email"
md-search-text-change="setPersonValidEmail(person, !innerForm.email.$error.email);"
md-search-text="searchText"
md-items="item in people"
md-item-text="item.email"
md-min-length="0"
placeholder="some#one.com"
ng-click="addOurPersonIfNecessary($index);"
name = "email">
<md-item-template>
<span md-highlight-text="searchText" md-highlight-flags="^i">{{item.name}}</span>
</md-item-template>
</md-autocomplete>
Md-selected-item here is expecting an object that is populated in people. Only then it can populate the auto complete. You can pass the text to md-search-text
I found solution. Try to use another autocomplete plugin like this:
https://github.com/ghiden/angucomplete-alt

How do I display a default value when no suggestion found in suggestbox

I would like to display a default value (that I already set using setDefaultSuggestionsFromText()) when there is no suggestion displayed for the user entered value. Thanks for your help!
You need a SuggestOracle that always returns a suggestion. You could easily build one that wraps your current SuggestOracle and returns your canned suggestion when the wrapped oracle returns none.

using Ajax , dropdownlist and page validation

using Ajax I filled Country, State and city dropdownlist. On land change state is filled and on state change city is filled properly.
Then when I try to save page I face this :Invalid postback or callback argument.
Searched and found out that this is due to change in ddl.selectedvalu change from initial value that is assigned by asp.net.
Now my question is that how can I let asp.net know that the new ddl value is valid?
Thank you.
In many pages it is recommended to use EnableEventValidation="false", but I prefer not to use it.
Some say that use Render and add value to notify .Net like this:
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
ClientScript.RegisterForEventValidation("ddlLanguages ", "English");
ClientScript.RegisterForEventValidation("ddlLanguages ", "Tamil");
ClientScript.RegisterForEventValidation("ddlLanguages ", "Hindi");
base.Render(writer);
}
but how to use it? where to put it?
for a better understanding I put here a sample code including Database script :
hesab20.com/DownLoad/Ajax.zip
in this sample Javascript is used to fill drop-down list . But when click button is executed and a post back occur, error happen.
Please help if you have experience with this.
Regards.
Please run the sample code and change the drop down lists , automatically the other is filled , meaning that list item text and value is completely changed. finally click button for a post back.
you must see that error happens:
Invalid postback or callback argument. Event validation ....
and note : EnableEventValidation="true"
Thanks

check if custom attribute has specific value

My problem seemed easy at first but i got stuck.
I have some containers (divs) in my page with some custom attributes.
<div class="myclass" myattr1="blah" myattr2="text1-text2-text3-text4-"></div>
myattr1 and myattr2 are defined by me.
All divs are visible on page load.
Now, depending on user selection from a list, i want to show only the divs with myattrib1="blah" and hide the rest.
I tried the following code, with no success at all
$('#mySelectID').change(function()
{
var startName = $(this).val();
$(".myclass").not('[myattrib1!="+startName+"]').toggle();
});
The same approach will be used to filter results by attrib2, but there i will use myattrib2|="+startName+" ( i think this is correct - thats why i have the extra - on the end of myattr2="text1-text2-text3-text4-").
Can anyone advice me on how to properly achieve this kind of filtering?
thank you!
You are close, but as you can see form the syntax highlighting, your are not performing string concatenation. +startName+ will be taken literally. Fix the quotes and your fine:
.not('[myattrib1!="' + startName + '"]')
Note that you should be using data-* attributes instead of custom ones.

zend form - Element Label in two line

I am extremely new to Zend Framework, In registration form, i need label text in two line. For Example:- In the case First name, I need to display like below:
First
Name:
How can i implement this? Please anyone help me!!!
By default, input fields labels are being escaped by Zend_View_Helper_FormLabel. However, you can easy switch this off:
$yourTextInputElement->getDecorator('label')->setOption('escape', false);
This way you can use labels as e.g. $yourTextInputElement->setLabel('First <br/> name');.
What about this nifty solution ?
http://jsfiddle.net/J67GD/
The best way is probably to use Description decorator, or subclass one of other standard ZF decorators.
Yanick's CSS solution might be a good choice too, depending what are you trying to do.