Ejemplo n.º 1
0
  public static void main(String[] args) {
    Configuration.setValue(AVKey.INITIAL_LATITUDE, 49.05);
    Configuration.setValue(AVKey.INITIAL_LONGITUDE, -122.78);
    Configuration.setValue(AVKey.INITIAL_ALTITUDE, 8000);

    ApplicationTemplate.start("World Wind Multi Path", AppFrame.class);
  }
Ejemplo n.º 2
0
  public VncViewer(String[] argv) {
    applet = false;

    // Override defaults with command-line options
    for (int i = 0; i < argv.length; i++) {
      if (argv[i].equalsIgnoreCase("-log")) {
        if (++i >= argv.length) usage();
        System.err.println("Log setting: " + argv[i]);
        LogWriter.setLogParams(argv[i]);
        continue;
      }

      if (Configuration.setParam(argv[i])) continue;

      if (argv[i].charAt(0) == '-') {
        if (i + 1 < argv.length) {
          if (Configuration.setParam(argv[i].substring(1), argv[i + 1])) {
            i++;
            continue;
          }
        }
        usage();
      }

      if (vncServerName.getValue() != null) usage();
      vncServerName.setParam(argv[i]);
    }
  }
  public static void main(String[] args) {
    // zoom to San Francisco downtown
    Configuration.setValue(AVKey.INITIAL_ALTITUDE, 34e3);
    Configuration.setValue(AVKey.INITIAL_LATITUDE, 37.9521d);
    Configuration.setValue(AVKey.INITIAL_LONGITUDE, -119.7761d);

    // Adjust configuration values before instantiation
    ApplicationTemplate.start("World Wind Terrain Intersections", AppFrame.class);
  }
Ejemplo n.º 4
0
 public void save() {
   Configuration config = Configuration.getInstance();
   Properties props = config.props;
   props.setProperty("mx", maxMemory.tf.getText().trim());
   props.setProperty("ms", initMemory.tf.getText().trim());
   props.setProperty("ss", stackSize.tf.getText().trim());
   props.setProperty("ext", extDirs.tf.getText().trim());
   props.setProperty("clr", (clearLogs.cb.isSelected() ? "yes" : "no"));
   props.setProperty("ssl", (debugSSL.cb.isSelected() ? "yes" : "no"));
   props.setProperty("mon", (javaMonitor.cb.isSelected() ? "yes" : "no"));
   config.save();
 }
Ejemplo n.º 5
0
 public static void createDirectories() {
   final String[] dirs = {
     Paths.getHomeDirectory(),
     Paths.getLogsDirectory(),
     Paths.getCacheDirectory(),
     Paths.getSettingsDirectory(),
     Paths.getScriptsDirectory(),
     Paths.getScriptsSourcesDirectory(),
     Paths.getScriptsPrecompiledDirectory(),
     Paths.getScriptsNetworkDirectory(),
   };
   for (final String name : dirs) {
     final File dir = new File(name);
     if (!dir.isDirectory()) {
       dir.mkdirs();
     }
   }
   if (Configuration.getCurrentOperatingSystem() == Configuration.OperatingSystem.WINDOWS) {
     try {
       Runtime.getRuntime()
           .exec(
               "attrib +H \""
                   + new File(Paths.getScriptsNetworkDirectory()).getAbsolutePath()
                   + "\"");
     } catch (final IOException ignored) {
     }
   }
 }
  public JungGraphObserver(String name) {
    this.name = name;
    this.hyphadataPid = Configuration.getPid(PAR_HYPHADATA_PROTO);
    this.hyphalinkPid = Configuration.getPid(PAR_HYPHALINK_PROTO);
    this.mycocastPid = Configuration.getPid(PAR_MYCOCAST_PROTO);
    this.period = Configuration.getInt(name + "." + PAR_PERIOD);

    this.walkDelay = Configuration.getInt(name + "." + PAR_WALK_DELAY);
    mainThread = Thread.currentThread();
    this.changeListeners = new HashSet<ChangeListener>();

    visualizer = null;

    // HyphaData.addHyphaDataListener(this);
    // HyphaLink.addHyphaLinkListener(this);
  }
