use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.
the class ChooseHaleConnectProjectWizard method openSelectProject.
/**
* Open a {@link ChooseHaleConnectProjectWizard}
*
* @return the selected project or null if none was selected
*/
public static HaleConnectProjectConfig openSelectProject() {
HaleConnectProjectConfig config = new HaleConnectProjectConfig();
ChooseHaleConnectProjectWizard wizard = new ChooseHaleConnectProjectWizard(config);
HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setMinimumPageSize(800, 300);
if (dialog.open() == WizardDialog.OK) {
return wizard.getConfiguration();
}
return null;
}
use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.
the class ShareProjectHandler method execute.
/**
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ShareProjectWizard wizard = new ShareProjectWizard();
HaleConnectProjectExportAdvisor advisor = new HaleConnectProjectExportAdvisor();
advisor.setServiceProvider(HaleUI.getServiceProvider());
advisor.setActionId(ProjectIO.ACTION_SAVE_PROJECT);
wizard.setAdvisor(advisor, null);
HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.open();
return null;
}
use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.
the class AbstractGenericCustomFunctionWizard method setContainer.
/**
* @see Wizard#setContainer(IWizardContainer)
*/
@Override
public void setContainer(IWizardContainer wizardContainer) {
super.setContainer(wizardContainer);
if (wizardContainer instanceof HaleWizardDialog) {
final HaleWizardDialog container = (HaleWizardDialog) wizardContainer;
// has to be pageChanging, because closing the tray in page changed
// leads to an exception
((HaleWizardDialog) wizardContainer).addPageChangingListener(new IPageChangingListener() {
@Override
public void handlePageChanging(PageChangingEvent event) {
boolean helpAvailable = false;
if (event.getTargetPage() instanceof HaleWizardPage<?>) {
HaleWizardPage<?> page = (HaleWizardPage<?>) event.getTargetPage();
helpAvailable = page.getHelpContext() != null;
}
container.setHelpButtonEnabled(helpAvailable);
if (container.getTray() != null)
container.closeTray();
}
});
}
}
use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.
the class WFSTarget method createControls.
@Override
public void createControls(Composite parent) {
getPage().setMessage("Please specify the WFS Transaction URL");
GridLayout layout = new GridLayout(3, false);
parent.setLayout(layout);
// target URL field
targetURL = new URIFieldEditor("targetURL", "Transaction URL", parent) {
// the following methods are overridden so the capabilities button
// may appear on the same line
@Override
public int getNumberOfControls() {
return super.getNumberOfControls() + 1;
}
@Override
protected void doFillIntoGrid(Composite parent, int numColumns) {
super.doFillIntoGrid(parent, numColumns - 1);
}
};
targetURL.setPage(getPage());
targetURL.setPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
if (event.getProperty().equals(FieldEditor.IS_VALID)) {
getPage().setMessage(null);
updateState();
} else if (event.getProperty().equals(FieldEditor.VALUE)) {
getPage().setMessage(null);
updateState();
}
}
});
// button to determine from capabilities
Button capButton = new Button(parent, SWT.PUSH);
capButton.setText("...");
capButton.setToolTipText("Determine based on WFS Capabilities");
capButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
WFSTransactionConfig config = new WFSTransactionConfig();
ISelection versionSel = selectVersion.getSelection();
if (!versionSel.isEmpty() && versionSel instanceof IStructuredSelection) {
WFSVersion version = (WFSVersion) ((IStructuredSelection) versionSel).getFirstElement();
config.setVersion(version);
}
WFSTransactionWizard wizard = new WFSTransactionWizard(config);
HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
WFSTransactionConfig result = wizard.getConfiguration();
// apply result
targetURL.setStringValue(result.getTransactionUri().toString());
if (result.getVersion() != null) {
selectVersion.setSelection(new StructuredSelection(result.getVersion()));
} else {
selectVersion.setSelection(new StructuredSelection());
}
}
}
});
// select version
Label versionLabel = new Label(parent, SWT.NONE);
versionLabel.setText("WFS Version");
selectVersion = new ComboViewer(parent);
GridDataFactory.swtDefaults().span(1, 1).grab(true, false).align(SWT.FILL, SWT.CENTER).applyTo(selectVersion.getControl());
selectVersion.setContentProvider(EnumContentProvider.getInstance());
selectVersion.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof WFSVersion) {
return ((WFSVersion) element).versionString;
}
return super.getText(element);
}
});
selectVersion.setInput(WFSVersion.class);
selectVersion.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateState();
}
});
// fixed content type
setContentType(HalePlatform.getContentTypeManager().getContentType(CONTENT_TYPE_ID_WFST));
// initial state update
updateState();
}
use of eu.esdihumboldt.hale.ui.util.wizard.HaleWizardDialog in project hale by halestudio.
the class WFSGetFeatureSource method determineSource.
@Override
protected void determineSource(URIFieldEditor sourceURL) {
WFSGetFeatureConfig config = new WFSGetFeatureConfig();
WFSGetFeatureWizard wizard = new WFSGetFeatureWizard(config, getSchemaSpace());
HaleWizardDialog dialog = new HaleWizardDialog(Display.getCurrent().getActiveShell(), wizard);
if (dialog.open() == WizardDialog.OK) {
WFSGetFeatureConfig result = wizard.getConfiguration();
// create URL
URIBuilder builder = new URIBuilder(result.getGetFeatureUri());
// add fixed parameters
builder.addParameter("SERVICE", "WFS");
builder.addParameter("VERSION", result.getVersion().toString());
builder.addParameter("REQUEST", "GetFeature");
// specify type names
if (!result.getTypeNames().isEmpty()) {
KVPUtil.addTypeNameParameter(builder, result.getTypeNames(), result.getVersion());
}
// BBOX
if (result.getBbox() != null) {
BBox bb = result.getBbox();
List<String> vals = new ArrayList<>(5);
vals.add(Double.toString(bb.getX1()));
vals.add(Double.toString(bb.getY1()));
vals.add(Double.toString(bb.getX2()));
vals.add(Double.toString(bb.getY2()));
String crs = result.getBboxCrsUri();
if (crs != null && !crs.isEmpty()) {
vals.add(crs);
} else {
// if no CRS is provided this may be a problem, because
// default behavior is different for WFS 1.1 and WFS 2.0
// WFS 1.1: WGS 84
// WFS 2.0: Service default CRS
}
builder.addParameter("BBOX", Joiner.on(',').join(vals));
}
// MAXFEATURES (WFS 1) / COUNT (WFS 2)
if (result.getMaxFeatures() != null) {
switch(result.getVersion()) {
case V1_1_0:
builder.addParameter("MAXFEATURES", String.valueOf(result.getMaxFeatures()));
break;
case V2_0_0:
case V2_0_2:
default:
builder.addParameter("COUNT", String.valueOf(result.getMaxFeatures()));
break;
}
}
try {
sourceURL.setStringValue(builder.build().toString());
getPage().setErrorMessage(null);
} catch (URISyntaxException e) {
getPage().setErrorMessage(e.getLocalizedMessage());
}
}
}
Aggregations