public void browseForFile() { Window f = (Window) SwingUtilities.getAncestorOfClass(Window.class, this); File file = dialogMode == OPEN_DIALOG_MODE ? UIUtil.openFile(f, fileChooserText, "OWL File", extensions) : UIUtil.saveFile(new JFrame(),fileChooserText, "OWL File", extensions); if (file != null) { textField.setText(file.toString()); } }
public void browseForFolder() { File f = UIUtil.chooseFolder(this, "Select a folder"); if (f != null) { textField.setText(f.toString()); } }
public void actionPerformed(ActionEvent e) { try { UIUtil.openRequest(this); } catch (Exception e1) { ErrorLogPanel.showErrorDialog(e1); } }
public static File saveFile(Window parent, String title, String description, Set<String> extensions) { return saveFile(parent, title, description, extensions, null); }
/** * * @param parent * @param title * @param extensions * @deprecated Use openFile(Window parent, String title, final String description, final Set<String> extensions) */ @Deprecated public static File openFile(Component parent, String title, Set<String> extensions) { return openFile(parent, title, null, extensions); }
public static File chooseFolder(Component parent, String title) { if(System.getProperty("os.name").contains("OS X")) { return MacUIUtil.chooseOSXFolder(parent, title); } JFileChooser chooser = new JFileChooser(); File currentDirectory = new File(getCurrentFileDirectory()); chooser.setSelectedFile(currentDirectory); chooser.setDialogTitle(title); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if(chooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { File selectedDirectory = chooser.getSelectedFile(); if(selectedDirectory != null) { setCurrentFileDirectory(selectedDirectory.toString()); } return selectedDirectory; } return null; }
return MacUIUtil.saveFile(parentWindow, title, extensions, initialName); JFileChooser fileDialog = new JFileChooser(getCurrentFileDirectory()); fileDialog.setDialogTitle(title); if(extensions != null && !extensions.isEmpty()) { if(retVal == JFileChooser.APPROVE_OPTION && (f = fileDialog.getSelectedFile()) != null) { if(f.getParent() != null) { setCurrentFileDirectory(f.getParent());
return MacUIUtil.openFile(parentWindow, title, extensions); JFileChooser fileDialog = new JFileChooser(getCurrentFileDirectory()); if(extensions != null && !extensions.isEmpty()) { fileDialog.setFileFilter(new FileFilter() { if(retVal == JFileChooser.APPROVE_OPTION && (f = fileDialog.getSelectedFile()) != null) { if(f.getParent() != null) { setCurrentFileDirectory(f.getParent());
public ShowFileAction(URI physicalURI) { super("Show file..."); this.physicalURI = physicalURI; if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } }
public void dispose() { for (View view : UIUtil.getComponentsExtending(this, View.class)) { view.dispose(); } } }
public static <T> Collection<T> getComponentsExtending(Component component, Class<? extends T> clazz) { Collection<T> components = new ArrayList<T>(); addComponentsExtending(component, clazz, components); return components; }
/** * @deprecated Use saveFile(Window parent, String title, String description, Set<String> extensions) */ @Deprecated public static File saveFile(Window parent, String title, Set<String> extensions) { return saveFile(parent, title, null, extensions, null); }
/** * * @param parent * @param title * @param extensions * @deprecated Use openFile(Window parent, String title, final String description, final Set<String> extensions) */ @Deprecated public static File openFile(Component parent, String title, Set<String> extensions) { return openFile(parent, title, null, extensions); }
public static File chooseFolder(Component parent, String title) { if (System.getProperty("os.name").indexOf("OS X") != -1) { return MacUIUtil.chooseOSXFolder(parent, title); } JFileChooser chooser = new JFileChooser(); File currentDirectory = new File(getCurrentFileDirectory()); if (currentDirectory != null) { chooser.setSelectedFile(currentDirectory); } chooser.setDialogTitle(title); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (chooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { File selectedDirectory = chooser.getSelectedFile(); if (selectedDirectory != null) { setCurrentFileDirectory(selectedDirectory.toString()); } return selectedDirectory; } return null; }
public ShowFileAction(URI physicalURI) { super("Show file..."); this.physicalURI = physicalURI; if (!UIUtil.isLocalFile(physicalURI)) { throw new IllegalArgumentException("URI must be a file URI!"); } }
public void dispose() { for (View view : UIUtil.getComponentsExtending(this, View.class)) { view.dispose(); } } }
public static <T> Collection<T> getComponentsExtending(Component component, Class<? extends T> clazz) { Collection<T> components = new ArrayList<T>(); addComponentsExtending(component, clazz, components); return components; }
/** * * @param parent * @param title * @param extensions * @param initialName * @deprecated Use saveFile(Window parent, String title, final String description, final Set<String> extensions, String initialName) */ @Deprecated public static File saveFile(Component parent, String title, Set<String> extensions, String initialName) { return saveFile(parent, title, null, extensions, initialName); }
public void browseForFile() { Window f = (Window) SwingUtilities.getAncestorOfClass(Window.class, this); File file = dialogMode == OPEN_DIALOG_MODE ? UIUtil.openFile(f, fileChooserText, "OWL File", extensions) : UIUtil.saveFile(new JFrame(),fileChooserText, "OWL File", extensions); if (file != null) { textField.setText(file.toString()); } }
public void actionPerformed(ActionEvent e) { File f = UIUtil.openFile(UriEntryPanel.this, "Choose OWL source", "OWL File",UIHelper.OWL_EXTENSIONS); if (f != null) { physicalLocationField.setText(f.getPath()); regenerateImportSuggestions(); } } });