MCPcopy Create free account
hub / github.com/Singular/Singular / askForSurf

Method askForSurf

Singular/LIB/surfex/ConfigFrame.java:391–504  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

389 }
390
391 public void askForSurf() {
392
393 int optReturn = JOptionPane.showConfirmDialog(new Panel(),
394 "Can't find POV - do you want me to try using surf?",
395 "Can't find POV", JOptionPane.YES_NO_CANCEL_OPTION,
396 JOptionPane.QUESTION_MESSAGE);
397 switch (optReturn) {
398 case 0:
399 // ja, dann nutze surf
400 surf.setSelected(true);
401 if (!surfAvailable()) {
402 // der Pfad war wohl nich korrekt
403 optReturn = JOptionPane
404 .showConfirmDialog(
405 new Panel(),
406 "Can't find SURF - do you konow where SURF is installed?",
407 "Can't find SURF",
408
409 JOptionPane.YES_NO_CANCEL_OPTION,
410 JOptionPane.QUESTION_MESSAGE);
411 switch (optReturn) {
412 case 0:
413 // ja, dann suche surf
414 // creating new Frame
415 final JFrame frame2 = new JFrame("load surf");
416
417 // adding container
418 Container contentPane = frame2.getContentPane();
419
420 // creating Filechooser
421 JFileChooser fileChooser = new JFileChooser(
422 surfex_.currentDirectory);
423
424 // adding filechooser
425 contentPane.add(fileChooser, BorderLayout.CENTER);
426
427 // Create ActionListener
428 ActionListener actionListener = new ActionListener() {
429 public void actionPerformed(ActionEvent actionEvent) {
430 JFileChooser theFileChooser = (JFileChooser) actionEvent
431 .getSource();
432
433 // get command2
434 String command2 = actionEvent.getActionCommand();
435
436 // check if doubleclickt or if "open" was pressed
437 if (command2.equals(JFileChooser.APPROVE_SELECTION)) {
438 File selectedFile = theFileChooser
439 .getSelectedFile();
440
441 // making savepopup invisible/removing it
442 frame2.dispose();
443
444 // creating complete filepath
445 String filelocation = new String(selectedFile
446 .getParent()
447 + File.separator
448 + selectedFile.getName());

Callers 2

actionPerformedMethod · 0.95
ask4pov2Method · 0.95

Calls 4

surfAvailableMethod · 0.95
setSelectedMethod · 0.80
setVisibleMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected