Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove campaign export and all related code #4065

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
45 changes: 6 additions & 39 deletions src/main/java/net/rptools/maptool/client/AppActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import net.rptools.maptool.client.ui.addresource.AddResourceDialog;
import net.rptools.maptool.client.ui.assetpanel.AssetPanel;
import net.rptools.maptool.client.ui.assetpanel.Directory;
import net.rptools.maptool.client.ui.campaignexportdialog.CampaignExportDialog;
import net.rptools.maptool.client.ui.campaignproperties.CampaignPropertiesDialog;
import net.rptools.maptool.client.ui.connectioninfodialog.ConnectionInfoDialog;
import net.rptools.maptool.client.ui.connections.ClientConnectionPanel;
Expand Down Expand Up @@ -238,22 +237,6 @@ protected void executeAction() {
}
};

public static final Action EXPORT_CAMPAIGN_AS =
new AdminClientAction() {
{
init("action.exportCampaignAs");
}

@Override
protected void executeAction() {
try {
doCampaignExport();
} catch (Exception ex) {
MapTool.showError("Cannot create the ExportCampaignDialog object", ex);
}
}
};

public static final Action EXPORT_CAMPAIGN_REPO =
new AdminClientAction() {

Expand Down Expand Up @@ -2712,28 +2695,22 @@ public static void doSaveCampaign(Runnable onSuccess) {
}

private static void doSaveCampaign(final File file, Runnable onSuccess) {
doSaveCampaign(file, null, onSuccess);
}

private static void doSaveCampaign(File file, String campaignVersion, Runnable onSuccess) {

if (AppState.testBackgroundTaskLock()) {
MapTool.showError("msg.error.failedSaveCampaignLock");
return;
}
new CampaignSaver(file, campaignVersion, onSuccess).execute();
new CampaignSaver(file, onSuccess).execute();
}

private static class CampaignSaver extends SwingWorker<Object, String> {

private File file;
private String campaignVersion;
private Runnable onSuccess;
private int maxWaitForLock = 30;

public CampaignSaver(File file, String campaignVersion, Runnable onSuccess) {
public CampaignSaver(File file, Runnable onSuccess) {
this.file = file;
this.campaignVersion = campaignVersion;
this.onSuccess = onSuccess;
}

Expand All @@ -2746,7 +2723,7 @@ protected Object doInBackground() throws Exception {

try {
long start = System.currentTimeMillis();
PersistenceUtil.saveCampaign(MapTool.getCampaign(), file, campaignVersion);
PersistenceUtil.saveCampaign(MapTool.getCampaign(), file);

publish(I18N.getString("msg.info.campaignSaved"));

Expand Down Expand Up @@ -2788,26 +2765,16 @@ public static void doSaveCampaignAs(Runnable onSuccess) {
JFileChooser chooser = MapTool.getFrame().getSaveCmpgnFileChooser();
int saveStatus = chooser.showSaveDialog(MapTool.getFrame());
if (saveStatus == JFileChooser.APPROVE_OPTION) {
saveAndUpdateCampaignName(null, chooser.getSelectedFile(), onSuccess);
}
}

public static void doCampaignExport() {
CampaignExportDialog dialog = MapTool.getCampaign().getExportCampaignDialog();
dialog.setVisible(true);

if (dialog.getSaveStatus() == JFileChooser.APPROVE_OPTION) {
saveAndUpdateCampaignName(dialog.getVersionText(), dialog.getCampaignFile(), null);
saveAndUpdateCampaignName(chooser.getSelectedFile(), onSuccess);
}
}

private static void saveAndUpdateCampaignName(
String campaignVersion, File selectedFile, Runnable onSuccess) {
private static void saveAndUpdateCampaignName(File selectedFile, Runnable onSuccess) {
File campaignFile = getFileWithExtension(selectedFile, AppConstants.CAMPAIGN_FILE_EXTENSION);
if (campaignFile.exists() && !MapTool.confirm("msg.confirm.overwriteExistingCampaign")) {
return;
}
doSaveCampaign(campaignFile, campaignVersion, onSuccess);
doSaveCampaign(campaignFile, onSuccess);
AppState.setCampaignFile(campaignFile);
AppPreferences.setSaveDir(campaignFile.getParentFile());
AppMenuBar.getMruManager().addMRUCampaign(AppState.getCampaignFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected String doInBackground() throws Exception {
try {
long startSave = System.currentTimeMillis();
log.info("Starting autosave..."); // $NON-NLS-1$
PersistenceUtil.saveCampaign(campaign, AUTOSAVE_FILE, null);
PersistenceUtil.saveCampaign(campaign, AUTOSAVE_FILE);
String msg =
I18N.getText(
"AutoSaveManager.status.autoSaveComplete", System.currentTimeMillis() - startSave);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ protected JMenu createExportMenu() {

menu.addSeparator();

menu.add(new JMenuItem(AppActions.EXPORT_CAMPAIGN_AS));
menu.add(new JMenuItem(AppActions.EXPORT_CAMPAIGN_REPO));
// menu.add(new JMenuItem(AppActions.UPDATE_CAMPAIGN_REPO));

Expand Down

This file was deleted.

This file was deleted.