Search in sources :

Example 1 with ResourceSorter

use of org.eclipse.ui.views.navigator.ResourceSorter 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();
        }
    }
}
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 2 with ResourceSorter

use of org.eclipse.ui.views.navigator.ResourceSorter 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();
        }
    }
}
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 3 with ResourceSorter

use of org.eclipse.ui.views.navigator.ResourceSorter 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 4 with ResourceSorter

use of org.eclipse.ui.views.navigator.ResourceSorter 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)

Aggregations

HashMap (java.util.HashMap)4 Map (java.util.Map)4 IProject (org.eclipse.core.resources.IProject)4 IWorkspace (org.eclipse.core.resources.IWorkspace)4 DecoratingLabelProvider (org.eclipse.jface.viewers.DecoratingLabelProvider)4 IStructuredContentProvider (org.eclipse.jface.viewers.IStructuredContentProvider)4 Viewer (org.eclipse.jface.viewers.Viewer)4 Composite (org.eclipse.swt.widgets.Composite)4 Control (org.eclipse.swt.widgets.Control)4 ListDialog (org.eclipse.ui.dialogs.ListDialog)4 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)4 ResourceSorter (org.eclipse.ui.views.navigator.ResourceSorter)4 IWorkbench (org.eclipse.ui.IWorkbench)1