Skip to content

Commit cbff600

Browse files
committed
Replace some string literals with global variables.
1 parent 15b8c3e commit cbff600

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

MSFragger-GUI/src/com/dmtavt/fragpipe/FragpipeRun.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
import static com.dmtavt.fragpipe.messages.MessagePrintToConsole.toConsole;
2121
import static com.dmtavt.fragpipe.tabs.TabDatabase.databaseSizeLimit;
22+
import static com.dmtavt.fragpipe.tabs.TabWorkflow.manifestExt;
23+
import static com.dmtavt.fragpipe.tabs.TabWorkflow.workflowExt;
2224
import static com.github.chhh.utils.FileDelete.deleteFileOrFolder;
2325

2426
import com.dmtavt.fragpipe.api.Bus;
@@ -508,7 +510,7 @@ public static int run(MessageRun m) {
508510
saveRuntimeConfig(wd);
509511

510512
// save manifest file in both GUI and headless mode
511-
Path path = wd.resolve("fragpipe-files.fp-manifest");
513+
Path path = wd.resolve("fragpipe-files" + manifestExt);
512514
Bus.post(new MessageManifestSave(path, true));
513515

514516
if (tabRun.isWriteSubMzml()) { // write sub workflow and manifest files for the second-pass
@@ -557,8 +559,8 @@ public static int run(MessageRun m) {
557559
newPrecursorTrueTolerance = Float.parseFloat(matcher.group(1));
558560
}
559561

560-
Path workflowFilePath = wd.resolve("fragpipe.workflow");
561-
Path workflowFileSecondPassPath = wd.resolve("fragpipe-second-pass.workflow");
562+
Path workflowFilePath = wd.resolve("fragpipe" + workflowExt);
563+
Path workflowFileSecondPassPath = wd.resolve("fragpipe-second-pass" + workflowExt);
562564
if (Files.exists(workflowFilePath) && Files.isRegularFile(workflowFilePath) && Files.isReadable(workflowFilePath)) {
563565
BufferedReader reader = Files.newBufferedReader(workflowFilePath);
564566
BufferedWriter writer = Files.newBufferedWriter(workflowFileSecondPassPath);
@@ -600,8 +602,8 @@ public static int run(MessageRun m) {
600602
reader.close();
601603
}
602604

603-
Path manifestFilePath = wd.resolve("fragpipe-files.fp-manifest");
604-
Path manifestFileSecondPassPath = wd.resolve("fragpipe-files-second-pass.fp-manifest");
605+
Path manifestFilePath = wd.resolve("fragpipe-files" + manifestExt);
606+
Path manifestFileSecondPassPath = wd.resolve("fragpipe-files-second-pass" + manifestExt);
605607
if (Files.exists(manifestFilePath) && Files.isRegularFile(manifestFilePath) && Files.isReadable(manifestFilePath)) {
606608
BufferedReader reader = Files.newBufferedReader(manifestFilePath);
607609
BufferedWriter writer = Files.newBufferedWriter(manifestFileSecondPassPath);
@@ -743,7 +745,7 @@ private static void printReference(TextConsole console) {
743745

744746

745747
public static void saveRuntimeConfig(Path wd) {
746-
Path path = wd.resolve("fragpipe.workflow");
748+
Path path = wd.resolve("fragpipe" + workflowExt);
747749
Bus.post(new MessageSaveUiState(path));
748750
}
749751

MSFragger-GUI/src/com/dmtavt/fragpipe/cmd/ProcessBuilderInfo.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.dmtavt.fragpipe.cmd;
1919

2020
import static com.dmtavt.fragpipe.messages.MessagePrintToConsole.toConsole;
21+
import static com.dmtavt.fragpipe.tabs.TabWorkflow.manifestExt;
2122

2223
import com.dmtavt.fragpipe.Fragpipe;
2324
import com.dmtavt.fragpipe.FragpipeRun;
@@ -138,7 +139,7 @@ public static Runnable toRunnable(final ProcessBuilderInfo pbi, final Path wdPat
138139

139140
if (!isDownstream) {
140141
// save manifest file in both GUI and headless mode
141-
Path path = wdPath.resolve("fragpipe-files.fp-manifest");
142+
Path path = wdPath.resolve("fragpipe-files" + manifestExt);
142143
Bus.post(new MessageManifestSave(path, true));
143144
}
144145

MSFragger-GUI/src/com/dmtavt/fragpipe/tabs/TabWorkflow.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ public class TabWorkflow extends JPanelWithEnablement {
152152
private JButton btnFilesRemove;
153153
private JButton btnFilesClear;
154154
public static final String TAB_PREFIX = "workflow.";
155-
private static final String manifestExt = ".fp-manifest";
155+
public static final String manifestExt = ".fp-manifest";
156+
public static final String workflowExt = ".workflow";
156157
public static final int maxProcessors = 128;
157158

158159
private SimpleETable tableRawFiles;
@@ -807,8 +808,8 @@ public void on(MessageSaveAsWorkflow m) throws IOException {
807808
Fragpipe fp0 = Fragpipe.getStickyStrict(Fragpipe.class);
808809
final javax.swing.JFrame fp = fp0.toJFrame();
809810
Properties uiProps = FragpipeCacheUtils.tabsSave0(fp0.tabs, m.saveWithFieldTypes);
810-
String workflowExt = ".workflow";
811-
FileNameEndingFilter workflowEndingFilter = new FileNameEndingFilter("workflow files", ".workflow");
811+
812+
FileNameEndingFilter workflowEndingFilter = new FileNameEndingFilter("workflow files", workflowExt);
812813

813814
Path saveDir;
814815
Path savePath = null;
@@ -861,7 +862,7 @@ public void on(MessageSaveAsWorkflow m) throws IOException {
861862
SwingUtils.showErrorDialog(fp, "Workflow name can't be left empty", "Error saving workflow");
862863
return;
863864
}
864-
final String fn = StringUtils.appendOnce(text, ".workflow");
865+
final String fn = StringUtils.appendOnce(text, workflowExt);
865866
if (saveDir.equals(fpWorkflowsDir) && defaultWorkflows.stream().anyMatch(path -> path.getFileName().toString().equalsIgnoreCase(fn))) {
866867
SwingUtils.showInfoDialog(this,
867868
"Name can't be the same as one of default ones",

0 commit comments

Comments
 (0)