Ejemplo n.º 7
0
 public void start() {
   vlog.debug("start called");
   if (version == null || build == null) {
     ClassLoader cl = this.getClass().getClassLoader();
     InputStream stream = cl.getResourceAsStream("com/tigervnc/vncviewer/timestamp");
     try {
       Manifest manifest = new Manifest(stream);
       Attributes attributes = manifest.getMainAttributes();
       version = attributes.getValue("Version");
       build = attributes.getValue("Build");
     } catch (java.io.IOException e) {
     }
   }
   nViewers++;
   if (firstApplet) {
     alwaysShowServerDialog.setParam(true);
     Configuration.readAppletParams(this);
     String host = getCodeBase().getHost();
     if (vncServerName.getValue() == null && vncServerPort.getValue() != 0) {
       int port = vncServerPort.getValue();
       vncServerName.setParam(
           host + ((port >= 5900 && port <= 5999) ? (":" + (port - 5900)) : ("::" + port)));
     }
   }
   thread = new Thread(this);
   thread.start();
 }
 public CfgInfo(Configuration cfg, final String title) {
   this.cfg = cfg;
   this.title = title;
   bundledInjections.addAll(cfg.getDefaultInjections());
   originalInjections =
       new ArrayList<BaseInjection>(
           ContainerUtil.concat(
               InjectorUtils.getActiveInjectionSupportIds(),
               new Function<String, Collection<? extends BaseInjection>>() {
                 public Collection<? extends BaseInjection> fun(final String s) {
                   List<BaseInjection> injections =
                       CfgInfo.this.cfg instanceof Configuration.Prj
                           ? ((Configuration.Prj) CfgInfo.this.cfg).getOwnInjections(s)
                           : CfgInfo.this.cfg.getInjections(s);
                   return ContainerUtil.findAll(
                       injections,
                       new Condition<BaseInjection>() {
                         public boolean value(final BaseInjection injection) {
                           String id = injection.getInjectedLanguageId();
                           return InjectedLanguage.findLanguageById(id) != null
                               || ReferenceInjector.findById(id) != null;
                         }
                       });
                 }
               }));
   sortInjections(originalInjections);
   reset();
 }
Ejemplo n.º 9
0
 public ConfigurationDialog(Frame owner, boolean insideOOo, Configuration config) {
   this.owner = owner;
   this.insideOOo = insideOOo;
   this.original = config;
   this.config = original.copy(original);
   messages = JLanguageTool.getMessageBundle();
 }
 public void apply() {
   final List<BaseInjection> injectionList = getInjectionList(injectionInfos);
   cfg.replaceInjections(injectionList, originalInjections, true);
   originalInjections.clear();
   originalInjections.addAll(injectionList);
   sortInjections(originalInjections);
   FileContentUtil.reparseOpenedFiles();
 }
Ejemplo n.º 11
0
 public static String getAccountsFile() {
   final String path;
   if (Configuration.getCurrentOperatingSystem() == OperatingSystem.WINDOWS) {
     path = System.getenv("APPDATA") + File.separator + Configuration.NAME + "_Accounts.ini";
   } else {
     path = Paths.getUnixHome() + File.separator + "." + Configuration.NAME_LOWERCASE + "acct";
   }
   return path;
 }
Ejemplo n.º 12
0
  private boolean getState(Rule rule) {
    boolean ret = true;

    if (config.getDisabledRuleIds().contains(rule.getId())) {
      ret = false;
    }
    if (config.getDisabledCategoryNames().contains(rule.getCategory().getName())) {
      ret = false;
    }
    if (rule.isDefaultOff() && !config.getEnabledRuleIds().contains(rule.getId())) {
      ret = false;
    }

    if (rule.isDefaultOff()
        && rule.getCategory().isDefaultOff()
        && config.getEnabledRuleIds().contains(rule.getId())) {
      config.getDisabledCategoryNames().remove(rule.getCategory().getName());
    }
    return ret;
  }
