JAL-845 - portability patch - workaround for lastToken failing for '\'
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 10 Feb 2015 16:21:54 +0000 (16:21 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 10 Feb 2015 16:21:54 +0000 (16:21 +0000)
src/jalview/gui/AlignViewport.java

index 638d3e5..a89174a 100644 (file)
@@ -60,7 +60,6 @@ import jalview.structure.SelectionSource;
 import jalview.structure.StructureSelectionManager;
 import jalview.structure.VamsasSource;
 import jalview.util.MessageManager;
-import jalview.util.StringUtils;
 import jalview.viewmodel.AlignmentViewport;
 import jalview.ws.params.AutoCalcSetting;
 
@@ -1132,6 +1131,8 @@ public class AlignViewport extends AlignmentViewport implements
 
     if (openSplitPane)
     {
+      // TODO: move this kind of constructor stuff to a factory/controller
+      // method ?
       /*
        * Open in split pane. DNA sequence above, protein below.
        */
@@ -1147,10 +1148,10 @@ public class AlignViewport extends AlignmentViewport implements
       cdnaFrame.setVisible(true);
       proteinFrame.setVisible(true);
       String sep = String.valueOf(File.separatorChar);
-      String proteinShortName = StringUtils.getLastToken(
-              proteinFrame.getTitle(), sep);
-      String dnaShortName = StringUtils.getLastToken(cdnaFrame.getTitle(),
-              sep);
+      String proteinShortName = proteinFrame.getTitle().substring(
+              proteinFrame.getTitle().lastIndexOf(sep) + 1);
+      String dnaShortName = cdnaFrame.getTitle().substring(
+              cdnaFrame.getTitle().lastIndexOf(sep) + 1);
       String linkedTitle = MessageManager.formatMessage(
               "label.linked_view_title", dnaShortName, proteinShortName);
       JInternalFrame splitFrame = new SplitFrame(cdnaFrame, proteinFrame);