mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
IJP-630 (wip) Add 'Build Project' option to the Actions on Save page
GitOrigin-RevId: 977ca695e504f61fe24de37f192634178519536a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
857f86da99
commit
62486562d2
@@ -1,16 +1,25 @@
|
|||||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||||
package com.intellij.compiler.options;
|
package com.intellij.compiler.options;
|
||||||
|
|
||||||
|
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||||
|
import com.intellij.ide.actionsOnSave.*;
|
||||||
import com.intellij.openapi.compiler.JavaCompilerBundle;
|
import com.intellij.openapi.compiler.JavaCompilerBundle;
|
||||||
import com.intellij.openapi.options.Configurable;
|
import com.intellij.openapi.options.Configurable;
|
||||||
import com.intellij.openapi.options.ConfigurationException;
|
import com.intellij.openapi.options.ConfigurationException;
|
||||||
import com.intellij.openapi.options.SearchableConfigurable;
|
import com.intellij.openapi.options.SearchableConfigurable;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
|
import com.intellij.ui.components.ActionLink;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CompilerConfigurable implements SearchableConfigurable.Parent, Configurable.NoScroll {
|
public class CompilerConfigurable implements SearchableConfigurable.Parent, Configurable.NoScroll {
|
||||||
|
private static final String CONFIGURABLE_ID = "project.propCompiler";
|
||||||
|
|
||||||
private final CompilerUIConfigurable myCompilerUIConfigurable;
|
private final CompilerUIConfigurable myCompilerUIConfigurable;
|
||||||
|
|
||||||
public CompilerConfigurable(Project project) {
|
public CompilerConfigurable(Project project) {
|
||||||
@@ -30,7 +39,7 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent, Conf
|
|||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return getHelpTopic();
|
return CONFIGURABLE_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -67,4 +76,62 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent, Conf
|
|||||||
public Configurable @NotNull [] getConfigurables() {
|
public Configurable @NotNull [] getConfigurables() {
|
||||||
return new Configurable[0];
|
return new Configurable[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class BuildOnSaveInfoProvider extends ActionOnSaveInfoProvider {
|
||||||
|
@Override
|
||||||
|
protected @NotNull Collection<? extends ActionOnSaveInfo> getActionOnSaveInfos(@NotNull Project project) {
|
||||||
|
for (CompilerOptionsFilter filter : CompilerOptionsFilter.EP_NAME.getExtensionList()) {
|
||||||
|
if (!filter.isAvailable(CompilerOptionsFilter.Setting.AUTO_MAKE, project)) return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return List.of(new BuildOnSaveInfo(project));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static class BuildOnSaveInfo extends ActionOnSaveBackedByOwnConfigurable<CompilerConfigurable> {
|
||||||
|
private final @NotNull Project myProject;
|
||||||
|
|
||||||
|
private BuildOnSaveInfo(@NotNull Project project) {
|
||||||
|
super(CONFIGURABLE_ID, CompilerConfigurable.class);
|
||||||
|
myProject = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull String getActionOnSaveName() {
|
||||||
|
return JavaCompilerBundle.message("settings.actions.on.save.page.build.project.on.save.checkbox");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable ActionOnSaveComment getCommentAccordingToStoredState() {
|
||||||
|
return ActionOnSaveComment.info(JavaCompilerBundle.message("settings.actions.on.save.page.build.project.on.save.checkbox.comment"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable ActionOnSaveComment getCommentAccordingToUiState(@NotNull CompilerConfigurable configurable) {
|
||||||
|
return ActionOnSaveComment.info(JavaCompilerBundle.message("settings.actions.on.save.page.build.project.on.save.checkbox.comment"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isActionOnSaveEnabledAccordingToStoredState() {
|
||||||
|
return CompilerWorkspaceConfiguration.getInstance(myProject).MAKE_PROJECT_ON_SAVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isActionOnSaveEnabledAccordingToUiState(@NotNull CompilerConfigurable configurable) {
|
||||||
|
return configurable.myCompilerUIConfigurable.getBuildOnSaveCheckBox().isSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setActionOnSaveEnabled(@NotNull CompilerConfigurable configurable, boolean enabled) {
|
||||||
|
configurable.myCompilerUIConfigurable.getBuildOnSaveCheckBox().setSelected(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull List<? extends ActionLink> getActionLinks() {
|
||||||
|
String linkText = JavaCompilerBundle.message("settings.actions.on.save.page.compiler.settings.link");
|
||||||
|
return List.of(ActionsOnSaveConfigurable.createGoToPageInSettingsLink(linkText, CONFIGURABLE_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||||
package com.intellij.compiler.options;
|
package com.intellij.compiler.options;
|
||||||
|
|
||||||
import com.intellij.codeInsight.NullableNotNullDialog;
|
import com.intellij.codeInsight.NullableNotNullDialog;
|
||||||
@@ -336,6 +336,10 @@ public class CompilerUIConfigurable implements SearchableConfigurable, Configura
|
|||||||
return myPanel;
|
return myPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JCheckBox getBuildOnSaveCheckBox() {
|
||||||
|
return myCbEnableAutomake;
|
||||||
|
}
|
||||||
|
|
||||||
private void createUIComponents() {
|
private void createUIComponents() {
|
||||||
myResourcePatternsField = new RawCommandLineEditor(ParametersListUtil.COLON_LINE_PARSER, ParametersListUtil.COLON_LINE_JOINER);
|
myResourcePatternsField = new RawCommandLineEditor(ParametersListUtil.COLON_LINE_PARSER, ParametersListUtil.COLON_LINE_JOINER);
|
||||||
myResourcePatternsField.setDialogCaption("Resource patterns");
|
myResourcePatternsField.setDialogCaption("Resource patterns");
|
||||||
|
|||||||
@@ -124,6 +124,9 @@ configurable.CompilerUIConfigurable.display.name=General
|
|||||||
configurable.AnnotationProcessorsConfigurable.display.name=Annotation Processors
|
configurable.AnnotationProcessorsConfigurable.display.name=Annotation Processors
|
||||||
settings.configure.annotations=&Configure annotations...
|
settings.configure.annotations=&Configure annotations...
|
||||||
settings.build.project.automatically=Build project automatically
|
settings.build.project.automatically=Build project automatically
|
||||||
|
settings.actions.on.save.page.build.project.on.save.checkbox=Build project
|
||||||
|
settings.actions.on.save.page.build.project.on.save.checkbox.comment=Build not auto-triggered during run/debug session
|
||||||
|
settings.actions.on.save.page.compiler.settings.link=Compiler settings...
|
||||||
settings.compile.independent.modules.in.parallel=Compile independent modules in parallel
|
settings.compile.independent.modules.in.parallel=Compile independent modules in parallel
|
||||||
settings.rebuild.module.on.dependency.change=Rebuild module on dependency change
|
settings.rebuild.module.on.dependency.change=Rebuild module on dependency change
|
||||||
settings.build.process.heap.size=Shared build process heap size (Mbytes):
|
settings.build.process.heap.size=Shared build process heap size (Mbytes):
|
||||||
|
|||||||
@@ -508,6 +508,10 @@
|
|||||||
key="rmi.compiler.description" bundle="messages.JavaCompilerBundle"/>
|
key="rmi.compiler.description" bundle="messages.JavaCompilerBundle"/>
|
||||||
</projectConfigurable>
|
</projectConfigurable>
|
||||||
|
|
||||||
|
<actionOnSaveInfoProvider id="BuildOnSaveInfoProvider"
|
||||||
|
implementation="com.intellij.compiler.options.CompilerConfigurable$BuildOnSaveInfoProvider"
|
||||||
|
order="after PrettierOnSaveInfoProvider, after EsLintOnSaveInfoProvider"/>
|
||||||
|
|
||||||
<advancedSetting id="compiler.automake.allow.when.app.running" groupKey="advanced.settings.group.compiler" default="false"
|
<advancedSetting id="compiler.automake.allow.when.app.running" groupKey="advanced.settings.group.compiler" default="false"
|
||||||
bundle="messages.JavaBundle"/>
|
bundle="messages.JavaBundle"/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user