Ejemplo n.º 13
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (e.getSource() == okButton) {
     if (original != null) {
       original.restoreState(config);
     }
     dialog.setVisible(false);
   } else if (e.getSource() == cancelButton) {
     dialog.setVisible(false);
   }
 }
  private void addTemplate(SearchDialogFactory searchDialogFactory) {
    SearchDialog dialog = createDialog(searchDialogFactory);
    dialog.show();
    if (!dialog.isOK()) return;
    Configuration configuration = dialog.getConfiguration();

    if (configuration.getName() == null
        || configuration.getName().equals(SearchDialog.USER_DEFINED)) {
      String name = dialog.showSaveTemplateAsDialog();

      if (name != null) {
        name =
            ConfigurationManager.findAppropriateName(myConfigurations, name, dialog.getProject());
      }
      if (name == null) return;
      configuration.setName(name);
    }
    myConfigurations.add(configuration);

    configurationsChanged(dialog.getSearchContext());
  }
Ejemplo n.º 15
0
 public static String getHomeDirectory() {
   final String env = System.getenv(Configuration.NAME.toUpperCase() + "_HOME");
   if (env == null || env.isEmpty()) {
     return (Configuration.getCurrentOperatingSystem() == OperatingSystem.WINDOWS
             ? FileSystemView.getFileSystemView().getDefaultDirectory().getAbsolutePath()
             : Paths.getUnixHome())
         + File.separator
         + Configuration.NAME;
   } else {
     return env;
   }
 }
Ejemplo n.º 16
0
  private DefaultMutableTreeNode createTree(List<Rule> rules) {
    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Rules");
    String lastRule = null;
    TreeMap<String, DefaultMutableTreeNode> parents = new TreeMap<>();
    for (final Rule rule : rules) {
      if (!parents.containsKey(rule.getCategory().getName())) {

        boolean enabled = true;
        if (config.getDisabledCategoryNames() != null
            && config.getDisabledCategoryNames().contains(rule.getCategory().getName())) {
          enabled = false;
        }
        DefaultMutableTreeNode categoryNode = new CategoryNode(rule.getCategory(), enabled);
        root.add(categoryNode);
        parents.put(rule.getCategory().getName(), categoryNode);
      }
      if (!rule.getId().equals(lastRule)) {
        RuleNode ruleNode = new RuleNode(rule, getState(rule));
        parents.get(rule.getCategory().getName()).add(ruleNode);
      }
      lastRule = rule.getId();
    }
    return root;
  }
Ejemplo n.º 17
0
 private void run() {
   int port = Util.getInt(serverPort.tf.getText().trim(), config.port);
   if (port != config.port) {
     try {
       Element server = Util.getFirstNamedChild(config.configXML, "Server");
       server.setAttribute("port", Integer.toString(port));
       config.saveXML();
       config.port = port;
     } catch (Exception unable) {
     }
     serverPort.tf.setText(Integer.toString(config.port));
   }
   save();
   if (!running) {
     runner = Util.startup();
     Util.wait(500);
     running = runner.isAlive();
     if (running) {
       monitor = new Monitor(runner);
       monitor.start();
     }
   }
   setStatus();
 }
Ejemplo n.º 18
0
 public void actionPerformed(ActionEvent event) {
   if (event.getSource().equals(launchBrowser)) {
     Configuration config = Configuration.getInstance();
     String ip = Util.getIPAddress();
     String protocol = "http" + (config.ssl ? "s" : "");
     String url = protocol + "://" + ip + ":" + config.port;
     Util.openURL(url);
   } else if (event.getSource().equals(stop)) {
     Util.shutdown();
     running = Util.isRunning();
     setStatus();
   } else if (event.getSource().equals(start)) {
     clearLogsDir();
     run();
     launchBrowser.requestFocusInWindow();
   }
 }
Ejemplo n.º 19
0
  public void start(String appConfigurationLocation, Dimension appSize) throws Exception {
    this.appTitle = Configuration.getStringValue(Constants.APPLICATION_DISPLAY_NAME);
    this.appSize = appSize;

    this.unitsFormat = new WWOUnitsFormat();
    this.unitsFormat.setShowUTM(true);
    this.unitsFormat.setShowWGS84(true);

    this.appConfigurationLocation = appConfigurationLocation;
    final AppConfiguration appConfig = new AppConfiguration();
    appConfig.initialize(this);

    appConfig.configure(this.appConfigurationLocation);

    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            redraw();
          }
        });
  }
