public void actionPerformed(ActionEvent e) { final File file = Dialogs.requestFileForOpen("AOI Processing Graph", false, null, GraphBuilderDialog.LAST_GRAPH_PATH); if (file != null) { graphField.setText(file.getAbsolutePath()); } } });
public void actionPerformed(ActionEvent e) { final File file = Dialogs.requestFileForOpen("User Defined Kernel File", false, null, "snap.filterDir"); kernelFile.setText(file.getAbsolutePath()); } });
@Override public void run() { answer[0] = Dialogs.requestDecision(title, msg, true, null); if (answer[0] == Dialogs.Answer.YES) { newFile[0] = Dialogs.requestFileForOpen(title, false, null, null); } } });
public void actionPerformed(ActionEvent e) { final File file = Dialogs.requestFileForOpen("External DEM File", false, null, DEMFactory.LAST_EXTERNAL_DEM_DIR_KEY); externalDEMFile.setText(file.getAbsolutePath()); extNoDataValue = OperatorUIUtils.getNoDataValue(file); externalDEMNoDataValue.setText(String.valueOf(extNoDataValue)); } });
/** * Loads a new graph from a file */ public void LoadGraph() { final SnapFileFilter fileFilter = new SnapFileFilter("XML", "xml", "Graph"); final File graphFile = Dialogs.requestFileForOpen("Load Graph", false, fileFilter, LAST_GRAPH_PATH); if (graphFile == null) return; LoadGraph(graphFile); }
private ActionListener createLoadExpressionButtonListener() { return e -> { try { final File file = Dialogs.requestFileForOpen( "Load Band Maths Expression", false, null, PREF_KEY_LAST_EXPRESSION_PATH); if (file != null) { expression = new String(Files.readAllBytes(file.toPath())); bindingContext.getBinding(PROPERTY_NAME_EXPRESSION).setPropertyValue(expression); bindingContext.getBinding(PROPERTY_NAME_EXPRESSION).adjustComponents(); } } catch (IOException ex) { showErrorDialog(ex.getMessage()); } }; }
@Override public void actionPerformed(ActionEvent event) { final SessionManager manager = SessionManager.getDefault(); if (manager.getSessionFile() != null) { Dialogs.Answer answer = Dialogs.requestDecision(TITLE, "This will close or reopen the current session.\n" + "Do you want to continue?", true, null); if (answer != Dialogs.Answer.YES) { return; } } final File sessionFile = Dialogs.requestFileForOpen(TITLE, false, SessionManager.getDefault().getSessionFileFilter(), LAST_SESSION_DIR_KEY); if (sessionFile == null) { return; } openSession(sessionFile); }
@Override public void actionPerformed(ActionEvent ae) { final File file = Dialogs.requestFileForOpen(Bundle.CTL_ImportSeadasTrackActionName(), false, null, "importTrack.lastDir"); if (file == null) { return; } final Product product = SnapApp.getDefault().getSelectedProduct(AUTO); FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection; try { featureCollection = readTrack(file, product.getSceneGeoCoding()); } catch (IOException e) { Dialogs.showError(Bundle.CTL_ImportSeadasTrackActionName(), "Failed to load track file:\n" + e.getMessage()); return; } if (featureCollection.isEmpty()) { Dialogs.showError(Bundle.CTL_ImportSeadasTrackActionName(), "No records found."); return; } String name = FileUtils.getFilenameWithoutExtension(file); final PlacemarkDescriptor placemarkDescriptor = PlacemarkDescriptorRegistry.getInstance().getPlacemarkDescriptor(featureCollection.getSchema()); placemarkDescriptor.setUserDataOf(featureCollection.getSchema()); VectorDataNode vectorDataNode = new VectorDataNode(name, featureCollection, placemarkDescriptor); product.getVectorDataGroup().add(vectorDataNode); final ProductSceneView view = SnapApp.getDefault().getSelectedProductSceneView(); if (view != null) { view.setLayersVisible(vectorDataNode); } }