diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/JdkPopupAction.java b/java/java-impl/src/com/intellij/openapi/projectRoots/JdkPopupAction.java index 8e8ca8b6381e..dad14c114ef1 100644 --- a/java/java-impl/src/com/intellij/openapi/projectRoots/JdkPopupAction.java +++ b/java/java-impl/src/com/intellij/openapi/projectRoots/JdkPopupAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.intellij.openapi.projectRoots; import com.intellij.execution.ExecutionException; +import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.process.ProcessOutput; import com.intellij.execution.util.ExecUtil; import com.intellij.icons.AllIcons; @@ -39,7 +40,6 @@ import java.awt.*; import java.awt.event.InputEvent; import java.io.File; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -158,7 +158,7 @@ public class JdkPopupAction extends AnAction { try { File file = new File(path); File javaExe = new File(new File(file, "bin"), "java.exe"); - ProcessOutput output = ExecUtil.execAndGetOutput(Arrays.asList(javaExe.getAbsolutePath(), "-version"), null); + ProcessOutput output = ExecUtil.execAndGetOutput(new GeneralCommandLine(javaExe.getAbsolutePath(), "-version")); List lines = output.getStderrLines(); if (lines.isEmpty()) { lines = output.getStdoutLines(); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java b/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java index 088328c86d14..0f6838683ffa 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/CreateDesktopEntryAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,7 @@ public class CreateDesktopEntryAction extends DumbAwareAction { } private static void check() throws ExecutionException, InterruptedException { - final int result = ExecUtil.execAndGetResult("which", "xdg-desktop-menu"); + int result = new GeneralCommandLine("which", "xdg-desktop-menu").createProcess().waitFor(); if (result != 0) throw new RuntimeException(ApplicationBundle.message("desktop.entry.xdg.missing")); } @@ -196,9 +196,9 @@ public class CreateDesktopEntryAction extends DumbAwareAction { if (result != 0) throw new RuntimeException("'" + script.getAbsolutePath() + "' : " + result); } else { - int result = ExecUtil.execAndGetResult("xdg-desktop-menu", "install", "--mode", "user", entryFile.getAbsolutePath()); + int result = new GeneralCommandLine("xdg-desktop-menu", "install", "--mode", "user", entryFile.getAbsolutePath()).createProcess().waitFor(); if (result != 0) throw new RuntimeException("'" + entryFile.getAbsolutePath() + "' : " + result); - ExecUtil.execAndGetResult("xdg-desktop-menu", "forceupdate", "--mode", "user"); + new GeneralCommandLine("xdg-desktop-menu", "forceupdate", "--mode", "user").createProcess().waitFor(); } } diff --git a/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java b/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java index ece0c80c31e2..3c367610feed 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/ShowFilePathAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,10 +84,10 @@ public class ShowFilePathAction extends AnAction { return false; } - String appName = ExecUtil.execAndReadLine("xdg-mime", "query", "default", "inode/directory"); + String appName = ExecUtil.execAndReadLine(new GeneralCommandLine("xdg-mime", "query", "default", "inode/directory")); if (appName == null || !appName.matches("nautilus.*\\.desktop")) return false; - String version = ExecUtil.execAndReadLine("nautilus", "--version"); + String version = ExecUtil.execAndReadLine(new GeneralCommandLine("nautilus", "--version")); if (version == null) return false; Matcher m = Pattern.compile("GNOME nautilus ([0-9.]+)").matcher(version); @@ -111,7 +111,7 @@ public class ShowFilePathAction extends AnAction { @Nullable private static String getUnixFileManagerName() { - String appName = ExecUtil.execAndReadLine("xdg-mime", "query", "default", "inode/directory"); + String appName = ExecUtil.execAndReadLine(new GeneralCommandLine("xdg-mime", "query", "default", "inode/directory")); if (appName == null || !appName.matches(".+\\.desktop")) return null; String dirs = System.getenv("XDG_DATA_DIRS"); @@ -157,12 +157,15 @@ public class ShowFilePathAction extends AnAction { show(getFile(e), new ShowAction() { @Override public void show(final ListPopup popup) { - DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer() { - @Override - public void consume(DataContext context) { - popup.showInBestPositionFor(context); - } - }); + DataManager dataManager = DataManager.getInstance(); + if (dataManager != null) { + dataManager.getDataContextFromFocus().doWhenDone(new Consumer() { + @Override + public void consume(DataContext context) { + popup.showInBestPositionFor(context); + } + }); + } } }); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java index 4cfa1d02bf5a..cf353cdfcb5a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.intellij.openapi.wm.impl; import com.intellij.Patches; +import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.execution.util.ExecUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.SystemInfo; @@ -306,7 +307,7 @@ public class X11UiUtil { @Nullable private static String getAwesomeWMVersion() { try { - String version = ExecUtil.execAndReadLine("awesome", "--version"); + String version = ExecUtil.execAndReadLine(new GeneralCommandLine("awesome", "--version")); if (version != null) { Matcher m = Pattern.compile("awesome v([0-9.]+)").matcher(version); if (m.find()) { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/external/DiffManagerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/external/DiffManagerTest.java index b2ac13b3b5cf..bfae0bb66aac 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/external/DiffManagerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/diff/impl/external/DiffManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,15 +18,21 @@ package com.intellij.openapi.diff.impl.external; import com.intellij.openapi.Disposable; import com.intellij.openapi.diff.*; import com.intellij.openapi.fileTypes.FileTypes; +import com.intellij.openapi.project.Project; import com.intellij.util.ArrayUtil; -import junit.framework.TestCase; +import org.easymock.classextension.EasyMock; import org.jetbrains.annotations.NotNull; +import org.junit.Test; import java.awt.*; import java.util.ArrayList; +import java.util.List; -public class DiffManagerTest extends TestCase { +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +public class DiffManagerTest { + @Test public void testAdditionalTools() { DiffManagerImpl diffManager = new DiffManagerImpl(); MyDiffTool tool = new MyDiffTool(); @@ -46,6 +52,7 @@ public class DiffManagerTest extends TestCase { private static class MyDiffTool implements DiffTool { public int myCanShowCount = 0; public int myShowCount = 0; + @Override public boolean canShow(DiffRequest request) { myCanShowCount++; @@ -69,8 +76,8 @@ public class DiffManagerTest extends TestCase { } private static class MyDiffRequest extends DiffRequest { - private final ArrayList myContentTitles = new ArrayList(); - private final ArrayList myDiffContents = new ArrayList(); + private final List myContentTitles = new ArrayList(); + private final List myDiffContents = new ArrayList(); public MyDiffRequest() { super(null); @@ -98,7 +105,8 @@ public class DiffManagerTest extends TestCase { } public void addContent() { - addContent(new BinaryContent(ArrayUtil.EMPTY_BYTE_ARRAY, null, FileTypes.UNKNOWN), ""); + Project project = EasyMock.createMock(Project.class); + addContent(new BinaryContent(project, ArrayUtil.EMPTY_BYTE_ARRAY, null, FileTypes.UNKNOWN, null), ""); } } } diff --git a/updater/src/com/intellij/updater/Runner.java b/updater/src/com/intellij/updater/Runner.java index 1d5d9c0217d2..791d6597de78 100644 --- a/updater/src/com/intellij/updater/Runner.java +++ b/updater/src/com/intellij/updater/Runner.java @@ -5,7 +5,6 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; -import javax.swing.*; import java.io.*; import java.net.URI; import java.net.URISyntaxException; @@ -240,21 +239,6 @@ public class Runner { } private static void install(final String jarFile, final String destFolder) throws Exception { - // todo[r.sh] to delete in IDEA 14 (after a full circle of platform updates) - if (System.getProperty("swing.defaultlaf") == null) { - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } - catch (Exception ignore) { - printStackTrace(ignore); - } - } - }); - } - new SwingUpdaterUI(new SwingUpdaterUI.InstallOperation() { public boolean execute(UpdaterUI ui) throws OperationCancelledException { logger.info("installing patch to the " + destFolder);