Ejemplo n.º 20
0
 public static void usage() {
   String usage =
       ("\nusage: vncviewer [options/parameters] "
           + "[host:displayNum] [options/parameters]\n"
           + "       vncviewer [options/parameters] -listen [port] "
           + "[options/parameters]\n"
           + "\n"
           + "Options:\n"
           + "  -log <level>    configure logging level\n"
           + "\n"
           + "Parameters can be turned on with -<param> or off with "
           + "-<param>=0\n"
           + "Parameters which take a value can be specified as "
           + "-<param> <value>\n"
           + "Other valid forms are <param>=<value> -<param>=<value> "
           + "--<param>=<value>\n"
           + "Parameter names are case-insensitive.  The parameters "
           + "are:\n\n"
           + Configuration.listParams());
   System.err.print(usage);
   System.exit(1);
 }
  public void setValuesFromConfig(Configuration configuration) {
    // replaceCriteriaEdit.putUserData(SubstitutionShortInfoHandler.CURRENT_CONFIGURATION_KEY,
    // configuration);

    if (configuration instanceof ReplaceConfiguration) {
      final ReplaceConfiguration config = (ReplaceConfiguration) configuration;
      final ReplaceOptions options = config.getOptions();
      super.setValuesFromConfig(config);

      UIUtil.setContent(
          replaceCriteriaEdit,
          config.getOptions().getReplacement(),
          0,
          replaceCriteriaEdit.getDocument().getTextLength(),
          searchContext.getProject());

      shortenFQN.setSelected(options.isToShortenFQN());
      formatAccordingToStyle.setSelected(options.isToReformatAccordingToStyle());
      useStaticImport.setSelected(options.isToUseStaticImport());

      ReplaceOptions newReplaceOptions = ((ReplaceConfiguration) model.getConfig()).getOptions();
      newReplaceOptions.clearVariableDefinitions();

      for (ReplacementVariableDefinition def : options.getReplacementVariableDefinitions()) {
        newReplaceOptions.addVariableDefinition((ReplacementVariableDefinition) def.clone());
      }
    } else {
      super.setValuesFromConfig(configuration);

      UIUtil.setContent(
          replaceCriteriaEdit,
          configuration.getMatchOptions().getSearchPattern(),
          0,
          replaceCriteriaEdit.getDocument().getTextLength(),
          searchContext.getProject());
    }
  }
Ejemplo n.º 22
0
 @Deprecated
 public boolean getUseGUIConfig() {
   return config.getUseGUIConfig();
 }
Ejemplo n.º 23
0
    protected void saveToFile() {
      if (this.fileChooser == null) {
        this.fileChooser = new JFileChooser();
        this.fileChooser.setCurrentDirectory(new File(Configuration.getUserHomeDirectory()));
      }

      this.fileChooser.setDialogTitle("Choose Directory to Place Airspaces");
      this.fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      this.fileChooser.setMultiSelectionEnabled(false);
      int status = this.fileChooser.showSaveDialog(null);
      if (status != JFileChooser.APPROVE_OPTION) return;

      final File dir = this.fileChooser.getSelectedFile();
      if (dir == null) return;

      if (!dir.exists()) {
        //noinspection ResultOfMethodCallIgnored
        dir.mkdirs();
      }

      final Iterable<AirspaceEntry> entries = this.getModel().getEntries();

      Thread t =
          new Thread(
              new Runnable() {
                public void run() {
                  try {
                    java.text.DecimalFormat f = new java.text.DecimalFormat("####");
                    f.setMinimumIntegerDigits(4);
                    int counter = 0;

                    for (AirspaceEntry entry : entries) {
                      Airspace a = entry.getAirspace();
                      AirspaceAttributes currentAttribs = a.getAttributes();
                      a.setAttributes(entry.getAttributes());

                      String xmlString = a.getRestorableState();
                      if (xmlString != null) {
                        try {
                          PrintWriter of =
                              new PrintWriter(
                                  new File(
                                      dir,
                                      a.getClass().getName()
                                          + "-"
                                          + entry.getName()
                                          + "-"
                                          + f.format(counter++)
                                          + ".xml"));
                          of.write(xmlString);
                          of.flush();
                          of.close();
                        } catch (Exception e) {
                          e.printStackTrace();
                        }
                      }

                      a.setAttributes(currentAttribs);
                    }
                  } finally {
                    SwingUtilities.invokeLater(
                        new Runnable() {
                          public void run() {
                            setEnabled(true);
                            getApp().setCursor(null);
                            getApp().getWwd().redraw();
                          }
                        });
                  }
                }
              });
      this.setEnabled(false);
      getApp().setCursor(new Cursor(Cursor.WAIT_CURSOR));
      t.start();
    }
