*/
package jalview.util;
-import java.io.*;
-import java.lang.reflect.*;
+import jalview.bin.Cache;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
/**
* BrowserLauncher is a class that provides one static method, openURL, which
case OTHER:
default:
- browser = jalview.bin.Cache.getDefault("DEFAULT_BROWSER", "firefox");
+ browser = Cache.getDefault("DEFAULT_BROWSER", "firefox");
break;
}
* Check for PFAM style stockhom PDB accession id citation e.g.
* "1WRI A; 7-80;"
*/
- Regex r = new com.stevesoft.pat.Regex(
+ Regex r = new Regex(
"([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)");
if (r.search(acn.trim()))
{
import jalview.datamodel.SequenceI;
import java.util.Hashtable;
-import java.util.Vector;
+
+import com.stevesoft.pat.Regex;
public class GroupUrlLink
{
}
ptok[ntoks] = link.length();
tmtch[ntoks] = "$$$$$$$$$";
- jalview.util.QuickSort.sortInt(ptok, tmtch);
+ QuickSort.sortInt(ptok, tmtch);
for (int i = 0; i < ntoks; i++)
{
mtch[i] = tmtch[i]; // TODO: check order is ascending
regexReplace[pass] = link.substring(ptok[pass] + mlength, p);
try
{
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
+ Regex rg = Regex.perlCode("/"
+ regexReplace[pass] + "/");
if (rg == null)
{
private String _replaceFor(String token)
{
for (int i = 0; i < mtch.length; i++)
+ {
if (segs[i] > -1 && mtch[i].equals(token))
{
return regexReplace[i];
}
+ }
return null;
}
// iterate through input, collating segments to be inserted into url
StringBuffer matched[] = new StringBuffer[idseq.length];
// and precompile regexes
- com.stevesoft.pat.Regex[] rgxs = new com.stevesoft.pat.Regex[matched.length];
+ Regex[] rgxs = new Regex[matched.length];
for (pass = 0; pass < matched.length; pass++)
{
matched[pass] = new StringBuffer();
if (regexReplace[pass] != null)
{
- rgxs[pass] = com.stevesoft.pat.Regex.perlCode("/"
+ rgxs[pass] = Regex.perlCode("/"
+ regexReplace[pass] + "/");
}
else
}
if (rgxs[pass] != null)
{
- com.stevesoft.pat.Regex rg = rgxs[pass];
+ Regex rg = rgxs[pass];
int rematchat = 0;
// concatenate all matches of re in the given string!
while (rg.searchFrom(idseq[pass][sq], rematchat))
*/
package jalview.util;
+import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.gui.EPSOptions;
import jalview.gui.SVGOptions;
import jalview.io.JalviewFileChooser;
+import jalview.io.JalviewFileView;
import java.awt.Component;
import java.awt.Graphics;
{
JalviewFileChooser chooser;
chooser = type.getChooser();
- chooser.setFileView(new jalview.io.JalviewFileView());
+ chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(title);
chooser.setToolTipText(MessageManager.getString("action.save"));
int value = chooser.showSaveDialog(parent);
- if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
+ if (value == JalviewFileChooser.APPROVE_OPTION)
{
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
+ Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
file = chooser.getSelectedFile();
}
{
boolean accurateText = true;
- String renderStyle = jalview.bin.Cache.getDefault("EPS_RENDERING",
+ String renderStyle = Cache.getDefault("EPS_RENDERING",
"Prompt each time");
// If we need to prompt, and if the GUI is visible then
g2 = new SVGGraphics2D(width, height);
Graphics2D ig2 = g2;
- String renderStyle = jalview.bin.Cache.getDefault("SVG_RENDERING",
+ String renderStyle = Cache.getDefault("SVG_RENDERING",
"Prompt each time");
// If we need to prompt, and if the GUI is visible then
return null;
}
return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "png" }, new String[]
{ "Portable network graphics" }, "Portable network graphics");
}
{
return null;
}
- return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ return new JalviewFileChooser(
+ Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "eps" }, new String[]
{ "Encapsulated Postscript" }, "Encapsulated Postscript");
}
{
return null;
}
- return new jalview.io.JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ return new JalviewFileChooser(
+ Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "svg" }, new String[]
{ "Scalable Vector Graphics" }, "Scalable Vector Graphics");
}
import java.util.Vector;
+import com.stevesoft.pat.Regex;
+
public class UrlLink
{
/**
* helper class to parse URL Link strings taken from applet parameters or
- * jalview properties file using the com.stevesoft.pat.Regex implementation.
- * Jalview 2.4 extension allows regular expressions to be used to parse ID
- * strings and replace the result in the URL. Regex's operate on the whole ID
- * string given to the matchURL method, if no regex is supplied, then only
- * text following the first pipe symbol will be susbstituted. Usage
- * documentation todo.
+ * jalview properties file using the Regex implementation. Jalview 2.4
+ * extension allows regular expressions to be used to parse ID strings and
+ * replace the result in the URL. Regex's operate on the whole ID string given
+ * to the matchURL method, if no regex is supplied, then only text following
+ * the first pipe symbol will be susbstituted. Usage documentation todo.
*/
private String url_suffix, url_prefix, target, label, regexReplace;
regexReplace = link.substring(psqid + 14, p);
try
{
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
+ Regex rg = Regex.perlCode("/"
+ regexReplace + "/");
if (rg == null)
{
{
if (regexReplace != null)
{
- com.stevesoft.pat.Regex rg = com.stevesoft.pat.Regex.perlCode("/"
- + regexReplace + "/");
+ Regex rg = Regex.perlCode("/" + regexReplace + "/");
if (rg.search(idstring))
{
int ns = rg.numSubs();