Vala Gtk Folder selection - gtk

I'm creating a simple GTK+ based application in Vala, which should be able to select a folder and then list the files inside it.
I've been able to select a single file using the Gtk.FileChooserDialog but I haven't found how to select a folder instead of a file.
Is there any way to tell the Gtk.FileChooserDialog that folders can be selected or is there any other widget to select folders?

Set the action property.
filechooser.action = FileChooserAction.SELECT_FOLDER;

Related

Changing a file to another with the same field names

I have a report built on a file but I want to change the file to another that has the exact same field names, but a different file name. They are both on the same data source.
Is there a way to do this?
Thanks
Go to
Database Lable --> Set Datasource Location--->
select current file and target file and click on update

File Selection from List in a Wizard page

I have a Wizard page which gets a list of IFile. I want to show the user the list and select one file from the list. Then the Wizard returns the selected file.
Is there a standard file chooser that I can use instead of building from scratch in the createControl() of the WizardPage? (Maybe something like table view list with scrollbar to show the list.)
There is FilteredResourcesSelectionDialog that is a popup displaying any resource wanted, eventually with pre-loaded regexp, allowing to search for file, and you give him a root directory :
You call getResult() to retrieve selection as Object[].
If you want to do just a wizard that does that, then I would do it this way.
If it's a list include in a wizard that does other things, then just list all the files and create a org.eclipse.swt.widgets.List
Though there is no ready-to-use FileViewer or the like, you can use a TableViewer with a WorkbenchLabelProvider to show the list of files.
IFile[] files = ...
TableViewer fileViewer = new TableViewer( parent );
fileViewer.setInput( files );
fileViewer.setContentProvider( ArrayContentProvider.getInstance() );
fileViewer.setLabelProvider( new WorkbenchLabelProvider() );
This will create a single-selection table (viewer) that displays the files from the files array.
If multi-selection or further styles apply, use new TableViewer( parent, SWT.MULTI | ... ) to create the viewer.
If the list of files need to be sorted by name or type, you can use the ResourceComparator from the org.eclipse.ui.ide plug-in.
fileViewer.setComparator( new ResourceComparator( ResourceComparator.NAME ) );
If you don't want the extra plug-in dependency or need to sort by another criteria, it may still be used as a template.

How to set eclipse preferences use plugin?

Now I'm using python to change settings files under .metadata/ in my workspace.I need find every line needed in these files beacuase I don't want any unnecessary content.
For example , if I want set tab's width be 4. I need change the file
.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.editors.prefs
in workspace and add a line following in it , not simply copy the settings file:
tabWidth=4
So I want to know : Can I set this value by java code in eclipse plugin? If it can, please give me related classes :-)
And, does it more complex than python's method?
In a plugin you can use:
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.ui.editors");
store.setValue("tabWidth", 4);

Hide Discount from line Items in Quotes in SugarCRM

Want to hide the discount field from the line Items in Quote module.
How to do that?
Please help
You will need to edit the "quotes.js" file located in the quotes module and remove the generated element from the add row method.
This can be done in an upgrade safe way by creating a copy of the quotes.js file in the custom directory. You will also need to specify a custom view.edit and EditViewFooter.html and change the references in each of the files to point to the custom directory.
Here are a list of files that you need to create/modify...
custom/modules/Quotes/metadata/editviewdefs.php
custom/modules/Quotes/quotes.js
custom/modules/Quotes/tpls/EditViewFooter.tpl
custom/modules/Quotes/views/view.edit.php

Suppose I want to search a type of file in a folder.how can I search that in xcode?

Suppose I have a parent folder which contains some more folders. I want to search the files which are present in the sub folders but I have the information of only parent folder (i.e. I know the path of parent folder). I want to list all files of same type present in sub folders. How can I list them all or search the required file type in xcode?
Just set the search string in the project navigator and manually refine from those results. Xcode's project navigator does not distinguish depth for you. If the items do not exist, you can add a folder reference ;)