use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.
the class WidgetEditor method setCurrentViewer.
/**
* This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
* is the current one.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCurrentViewer(Viewer viewer) {
//
if (currentViewer != viewer) {
if (selectionChangedListener == null) {
// Create the listener on demand.
//
selectionChangedListener = new ISelectionChangedListener() {
// This just notifies those things that are affected by the section.
//
public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
setSelection(selectionChangedEvent.getSelection());
}
};
}
//
if (currentViewer != null) {
currentViewer.removeSelectionChangedListener(selectionChangedListener);
}
//
if (viewer != null) {
viewer.addSelectionChangedListener(selectionChangedListener);
}
// Remember it.
//
currentViewer = viewer;
// Set the editors selection based on the current viewer's selection.
//
setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
}
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.
the class WidgetEditor method getContentOutlinePage.
/**
* This accesses a cached version of the content outliner.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IContentOutlinePage getContentOutlinePage() {
if (contentOutlinePage == null) {
//
class MyContentOutlinePage extends ContentOutlinePage {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
contentOutlineViewer = getTreeViewer();
contentOutlineViewer.addSelectionChangedListener(this);
// Set up the tree viewer.
//
contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
contentOutlineViewer.setInput(editingDomain.getResourceSet());
// Make sure our popups work.
//
createContextMenuFor(contentOutlineViewer);
if (!editingDomain.getResourceSet().getResources().isEmpty()) {
// Select the root object in the view.
//
contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
}
}
@Override
public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
super.makeContributions(menuManager, toolBarManager, statusLineManager);
contentOutlineStatusLineManager = statusLineManager;
}
@Override
public void setActionBars(IActionBars actionBars) {
super.setActionBars(actionBars);
getActionBarContributor().shareGlobalActions(this, actionBars);
}
}
contentOutlinePage = new MyContentOutlinePage();
// Listen to selection so that we can handle it is a special way.
//
contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
// This ensures that we handle selections correctly.
//
public void selectionChanged(SelectionChangedEvent event) {
handleContentOutlineSelection(event.getSelection());
}
});
}
return contentOutlinePage;
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project Malai by arnobl.
the class WidgetEditor method setSelection.
/**
* This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
* Calling this result will notify the listeners.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSelection(ISelection selection) {
editorSelection = selection;
for (ISelectionChangedListener listener : selectionChangedListeners) {
listener.selectionChanged(new SelectionChangedEvent(this, selection));
}
setStatusLineManager(selection);
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project hale by halestudio.
the class AbstractWFSCapabilitiesPage method createContent.
@Override
protected void createContent(Composite parent) {
Composite page = new Composite(parent, SWT.NONE);
page.setLayout(new GridLayout(2, false));
// capabilities field
location = new WFSCapabilitiesFieldEditor("location", "GetCapabilities URL", page) {
@Override
protected WFSVersion getWFSVersion() {
if (versionSelect != null) {
ISelection sel = versionSelect.getSelection();
if (!sel.isEmpty() && sel instanceof IStructuredSelection) {
Object selected = ((IStructuredSelection) sel).getFirstElement();
if (NoObject.NONE.equals(selected)) {
return null;
}
return (WFSVersion) selected;
}
}
return super.getWFSVersion();
}
};
location.setPage(this);
location.setPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(FieldEditor.IS_VALID)) {
update();
}
}
});
String currentValue = getCapabilitiesURL(getWizard().getConfiguration());
if (currentValue != null) {
location.setValue(currentValue);
}
// version field
Label vLabel = new Label(page, SWT.NONE);
vLabel.setText("WFS version");
versionSelect = new ComboViewer(page, SWT.READ_ONLY);
GridDataFactory.fillDefaults().grab(true, false).applyTo(versionSelect.getControl());
versionSelect.setContentProvider(new EnumContentProvider() {
@Override
public Object[] getElements(Object inputElement) {
Object[] values = super.getElements(inputElement);
// add a NoObject
values = Arrays.copyOf(values, values.length + 1, Object[].class);
values[values.length - 1] = NoObject.NONE;
return values;
}
});
versionSelect.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof NoObject) {
return "Based on URL / server default";
}
return super.getText(element);
}
});
versionSelect.setInput(WFSVersion.class);
versionSelect.setSelection(new StructuredSelection(NoObject.NONE));
versionSelect.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
location.revalidate();
}
});
setControl(page);
update();
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project hale by halestudio.
the class ClassificationMappingParameterPage method createContent.
/**
* @see eu.esdihumboldt.hale.ui.HaleWizardPage#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void createContent(Composite page) {
page.setLayout(GridLayoutFactory.swtDefaults().numColumns(4).create());
// not classified action
notClassifiedActionComposite = new Composite(page, SWT.NONE);
notClassifiedActionComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 4, 1));
notClassifiedActionComposite.setLayout(GridLayoutFactory.swtDefaults().numColumns(4).margins(0, 0).create());
Label notClassifiedActionLabel = new Label(notClassifiedActionComposite, SWT.NONE);
notClassifiedActionLabel.setText("For unmapped source values");
notClassifiedActionLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
notClassifiedActionViewer = new ComboViewer(notClassifiedActionComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
notClassifiedActionViewer.getControl().setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
notClassifiedActionViewer.setContentProvider(ArrayContentProvider.getInstance());
notClassifiedActionViewer.setInput(notClassifiedActionOptions);
notClassifiedActionViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (notClassifiedActionOptions.indexOf(((IStructuredSelection) event.getSelection()).getFirstElement()) == 2)
createFixedValueInputButton(null);
else
removeFixedValueInputButton();
}
});
notClassifiedActionViewer.setSelection(new StructuredSelection(notClassifiedActionOptions.get(0)));
if (notClassifiedAction != null) {
if (notClassifiedAction.equals("source"))
notClassifiedActionViewer.setSelection(new StructuredSelection(notClassifiedActionOptions.get(1)));
else if (notClassifiedAction.startsWith("fixed:")) {
notClassifiedActionViewer.setSelection(new StructuredSelection(notClassifiedActionOptions.get(2)));
createFixedValueInputButton(notClassifiedAction.substring(6));
}
}
// Tabs
tabs = new TabFolder(page, SWT.NONE);
tabs.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
// The manualTab for the manual way to specify something like a
// lookupTable
manualItem = new TabItem(tabs, SWT.NONE);
manualItem.setText("Explicit");
manualItem.setControl(createManualTabControl(tabs));
// FromFileTab to load lookupTable from file
fromFileItem = new TabItem(tabs, SWT.NONE);
fromFileItem.setText("From file");
fromFileItem.setControl(createFromFileTabControl(tabs));
if (selectedLookupTableID != null) {
tabs.setSelection(fromFileItem);
}
}
Aggregations