congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AppContext.handleError
Code IndexAdd Tabnine to your IDE (free)

How to use
handleError
method
in
org.esa.beam.framework.ui.AppContext

Best Java code snippets using org.esa.beam.framework.ui.AppContext.handleError (Showing top 18 results out of 315)

origin: bcdev/beam

@Override
public void handleException(Exception e) {
  appContext.handleError("Unable to perform download. Reason: " + e.getMessage(), e);
}
origin: bcdev/beam

  public void actionPerformed(ActionEvent event) {
    final String expression = editExpression(validPixelExpressionField.getText());
    if (expression != null) {
      try {
        binningFormModel.setProperty(BinningFormModel.PROPERTY_KEY_MASK_EXPR, expression);
      } catch (ValidationException e) {
        appContext.handleError("Invalid expression", e);
      }
    }
  }
});
origin: bcdev/beam

protected void handleProcessingError(Throwable t) {
  String msg;
  if (isInternalException(t)) {
    msg = MessageFormat.format("An internal error occurred during the target product processing.\n{0}",
                  formatThrowable(t));
  } else {
    msg = MessageFormat.format("A problem occurred during processing the target product processing.\n{0}",
                  formatThrowable(t));
  }
  appContext.handleError(msg, t);
}
origin: bcdev/beam

protected void handleInitialisationError(Throwable t) {
  String msg;
  if (isInternalException(t)) {
    msg = MessageFormat.format("An internal error occurred during the target product initialisation.\n{0}",
                  formatThrowable(t));
  } else {
    msg = MessageFormat.format("A problem occurred during the target product initialisation.\n{0}",
                  formatThrowable(t));
  }
  appContext.handleError(msg, t);
}
origin: bcdev/beam

  @Override
  protected void done() {
    try {
      Product firstProduct = get();
      if (firstProduct != null) {
        binningFormModel.useAsContextProduct(firstProduct);
        firstProduct.dispose();
      }
    } catch (Exception ex) {
      String msg = String.format("Cannot open source products.\n%s", ex.getMessage());
      appContext.handleError(msg, ex);
    }
  }
};
origin: bcdev/beam

