/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { IFileFilterable modelDescriptor = (IFileFilterable) context .get(ActionContextConstants.MODEL_DESCRIPTOR); setFileFilter(modelDescriptor.getFileFilter()); return super.execute(actionHandler, context); } }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { JFileChooser currentFileChooser = createFileChooser(context); int returnVal = currentFileChooser.showOpenDialog(SwingUtil .getVisibleWindow(getSourceComponent(context))); IFileOpenCallback openCallback = getFileOpenCallback(context); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = currentFileChooser.getSelectedFile(); if (file != null) { try { openCallback.fileChosen(file.getName(), new FileInputStream(file), actionHandler, context); } catch (FileNotFoundException ex) { openCallback.cancel(actionHandler, context); } } else { openCallback.cancel(actionHandler, context); } } else { openCallback.cancel(actionHandler, context); } return super.execute(actionHandler, context); }
/** * {@inheritDoc} */ @Override public boolean execute(IActionHandler actionHandler, Map<String, Object> context) { JFileChooser currentFileChooser = getFileChooser(context); int returnVal = currentFileChooser.showOpenDialog(SwingUtil .getVisibleWindow(getSourceComponent(context))); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = currentFileChooser.getSelectedFile(); if (file != null) { try { fileOpenCallback.fileChosen(new FileInputStream(file), file .getAbsolutePath(), actionHandler, context); } catch (FileNotFoundException ex) { fileOpenCallback.cancel(actionHandler, context); } } else { fileOpenCallback.cancel(actionHandler, context); } } else { fileOpenCallback.cancel(actionHandler, context); } return super.execute(actionHandler, context); }