Tabnine Logo
AppContext.getPreferences
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: bcdev/beam

private void setInputProductDir(final File currentDirectory) {
  applicationContext.getPreferences().setPropertyString(INPUT_PRODUCT_DIR_KEY,
                             currentDirectory.getAbsolutePath());
}
origin: bcdev/beam

private File getInputProductDir() {
  final String path = applicationContext.getPreferences().getPropertyString(INPUT_PRODUCT_DIR_KEY);
  final File inputProductDir;
  if (path != null) {
    inputProductDir = new File(path);
  } else {
    inputProductDir = null;
  }
  return inputProductDir;
}
origin: bcdev/beam

private void applyCurrentDirectory(JFileChooser fileChooser) {
  if (appContext != null) {
    String homeDirPath = SystemUtils.getUserHomeDir().getPath();
    String lastDir = appContext.getPreferences().getPropertyString(lastDirPreferenceKey, homeDirPath);
    fileChooser.setCurrentDirectory(new File(lastDir));
  }
}
origin: bcdev/beam

  private File getLastDirectory() {
    PropertyMap preferences = getContext().getAppContext().getPreferences();
    String dirPath = preferences.getPropertyString(PROPERTY_LAST_DIR, System.getProperty("user.home"));
    File lastDir = new File(dirPath);
    if (!lastDir.isDirectory()) {
      lastDir = new File(System.getProperty("user.home"));
    }
    return lastDir;
  }
}
origin: bcdev/beam

private File getLastDirectory() {
  PropertyMap preferences = getContext().getAppContext().getPreferences();
  String dirPath = preferences.getPropertyString(LAST_DIR, System.getProperty("user.home"));
  File lastDir = new File(dirPath);
  if (!lastDir.isDirectory()) {
    lastDir = new File(System.getProperty("user.home"));
  }
  return lastDir;
}
origin: bcdev/beam

private void preserveCurrentDirectory(JFileChooser fileChooser) {
  if (appContext != null) {
    String lastDir = fileChooser.getCurrentDirectory().getAbsolutePath();
    appContext.getPreferences().setPropertyString(lastDirPreferenceKey, lastDir);
  }
}
origin: bcdev/beam

public OpendapAccessPanel(AppContext appContext, String helpId) {
  super();
  this.propertyMap = appContext.getPreferences();
  this.helpId = helpId;
  this.appContext = appContext;
  initComponents();
  initContentPane();
}
origin: bcdev/beam

public void actionPerformed(ActionEvent e) {
  ensureDefaultDirSet();
  DiagramGraph[] diagramGraphs = DiagramGraphIO.readGraphs(null,
                               "Add Endmembers",
                               new BeamFileFilter[]{DiagramGraphIO.SPECTRA_CSV_FILE_FILTER},
                               appContext.getPreferences());
  Endmember[] endmembers = convertGraphsToEndmembers(diagramGraphs);
  for (Endmember endmember : endmembers) {
    addEndmember(endmember);
  }
}
origin: bcdev/beam

  public void actionPerformed(ActionEvent e) {
    ensureDefaultDirSet();
    DiagramGraphIO.writeGraphs(null,
                  "Export Endmembers",
                  new BeamFileFilter[]{DiagramGraphIO.SPECTRA_CSV_FILE_FILTER},
                  appContext.getPreferences(),
                  endmemberDiagram.getGraphs());
  }
}
origin: bcdev/beam

private String getDefaultOutputPath(AppContext appContext) {
  final Property dirProperty = container.getProperty("outputDir");
  String lastDir = appContext.getPreferences().getPropertyString(LAST_OPEN_OUTPUT_DIR, ".");
  String path;
  try {
    path = new File(lastDir).getCanonicalPath();
  } catch (IOException ignored) {
    path = SystemUtils.getUserHomeDir().getPath();
  }
  try {
    dirProperty.setValue(new File(path));
  } catch (ValidationException ignore) {
  }
  return path;
}
origin: bcdev/beam

  @Override
  public void actionPerformed(ActionEvent e) {
    ProductExpressionPane pep = ProductExpressionPane.createBooleanExpressionPane(new Product[]{activeProduct},
                                           activeProduct,
                                           appContext.getPreferences());
    pep.setCode(expressionArea.getText());
    final int i = pep.showModalDialog(parentWindow, "Expression Editor");
    if (i == ModalDialog.ID_OK) {
      expressionArea.setText(pep.getCode());
    }
  }
}
origin: bcdev/beam

/**
 * Shows an information dialog on top of this dialog.
 * The shown dialog will contain a user option allowing to not show the message anymore.
 *
 * @param infoMessage  The message.
 * @param propertyName The (simple) property name used to store the user option in the application's preferences.
 */
public void showSuppressibleInformationDialog(String infoMessage, String propertyName) {
  final SuppressibleOptionPane optionPane = new SuppressibleOptionPane(appContext.getPreferences());
  optionPane.showMessageDialog(getClass().getName() + "." + propertyName,
                 getJDialog(),
                 infoMessage,
                 getTitle(),
                 JOptionPane.INFORMATION_MESSAGE);
}
origin: bcdev/beam

