List of usage examples for org.apache.commons.lang SystemUtils IS_OS_LINUX
boolean IS_OS_LINUX
To view the source code for org.apache.commons.lang SystemUtils IS_OS_LINUX.
Click Source Link
Is true
if this is Linux.
The field will return false
if OS_NAME
is null
.
From source file:org.eclipse.ice.developer.actions.LaunchNewICEHandler.java
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get the Launch Manager ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); if (manager != null) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject productProject = root.getProject("org.eclipse.ice.product"); if (productProject != null) { // Local Declarations ArrayList<String> currentPlugins = new ArrayList<String>(); ArrayList<String> notIncludedProjects = new ArrayList<String>(); String fileName = "", currentPluginsStr = "", key = "selected_workspace_plugins"; String vmArgs = "", vmArgsKey = "org.eclipse.jdt.launching.VM_ARGUMENTS"; String[] plugins;/*from w w w . ja va2s.com*/ // Get the proper file name if (SystemUtils.IS_OS_WINDOWS) { fileName = "ice.product_WINDOWS.launch"; } else if (SystemUtils.IS_OS_MAC_OSX) { fileName = "ice.macosx_product.launch"; } else if (SystemUtils.IS_OS_LINUX) { fileName = "ice.product_linux.launch"; } else { throw new ExecutionException("Could not get the current OS. Cannot launch new version of ICE."); } // Get the Launch Configurations files IFile launchICE = productProject.getFile("modified_" + fileName); if (!launchICE.exists()) { IFile tempCopy = productProject.getFile(fileName); try { launchICE.create(tempCopy.getContents(), true, null); } catch (CoreException e1) { e1.printStackTrace(); logger.error("Could not create file withe name modified_" + fileName, e1); } } // Get the Launch Configuration from those files ILaunchConfiguration launchConfig = manager.getLaunchConfiguration(launchICE); try { currentPluginsStr = launchConfig.getAttribute(key, ""); vmArgs = launchConfig.getAttribute(vmArgsKey, ""); vmArgs = vmArgs.replace("org.eclipse.equinox.http.jetty.http.port=8081", "org.eclipse.equinox.http.jetty.http.port=8082"); // Put all workspace plugins in the launch config into a // list plugins = currentPluginsStr.split(","); for (String s : plugins) { currentPlugins.add(s.split("@")[0]); } // Get any project name that is not currently in the run // config List<String> pluginsToIgnore = Arrays.asList("org.eclipse.ice.aggregator", "reflectivity", "xsede", "ICEDocCleaner", "all", "default", "developerMenu", "dynamicUI", "fileFormats", "installation", "introToPTP", "itemDB", "moose-tutorial", "newItemGeneration", "org.eclipse.ice.examples.reflectivity", "org.eclipse.ice.installer", "org.eclipse.ice.parent", "org.eclipse.ice.product", "org.eclipse.ice.repository"); for (IProject p : root.getProjects()) { String name = p.getName(); if (!currentPlugins.contains(p.getName()) && !name.endsWith(".test") && !name.contains("Tutorial") && !name.contains("target.") && !name.contains("feature") && !pluginsToIgnore.contains(name)) { notIncludedProjects.add(p.getName()); } } // Display a list selection for the user to select which // plugins to add. ListSelectionDialog dialog = new ListSelectionDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), notIncludedProjects.toArray(), ArrayContentProvider.getInstance(), new LabelProvider(), "Select new plugins to include in the new ICE instance."); dialog.setTitle("Plugin Addition Selection"); // Open the dialog int ok = dialog.open(); if (ok == Window.OK) { // Get the results Object[] results = dialog.getResult(); for (Object s : results) { currentPluginsStr = s.toString() + "@default:true," + currentPluginsStr; } ILaunchConfigurationWorkingCopy wc = launchConfig.getWorkingCopy(); // Set the launch configs list of plugins wc.setAttribute(key, currentPluginsStr); wc.setAttribute(vmArgsKey, vmArgs); // Save the configuration ILaunchConfiguration config = wc.doSave(); // Create and launch the Job. Job job = new WorkspaceJob("Launching New Instance of ICE") { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { config.launch(ILaunchManager.RUN_MODE, monitor); return Status.OK_STATUS; } }; // Launch the job job.schedule(); } } catch (CoreException e) { e.printStackTrace(); logger.error("Could not create or launch new run configuration.", e); } } } return null; }
From source file:org.esa.s2tbx.dataio.rapideye.metadata.RapidEyeMetadataTest.java
@Test public void testGetPath() throws Exception { String root = System.getProperty(TestUtil.PROPERTYNAME_DATA_DIR); String partialPath = root + File.separator + productsFolder + "2009-04-16T104920_RE4_1B-NAC_3436599_84303_metadata.xml"; if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) { partialPath = partialPath.replaceAll("\\\\", "/"); }/* w ww. j a v a 2 s . c o m*/ assertEquals(partialPath, metadata.getPath()); }
From source file:org.esa.s2tbx.dataio.spot.dimap.SpotViewMetadataTest.java
@Test public void testGetPath() throws Exception { String root = System.getProperty(TestUtil.PROPERTYNAME_DATA_DIR); String partialPath = root + File.separator + productsFolder + "SP04_HRI1_X__1O_20050605T090007_20050605T090016_DLR_70_PREU.BIL\\metadata.xml"; if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) { partialPath = partialPath.replaceAll("\\\\", "/"); }//from w w w . java 2 s . co m assertEquals(partialPath, metadata.getPath()); }
From source file:org.esa.snap.utils.TestUtil.java
private static File getTestFileOrDirectory(String file) { String partialPath = file;/*from ww w . j ava 2 s. c o m*/ if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_MAC_OSX) { partialPath = file.replaceAll("\\\\", "/"); } String path = System.getProperty(PROPERTYNAME_DATA_DIR); return new File(path, partialPath); }
From source file:org.jajuk.util.TestUtilSystem.java
/** * Test method for {@link org.jajuk.util.UtilSystem#isUnderLinux()}. */ public void testIsUnderLinux() { assertEquals(SystemUtils.IS_OS_LINUX, UtilSystem.isUnderLinux()); }
From source file:org.jboss.pressgang.ccms.contentspec.client.commands.EditCommand.java
protected String getCommand(final String file) { if (getClientConfig().getEditorRequiresTerminal()) { if (SystemUtils.IS_OS_WINDOWS) { return "start \"\" \"" + getClientConfig().getEditorCommand() + "\" \"" + file + "\""; } else if (SystemUtils.IS_OS_LINUX) { return ClientUtilities.getLinuxTerminalCommand().replace("<COMMAND>", getClientConfig().getEditorCommand() + " " + file); } else if (SystemUtils.IS_OS_MAC_OSX) { return "osascript -e 'tell app \"Terminal\" to do script \"" + getClientConfig().getEditorCommand() + " " + file + "; exit\"'"; } else {/*from www . j a v a2s.c o m*/ printErrorAndShutdown(Constants.EXIT_FAILURE, "ERROR_UNABLE_TO_OPEN_EDITOR_IN_TERMINAL_MSG", false); return null; } } else { return getClientConfig().getEditorCommand() + " \"" + file + "\""; } }
From source file:org.jenkinsci.plugins.pipeline.modeldefinition.AbstractModelDefTest.java
protected void onAllowedOS(PossibleOS... osList) throws Exception { boolean passed = true; for (PossibleOS os : osList) { switch (os) { case LINUX: if (!SystemUtils.IS_OS_LINUX) { passed = false;/* w w w . ja va 2 s . com*/ } break; case WINDOWS: if (!SystemUtils.IS_OS_WINDOWS) { passed = false; } break; case MAC: if (!SystemUtils.IS_OS_MAC) { passed = false; } break; default: break; } } Assume.assumeTrue("Not on a valid OS for this test", passed); }
From source file:org.kitodo.selenium.testframework.BaseTestSelenium.java
@BeforeClass public static void setUp() throws Exception { MockDatabase.startNode();//from w w w . jav a 2 s . c om MockDatabase.insertProcessesFull(); MockDatabase.startDatabaseServer(); usersDirectory.mkdir(); FileLoader.createDiagramTestFile(); FileLoader.createConfigProjectsFile(); FileLoader.createDigitalCollectionsFile(); if (SystemUtils.IS_OS_LINUX) { File scriptCreateDirMeta = new File(ConfigCore.getParameter(ParameterCore.SCRIPT_CREATE_DIR_META)); File scriptCreateDirUserHome = new File( ConfigCore.getParameter(ParameterCore.SCRIPT_CREATE_DIR_USER_HOME)); ExecutionPermission.setExecutePermission(scriptCreateDirMeta); ExecutionPermission.setExecutePermission(scriptCreateDirUserHome); } Browser.Initialize(); }
From source file:org.kitodo.selenium.testframework.BaseTestSelenium.java
@AfterClass public static void tearDown() throws Exception { try {//from w w w .j a v a 2 s .co m Browser.close(); } catch (Exception e) { logger.error(e.getMessage(), e); } if (SystemUtils.IS_OS_LINUX) { File scriptCreateDirMeta = new File(ConfigCore.getParameter(ParameterCore.SCRIPT_CREATE_DIR_META)); File scriptCreateDirUserHome = new File( ConfigCore.getParameter(ParameterCore.SCRIPT_CREATE_DIR_USER_HOME)); ExecutionPermission.setNoExecutePermission(scriptCreateDirMeta); ExecutionPermission.setNoExecutePermission(scriptCreateDirUserHome); } FileLoader.deleteDigitalCollectionsFile(); FileLoader.deleteConfigProjectsFile(); FileLoader.deleteDiagramTestFile(); usersDirectory.delete(); MockDatabase.stopNode(); MockDatabase.stopDatabaseServer(); MockDatabase.cleanDatabase(); }
From source file:org.lnicholls.galleon.util.Tools.java
public static Toolkit getDefaultToolkit() { // return Toolkit.getDefaultToolkit(); try {//www .j a va 2s . c o m String headless = System.getProperty("java.awt.headless"); if (headless == null || !headless.equals("true")) try { if (SystemUtils.IS_OS_WINDOWS) return (Toolkit) Class.forName("sun.awt.windows.WToolkit").newInstance(); else if (SystemUtils.IS_OS_LINUX) return (Toolkit) Class.forName("sun.awt.motif.MToolkit").newInstance(); else if (SystemUtils.IS_OS_MAC_OSX) return (Toolkit) Class.forName("apple.awt.CToolkit").newInstance(); } catch (Throwable ex) { } return Toolkit.getDefaultToolkit(); } catch (Throwable ex) { try { return (Toolkit) Class.forName("com.eteks.awt.PJAToolkit").newInstance(); } catch (Exception ex2) { } } return null; }