use of org.eclipse.jface.viewers.DecoratingLabelProvider in project liferay-ide by liferay.
the class NewCustomJSPsHookWizardPage method handleFileBrowseButton.
protected void handleFileBrowseButton(Text text) {
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(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
dialog.addFilter(filter);
dialog.setInput(CoreUtil.getWorkspaceRoot());
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
IProject project = CoreUtil.getProject(getDataModel().getStringProperty(PROJECT_NAME));
IWebProject webproject = LiferayCore.create(IWebProject.class, project);
if (webproject != null) {
IFolder defaultWebappRootFolder = webproject.getDefaultDocrootFolder();
if (folder.equals(defaultWebappRootFolder)) {
folder = folder.getFolder("custom_jsps");
}
String defaultWebappRootFolderFullPath = defaultWebappRootFolder.getFullPath().toPortableString();
String folderFullPath = folder.getFullPath().toPortableString();
int index = folderFullPath.indexOf(defaultWebappRootFolderFullPath);
if (index != -1) {
folderFullPath = folderFullPath.substring(index + defaultWebappRootFolderFullPath.length());
}
text.setText(folderFullPath);
}
}
} catch (Exception ex) {
// Do nothing
}
}
}
use of org.eclipse.jface.viewers.DecoratingLabelProvider in project liferay-ide by liferay.
the class NewLanguagePropertiesHookWizardPage method handleFileBrowseButton.
protected void handleFileBrowseButton(Text text) {
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(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_TITLE);
dialog.setMessage(J2EEUIMessages.CONTAINER_SELECTION_DIALOG_DESC);
dialog.addFilter(filter);
dialog.setInput(CoreUtil.getWorkspaceRoot());
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
IProject project = CoreUtil.getProject(getDataModel().getStringProperty(PROJECT_NAME));
List<IFolder> sources = CoreUtil.getSourceFolders(JavaCore.create(project));
if (ListUtil.isNotEmpty(sources) && folder.equals(sources.get(0))) {
folder = folder.getFolder("content");
}
text.setText(folder.getFullPath().toPortableString());
}
} catch (Exception ex) {
// Do nothing
}
}
}
use of org.eclipse.jface.viewers.DecoratingLabelProvider in project liferay-ide by liferay.
the class NewPortalPropertiesHookWizardPage method handleBrowseButton.
protected void handleBrowseButton(Text text) {
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(Msgs.portalPropertiesFile);
dialog.setMessage(Msgs.portalPropertiesFile);
dialog.addFilter(filter);
dialog.setInput(CoreUtil.getWorkspaceRoot());
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IFile) {
IFile file = (IFile) element;
text.setText(file.getFullPath().toPortableString());
} else if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
IPath portalPropertiesPath = folder.getFullPath().append("portal.properties");
text.setText(portalPropertiesPath.toPortableString());
}
} catch (Exception ex) {
// Do nothing
}
}
}
use of org.eclipse.jface.viewers.DecoratingLabelProvider in project webtools.sourceediting by eclipse.
the class PropertyPreferencePage method openProjectSettings.
void openProjectSettings() {
ListDialog dialog = new ListDialog(getShell()) {
protected Control createDialogArea(Composite container) {
Control area = super.createDialogArea(container);
getTableViewer().setSorter(new ResourceSorter(ResourceSorter.NAME));
return area;
}
};
dialog.setMessage(SSEUIMessages.PropertyPreferencePage_02);
dialog.setContentProvider(new IStructuredContentProvider() {
public void dispose() {
}
public Object[] getElements(Object inputElement) {
return ((IWorkspace) inputElement).getRoot().getProjects();
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
dialog.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), SSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
dialog.setInput(ResourcesPlugin.getWorkspace());
dialog.setTitle(SSEUIMessages.PropertyPreferencePage_01);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result.length > 0) {
IProject project = (IProject) dialog.getResult()[0];
Map data = new HashMap();
data.put(DISABLE_LINK, Boolean.TRUE);
PreferencesUtil.createPropertyDialogOn(getShell(), project, getPropertyPageID(), new String[] { getPropertyPageID() }, data).open();
}
}
}
use of org.eclipse.jface.viewers.DecoratingLabelProvider in project webtools.sourceediting by eclipse.
the class AbstractPropertyPreferencePage method openProjectSettings.
void openProjectSettings() {
ListDialog dialog = new ListDialog(getShell()) {
protected Control createDialogArea(Composite container) {
Control area = super.createDialogArea(container);
getTableViewer().setSorter(new ResourceSorter(ResourceSorter.NAME));
return area;
}
};
dialog.setMessage(SSEUIMessages.PropertyPreferencePage_02);
dialog.setContentProvider(new IStructuredContentProvider() {
public void dispose() {
}
public Object[] getElements(Object inputElement) {
return ((IWorkspace) inputElement).getRoot().getProjects();
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
dialog.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), SSEUIPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
dialog.setInput(ResourcesPlugin.getWorkspace());
dialog.setTitle(SSEUIMessages.PropertyPreferencePage_01);
if (dialog.open() == Window.OK) {
Object[] result = dialog.getResult();
if (result.length > 0) {
IProject project = (IProject) dialog.getResult()[0];
Map data = new HashMap();
data.put(DISABLE_LINK, Boolean.TRUE);
PreferencesUtil.createPropertyDialogOn(getShell(), project, getPropertyPageID(), new String[] { getPropertyPageID() }, data).open();
}
}
}
Aggregations