diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant index 0e74cf11042a..8017d1154098 100644 --- a/build/scripts/utils.gant +++ b/build/scripts/utils.gant @@ -884,23 +884,21 @@ binding.setVariable("bundledJDK64s"){ private bundledJDK(boolean win64) { requireProperty("artifact.linux.no.jdk", "true") requireProperty("artifact.mac.no.jdk", "true") - requireProperty("jdk.win", "jdk1.8") - requireProperty("jdk.custom.win", "false") - requireProperty("jdk.mac", "openjdk.1.8") + requireProperty("jdk.oracle.win", "jdk1.8") + requireProperty("jdk.win", "openjdk.1.8") + requireProperty("jdk.mac", "openjdk.1.8") requireProperty("jdk.linux", "openjdk.1.8") if (new File("${home}/build/jdk").exists()) { def jdkDir = new File("${home}/build/jdk/win") - if (p("jdk.win") != "false") { - setProperty("winJDK", getPathToBundledJDK(jdkDir, p("jdk.win"), (win64 ? "x64.zip": "x32.zip") )) - extractRedistJre(winJDK, "${paths.sandbox}/jdk.win/jre") + if (p("jdk.oracle.win") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) { + setProperty("winJDK", getPathToBundledJDK(jdkDir, p("jdk.oracle.win"), (win64 ? "x64.zip": "x32.zip"))) + extractRedistJre(winJDK, "${paths.sandbox}/jdk.oracle.win/jre") } jdkDir = new File("${home}/build/jdk/win/custom") - if (p("jdk.custom.win") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) { - setProperty("winCustomJDKx32", getPathToBundledJDK(jdkDir, p("jdk.custom.win"), "x32.tar.gz")) - extractRedistJre(winCustomJDKx32, "${paths.sandbox}/jdk.custom.win.x32") - setProperty("winCustomJDKx64", getPathToBundledJDK(jdkDir, p("jdk.custom.win"), "x64.tar.gz")) - extractRedistJre(winCustomJDKx64, "${paths.sandbox}/jdk.custom.win.x64") + if (p("jdk.win") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) { + setProperty("winCustomJDKx32", getPathToBundledJDK(jdkDir, p("jdk.win"), (win64 ? "x64.tar.gz": "x32.tar.gz"))) + extractRedistJre(winCustomJDKx32, "${paths.sandbox}/jdk.win") } jdkDir = new File("${home}/build/jdk/mac/custom") if (p("jdk.mac") != "false" && (jdkDir.exists() && jdkDir.isDirectory())) { diff --git a/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt b/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt index feb29b80c168..ce2969704f2c 100644 --- a/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt +++ b/platform/built-in-server/src/org/jetbrains/builtInWebServer/DefaultWebServerRootsProvider.kt @@ -60,10 +60,9 @@ private class DefaultWebServerRootsProvider : WebServerRootsProvider() { runReadAction { ModuleManager.getInstance(project).modules } .computeOrNull { module -> if (!module.isDisposed) { - val result = findByRelativePath(path, rootProvider.getRoots(ModuleRootManager.getInstance(module)), resolver, null) - if (result != null) { - result.moduleName = getModuleNameQualifier(project, module) - return result + findByRelativePath(path, rootProvider.getRoots(ModuleRootManager.getInstance(module)), resolver, null)?.let { + it.moduleName = getModuleNameQualifier(project, module) + return it } } null diff --git a/platform/built-in-server/testSrc/BuiltInWebServerTest.kt b/platform/built-in-server/testSrc/BuiltInWebServerTest.kt index 899d21dc4248..92bc079235ca 100644 --- a/platform/built-in-server/testSrc/BuiltInWebServerTest.kt +++ b/platform/built-in-server/testSrc/BuiltInWebServerTest.kt @@ -11,9 +11,9 @@ import com.intellij.util.writeChild import org.assertj.core.api.Assertions.assertThat import org.junit.Test -private class BuiltInWebServerTest : BuiltInServerTestCase() { +internal class BuiltInWebServerTest : BuiltInServerTestCase() { override val urlPathPrefix: String - get() = "/${BuiltInServerTestCase.projectRule.project.name}" + get() = "/${projectRule.project.name}" @Test @TestManager.TestDescriptor(filePath = "foo/index.html", doNotCreate = true, status = 200) @@ -34,7 +34,7 @@ private class BuiltInWebServerTest : BuiltInServerTestCase() { } private fun testIndex(vararg paths: String) { - val project = BuiltInServerTestCase.projectRule.project + val project = projectRule.project val newPath = tempDirManager.newPath() newPath.writeChild(manager.filePath!!, "hello") newPath.refreshVfs() diff --git a/platform/built-in-server/testSrc/RestApiTest.kt b/platform/built-in-server/testSrc/RestApiTest.kt index 5116c6425b47..8b01e8431c32 100644 --- a/platform/built-in-server/testSrc/RestApiTest.kt +++ b/platform/built-in-server/testSrc/RestApiTest.kt @@ -8,7 +8,7 @@ import org.junit.Test import java.net.HttpURLConnection import java.net.URL -private class RestApiTest : BuiltInServerTestCase() { +internal class RestApiTest : BuiltInServerTestCase() { override val urlPathPrefix = "/api/file" @Test diff --git a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java index becf68bef55a..97c95f00a54c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/AutoPopupController.java @@ -36,7 +36,6 @@ import com.intellij.openapi.application.TransactionId; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.DumbService; -import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Key; @@ -178,22 +177,14 @@ public class AutoPopupController implements Disposable { } final PsiFile file1 = file; - final Runnable request = new Runnable(){ - @Override - public void run(){ - if (myProject.isDisposed() || DumbService.isDumb(myProject)) return; - documentManager.commitAllDocuments(); - if (editor.isDisposed() || !editor.getComponent().isShowing()) return; + Runnable request = () -> { + if (!myProject.isDisposed() && !DumbService.isDumb(myProject) && !editor.isDisposed() && editor.getComponent().isShowing()) { int lbraceOffset = editor.getCaretModel().getOffset() - 1; - try { - ShowParameterInfoHandler.invoke(myProject, editor, file1, lbraceOffset, highlightedMethod, false); - } - catch (IndexNotReadyException ignored) { //anything can happen on alarm - } + ShowParameterInfoHandler.invoke(myProject, editor, file1, lbraceOffset, highlightedMethod, false); } }; - addRequest(request, settings.PARAMETER_INFO_DELAY); + addRequest(() -> documentManager.performLaterWhenAllCommitted(request), settings.PARAMETER_INFO_DELAY); } } diff --git a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java index 8ce9404e73fa..18bbb25f1a04 100644 --- a/platform/platform-impl/src/com/intellij/idea/StartupUtil.java +++ b/platform/platform-impl/src/com/intellij/idea/StartupUtil.java @@ -15,8 +15,6 @@ */ package com.intellij.idea; -import com.intellij.ide.BrowserUtil; -import com.intellij.ide.PrivacyPolicy; import com.intellij.ide.customize.CustomizeIDEWizardDialog; import com.intellij.ide.customize.CustomizeIDEWizardStepsProvider; import com.intellij.ide.plugins.PluginManagerCore; @@ -25,14 +23,9 @@ import com.intellij.openapi.application.ApplicationInfo; import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.application.ConfigImportHelper; import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.application.ex.ApplicationInfoEx; -import com.intellij.openapi.application.ex.ApplicationManagerEx; -import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.application.impl.ApplicationInfoImpl; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.ShutDownTracker; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.SystemInfoRt; @@ -40,15 +33,10 @@ import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.io.win32.IdeaWin32; import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.AppUIUtil; -import com.intellij.ui.HyperlinkAdapter; -import com.intellij.ui.JBColor; -import com.intellij.ui.components.JBScrollPane; import com.intellij.util.Consumer; import com.intellij.util.EnvironmentUtil; import com.intellij.util.PlatformUtils; import com.intellij.util.lang.UrlClassLoader; -import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.SwingHelper; import com.sun.jna.Native; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Level; @@ -58,15 +46,10 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.io.BuiltInServer; import javax.swing.*; -import javax.swing.event.HyperlinkEvent; -import javax.swing.text.html.HTMLDocument; -import javax.swing.text.html.StyleSheet; -import java.awt.*; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.lang.management.ManagementFactory; -import java.net.URL; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.List; @@ -137,7 +120,12 @@ public class StartupUtil { if (!checkSystemFolders()) { System.exit(Main.DIR_CHECK_FAILED); } - if (!lockSystemFolders(args)) { + + ActivationResult result = lockSystemFolders(args); + if (result == ActivationResult.ACTIVATED) { + System.exit(0); + } + else if (result != ActivationResult.STARTED) { System.exit(Main.INSTANCE_CHECK_FAILED); } @@ -154,20 +142,7 @@ public class StartupUtil { if (!Main.isHeadless()) { AppUIUtil.updateWindowIcon(JOptionPane.getRootFrame()); AppUIUtil.registerBundledFonts(); - final Pair policy = PrivacyPolicy.getContent(); - if (!PrivacyPolicy.isVersionAccepted(policy.getFirst())) { - try { - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - showPrivacyPolicyAgreement(policy.getSecond()); - } - }); - PrivacyPolicy.setVersionAccepted(policy.getFirst()); - } - catch (Exception ignored) { - } - } + AppUIUtil.showPrivacyPolicy(); } appStarter.start(newConfigFolder); @@ -305,7 +280,9 @@ public class StartupUtil { } } - private synchronized static boolean lockSystemFolders(String[] args) { + private enum ActivationResult { STARTED, ACTIVATED, FAILED } + + private synchronized static @NotNull ActivationResult lockSystemFolders(String[] args) { if (ourSocketLock != null) { throw new AssertionError(); } @@ -318,33 +295,30 @@ public class StartupUtil { } catch (Exception e) { Main.showMessage("Cannot Lock System Folders", e); - return false; + return ActivationResult.FAILED; } if (status == SocketLock.ActivateStatus.NO_INSTANCE) { - ShutDownTracker.getInstance().registerShutdownTask(new Runnable() { - @SuppressWarnings("AssignmentToStaticFieldFromInstanceMethod") - @Override - public void run() { - synchronized (StartupUtil.class) { - ourSocketLock.dispose(); - ourSocketLock = null; - } + ShutDownTracker.getInstance().registerShutdownTask(() -> { + //noinspection SynchronizeOnThis + synchronized (StartupUtil.class) { + ourSocketLock.dispose(); + ourSocketLock = null; } }); - return true; + return ActivationResult.STARTED; + } + else if (status == SocketLock.ActivateStatus.ACTIVATED) { + //noinspection UseOfSystemOutOrSystemErr + System.out.println("Already running"); + return ActivationResult.ACTIVATED; } else if (Main.isHeadless() || status == SocketLock.ActivateStatus.CANNOT_ACTIVATE) { String message = "Only one instance of " + ApplicationNamesInfo.getInstance().getFullProductName() + " can be run at a time."; Main.showMessage("Too Many Instances", message, true); } - if (status == SocketLock.ActivateStatus.ACTIVATED) { - System.out.println("Already running"); - System.exit(0); - } - - return false; + return ActivationResult.FAILED; } private static void fixProcessEnvironment(Logger log) { @@ -438,76 +412,6 @@ public class StartupUtil { log.info("JNU charset: " + System.getProperty("sun.jnu.encoding")); } - /** - * @param htmlText Updated version of Privacy Policy text if any. - * If it's null the standard text from bundled resources would be used. - */ - public static void showPrivacyPolicyAgreement(@NotNull String htmlText) { - DialogWrapper dialog = new DialogWrapper(true) { - @Nullable - @Override - protected JComponent createCenterPanel() { - JPanel centerPanel = new JPanel(new BorderLayout(JBUI.scale(5), JBUI.scale(5))); - JEditorPane viewer = SwingHelper.createHtmlViewer(true, null, JBColor.WHITE, JBColor.BLACK); - viewer.setFocusable(true); - viewer.addHyperlinkListener(new HyperlinkAdapter() { - @Override - protected void hyperlinkActivated(HyperlinkEvent e) { - URL url = e.getURL(); - if (url != null) { - BrowserUtil.browse(url); - } - else { - SwingHelper.scrollToReference(viewer, e.getDescription()); - } - } - }); - viewer.setText(htmlText); - StyleSheet styleSheet = ((HTMLDocument)viewer.getDocument()).getStyleSheet(); - styleSheet.addRule("body {font-family: \"Segoe UI\", Tahoma, sans-serif;}"); - styleSheet.addRule("body {margin-top:0;padding-top:0;}"); - styleSheet.addRule("body {font-size:" + JBUI.scaleFontSize(13) + "pt;}"); - styleSheet.addRule("h2, em {margin-top:" + JBUI.scaleFontSize(20) + "pt;}"); - styleSheet.addRule("h1, h2, h3, p, h4, em {margin-bottom:0;padding-bottom:0;}"); - styleSheet.addRule("p, h1 {margin-top:0;padding-top:"+JBUI.scaleFontSize(6)+"pt;}"); - styleSheet.addRule("li {margin-bottom:" + JBUI.scaleFontSize(6) + "pt;}"); - styleSheet.addRule("h2 {margin-top:0;padding-top:"+JBUI.scaleFontSize(13)+"pt;}"); - viewer.setCaretPosition(0); - viewer.setBorder(JBUI.Borders.empty(0, 5, 5, 5)); - centerPanel.add(new JLabel("Please read and accept these terms and conditions:"), BorderLayout.NORTH); - centerPanel - .add(new JBScrollPane(viewer, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER), - BorderLayout.CENTER); - return centerPanel; - } - - @Override - protected void createDefaultActions() { - super.createDefaultActions(); - init(); - setOKButtonText("Accept"); - setCancelButtonText("Reject and Exit"); - setAutoAdjustable(false); - } - - @Override - public void doCancelAction() { - super.doCancelAction(); - ApplicationEx application = ApplicationManagerEx.getApplicationEx(); - if (application == null) { - System.exit(Main.PRIVACY_POLICY_REJECTION); - } - else { - ((ApplicationImpl)application).exit(true, true, false, false); - } - } - }; - dialog.setModal(true); - dialog.setTitle(ApplicationNamesInfo.getInstance().getFullProductName() + " Privacy Policy Agreement"); - dialog.setSize(JBUI.scale(509), JBUI.scale(395)); - dialog.show(); - } - static void runStartupWizard() { ApplicationInfoEx appInfo = ApplicationInfoImpl.getShadowInstance(); @@ -535,4 +439,4 @@ public class StartupUtil { PluginManagerCore.invalidatePlugins(); } } -} +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/FileDeleteAction.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/FileDeleteAction.java index 654965e25446..f9354c07df7f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/FileDeleteAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/FileDeleteAction.java @@ -20,6 +20,7 @@ import com.intellij.ide.actions.DeleteAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.Presentation; +import com.intellij.openapi.fileChooser.FileSystemTree; import com.intellij.openapi.fileChooser.ex.FileChooserKeys; public class FileDeleteAction extends DeleteAction { @@ -34,13 +35,19 @@ public class FileDeleteAction extends DeleteAction { @Override public void update(AnActionEvent event) { Presentation presentation = event.getPresentation(); - final Boolean available = event.getData(FileChooserKeys.DELETE_ACTION_AVAILABLE); - if (available != null && !available) { - presentation.setEnabled(false); - presentation.setVisible(false); + FileSystemTree tree = event.getData(FileSystemTree.DATA_KEY); + if (tree == null) { + presentation.setEnabledAndVisible(false); return; } + final Boolean available = event.getData(FileChooserKeys.DELETE_ACTION_AVAILABLE); + if (available != null && !available) { + presentation.setEnabledAndVisible(false); + return; + } + + presentation.setEnabledAndVisible(true); super.update(event); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/ShowHiddensAction.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/ShowHiddensAction.java index 1c8a1c162bcb..dd7b4486ca10 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/ShowHiddensAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/ShowHiddensAction.java @@ -19,11 +19,18 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.fileChooser.FileSystemTree; import com.intellij.openapi.project.DumbAware; +import org.jetbrains.annotations.NotNull; /** * @author Vladimir Kondratyev */ public final class ShowHiddensAction extends ToggleAction implements DumbAware { + @Override + public void update(AnActionEvent e) { + FileSystemTree tree = e.getData(FileSystemTree.DATA_KEY); + e.getPresentation().setEnabled(tree != null); + } + public boolean isSelected(AnActionEvent e) { final FileSystemTree fileSystemTree = e.getData(FileSystemTree.DATA_KEY); return fileSystemTree != null && fileSystemTree.areHiddensShown(); diff --git a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java index 2aea85777a30..731239970fc7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java @@ -411,25 +411,16 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica @Override public void smartInvokeLater(@NotNull final Runnable runnable) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - runWhenSmart(runnable); - } - - @Override - public String toString() { - return runnable.toString(); - } - }, myProject.getDisposed()); + smartInvokeLater(runnable, ModalityState.defaultModalityState()); } @Override public void smartInvokeLater(@NotNull final Runnable runnable, @NotNull ModalityState modalityState) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - runWhenSmart(runnable); + ApplicationManager.getApplication().invokeLater(() -> { + if (isDumb()) { + runWhenSmart(() -> smartInvokeLater(runnable, modalityState)); + } else { + runnable.run(); } }, modalityState, myProject.getDisposed()); } diff --git a/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java b/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java index b61191c0162f..b7875fa3fb32 100644 --- a/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java +++ b/platform/platform-impl/src/com/intellij/ui/AppUIUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,27 +15,39 @@ */ package com.intellij.ui; +import com.intellij.ide.BrowserUtil; +import com.intellij.ide.PrivacyPolicy; +import com.intellij.idea.Main; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ApplicationNamesInfo; +import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.application.ex.ApplicationInfoEx; +import com.intellij.openapi.application.ex.ApplicationManagerEx; +import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.application.impl.ApplicationInfoImpl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ToolWindowManager; -import com.intellij.util.PlatformUtils; -import com.intellij.util.ReflectionUtil; -import com.intellij.util.SystemProperties; +import com.intellij.ui.components.JBScrollPane; +import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.ui.JBUI; +import com.intellij.util.ui.SwingHelper; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import javax.swing.event.HyperlinkEvent; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.StyleSheet; import java.awt.*; import java.io.File; import java.io.InputStream; @@ -43,6 +55,9 @@ import java.net.URL; import java.util.List; import java.util.Locale; +import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; +import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED; + /** * @author yole */ @@ -71,18 +86,13 @@ public class AppUIUtil { return images; } - public static void invokeLaterIfProjectAlive(@NotNull final Project project, @NotNull final Runnable runnable) { + public static void invokeLaterIfProjectAlive(@NotNull Project project, @NotNull Runnable runnable) { final Application application = ApplicationManager.getApplication(); if (application.isDispatchThread()) { runnable.run(); } else { - application.invokeLater(runnable, new Condition() { - @Override - public boolean value(Object o) { - return !project.isOpen() || project.isDisposed(); - } - }); + application.invokeLater(runnable, o -> !project.isOpen() || project.isDisposed()); } } @@ -158,14 +168,11 @@ public class AppUIUtil { } } - public static void hideToolWindowBalloon(@NotNull final String id, @NotNull final Project project) { - invokeLaterIfProjectAlive(project, new Runnable() { - @Override - public void run() { - Balloon balloon = ToolWindowManager.getInstance(project).getToolWindowBalloon(id); - if (balloon != null) { - balloon.hide(); - } + public static void hideToolWindowBalloon(@NotNull String id, @NotNull Project project) { + invokeLaterIfProjectAlive(project, () -> { + Balloon balloon = ToolWindowManager.getInstance(project).getToolWindowBalloon(id); + if (balloon != null) { + balloon.hide(); } }); } @@ -173,30 +180,112 @@ public class AppUIUtil { private static final int MIN_ICON_SIZE = 32; @Nullable - public static String findIcon(final String iconsPath) { - final File iconsDir = new File(iconsPath); + public static String findIcon(@NotNull String iconsPath) { + String[] childFiles = ObjectUtils.notNull(new File(iconsPath).list(), ArrayUtil.EMPTY_STRING_ARRAY); // 1. look for .svg icon - for (String child : iconsDir.list()) { + for (String child : childFiles) { if (child.endsWith(".svg")) { return iconsPath + '/' + child; } } // 2. look for .png icon of max size - int max = 0; + int best = MIN_ICON_SIZE - 1; String iconPath = null; - for (String child : iconsDir.list()) { - if (!child.endsWith(".png")) continue; - final String path = iconsPath + '/' + child; - final Icon icon = new ImageIcon(path); - final int size = icon.getIconHeight(); - if (size >= MIN_ICON_SIZE && size > max && size == icon.getIconWidth()) { - max = size; - iconPath = path; + for (String child : childFiles) { + if (child.endsWith(".png")) { + String path = iconsPath + '/' + child; + Icon icon = new ImageIcon(path); + int size = icon.getIconHeight(); + if (size > best && size == icon.getIconWidth()) { + best = size; + iconPath = path; + } } } return iconPath; } -} + + public static void showPrivacyPolicy() { + Pair policy = PrivacyPolicy.getContent(); + if (!PrivacyPolicy.isVersionAccepted(policy.getFirst())) { + try { + SwingUtilities.invokeAndWait(() -> showPrivacyPolicyAgreement(policy.getSecond())); + PrivacyPolicy.setVersionAccepted(policy.getFirst()); + } + catch (Exception e) { + Logger.getInstance(AppUIUtil.class).warn(e); + } + } + } + + /** + * @param htmlText Updated version of Privacy Policy text if any. + * If it's {@code null}, the standard text from bundled resources would be used. + */ + public static void showPrivacyPolicyAgreement(@NotNull String htmlText) { + DialogWrapper dialog = new DialogWrapper(true) { + @Nullable + @Override + protected JComponent createCenterPanel() { + JPanel centerPanel = new JPanel(new BorderLayout(JBUI.scale(5), JBUI.scale(5))); + JEditorPane viewer = SwingHelper.createHtmlViewer(true, null, JBColor.WHITE, JBColor.BLACK); + viewer.setFocusable(true); + viewer.addHyperlinkListener(new HyperlinkAdapter() { + @Override + protected void hyperlinkActivated(HyperlinkEvent e) { + URL url = e.getURL(); + if (url != null) { + BrowserUtil.browse(url); + } + else { + SwingHelper.scrollToReference(viewer, e.getDescription()); + } + } + }); + viewer.setText(htmlText); + StyleSheet styleSheet = ((HTMLDocument)viewer.getDocument()).getStyleSheet(); + styleSheet.addRule("body {font-family: \"Segoe UI\", Tahoma, sans-serif;}"); + styleSheet.addRule("body {margin-top:0;padding-top:0;}"); + styleSheet.addRule("body {font-size:" + JBUI.scaleFontSize(13) + "pt;}"); + styleSheet.addRule("h2, em {margin-top:" + JBUI.scaleFontSize(20) + "pt;}"); + styleSheet.addRule("h1, h2, h3, p, h4, em {margin-bottom:0;padding-bottom:0;}"); + styleSheet.addRule("p, h1 {margin-top:0;padding-top:"+JBUI.scaleFontSize(6)+"pt;}"); + styleSheet.addRule("li {margin-bottom:" + JBUI.scaleFontSize(6) + "pt;}"); + styleSheet.addRule("h2 {margin-top:0;padding-top:"+JBUI.scaleFontSize(13)+"pt;}"); + viewer.setCaretPosition(0); + viewer.setBorder(JBUI.Borders.empty(0, 5, 5, 5)); + centerPanel.add(new JLabel("Please read and accept these terms and conditions:"), BorderLayout.NORTH); + centerPanel.add(new JBScrollPane(viewer, VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); + return centerPanel; + } + + @Override + protected void createDefaultActions() { + super.createDefaultActions(); + init(); + setOKButtonText("Accept"); + setCancelButtonText("Reject and Exit"); + setAutoAdjustable(false); + } + + @Override + public void doCancelAction() { + super.doCancelAction(); + ApplicationEx application = ApplicationManagerEx.getApplicationEx(); + if (application == null) { + System.exit(Main.PRIVACY_POLICY_REJECTION); + } + else { + ((ApplicationImpl)application).exit(true, true, false, false); + } + } + }; + dialog.setModal(true); + dialog.setTitle(ApplicationNamesInfo.getInstance().getFullProductName() + " Privacy Policy Agreement"); + dialog.setSize(JBUI.scale(509), JBUI.scale(395)); + dialog.show(); + } +} \ No newline at end of file diff --git a/platform/platform-impl/src/com/intellij/util/path.kt b/platform/platform-impl/src/com/intellij/util/path.kt index 33d2a184a15e..8dfd631a41d3 100644 --- a/platform/platform-impl/src/com/intellij/util/path.kt +++ b/platform/platform-impl/src/com/intellij/util/path.kt @@ -141,7 +141,7 @@ fun Path.refreshVfs() { inline fun Path.directoryStreamIfExists(task: (stream: DirectoryStream) -> R): R? { try { - Files.newDirectoryStream(this).use(task) + return Files.newDirectoryStream(this).use(task) } catch (ignored: NoSuchFileException) { } @@ -150,7 +150,7 @@ inline fun Path.directoryStreamIfExists(task: (stream: DirectoryStream inline fun Path.directoryStreamIfExists(noinline filter: ((path: Path) -> Boolean), task: (stream: DirectoryStream) -> R): R? { try { - Files.newDirectoryStream(this, { filter.invoke(it) }).use(task) + return Files.newDirectoryStream(this, { filter.invoke(it) }).use(task) } catch (ignored: NoSuchFileException) { } diff --git a/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java b/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java index d76a54768f38..8d306d7cb628 100644 --- a/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java +++ b/platform/platform-tests/testSrc/com/intellij/util/containers/TreeTraverserTest.java @@ -33,6 +33,22 @@ import static com.intellij.openapi.util.Conditions.not; */ public class TreeTraverserTest extends TestCase { + + /** + *
+   *                   --- 5
+   *           ---  2  --- 6
+   *         /         --- 7
+   *       /
+   *     /          --- 8
+   *   1   ---  3   --- 9
+   *     \          --- 10
+   *      \
+   *       \           --- 11
+   *         ---  4    --- 12
+   *                   --- 13
+   * 
+ */ private static Map> numbers() { return ContainerUtil.>immutableMapBuilder(). put(1, Arrays.asList(2, 3, 4)). @@ -455,7 +471,17 @@ public class TreeTraverserTest extends TestCase { assertEquals(Arrays.asList(5, 6, 3, 11, 12, 13), t.withRoot(1).regard(not(inRange(7, 10))).traverse(TreeTraversal.LEAVES_DFS).toList()); } - public void testSkipExpandedBfs() { + public void testHideOneNodeDfs() { + JBTreeTraverser t = filteredTraverser(); + assertEquals(Arrays.asList(1, 2, 5, 6, 7, 4, 11, 12, 13), t.withRoot(1).expandAndFilter(x -> x != 3).traverse(TreeTraversal.PRE_ORDER_DFS).toList()); + } + + public void testHideOneNodeCompletelyBfs() { + JBTreeTraverser t = filteredTraverser(); + assertEquals(Arrays.asList(1, 2, 4, 5, 6, 7, 11, 12, 13), t.withRoot(1).expandAndFilter(x -> x != 3).traverse(TreeTraversal.PLAIN_BFS).toList()); + } + + public void testSkipExpandedCompletelyBfs() { JBTreeTraverser t = filteredTraverser(); assertEquals(Arrays.asList(2, 4, 8, 9, 10), t.withRoot(1).expand(IS_ODD).traverse(TreeTraversal.LEAVES_BFS).toList()); } diff --git a/platform/testFramework/src/com/intellij/testFramework/FixtureRule.kt b/platform/testFramework/src/com/intellij/testFramework/FixtureRule.kt index 7e8248b06be5..cbba936fc3e4 100644 --- a/platform/testFramework/src/com/intellij/testFramework/FixtureRule.kt +++ b/platform/testFramework/src/com/intellij/testFramework/FixtureRule.kt @@ -30,7 +30,6 @@ import com.intellij.openapi.project.ex.ProjectEx import com.intellij.openapi.project.ex.ProjectManagerEx import com.intellij.openapi.project.impl.ProjectManagerImpl import com.intellij.openapi.util.Disposer -import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS import com.intellij.openapi.vfs.newvfs.persistent.PersistentFSImpl @@ -132,7 +131,6 @@ class ProjectRule() : ApplicationRule() { val module: Module get() { - var project = project var result = sharedModule if (result == null) { runInEdtAndWait { @@ -141,9 +139,6 @@ class ProjectRule() : ApplicationRule() { result = module sharedModule = module } - - override fun sourceRootCreated(sourceRoot: VirtualFile) { - } }) } } diff --git a/platform/testFramework/src/com/intellij/testFramework/LightProjectDescriptor.java b/platform/testFramework/src/com/intellij/testFramework/LightProjectDescriptor.java index ef591e861acb..8883fe18f2ca 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightProjectDescriptor.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightProjectDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,7 +15,6 @@ */ package com.intellij.testFramework; -import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.EmptyModuleType; import com.intellij.openapi.module.Module; @@ -34,7 +33,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.openapi.vfs.VirtualFileVisitor; import com.intellij.openapi.vfs.ex.temp.TempFileSystem; -import com.intellij.util.Consumer; import com.intellij.util.indexing.FileBasedIndex; import com.intellij.util.indexing.IndexableFileSet; import org.jetbrains.annotations.NotNull; @@ -50,33 +48,27 @@ public class LightProjectDescriptor { public static final LightProjectDescriptor EMPTY_PROJECT_DESCRIPTOR = new LightProjectDescriptor(); public void setUpProject(@NotNull final Project project, @NotNull final SetupHandler handler) throws Exception { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - Module module = createMainModule(project); - handler.moduleCreated(module); - VirtualFile sourceRoot = createSourcesRoot(module); - if (sourceRoot != null) { - handler.sourceRootCreated(sourceRoot); - createContentEntry(module, sourceRoot); - } + ApplicationManager.getApplication().runWriteAction(() -> { + Module module = createMainModule(project); + handler.moduleCreated(module); + VirtualFile sourceRoot = createSourcesRoot(module); + if (sourceRoot != null) { + handler.sourceRootCreated(sourceRoot); + createContentEntry(module, sourceRoot); } }); } @NotNull public Module createMainModule(@NotNull final Project project) { - return ApplicationManager.getApplication().runWriteAction(new Computable() { - @Override - public Module compute() { - String moduleFilePath = "light_idea_test_case.iml"; - File imlFile = new File(moduleFilePath); - if (imlFile.exists()) { - //temporary workaround for IDEA-147530: otherwise if someone saved module with this name before the created module will get its settings - FileUtil.delete(imlFile); - } - return ModuleManager.getInstance(project).newModule(moduleFilePath, getModuleType().getId()); + return ApplicationManager.getApplication().runWriteAction((Computable)() -> { + String moduleFilePath = "light_idea_test_case.iml"; + File imlFile = new File(moduleFilePath); + if (imlFile.exists()) { + //temporary workaround for IDEA-147530: otherwise if someone saved module with this name before the created module will get its settings + FileUtil.delete(imlFile); } + return ModuleManager.getInstance(project).newModule(moduleFilePath, getModuleType().getId()); }); } @@ -119,30 +111,22 @@ public class LightProjectDescriptor { } }; FileBasedIndex.getInstance().registerIndexableSet(indexableFileSet, null); - Disposer.register(module.getProject(), new Disposable() { - @Override - public void dispose() { - FileBasedIndex.getInstance().removeIndexableSet(indexableFileSet); - } - }); + Disposer.register(module.getProject(), () -> FileBasedIndex.getInstance().removeIndexableSet(indexableFileSet)); return srcRoot; } protected void createContentEntry(@NotNull final Module module, @NotNull final VirtualFile srcRoot) { - updateModel(module, new Consumer() { - @Override - public void consume(ModifiableRootModel model) { - Sdk sdk = getSdk(); - if (sdk != null) { - model.setSdk(sdk); - } - - ContentEntry contentEntry = model.addContentEntry(srcRoot); - contentEntry.addSourceFolder(srcRoot, false); - - configureModule(module, model, contentEntry); + updateModel(module, model -> { + Sdk sdk = getSdk(); + if (sdk != null) { + model.setSdk(sdk); } + + ContentEntry contentEntry = model.addContentEntry(srcRoot); + contentEntry.addSourceFolder(srcRoot, false); + + configureModule(module, model, contentEntry); }); } @@ -163,9 +147,12 @@ public class LightProjectDescriptor { protected void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) { } - + public interface SetupHandler { - void moduleCreated(@NotNull Module module); - void sourceRootCreated(@NotNull VirtualFile sourceRoot); - } + default void moduleCreated(@NotNull Module module) { + } + + default void sourceRootCreated(@NotNull VirtualFile sourceRoot) { + } + } } diff --git a/platform/util/src/com/intellij/util/EnvironmentUtil.java b/platform/util/src/com/intellij/util/EnvironmentUtil.java index 768b5623fc83..c27806a49b48 100644 --- a/platform/util/src/com/intellij/util/EnvironmentUtil.java +++ b/platform/util/src/com/intellij/util/EnvironmentUtil.java @@ -53,6 +53,7 @@ public class EnvironmentUtil { private static final String LC_CTYPE = "LC_CTYPE"; private static final Future> ourEnvGetter; + static { if (SystemInfo.isMac && "unlocked".equals(System.getProperty("__idea.mac.env.lock")) && Registry.is("idea.fix.mac.env")) { ourEnvGetter = AppExecutorUtil.getAppExecutorService().submit(new Callable>() { @@ -149,6 +150,8 @@ public class EnvironmentUtil { return array; } + private static final String DISABLE_OMZ_AUTO_UPDATE = "DISABLE_AUTO_UPDATE"; + private static Map getShellEnv() throws Exception { String shell = System.getenv("SHELL"); if (shell == null || !new File(shell).canExecute()) { @@ -168,15 +171,16 @@ public class EnvironmentUtil { String[] command = {shell, "-l", "-i", "-c", "'" + reader.getAbsolutePath() + "' '" + envFile.getAbsolutePath() + "'"}; LOG.info("loading shell env: " + StringUtil.join(command, " ")); - Process process = new ProcessBuilder(command).redirectErrorStream(true).start(); + ProcessBuilder builder = new ProcessBuilder(command).redirectErrorStream(true); + builder.environment().put(DISABLE_OMZ_AUTO_UPDATE, "true"); + Process process = builder.start(); StreamGobbler gobbler = new StreamGobbler(process.getInputStream()); int rv = waitAndTerminateAfter(process, SHELL_ENV_READING_TIMEOUT); gobbler.stop(); String lines = FileUtil.loadFile(envFile); if (rv != 0 || lines.isEmpty()) { - LOG.info("shell process output: " + StringUtil.trimEnd(gobbler.getText(), '\n')); - throw new Exception("rv:" + rv + " text:" + lines.length()); + throw new Exception("rv:" + rv + " text:" + lines.length() + " out:" + StringUtil.trimEnd(gobbler.getText(), '\n')); } return parseEnv(lines); } @@ -186,7 +190,7 @@ public class EnvironmentUtil { } private static Map parseEnv(String text) throws Exception { - Set toIgnore = new HashSet(Arrays.asList("_", "PWD", "SHLVL")); + Set toIgnore = new HashSet(Arrays.asList("_", "PWD", "SHLVL", DISABLE_OMZ_AUTO_UPDATE)); Map env = System.getenv(); Map newEnv = new HashMap(); @@ -299,7 +303,6 @@ public class EnvironmentUtil { } private static class StreamGobbler extends BaseOutputReader { - private final StringBuffer myBuffer; public StreamGobbler(@NotNull InputStream stream) { @@ -324,4 +327,4 @@ public class EnvironmentUtil { return myBuffer.toString(); } } -} +} \ No newline at end of file diff --git a/platform/util/src/com/intellij/util/io/BaseOutputReader.java b/platform/util/src/com/intellij/util/io/BaseOutputReader.java index 2e73ddff7870..72f880eb03f0 100644 --- a/platform/util/src/com/intellij/util/io/BaseOutputReader.java +++ b/platform/util/src/com/intellij/util/io/BaseOutputReader.java @@ -103,9 +103,9 @@ public abstract class BaseOutputReader extends BaseDataReader { processLine(myInputBuffer, myLineBuffer, n); } - boolean isReady = availableUnsupported || myReader.ready(); + boolean isReady = myReader.ready(); - if (!isReady) { + if (!availableUnsupported && !isReady) { TimeoutUtil.sleep(mySleepingPolicy.getTimeToSleep(n > 0)); isReady = myReader.ready(); } diff --git a/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java b/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java index 9728f9b70390..4d51cb94a75f 100644 --- a/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java +++ b/platform/util/testSrc/com/intellij/util/EnvironmentUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -63,4 +63,4 @@ public class EnvironmentUtilTest { Map env = EnvironmentUtil.testLoader(); assertTrue(env.size() >= System.getenv().size() / 2); } -} +} \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChange.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChange.java index 9c0ec75719b1..590c6e970529 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChange.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChange.java @@ -49,7 +49,6 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.io.IOException; import java.util.List; -import java.util.concurrent.atomic.AtomicReference; public class ShelvedChange { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.shelf.ShelvedChange"); @@ -58,7 +57,6 @@ public class ShelvedChange { private final String myBeforePath; private final String myAfterPath; private final FileStatus myFileStatus; - private final AtomicReference myIsConflicting; private Change myChange; public ShelvedChange(final String patchPath, final String beforePath, final String afterPath, final FileStatus fileStatus) { @@ -67,25 +65,19 @@ public class ShelvedChange { // optimisation: memory myAfterPath = Comparing.equal(beforePath, afterPath) ? beforePath : afterPath; myFileStatus = fileStatus; - myIsConflicting = new AtomicReference(); } public boolean isConflictingChange(final Project project) { - Boolean isConflicting = myIsConflicting.get(); - if (isConflicting != null) return isConflicting; - ContentRevision afterRevision = getChange(project).getAfterRevision(); if (afterRevision == null) return false; try { afterRevision.getContent(); } - catch(VcsException e) { + catch (VcsException e) { if (e.getCause() instanceof ApplyPatchException) { - myIsConflicting.set(true); return true; } } - myIsConflicting.set(false); return false; } @@ -204,7 +196,6 @@ public class ShelvedChange { private final Project myProject; private final FilePath myBeforeFilePath; private final FilePath myAfterFilePath; - private String myContent; public PatchedContentRevision(Project project, final FilePath beforeFilePath, final FilePath afterFilePath) { myProject = project; @@ -215,16 +206,13 @@ public class ShelvedChange { @Override @Nullable public String getContent() throws VcsException { - if (myContent == null) { - try { - myContent = loadContent(); - } - catch (Exception e) { - throw new VcsException(e); - } + try { + // content based on local shouldn't be cached because local file may be changed (during show diff also) + return loadContent(); + } + catch (Exception e) { + throw new VcsException(e); } - - return myContent; } @Nullable diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java index a8804468cd44..052887b10b4f 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/FxmlReferencesContributor.java @@ -93,7 +93,10 @@ public class FxmlReferencesContributor extends PsiReferenceContributor { registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("@")).and(attributeValueInFxml), new JavaFxLocationReferenceProvider()); - registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("$")).and(attributeValueInFxml), + registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withValue(string().startsWith("$")) + .withParent(XmlPatterns.xmlAttribute() + .andNot(XmlPatterns.xmlAttribute().withName(FxmlConstants.FX_VALUE))) + .and(attributeValueInFxml), new JavaFxComponentIdReferenceProvider()); registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute().withName("url")).and(attributeValueInFxml), diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxComponentIdReferenceProvider.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxComponentIdReferenceProvider.java index d7c8779dce7e..82b6aa22ca4d 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxComponentIdReferenceProvider.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxComponentIdReferenceProvider.java @@ -49,10 +49,6 @@ class JavaFxComponentIdReferenceProvider extends PsiReferenceProvider { @Override public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { - final PsiElement parent = element.getParent(); - if (parent instanceof XmlAttribute && FxmlConstants.FX_VALUE.equals(((XmlAttribute)parent).getName())) { - return PsiReference.EMPTY_ARRAY; - } final XmlAttributeValue xmlAttributeValue = (XmlAttributeValue)element; final String value = xmlAttributeValue.getValue(); if (JavaFxPsiUtil.isIncorrectExpressionBinding(value)) { diff --git a/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenPlugin.java b/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenPlugin.java index abe3fb4b23d7..f127ace77adc 100644 --- a/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenPlugin.java +++ b/plugins/maven/maven-server-api/src/org/jetbrains/idea/maven/model/MavenPlugin.java @@ -160,17 +160,27 @@ public class MavenPlugin implements Serializable { private final List myGoals; private final Element myConfiguration; private final String myExecutionId; + private final String myPhase; public Execution(String executionId, List goals, Element configuration) { + this(executionId, null, goals, configuration); + } + + public Execution(String executionId, String phase, List goals, Element configuration) { myGoals = goals; myConfiguration = configuration; myExecutionId = executionId; + myPhase = phase; } public String getExecutionId() { return myExecutionId; } + public String getPhase() { + return myPhase; + } + public List getGoals() { return myGoals; } @@ -189,6 +199,7 @@ public class MavenPlugin implements Serializable { if (myGoals != null ? !myGoals.equals(that.myGoals) : that.myGoals != null) return false; if (myExecutionId != null ? !myExecutionId.equals(that.myExecutionId) : that.myExecutionId != null) return false; + if (myPhase != null ? !myPhase.equals(that.myPhase) : that.myPhase != null) return false; if (!JDOMUtil.areElementsEqual(myConfiguration, that.myConfiguration)) return false; return true; @@ -200,6 +211,9 @@ public class MavenPlugin implements Serializable { if (myExecutionId != null) { result = 31 * result + myExecutionId.hashCode(); } + if (myPhase != null) { + result = 31 * result + myPhase.hashCode(); + } return result; } diff --git a/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ModelConverter.java b/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ModelConverter.java index 9b6d586cddfd..4642d0bc08f1 100644 --- a/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ModelConverter.java +++ b/plugins/maven/maven2-server-impl/src/org/jetbrains/idea/maven/server/embedder/Maven2ModelConverter.java @@ -273,7 +273,7 @@ public class Maven2ModelConverter { } public static MavenPlugin.Execution convertExecution(PluginExecution execution) throws RemoteException { - return new MavenPlugin.Execution(execution.getId(), execution.getGoals(), convertConfiguration(execution.getConfiguration())); + return new MavenPlugin.Execution(execution.getId(), execution.getPhase(), execution.getGoals(), convertConfiguration(execution.getConfiguration())); } private static Element convertConfiguration(Object config) throws RemoteException { diff --git a/plugins/maven/maven3-server-common/src/org/jetbrains/idea/maven/server/MavenModelConverter.java b/plugins/maven/maven3-server-common/src/org/jetbrains/idea/maven/server/MavenModelConverter.java index daecb94144ac..84554f23877c 100644 --- a/plugins/maven/maven3-server-common/src/org/jetbrains/idea/maven/server/MavenModelConverter.java +++ b/plugins/maven/maven3-server-common/src/org/jetbrains/idea/maven/server/MavenModelConverter.java @@ -264,7 +264,7 @@ public class MavenModelConverter { } public static MavenPlugin.Execution convertExecution(PluginExecution execution) throws RemoteException { - return new MavenPlugin.Execution(execution.getId(), execution.getGoals(), convertConfiguration(execution.getConfiguration())); + return new MavenPlugin.Execution(execution.getId(), execution.getPhase(), execution.getGoals(), convertConfiguration(execution.getConfiguration())); } private static Element convertConfiguration(Object config) throws RemoteException { diff --git a/python/IntelliLang-python/src/resources/pyInjections.xml b/python/IntelliLang-python/src/resources/pyInjections.xml index f500f3ab4b16..06c3be4eece5 100644 --- a/python/IntelliLang-python/src/resources/pyInjections.xml +++ b/python/IntelliLang-python/src/resources/pyInjections.xml @@ -11,74 +11,74 @@ "SQL select/delete/insert/update/create" - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/python/build/pycharm_community_build.gant b/python/build/pycharm_community_build.gant index ee43535231dd..6213ba96fcb2 100644 --- a/python/build/pycharm_community_build.gant +++ b/python/build/pycharm_community_build.gant @@ -175,6 +175,11 @@ public layoutCommunity(String classesPath, Set usedJars) { List pathsDist = new File("${home}/out/pycharm/jdk.win/jre").exists() ? [paths.distAll, paths.distWin, "${home}/out/pycharm/jdk.win"] : [paths.distAll, paths.distWin] buildWinZip("${paths.artifacts}/pycharmPC-${buildNumber}.zip", pathsDist) + //win oracle jdk + if (new File("${home}/out/pycharm/jdk.oracle.win/jre").exists()) { + buildWinZip("${paths.artifacts}/pycharmPC-${buildNumber}-oracle-win.zip", [paths.distAll, paths.distWin, "${home}/out/pycharm/jdk.oracle.win"]) + } + String tarRoot = isEap() ? "pycharm-community-$buildNumber" : "pycharm-community-${p("component.version.major")}.${p("component.version.minor")}" buildTarGz(tarRoot, "$paths.artifacts/pycharmPC-${buildNumber}-no-jdk.tar", [paths.distAll, paths.distUnix]) requireProperty("jdk.linux", "false") diff --git a/python/educational-python/build/pycharm_edu_build.gant b/python/educational-python/build/pycharm_edu_build.gant index d78efb76507b..b9219f85552f 100644 --- a/python/educational-python/build/pycharm_edu_build.gant +++ b/python/educational-python/build/pycharm_edu_build.gant @@ -210,6 +210,10 @@ public layoutEducational(String classesPath, Set usedJars) { buildNSIS([paths.distAll, paths.distWin], "$pythonEduHome/build/strings.nsi", "$pythonEduHome/build/paths.nsi", "pycharmEDU-", false, true, system_selector) + //win oracle jdk + if (new File("${home}/out/pycharm/jdk.oracle.win/jre").exists()) { + buildWinZip("${paths.artifacts}/pycharm${buildName}-oracle-win.zip", [paths.distAll, paths.distWin, "${home}/out/pycharm/jdk.oracle.win"]) + } String tarRoot = isEap() ? "pycharm-edu-$buildNumber" : "pycharm-edu-${p("component.version.major")}.${p("component.version.minor")}" buildTarGz(tarRoot, "$paths.artifacts/pycharm${buildName}-no-jdk.tar", [paths.distAll, paths.distUnix])