X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=cc41c534d9899d85b3e4f8b5a6fe0d7723e0ee85;hb=16d109024847af92482237e43f99b82fd997451a;hp=9ec00334946c525298817e219ff2d9a2ef399777;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 9ec0033..cc41c53 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -20,9 +20,6 @@ */ package jalview.bin; -import groovy.lang.Binding; -import groovy.util.GroovyScriptEngine; - import jalview.ext.so.SequenceOntology; import jalview.gui.AlignFrame; import jalview.gui.Desktop; @@ -64,12 +61,23 @@ import java.util.HashMap; import java.util.Map; import java.util.Vector; +import javax.swing.LookAndFeel; import javax.swing.UIManager; +import groovy.lang.Binding; +import groovy.util.GroovyScriptEngine; + /** * Main class for Jalview Application
*
- * start with java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview + * start with: java -classpath "$PATH_TO_LIB$/*:$PATH_TO_CLASSES$" \ + * jalview.bin.Jalview + * + * or on Windows: java -classpath "$PATH_TO_LIB$/*;$PATH_TO_CLASSES$" \ + * jalview.bin.Jalview jalview.bin.Jalview + * + * (ensure -classpath arg is quoted to avoid shell expansion of '*' and do not + * embellish '*' to e.g. '*.jar') * * @author $author$ * @version $Revision$ @@ -148,7 +156,6 @@ public class Jalview af.setProgressBar(MessageManager .getString("status.das_features_being_retrived"), id); af.featureSettings_actionPerformed(null); - af.featureSettings.fetchDasFeatures(dasSources, true); af.setProgressBar(null, id); synchronized (us) { @@ -264,7 +271,7 @@ public class Jalview { error.printStackTrace(); System.out.println("\nEssential logging libraries not found." - + "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview"); + + "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview"); System.exit(0); } @@ -275,20 +282,43 @@ public class Jalview UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { + System.err.println("Unexpected Look and Feel Exception"); + ex.printStackTrace(); } if (Platform.isAMac()) { + + LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager + .getLookAndFeel(); System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Jalview"); System.setProperty("apple.laf.useScreenMenuBar", "true"); - try + if (lookAndFeel != null) { - UIManager.setLookAndFeel( - ch.randelshofer.quaqua.QuaquaManager.getLookAndFeel()); - } catch (Throwable e) + try + { + UIManager.setLookAndFeel(lookAndFeel); + } catch (Throwable e) + { + System.err.println( + "Failed to set QuaQua look and feel: " + e.toString()); + } + } + if (lookAndFeel == null || !(lookAndFeel.getClass() + .isAssignableFrom(UIManager.getLookAndFeel().getClass())) + || !UIManager.getLookAndFeel().getClass().toString() + .toLowerCase().contains("quaqua")) { - System.err.println( - "Failed to set QuaQua look and feel: " + e.toString()); + try + { + System.err.println( + "Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976"); + UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel"); + } catch (Throwable e) + { + System.err.println( + "Failed to reset look and feel: " + e.toString()); + } } } @@ -361,10 +391,7 @@ public class Jalview FileFormatI format = null; DataSourceType protocol = null; FileLoader fileLoader = new FileLoader(!headless); - Vector getFeatures = null; // vector of das source nicknames to - // fetch - // features from - // loading is done. + String groovyscript = null; // script to execute after all loading is // completed one way or another // extract groovy argument and execute if necessary @@ -511,7 +538,8 @@ public class Jalview data.replaceAll("%20", " "); ColourSchemeI cs = ColourSchemeProperty - .getColourScheme(af.getViewport().getAlignment(), data); + .getColourScheme(af.getViewport(), + af.getViewport().getAlignment(), data); if (cs != null) { @@ -595,27 +623,6 @@ public class Jalview // TODO - load PDB structure(s) to alignment JAL-629 // (associate with identical sequence in alignment, or a specified // sequence) - - getFeatures = checkDasArguments(aparser); - if (af != null && getFeatures != null) - { - FeatureFetcher ff = startFeatureFetching(getFeatures); - if (ff != null) - { - while (!ff.allFinished() || af.operationInProgress()) - { - // wait around until fetching is finished. - try - { - Thread.sleep(100); - } catch (Exception e) - { - - } - } - } - getFeatures = null; // have retrieved features - forget them now. - } if (groovyscript != null) { // Execute the groovy script after we've done all the rendering stuff @@ -757,20 +764,9 @@ public class Jalview startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol, format); - getFeatures = checkDasArguments(aparser); // extract groovy arguments before anything else. } - // If the user has specified features to be retrieved, - // or a groovy script to be executed, do them if they - // haven't been done already - // fetch features for the default alignment - if (getFeatures != null) - { - if (startUpAlframe != null) - { - startFeatureFetching(getFeatures); - } - } + // Once all other stuff is done, execute any groovy scripts (in order) if (groovyscript != null) { @@ -833,9 +829,6 @@ public class Jalview // (quote the 'PROPERTY=VALUE' pair to ensure spaces are // passed in correctly)" + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n" - + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n" - + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n" - + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n" + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n" // + // "-vdoc vamsas-document\tImport vamsas document into new @@ -970,7 +963,7 @@ public class Jalview } try { - Map vbinding = new HashMap(); + Map vbinding = new HashMap<>(); vbinding.put("Jalview", this); if (af != null) { @@ -994,94 +987,6 @@ public class Jalview } } - /** - * Check commandline for any das server definitions or any fetchfrom switches - * - * @return vector of DAS source nicknames to retrieve from - */ - private static Vector checkDasArguments(ArgsParser aparser) - { - Vector source = null; - String data; - String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE); - while ((data = aparser.getValue("dasserver", true)) != null) - { - String nickname = null; - String url = null; - int pos = data.indexOf('='); - // determine capabilities - if (pos > 0) - { - nickname = data.substring(0, pos); - } - url = data.substring(pos + 1); - if (url != null && (url.startsWith("http:") - || url.startsWith("sequence:http:"))) - { - if (nickname == null) - { - nickname = url; - } - if (locsources == null) - { - locsources = ""; - } - else - { - locsources += "\t"; - } - locsources = locsources + nickname + "|" + url; - System.err.println( - "NOTE! dasserver parameter not yet really supported (got args of " - + nickname + "|" + url); - if (source == null) - { - source = new Vector(); - } - source.addElement(nickname); - } - System.out.println( - "CMD [-dasserver " + data + "] executed successfully!"); - } // loop until no more server entries are found. - if (locsources != null && locsources.indexOf('|') > -1) - { - Cache.log.debug("Setting local source list in properties file to:\n" - + locsources); - Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources); - } - while ((data = aparser.getValue("fetchfrom", true)) != null) - { - System.out.println("adding source '" + data + "'"); - if (source == null) - { - source = new Vector(); - } - source.addElement(data); - } - return source; - } - - /** - * start a feature fetcher for every alignment frame - * - * @param dasSources - */ - private FeatureFetcher startFeatureFetching( - final Vector dasSources) - { - FeatureFetcher ff = new FeatureFetcher(); - AlignFrame afs[] = Desktop.getAlignFrames(); - if (afs == null || afs.length == 0) - { - return null; - } - for (int i = 0; i < afs.length; i++) - { - ff.addFetcher(afs[i], dasSources); - } - return ff; - } - public static boolean isHeadlessMode() { String isheadless = System.getProperty("java.awt.headless");