@Override
public void actionPerformed(ActionEvent e) {
  JFileChooser fileChooser = new JFileChooser();
  fileChooser.addChoosableFileFilter(filter);
  fileChooser.setCurrentDirectory(getLastDirectory());
  LayerSourcePageContext pageContext = getContext();
  fileChooser.showOpenDialog(pageContext.getWindow());
  if (fileChooser.getSelectedFile() != null) {
    String filePath = fileChooser.getSelectedFile().getPath();
    imageHistoryModel.setSelectedItem(filePath);
    PropertyMap preferences = pageContext.getAppContext().getPreferences();
    preferences.setPropertyString(LAST_DIR, fileChooser.getCurrentDirectory().getAbsolutePath());
    onFileSelected(pageContext, filePath);
    pageContext.updateState();
  }
}
origin: bcdev/beam

@Override
public void actionPerformed(ActionEvent e) {
  JFileChooser fileChooser = new JFileChooser();
  fileChooser.setAcceptAllFileFilterUsed(false);
  final FileNameExtensionFilter shapefileFilter = new FileNameExtensionFilter("ESRI Shapefile", "shp");
  fileChooser.addChoosableFileFilter(shapefileFilter);
  fileChooser.setFileFilter(shapefileFilter);
  File lastDir = getLastDirectory();
  fileChooser.setCurrentDirectory(lastDir);
  LayerSourcePageContext pageContext = getContext();
  fileChooser.showOpenDialog(pageContext.getWindow());
  if (fileChooser.getSelectedFile() != null) {
    String filePath = fileChooser.getSelectedFile().getPath();
    fileHistoryModel.setSelectedItem(filePath);
    PropertyMap preferences = pageContext.getAppContext().getPreferences();
    preferences.setPropertyString(PROPERTY_LAST_DIR, fileChooser.getCurrentDirectory().getAbsolutePath());
    pageContext.updateState();
  }
}
origin: bcdev/beam

private void ensureDefaultDirSet() {
  if (!defaultEndmemberDir.exists()) {
    final ResourceInstaller resourceInstaller = new ResourceInstaller(ResourceInstaller.getSourceUrl(SpectralUnmixingDialog.class),
                                     "auxdata/", defaultEndmemberDir);
    try {
      resourceInstaller.install(".*", com.bc.ceres.core.ProgressMonitor.NULL);
    } catch (IOException e) {
      // failed, so what
    }
  }
  final String key = DiagramGraphIO.DIAGRAM_GRAPH_IO_LAST_DIR_KEY;
  final PropertyMap preferences = appContext.getPreferences();
  if (preferences.getPropertyString(key, null) == null) {
    preferences.setPropertyString(key, defaultEndmemberDir.getPath());
  }
}
origin: bcdev/beam

public RestoredSession restore(AppContext appContext, URI rootURI, ProgressMonitor pm,
                ProblemSolver problemSolver) throws
    CanceledException {
  try {
    pm.beginTask("Restoring session", 100);
    ArrayList<Exception> problems = new ArrayList<Exception>();
    ProductManager productManager = restoreProducts(rootURI, SubProgressMonitor.create(pm, 80),
                            problemSolver, problems);
    // Note: ProductManager is used for the SessionDomConverter
    ProductNodeView[] views = restoreViews(productManager, appContext.getPreferences(), SubProgressMonitor.create(pm, 20), problems
    );
    return new RestoredSession(productManager.getProducts(),
                  views,
                  problems.toArray(new Exception[problems.size()]));
  } finally {
    pm.done();
  }
}
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

private String editExpression(String expression) {
  final Product product = binningFormModel.getContextProduct();
  if (product == null) {
    return null;
  }
  final ProductExpressionPane expressionPane;
  expressionPane = ProductExpressionPane.createBooleanExpressionPane(new Product[]{product}, product, appContext.getPreferences());
  expressionPane.setCode(expression);
  final int i = expressionPane.showModalDialog(appContext.getApplicationWindow(), "Expression Editor");
  if (i == ModalDialog.ID_OK) {
    return expressionPane.getCode();
  }
  return null;
}
origin: bcdev/beam

@Override
public AbstractLayerSourceAssistantPage getNextPage() {
  imageHistoryModel.getHistory().copyInto(getContext().getAppContext().getPreferences());
  createTransform(getContext());
  return new ImageFileAssistantPage2();
}
origin: bcdev/beam

@Override
public boolean performFinish() {
  imageHistoryModel.getHistory().copyInto(getContext().getAppContext().getPreferences());
  createTransform(getContext());
  return ImageFileLayerSource.insertImageLayer(getContext());
}
org.esa.beam.framework.uiAppContextgetPreferences

Popular methods of AppContext

  • getApplicationWindow
  • handleError
  • getSelectedProduct
  • getProductManager
  • getApplicationName
  • getApplicationPage
  • getSelectedProductSceneView

Popular in Java

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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