use of org.eclipse.jface.viewers.ITreeContentProvider in project webtools.sourceediting by eclipse.
the class ADTMultiPageEditor method getContentOutlinePage.
public IContentOutlinePage getContentOutlinePage() {
if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed()) {
final ProductCustomizationProvider productCustomizationProvider = (ProductCustomizationProvider) getAdapter(ProductCustomizationProvider.class);
ExtensibleContentOutlinePage outlinePage = null;
if (productCustomizationProvider != null) {
outlinePage = productCustomizationProvider.getProductContentOutlinePage();
}
if (outlinePage == null) {
outlinePage = new ADTContentOutlinePage();
}
outlinePage.setEditor(this);
ITreeContentProvider provider = (ITreeContentProvider) getEditorModeManager().getCurrentMode().getOutlineProvider();
outlinePage.setContentProvider(provider);
ADTLabelProvider adtLabelProvider = new ADTLabelProvider();
outlinePage.setLabelProvider(adtLabelProvider);
outlinePage.setModel(getModel());
fOutlinePage = outlinePage;
}
return fOutlinePage;
}
use of org.eclipse.jface.viewers.ITreeContentProvider in project webtools.sourceediting by eclipse.
the class CSSSyntaxColoringPage method createStylesViewer.
/**
* Creates the List viewer where we see the various syntax element display
* names--would it ever be a Tree like JDT's?
*
* @param parent
* @return
*/
private StructuredViewer createStylesViewer(Composite parent) {
StructuredViewer stylesViewer = new ListViewer(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
stylesViewer.setComparator(new ViewerComparator(Collator.getInstance()));
stylesViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
Object description = fStyleToDescriptionMap.get(element);
if (description != null)
return description.toString();
return super.getText(element);
}
});
stylesViewer.setContentProvider(new ITreeContentProvider() {
public void dispose() {
}
public Object[] getChildren(Object parentElement) {
return getStylePreferenceKeys().toArray();
}
public Object[] getElements(Object inputElement) {
return getChildren(inputElement);
}
public Object getParent(Object element) {
return getStylePreferenceKeys();
}
public boolean hasChildren(Object element) {
return false;
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
});
return stylesViewer;
}
use of org.eclipse.jface.viewers.ITreeContentProvider in project webtools.sourceediting by eclipse.
the class AddWorkspaceFileAction method run.
@Override
public void run() {
// ViewerFilter filter= new StylesheetFilter(getSelectedJars());
ILabelProvider lp = new WorkbenchLabelProvider();
ITreeContentProvider cp = new WorkbenchContentProvider();
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), lp, cp);
dialog.setValidator(validator);
dialog.setTitle(Messages.AddWorkspaceFileAction_DialogTitle);
dialog.setMessage(Messages.AddWorkspaceFileAction_DialogMessage);
dialog.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (!(element instanceof IResource))
return false;
IResource resource = (IResource) element;
if (resource.getType() == IResource.FILE) {
if (!XSLCore.isXSLFile((IFile) resource))
return false;
}
return true;
}
});
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == Window.OK) {
Object[] elements = dialog.getResult();
LaunchTransform[] res = new LaunchTransform[elements.length];
for (int i = 0; i < res.length; i++) {
IResource elem = (IResource) elements[i];
res[i] = new LaunchTransform(elem.getFullPath().toPortableString(), LaunchTransform.RESOURCE_TYPE);
}
addTransforms(res);
}
}
use of org.eclipse.jface.viewers.ITreeContentProvider in project liferay-ide by liferay.
the class UploadNewWorkflowDefinitionAction method promptForWorkspaceFile.
protected IFile promptForWorkspaceFile() {
ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
ViewerFilter filter = getContainerDialogViewerFilter();
ITreeContentProvider contentProvider = new WorkbenchContentProvider();
IWorkbench workBench = PlatformUI.getWorkbench();
ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), workBench.getDecoratorManager().getLabelDecorator());
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), labelProvider, contentProvider);
dialog.setValidator(validator);
dialog.setTitle("workspace file");
dialog.setMessage("workspace file");
dialog.addFilter(filter);
dialog.setInput(ResourcesPlugin.getWorkspace());
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IFile) {
IFile file = (IFile) element;
return file;
}
} catch (Exception ex) {
// Do nothing
}
}
return null;
}
use of org.eclipse.jface.viewers.ITreeContentProvider in project liferay-ide by liferay.
the class NewPortletClassWizardPage method handleFolderButtonPressed.
/**
* Browse for a new Destination Folder
*/
protected void handleFolderButtonPressed() {
ISelectionStatusValidator validator = getContainerDialogSelectionValidator();
ViewerFilter filter = getContainerDialogViewerFilter();
ITreeContentProvider contentProvider = new WorkbenchContentProvider();
IWorkbench workbench = PlatformUI.getWorkbench();
ILabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), workbench.getDecoratorManager().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);
String projectName = model.getStringProperty(IArtifactEditOperationDataModelProperties.PROJECT_NAME);
if ((projectName == null) || (projectName.length() == 0)) {
return;
}
IProject project = ProjectUtilities.getProject(projectName);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
if (project != null) {
dialog.setInitialSelection(project);
}
if (dialog.open() == Window.OK) {
Object element = dialog.getFirstResult();
try {
if (element instanceof IContainer) {
IContainer container = (IContainer) element;
folderText.setText(container.getFullPath().toString());
// dealWithSelectedContainerResource(container);
}
} catch (Exception ex) {
// Do nothing
}
}
}
Aggregations