Package javax.swing

Examples of javax.swing.SwingWorker


    });
  }

  public void performUpdate(final List<File> files,
      final IStatusHandler handler) {
    SwingWorker t = new SwingWorker<Void, Void>() {
      @Override
      protected Void doInBackground() throws Exception {
        performUpdate2(files, handler);
        return null;
      }
    };
    t.execute();
  }
View Full Code Here


    try {
      final File file = (File) table.getModel().getValueAt(table.getSelectedRow(), 3);
//      FileUtils.deleteDirectory(prefs.getMinecraftDirAsFile());
     
      progressBar.setIndeterminate(true);
      SwingWorker t = new SwingWorker<Void, Void>() {
        @Override
        protected Void doInBackground() throws Exception {
          try {
            okButton.setEnabled(false);
            if (chckbxRestoreMinecraftjarOnly.isSelected()) {
              Util.unzip(file, prefs.getMinecraftDirAsFile(), new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                  return pathname.getName().equalsIgnoreCase("minecraft.jar");
                }
              });
            } else {
              Util.unzip(file, prefs.getMinecraftDirAsFile());
            }
            JOptionPane.showMessageDialog(RestoreDialog.this,
                "Restored " + file, "Restore Message",
                JOptionPane.INFORMATION_MESSAGE);
          } catch (Throwable t) {
            log.warn("Failed to restore files ", t);
            JOptionPane.showMessageDialog(RestoreDialog.this,
                "Failed to restore files.  Message: " + t.getMessage(), "Restore Message",
                JOptionPane.WARNING_MESSAGE);
          } finally {
            progressBar.setIndeterminate(false);
            okButton.setEnabled(true);
          }
          return null;
        }
      };
      t.execute();
    } catch (Throwable t) {
      log.warn("Failed to restore files ", t);
      JOptionPane.showMessageDialog(this,
          "Failed to restore files.  Message: " + t.getMessage(), "Restore Message",
          JOptionPane.WARNING_MESSAGE);
    }
  }
View Full Code Here

        } else if (extension != null && extension.equalsIgnoreCase("vlogic"))
        {
            globalProjectPath = node.projectPath;
            globalPath = path;

            SwingWorker worker = new SwingWorker<Object, Object>() {

                public Object doInBackground()
                {
                    Tools.dialogWait = new DialogWait();
                    Tools.dialogWait.setVisible(true);
                    Tools.dialogWait.setLocation(Tools.dialogWait.getLocation().x, Tools.dialogWait.getLocation().y - 150);

                    Basis oBasis = addBasisToVMPanel(globalPath, globalProjectPath, true);
                    if (oBasis != null)
                    {
                        paneRight.setSelectedComponent(oBasis.ownerVMPanel);
                    }

                    return null;
                }

                protected void done()
                {
                    Tools.dialogWait.dispose();
                }
            };

            worker.execute();
        }
    }
View Full Code Here

            settings.currentDirectory = chooser.getCurrentDirectory().getPath();

            globalPath = file.getAbsolutePath();


            SwingWorker worker = new SwingWorker<Object, Object>() {

                DialogWait frm;

                public Object doInBackground()
                {
                    Tools.dialogWait = new DialogWait();
                    Tools.dialogWait.setVisible(true);
                    Tools.dialogWait.setLocation(Tools.dialogWait.getLocation().x, Tools.dialogWait.getLocation().y - 150);

                    addBasisToVMPanel(globalPath, "", true);
                    return null;
                }

                protected void done()
                {
                    Tools.dialogWait.dispose();
                }
            };

            worker.execute();

        }
       
    }//GEN-LAST:event_jmnuOpenSingleVMActionPerformed
