Search in sources :

Example 1 with XMLCatalogEntryDetailsView

use of org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView in project webtools.sourceediting by eclipse.

the class SelectFromCatalogDialog method createCatalogDetailsView.

protected void createCatalogDetailsView(Composite parent) {
    Group detailsGroup = new Group(parent, SWT.NONE);
    detailsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    detailsGroup.setLayout(new GridLayout());
    detailsGroup.setText(XMLCatalogMessages.UI_LABEL_DETAILS);
    final XMLCatalogEntryDetailsView detailsView = new XMLCatalogEntryDetailsView(detailsGroup);
    ISelectionChangedListener listener = new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection selection = event.getSelection();
            Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null;
            if (selectedObject instanceof ICatalogEntry) {
                ICatalogEntry entry = (ICatalogEntry) selectedObject;
                detailsView.setCatalogElement(entry);
                currentSelectionLocation = entry.getURI();
                currentSelectionNamespace = entry.getKey();
            } else {
                detailsView.setCatalogElement((ICatalogEntry) null);
                currentSelectionLocation = "";
                currentSelectionNamespace = "";
            }
        }
    };
    catalogEntriesView.getViewer().addSelectionChangedListener(listener);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) XMLCatalogEntryDetailsView(org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) GridData(org.eclipse.swt.layout.GridData) ISelection(org.eclipse.jface.viewers.ISelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ICatalogEntry(org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry)

Aggregations

ISelection (org.eclipse.jface.viewers.ISelection)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Group (org.eclipse.swt.widgets.Group)1 ICatalogEntry (org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry)1 XMLCatalogEntryDetailsView (org.eclipse.wst.xml.ui.internal.catalog.XMLCatalogEntryDetailsView)1