예제 #1
0
  public LocalHistory() {
    String include = System.getProperty("netbeans.localhistory.includeFiles");
    if (include != null && !include.trim().equals("")) {
      this.includeFiles = Pattern.compile(include);
    }
    String exclude = System.getProperty("netbeans.localhistory.excludeFiles");
    if (exclude != null && !exclude.trim().equals("")) {
      this.excludeFiles = Pattern.compile(exclude);
    }

    String rootPaths = System.getProperty("netbeans.localhistory.historypath");
    if (rootPaths == null || rootPaths.trim().equals("")) {
      userDefinedRoots = Collections.EMPTY_SET;
    } else {
      String[] paths = rootPaths.split(";");
      userDefinedRoots = new HashSet<File>(paths.length);
      for (String root : paths) {
        addRootFile(userDefinedRoots, new File(root));
      }
    }

    WindowManager.getDefault()
        .addWindowSystemListener(
            new WindowSystemListener() {
              @Override
              public void beforeLoad(WindowSystemEvent event) {}

              @Override
              public void afterLoad(WindowSystemEvent event) {
                WindowManager.getDefault().removeWindowSystemListener(this);
                WindowManager.getDefault()
                    .getRegistry()
                    .addPropertyChangeListener(new OpenedFilesListener());
              }

              @Override
              public void beforeSave(WindowSystemEvent event) {}

              @Override
              public void afterSave(WindowSystemEvent event) {}
            });
  }
예제 #2
0
 public static void log(String msg) {
   if (!LOG.isLoggable(Level.FINE)) {
     return;
   }
   StringBuilder sb = new StringBuilder();
   SimpleDateFormat defaultFormat = new SimpleDateFormat("dd-MM-yyyy:HH-mm-ss.S");
   sb.append(defaultFormat.format(new Date(System.currentTimeMillis())));
   sb.append(":");
   sb.append(msg);
   sb.append('\t');
   sb.append(Thread.currentThread().getName());
   LocalHistory.LOG.fine(sb.toString()); // NOI18N
 }