View Full Code Here

    public void executeMainVM(String projectPath, String mainVM)
    {
        globalPath = projectPath + "/" + mainVM;
        globalProjectPath = projectPath;
        SwingWorker worker = new SwingWorker<Object, Object>() {

            DialogWait frm;

            public Object doInBackground()
            {
                Tools.dialogWait = new DialogWait();
                Tools.dialogWait.setVisible(true);
                Tools.dialogWait.setLocation(Tools.dialogWait.getLocation().x, Tools.dialogWait.getLocation().y - 150);


                frontMode = true;
                Basis basis = addBasisToVMPanel(globalPath, globalProjectPath, false);

                //basis.startInFrontMode=true;
                //basis.panelMode=true;
                basis.getFrontBasis().sortSubPanels();

                basis.getCircuitBasis().adjustAllElemnts();
                basis.getFrontBasis().adjustAllElemnts();

                basis.getCircuitBasis().checkPins();

                basis.getCircuitBasis().ProcessPinDataType();

                basis.start(false);
                return null;
            }

            protected void done()
            {
                Tools.dialogWait.dispose();
            }
        };

        worker.execute();


    /*Basis basis = new Basis(this, elementPath);
    basis.panelMode=true;
    addBasisToVMPanel(filename);
View Full Code Here

        } else if (extension != null && extension.equalsIgnoreCase("vlogic"))
        {
            globalProjectPath = node.projectPath;
            globalPath = path;

            SwingWorker worker = new SwingWorker<Object, Object>() {

                public Object doInBackground()
                {
                    Tools.dialogWait = new DialogWait();
                    Tools.dialogWait.setVisible(true);
                    Tools.dialogWait.setLocation(Tools.dialogWait.getLocation().x, Tools.dialogWait.getLocation().y - 150);

                    Basis oBasis = addBasisToVMPanel(globalPath, globalProjectPath, true);
                    if (oBasis != null)
                    {
                        paneRight.setSelectedComponent(oBasis.ownerVMPanel);
                    }

                    return null;
                }

                protected void done()
                {
                    Tools.dialogWait.dispose();
                }
            };

            worker.execute();
        }
    }
View Full Code Here

            settings.currentDirectory = chooser.getCurrentDirectory().getPath();

            globalPath = file.getAbsolutePath();


            SwingWorker worker = new SwingWorker<Object, Object>() {

                DialogWait frm;

                public Object doInBackground()
                {
                    Tools.dialogWait = new DialogWait();
                    Tools.dialogWait.setVisible(true);
                    Tools.dialogWait.setLocation(Tools.dialogWait.getLocation().x, Tools.dialogWait.getLocation().y - 150);

                    addBasisToVMPanel(globalPath, "", true);
                    return null;
                }

                protected void done()
                {
                    Tools.dialogWait.dispose();
                }
            };

            worker.execute();

        }
       
    }//GEN-LAST:event_jmnuOpenSingleVMActionPerformed
View Full Code Here

    public void executeMainVM(String projectPath, String mainVM)
    {
        globalPath = projectPath + "/" + mainVM;
        globalProjectPath = projectPath;
        SwingWorker worker = new SwingWorker<Object, Object>() {

            DialogWait frm;

            public Object doInBackground()
            {
                Tools.dialogWait = new DialogWait();
                Tools.dialogWait.setVisible(true);
                Tools.dialogWait.setLocation(Tools.dialogWait.getLocation().x, Tools.dialogWait.getLocation().y - 150);


                frontMode = true;
                Basis basis = addBasisToVMPanel(globalPath, globalProjectPath, false);

                //basis.startInFrontMode=true;
                //basis.panelMode=true;
                basis.getFrontBasis().sortSubPanels();

                basis.getCircuitBasis().adjustAllElemnts();
                basis.getFrontBasis().adjustAllElemnts();

                basis.getCircuitBasis().checkPins();

                basis.getCircuitBasis().ProcessPinDataType();

                basis.start(false);
                return null;
            }

            protected void done()
            {
                Tools.dialogWait.dispose();
            }
        };

        worker.execute();


    /*Basis basis = new Basis(this, elementPath);
    basis.panelMode=true;
    addBasisToVMPanel(filename);
View Full Code Here

                return;
            }

            delayed = e;

            SwingWorker sw = new SwingWorker() {

                @Override
                protected Object doInBackground() throws Exception {
                    try {
                        Thread.sleep(delay);
                    } catch (InterruptedException ie) {

                    }

                    return null;
                }

                @Override
                protected void done() {
                    if (delayed != null) {
                        superMouseEvent(delayed);
                        delayed = null;
                    }
                }
            };

            sw.execute();
        }
View Full Code Here

    @SuppressWarnings("static-access")
    public static void executePythonScript(String pathFileHtml) {

        final String path = pathFileHtml;

        SwingWorker worker = new SwingWorker() {

            @Override
            protected String doInBackground() throws InterruptedException {

                boolean error = false;
                // Verifico se è stato selelzionato almeno un html dalla lista
                if (path != null) {
                    // Metodo non statico quindi devo chiamarlo per forza attraverso l'istanza
                    if (layoutWA != null) {
                        layoutWA.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
                        LayoutWA.waitOp(true);
                    }
                    String pathFileHtml = path_html + path;
                    String cmd = "python script.py " + pathFileHtml;
                    LayoutWA.log("Inizio esecuzione script: " + cmd);

                    try {
                        Process p = Runtime.getRuntime().exec(cmd);
                        p.waitFor();
                        // Riempio la lista dei wa creati
                        ActionManager.ISTANCE.doAction(ActionManager.ISTANCE.ACTION_GET_LIST_WA_HTML);
                    } catch (Exception x) {
                        LayoutWA.log("Esecuzione script non riuscita: " + x.getMessage());
                        error = true;
                    }
                }
                LayoutWA.setErrorModality(error);
                return null;
            }

            @Override
            protected void done() {
                layoutWA.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
                LayoutWA.waitOp(false);
                LayoutWA.log("Fine esecuzione script");
                // Diasbilito la selezione di un altro WA prima di aver concluso l'operazione
                LayoutWA.disable(1);
            }
        };
        worker.execute();
    }
View Full Code Here

TOP

Related Classes of javax.swing.SwingWorker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.