Search in sources :

Example 1 with INavigatorContentDescriptor

use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.

the class NavigatorSorterService method computeSortOnlyDescriptors.

private synchronized void computeSortOnlyDescriptors() {
    INavigatorContentDescriptor[] allDescriptors;
    allDescriptors = NavigatorContentDescriptorManager.getInstance().getSortOnlyContentDescriptors();
    List sortOnlyList = new ArrayList();
    for (int i = 0; i < allDescriptors.length; i++) {
        if (contentService.isActive(allDescriptors[i].getId())) {
            sortOnlyList.add(allDescriptors[i]);
        }
    }
    sortOnlyDescriptors = (INavigatorContentDescriptor[]) sortOnlyList.toArray(new INavigatorContentDescriptor[] {});
}
Also used : INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with INavigatorContentDescriptor

use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.

the class CommonFilterSelectionDialog method okPressed.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
	 */
protected void okPressed() {
    if (contentExtensionsTab != null) {
        List checkedExtensions = new ArrayList();
        TableItem[] tableItems = contentExtensionsTab.getTable().getItems();
        INavigatorContentDescriptor descriptor;
        for (int i = 0; i < tableItems.length; i++) {
            descriptor = (INavigatorContentDescriptor) tableItems[i].getData();
            if (tableItems[i].getChecked()) {
                checkedExtensions.add(descriptor.getId());
            }
        }
        String[] contentExtensionIdsToActivate = (String[]) checkedExtensions.toArray(new String[checkedExtensions.size()]);
        UpdateActiveExtensionsOperation updateExtensions = new UpdateActiveExtensionsOperation(commonViewer, contentExtensionIdsToActivate);
        updateExtensions.execute(null, null);
    }
    if (commonFiltersTab != null) {
        Set checkedFilters = commonFiltersTab.getCheckedItems();
        String[] filterIdsToActivate = new String[checkedFilters.size()];
        int indx = 0;
        for (Iterator iterator = checkedFilters.iterator(); iterator.hasNext(); ) {
            ICommonFilterDescriptor descriptor = (ICommonFilterDescriptor) iterator.next();
            filterIdsToActivate[indx++] = descriptor.getId();
        }
        UpdateActiveFiltersOperation updateFilters = new UpdateActiveFiltersOperation(commonViewer, filterIdsToActivate);
        updateFilters.execute(null, null);
    }
    super.okPressed();
}
Also used : INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor) Set(java.util.Set) ICommonFilterDescriptor(org.eclipse.ui.navigator.ICommonFilterDescriptor) TableItem(org.eclipse.swt.widgets.TableItem) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List)

Example 3 with INavigatorContentDescriptor

use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.

the class ContentDescriptorContentProvider method updateCheckState.

private void updateCheckState() {
    if (talbleViewer == null || contentService == null) {
        return;
    }
    INavigatorContentDescriptor descriptor;
    boolean enabled;
    TableItem[] descriptorTableItems = talbleViewer.getTable().getItems();
    for (int i = 0; i < descriptorTableItems.length; i++) {
        if (descriptorTableItems[i].getData() instanceof INavigatorContentDescriptor) {
            descriptor = (INavigatorContentDescriptor) descriptorTableItems[i].getData();
            enabled = contentService.getActivationService().isNavigatorExtensionActive(descriptor.getId());
            talbleViewer.setChecked(descriptor, enabled);
        }
    }
}
Also used : INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor) TableItem(org.eclipse.swt.widgets.TableItem)

Example 4 with INavigatorContentDescriptor

use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.

the class ExtensionSequenceNumberComparator method compare.

/*
	 * (non-Javadoc)
	 * 
	 * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
	 */
public int compare(Object o1, Object o2) {
    INavigatorContentDescriptor lvalue = null;
    INavigatorContentDescriptor rvalue = null;
    if (o1 instanceof INavigatorContentDescriptor) {
        lvalue = (INavigatorContentDescriptor) o1;
    } else if (o1 instanceof NavigatorContentExtension) {
        lvalue = ((NavigatorContentExtension) o1).getDescriptor();
    }
    if (o2 instanceof INavigatorContentDescriptor) {
        rvalue = (INavigatorContentDescriptor) o2;
    } else if (o2 instanceof INavigatorContentExtension) {
        rvalue = ((NavigatorContentExtension) o2).getDescriptor();
    }
    if (lvalue == null || rvalue == null) {
        return -1 * sortAscending;
    }
    int c = lvalue.getSequenceNumber() - rvalue.getSequenceNumber();
    if (c != 0) {
        return c * sortAscending;
    }
    return 0;
}
Also used : INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor) INavigatorContentExtension(org.eclipse.ui.navigator.INavigatorContentExtension) INavigatorContentExtension(org.eclipse.ui.navigator.INavigatorContentExtension)

Example 5 with INavigatorContentDescriptor

use of org.eclipse.ui.navigator.INavigatorContentDescriptor in project polymap4-core by Polymap4.

the class FilterDialogSelectionListener method selectionChanged.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
	 */
public void selectionChanged(SelectionChangedEvent event) {
    IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection();
    Object element = structuredSelection.getFirstElement();
    if (element instanceof INavigatorContentDescriptor) {
        INavigatorContentDescriptor ncd = (INavigatorContentDescriptor) element;
        String desc = NLS.bind(CommonNavigatorMessages.CommonFilterSelectionDialog_Hides_all_content_associated, new Object[] { ncd.getName() });
        descriptionText.setText(desc);
    } else if (element instanceof ICommonFilterDescriptor) {
        ICommonFilterDescriptor cfd = (ICommonFilterDescriptor) element;
        String description = cfd.getDescription();
        if (description != null)
            descriptionText.setText(description);
        else
            descriptionText.setText(NLS.bind(CommonNavigatorMessages.FilterDialogSelectionListener_Enable_the_0_filter_, cfd.getName()));
    }
}
Also used : INavigatorContentDescriptor(org.eclipse.ui.navigator.INavigatorContentDescriptor) ICommonFilterDescriptor(org.eclipse.ui.navigator.ICommonFilterDescriptor) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

INavigatorContentDescriptor (org.eclipse.ui.navigator.INavigatorContentDescriptor)23 Set (java.util.Set)10 NavigatorContentDescriptor (org.eclipse.ui.internal.navigator.extensions.NavigatorContentDescriptor)10 ArrayList (java.util.ArrayList)7 LinkedHashSet (java.util.LinkedHashSet)7 List (java.util.List)7 HashSet (java.util.HashSet)6 Iterator (java.util.Iterator)6 SortedSet (java.util.SortedSet)4 TreeSet (java.util.TreeSet)4 ListIterator (java.util.ListIterator)3 NavigatorContentExtension (org.eclipse.ui.internal.navigator.extensions.NavigatorContentExtension)3 INavigatorContentExtension (org.eclipse.ui.navigator.INavigatorContentExtension)3 ListenerList (org.eclipse.core.runtime.ListenerList)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TableItem (org.eclipse.swt.widgets.TableItem)2 ICommonFilterDescriptor (org.eclipse.ui.navigator.ICommonFilterDescriptor)2 HashMap (java.util.HashMap)1 TreeMap (java.util.TreeMap)1 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)1