Open file in the menu bar was invoked by the user
184110
protected void openFileMenuBar() {
		List<BoofSwingUtil.FileTypes> types = new ArrayList<>();
		if( allowImages )
			types.add(BoofSwingUtil.FileTypes.IMAGES);
		if( allowVideos )
			types.add(BoofSwingUtil.FileTypes.VIDEOS);
		BoofSwingUtil.FileTypes array[] = types.toArray(new BoofSwingUtil.FileTypes[0]);

		File file = BoofSwingUtil.openFileChooser(DemonstrationBase.this,array);
		if (file != null) {
			openFile(file);
		}
	}
766060
private function open()
    {
        if (null === ($this->handle = fopen($this->file, 'rb'))) {
            $this->handle = null;

            throw new RuntimeException(
                sprintf(
                    'The file "%s" could not be opened for reading.',
                    $this->file
                )
            );
        }
    }
221522
function openFile(themeId, folderName, fileName) {
        if (themeId && folderName && fileName) {
            //if image then display it
            if (folderName === "images") {
                showImage(themeId, folderName, fileName);
                return;
            }

            var options = {
                url:getURL("show") + "/" + themeId + "/" + folderName + "/" + fileName,
                success:function (response) {
                    if (response.status === "error") {
                        util.showErrorFlash(response.message);
                    }
                    else {
                        // if js, css or jade file then show in editor
                        var mode = "scss";
                        if (fileName.indexOf(".js") > -1) {
                            mode = "javascript";
                        }
                        else if (fileName.indexOf(".css") > -1) {
                            mode = "css";
                        }

                        initAceEditor(themeId, folderName, fileName, response, mode);
                    }
                }
            };
            Rocket.ajax(options);
        }
    }
261680
def browse( parent, filename = '' ):
        
        dlg = XdkWindow(parent)
        dlg.show()
        
        if ( filename ):
            dlg.loadFilename(filename)
739981
function() {
					// don't create more object URLs than needed
					if (blob_changed || !object_url) {
						object_url = get_URL().createObjectURL(blob);
					}
					if (target_view) {
						target_view.location.href = object_url;
					} else {
						var new_tab = view.open(object_url, "_blank");
						if (new_tab == undefined && typeof safari !== "undefined") {
							//Apple do not allow window.open, see http://bit.ly/1kZffRI
							view.location.href = object_url
						}
					}
					filesaver.readyState = filesaver.DONE;
					dispatch_all();
					revoke(object_url);
				}
900744
def on_m_open_file(self,event):
        '''
        
        '''
        dlg = wx.FileDialog(
            self, message="choose orient file",
            defaultDir=self.WD,
            defaultFile="",
            style=wx.FD_OPEN | wx.FD_CHANGE_DIR
            )
        if dlg.ShowModal() == wx.ID_OK:
            orient_file = dlg.GetPath()
            dlg.Destroy()
            new_data, dtype, keys = pmag.magic_read_dict(orient_file,
                                                         sort_by_this_name="sample_name",
                                                         return_keys=True)

            if len(new_data) > 0:
                self.orient_data={}
                self.orient_data=new_data
            #self.create_sheet()
            self.update_sheet()
            print("-I- If you don't see a change in the spreadsheet, you may need to manually re-size the window")
1259770
function handleFileNew() {
        //var defaultExtension = PreferencesManager.get("defaultExtension");
        //if (defaultExtension) {
        //    defaultExtension = "." + defaultExtension;
        //}
        var defaultExtension = "";  // disable preference setting for now

        var doc = DocumentManager.createUntitledDocument(_nextUntitledIndexToUse++, defaultExtension);
        MainViewManager._edit(MainViewManager.ACTIVE_PANE, doc);

        HealthLogger.sendAnalyticsData(
            HealthLogger.commonStrings.USAGE +
            HealthLogger.commonStrings.FILE_OPEN +
            HealthLogger.commonStrings.FILE_NEW,
            HealthLogger.commonStrings.USAGE,
            HealthLogger.commonStrings.FILE_OPEN,
            HealthLogger.commonStrings.FILE_NEW
        );

        return new $.Deferred().resolve(doc).promise();
    }
203454
def open_file_dialog(self):
        
        dialog = QtWidgets.QFileDialog
        sender = self.sender()
        if sender == self.btn_open_source:
            textbox = self.source_path
        elif sender == self.btn_open_target:
            textbox = self.target_path
        folder = dialog.getExistingDirectory(self, 'Select a file:', textbox.text(), options = QtWidgets.QFileDialog.ShowDirsOnly)
        if str(folder) != '':
            textbox.setText(folder)
            # load elements from file and display in tree
            if sender == self.btn_open_source:
                self.reset_avaliable(folder)
