use of org.eclipse.jface.viewers.DecoratingLabelProvider in project liferay-ide by liferay.
the class LiferayDataModelWizardPage method handleFileBrowseButton.
protected void handleFileBrowseButton(final Text text, String title, String message) {
ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
ViewerFilter filter = getContainerDialogViewerFilter();
ITreeContentProvider contentProvider = new WorkbenchContentProvider();
IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), decoratorManager.getLabelDecorator());
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
dialog.setValidator(validator);
dialog.setTitle(title);
dialog.setMessage(message);
dialog.addFilter(filter);
final IWebProject lrproject = LiferayCore.create(IWebProject.class, CoreUtil.getProject(getDataModel().getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME)));
if (lrproject != null) {
final IFolder defaultDocroot = lrproject.getDefaultDocrootFolder();
if (defaultDocroot != null) {
dialog.setInput(defaultDocroot);
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IFile) {
IFile file = (IFile) element;
final IPath relativePath = file.getFullPath().makeRelativeTo(defaultDocroot.getFullPath());
text.setText("/" + relativePath.toPortableString());
// dealWithSelectedContainerResource(container);
}
} catch (Exception ex) {
// Do nothing
}
}
}
}
}
Aggregations