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[] {});
}
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();
}
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);
}
}
}
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;
}
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()));
}
}
Aggregations