517802
def clicked(self):
        """"""
        fnames = self.get_selected_filenames()
        for fname in fnames:
            if osp.isdir(fname):
                self.directory_clicked(fname)
            else:
                self.open([fname])
1061304
def on_open(self):
        
        filename, filter = QtWidgets.QFileDialog.getOpenFileName(
            self, _('Open'))
        if filename:
            self.open_file(filename)
439274
def on_directory_button_tool_clicked(self):
        """"""
        # noinspection PyCallByClass,PyTypeChecker
        # set up parameter from dialog
        input_path = self.layer.currentLayer().source()
        input_directory, self.output_filename = os.path.split(input_path)
        file_extension = os.path.splitext(self.output_filename)[1]
        self.output_filename = os.path.splitext(self.output_filename)[0]
        # show Qt file directory dialog
        output_path, __ = QtWidgets.QFileDialog.getSaveFileName(
            self,
            self.tr('Output file'),
            '%s_multi_buffer%s' % (
                os.path.join(input_directory, self.output_filename),
                file_extension),
            'GeoJSON (*.geojson);;Shapefile (*.shp)')
        # set selected path to the dialog
        self.output_form.setText(output_path)
180109
function Openfile(i, path) {
            // !Optimized: use child_process module to open local file with local path
            (function() {
                var cmdArr = [
                    'nautilus ' + path
                  , 'start "" "' + path + '"'
                  , 'konqueror ' + path
                  , 'open ' + path
                ]
                ;
                
                if (i >= cmdArr.length) {
                    client.emit("complete", {
                        error: null
                      , output: path
                      , mannual: true
                    });
                }
                
                // recursive calling
                exec(cmdArr[i], function (err, stdout, stderr) {
                    if (err == null) {
                        // Success
                        client.emit("complete", {
                            error: null
                          , output: path
                          , mannual: false
                        });
                    } else {
                        Openfile(++i, path);
                    }
                });
            })();
        }
1131289
void open() {
        if (askToSave()) {
            return;
        }

        boolean loading = true;
        SaveType fileType;
        tryAgain: while (loading) {
            int value = saveOpenFileChooser.showOpenDialog(mainFrame);
            if (value != JFileChooser.APPROVE_OPTION) {
                return;
            }

            loading = false;
            fileType = convertFilterToType(saveOpenFileChooser.getFileFilter());
            final File f = saveOpenFileChooser.getSelectedFile();

            if (!fileType.isValid(f)) {
                JOptionPane.showMessageDialog(saveOpenFileChooser, "That file is not compatible with the chosen file type",
                        "Invalid File", JOptionPane.WARNING_MESSAGE);
                loading = true;
                continue;
            }

            switch (fileType) {
            case XML_ANALYSIS:
                if (!f.getName().endsWith(".xml")) {
                    JOptionPane.showMessageDialog(saveOpenFileChooser,
                            L10N.getLocalString("dlg.not_xml_data_lbl", "This is not a saved bug XML data file."));
                    loading = true;
                    continue tryAgain;
                }

                if (!mainFrame.openAnalysis(f, fileType)) {
                    // TODO: Deal if something happens when loading analysis
                    JOptionPane.showMessageDialog(saveOpenFileChooser, "An error occurred while trying to load the analysis.");
                    loading = true;
                    continue tryAgain;
                }
                break;
            case FBP_FILE:
                if (!openFBPFile(f)) {
                    // TODO: Deal if something happens when loading analysis
                    JOptionPane.showMessageDialog(saveOpenFileChooser, "An error occurred while trying to load the analysis.");
                    loading = true;
                    continue tryAgain;
                }
                break;
            case FBA_FILE:
                if (!openFBAFile(f)) {
                    // TODO: Deal if something happens when loading analysis
                    JOptionPane.showMessageDialog(saveOpenFileChooser, "An error occurred while trying to load the analysis.");
                    loading = true;
                    continue tryAgain;
                }
                break;
            default:
                assert false;
            }
        }
    }
375247
def OnMacroListLoad(self, event):
        """"""

        # Get filepath from user

        wildcards = get_filetypes2wildcards(["py", "all"]).values()

        wildcard = "|".join(wildcards)

        message = _("Choose macro file.")

        style = wx.OPEN
        filepath, filterindex = \
            self.interfaces.get_filepath_findex_from_user(wildcard, message,
                                                          style)

        if filepath is None:
            return

        # Enter safe mode because macro file could be harmful

        post_command_event(self.main_window, self.main_window.SafeModeEntryMsg)

        # Load macros from file

        self.main_window.actions.open_macros(filepath)

        event.Skip()
