Search in sources :

Example 6 with DecoratingLabelProvider

use of org.eclipse.jface.viewers.DecoratingLabelProvider in project tmdm-studio-se by Talend.

the class LockedObjectDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.marginHeight = 5;
    titleLabel = new Label(container, SWT.WRAP);
    GridData gd_titleLabel = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
    gd_titleLabel.heightHint = 40;
    gd_titleLabel.verticalIndent = 5;
    titleLabel.setLayoutData(gd_titleLabel);
    if (mutliObjAlertMsg != null) {
        if (canContinueRestOperation()) {
            titleLabel.setText(mutliObjAlertMsg);
        } else {
            titleLabel.setText(singleObjAlertMsg);
        }
    }
    treeViewer = new TreeViewer(container, SWT.BORDER);
    Tree tree = treeViewer.getTree();
    GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_tree.verticalIndent = 5;
    tree.setLayoutData(gd_tree);
    treeViewer.setContentProvider(new TreeContentProvider());
    ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator();
    DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new MDMRepositoryLabelProvider(), labelDecorator);
    treeViewer.setLabelProvider(labelProvider);
    // init input
    treeViewer.setInput(lockedObjs);
    return container;
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) ILabelDecorator(org.eclipse.jface.viewers.ILabelDecorator) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) MDMRepositoryLabelProvider(org.talend.mdm.repository.ui.navigator.MDMRepositoryLabelProvider) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Tree(org.eclipse.swt.widgets.Tree) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider)

Example 7 with DecoratingLabelProvider

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()) {

        @Override
        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();
        }
    }
}
Also used : WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) ResourceSorter(org.eclipse.ui.views.navigator.ResourceSorter) Composite(org.eclipse.swt.widgets.Composite) HashMap(java.util.HashMap) Viewer(org.eclipse.jface.viewers.Viewer) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) IProject(org.eclipse.core.resources.IProject) Control(org.eclipse.swt.widgets.Control) IWorkspace(org.eclipse.core.resources.IWorkspace) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) HashMap(java.util.HashMap) Map(java.util.Map) ListDialog(org.eclipse.ui.dialogs.ListDialog)

Example 8 with DecoratingLabelProvider

use of org.eclipse.jface.viewers.DecoratingLabelProvider in project liferay-ide by liferay.

the class PropertyPreferencePage method _openProjectSettings.

private void _openProjectSettings() {
    ListDialog dialog = new ListDialog(getShell()) {

        @Override
        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) {
        }
    });
    IWorkbench workbench = SSEUIPlugin.getDefault().getWorkbench();
    dialog.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(), workbench.getDecoratorManager().getLabelDecorator()));
    dialog.setInput(ResourcesPlugin.getWorkspace());
    dialog.setTitle(SSEUIMessages.PropertyPreferencePage_01);
    if (dialog.open() == Window.OK) {
        Object[] result = dialog.getResult();
        if (ListUtil.isNotEmpty(result)) {
            IProject project = (IProject) dialog.getResult()[0];
            Map data = new HashMap();
            data.put(_disableLink, Boolean.TRUE);
            PreferencesUtil.createPropertyDialogOn(getShell(), project, getPropertyPageID(), new String[] { getPropertyPageID() }, data).open();
        }
    }
}
Also used : WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) ResourceSorter(org.eclipse.ui.views.navigator.ResourceSorter) Composite(org.eclipse.swt.widgets.Composite) HashMap(java.util.HashMap) Viewer(org.eclipse.jface.viewers.Viewer) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) IProject(org.eclipse.core.resources.IProject) IWorkbench(org.eclipse.ui.IWorkbench) Control(org.eclipse.swt.widgets.Control) IWorkspace(org.eclipse.core.resources.IWorkspace) IStructuredContentProvider(org.eclipse.jface.viewers.IStructuredContentProvider) HashMap(java.util.HashMap) Map(java.util.Map) ListDialog(org.eclipse.ui.dialogs.ListDialog)

Example 9 with DecoratingLabelProvider

use of org.eclipse.jface.viewers.DecoratingLabelProvider 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;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) IFile(org.eclipse.core.resources.IFile) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider)

Example 10 with DecoratingLabelProvider

use of org.eclipse.jface.viewers.DecoratingLabelProvider 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
        }
    }
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) DecoratingLabelProvider(org.eclipse.jface.viewers.DecoratingLabelProvider) WorkbenchContentProvider(org.eclipse.ui.model.WorkbenchContentProvider) ILabelProvider(org.eclipse.jface.viewers.ILabelProvider) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) JavaModelException(org.eclipse.jdt.core.JavaModelException) IWorkbench(org.eclipse.ui.IWorkbench) ElementTreeSelectionDialog(org.eclipse.ui.dialogs.ElementTreeSelectionDialog) ISelectionStatusValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) EObject(org.eclipse.emf.ecore.EObject) IContainer(org.eclipse.core.resources.IContainer)

Aggregations

DecoratingLabelProvider (org.eclipse.jface.viewers.DecoratingLabelProvider)11 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)10 IProject (org.eclipse.core.resources.IProject)7 ITreeContentProvider (org.eclipse.jface.viewers.ITreeContentProvider)7 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)6 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)6 ElementTreeSelectionDialog (org.eclipse.ui.dialogs.ElementTreeSelectionDialog)6 ISelectionStatusValidator (org.eclipse.ui.dialogs.ISelectionStatusValidator)6 WorkbenchContentProvider (org.eclipse.ui.model.WorkbenchContentProvider)6 Composite (org.eclipse.swt.widgets.Composite)5 HashMap (java.util.HashMap)4 Map (java.util.Map)4 IFolder (org.eclipse.core.resources.IFolder)4 IWorkspace (org.eclipse.core.resources.IWorkspace)4 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)4 Viewer (org.eclipse.jface.viewers.Viewer)4 Control (org.eclipse.swt.widgets.Control)4 IDecoratorManager (org.eclipse.ui.IDecoratorManager)4 ListDialog (org.eclipse.ui.dialogs.ListDialog)4 ResourceSorter (org.eclipse.ui.views.navigator.ResourceSorter)4