Ejemplo n.º 24
0
    protected void openFromFile() {
      if (this.fileChooser == null) {
        this.fileChooser = new JFileChooser();
        this.fileChooser.setCurrentDirectory(new File(Configuration.getUserHomeDirectory()));
      }

      this.fileChooser.setDialogTitle("Choose Airspace File Directory");
      this.fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
      this.fileChooser.setMultiSelectionEnabled(false);
      int status = this.fileChooser.showOpenDialog(null);
      if (status != JFileChooser.APPROVE_OPTION) return;

      final File dir = this.fileChooser.getSelectedFile();
      if (dir == null) return;

      Thread t =
          new Thread(
              new Runnable() {
                public void run() {
                  final ArrayList<Airspace> airspaces = new ArrayList<Airspace>();
                  try {
                    File[] files =
                        dir.listFiles(
                            new FilenameFilter() {
                              public boolean accept(File dir, String name) {
                                return name.startsWith("gov.nasa.worldwind.render.airspaces")
                                    && name.endsWith(".xml");
                              }
                            });

                    for (File file : files) {
                      String[] name = file.getName().split("-");
                      try {
                        Class c = Class.forName(name[0]);
                        Airspace airspace = (Airspace) c.newInstance();
                        BufferedReader input = new BufferedReader(new FileReader(file));
                        String s = input.readLine();
                        airspace.restoreState(s);
                        airspaces.add(airspace);

                        if (name.length >= 2) {
                          airspace.setValue(AVKey.DISPLAY_NAME, name[1]);
                        }
                      } catch (Exception e) {
                        e.printStackTrace();
                      }
                    }
                  } finally {
                    SwingUtilities.invokeLater(
                        new Runnable() {
                          public void run() {
                            setAirspaces(airspaces);
                            setEnabled(true);
                            getApp().setCursor(null);
                            getApp().getWwd().redraw();
                          }
                        });
                  }
                }
              });
      this.setEnabled(false);
      getApp().setCursor(new Cursor(Cursor.WAIT_CURSOR));
      t.start();
    }
Ejemplo n.º 25
0
 @Deprecated
 public void setUseGUIConfig(boolean useGUIConfig) {
   config.setUseGUIConfig(useGUIConfig);
 }
Ejemplo n.º 26
0
 @Deprecated
 public boolean getRunServer() {
   return config.getRunServer();
 }
Ejemplo n.º 27
0
 @Deprecated
 public int getServerPort() {
   return config.getServerPort();
 }
Ejemplo n.º 28
0
 @Deprecated
 public void setServerPort(int serverPort) {
   config.setServerPort(serverPort);
 }
Ejemplo n.º 29
0
 public static void main(String[] args) {
   Configuration.setValue(AVKey.INITIAL_LATITUDE, 37.8432);
   Configuration.setValue(AVKey.INITIAL_LONGITUDE, -105.0527);
   Configuration.setValue(AVKey.INITIAL_ALTITUDE, 7000);
   ApplicationTemplate.start("World Wind Video on Terrain", AppFrame.class);
 }
Ejemplo n.º 30
0
 @Deprecated
 public void setRunServer(boolean serverMode) {
   config.setRunServer(serverMode);
 }