924872
def popupChoices(self, event=None):
        
        # don't bother if all items are disabled
        if NORMAL not in (self.browserEnabled, self.clearEnabled,
                          self.unlearnEnabled, self.helpEnabled):
            return

        self.menu = Menu(self.entry, tearoff = 0)
        if self.browserEnabled != DISABLED:
            # Handle file and directory in different functions (tkFileDialog)
            if capable.OF_TKFD_IN_EPAR:
                self.menu.add_command(label   = "File Browser",
                                      state   = self.browserEnabled,
                                      command = self.fileBrowser)
                self.menu.add_command(label   = "Directory Browser",
                                      state   = self.browserEnabled,
                                      command = self.dirBrowser)
            # Handle file and directory in the same function (filedlg)
            else:
                self.menu.add_command(label   = "File/Directory Browser",
                                      state   = self.browserEnabled,
                                      command = self.fileBrowser)
            self.menu.add_separator()
        self.menu.add_command(label   = "Clear",
                              state   = self.clearEnabled,
                              command = self.clearEntry)
        self.menu.add_command(label   = self.defaultsVerb,
                              state   = self.unlearnEnabled,
                              command = self.unlearnValue)
        self.menu.add_command(label   = 'Help',
                              state   = self.helpEnabled,
                              command = self.helpOnParam)

        # Get the current y-coordinate of the Entry
        ycoord = self.entry.winfo_rooty()

        # Get the current x-coordinate of the cursor
        xcoord = self.entry.winfo_pointerx() - XSHIFT

        # Display the Menu as a popup as it is not associated with a Button
        self.menu.tk_popup(xcoord, ycoord)
