List of usage examples for org.eclipse.jface.preference FieldEditor IS_VALID
String IS_VALID
To view the source code for org.eclipse.jface.preference FieldEditor IS_VALID.
Click Source Link
"field_editor_is_valid"
) to signal a change in the validity of the value of this field editor. From source file:de.fhg.igd.mapviewer.server.wms.wizard.pages.BasicConfigurationPage.java
License:Open Source License
/** * Create components for basic options, the service name and location. *//*from w w w . j a v a 2 s . co m*/ protected void createComponent() { // name String serverName = getConfiguration().getName(); boolean enterName = serverName == null || serverName.isEmpty(); name = new ConfigurationNameFieldEditor(getConfiguration()); name.fillIntoGrid(page, 3); name.setStringValue(serverName); if (!enterName) { checkName = false; name.setEnabled(false, page); } name.setLabelText(Messages.BasicConfigurationPage_3); name.setPage(this); name.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { update(); } } }); // location location = new WMSLocationFieldEditor(page.getDisplay()); location.fillIntoGrid(page, 3); location.setEmptyStringAllowed(false); location.setStringValue(getConfiguration().getBaseUrl()); location.setLabelText(Messages.BasicConfigurationPage_4); location.setPage(this); location.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { update(); } } }); }
From source file:eu.esdihumboldt.hale.io.gml.ui.wfs.AbstractWFSSource.java
License:Open Source License
/** * @see ImportSource#createControls(Composite) *///from w ww.ja va 2s . co m @Override public void createControls(Composite parent) { parent.setLayout(new GridLayout(3, false)); // caption new Label(parent, SWT.NONE); // placeholder Label caption = new Label(parent, SWT.NONE); caption.setText(getCaption()); caption.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 2, 1)); // source file sourceURL = createWfsFieldEditor(parent); sourceURL.setPage(getPage()); sourceURL.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { updateState(false); } else if (event.getProperty().equals(FieldEditor.VALUE)) { updateState(false); } } }); // provider selection // label Label providerLabel = new Label(parent, SWT.NONE); providerLabel.setText("Import as"); // create provider combo ComboViewer providers = createProviders(parent); providers.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1)); // initial state update updateState(true); }
From source file:eu.esdihumboldt.hale.io.gml.ui.wfs.wizard.CapabilitiesPage.java
License:Open Source License
/** * @see AbstractWfsPage#createContent(Composite) *///from www . j a va 2s.co m @Override protected void createContent(Composite parent) { Composite page = new Composite(parent, SWT.NONE); page.setLayout(new GridLayout(2, false)); location = new WfsLocationFieldEditor("location", Messages.CapabilitiesPage_4, page); //$NON-NLS-1$ //$NON-NLS-2$ location.setPage(this); location.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { update(); } } }); String currentValue = getConfiguration().getCapabilitiesURL(); if (currentValue != null) { location.setValue(currentValue); } setControl(page); update(); }
From source file:eu.esdihumboldt.hale.io.haleconnect.ui.projects.HaleConnectSource.java
License:Open Source License
/** * @see ImportSource#createControls(Composite) *//*from w ww . ja va 2 s . c o m*/ @Override public void createControls(Composite parent) { parent.setLayout(new GridLayout(3, false)); HaleConnectService hcs = HaleUI.getServiceProvider().getService(HaleConnectService.class); /* * Login status label */ loginStatusLabel = new Label(parent, SWT.NONE); loginStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); loginButton = new Button(parent, SWT.PUSH); loginButton.setText("Login"); loginButton.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { HaleConnectLoginDialog loginDialog = HaleConnectLoginHandler .createLoginDialog(Display.getCurrent().getActiveShell()); if (loginDialog.open() == Dialog.OK) { HaleConnectLoginHandler.performLogin(loginDialog); updateLoginStatus(); } } }); /* * Project name text field */ projectName = new StringFieldEditor("project", "Project", parent) { // the following methods are overridden so the 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); } }; projectName.setEmptyStringAllowed(false); projectName.setErrorMessage("Please select a project before continuing."); projectName.setPage(getPage()); projectName.getTextControl(parent).setEditable(false); projectName.getTextControl(parent).addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { selectProject(); } }); projectName.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { getPage().setMessage(null); updateState(false); } else if (event.getProperty().equals(FieldEditor.VALUE)) { getPage().setMessage(null); updateState(false); } } }); /* * Select project button */ selectProjectButton = new Button(parent, SWT.PUSH); selectProjectButton.setText("Select"); selectProjectButton.setToolTipText("Select project"); selectProjectButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); selectProjectButton.setEnabled(hcs.isLoggedIn()); selectProjectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { selectProject(); } }); /* * Supported types */ supportedTypes = new HashSet<IContentType>(); if (getConfiguration().getContentType() != null) { supportedTypes.add(getConfiguration().getContentType()); } else { // set content types for file field Collection<IOProviderDescriptor> factories = getConfiguration().getFactories(); for (IOProviderDescriptor factory : factories) { supportedTypes.addAll(factory.getSupportedTypes()); } } // types combo Composite group = new Composite(parent, SWT.NONE); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 3, 1)); group.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).create()); // label Label providerLabel = new Label(parent, SWT.NONE); providerLabel.setText("Import as"); // create provider combo ComboViewer providers = createProviders(parent); providers.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1)); updateLoginStatus(); // initial state update updateState(true); }
From source file:eu.esdihumboldt.hale.io.haleconnect.ui.projects.HaleConnectTarget.java
License:Open Source License
@Override public void createControls(Composite parent) { getPage().setDescription("Please select a destination file for the export"); parent.setLayout(new GridLayout(4, false)); Composite loginGroup = new Composite(parent, SWT.BORDER); loginGroup.setLayout(new GridLayout(4, false)); GridData loginGroupLayout = new GridData(SWT.LEAD, SWT.LEAD, false, false, 4, 1); loginGroupLayout.widthHint = 550;/*w w w . j av a2 s. co m*/ loginGroup.setLayoutData(loginGroupLayout); /* * Login status label */ loginStatusLabel = new Label(loginGroup, SWT.NONE); loginStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); loginButton = new Button(loginGroup, SWT.PUSH); loginButton.setText("Login"); loginButton.setLayoutData(new GridData(SWT.LEAD, SWT.CENTER, false, false, 1, 1)); loginButton.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { HaleConnectLoginDialog loginDialog = HaleConnectLoginHandler .createLoginDialog(Display.getCurrent().getActiveShell()); if (loginDialog != null && loginDialog.open() == Dialog.OK) { HaleConnectLoginHandler.performLogin(loginDialog); updateState(); prefillTargetProject(); } } }); updateOrNewGroup = new Group(parent, SWT.NONE); updateOrNewGroup.setText("Please choose whether you would like to..."); updateOrNewGroup.setLayout(new GridLayout(4, false)); updateOrNewGroup.setLayoutData(new GridData(SWT.LEAD, SWT.LEAD, false, false, 4, 1)); newProject = new Button(updateOrNewGroup, SWT.RADIO); newProject.setText("create a new project on hale connect"); newProject.setSelection(true); newProject.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { updateState(); } }); updateProject = new Button(updateOrNewGroup, SWT.RADIO); updateProject.setText("update an existing project"); updateProject.addSelectionListener(new SelectionAdapter() { /** * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { updateState(); } }); controlsStackLayout = new StackLayout(); controlsStack = new Composite(parent, SWT.NONE); controlsStack.setLayout(controlsStackLayout); newProjectControls = new Composite(controlsStack, SWT.NONE); newProjectControls.setLayout(new GridLayout(4, true)); GridData grid = new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1); newProjectControls.setLayoutData(grid); ownershipGroup = new Composite(newProjectControls, SWT.NONE); ownershipGroup.setLayout(new GridLayout(4, false)); ownershipGroup.setLayoutData(new GridData(SWT.LEAD, SWT.LEAD, false, false, 4, 1)); Label ownerLabel = new Label(ownershipGroup, SWT.NONE); ownerLabel.setText("Who should own the uploaded project?"); ownerUser = new Button(ownershipGroup, SWT.RADIO); ownerUser.setText("You"); ownerOrg = new Button(ownershipGroup, SWT.RADIO); ownerOrg.setText("Your organisation"); orgSelector = new ComboViewer(ownershipGroup); GridData orgSelectorGrid = new GridData(SWT.LEAD, SWT.LEAD, false, false); orgSelectorGrid.widthHint = 175; orgSelector.getCombo().setLayoutData(orgSelectorGrid); orgSelector.setContentProvider(ArrayContentProvider.getInstance()); orgSelector.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof HaleConnectOrganisationInfo) { return ((HaleConnectOrganisationInfo) element).getName(); } return super.getText(element); } }); Composite bucketOptions = new Composite(parent, SWT.NONE); bucketOptions.setLayout(new RowLayout()); bucketOptions.setLayoutData(new GridData(SWT.LEAD, SWT.LEAD, true, true, 4, 1)); enableVersioning = new Button(bucketOptions, SWT.CHECK); enableVersioning.setText("Enable versioning?"); publicAccess = new Button(bucketOptions, SWT.CHECK); publicAccess.setText("Allow public access?"); updateProjectControls = new Composite(controlsStack, SWT.NONE); updateProjectControls.setVisible(false); updateProjectControls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1)); /* * Project name text field */ projectName = new StringFieldEditor("project", "Project to update", updateProjectControls) { // the following methods are overridden so the 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); } }; projectName.setEmptyStringAllowed(false); projectName.setErrorMessage("Please select a project before continuing."); projectName.setPage(getPage()); projectName.getTextControl(updateProjectControls).setEditable(false); projectName.getTextControl(updateProjectControls).addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { selectProject(); } }); projectName.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(); } } }); /* * Select project button */ selectProjectButton = new Button(updateProjectControls, SWT.PUSH); selectProjectButton.setText("Select"); selectProjectButton.setToolTipText("Select project"); selectProjectButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); selectProjectButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { selectProject(); } }); FontData currentFont = loginStatusLabel.getFont().getFontData()[0]; upstreamModifiedWarning = new Label(updateProjectControls, SWT.WRAP); upstreamModifiedWarning.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 4, 1)); upstreamModifiedWarning.setFont(new Font(upstreamModifiedWarning.getDisplay(), new FontData(currentFont.getName(), currentFont.getHeight(), SWT.BOLD))); upstreamModifiedWarning.setVisible(false); Composite writerOptions = new Composite(parent, SWT.NONE); writerOptions.setLayout(new RowLayout()); writerOptions.setLayoutData(new GridData(SWT.LEAD, SWT.LEAD, true, true, 4, 2)); includeWebResources = new Button(writerOptions, SWT.CHECK); includeWebResources.setText("Include web resources?"); excludeData = new Button(writerOptions, SWT.CHECK); excludeData.setText("Exclude source data?"); excludeData.setSelection(true); excludeCachedResources = new Button(writerOptions, SWT.CHECK); excludeCachedResources .setText("Use cached internal schema representation (required for big schema files)?"); excludeCachedResources.setSelection(true); prefillTargetProject(); updateState(); }
From source file:eu.esdihumboldt.hale.io.wfs.ui.AbstractWFSSource.java
License:Open Source License
/** * @see ImportSource#createControls(Composite) *//*from ww w . j ava 2s . c o m*/ @Override public void createControls(Composite parent) { parent.setLayout(new GridLayout(4, false)); // caption new Label(parent, SWT.NONE); // placeholder Label caption = new Label(parent, SWT.NONE); caption.setText(getCaption()); caption.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 3, 1)); // source file // target URL field sourceURL = new URLSourceURIFieldEditor("sourceURL", "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); } }; sourceURL.setPage(getPage()); // set custom URI filter sourceURL.setURIFilter(createHistoryURIFilter()); // set content types for URI field Collection<IOProviderDescriptor> factories = getConfiguration().getFactories(); HashSet<IContentType> supportedTypes = new HashSet<IContentType>(); for (IOProviderDescriptor factory : factories) { supportedTypes.addAll(factory.getSupportedTypes()); } sourceURL.setContentTypes(supportedTypes); sourceURL.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { getPage().setMessage(null); updateState(true); } else if (event.getProperty().equals(FieldEditor.VALUE)) { getPage().setMessage(null); updateState(true); } } }); // 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) { determineSource(sourceURL); } }); // provider selection // label Label providerLabel = new Label(parent, SWT.NONE); providerLabel.setText("Import as"); // create provider combo ComboViewer providers = createProviders(parent); providers.getControl().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1)); // initial state update updateState(true); }
From source file:eu.esdihumboldt.hale.io.wfs.ui.capabilities.AbstractWFSCapabilitiesPage.java
License:Open Source License
@Override protected void createContent(Composite parent) { Composite page = new Composite(parent, SWT.NONE); page.setLayout(new GridLayout(2, false)); location = new WFSCapabilitiesFieldEditor("location", "GetCapabilities URL", page); location.setPage(this); location.setPropertyChangeListener(new IPropertyChangeListener() { @Override//from w w w.jav a2 s. com public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { update(); } } }); String currentValue = getCapabilitiesURL(getWizard().getConfiguration()); if (currentValue != null) { location.setValue(currentValue); } setControl(page); update(); }
From source file:eu.esdihumboldt.hale.io.wfs.ui.WFSTarget.java
License:Open Source License
@Override public void createControls(Composite parent) { GridLayout layout = new GridLayout(3, false); parent.setLayout(layout);/*from ww w. j av a 2 s . c o m*/ // 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(Platform.getContentTypeManager().getContentType(CONTENT_TYPE_ID_WFST)); // initial state update updateState(); }
From source file:eu.esdihumboldt.hale.ui.io.instance.crs.SelectCRSDialog.java
License:Open Source License
/** * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) *///from ww w . j a va2 s.c o m @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.VALUE)) { CRSFieldEditor editor = (CRSFieldEditor) event.getSource(); updateMessage(editor); } else if (event.getProperty().equals(FieldEditor.IS_VALID)) { updateState(); } }
From source file:eu.esdihumboldt.hale.ui.io.project.ArchiveProjectImportSelectLocationPage.java
License:Open Source License
@Override protected void createContent(Composite page) { directoryField = new KeyStrokeValidatingDirectoryFieldEditor("Import location", "Select directory", page); directoryField.setEmptyStringAllowed(false); directoryField.setPropertyChangeListener(new IPropertyChangeListener() { @Override//www .j a va2s .com public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(FieldEditor.IS_VALID)) { updateState(); } else if (event.getProperty().equals(FieldEditor.VALUE)) { updateState(); } } }); }