public void resolveCatalogReferenceNode(DefaultMutableTreeNode catalogReferenceNode, boolean expandPath) {
  final DefaultTreeModel model = (DefaultTreeModel) jTree.getModel();
  final DefaultMutableTreeNode parent = (DefaultMutableTreeNode) catalogReferenceNode.getParent();
  model.removeNodeFromParent(catalogReferenceNode);
  try {
    List<InvDataset> catalogDatasets = CatalogTreeUtils.getCatalogDatasets(catalogReferenceNode);
    insertCatalogElements(catalogDatasets, parent, expandPath);
  } catch (Exception e) {
    String msg = MessageFormat.format("Unable to completely resolve catalog. Reason: {0}", e.getMessage());
    BeamLogManager.getSystemLogger().warning(msg);
    appContext.handleError(msg, e);
  }
}
origin: bcdev/beam

  @Override
  protected void done() {
    try {
      get();
      Object outputDir = parameterMap.get("outputDir");
      String message;
      if (outputDir != null) {
        message = String.format(
              "The pixel extraction tool has run successfully and written the result file(s) to %s.",
              outputDir.toString());
      } else {
        message = "The pixel extraction tool has run successfully and written the result file to to std.out.";
      }
      JOptionPane.showMessageDialog(getJDialog(), message);
    } catch (InterruptedException ignore) {
    } catch (ExecutionException e) {
      appContext.handleError(e.getMessage(), e);
    } finally {
      AbstractButton runButton = getButton(ID_OK);
      runButton.setEnabled(true);
    }
  }
}
origin: bcdev/beam

  @Override
  public void selectionChanged(SelectionChangeEvent event) {
    final Product product = (Product) event.getSelection().getSelectedValue();
    try {
      if (product != null) {
        final Map<String, Object> map = MosaicOp.getOperatorParameters(product);
        for (Map.Entry<String, Object> entry : map.entrySet()) {
          if (propertySet.getProperty(entry.getKey()) != null) {
            propertySet.setValue(entry.getKey(), entry.getValue());
          }
        }
      }
      propertySet.setValue(MosaicFormModel.PROPERTY_UPDATE_PRODUCT, product);
    } catch (OperatorException e) {
      appContext.handleError("Selected product cannot be used for update mode.", e);
    }
  }
});
origin: bcdev/beam

  appContext.handleError(String.format("Error occurred while reading file: %s", selectedFile), ioe);
} finally {
  if (reader != null) {
origin: bcdev/beam

private int editExpression(String[] value, final boolean booleanExpected) {
  Product product;
  try {
    product = mosaicModel.getReferenceProduct();
  } catch (IOException ioe) {
    appContext.handleError(ioe.getMessage(), ioe);
    return 0;
  }
  if(product == null) {
    final String msg = "No source product specified.";
    appContext.handleError(msg, new IllegalStateException(msg));
    return 0;
  }
  final ProductExpressionPane pep;
  if (booleanExpected) {
    pep = ProductExpressionPane.createBooleanExpressionPane(new Product[]{product}, product,
                                appContext.getPreferences());
  } else {
    pep = ProductExpressionPane.createGeneralExpressionPane(new Product[]{product}, product,
                                appContext.getPreferences());
  }
  pep.setCode(value[0]);
  final int i = pep.showModalDialog(appContext.getApplicationWindow(), value[0]);
  if (i == ModalDialog.ID_OK) {
    value[0] = pep.getCode();
  }
  return i;
}
origin: bcdev/beam

  product = mosaicModel.getReferenceProduct();
} catch (IOException ioe) {
  appContext.handleError(ioe.getMessage(), ioe);
  return;
origin: bcdev/beam

} catch (ValidationException ve) {
  appContext.handleError("Invalid input path", ve);
origin: bcdev/beam

@Override
public void contentsChanged(ListDataEvent event) {
  final Product[] sourceProducts = sourceProductList.getSourceProducts();
  try {
    binningFormModel.setProperty(BinningFormModel.PROPERTY_KEY_SOURCE_PRODUCTS, sourceProducts);
  } catch (ValidationException e) {
    appContext.handleError("Unable to set source products.", e);
  }
  if (sourceProducts.length > 0) {
    binningFormModel.useAsContextProduct(sourceProducts[0]);
    return;
  }
  String[] sourceProductPath = binningFormModel.getSourceProductPath();
  if (sourceProductPath != null && sourceProductPath.length > 0) {
    openFirstProduct(sourceProductPath);
    return;
  }
  binningFormModel.useAsContextProduct(null);
}
origin: bcdev/beam

  @Override
  public void actionPerformed(ActionEvent e) {
    FolderChooser folderChooser = new FolderChooser();
    folderChooser.setCurrentDirectory(new File(getDefaultOutputPath(appContext)));
    folderChooser.setDialogTitle("Select output directory");
    folderChooser.setMultiSelectionEnabled(false);
    int result = folderChooser.showDialog(appContext.getApplicationWindow(), "Select");    /*I18N*/
    if (result != JFileChooser.APPROVE_OPTION) {
      return;
    }
    File selectedFile = folderChooser.getSelectedFile();
    setOutputDirPath(selectedFile.getAbsolutePath());
    try {
      outputFileProperty.setValue(selectedFile);
      appContext.getPreferences().setPropertyString(LAST_OPEN_OUTPUT_DIR,
                             selectedFile.getAbsolutePath());
    } catch (ValidationException ve) {
      // not expected to ever come here
      appContext.handleError("Invalid input path", ve);
    }
  }
});
origin: bcdev/beam

  @Override
  public void propertyChange(PropertyChangeEvent evt) {
    final Product product = (Product) evt.getNewValue();
    final TargetProductSelectorModel selectorModel = targetProductSelector.getModel();
    if (product != null) {
      final String formatName = product.getProductReader().getReaderPlugIn().getFormatNames()[0];
      final ProductIOPlugInManager ioPlugInManager = ProductIOPlugInManager.getInstance();
      final Iterator<ProductWriterPlugIn> writerIterator = ioPlugInManager.getWriterPlugIns(formatName);
      if (writerIterator.hasNext()) {
        selectorModel.setFormatName(formatName);
      } else {
        final String errMsg = "Cannot write to update product.";
        final String iseMsg = String.format("No product writer found for format '%s'", formatName);
        appContext.handleError(errMsg, new IllegalStateException(iseMsg));
      }
      final File fileLocation = product.getFileLocation();
      final String fileName = FileUtils.getFilenameWithoutExtension(fileLocation);
      final File fileDir = fileLocation.getParentFile();
      selectorModel.setProductName(fileName);
      selectorModel.setProductDir(fileDir);
    } else {
      selectorModel.setFormatName(ProductIO.DEFAULT_FORMAT_NAME);
      selectorModel.setProductName("mosaic");
      String homeDirPath = SystemUtils.getUserHomeDir().getPath();
      final PropertyMap prefs = appContext.getPreferences();
      String saveDir = prefs.getPropertyString(BasicApp.PROPERTY_KEY_APP_LAST_SAVE_DIR, homeDirPath);
      selectorModel.setProductDir(new File(saveDir));
    }
  }
}
origin: bcdev/beam

} catch (ValidationException ve) {
  appContext.handleError("Invalid input path", ve);
origin: bcdev/beam

@Override
public void actionPerformed(ActionEvent e) {
  PropertyMap preferences = appContext.getPreferences();
  final BeamFileChooser fileChooser = getFileChooser(
      preferences.getPropertyString(LAST_OPEN_CSV_DIR, SystemUtils.getUserHomeDir().getPath()));
  int answer = fileChooser.showDialog(parent, "Select");
  if (answer == JFileChooser.APPROVE_OPTION) {
    File selectedFile = fileChooser.getSelectedFile();
    preferences.setPropertyString(LAST_OPEN_CSV_DIR, selectedFile.getParent());
    try {
      final List<SimpleFeature> extendedFeatures = PixExOpUtils.extractFeatures(selectedFile);
      for (SimpleFeature extendedFeature : extendedFeatures) {
        final GenericPlacemarkDescriptor placemarkDescriptor = new GenericPlacemarkDescriptor(
            extendedFeature.getFeatureType());
        final Placemark placemark = placemarkDescriptor.createPlacemark(extendedFeature);
        if (extendedFeature.getAttribute("Name") != null) {
          placemark.setName(extendedFeature.getAttribute("Name").toString());
        }
        setPlacemarkGeoPos(extendedFeature, placemark);
        tableModel.addPlacemark(placemark);
      }
    } catch (IOException exception) {
      appContext.handleError(String.format("Error occurred while reading file: %s \n" +
                             exception.getLocalizedMessage() +
                             "\nPossible reason: Other char separator than tabulator used",
                         selectedFile), exception);
    }
  }
}
origin: bcdev/beam

appContext.handleError("Could not create a 'Coordinate Reference System'.\n" +
            e.getMessage(), e);
org.esa.beam.framework.uiAppContexthandleError

Popular methods of AppContext

  • getApplicationWindow
  • getPreferences
  • getSelectedProduct
  • getProductManager
  • getApplicationName
  • getApplicationPage
  • getSelectedProductSceneView

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Table (org.hibernate.mapping)
    A relational table
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now