57044
def __initialize_menu_bar(self):
        

        self.__file_menu = QMenu("&File", parent=self.__menu_bar)
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|&New",
            shortcut=QKeySequence.New,
            slot=self.__new_file_action__triggered))
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|&Load ...",
            shortcut=QKeySequence.Open,
            slot=self.__load_file_action__triggered))
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Source ...",
            slot=self.__source_file_action__triggered))
        self.__file_menu.addSeparator()
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Add Project ...",
            slot=self.__add_project_action__triggered))
        self.__file_menu.addSeparator()
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|&Save",
            shortcut=QKeySequence.Save,
            slot=self.__save_file_action__triggered))
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Save As ...",
            shortcut=QKeySequence.SaveAs,
            slot=self.__save_file_as_action__triggered))
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Save All",
            slot=self.__save_all_files_action__triggered))
        self.__file_menu.addSeparator()
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Revert",
            slot=self.__revert_file_action__triggered))
        self.__file_menu.addSeparator()
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Close ...",
            shortcut=QKeySequence.Close,
            slot=self.__close_file_action__triggered))
        self.__file_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&File|Close All ...",
            shortcut=Qt.SHIFT + Qt.ControlModifier + Qt.Key_W,
            slot=self.__close_all_files_action__triggered))
        self.__file_menu.addSeparator()
        for action in self.__recent_files_actions:
            self.__file_menu.addAction(action)
        self.__set_recent_files_actions()
        self.__menu_bar.addMenu(self.__file_menu)

        self.__edit_menu = QMenu("&Edit", parent=self.__menu_bar)
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|&Undo",
            shortcut=QKeySequence.Undo,
            slot=self.__undo_action__triggered))
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|&Redo",
            shortcut=QKeySequence.Redo,
            slot=self.__redo_action__triggered))
        self.__edit_menu.addSeparator()
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|Cu&t",
            shortcut=QKeySequence.Cut,
            slot=self.__cut_action__triggered))
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|&Copy",
            shortcut=QKeySequence.Copy,
            slot=self.__copy_action__triggered))
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|&Paste",
            shortcut=QKeySequence.Paste,
            slot=self.__paste_action__triggered))
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|Delete",
            slot=self.__delete_action__triggered))
        self.__edit_menu.addSeparator()
        self.__edit_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Edit|Select All",
            shortcut=QKeySequence.SelectAll,
            slot=self.__select_all_action__triggered))
        self.__menu_bar.addMenu(self.__edit_menu)

        self.__source_menu = QMenu("&Source", parent=self.__menu_bar)
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Delete Line(s)",
            shortcut=Qt.ControlModifier + Qt.Key_D,
            slot=self.__delete_lines_action__triggered))
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Duplicate Line(s)",
            shortcut=Qt.SHIFT + Qt.ControlModifier + Qt.Key_D,
            slot=self.__duplicate_lines_action__triggered))
        self.__source_menu.addSeparator()
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Move Up",
            shortcut=Qt.SHIFT + Qt.ControlModifier + Qt.ALT + Qt.Key_Up,
            slot=self.__move_up_action__triggered))
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Move Down",
            shortcut=Qt.SHIFT + Qt.ControlModifier + Qt.ALT + Qt.Key_Down,
            slot=self.__move_down_action__triggered))
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Indent Selection",
            shortcut=Qt.Key_Tab,
            slot=self.__indent_selection_action__triggered))
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Unindent Selection",
            shortcut=Qt.Key_Backtab,
            slot=self.__unindent_selection_action__triggered))
        self.__source_menu.addSeparator()
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Convert Indentation To Tabs",
            slot=self.__convert_indentation_to_tabs_action__triggered))
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Convert Indentation To Spaces",
            slot=self.__convert_indentation_to_spaces_action__triggered))
        self.__source_menu.addSeparator()
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Remove Trailing WhiteSpaces",
            slot=self.__remove_trailing_white_spaces_action__triggered))
        self.__source_menu.addSeparator()
        self.__source_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Source|Toggle Comments",
            shortcut=Qt.ControlModifier + Qt.Key_Slash,
            slot=self.__toggle_comments_action__triggered))
        self.__menu_bar.addMenu(self.__source_menu)

        self.__navigate_menu = QMenu("&Navigate", parent=self.__menu_bar)
        self.__navigate_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Navigate|Goto Line ...",
            shortcut=Qt.ControlModifier + Qt.Key_L,
            slot=self.__go_to_line_action__triggered))
        self.__navigate_menu.addSeparator()
        self.__menu_bar.addMenu(self.__navigate_menu)

        self.__search_menu = QMenu("&Search", parent=self.__menu_bar)
        self.__search_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Search|Search And Replace ...",
            shortcut=Qt.ControlModifier + Qt.Key_F,
            slot=self.__search_and_replace_action__triggered))
        self.__search_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Search|Search In Files ...",
            shortcut=Qt.ALT + Qt.ControlModifier + Qt.Key_F,
            slot=self.__search_in_files_action__triggered))
        self.__search_menu.addSeparator()
        self.__search_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Search|Search Next",
            shortcut=Qt.ControlModifier + Qt.Key_K,
            slot=self.__search_next_action__triggered))
        self.__search_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Search|Search Previous",
            shortcut=Qt.SHIFT + Qt.ControlModifier + Qt.Key_K,
            slot=self.__search_previous_action__triggered))
        self.__menu_bar.addMenu(self.__search_menu)

        self.__command_menu = QMenu("&Command", parent=self.__menu_bar)
        self.__command_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Command|&Evaluate Selection",
            shortcut=Qt.ControlModifier + Qt.Key_Return,
            slot=self.__evaluate_selection_action__triggered))
        self.__command_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&Command|Evaluate &Script",
            shortcut=Qt.SHIFT + Qt.CTRL + Qt.Key_Return,
            slot=self.__evaluate_script_action__triggered))
        self.__menu_bar.addMenu(self.__command_menu)

        self.__view_menu = QMenu("&View", parent=self.__menu_bar)
        self.__view_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&View|Increase Font Size",
            shortcut=Qt.ControlModifier + Qt.Key_Plus,
            slot=self.__increase_font_size_action__triggered))
        self.__view_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&View|Decrease Font Size",
            shortcut=Qt.ControlModifier + Qt.Key_Minus,
            slot=self.__decrease_font_size_action__triggered))
        self.__view_menu.addSeparator()
        self.__view_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&View|Toggle Word Wrap",
            slot=self.__toggle_word_wrap_action__triggered))
        self.__view_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&View|Toggle White Spaces",
            slot=self.__toggle_white_spaces_action__triggered))
        self.__view_menu.addSeparator()
        self.__view_menu.addAction(self.__engine.actions_manager.register_action(
            "Actions|Umbra|Components|factory.script_editor|&View|Loop Through Editors",
            shortcut=Qt.AltModifier + Qt.SHIFT + Qt.Key_Tab,
            slot=self.__loop_through_editors_action__triggered))
        self.__menu_bar.addMenu(self.__view_menu)
30388
def open(self, filehandle):
        """"""
        with self.lock:
            if filehandle in self.files:
                self.files[filehandle] += 1
            elif filehandle.closed:
                filehandle.open()
                self.files[filehandle] = 1
                self.past.append(filehandle)