コード例 #1
0
ファイル: MigrateAction.java プロジェクト: apache/cayenne
 @Override
 protected DbActionOptionsDialog createDialog(
     Collection<String> catalogs,
     Collection<String> schemas,
     String currentCatalog,
     String currentSchema) {
   return new DbActionOptionsDialog(
       Application.getFrame(),
       "Migrate DB Schema: Select Catalog and Schema",
       catalogs,
       schemas,
       currentCatalog,
       currentSchema);
 }
コード例 #2
0
ファイル: SaveAction.java プロジェクト: vintikjeny/cayenne
  @Override
  protected boolean saveAll() throws Exception {
    Project p = getCurrentProject();

    if (p == null || p.getConfigurationResource() == null) {
      return super.saveAll();
    } else {

      String oldPath = p.getConfigurationResource().getURL().getPath();

      getProjectController().getFileChangeTracker().pauseWatching();

      ProjectSaver saver = getApplication().getInjector().getInstance(ProjectSaver.class);
      saver.save(p);

      RenamedPreferences.removeOldPreferences();

      // if change DataChanelDescriptor name - as result change name of xml file
      // we will need change preferences path
      String[] path = oldPath.split("/");
      String[] newPath = p.getConfigurationResource().getURL().getPath().split("/");

      if (!path[path.length - 1].equals(newPath[newPath.length - 1])) {
        String newName = newPath[newPath.length - 1].replace(".xml", "");
        RenamedPreferences.copyPreferences(
            newName, getProjectController().getPreferenceForProject());
        RenamedPreferences.removeOldPreferences();
      }

      getApplication()
          .getFrameController()
          .changePathInLastProjListAction(oldPath, p.getConfigurationResource().getURL().getPath());
      Application.getFrame().fireRecentFileListChanged();

      /** Reset the watcher now */
      getProjectController().getFileChangeTracker().reconfigure();
    }

    return true;
  }