Search in sources :

Example 1 with JavaSourceFolderFilter

use of org.whole.lang.ui.controls.JavaSourceFolderFilter in project whole by wholeplatform.

the class OperationLauncherRegistry method openJavaSourceFoldersDialog.

public static IContainer[] openJavaSourceFoldersDialog(Shell shell, boolean allowMultipleSelection) {
    ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(shell, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
    dialog.setValidator(new JavaSourceFolderValidator());
    dialog.setTitle("Java Source Folder Selection");
    dialog.setMessage("Choose a destination folder for generated code");
    dialog.addFilter(new JavaSourceFolderFilter());
    dialog.setInput(JDTUtils.getWorkspaceRoot());
    dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
    dialog.setAllowMultiple(allowMultipleSelection);
    if (dialog.open() == Window.OK) {
        Object[] elements = dialog.getResult();
        IContainer[] containers = new IContainer[elements.length];
        for (int i = 0; i < containers.length; i++) containers[i] = (IContainer) elements[i];
        return containers;
    }
    return new IContainer[0];
}
Also used : ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ResourceComparator(org.eclipse.ui.views.navigator.ResourceComparator) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) JavaSourceFolderValidator(org.whole.lang.ui.controls.JavaSourceFolderValidator) IContainer(org.eclipse.core.resources.IContainer) JavaSourceFolderFilter(org.whole.lang.ui.controls.JavaSourceFolderFilter)

Aggregations

IContainer (org.eclipse.core.resources.IContainer)1 ElementTreeSelectionDialog (org.eclipse.ui.dialogs.ElementTreeSelectionDialog)1 WorkbenchContentProvider (org.eclipse.ui.model.WorkbenchContentProvider)1 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)1 ResourceComparator (org.eclipse.ui.views.navigator.ResourceComparator)1 JavaSourceFolderFilter (org.whole.lang.ui.controls.JavaSourceFolderFilter)1 JavaSourceFolderValidator (org.whole.lang.ui.controls.JavaSourceFolderValidator)1