use of eu.esdihumboldt.hale.ui.common.definition.selector.TypeDefinitionSelector 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 eu.esdihumboldt.hale.ui.common.definition.selector.TypeDefinitionSelector in project hale by halestudio.
the class TypeSelectionPage method onShowPage.
/**
* @see HaleWizardPage#onShowPage(boolean)
*/
@Override
protected void onShowPage(boolean firstShow) {
super.onShowPage(firstShow);
if (firstShow) {
selector = new TypeDefinitionSelector(page, "Select the corresponding schema type", getWizard().getProvider().getSourceSchema(), null);
selector.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1, 1).create());
selector.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
validateSelection();
}
});
page.layout();
page.pack();
}
LocatableInputSupplier<? extends InputStream> currentSource = getWizard().getProvider().getSource();
if (!currentSource.equals(lastSource)) {
// if the source has changed
lastSource = currentSource;
lastType = ShapeSchemaReader.readShapeType(lastSource);
if (selector.getSelectedObject() == null) {
// try to find a candidate for default selection
if (lastType != null) {
Pair<TypeDefinition, Integer> pt = ShapeInstanceReader.getMostCompatibleShapeType(getWizard().getProvider().getSourceSchema(), lastType, lastType.getName().getLocalPart());
if (pt != null) {
selector.setSelection(new StructuredSelection(pt.getFirst()));
}
}
}
validateSelection();
}
}
use of eu.esdihumboldt.hale.ui.common.definition.selector.TypeDefinitionSelector in project hale by halestudio.
the class TypeSelectionPage method createContent.
/**
* @see eu.esdihumboldt.hale.ui.HaleWizardPage#createContent(org.eclipse.swt.widgets.Composite)
*/
@Override
protected void createContent(Composite page) {
page.setLayout(new GridLayout(2, false));
// XXX needed?
GridData layoutData = new GridData();
layoutData.widthHint = 200;
label = new Label(page, SWT.NONE);
label.setText("Choose your Type:");
SchemaService ss = PlatformUI.getWorkbench().getService(SchemaService.class);
sel = new TypeDefinitionSelector(page, "Select the corresponding schema type", ss.getSchemas(SchemaSpaceID.SOURCE), null);
sel.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(1, 1).create());
sel.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
setPageComplete(!(event.getSelection().isEmpty()));
if (sel.getSelectedObject() != null) {
TypeDefinition type = sel.getSelectedObject();
CSVConfiguration conf = type.getConstraint(CSVConfiguration.class);
Boolean skip = conf.skipFirst();
button.setSelection(skip);
label.getParent().layout();
}
}
});
button = new Button(page, SWT.CHECK);
button.setText("Skip first line");
button.setSelection(true);
page.pack();
setPageComplete(false);
}
Aggregations