use of org.eclipse.jface.viewers.ISelectionChangedListener in project hale by halestudio.
the class BasicConfigurationWithWMSListPage method createComponent.
@Override
public void createComponent() {
super.createComponent();
Button storeWMS = new Button(getComposite(), SWT.PUSH);
storeWMS.setText(Messages.WMSListConfigurationPage_2);
// add new WMS to list and refresh
storeWMS.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
// store WMS i UI list
map.put(getServiceName(), getServiceURL());
getListForUI(listUI);
comboViewer.refresh();
}
});
// free line
new Text(getComposite(), SWT.NONE).setEditable(false);
new Text(getComposite(), SWT.NONE).setEditable(false);
new Text(getComposite(), SWT.NONE).setEditable(false);
new Text(getComposite(), SWT.NONE).setEditable(false);
new Text(getComposite(), SWT.NONE).setEditable(false);
// add text and combo viewer
Text text = new Text(getComposite(), SWT.NONE);
text.setEditable(false);
text.setText(Messages.WMSListConfigurationPage_0);
// get a list of all WMS
// get all WMS, storing as WMS Map Server
Preferences PREF_SERVERS = new WMSMapServer().getPreferences();
String[] prefs = null;
try {
prefs = PREF_SERVERS.childrenNames();
// put all in map
for (String current : prefs) {
Preferences child = PREF_SERVERS.node(current);
map.put(current, child.get("baseUrl", "baseUrl"));
}
} catch (BackingStoreException e) {
// $NON-NLS-1$
log.warn(Messages.WMSListConfigurationPage_1, e);
}
// get all WMS, storing as extension points
IConfigurationElement[] allER = Platform.getExtensionRegistry().getConfigurationElementsFor("de.fhg.igd.mapviewer.server.MapServer");
for (IConfigurationElement current : allER) {
String name = "";
String url = "";
// name is stored directly as attribute
name = current.getAttribute("name");
// url is stored as child
for (IConfigurationElement child : current.getChildren()) {
if (child.getAttribute("name").equals("baseUrl")) {
url = child.getAttribute("value");
}
}
// store everything into map
if (name != null && !name.isEmpty() && url != null && !url.isEmpty()) {
map.put(name, url);
}
}
// show stored WMS as DropDown
comboViewer = new ComboViewer(getComposite(), SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
comboViewer.setContentProvider(new ArrayContentProvider());
getListForUI(listUI);
comboViewer.setInput(listUI);
comboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
if (selection.size() > 0) {
String currentSelection = (String) selection.getFirstElement();
name.setStringValue(currentSelection);
location.setStringValue(map.get(currentSelection));
}
}
});
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project hale by halestudio.
the class SRSConfigurationPage method createContent.
/**
* @see WMSWizardPage#createContent(Composite)
*/
@Override
public void createContent(Composite parent) {
Composite page = new Composite(parent, SWT.NONE);
page.setLayout(new GridLayout(1, false));
// SRS
Combo combo = new Combo(page, SWT.DROP_DOWN | SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
viewer = new ComboViewer(combo);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new SRSLabelProvider());
viewer.addPostSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
update();
}
});
setControl(page);
update();
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project hale by halestudio.
the class InstanceExportConfigurationPage method onShowPage.
@Override
protected void onShowPage(boolean firstShow) {
if (firstShow) {
ViewerFilter[] filters = { validTypesToSelect };
typeSelector = new TypeDefinitionSelector(page, "Select the corresponding schema type", getWizard().getProvider().getTargetSchema(), filters);
typeSelector.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1, 1).create());
typeSelector.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
setPageComplete(!(event.getSelection().isEmpty()));
if (typeSelector.getSelectedObject() != null) {
// TypeDefinition type =
// typeSelector.getSelectedObject();
// label.getParent().layout();
page.layout();
page.pack();
}
}
});
}
page.layout();
page.pack();
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project archi by archimatetool.
the class NewNestedRelationDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
// Help
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
setTitle(Messages.NewNestedRelationDialog_1);
String message = NLS.bind(Messages.NewNestedRelationDialog_2, fParentElement.getName(), fChildElement.getName());
setMessage(message);
Composite composite = (Composite) super.createDialogArea(parent);
Composite client = new Composite(composite, SWT.NULL);
GridLayout layout = new GridLayout(1, false);
client.setLayout(layout);
client.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite tableComp = new Composite(client, SWT.BORDER);
tableComp.setLayout(new TableColumnLayout());
tableComp.setLayoutData(new GridData(GridData.FILL_BOTH));
fTableViewer = new RelationsTableViewer(tableComp, SWT.NONE);
fTableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
// anything will do //$NON-NLS-1$
fTableViewer.setInput("");
fTableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
fSelected = (EClass) ((IStructuredSelection) fTableViewer.getSelection()).getFirstElement();
}
});
if (fValidRelations != null && fValidRelations.length > 0) {
fTableViewer.setSelection(new StructuredSelection(fValidRelations[0]));
}
return composite;
}
use of org.eclipse.jface.viewers.ISelectionChangedListener in project archi by archimatetool.
the class ValidatorView method createPartControl.
@Override
public void createPartControl(Composite parent) {
Composite treeComp = new Composite(parent, SWT.NULL);
treeComp.setLayout(new TreeColumnLayout());
treeComp.setLayoutData(new GridData(GridData.FILL_BOTH));
fViewer = new ValidatorViewer(treeComp, SWT.NULL);
fViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
selectObjects((IStructuredSelection) event.getSelection());
}
});
fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
updateMenuItems((IStructuredSelection) event.getSelection());
}
});
makeActions();
registerGlobalActions();
makeLocalToolBar();
hookContextMenu();
// Listen to global selections to update the viewer
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
// Selection Provider
getSite().setSelectionProvider(fViewer);
// Help
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, HELP_ID);
// Register us as a Model Listener
IEditorModelManager.INSTANCE.addPropertyChangeListener(this);
// Initialise with whatever is selected in the workbench
selectionChanged(getSite().getWorkbenchWindow().getPartService().getActivePart(), getSite().getWorkbenchWindow().getSelectionService().getSelection());
// Table row bug on Yosemite https://bugs.eclipse.org/bugs/show_bug.cgi?id=446534
if (PlatformUtils.isMac() && System.getProperty("os.version").startsWith("10.10")) {
// $NON-NLS-1$//$NON-NLS-2$
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
validateModel();
}
});
} else {
validateModel();
}
}
Aggregations