Search in sources :

Example 1 with FileChooser

use of org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser in project scout.rt by eclipse.

the class AbstractFileChooserField method getFileChooser.

/**
 * @deprecated The UI will display the native file chooser dialog on click. There is no {@link FileChooser} created on
 *             java side anymore. Will be removed with 7.0
 */
@Deprecated
@Override
public IFileChooser getFileChooser() {
    FileChooser fileChooser = new FileChooser(getFileExtensions(), false);
    fileChooser.setMaximumUploadSize(getMaximumUploadSize());
    return fileChooser;
}
Also used : FileChooser(org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser) IFileChooser(org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)

Example 2 with FileChooser

use of org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser in project scout.rt by eclipse.

the class AbstractForm method doImportXml.

@Override
public void doImportXml() {
    try {
        List<BinaryResource> a = new FileChooser(Collections.singletonList("xml"), false).startChooser();
        if (a.size() == 1) {
            BinaryResource newPath = a.get(0);
            try (InputStream in = new ByteArrayInputStream(newPath.getContent())) {
                // NOSONAR
                Document doc = XmlUtility.getXmlDocument(in);
                // load xml to search
                loadFromXml(doc.getDocumentElement());
            } catch (Exception e) {
                LOG.warn("Could not load XML from file: {}", newPath, e);
                MessageBoxes.createOk().withDisplayParent(this).withHeader(TEXTS.get("LoadFormXmlFailedText")).show();
            }
        }
    } catch (Exception e) {
        BEANS.get(ExceptionHandler.class).handle(e);
    }
}
Also used : BinaryResource(org.eclipse.scout.rt.platform.resource.BinaryResource) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) FileChooser(org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser) Document(org.w3c.dom.Document) PlatformException(org.eclipse.scout.rt.platform.exception.PlatformException) ProcessingException(org.eclipse.scout.rt.platform.exception.ProcessingException) VetoException(org.eclipse.scout.rt.platform.exception.VetoException)

Aggregations

FileChooser (org.eclipse.scout.rt.client.ui.basic.filechooser.FileChooser)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 IFileChooser (org.eclipse.scout.rt.client.ui.basic.filechooser.IFileChooser)1 PlatformException (org.eclipse.scout.rt.platform.exception.PlatformException)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 VetoException (org.eclipse.scout.rt.platform.exception.VetoException)1 BinaryResource (org.eclipse.scout.rt.platform.resource.BinaryResource)1 Document (org.w3c.dom.Document)1