diff --git a/platform/configuration-store-impl/src/ExportSettingsAction.kt b/platform/configuration-store-impl/src/ExportSettingsAction.kt index 25908e561072..663c05d5ae9f 100644 --- a/platform/configuration-store-impl/src/ExportSettingsAction.kt +++ b/platform/configuration-store-impl/src/ExportSettingsAction.kt @@ -225,11 +225,12 @@ fun getExportableComponentsMap(onlyExisting: Boolean, } } - val files = if (additionalExportFile == null) listOf(file) else if (isFileIncluded) listOf(file, additionalExportFile) else listOf(additionalExportFile) - val item = ExportableItem(files, if (computePresentableNames) getComponentPresentableName(stateAnnotation, aClass, pluginDescriptor) else "", storage.roamingType) - result.putValue(file, item) + val presentableName = if (computePresentableNames) getComponentPresentableName(stateAnnotation, aClass, pluginDescriptor) else "" + if (isFileIncluded) { + result.putValue(file, ExportableItem(listOf(file), presentableName, storage.roamingType)) + } if (additionalExportFile != null) { - result.putValue(additionalExportFile, item) + result.putValue(additionalExportFile, ExportableItem(listOf(additionalExportFile), presentableName, RoamingType.DEFAULT)) } } true @@ -237,10 +238,10 @@ fun getExportableComponentsMap(onlyExisting: Boolean, // must be in the end - because most of SchemeManager clients specify additionalExportFile in the State spec (SchemeManagerFactory.getInstance() as SchemeManagerFactoryBase).process { - if (it.roamingType != RoamingType.DISABLED && it.presentableName != null && it.fileSpec.getOrNull(0) != '$') { + if (it.roamingType != RoamingType.DISABLED && it.fileSpec.getOrNull(0) != '$') { val file = Paths.get(storageManager.expandMacros(ROOT_CONFIG), it.fileSpec) if (!result.containsKey(file) && !isSkipFile(file)) { - result.putValue(file, ExportableItem(listOf(file), it.presentableName, it.roamingType)) + result.putValue(file, ExportableItem(listOf(file), it.presentableName ?: "", it.roamingType)) } } } diff --git a/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt b/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt index 58aa248da2af..ed47ca66e2de 100644 --- a/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt +++ b/platform/configuration-store-impl/testSrc/ApplicationStoreTest.kt @@ -129,13 +129,15 @@ internal class ApplicationStoreTest { fun test(item: ExportableItem) { val file = item.files.first() - assertThat(map[file]).containsExactly(item) + assertThat(map.get(file)).containsExactly(item) assertThat(file).doesNotExist() } - test(ExportableItem(listOf(Paths.get(optionsPath, "filetypes.xml"), Paths.get(rootConfigPath, "filetypes")), "File types", RoamingType.DEFAULT)) + test(ExportableItem(listOf(Paths.get(optionsPath, "filetypes.xml")), "File types", RoamingType.DEFAULT)) + test(ExportableItem(listOf(Paths.get(rootConfigPath, "filetypes")), "File types", RoamingType.DEFAULT)) test(ExportableItem(listOf(Paths.get(optionsPath, "customization.xml")), "Menus and toolbars customization", RoamingType.DEFAULT)) - test(ExportableItem(listOf(Paths.get(optionsPath, "templates.xml"), Paths.get(rootConfigPath, "templates")), "Live templates", RoamingType.DEFAULT)) + test(ExportableItem(listOf(Paths.get(optionsPath, "templates.xml")), "Live templates", RoamingType.DEFAULT)) + test(ExportableItem(listOf(Paths.get(rootConfigPath, "templates")), "Live templates", RoamingType.DEFAULT)) } @Test fun `import settings`() { @@ -166,7 +168,6 @@ internal class ApplicationStoreTest { val relativePaths = getPaths(ByteArrayInputStream(exportedData.internalBuffer, 0, exportedData.size())) assertThat(relativePaths).containsOnly("a.xml", "foo/", "foo/bar.icls", "IntelliJ IDEA Global Settings") - val list = listOf(ExportableItem(listOf(componentFile, additionalFile), "")) fun Path.to(that: B) = MapEntry.entry(this, that) @@ -174,7 +175,7 @@ internal class ApplicationStoreTest { val componentKey = A::class.java.name picoContainer.registerComponent(InstanceComponentAdapter(componentKey, component)) try { - assertThat(getExportableComponentsMap(false, false, storageManager, relativePaths)).containsOnly(componentFile.to(list), additionalFile.to(list)) + assertThat(getExportableComponentsMap(false, false, storageManager, relativePaths)).containsOnly(componentFile.to(listOf(ExportableItem(listOf(componentFile), ""))), additionalFile.to(listOf(ExportableItem(listOf(additionalFile), "")))) } finally { picoContainer.unregisterComponent(componentKey) diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java index ea4dcee737ac..483727401eb0 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java @@ -60,6 +60,7 @@ import com.intellij.vcs.log.VcsFullCommitDetails; import com.intellij.vcsUtil.VcsImplUtil; import com.intellij.vcsUtil.VcsUtil; import org.intellij.images.editor.ImageFileEditor; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -165,6 +166,7 @@ public class DvcsUtil { * Returns the currently selected file, based on which VcsBranch or StatusBar components will identify the current repository root. */ @Nullable + @CalledInAwt public static VirtualFile getSelectedFile(@NotNull Project project) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); final FileEditor fileEditor = StatusBarUtil.getCurrentFileEditor(project, statusBar); @@ -328,6 +330,7 @@ public class DvcsUtil { } @Nullable + @CalledInAwt public static T guessCurrentRepositoryQuick(@NotNull Project project, @NotNull AbstractRepositoryManager manager, @Nullable String defaultRootPathValue) { diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java index 6c9eaceb8b79..2368f86a7302 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/DvcsStatusWidget.java @@ -185,6 +185,7 @@ public abstract class DvcsStatusWidget extends EditorBased } @Nullable + @CalledInAwt private String getToolTip(@NotNull Project project) { T currentRepository = guessCurrentRepository(project); if (currentRepository == null) return null; diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java index 481f9deeff9c..a1f5e3ca5392 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java @@ -64,7 +64,6 @@ import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.*; -import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.tree.IElementType; @@ -138,7 +137,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo // Should be accessed in EDT only. @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized") private boolean myDocumentClearing; - private int consoleTooMuchTextBufferRatio; public Editor getEditor() { return myEditor; @@ -323,8 +321,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo myInputMessageFilter = null; } - consoleTooMuchTextBufferRatio = Registry.intValue("console.too.much.text.buffer.ratio"); - project.getMessageBus().connect(this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { private long myLastStamp; @@ -786,10 +782,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo return myLastStickingToEnd; } - private boolean isTheAmountOfTextTooBig(final int textLength) { - return myBuffer.isUseCyclicBuffer() && textLength > myBuffer.getCyclicBufferSize() / consoleTooMuchTextBufferRatio; - } - private void clearHyperlinkAndFoldings() { myEditor.getMarkupModel().removeAllHighlighters(); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java index cbd5201134ea..a4a24208b4fc 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComponentWithBrowseButton.java @@ -26,7 +26,6 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor; import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; @@ -36,7 +35,6 @@ import com.intellij.ui.GuiUtils; import com.intellij.ui.UIBundle; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.accessibility.ScreenReader; -import com.intellij.util.ui.update.LazyUiDisposable; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -131,42 +129,43 @@ public class ComponentWithBrowseButton extends JPanel i @Nullable Project project, FileChooserDescriptor fileChooserDescriptor, TextComponentAccessor accessor) { - addBrowseFolderListener(title, description, project, fileChooserDescriptor, accessor, true); + addActionListener(new BrowseFolderActionListener<>(title, description, this, project, fileChooserDescriptor, accessor)); } + /** + * @deprecated use {@link #addBrowseFolderListener(String, String, Project, FileChooserDescriptor, TextComponentAccessor)} instead + */ public void addBrowseFolderListener(@Nullable @Nls(capitalization = Nls.Capitalization.Title) String title, @Nullable @Nls(capitalization = Nls.Capitalization.Sentence) String description, @Nullable Project project, FileChooserDescriptor fileChooserDescriptor, TextComponentAccessor accessor, boolean autoRemoveOnHide) { - addBrowseFolderListener(project, new BrowseFolderActionListener<>(title, description, this, project, fileChooserDescriptor, accessor), autoRemoveOnHide); + addBrowseFolderListener(title, description, project, fileChooserDescriptor, accessor); } + /** + * @deprecated use {@link #addActionListener(ActionListener)} instead + */ + @SuppressWarnings("UnusedParameters") public void addBrowseFolderListener(@Nullable Project project, final BrowseFolderActionListener actionListener) { - addBrowseFolderListener(project, actionListener, true); + addActionListener(actionListener); } + /** + * @deprecated use {@link #addActionListener(ActionListener)} instead + */ + @SuppressWarnings("UnusedParameters") public void addBrowseFolderListener(@Nullable Project project, final BrowseFolderActionListener actionListener, boolean autoRemoveOnHide) { - if (autoRemoveOnHide) { - new LazyUiDisposable>(null, this, this) { - @Override - protected void initialize(@NotNull Disposable parent, @NotNull ComponentWithBrowseButton child, @Nullable Project project) { - addActionListener(actionListener); - Disposer.register(child, new Disposable() { - @Override - public void dispose() { - removeActionListener(actionListener); - } - }); - } - }; - } else { - addActionListener(actionListener); - } + addActionListener(actionListener); } @Override - public void dispose() { } + public void dispose() { + ActionListener[] listeners = myBrowseButton.getActionListeners(); + for (ActionListener listener : listeners) { + myBrowseButton.removeActionListener(listener); + } + } public FixedSizeButton getButton() { return myBrowseButton; diff --git a/platform/platform-impl/src/com/intellij/help/impl/ShowProductVersion.java b/platform/platform-impl/src/com/intellij/help/impl/ShowProductVersion.java new file mode 100644 index 000000000000..f7bd4af84df3 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/help/impl/ShowProductVersion.java @@ -0,0 +1,41 @@ +/* + * 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.help.impl; + +import com.intellij.openapi.application.ApplicationStarter; +import com.intellij.openapi.application.ex.ApplicationInfoEx; + +/** + * @author Konstantin Bulenkov + */ +public class ShowProductVersion implements ApplicationStarter { + @Override + public String getCommandName() { + return "-version"; + } + + @Override + public void premain(String[] args) { + + } + + @SuppressWarnings("UseOfSystemOutOrSystemErr") + @Override + public void main(String[] args) { + System.out.println(ApplicationInfoEx.getInstanceEx().getFullVersion()); + System.exit(0); + } +} diff --git a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java index 569a74a74345..d9b0868182c3 100644 --- a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java +++ b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.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. @@ -102,12 +102,12 @@ public class IdeaApplication { } else { Splash splash = null; - if (myArgs.length == 0) { - myStarter = getStarter(); - if (myStarter instanceof IdeStarter) { - splash = ((IdeStarter)myStarter).showSplash(myArgs); - } + //if (myArgs.length == 0) { + myStarter = getStarter(); + if (myStarter instanceof IdeStarter) { + splash = ((IdeStarter)myStarter).showSplash(myArgs); } + //} ApplicationManagerEx.createApplication(isInternal, isUnitTest, false, false, ApplicationManagerEx.IDEA_APPLICATION, splash); } diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/JBProtocolOpenProjectCommand.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/JBProtocolOpenProjectCommand.java index 3af81dc1026f..9306509f500e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/JBProtocolOpenProjectCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/JBProtocolOpenProjectCommand.java @@ -16,7 +16,9 @@ package com.intellij.openapi.project.impl; import com.intellij.ide.impl.ProjectUtil; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.JBProtocolCommand; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.LocalFileSystem; @@ -34,7 +36,8 @@ public class JBProtocolOpenProjectCommand extends JBProtocolCommand { @Override public void perform(String target, Map parameters) { String path = URLDecoder.decode(target); - path = StringUtil.trimStart(path, LocalFileSystem.PROTOCOL_PREFIX); - ProjectUtil.openProject(path, null, true); + String projectPath = StringUtil.trimStart(path, LocalFileSystem.PROTOCOL_PREFIX); + ApplicationManager.getApplication().invokeLater( + () -> ProjectUtil.openProject(projectPath, null, true), ModalityState.NON_MODAL); } } diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index 071385c6b135..5fb51b52f3a4 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -7,6 +7,7 @@ + diff --git a/platform/projectModel-api/src/org/jetbrains/concurrency/Promise.java b/platform/projectModel-api/src/org/jetbrains/concurrency/Promise.java index 6353cf75ab2b..5112c9ad5b23 100644 --- a/platform/projectModel-api/src/org/jetbrains/concurrency/Promise.java +++ b/platform/projectModel-api/src/org/jetbrains/concurrency/Promise.java @@ -33,6 +33,12 @@ public interface Promise { PENDING, FULFILLED, REJECTED } + @NotNull + @Deprecated + static RuntimeException createError(@NotNull String error) { + return Promises.createError(error); + } + @NotNull static Promise resolve(T result) { return result == null ? Promises.resolvedPromise() : new DonePromise<>(result); diff --git a/platform/projectModel-api/src/org/jetbrains/concurrency/promise.kt b/platform/projectModel-api/src/org/jetbrains/concurrency/promise.kt index 552dcb9ace59..56851f141d5f 100644 --- a/platform/projectModel-api/src/org/jetbrains/concurrency/promise.kt +++ b/platform/projectModel-api/src/org/jetbrains/concurrency/promise.kt @@ -128,6 +128,7 @@ fun collectResults(promises: List>): Promise> { return all(promises, results) } +@JvmOverloads fun createError(error: String, log: Boolean = false): RuntimeException = MessageError(error, log) inline fun AsyncPromise.compute(runnable: () -> T) { diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index c90c6ea23848..40dcb301ba9f 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -606,12 +606,6 @@ emmet.segments.limit=50 emmet.template.length.limit.kilobytes=15 command.line.execution.timeout=30 -console.ui.cycle.buffer.size=Default -console.too.much.text.buffer.ratio=10 -console.too.much.text.buffer.ratio.description=Used for disabling of console processing (console filters for highlights, foldings...),\n\ - when there is too much text to process.\n\ - The ratio is used against the console cycle buffer size (idea.cycle.buffer.size/theRatio=maxTextLength). - ide.settings.keymap.input.method.enabled=false ide.settings.keymap.input.method.enabled.description=Use input method instead of simple key event to enter shortcuts. @@ -664,7 +658,6 @@ decompiler.dump.original.lines.description=Show original line numbers as comment ide.transparency.mode.for.windows=false ide.transparency.mode.for.windows.description=Allow to add transparency to floating windows -ide.new.welcome.screen=true ide.new.welcome.screen.force=false editor.caret.width=2 diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java index 3e1492265ab0..a4eb66e5f8c9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/patch/ApplyPatchDifferentiatedDialog.java @@ -38,6 +38,7 @@ import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.openapi.ui.Splitter; import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.PopupStep; @@ -470,16 +471,18 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { protected JComponent createCenterPanel() { if (myCenterPanel == null) { myCenterPanel = new JPanel(new GridBagLayout()); - final GridBagConstraints gb = - new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0); + final GridBagConstraints centralGb = createConstraints(); myPatchFileLabel = new JLabel(VcsBundle.message("patch.apply.file.name.field")); myPatchFileLabel.setLabelFor(myPatchFile); - myCenterPanel.add(myPatchFileLabel, gb); + myCenterPanel.add(myPatchFileLabel, centralGb); - gb.fill = GridBagConstraints.HORIZONTAL; - ++gb.gridy; - myCenterPanel.add(myPatchFile, gb); + centralGb.fill = GridBagConstraints.HORIZONTAL; + ++centralGb.gridy; + myCenterPanel.add(myPatchFile, centralGb); + + JPanel treePanel = new JPanel(new GridBagLayout()); + final GridBagConstraints gb = createConstraints(); final DefaultActionGroup group = new DefaultActionGroup(); final AnAction[] treeActions = myChangesTreeList.getTreeActions(); @@ -504,28 +507,37 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { } final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("APPLY_PATCH", group, true); - ++gb.gridy; gb.fill = GridBagConstraints.HORIZONTAL; - myCenterPanel.add(toolbar.getComponent(), gb); + treePanel.add(toolbar.getComponent(), gb); ++gb.gridy; gb.weighty = 1; gb.fill = GridBagConstraints.BOTH; - myCenterPanel.add(ScrollPaneFactory.createScrollPane(myChangesTreeList), gb); + treePanel.add(ScrollPaneFactory.createScrollPane(myChangesTreeList), gb); ++gb.gridy; gb.weighty = 0; gb.fill = GridBagConstraints.NONE; gb.insets.bottom = UIUtil.DEFAULT_VGAP; - myCenterPanel.add(myCommitLegendPanel.getComponent(), gb); + treePanel.add(myCommitLegendPanel.getComponent(), gb); ++gb.gridy; - gb.fill = GridBagConstraints.HORIZONTAL; - myCenterPanel.add(myChangeListChooser, gb); + Splitter splitter = new Splitter(true, 0.7f); + splitter.setFirstComponent(treePanel); + splitter.setSecondComponent(myChangeListChooser); + ++centralGb.gridy; + centralGb.weighty = 1; + centralGb.fill = GridBagConstraints.BOTH; + myCenterPanel.add(splitter, centralGb); } return myCenterPanel; } + @NotNull + private static GridBagConstraints createConstraints() { + return new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, JBUI.insets(1), 0, 0); + } + private void paintBusy(final boolean requestPut) { if (requestPut) { myChangesTreeList.setPaintBusy(true); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/NewEditChangelistPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/NewEditChangelistPanel.java index 98260d3f6a08..022076e1edf5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/NewEditChangelistPanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/NewEditChangelistPanel.java @@ -175,16 +175,18 @@ public abstract class NewEditChangelistPanel extends JPanel { final Set editorFeatures = ContainerUtil.newHashSet(); ContainerUtil.addIfNotNull(editorFeatures, SpellCheckingEditorCustomizationProvider.getInstance().getEnabledCustomization()); - + double scaleFactor = 1.3; if (defaultLines == 1) { editorFeatures.add(HorizontalScrollBarEditorCustomization.DISABLED); editorFeatures.add(OneLineEditorCustomization.ENABLED); - } else { + } + else { editorFeatures.add(SoftWrapsEditorCustomization.ENABLED); + scaleFactor = 2.1; } editorField = service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, editorFeatures); final int height = editorField.getFontMetrics(editorField.getFont()).getHeight(); - editorField.getComponent().setMinimumSize(new Dimension(100, (int)(height * 1.3))); + editorField.getComponent().setMinimumSize(new Dimension(100, (int)(height * scaleFactor))); return editorField; } diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java index 3e241fbae18c..3a1a4d8b762b 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/GraphCommitCellRenderer.java @@ -62,7 +62,8 @@ public class GraphCommitCellRenderer extends ColoredTableCellRenderer { @Override public Dimension getPreferredSize() { Dimension preferredSize = super.getPreferredSize(); - return new Dimension(preferredSize.width + (myReferencePainter.isLeftAligned() ? 0 : myReferencePainter.getSize().width), + return new Dimension(preferredSize.width + (myReferencePainter.isLeftAligned() ? 0 : + myReferencePainter.getSize().width - LabelPainter.GRADIENT_WIDTH), getPreferredHeight()); } diff --git a/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java b/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java index a02b27bcd542..220531f553f7 100644 --- a/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java +++ b/plugins/git4idea/src/git4idea/actions/GitRepositoryAction.java @@ -37,6 +37,7 @@ import git4idea.branch.GitBranchUtil; import git4idea.i18n.GitBundle; import git4idea.repo.GitRepository; import git4idea.repo.GitRepositoryManager; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -80,6 +81,7 @@ public abstract class GitRepositoryAction extends DumbAwareAction { } @NotNull + @CalledInAwt private static VirtualFile getDefaultRoot(@NotNull Project project, @NotNull List roots, @Nullable VirtualFile[] vFiles) { if (vFiles != null) { for (VirtualFile file : vFiles) { @@ -120,6 +122,7 @@ public abstract class GitRepositoryAction extends DumbAwareAction { return true; } + @CalledInAwt protected static boolean isRebasing(AnActionEvent e) { final Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { diff --git a/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java b/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java index aabee79e1bb5..1fd3c9a03305 100644 --- a/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java +++ b/plugins/git4idea/src/git4idea/branch/GitBranchUtil.java @@ -38,6 +38,7 @@ import git4idea.repo.GitRemote; import git4idea.repo.GitRepository; import git4idea.ui.branch.GitMultiRootBranchConfig; import git4idea.validators.GitNewBranchNameValidator; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -319,6 +320,7 @@ public class GitBranchUtil { * or if the current Git root couldn't be determined. */ @Nullable + @CalledInAwt public static GitRepository getCurrentRepository(@NotNull Project project) { return getRepositoryOrGuess(project, DvcsUtil.getSelectedFile(project)); } diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java b/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java index f263655b3e81..e8350ba14caa 100644 --- a/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java +++ b/plugins/git4idea/src/git4idea/ui/branch/GitBranchWidget.java @@ -26,6 +26,7 @@ import git4idea.branch.GitBranchUtil; import git4idea.config.GitVcsSettings; import git4idea.repo.GitRepository; import git4idea.repo.GitRepositoryChangeListener; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,6 +48,7 @@ public class GitBranchWidget extends DvcsStatusWidget { @Nullable @Override + @CalledInAwt protected GitRepository guessCurrentRepository(@NotNull Project project) { return DvcsUtil.guessCurrentRepositoryQuick(project, GitUtil.getRepositoryManager(project), mySettings.getRecentRootPath()); } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgActionUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgActionUtil.java index 627c88898bb6..3fdd52207c8c 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgActionUtil.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgActionUtil.java @@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.repo.HgRepository; @@ -45,6 +46,7 @@ public class HgActionUtil { } @Nullable + @CalledInAwt public static HgRepository getSelectedRepositoryFromEvent(AnActionEvent e) { final DataContext dataContext = e.getDataContext(); final Project project = CommonDataKeys.PROJECT.getData(dataContext); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgProcessStateAction.java b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgProcessStateAction.java index 8ec77382a3af..623946ef1c3c 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgProcessStateAction.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/action/HgProcessStateAction.java @@ -17,6 +17,7 @@ package org.zmlx.hg4idea.action; import com.intellij.dvcs.repo.Repository; import com.intellij.openapi.actionSystem.AnActionEvent; +import org.jetbrains.annotations.CalledInAwt; import org.zmlx.hg4idea.repo.HgRepository; public abstract class HgProcessStateAction extends HgAbstractGlobalSingleRepoAction { @@ -26,6 +27,7 @@ public abstract class HgProcessStateAction extends HgAbstractGlobalSingleRepoAct myState = state; } + @CalledInAwt protected boolean isRebasing(AnActionEvent e) { HgRepository repository = HgActionUtil.getSelectedRepositoryFromEvent(e); return repository != null && repository.getState() == myState; diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java b/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java index e827d91dccc8..970eff482291 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/status/ui/HgStatusWidget.java @@ -22,6 +22,7 @@ import com.intellij.openapi.ui.popup.ListPopup; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.StatusBarWidget; import com.intellij.util.ObjectUtils; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.HgProjectSettings; @@ -52,6 +53,7 @@ public class HgStatusWidget extends DvcsStatusWidget { @Nullable @Override + @CalledInAwt protected HgRepository guessCurrentRepository(@NotNull Project project) { return DvcsUtil.guessCurrentRepositoryQuick(project, HgUtil.getRepositoryManager(project), HgProjectSettings.getInstance(project).getRecentRootPath()); diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java index 870e6b9a40ef..e455e7769fd1 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgUtil.java @@ -25,7 +25,9 @@ import com.intellij.openapi.util.Couple; import com.intellij.openapi.util.ShutDownTracker; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vcs.*; +import com.intellij.openapi.vcs.FilePath; +import com.intellij.openapi.vcs.FileStatus; +import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.ContentRevision; @@ -40,9 +42,9 @@ import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.GuiUtils; import com.intellij.util.ArrayUtil; -import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import com.intellij.vcsUtil.VcsUtil; +import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.*; @@ -112,39 +114,23 @@ public abstract class HgUtil { VcsDirtyScopeManager.getInstance(project).dirDirtyRecursively(file); } - public static void markFileDirty( final Project project, final VirtualFile file ) throws InvocationTargetException, InterruptedException { - ApplicationManager.getApplication().runReadAction(new Runnable() { - public void run() { - VcsDirtyScopeManager.getInstance(project).fileDirty(file); - } - }); - runWriteActionAndWait(new Runnable() { - public void run() { - file.refresh(true, false); - } - }); + public static void markFileDirty(final Project project, final VirtualFile file) throws InvocationTargetException, InterruptedException { + ApplicationManager.getApplication().runReadAction(() -> VcsDirtyScopeManager.getInstance(project).fileDirty(file)); + runWriteActionAndWait(() -> file.refresh(true, false)); } /** * Runs the given task as a write action in the event dispatching thread and waits for its completion. */ public static void runWriteActionAndWait(@NotNull final Runnable runnable) throws InvocationTargetException, InterruptedException { - GuiUtils.runOrInvokeAndWait(new Runnable() { - public void run() { - ApplicationManager.getApplication().runWriteAction(runnable); - } - }); + GuiUtils.runOrInvokeAndWait(() -> ApplicationManager.getApplication().runWriteAction(runnable)); } /** * Schedules the given task to be run as a write action in the event dispatching thread. */ public static void runWriteActionLater(@NotNull final Runnable runnable) { - ApplicationManager.getApplication().invokeLater(new Runnable() { - public void run() { - ApplicationManager.getApplication().runWriteAction(runnable); - } - }); + ApplicationManager.getApplication().invokeLater(() -> ApplicationManager.getApplication().runWriteAction(runnable)); } /** @@ -161,17 +147,11 @@ public abstract class HgUtil { try { final File file = copyResourceToTempFile(base, ".py"); final String fileName = file.getName(); - ShutDownTracker.getInstance().registerShutdownTask(new Runnable() { - public void run() { - File[] files = file.getParentFile().listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.startsWith(fileName); - } - }); - if (files != null) { - for (File file1 : files) { - file1.delete(); - } + ShutDownTracker.getInstance().registerShutdownTask(() -> { + File[] files = file.getParentFile().listFiles((dir, name) -> name.startsWith(fileName)); + if (files != null) { + for (File file1 : files) { + file1.delete(); } } }); @@ -203,7 +183,7 @@ public abstract class HgUtil { * @param dir Directory which parent will be checked. * @return Directory which is the nearest hg root being a parent of this directory, * or null if this directory is not under hg. - * @see com.intellij.openapi.vcs.AbstractVcs#isVersionedDirectory(com.intellij.openapi.vfs.VirtualFile) + * @see com.intellij.openapi.vcs.AbstractVcs#isVersionedDirectory(VirtualFile) */ @Nullable public static VirtualFile getNearestHgRoot(VirtualFile dir) { @@ -227,7 +207,8 @@ public abstract class HgUtil { /** * Gets the Mercurial root for the given file path or null if non exists: * the root should not only be in directory mappings, but also the .hg repository folder should exist. - * @see #getHgRootOrThrow(com.intellij.openapi.project.Project, com.intellij.openapi.vcs.FilePath) + * + * @see #getHgRootOrThrow(Project, FilePath) */ @Nullable public static VirtualFile getHgRootOrNull(Project project, FilePath filePath) { @@ -255,8 +236,8 @@ public abstract class HgUtil { /** * Gets the Mercurial root for the given file path or null if non exists: * the root should not only be in directory mappings, but also the .hg repository folder should exist. - * @see #getHgRootOrThrow(com.intellij.openapi.project.Project, com.intellij.openapi.vcs.FilePath) - * @see #getHgRootOrNull(com.intellij.openapi.project.Project, com.intellij.openapi.vcs.FilePath) + * @see #getHgRootOrThrow(Project, FilePath) + * @see #getHgRootOrNull(Project, FilePath) */ @Nullable public static VirtualFile getHgRootOrNull(Project project, @NotNull VirtualFile file) { @@ -266,7 +247,7 @@ public abstract class HgUtil { /** * Gets the Mercurial root for the given file path or throws a VcsException if non exists: * the root should not only be in directory mappings, but also the .hg repository folder should exist. - * @see #getHgRootOrNull(com.intellij.openapi.project.Project, com.intellij.openapi.vcs.FilePath) + * @see #getHgRootOrNull(Project, FilePath) */ @NotNull public static VirtualFile getHgRootOrThrow(Project project, FilePath filePath) throws VcsException { @@ -282,15 +263,6 @@ public abstract class HgUtil { return getHgRootOrThrow(project, VcsUtil.getFilePath(file.getPath())); } - @Nullable - public static VirtualFile getRootForSelectedFile(@NotNull Project project) { - VirtualFile selectedFile = DvcsUtil.getSelectedFile(project); - if (selectedFile != null) { - return getHgRootOrNull(project, selectedFile); - } - return null; - } - /** * Shows a message dialog to enter the name of new branch. * @@ -373,19 +345,6 @@ public abstract class HgUtil { } } - /** - * Returns all HG roots in the project. - */ - public static @NotNull List getHgRepositories(@NotNull Project project) { - final List repos = new LinkedList<>(); - for (VcsRoot root : ProjectLevelVcsManager.getInstance(project).getAllVcsRoots()) { - if (HgVcs.VCS_NAME.equals(root.getVcs().getName())) { - repos.add(root.getPath()); - } - } - return repos; - } - @NotNull public static Map> sortByHgRoots(@NotNull Project project, @NotNull Collection files) { Map> sorted = new HashMap<>(); @@ -474,7 +433,7 @@ public abstract class HgUtil { Collection hgChanges = statusCommand.executeInCurrentThread(root, Collections.singleton(path)); List changes = new ArrayList<>(); - //convert output changes to standart Change class + //convert output changes to standard Change class for (HgChange hgChange : hgChanges) { FileStatus status = convertHgDiffStatus(hgChange.getStatus()); if (status != FileStatus.UNKNOWN) { @@ -540,6 +499,7 @@ public abstract class HgUtil { } @Nullable + @CalledInAwt public static HgRepository getCurrentRepository(@NotNull Project project) { if (project.isDisposed()) return null; return DvcsUtil.guessRepositoryForFile(project, getRepositoryManager(project), @@ -667,11 +627,6 @@ public abstract class HgUtil { @NotNull public static List getTargetNames(@NotNull HgRepository repository) { - return ContainerUtil.sorted(ContainerUtil.map(repository.getRepositoryConfig().getPaths(), new Function() { - @Override - public String fun(String s) { - return removePasswordIfNeeded(s); - } - })); + return ContainerUtil.sorted(ContainerUtil.map(repository.getRepositoryConfig().getPaths(), s -> removePasswordIfNeeded(s))); } } diff --git a/plugins/settings-repository/src/IcsManager.kt b/plugins/settings-repository/src/IcsManager.kt index 90d78fa12981..03ddf6ec335a 100644 --- a/plugins/settings-repository/src/IcsManager.kt +++ b/plugins/settings-repository/src/IcsManager.kt @@ -24,6 +24,7 @@ import com.intellij.openapi.application.PathManager import com.intellij.openapi.components.RoamingType import com.intellij.openapi.components.stateStore import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.diagnostic.catchAndLog import com.intellij.openapi.progress.runBackgroundableTask import com.intellij.openapi.project.Project import com.intellij.openapi.project.impl.ProjectLifecycleListener @@ -216,39 +217,32 @@ class IcsApplicationLoadListener : ApplicationLoadListener { icsManager = IcsManager(pluginSystemDir) if (!pluginSystemDir.exists()) { - try { + LOG.catchAndLog { val oldPluginDir = Paths.get(PathManager.getSystemPath(), "settingsRepository") if (oldPluginDir.exists()) { oldPluginDir.move(pluginSystemDir) } } - catch (e: Throwable) { - LOG.error(e) - } } val repositoryManager = icsManager.repositoryManager if (repositoryManager.isRepositoryExists() && repositoryManager is GitRepositoryManager) { + val osFolderName = getOsFolderName() + val migrateSchemes = repositoryManager.renameDirectory(linkedMapOf( Pair("\$ROOT_CONFIG$", null), - Pair("_mac/\$ROOT_CONFIG$", "_mac"), - Pair("_windows/\$ROOT_CONFIG$", "_windows"), - Pair("_linux/\$ROOT_CONFIG$", "_linux"), - Pair("_freebsd/\$ROOT_CONFIG$", "_freebsd"), - Pair("_unix/\$ROOT_CONFIG$", "_unix"), - Pair("_unknown/\$ROOT_CONFIG$", "_unknown"), + Pair("$osFolderName/\$ROOT_CONFIG$", osFolderName), Pair("\$APP_CONFIG$", null), - Pair("_mac/\$APP_CONFIG$", "_mac"), - Pair("_windows/\$APP_CONFIG$", "_windows"), - Pair("_linux/\$APP_CONFIG$", "_linux"), - Pair("_freebsd/\$APP_CONFIG$", "_freebsd"), - Pair("_unix/\$APP_CONFIG$", "_unix"), - Pair("_unknown/\$APP_CONFIG$", "_unknown") - )) + Pair("$osFolderName/\$APP_CONFIG$", osFolderName) + ), "Get rid of \$ROOT_CONFIG$ and \$APP_CONFIG") + + val migrateKeyMaps = repositoryManager.renameDirectory(linkedMapOf( + Pair("$osFolderName/keymaps", "keymaps") + ), "Move keymaps to root") val removeOtherXml = repositoryManager.delete("other.xml") - if (migrateSchemes || removeOtherXml) { + if (migrateSchemes || migrateKeyMaps || removeOtherXml) { // schedule push to avoid merge conflicts application.invokeLater({ icsManager.autoSyncManager.autoSync(force = true) }) } diff --git a/plugins/settings-repository/src/IcsUrlBuilder.kt b/plugins/settings-repository/src/IcsUrlBuilder.kt index 268c126c5807..187c24172bfc 100644 --- a/plugins/settings-repository/src/IcsUrlBuilder.kt +++ b/plugins/settings-repository/src/IcsUrlBuilder.kt @@ -21,7 +21,7 @@ import com.intellij.openapi.util.SystemInfo internal const val PROJECTS_DIR_NAME: String = "_projects/" private val osPrefixes = arrayOf("_mac/", "_windows/", "_linux/", "_freebsd/", "_unix/") -private fun getOsFolderName() = when { +internal fun getOsFolderName() = when { SystemInfo.isMac -> "_mac" SystemInfo.isWindows -> "_windows" SystemInfo.isLinux -> "_linux" diff --git a/plugins/settings-repository/src/git/GitRepositoryManager.kt b/plugins/settings-repository/src/git/GitRepositoryManager.kt index 02660790c9e6..38cfe1eae5ca 100644 --- a/plugins/settings-repository/src/git/GitRepositoryManager.kt +++ b/plugins/settings-repository/src/git/GitRepositoryManager.kt @@ -16,6 +16,7 @@ package org.jetbrains.settingsRepository.git import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.diagnostic.catchAndLog import com.intellij.openapi.progress.EmptyProgressIndicator import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.util.ShutDownTracker @@ -37,7 +38,7 @@ import org.eclipse.jgit.transport.* import org.jetbrains.settingsRepository.* import org.jetbrains.settingsRepository.RepositoryManager.Updater import java.io.IOException -import java.nio.file.Files +import java.nio.file.FileAlreadyExistsException import java.nio.file.Path import kotlin.concurrent.write @@ -229,7 +230,7 @@ class GitRepositoryManager(private val credentialsStore: Lazy): Boolean { + fun renameDirectory(pairs: Map, commitMessage: String): Boolean { var addCommand: AddCommand? = null val toDelete = SmartList() for ((oldPath, newPath) in pairs) { @@ -242,31 +243,31 @@ class GitRepositoryManager(private val credentialsStore: Lazy