Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2011-11-27 10:07:39 +04:00
266 changed files with 3204 additions and 1645 deletions
+11
View File
@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="gson">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/gson-1.7.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/gson-1.7.1-sources.zip!/" />
</SOURCES>
</library>
</component>
BIN
View File
Binary file not shown.
+2
View File
@@ -215,6 +215,8 @@ public def layoutCommunityPlugins(String home) {
module("maven2-server-impl")
}
fileset(dir: "$home/plugins/maven/lib")
fileset(dir: "$home/lib/") { include(name: "gson-1.7.1.jar")}
fileset(dir: "$home/lib/") { include(name: "jaxb*.jar")}
fileset(dir: "$home/plugins/maven/maven-server-api/lib")
fileset(dir: "$home/plugins/maven/maven2-server-impl/lib")
}
+2 -2
View File
@@ -178,11 +178,11 @@ libraryLicense(name: "Antlr", libraryName: "antlr.jar", version: "3.1.3", licens
licenseUrl: "http://www.antlr.org/license.html")
libraryLicense(name: "Guava", version: "R8", license: "Apache 2.0", url: "http://code.google.com/p/guava-libraries/", licenseUrl: "http://ant.apache.org/license.html")
libraryLicense(name: "Groovy", version: "1.7.3", license: "Apache 2.0", url: "http://groovy.codehaus.org/")
libraryLicense(name: "Gson", libraryName: "gson-1.3.jar", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/")
libraryLicense(name: "Gson", libraryName: "gson", license: "Apache 2.0", url: "http://code.google.com/p/google-gson/")
libraryLicense(name: "ini4j", libraryName: "ini4j-0.5.2-patched", version: "0.5.2 (with a patch by JetBrains)", license: "Apache 2.0", url: "http://ini4j.sourceforge.net/", attachedTo: "git4idea")
libraryLicense(name: "ISO RELAX", libraryName: "isorelax.jar", license: "MIT License", url: "http://sourceforge.net/projects/iso-relax/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
libraryLicense(name: "JavaCVS", attachedTo: "javacvs-src", version: "no version number available (with patches by JetBrains)", license: "Sun Public License", url: "http://javacvs.netbeans.org/library/", licenseUrl: "http://www.netbeans.org/about/legal/spl.html")
libraryLicense(name: "JAXB", libraryName: "JAXB", version: "2.1.10", license: "CDDL 1.1 & GPL 2", url: "http://jaxb.java.net/", licenseUrl: "http://glassfish.java.net/public/CDDL+GPL_1_1.html")
libraryLicense(name: "JAXB", libraryName: "JAXB", version: "2.2.4-1", license: "CDDL 1.1", url: "http://jaxb.java.net/", licenseUrl: "http://glassfish.java.net/public/CDDL+GPL_1_1.html")
libraryLicense(name: "Jaxen", version: "", license: "modified Apache", url: "http://www.jaxen.org/", licenseUrl: "http://www.jaxen.org/license.html")
libraryLicense(name: "JavaHelp", version: "2.0_02", license: "included as license/javahelp_license.html in IntelliJ IDEA distribution", url: "http://java.sun.com/products/javahelp/")
libraryLicense(name: "JCIP Annotations", libraryName: "jcip", license: "Creative Commons Attribution License", url: "http://www.jcip.net", licenseUrl: "http://creativecommons.org/licenses/by/2.5")
@@ -20,11 +20,11 @@ import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.ui.ex.MultiLineLabel;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
@@ -55,7 +55,7 @@ import java.util.Map;
* @author Eugene Zhuravlev
* Date: Oct 5, 2009
*/
public class AnnotationProcessorsConfigurable implements SearchableConfigurable {
public class AnnotationProcessorsConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private ProcessedModulesTable myModulesTable;
private final Project myProject;
private JRadioButton myRbClasspath;
@@ -144,28 +144,27 @@ public class AnnotationProcessorsConfigurable implements SearchableConfigurable
processorTablePanel.add(myProcessorPanel, BorderLayout.CENTER);
processorTablePanel.setPreferredSize(new Dimension(processorTablePanel.getPreferredSize().width, 50));
myModulesTable = new ProcessedModulesTable(myProject);
myModulesTable.setBorder(IdeBorderFactory.createTitledBorder("Processed Modules", false, false, true));
final JLabel noteMessage = new MultiLineLabel("Source files generated by annotation processors will be stored under the project output directory.\n" +
"To override this behaviour for certain modules you may specify the directory name in the table below.\n" +
"If specified, the directory will be created under corresponding module's content root.");
final JLabel noteMessage = new JLabel("<html>Source files generated by annotation processors will be stored under the project output directory. " +
"To override this behaviour for certain modules you may specify the directory name in the table below. " +
"If specified, the directory will be created under corresponding module's content root.</html>");
final JLabel warning = new MultiLineLabel("WARNING!\n" +
"All source files located in the generated sources output directory WILL BE EXCLUDED from annotation processing.\n" +
"If option 'Clear output directory on rebuild' is enabled,\n" +
"the entire contents of directories specified in the table below WILL BE CLEARED on rebuild.");
final JLabel warning = new JLabel("<html>WARNING!<br>" +
"All source files located in the generated sources output directory WILL BE EXCLUDED from annotation processing. " +
"If option 'Clear output directory on rebuild' is enabled, " +
"the entire contents of directories specified in the table below WILL BE CLEARED on rebuild.</html>");
warning.setFont(warning.getFont().deriveFont(Font.BOLD));
mainPanel.add(myCbEnableProcessing, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
mainPanel.add(myRbClasspath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
mainPanel.add(myRbProcessorsPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
mainPanel.add(myProcessorPathField, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0));
mainPanel.add(processorTablePanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
mainPanel.add(noteMessage, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
mainPanel.add(warning, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
mainPanel.add(myModulesTable, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
mainPanel.add(myCbEnableProcessing, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
mainPanel.add(myRbClasspath, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(10, 0, 0, 0), 0, 0));
mainPanel.add(myRbProcessorsPath, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
mainPanel.add(myProcessorPathField, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0));
mainPanel.add(processorTablePanel, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
mainPanel.add(noteMessage, new GridBagConstraints(0, 4, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
mainPanel.add(warning, new GridBagConstraints(0, 5, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10, 5, 0, 0), 0, 0));
mainPanel.add(myModulesTable, new GridBagConstraints(0, 6, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(10, 0, 0, 0), 0, 0));
myRbClasspath.addItemListener(new ItemListener() {
@@ -43,7 +43,7 @@ import java.util.List;
public class CompilerConfigurable implements SearchableConfigurable.Parent {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.options.CompilerConfigurable");
private final Project myProject;
private static final Icon ICON = IconLoader.getIcon("/general/configurableCompiler.png");
private final CompilerUIConfigurable myCompilerUIConfigurable;
@@ -111,13 +111,14 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent {
CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject);
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true);
final ExcludedEntriesConfigurable excludes = new ExcludedEntriesConfigurable(myProject, descriptor, compilerConfiguration.getExcludedEntriesConfiguration()) {
public void apply() {
super.apply();
FileStatusManager.getInstance(myProject).fileStatusesChanged(); // refresh exclude from compile status
//ProjectView.getInstance(myProject).refresh();
}
};
final ExcludedEntriesConfigurable excludes =
new ExcludedEntriesConfigurable(myProject, descriptor, compilerConfiguration.getExcludedEntriesConfiguration()) {
public void apply() {
super.apply();
FileStatusManager.getInstance(myProject).fileStatusesChanged(); // refresh exclude from compile status
//ProjectView.getInstance(myProject).refresh();
}
};
kids.add(createExcludesWrapper(excludes));
@@ -145,50 +146,50 @@ public class CompilerConfigurable implements SearchableConfigurable.Parent {
additional.add(0, new RmicConfigurable(RmicConfiguration.getSettings(myProject)));
additional.add(0, new AnnotationProcessorsConfigurable(myProject));
additional.add(0, new JavaCompilersTab(myProject, compilerConfiguration.getRegisteredJavaCompilers(), compilerConfiguration.getDefaultCompiler()));
additional.add(0, new JavaCompilersTab(myProject, compilerConfiguration.getRegisteredJavaCompilers(),
compilerConfiguration.getDefaultCompiler()));
kids.addAll(additional);
myKids = kids.toArray(new Configurable[kids.size()]);
}
return myKids;
}
private static Configurable createExcludesWrapper(final ExcludedEntriesConfigurable excludes) {
return new SearchableConfigurable(){
@Nls
public String getDisplayName() {
return "Excludes";
}
return new SearchableConfigurable() {
@Nls
public String getDisplayName() {
return "Excludes";
}
public Icon getIcon() {
return null;
}
public Icon getIcon() {
return null;
}
public String getHelpTopic() {
return "reference.projectsettings.compiler.excludes";
}
public String getHelpTopic() {
return "reference.projectsettings.compiler.excludes";
}
public JComponent createComponent() {
return excludes.createComponent();
}
public JComponent createComponent() {
return excludes.createComponent();
}
public void apply() {
excludes.apply();
}
public void apply() {
excludes.apply();
}
public boolean isModified() {
return excludes.isModified();
}
public boolean isModified() {
return excludes.isModified();
}
public void reset() {
excludes.reset();
}
public void reset() {
excludes.reset();
}
public void disposeUIResources() {
excludes.disposeUIResources();
}
public void disposeUIResources() {
excludes.disposeUIResources();
}
@NotNull
public String getId() {
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.compiler.options.CompilerUIConfigurable">
<grid id="1663f" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="1663f" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="28" y="24" width="883" height="379"/>
@@ -106,6 +106,11 @@
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="71752">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>
@@ -22,6 +22,7 @@ import com.intellij.compiler.MalformedPatternException;
import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
@@ -32,7 +33,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
public class CompilerUIConfigurable implements SearchableConfigurable {
public class CompilerUIConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private JPanel myPanel;
private final Project myProject;
@@ -49,9 +50,9 @@ public class CompilerUIConfigurable implements SearchableConfigurable {
myCbUseCompileServer.setVisible(ApplicationManager.getApplication().isInternal());
myPatternLegendLabel.setText("<html>" +
"Use <b>;</b> to separate patterns and <b>!</b> to negate a pattern.<br/>" +
"Accepted wildcards: <b>?</b> - exactly one symbol; <b>*</b> - zero or more symbols;<br/>" +
"&nbsp;&nbsp;<b>/</b> - path separator; <b>/**/</b> - any number of directories;<br>" +
"&nbsp;&nbsp;<i>resources</i>:* - for everything under a source root named <i>resources</i>" +
"Accepted wildcards: <b>?</b> &mdash; exactly one symbol; <b>*</b> &mdash; zero or more symbols;<br/>" +
"&nbsp;&nbsp;<b>/</b> &mdash; path separator; <b>/**/</b> &mdash; any number of directories;<br>" +
"&nbsp;&nbsp;<i>&lt;dir_name&gt;</i>:&lt;pattern&gt; &mdash; restrict to source roots with the specified name" +
"</html>");
}
@@ -39,7 +39,7 @@ import java.util.Vector;
* @author Eugene Zhuravlev
* Date: Mar 30, 2004
*/
public class JavaCompilersTab implements SearchableConfigurable {
public class JavaCompilersTab implements SearchableConfigurable, Configurable.NoScroll {
private JPanel myPanel;
private JPanel myContentPanel;
private JComboBox myCompiler;
@@ -17,6 +17,7 @@ package com.intellij.compiler.options;
import com.intellij.compiler.impl.rmiCompiler.RmicSettings;
import com.intellij.openapi.compiler.CompilerBundle;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.ui.RawCommandLineEditor;
@@ -30,7 +31,7 @@ import java.awt.event.ItemListener;
* @author Eugene Zhuravlev
* Date: Mar 30, 2004
*/
public class RmicConfigurable implements SearchableConfigurable {
public class RmicConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private JPanel myPanel;
private JCheckBox myCbEnabled;
private JCheckBox myCbGenerateIiopStubs;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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,75 +15,33 @@
*/
package com.intellij.debugger.actions;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.engine.RequestHint;
import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.containers.OrderedSet;
import com.intellij.util.text.CharArrayUtil;
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
public class SmartStepIntoActionHandler extends DebuggerActionHandler {
public void perform(@NotNull final Project project, final AnActionEvent event) {
final DebuggerContextImpl debuggerContext = (DebuggerManagerEx.getInstanceEx(project)).getContext();
doStep(project, debuggerContext.getSourcePosition(), debuggerContext.getDebuggerSession());
/**
* User: Alexander Podkhalyuzin
* Date: 22.11.11
*/
public class JavaSmartStepIntoHandler extends JvmSmartStepIntoHandler {
@Override
public boolean isAvailable(final SourcePosition position) {
final PsiFile file = position.getFile();
return file.getLanguage().isKindOf(JavaLanguage.INSTANCE);
}
private static void doStep(final @NotNull Project project, final @Nullable SourcePosition position, final @NotNull DebuggerSession session) {
final VirtualFile file = position != null ? position.getFile().getVirtualFile() : null;
final FileEditor fileEditor = file != null? FileEditorManager.getInstance(project).getSelectedEditor(file) : null;
if (fileEditor instanceof TextEditor) {
final List<PsiMethod> methods = findReferencedMethods(position);
if (methods.size() > 0) {
if (methods.size() == 1) {
session.stepInto(true, createSmartStepFilter(methods.get(0)));
}
else {
final PsiMethodListPopupStep popupStep = new PsiMethodListPopupStep(methods, new PsiMethodListPopupStep.OnChooseRunnable() {
public void execute(PsiMethod chosenMethod) {
session.stepInto(true, createSmartStepFilter(chosenMethod));
}
});
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(popupStep);
final RelativePoint point = DebuggerUIUtil.calcPopupLocation(((TextEditor)fileEditor).getEditor(), position.getLine());
popup.show(point);
}
return;
}
}
session.stepInto(true, null);
}
@Nullable
private static RequestHint.SmartStepFilter createSmartStepFilter(final PsiMethod method) {
return new RequestHint.SmartStepFilter(method);
}
private static List<PsiMethod> findReferencedMethods(final SourcePosition position) {
@Override
public List<PsiMethod> findReferencedMethods(final SourcePosition position) {
final int line = position.getLine();
if (line < 0) {
return Collections.emptyList(); // the document has been changed
@@ -95,8 +53,9 @@ public class SmartStepIntoActionHandler extends DebuggerActionHandler {
// the file is not physical
return Collections.emptyList();
}
final Document doc = FileDocumentManager.getInstance().getDocument(vFile);
if (doc == null) return Collections.emptyList();
if (line >= doc.getLineCount()) {
return Collections.emptyList(); // the document has been changed
}
@@ -144,13 +103,4 @@ public class SmartStepIntoActionHandler extends DebuggerActionHandler {
}
return Collections.emptyList();
}
public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
final DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();
DebuggerSession debuggerSession = context.getDebuggerSession();
final boolean isPaused = debuggerSession != null && debuggerSession.isPaused();
final SuspendContextImpl suspendContext = context.getSuspendContext();
final boolean hasCurrentThread = suspendContext != null && suspendContext.getThread() != null;
return isPaused && hasCurrentThread;
}
}
@@ -0,0 +1,74 @@
/*
* Copyright 2000-2009 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.debugger.actions;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.engine.RequestHint;
import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.containers.OrderedSet;
import com.intellij.util.text.CharArrayUtil;
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import gnu.trove.TObjectHashingStrategy;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collections;
import java.util.List;
public class JvmSmartStepIntoActionHandler extends DebuggerActionHandler {
public void perform(@NotNull final Project project, final AnActionEvent event) {
final DebuggerContextImpl debuggerContext = (DebuggerManagerEx.getInstanceEx(project)).getContext();
doStep(project, debuggerContext.getSourcePosition(), debuggerContext.getDebuggerSession());
}
private static void doStep(final @NotNull Project project, final @Nullable SourcePosition position, final @NotNull DebuggerSession session) {
final VirtualFile file = position != null ? position.getFile().getVirtualFile() : null;
final FileEditor fileEditor = file != null? FileEditorManager.getInstance(project).getSelectedEditor(file) : null;
if (fileEditor instanceof TextEditor) {
for (JvmSmartStepIntoHandler handler : Extensions.getExtensions(JvmSmartStepIntoHandler.EP_NAME)) {
if (handler.isAvailable(position) && handler.doSmartStep(position, session, (TextEditor)fileEditor)) return;
}
}
session.stepInto(true, null);
}
public boolean isEnabled(@NotNull final Project project, final AnActionEvent event) {
final DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();
DebuggerSession debuggerSession = context.getDebuggerSession();
final boolean isPaused = debuggerSession != null && debuggerSession.isPaused();
final SuspendContextImpl suspendContext = context.getSuspendContext();
final boolean hasCurrentThread = suspendContext != null && suspendContext.getThread() != null;
return isPaused && hasCurrentThread;
}
}
@@ -0,0 +1,79 @@
/*
* Copyright 2000-2011 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.debugger.actions;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.engine.RequestHint;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.psi.PsiMethod;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* User: Alexander Podkhalyuzin
* Date: 22.11.11
*/
public abstract class JvmSmartStepIntoHandler {
public static ExtensionPointName<JvmSmartStepIntoHandler> EP_NAME = ExtensionPointName.create("com.intellij.debugger.jvmSmartStepIntoHandler");
public abstract List<PsiMethod> findReferencedMethods(SourcePosition position);
public abstract boolean isAvailable(SourcePosition position);
/**
* Override this if you haven't PsiMethod, like in Kotlin.
* @param position
* @param session
* @param fileEditor
* @return false to continue for another handler or for default action (step into)
*/
public boolean doSmartStep(SourcePosition position, final DebuggerSession session, TextEditor fileEditor) {
final List<PsiMethod> methods = findReferencedMethods(position);
if (methods.size() > 0) {
if (methods.size() == 1) {
session.stepInto(true, getSmartStepFilter(methods.get(0)));
}
else {
final PsiMethodListPopupStep popupStep = new PsiMethodListPopupStep(methods, new PsiMethodListPopupStep.OnChooseRunnable() {
public void execute(PsiMethod chosenMethod) {
session.stepInto(true, getSmartStepFilter(chosenMethod));
}
});
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(popupStep);
final RelativePoint point = DebuggerUIUtil.calcPopupLocation(((TextEditor)fileEditor).getEditor(), position.getLine());
popup.show(point);
}
return true;
}
return false;
}
/**
* Override in case if your JVMNames slightly different then it can be provided by getJvmSignature method.
* @param method
* @return SmartStepFilter
*/
protected RequestHint.SmartStepFilter getSmartStepFilter(PsiMethod method) {
return new RequestHint.SmartStepFilter(method);
}
}
@@ -17,6 +17,7 @@ package com.intellij.debugger.settings;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.ui.classFilter.ClassFilterEditor;
@@ -27,7 +28,7 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class DebuggerSteppingConfigurable implements SearchableConfigurable {
public class DebuggerSteppingConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private JCheckBox myCbStepInfoFiltersEnabled;
private JCheckBox myCbSkipSyntheticMethods;
private JCheckBox myCbSkipConstructors;
@@ -21,6 +21,7 @@ import com.intellij.debugger.ui.tree.render.NodeRenderer;
import com.intellij.ide.util.ElementsChooser;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
@@ -41,7 +42,7 @@ import java.util.ArrayList;
* @author Eugene Zhuravlev
* Date: Feb 19, 2005
*/
public class UserRenderersConfigurable implements SearchableConfigurable {
public class UserRenderersConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.settings.UserRenderersConfigurable");
private static final Icon ADD_ICON = IconLoader.getIcon("/general/add.png");
private static final Icon REMOVE_ICON = IconLoader.getIcon("/general/remove.png");
@@ -64,7 +64,7 @@ public class JavaDebuggerSupport extends DebuggerSupport {
private final QuickEvaluateActionHandler myQuickEvaluateHandler = new QuickEvaluateActionHandler();
private final JavaDebuggerSettingsPanelProvider myDebuggerSettingsPanelProvider = new JavaDebuggerSettingsPanelProvider();
private final MuteBreakpointsActionHandler myMuteBreakpointsHandler = new MuteBreakpointsActionHandler();
private final DebuggerActionHandler mySmartStepIntoHandler = new SmartStepIntoActionHandler();
private final DebuggerActionHandler mySmartStepIntoHandler = new JvmSmartStepIntoActionHandler();
private final DebuggerActionHandler myAddToWatchedActionHandler = new AddToWatchActionHandler();
private JavaMarkObjectActionHandler myMarkObjectActionHandler = new JavaMarkObjectActionHandler();
@@ -140,7 +140,7 @@ public class RootsDetectionStep extends AbstractStepWithProgress<List<DetectedRo
final Set<String> selectedTypes = new HashSet<String>();
for (DetectedRootData rootData : myDetectedRootsChooser.getMarkedElements()) {
for (ProjectStructureDetector detector : rootData.getSelectedDetectors()) {
selectedTypes.add(detector.getClass().getName());
selectedTypes.add(detector.getDetectorId());
}
}
mySequence.setTypes(selectedTypes);
@@ -68,7 +68,7 @@ public abstract class CreateFromSourcesMode extends WizardMode {
sequence.addCommonStep(new RootsDetectionStep(projectBuilder, context, sequence, icon, "reference.dialogs.new.project.fromCode.source"));
for (ProjectStructureDetector detector : ProjectStructureDetector.EP_NAME.getExtensions()) {
for (ModuleWizardStep step : detector.createWizardSteps(projectBuilder, projectBuilder.getProjectDescriptor(detector), icon)) {
sequence.addSpecificStep(detector.getClass().getName(), step);
sequence.addSpecificStep(detector.getDetectorId(), step);
}
}
@@ -52,6 +52,11 @@ public abstract class JavaSourceRootDetector extends ProjectStructureDetector {
return DirectoryProcessingResult.PROCESS_CHILDREN;
}
@Override
public String getDetectorId() {
return "Java";
}
@NotNull
protected abstract String getLanguageName();
@@ -68,6 +68,10 @@ public abstract class ProjectStructureDetector {
return Collections.emptyList();
}
public String getDetectorId() {
return getClass().getName();
}
/**
* Setup modules and libraries for the selected roots
*/
@@ -19,7 +19,8 @@ import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.ExpectedTypesProvider;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.diagnostic.LogMessageEx;
import com.intellij.diagnostic.errordialog.Attachment;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
@@ -105,11 +106,8 @@ class JavaClassNameInsertHandler implements InsertHandler<JavaPsiClassReferenceE
String docText = context.getDocument().getText();
DefaultInsertHandler.addImportForItem(context, item);
if (context.getTailOffset() < 0) {
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
LOG.error("Tail offset degraded: " + context.getStartOffset() + "; " + docText);
} else {
LOG.error("Tail offset degraded after insertion");
}
LOG.error(LogMessageEx.createEvent("Tail offset degraded after insertion", "start=" + context.getStartOffset(),
new Attachment(context.getFile().getViewProvider().getVirtualFile().getPath(), docText)));
}
@@ -173,6 +173,13 @@ public class JavaCompletionUtil {
public static boolean isInExcludedPackage(@NotNull final PsiMember member) {
final String name = StaticImportMethodFix.getMemberQualifiedName(member);
if (name == null) return false;
if (!member.hasModifierProperty(PsiModifier.STATIC)) {
if (member instanceof PsiMethod || member instanceof PsiField || member instanceof PsiClass && member.getContainingClass() != null) {
return false;
}
}
CodeInsightSettings cis = CodeInsightSettings.getInstance();
for (String excluded : cis.EXCLUDED_PACKAGES) {
if (name.equals(excluded) || name.startsWith(excluded + ".")) {
@@ -198,6 +198,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
}
else if (instruction instanceof BranchingInstruction) {
PsiElement psiAnchor = ((BranchingInstruction)instruction).getPsiAnchor();
boolean underBinary = isAtRHSOfBooleanAnd(psiAnchor);
if (instruction instanceof InstanceofInstruction && visitor.isInstanceofRedundant((InstanceofInstruction)instruction)) {
if (visitor.canBeNull((BinopInstruction)instruction)) {
holder.registerProblem(psiAnchor,
@@ -207,7 +208,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
else {
final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, true);
holder.registerProblem(psiAnchor,
InspectionsBundle.message("dataflow.message.constant.condition", Boolean.toString(true)),
InspectionsBundle.message(underBinary ? "dataflow.message.constant.condition.whenriched" : "dataflow.message.constant.condition", Boolean.toString(true)),
localQuickFix==null?null:new LocalQuickFix[]{localQuickFix});
}
}
@@ -227,7 +228,7 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
boolean report = !(psiAnchor.getParent() instanceof PsiAssertStatement) || !DONT_REPORT_TRUE_ASSERT_STATEMENTS || !evaluatesToTrue;
if (report) {
final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, evaluatesToTrue);
holder.registerProblem(psiAnchor, InspectionsBundle.message("dataflow.message.constant.condition",
holder.registerProblem(psiAnchor, InspectionsBundle.message(underBinary ? "dataflow.message.constant.condition.whenriched" : "dataflow.message.constant.condition",
Boolean.toString(evaluatesToTrue)),
localQuickFix == null ? null : new LocalQuickFix[]{localQuickFix});
}
@@ -279,6 +280,22 @@ public class DataFlowInspection extends BaseLocalInspectionTool {
}
}
private static boolean isAtRHSOfBooleanAnd(PsiElement expr) {
PsiElement cur = expr;
while (cur != null && !(cur instanceof PsiMember)) {
PsiElement parent = cur.getParent();
if (parent instanceof PsiBinaryExpression && cur == ((PsiBinaryExpression)parent).getROperand()) {
return true;
}
cur = parent;
}
return false;
}
private static boolean isCompileConstantInIfCondition(PsiElement element) {
if (!(element instanceof PsiReferenceExpression)) return false;
PsiElement resolved = ((PsiReferenceExpression)element).resolve();
@@ -683,6 +683,11 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
return;
}
doFlash(variable);
doFlash((DfaVariableValue)variable.createNegated());
}
private void doFlash(DfaVariableValue variable) {
final int id = variable.getID();
int size = myEqClasses.size();
int interruptCount = 0;
@@ -57,11 +57,13 @@ import com.intellij.psi.util.PsiMethodUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.SeparatorFactory;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.HashMap;
import com.intellij.util.text.CharArrayUtil;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -140,6 +142,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
GridBagConstraints gc = new GridBagConstraints();
gc.weightx = 1;
gc.weighty = 0;
gc.insets = new Insets(0, IdeBorderFactory.TITLED_BORDER_INDENT, 2, 0);
gc.fill = GridBagConstraints.HORIZONTAL;
gc.anchor = GridBagConstraints.NORTHWEST;
@@ -203,6 +206,8 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
final JButton configureAnnotations = EntryPointsManagerImpl.createConfigureAnnotationsBtn(this);
gc.fill = GridBagConstraints.NONE;
gc.gridy++;
gc.insets.top = 10;
gc.weighty = 1;
add(configureAnnotations, gc);
}
@@ -78,7 +78,7 @@ public class DependencyInspection extends BaseLocalInspectionTool {
}
});
JPanel depPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
JPanel depPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
depPanel.add(editDependencies);
return depPanel;
}
@@ -277,7 +277,7 @@ public class EmptyMethodInspection extends GlobalJavaInspectionTool {
.createSpecialAnnotationsListControl(EXCLUDE_ANNOS, InspectionsBundle.message("special.annotations.annotations.list"));
final JPanel panel = new JPanel(new BorderLayout(2, 2));
panel.add(listPanel, BorderLayout.NORTH);
panel.add(listPanel, BorderLayout.CENTER);
return panel;
}
@@ -151,8 +151,7 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
@Override
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new VerticalFlowLayout());
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5, true, false));
panel.add(new JLabel("Forbid API usages:"));
final JRadioButton projectRb = new JRadioButton("Respecting to project language level settings");
@@ -191,7 +190,7 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
}
});
final JPanel comboPanel = new JPanel(new BorderLayout());
comboPanel.setBorder(BorderFactory.createEmptyBorder(5, 20, 5, 5));
comboPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
comboPanel.add(llCombo, BorderLayout.WEST);
panel.add(comboPanel);
@@ -109,7 +109,8 @@ public class UnusedParametersInspection extends GlobalJavaInspectionTool {
final PsiSearchHelper helper = PsiSearchHelper.SERVICE.getInstance(project);
final AnalysisScope scope = manager.getScope();
manager.iterate(new RefJavaVisitor() {
@Override public void visitElement(RefEntity refEntity) {
@Override
public void visitElement(RefEntity refEntity) {
if (refEntity instanceof RefMethod) {
RefMethod refMethod = (RefMethod)refEntity;
final PsiModifierListOwner element = refMethod.getElement();
@@ -132,15 +133,16 @@ public class UnusedParametersInspection extends GlobalJavaInspectionTool {
final PsiParameter[] parameters = derived[i].getParameterList().getParameters();
if (parameters.length >= idx) continue;
PsiParameter psiParameter = parameters[idx];
ReferencesSearch.search(psiParameter, helper.getUseScope(psiParameter), false).forEach(new PsiReferenceProcessorAdapter(
new PsiReferenceProcessor() {
public boolean execute(PsiReference element) {
refParameter.parameterReferenced(false);
processor.ignoreElement(refParameter);
found[0] = true;
return false;
}
}));
ReferencesSearch.search(psiParameter, helper.getUseScope(psiParameter), false)
.forEach(new PsiReferenceProcessorAdapter(
new PsiReferenceProcessor() {
public boolean execute(PsiReference element) {
refParameter.parameterReferenced(false);
processor.ignoreElement(refParameter);
found[0] = true;
return false;
}
}));
}
}
}
@@ -222,13 +224,9 @@ public class UnusedParametersInspection extends GlobalJavaInspectionTool {
@Override
public JComponent createOptionsPanel() {
final JPanel panel = new JPanel(new GridBagLayout());
final GridBagConstraints gc =
new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 0, 0, 0), 0, 0);
panel.add(EntryPointsManagerImpl.createConfigureAnnotationsBtn(panel), gc);
gc.weightx = 1;
gc.fill = GridBagConstraints.HORIZONTAL;
panel.add(Box.createHorizontalBox(), gc);
panel.add(EntryPointsManagerImpl.createConfigureAnnotationsBtn(panel),
new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0));
return panel;
}
@@ -305,6 +303,5 @@ public class UnusedParametersInspection extends GlobalJavaInspectionTool {
csp.run();
}
}
}
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection.OptionsPanel">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="2">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="394" height="400"/>
@@ -10,7 +10,7 @@
<children>
<component id="b6cc3" class="javax.swing.JCheckBox" binding="myCheckLocalVariablesCheckBox" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="172" height="22"/>
</grid>
</constraints>
@@ -20,7 +20,7 @@
</component>
<component id="6664b" class="javax.swing.JCheckBox" binding="myCheckParametersCheckBox" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="172" height="22"/>
</grid>
</constraints>
@@ -30,7 +30,7 @@
</component>
<component id="c49dc" class="javax.swing.JCheckBox" binding="myCheckMethodsCheckBox" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="172" height="22"/>
</grid>
</constraints>
@@ -40,7 +40,7 @@
</component>
<component id="2077d" class="javax.swing.JCheckBox" binding="myReportUnusedParametersInPublics" default-binding="true">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/InspectionsBundle" key="inspection.unused.symbol.public.method.parameters"/>
@@ -48,7 +48,7 @@
</component>
<grid id="a47a5" binding="myAnnos" layout-manager="GridBagLayout">
<constraints>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -56,7 +56,7 @@
</grid>
<component id="b2b9f" class="javax.swing.JCheckBox" binding="myCheckFieldsCheckBox" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/InspectionsBundle" key="inspection.unused.symbol.check.fields"/>
@@ -64,12 +64,17 @@
</component>
<component id="bcd0d" class="javax.swing.JCheckBox" binding="myCheckClassesCheckBox" default-binding="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/InspectionsBundle" key="inspection.unused.symbol.check.classes"/>
</properties>
</component>
<vspacer id="eb5d4">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
</grid>
</form>
@@ -53,7 +53,6 @@ public class UnusedSymbolLocalInspection extends BaseJavaLocalInspectionTool imp
public boolean REPORT_PARAMETER_FOR_PUBLIC_METHODS = true;
@NotNull
public String getGroupDisplayName() {
return GroupNames.DECLARATION_REDUNDANCY;
@@ -124,13 +123,9 @@ public class UnusedSymbolLocalInspection extends BaseJavaLocalInspectionTool imp
myCheckClassesCheckBox.addActionListener(listener);
myCheckParametersCheckBox.addActionListener(listener);
myReportUnusedParametersInPublics.addActionListener(listener);
final GridBagConstraints gc =
new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 0, 0);
myAnnos.add(EntryPointsManagerImpl.createConfigureAnnotationsBtn(myPanel), gc);
gc.weightx = 1;
gc.fill = GridBagConstraints.HORIZONTAL;
myAnnos.add(Box.createHorizontalBox(), gc);
myAnnos.add(EntryPointsManagerImpl.createConfigureAnnotationsBtn(myPanel),
new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(10, 0, 0, 0), 0, 0));
}
public JComponent getPanel() {
@@ -99,7 +99,7 @@ public class FieldCanBeLocalInspection extends BaseLocalInspectionTool {
.createSpecialAnnotationsListControl(EXCLUDE_ANNOS, InspectionsBundle.message("special.annotations.annotations.list"));
final JPanel panel = new JPanel(new BorderLayout(2, 2));
panel.add(listPanel, BorderLayout.NORTH);
panel.add(listPanel, BorderLayout.CENTER);
return panel;
}
@@ -1,3 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems />
<problems>
<problem>
<file>NoWarnings.java</file>
<line>9</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Constant conditions &amp; exceptions</problem_class>
<description>Condition &lt;code&gt;i == 1&lt;/code&gt; is always &lt;code&gt;true&lt;/code&gt; when reached</description>
</problem>
</problems>
@@ -5,12 +5,17 @@ public class NoWarnings {
int i = 1;
boolean b = true;
while (i < 200) {
if (b && i == 1) { // Warning here: i == 1 is always true, but it is not so.
while (true) {
if (b && i == 1) {
b = false;
} else {
i++;
}
else {
i = g();
}
}
}
public int g() {
return 1;
}
}
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems/>
@@ -0,0 +1,17 @@
public abstract class NoWarnings {
public void f() {
boolean A = false;
boolean B = false;
while (true) {
boolean f = g();
A = A || f;
B = B || !f;
if (A && B) {
return;
}
}
}
public abstract boolean g();
}
@@ -477,7 +477,110 @@ calculate(3, 4)
'''
doTest(before, toPaste2, expected)
}
void testPasteTextThatStartsWithLineFeedAfterNonEmptyLine() {
def before = '''\
class Test {
void test() {
foo(1);
}<caret>
}\
'''
def toPaste1 =
'''
void test() {
foo(1);
}\
'''
def expected1 = '''\
class Test {
void test() {
foo(1);
}
void test() {
foo(1);
}
}\
'''
doTest(before, toPaste1, expected1)
def toPaste2 =
'''
void test() {
foo(1);
}\
'''
def expected2 = '''\
class Test {
void test() {
foo(1);
}
void test() {
foo(1);
}
}\
'''
doTest(before, toPaste2, expected2)
}
void testPasteTextThatStartsWithLineFeedToNewLine() {
def before = '''\
class Test {
void test(int i) {
if (i > 0) {<caret>
}
}
}\
'''
def toPaste1 =
'''
if (i > 2) {
}\
'''
def expected1 = '''\
class Test {
void test(int i) {
if (i > 0) {
if (i > 2) {
}
}
}
}\
'''
doTest(before, toPaste1, expected1)
def toPaste2 =
'''
if (i > 2) {
}\
'''
def expected2 = '''\
class Test {
void test(int i) {
if (i > 0) {
if (i > 2) {
}
}
}
}\
'''
doTest(before, toPaste2, expected2)
}
def testPlainTextPaste() {
def before = '''\
line1
@@ -539,6 +642,41 @@ line to paste #2
'''
doTest(before, toPaste, expected, StdFileTypes.PLAIN_TEXT)
}
def testPlainTextThatStartsByLineFeed() {
def before = '''\
line 1
# item1<caret>
'''
def toPaste1 =
'''
# item2\
'''
def expected1 = '''\
line 1
# item1
# item2
'''
doTest(before, toPaste1, expected1, StdFileTypes.PLAIN_TEXT)
def toPaste2 =
'''
# item2\
'''
def expected2 = '''\
line 1
# item1
# item2
'''
doTest(before, toPaste2, expected2, StdFileTypes.PLAIN_TEXT)
}
def doTest(String before, toPaste, expected, FileType fileType = StdFileTypes.JAVA) {
myFixture.configureByText(fileType, before)
@@ -79,6 +79,7 @@ public class DataFlowInspectionTest extends InspectionTestCase {
public void testconstantExpr() throws Exception { doTest(); }
public void testIDEADEV74518() throws Exception { doTest(); }
public void testIDEADEV74518_2() throws Exception { doTest(); }
public void testNotNullable() throws Exception { doTest15(); }
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13
View File
@@ -0,0 +1,13 @@
Copyright (c) 2008-2011 Google Inc.
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.
+274
View File
@@ -0,0 +1,274 @@
COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)Version 1.1
1. Definitions.
1.1. "Contributor" means each individual or entity that creates or contributes to the creation of Modifications.
1.2. "Contributor Version" means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor.
1.3. "Covered Software" means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof.
1.4. "Executable" means the Covered Software in any form other than Source Code.
1.5. "Initial Developer" means the individual or entity that first makes Original Software available under this License.
1.6. "Larger Work" means a work which combines Covered Software or portions thereof with code not governed by the terms of this License.
1.7. "License" means this document.
1.8. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein.
1.9. "Modifications" means the Source Code and Executable form of any of the following:
A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications;
B. Any new file that contains any part of the Original Software or previous Modification; or
C. Any new file that is contributed or otherwise made available under the terms of this License.
1.10. "Original Software" means the Source Code and Executable form of computer software code that is originally released under this License.
1.11. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor.
1.12. "Source Code" means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code.
1.13. "You" (or "Your") means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
2. License Grants.
2.1. The Initial Developer Grant.
Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof).
(c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License.
(d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices.
2.2. Contributor Grant.
Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license:
(a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and
(b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination).
(c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party.
(d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor.
3. Distribution Obligations.
3.1. Availability of Source Code.
Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange.
3.2. Modifications.
The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License.
3.3. Required Notices.
You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer.
3.4. Application of Additional Terms.
You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients' rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer.
3.5. Distribution of Executable Versions.
You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient's rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer.
3.6. Larger Works.
You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software.
4. Versions of the License.
4.1. New Versions.
Oracle is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License.
4.2. Effect of New Versions.
You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward.
4.3. Modified Versions.
When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License.
5. DISCLAIMER OF WARRANTY.
COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
6. TERMINATION.
6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive.
6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as "Participant") alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant.
6.3. If You assert a patent infringement claim against Participant alleging that the Participant Software directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license.
6.4. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination.
7. LIMITATION OF LIABILITY.
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
8. U.S. GOVERNMENT END USERS.
The Covered Software is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" (as that term is defined at 48 C.F.R. ? 252.227-7014(a)(1)) and "commercial computer software documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License.
9. MISCELLANEOUS.
This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction's conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software.
10. RESPONSIBILITY FOR CLAIMS.
As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
----------
NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL)
The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California.
The GNU General Public License (GPL) Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
One line to give the program's name and a brief idea of what it does.
Copyright (C)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
signature of Ty Coon, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.
"CLASSPATH" EXCEPTION TO THE GPL VERSION 2
Certain source files distributed by Oracle are subject to the following clarification and special exception to the GPL Version 2, but only where Oracle has expressly included in the particular source file's header the words "Oracle designates this particular file as subject to the "Classpath" exception as provided by Oracle in the License file that accompanied this code."
Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License Version 2 cover the whole combination.
As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
+10 -55
View File
@@ -2,65 +2,20 @@
#import <AppKit/AppKit.h>
@interface TerminationListener : NSObject
{
const char *executablePath;
pid_t parentProcessId;
}
int main(int argc, const char *argv[]) {
if (argc != 2) return EXIT_FAILURE;
- (void) relaunch;
unsigned int interval = 500; // check every 0.5 second
unsigned int slept = 0;
while (getppid() != 1) {
usleep(interval * 1000);
@end
@implementation TerminationListener
- (id) initWithExecutablePath:(const char *)execPath parentProcessId:(pid_t)ppid
{
self = [super init];
if (self != nil) {
executablePath = execPath;
parentProcessId = ppid;
// This adds the input source required by the run loop
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(applicationDidTerminate:) name:NSWorkspaceDidTerminateApplicationNotification object:nil];
if (getppid() == 1) {
// ppid is launchd (1) => parent terminated already
[self relaunch];
}
slept += interval;
if (slept > 10 * 1000 /* wait for maximum 10 seconds */) return EXIT_FAILURE;
}
return self;
}
- (void) applicationDidTerminate:(NSNotification *)notification
{
if (parentProcessId == [[[notification userInfo] valueForKey:@"NSApplicationProcessIdentifier"] intValue]) {
// parent just terminated
[self relaunch];
}
}
- (void) relaunch
{
// [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(actualLaunch) userInfo:nil repeats:NO];
// NSDate *future = [NSDate dateWithTimeIntervalSinceNow: 5.0 ];
// [NSThread sleepUntilDate:future];
[[NSWorkspace sharedWorkspace] launchApplication:[NSString stringWithUTF8String:executablePath]];
exit(0);
}
@end
int main (int argc, const char * argv[])
{
if (argc != 3) return EXIT_FAILURE;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[[TerminationListener alloc] initWithExecutablePath:argv[1] parentProcessId:atoi(argv[2])] autorelease];
[[NSApplication sharedApplication] run];
[pool release];
char const *pathToRelaunch = argv[1];
[[NSWorkspace sharedWorkspace] launchApplication:[NSString stringWithUTF8String:pathToRelaunch]];
return EXIT_SUCCESS;
}
@@ -0,0 +1,209 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
3A6C10B4148122790074811C /* relaunch.m in Sources */ = {isa = PBXBuildFile; fileRef = 3A6C10B3148122790074811C /* relaunch.m */; };
3A6C10B7148122940074811C /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A6C10B6148122940074811C /* AppKit.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
CF2F99674C3F98D5739C1B44 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = /usr/share/man/man1/;
dstSubfolderSpec = 0;
files = (
);
runOnlyForDeploymentPostprocessing = 1;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
3A6C10AE148122660074811C /* relaunch */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = relaunch; sourceTree = BUILT_PRODUCTS_DIR; };
3A6C10B3148122790074811C /* relaunch.m */ = {isa = PBXFileReference; fileEncoding = 11; lastKnownFileType = sourcecode.c.objc; path = relaunch.m; sourceTree = "<group>"; };
3A6C10B6148122940074811C /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
CF2F99674C3F98D5739C1B43 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3A6C10B7148122940074811C /* AppKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
CF2F99674C3F98D5739C1B39 = {
isa = PBXGroup;
children = (
3A6C10B3148122790074811C /* relaunch.m */,
CF2F99674C3F98D5739C1B3A /* Products */,
CF2F99674C3F98D5739C1B45 /* Frameworks */,
3A6C10B6148122940074811C /* AppKit.framework */,
);
sourceTree = "<group>";
};
CF2F99674C3F98D5739C1B3A /* Products */ = {
isa = PBXGroup;
children = (
3A6C10AE148122660074811C /* relaunch */,
);
name = Products;
sourceTree = "<group>";
};
CF2F99674C3F98D5739C1B45 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
CF2F99674C3F98D5739C1B3E /* relaunch */ = {
isa = PBXNativeTarget;
buildConfigurationList = CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "relaunch" */;
buildPhases = (
CF2F99674C3F98D5739C1B42 /* Sources */,
CF2F99674C3F98D5739C1B43 /* Frameworks */,
CF2F99674C3F98D5739C1B44 /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = relaunch;
productName = relaunch;
productReference = 3A6C10AE148122660074811C /* relaunch */;
productType = "com.apple.product-type.tool";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
CF2F99674C3F98D5739C1B37 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "relaunch" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = CF2F99674C3F98D5739C1B39;
productRefGroup = CF2F99674C3F98D5739C1B3A /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
CF2F99674C3F98D5739C1B3E /* relaunch */,
);
};
/* End PBXProject section */
/* Begin PBXSourcesBuildPhase section */
CF2F99674C3F98D5739C1B42 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3A6C10B4148122790074811C /* relaunch.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
CF2F99674C3F98D5739C1B3B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_VERSION = 4.0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.4;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx10.4;
};
name = Release;
};
CF2F99674C3F98D5739C1B3C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = 4.0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.4;
ONLY_ACTIVE_ARCH = NO;
SDKROOT = macosx10.4;
};
name = Debug;
};
CF2F99674C3F98D5739C1B40 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
CF2F99674C3F98D5739C1B41 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_PRECOMPILE_PREFIX_HEADER = NO;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
CF2F99674C3F98D5739C1B38 /* Build configuration list for PBXProject "relaunch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CF2F99674C3F98D5739C1B3B /* Release */,
CF2F99674C3F98D5739C1B3C /* Debug */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CF2F99674C3F98D5739C1B3F /* Build configuration list for PBXNativeTarget "relaunch" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CF2F99674C3F98D5739C1B40 /* Release */,
CF2F99674C3F98D5739C1B41 /* Debug */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = CF2F99674C3F98D5739C1B37 /* Project object */;
}
@@ -19,6 +19,7 @@ package com.intellij.idea;
import com.intellij.ide.Bootstrap;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.Restarter;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
@@ -39,12 +40,38 @@ public class Main {
public static void main(final String[] args) {
if (installPatch()) {
boolean restarted = false;
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
restarted = Restarter.restart();
}
catch (Exception ignore) { }
JOptionPane.showMessageDialog(null, "The application cannot start right away since some critical files have been changed, " +
"please restart it manually.");
catch (Restarter.CannotRestartException e) {
// noinspection CallToPrintStackTrace
e.printStackTrace();
}
final int restartCode = Restarter.getRestartCode();
if (!restarted && restartCode == 0) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (Exception ignore) {
}
JOptionPane.showMessageDialog(null,
"The application cannot start right away since some critical files have been changed.\n" +
"Please restart it manually.",
"Update",
JOptionPane.INFORMATION_MESSAGE);
}
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
System.exit(restartCode);
}
});
return;
}
@@ -69,11 +96,11 @@ public class Main {
return false;
}
final String firstArg = args[0];
return forceEnabledHeadlessMode ||
Comparing.strEqual(firstArg, antAppCode) ||
Comparing.strEqual(firstArg, duplocateCode) ||
Comparing.strEqual(firstArg, traverseUI) ||
(firstArg.length() < 20 && firstArg.endsWith("inspect"));
return forceEnabledHeadlessMode ||
Comparing.strEqual(firstArg, antAppCode) ||
Comparing.strEqual(firstArg, duplocateCode) ||
Comparing.strEqual(firstArg, traverseUI) ||
(firstArg.length() < 20 && firstArg.endsWith("inspect"));
}
public static boolean isUITraverser(final String[] args) {
@@ -17,6 +17,7 @@ package com.intellij.codeInspection.ui;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.ui.DocumentAdapter;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import javax.swing.JFormattedTextField;
@@ -47,8 +48,7 @@ public class SingleIntegerFieldOptionsPanel extends JPanel {
final GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
constraints.insets.left = 4;
constraints.insets.top = 4;
constraints.insets.right = UIUtil.DEFAULT_HGAP;
constraints.weightx = 0.0;
constraints.anchor = GridBagConstraints.BASELINE_LEADING;
constraints.fill = GridBagConstraints.NONE;
@@ -57,6 +57,7 @@ public class SingleIntegerFieldOptionsPanel extends JPanel {
constraints.gridy = 0;
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.insets.right = 0;
constraints.anchor = GridBagConstraints.BASELINE_LEADING;
constraints.fill = GridBagConstraints.NONE;
add(valueField, constraints);
@@ -17,6 +17,7 @@ package com.intellij.facet.frameworks;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.containers.hash.HashMap;
import org.jdom.Document;
import org.jdom.Element;
@@ -71,7 +72,10 @@ public abstract class SettingsConnectionService {
final Document document = JDOMUtil.loadDocument(is);
final Element root = document.getRootElement();
for (String s : attributes) {
settings.put(s, root.getAttributeValue(s));
final String attributeValue = root.getAttributeValue(s);
if (StringUtil.isNotEmpty(attributeValue)) {
settings.put(s, attributeValue);
}
}
}
catch (MalformedURLException e) {
@@ -19,6 +19,7 @@ package com.intellij.application.options;
import com.intellij.application.options.editor.EditorOptionsProvider;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.util.IconLoader;
import org.jetbrains.annotations.NotNull;
@@ -26,7 +27,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
public class CodeCompletionOptions extends BaseConfigurable implements SearchableConfigurable, EditorOptionsProvider {
public class CodeCompletionOptions extends BaseConfigurable implements SearchableConfigurable, EditorOptionsProvider, Configurable.NoScroll {
private CodeCompletionPanel myPanel;
public boolean isModified() {
@@ -65,6 +65,9 @@
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
<BorderFactoryClass class="java.lang.String" value="com.intellij.ui.IdeBorderFactory$PlainSmallWithIndent"/>
</clientProperties>
<border type="none" title="Default Indent Options"/>
<children/>
</grid>
@@ -85,8 +85,7 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
JScrollPane scroll = ScrollPaneFactory.createScrollPane(optionsPanel);
scroll.setBorder(null);
scroll.setMinimumSize(new Dimension(optionsPanel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5,
optionsPanel.getPreferredSize().height));
scroll.setMinimumSize(new Dimension(optionsPanel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1));
scroll.setPreferredSize(scroll.getMinimumSize());
myPanel
@@ -3,7 +3,7 @@
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="4" right="0"/>
<constraints>
<xy x="20" y="20" width="1123" height="400"/>
<xy x="20" y="20" width="1283" height="380"/>
</constraints>
<properties/>
<border type="none"/>
@@ -11,7 +11,8 @@
<scrollpane id="bdbf2" class="com.intellij.ui.components.JBScrollPane" binding="myJBScrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="-1" height="40"/>
<minimum-size width="-1" height="50"/>
<preferred-size width="-1" height="50"/>
</grid>
</constraints>
<properties/>
@@ -19,8 +20,8 @@
<color color="-16777216"/>
</border>
<children>
<grid id="3fa8b" layout-manager="GridLayoutManager" row-count="1" column-count="18" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="4" right="0"/>
<grid id="3fa8b" layout-manager="GridLayoutManager" row-count="1" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints/>
<properties/>
<border type="none"/>
@@ -28,7 +29,7 @@
<grid id="93903" binding="myGlobalPanel" layout-manager="GridLayoutManager" row-count="1" column-count="7" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="9" row-span="1" col-span="7" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -92,7 +93,7 @@
<grid id="db159" binding="myProjectPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="2" row-span="1" col-span="7" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -128,7 +129,7 @@
<grid id="e086a" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="16" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
@@ -145,7 +146,7 @@
</grid>
<hspacer id="fd090">
<constraints>
<grid row="0" column="17" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
@@ -52,12 +52,16 @@ public class AutoImportOptionsConfigurable extends CompositeConfigurable<AutoImp
public JComponent createComponent() {
myProvidersPanel.removeAll();
for (AutoImportOptionsProvider provider : getConfigurables()) {
myProvidersPanel.add(provider.createComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0,
for (int i = 0; i < getConfigurables().size(); i++) {
AutoImportOptionsProvider provider = getConfigurables().get(i);
myProvidersPanel.add(provider.createComponent(), new GridBagConstraints(0, i, 1, 1, 0, 0,
GridBagConstraints.NORTH,
GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0,0));
}
myProvidersPanel.add(Box.createVerticalGlue(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 1,
myProvidersPanel.add(Box.createVerticalGlue(), new GridBagConstraints(0, getConfigurables().size(), 1, 1, 0, 1,
GridBagConstraints.NORTH,
GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));
myProvidersPanel.add(Box.createVerticalGlue(), new GridBagConstraints(1, 0, getConfigurables().size() + 1, 1, 1, 0,
GridBagConstraints.NORTH,
GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));
return myPanel;
@@ -34,4 +34,5 @@ public interface CodeCompletionFeatures {
@NonNls String EDITING_COMPLETION_CONTROL_ENTER = "editing.completion.finishByControlEnter";
@NonNls String EDITING_COMPLETION_CONTROL_ARROWS = "editing.completion.cancelByControlArrows";
@NonNls String EDITING_COMPLETION_CHANGE_SORTING = "editing.completion.changeSorting";
}
@@ -356,7 +356,7 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
CharSequence chars = document.getCharsSequence();
int spaceEnd = CharArrayUtil.shiftForward(chars, startOffset, " \t");
int line = document.getLineNumber(startOffset);
if (spaceEnd > endOffset || indentLevel <= 0 || line >= document.getLineCount() - 1) {
if (spaceEnd > endOffset || indentLevel <= 0 || line >= document.getLineCount() - 1 || chars.charAt(spaceEnd) == '\n') {
return;
}
@@ -390,6 +390,14 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
// pasted line 2]
// Indent adjustment string is just the first line indent then.
//
// --- pasted block starts with empty line(s)
// Example:
// old content [
// pasted line 1
// pasted line 2]
// We parse existing indents of the pasted block then, adjust its first non-blank line via formatter and adjust indent
// of subsequent pasted lines in order to preserve old indentation.
//
// --- pasted block is located at the new line and starts with white space symbols.
// Example:
// [ pasted line 1
@@ -457,7 +465,7 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
final int i = CharArrayUtil.shiftBackward(chars, startOffset - 1, " \t");
// Handle situation when pasted block doesn't start new line.
if (i > 0 && chars.charAt(i) != '\n') {
if (chars.charAt(startOffset) != '\n' && i > 0 && chars.charAt(i) != '\n') {
int firstNonWsOffset = CharArrayUtil.shiftForward(chars, firstLineStart, " \t");
if (firstNonWsOffset > firstLineStart) {
CharSequence toInsert = chars.subSequence(firstLineStart, firstNonWsOffset);
@@ -475,11 +483,18 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
}
CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project);
final int j = CharArrayUtil.shiftForward(chars, startOffset, " \t");
codeStyleManager.adjustLineIndent(file, startOffset);
final int j = CharArrayUtil.shiftForward(chars, startOffset, " \t\n");
if (j >= endOffset) {
// Pasted text contains white space/line feed symbols only, do nothing.
return;
}
final int anchorLine = document.getLineNumber(j);
final int anchorLineStart = document.getLineStartOffset(anchorLine);
codeStyleManager.adjustLineIndent(file, j);
// Handle situation when pasted block starts with non-white space symbols.
if (j == startOffset) {
if (anchorLine == firstLine && j == startOffset) {
int indentOffset = CharArrayUtil.shiftForward(chars, firstLineStart, " \t");
if (indentOffset > firstLineStart) {
CharSequence toInsert = chars.subSequence(firstLineStart, indentOffset);
@@ -492,25 +507,32 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
// Handle situation when pasted block starts from white space symbols. Assume that the pasted text started at the line start,
// i.e. correct indentation level is stored at the blocks structure.
final int firstNonWsOffset = CharArrayUtil.shiftForward(chars, firstLineStart, " \t");
final int firstNonWsOffset = CharArrayUtil.shiftForward(chars, anchorLineStart, " \t");
final int diff = firstNonWsOffset - j;
if (diff == 0) {
return;
}
if (diff > 0) {
CharSequence toInsert = chars.subSequence(firstLineStart, startOffset + diff);
for (int line = firstLine + 1; line <= lastLine; line++) {
CharSequence toInsert = chars.subSequence(anchorLineStart, anchorLineStart + diff);
for (int line = anchorLine + 1; line <= lastLine; line++) {
document.insertString(document.getLineStartOffset(line), toInsert);
}
return;
}
if (-diff == startOffset - firstLineStart) {
if (anchorLine == firstLine && -diff == startOffset - firstLineStart) {
return;
}
if (-diff > startOffset - firstLineStart) {
int desiredSymbolsToRemove = -diff - (startOffset - firstLineStart);
for (int line = firstLine + 1; line <= lastLine; line++) {
if (anchorLine != firstLine || -diff > startOffset - firstLineStart) {
final int desiredSymbolsToRemove;
if (anchorLine == firstLine) {
desiredSymbolsToRemove = -diff - (startOffset - firstLineStart);
}
else {
desiredSymbolsToRemove = -diff;
}
for (int line = anchorLine + 1; line <= lastLine; line++) {
int currentLineStart = document.getLineStartOffset(line);
int currentLineIndentOffset = CharArrayUtil.shiftForward(chars, currentLineStart, " \t");
int symbolsToRemove = Math.min(currentLineIndentOffset - currentLineStart, desiredSymbolsToRemove);
@@ -520,8 +542,8 @@ public class PasteHandler extends EditorActionHandler implements EditorTextInser
}
}
else {
CharSequence toInsert = chars.subSequence(firstLineStart, firstLineStart + startOffset - firstLineStart + diff);
for (int line = firstLine + 1; line <= lastLine; line++) {
CharSequence toInsert = chars.subSequence(anchorLineStart, j + diff);
for (int line = anchorLine + 1; line <= lastLine; line++) {
document.insertString(document.getLineStartOffset(line), toInsert);
}
}
@@ -61,6 +61,7 @@ import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.components.JBList;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.plaf.beg.BegPopupMenuBorder;
import com.intellij.ui.popup.AbstractPopup;
import com.intellij.util.Alarm;
import com.intellij.util.CollectConsumer;
import com.intellij.util.ObjectUtils;
@@ -144,6 +145,8 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
setForceShowAsPopup(true);
setCancelOnClickOutside(false);
setResizable(true);
AbstractPopup.suppressMacCornerFor(getComponent());
myProject = project;
myEditor = editor;
@@ -201,6 +204,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
mySortingLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CodeCompletionFeatures.EDITING_COMPLETION_CHANGE_SORTING);
UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY = !UISettings.getInstance().SORT_LOOKUP_ELEMENTS_LEXICOGRAPHICALLY;
updateSorting();
}
@@ -987,6 +987,7 @@ public class TemplateState implements Disposable {
for (TemplateOptionalProcessor optionalProcessor : Extensions.getExtensions(TemplateOptionalProcessor.EP_NAME)) {
optionalProcessor.processText(myProject, myTemplate, myDocument, myTemplateRange, myEditor);
}
PsiDocumentManager.getInstance(myProject).doPostponedOperationsAndUnblockDocument(myDocument);
// for Python, we need to indent the template even if reformatting is enabled, because otherwise indents would be broken
// and reformat wouldn't be able to fix them
if (myTemplate.isToIndent()) {
@@ -1,5 +1,6 @@
package com.intellij.execution.console;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.Messages;
@@ -18,7 +19,7 @@ import java.util.List;
/**
* @author peter
*/
public class ConsoleFoldingConfigurable implements SearchableConfigurable {
public class ConsoleFoldingConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private JPanel myMainComponent;
private MyAddDeleteListPanel myPositivePanel;
private MyAddDeleteListPanel myNegativePanel;
@@ -229,11 +229,11 @@ public class FileTemplateUtil{
try {
Velocity.evaluate(context, stringWriter, "", templateContent);
}
catch (VelocityException e) {
catch (final VelocityException e) {
LOG.error("Error evaluating template:\n"+templateContent,e);
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
Messages.showErrorDialog(IdeBundle.message("error.parsing.file.template"),
Messages.showErrorDialog(IdeBundle.message("error.parsing.file.template", e.getMessage()),
IdeBundle.message("title.velocity.error"));
}
});
@@ -24,10 +24,12 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.IconLoader;
@@ -56,7 +58,7 @@ import java.util.List;
* Time: 12:44:56 PM
*/
public class AllFileTemplatesConfigurable implements SearchableConfigurable {
public class AllFileTemplatesConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.fileTemplates.impl.AllFileTemplatesConfigurable");
private static final String TEMPLATES_TITLE = IdeBundle.message("tab.filetemplates.templates");
@@ -297,26 +299,16 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable {
onEditorChanged();
}
});
myMainPanel = new JPanel(new GridBagLayout()) {
public void doLayout() {
doMainPanelLayout();
}
};
// Layout manager is ignored
myMainPanel.add(myToolBar,
new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
myMainPanel.add(myTabbedPane.getComponent(),
new GridBagConstraints(0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
new Insets(2, 2, 2, 2), 0, 0));
myMainPanel = new JPanel(new BorderLayout());
Splitter splitter = new Splitter();
JPanel leftPanel = new JPanel(new BorderLayout());
leftPanel.add(myToolBar, BorderLayout.NORTH);
leftPanel.add(myTabbedPane.getComponent(), BorderLayout.CENTER);
splitter.setFirstComponent(leftPanel);
myEditorComponent = myEditor.createComponent();
myMainPanel.add(myEditorComponent,
new GridBagConstraints(1, 0, 1, 2, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(2, 2, 2, 2), 0, 0));
myMainPanel.setMinimumSize(new Dimension(400, 300));
myMainPanel.setPreferredSize(new Dimension(700, 500));
splitter.setSecondComponent(myEditorComponent);
myMainPanel.add(splitter, BorderLayout.CENTER);
return myMainPanel;
}
@@ -419,35 +411,6 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable {
return false;
}
private void doMainPanelLayout() {
Dimension toolbarPreferredSize = myToolBar.getPreferredSize();
Dimension mainPanelSize = myMainPanel.getSize();
Dimension scrollPanePreferedSize = myTabbedPane.getComponent().getPreferredSize();
if (mainPanelSize.width < 1 || mainPanelSize.height < 1) {
return;
}
int leftWidth = scrollPanePreferedSize.width;
leftWidth = Math.min(leftWidth, mainPanelSize.width / 5);
leftWidth = Math.max(leftWidth, 300); //to prevent tabs from scrolling
//todo[myakovlev] Calculate tabs preferred size
leftWidth = Math.max(leftWidth, toolbarPreferredSize.width);
int x = 2;
int y = 2;
int width = toolbarPreferredSize.width;
int height = toolbarPreferredSize.height;
myToolBar.setBounds(x, y, width, height);
y += height + 2;
width = leftWidth + 2;
height = Math.max(1, mainPanelSize.height - 2 - y);
myTabbedPane.getComponent().setBounds(x, y, width, height);
x += width + 4;
y = 2;
width = Math.max(1, mainPanelSize.width - 2 - x);
height = Math.max(1, mainPanelSize.height - 2 - y);
myEditorComponent.setBounds(x, y, width, height);
myEditorComponent.revalidate();
}
private void initLists() {
final FileTemplateManager templateManager = FileTemplateManager.getInstance();
@@ -77,7 +77,7 @@ import java.util.ArrayList;
* Time: 12:46:00 PM
*/
public class FileTemplateConfigurable implements Configurable {
public class FileTemplateConfigurable implements Configurable, Configurable.NoScroll {
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.fileTemplates.impl.FileTemplateConfigurable");
@NonNls private static final String CONTENT_TYPE_HTML = "text/html";
@NonNls private static final String EMPTY_HTML = "<html></html>";
@@ -126,7 +126,7 @@ public class FileTemplateConfigurable implements Configurable {
new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE,
new Insets(0, 2, 0, 2), 0, 0));
myTopPanel.add(myExtensionField,
new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
new GridBagConstraints(3, 0, 1, 1, .3, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.HORIZONTAL, new Insets(0, 2, 0, 0), 0, 0));
myExtensionField.setColumns(7);
}
@@ -41,16 +41,7 @@ class NavBarBorder implements Border {
g.setColor(new Color(0, 0, 0, 50));
g.drawLine(x, y + 1, x + width, y + 1);
} else if (NavBarRootPaneExtension.runToolbarExists()) {
g.setColor(new Color(0, 0, 0, 50));
g.drawLine(x, y, x + width, y);
}
if (!UISettings.getInstance().SHOW_MAIN_TOOLBAR && NavBarRootPaneExtension.runToolbarExists()) {
g.drawLine(x + width - 1, y + 1, x + width - 1, y + height - 2);
g.drawLine(x, y + height - 1, x + width - 1, y + height - 1);
}
}
public Insets getBorderInsets(final Component c) {
@@ -77,7 +77,8 @@ public abstract class AbstractNavBarUI implements NavBarUI {
@Override
public void doPaintNavBarItem(Graphics2D g, NavBarItem item, NavBarPanel navbar) {
final boolean floating = navbar.isInFloatingMode();
boolean toolbar = UISettings.getInstance().SHOW_MAIN_TOOLBAR;
Icon icon = item.getIcon();
int w = item.getWidth();
int h = item.getHeight();
@@ -106,7 +107,7 @@ public abstract class AbstractNavBarUI implements NavBarUI {
endShape.lineTo(w, h / 2);
endShape.closePath();
if (bg != null) {
if (bg != null && toolbar) {
g2.setPaint(bg);
g2.fill(shape);
if (!item.isLastElement() || floating) {
@@ -115,17 +116,52 @@ public abstract class AbstractNavBarUI implements NavBarUI {
}
if (selected) {
Path2D.Double focusShape = new Path2D.Double();
if (toolbar || floating) {
focusShape.moveTo(w-getDecorationOffset(), 0);
} else {
focusShape.moveTo(0, 0);
focusShape.lineTo(w - getDecorationOffset(), 0);
}
focusShape.lineTo(w - 1, h / 2);
focusShape.lineTo(w - getDecorationOffset(), h - 1);
if (!toolbar && !floating) {
focusShape.lineTo(0, h - 1);
}
g2.setColor(selection);
if (floating && item.isLastElement()) {
g2.fillRect(0, 0, w, h);
} else {
g2.fill(shape);
g2.setColor(new Color(0, 0, 0, 70));
g2.draw(focusShape);
}
}
if (item.isNextSelected() && navbar.hasFocus()) {
g2.setColor(selection);
g2.fill(endShape);
Path2D.Double endFocusShape = new Path2D.Double();
if (toolbar || floating) {
endFocusShape.moveTo(w - getDecorationOffset(), 0);
} else {
endFocusShape.moveTo(w, 0);
endFocusShape.lineTo(w - getDecorationOffset(), 0);
}
endFocusShape.lineTo(w - 1, h / 2);
endFocusShape.lineTo(w - getDecorationOffset(), h - 1);
if (!toolbar && !floating) {
endFocusShape.lineTo(w, h - 1);
}
g2.setColor(new Color(0, 0, 0, 70));
g2.draw(endFocusShape);
}
final int offset = item.isFirstElement() ? getFirstElementLeftOffset() : 0;
@@ -138,20 +174,50 @@ public abstract class AbstractNavBarUI implements NavBarUI {
int off = getDecorationOffset() - 1;
if (!floating || !item.isLastElement()) {
g2.setColor(new Color(0, 0, 0, 70));
g2.drawLine(0, 0, off, h / 2 - 1);
g2.drawLine(off, h / 2 - 1, 0, h);
}
if (!selected && !floating) {
g2.translate(-1, 0);
g2.setColor(new SameColor(205));
g2.drawLine(0, 0, off, h / 2 - 1);
g2.drawLine(off, h / 2 - 1, 0, h);
if (toolbar || floating) {
if (!selected && (!navbar.hasFocus() | !item.isNextSelected())) {
drawArrow(g2, new Color(0, 0, 0, 70), new SameColor(205), off, h, !selected && !floating, false);
}
} else {
if (!selected && (!navbar.hasFocus() | !item.isNextSelected())) {
drawArrow(g2, new Color(0, 0, 0, 150), new Color(255, 255, 255, 200), off, h, !selected && !floating, true);
}
}
}
g2.dispose();
}
private static void drawArrow(Graphics2D g2d, Color c, Color light, int decorationOffset, int h, boolean highlight, boolean gradient) {
int off = decorationOffset - 1;
g2d.setColor(c);
if (gradient) {
g2d.setPaint(new GradientPaint(0, 0, new Color(c.getRed(), c.getGreen(), c.getBlue(), 10), 0, h / 2, c));
}
g2d.drawLine(0, 0, off, h / 2);
if (gradient) {
g2d.setPaint(new GradientPaint(0, h / 2, c, 0, h, new Color(c.getRed(), c.getGreen(), c.getBlue(), 10)));
}
g2d.drawLine(off, h / 2, 0, h);
if (highlight) {
g2d.translate(-1, 0);
g2d.setColor(light);
if (gradient) {
g2d.setPaint(new GradientPaint(0, 0, new Color(light.getRed(), light.getGreen(), light.getBlue(), 10), 0, h / 2, light));
}
g2d.drawLine(0, 0, off, h / 2);
if (gradient) {
g2d.setPaint(new GradientPaint(0, h / 2, light, 0, h, new Color(light.getRed(), light.getGreen(), light.getBlue(), 10)));
}
g2d.drawLine(off, h / 2, 0, h);
}
}
private int getDecorationOffset() {
return 8;
@@ -187,6 +253,8 @@ public abstract class AbstractNavBarUI implements NavBarUI {
@Override
public void doPaintNavBarPanel(Graphics2D g, Rectangle r, boolean mainToolbarVisible, boolean undocked) {
g.setColor(getBackgroundColor());
g.fillRect(0, 0, r.width, r.height);
if (mainToolbarVisible) {
g.fillRect(0, 0, r.width, r.height);
}
}
}
@@ -20,6 +20,7 @@ import com.intellij.ide.IdeBundle;
import com.intellij.ide.todo.TodoConfiguration;
import com.intellij.ide.todo.TodoFilter;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.DialogWrapper;
@@ -52,7 +53,7 @@ import java.util.List;
/**
* @author Vladimir Kondratyev
*/
public class TodoConfigurable extends BaseConfigurable implements SearchableConfigurable {
public class TodoConfigurable extends BaseConfigurable implements SearchableConfigurable, Configurable.NoScroll {
/*
* UI resources
*/
@@ -373,12 +374,11 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
//
myPanel = new JPanel(new GridBagLayout());
myPanel.add(patternsPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
myPanel.add(patternsPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH,
new Insets(0,0,0,0), 0, 0));
myPanel.add(filtersPanel, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL,
myPanel.add(filtersPanel, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH, GridBagConstraints.BOTH,
new Insets(0,0,0,0), 0, 0));
myPanel.setPreferredSize(new Dimension(Math.max(700, myPanel.getPreferredSize().width), myPanel.getPreferredSize().height));
return myPanel;
}
@@ -53,7 +53,7 @@ import java.util.List;
/**
* @author Eugene Belyaev
*/
public class FileTypeConfigurable extends BaseConfigurable implements SearchableConfigurable {
public class FileTypeConfigurable extends BaseConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private RecognizedFileTypes myRecognizedFileType;
private PatternsPanel myPatterns;
private FileTypePanel myFileTypePanel;
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.openapi.vfs.encoding.FileEncodingConfigurable">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="571" height="400"/>
<xy x="20" y="20" width="1037" height="400"/>
</constraints>
<properties/>
<clientProperties>
@@ -13,7 +13,7 @@
<children>
<component id="e9af6" class="javax.swing.JLabel" binding="myTitleLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="messages/IdeBundle" key="encodings.dialog.caption"/>
@@ -21,7 +21,7 @@
</component>
<scrollpane id="fe0c3" class="com.intellij.ui.components.JBScrollPane" binding="myTreePanel" custom-create="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none">
@@ -95,6 +95,11 @@
</component>
</children>
</grid>
<hspacer id="a4841">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>
@@ -20,6 +20,7 @@ import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.OptionalConfigurable;
import com.intellij.openapi.options.SearchableConfigurable;
@@ -42,7 +43,7 @@ import java.awt.*;
import java.nio.charset.Charset;
import java.util.Map;
public class FileEncodingConfigurable implements SearchableConfigurable, OptionalConfigurable {
public class FileEncodingConfigurable implements SearchableConfigurable, OptionalConfigurable, Configurable.NoScroll {
private static final String SYSTEM_DEFAULT = IdeBundle.message("encoding.name.system.default");
private final Project myProject;
private FileTreeTable myTreeView;
@@ -3,98 +3,108 @@
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="671" height="400"/>
<xy x="20" y="20" width="1033" height="471"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="d67c2" binding="myPanel" layout-manager="CardLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="6012b" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<scrollpane id="64d7f" class="com.intellij.ui.components.JBScrollPane" binding="myJBScrollPane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="-1" height="45"/>
<preferred-size width="-1" height="45"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="a4fd5" class="javax.swing.JComboBox" binding="myProfiles">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<grid id="316ed" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="true" same-size-vertically="false" hgap="5" vgap="-1">
<grid id="6012b" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<constraints/>
<properties/>
<border type="none"/>
<children>
<component id="9715e" class="javax.swing.JButton" binding="myAddButton" default-binding="true">
<component id="a4fd5" class="javax.swing.JComboBox" binding="myProfiles">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<grid id="316ed" layout-manager="GridLayoutManager" row-count="1" column-count="5" same-size-horizontally="true" same-size-vertically="false" hgap="5" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="9715e" class="javax.swing.JButton" binding="myAddButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Add"/>
</properties>
</component>
<component id="95fc" class="javax.swing.JButton" binding="myDeleteButton" default-binding="true">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Delete"/>
</properties>
</component>
<component id="4aa90" class="javax.swing.JButton" binding="myImportButton" default-binding="true">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Import"/>
</properties>
</component>
<component id="f1082" class="javax.swing.JButton" binding="myExportButton" default-binding="true">
<constraints>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Export"/>
</properties>
</component>
<component id="6a3c2" class="javax.swing.JButton" binding="myCopyButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Copy"/>
</properties>
</component>
</children>
</grid>
<component id="3617d" class="javax.swing.JCheckBox" binding="myShareProfileCheckBox">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Add"/>
<text value="&amp;Share profile"/>
</properties>
</component>
<component id="95fc" class="javax.swing.JButton" binding="myDeleteButton" default-binding="true">
<hspacer id="2ef95">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Delete"/>
</properties>
</component>
<component id="4aa90" class="javax.swing.JButton" binding="myImportButton" default-binding="true">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Import"/>
</properties>
</component>
<component id="f1082" class="javax.swing.JButton" binding="myExportButton" default-binding="true">
<constraints>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Export"/>
</properties>
</component>
<component id="6a3c2" class="javax.swing.JButton" binding="myCopyButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Copy"/>
</properties>
</component>
</hspacer>
</children>
</grid>
<component id="3617d" class="javax.swing.JCheckBox" binding="myShareProfileCheckBox">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Share profile"/>
</properties>
</component>
<hspacer id="6f27">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</scrollpane>
</children>
</grid>
</form>
@@ -38,6 +38,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.DialogWrapper;
@@ -50,6 +51,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.profile.Profile;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.util.Alarm;
import com.intellij.util.SystemProperties;
import com.intellij.util.containers.HashMap;
@@ -66,7 +68,8 @@ import java.io.File;
import java.io.IOException;
import java.util.*;
public abstract class InspectionToolsConfigurable extends BaseConfigurable implements ErrorsConfigurable, SearchableConfigurable {
public abstract class InspectionToolsConfigurable extends BaseConfigurable implements ErrorsConfigurable, SearchableConfigurable,
Configurable.NoScroll {
private final CardLayout myLayout = new CardLayout();
private JPanel myPanel;
@@ -83,6 +86,7 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple
private JButton myExportButton;
private JCheckBox myShareProfileCheckBox;
private JButton myCopyButton;
private JBScrollPane myJBScrollPane;
private final ArrayList<String> myDeletedProfiles = new ArrayList<String>();
protected final InspectionProfileManager myProfileManager;
@@ -225,6 +229,8 @@ public abstract class InspectionToolsConfigurable extends BaseConfigurable imple
myProjectProfileManager = projectProfileManager;
myProfileManager = profileManager;
myJBScrollPane.setBorder(null);
}
private void addProfile(InspectionProfileImpl model) {
@@ -60,6 +60,7 @@ import com.intellij.ui.*;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.Alarm;
import com.intellij.util.ArrayUtil;
import com.intellij.util.config.StorageAccessors;
import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.tree.TreeUtil;
@@ -109,9 +110,14 @@ public class SingleInspectionProfilePanel extends JPanel {
private String myInitialProfile;
@NonNls private static final String EMPTY_HTML = "<html><body></body></html>";
private boolean myIsInRestore = false;
@NonNls private static final String VERTICAL_DIVIDER_PROPORTION = "VERTICAL_DIVIDER_PROPORTION";
@NonNls private static final String HORIZONTAL_DIVIDER_PROPORTION = "HORIZONTAL_DIVIDER_PROPORTION";
private final StorageAccessors myProperties = StorageAccessors.createGlobal("SingleInspectionProfilePanel");
private boolean myShareProfile;
private final InspectionProjectProfileManager myProjectProfileManager;
private Splitter myRightSplitter;
private Splitter myMainSplitter;
public SingleInspectionProfilePanel(final String inspectionProfileName, final ModifiableModel profile) {
this(null, inspectionProfileName, profile);
@@ -529,8 +535,8 @@ public class SingleInspectionProfilePanel extends JPanel {
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
TreeUtil.collapseAll(myTree, 1);
final Dimension preferredSize = new Dimension(myTree.getPreferredSize().width + 20, scrollPane.getPreferredSize().height);
scrollPane.setPreferredSize(preferredSize);
scrollPane.setMinimumSize(preferredSize);
//scrollPane.setPreferredSize(preferredSize);
//scrollPane.setMinimumSize(preferredSize);
myTree.addTreeExpansionListener(new TreeExpansionListener() {
@@ -560,6 +566,7 @@ public class SingleInspectionProfilePanel extends JPanel {
myTreeExpander = new DefaultTreeExpander(myTree);
myProfileFilter = new MyFilterComponent();
myProfileFilter.setPreferredSize(new Dimension(100, -1));
return scrollPane;
}
@@ -778,19 +785,19 @@ public class SingleInspectionProfilePanel extends JPanel {
final JPanel withSeverity = new JPanel(new GridBagLayout());
withSeverity.add(new JLabel(InspectionsBundle.message("inspection.severity")),
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 5, 5, 10), 0, 0));
withSeverity.add(chooser, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));
new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, IdeBorderFactory.TITLED_BORDER_INDENT, 10, 10), 0, 0));
withSeverity.add(chooser, new GridBagConstraints(1, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST,
GridBagConstraints.NONE, new Insets(0, 0, 10, 0), 0, 0));
final JComponent comp = descriptor.getState().getAdditionalConfigPanel();
withSeverity.add(comp != null ? comp : new JPanel(),
new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.BOTH, new Insets(0, IdeBorderFactory.TITLED_BORDER_INDENT, 0, 0), 0, 0));
myOptionsPanel.add(withSeverity, BorderLayout.NORTH);
myOptionsPanel.add(withSeverity, BorderLayout.CENTER);
}
myOptionsPanel.validate();
myOptionsPanel.revalidate();
GuiUtils.enableChildren(myOptionsPanel, node.isChecked());
}
else {
@@ -801,8 +808,6 @@ public class SingleInspectionProfilePanel extends JPanel {
private void initOptionsAndDescriptionPanel() {
myOptionsPanel.removeAll();
myOptionsPanel.add(SeparatorFactory.createSeparator("Options", null));
myOptionsPanel.add(new JPanel());
try {
myBrowser.read(new StringReader(EMPTY_HTML), null);
}
@@ -861,6 +866,8 @@ public class SingleInspectionProfilePanel extends JPanel {
if (myInspectionProfilePanel == null) {
return;
}
myProperties.setFloat(VERTICAL_DIVIDER_PROPORTION, myMainSplitter.getProportion());
myProperties.setFloat(HORIZONTAL_DIVIDER_PROPORTION, myRightSplitter.getProportion());
myAlarm.cancelAllRequests();
myProfileFilter.dispose();
if (mySelectedProfile != null) {
@@ -885,13 +892,14 @@ public class SingleInspectionProfilePanel extends JPanel {
true, new Insets(13, 0, 0, 0)));
descriptionPanel.add(ScrollPaneFactory.createScrollPane(myBrowser), BorderLayout.CENTER);
Splitter rightPanel = new Splitter(true);
rightPanel.setFirstComponent(descriptionPanel);
myRightSplitter = new Splitter(true);
myRightSplitter.setFirstComponent(descriptionPanel);
myRightSplitter.setProportion(myProperties.getFloat(HORIZONTAL_DIVIDER_PROPORTION, 0.5f));
myOptionsPanel = new JPanel(new BorderLayout());
initOptionsAndDescriptionPanel();
rightPanel.setSecondComponent(myOptionsPanel);
rightPanel.setHonorComponentsMinimumSize(true);
myRightSplitter.setSecondComponent(myOptionsPanel);
myRightSplitter.setHonorComponentsMinimumSize(true);
final JPanel treePanel = new JPanel(new BorderLayout());
final JScrollPane tree = initTreeScrollPane();
@@ -903,15 +911,14 @@ public class SingleInspectionProfilePanel extends JPanel {
northPanel.add(myProfileFilter, BorderLayout.EAST);
treePanel.add(northPanel, BorderLayout.NORTH);
Splitter splitter = new Splitter(false);
splitter.setShowDividerControls(false);
splitter.setFirstComponent(treePanel);
splitter.setSecondComponent(rightPanel);
splitter.setProportion((float)tree.getPreferredSize().width/getPreferredSize().width);
splitter.setHonorComponentsMinimumSize(true);
myMainSplitter = new Splitter(false);
myMainSplitter.setFirstComponent(treePanel);
myMainSplitter.setSecondComponent(myRightSplitter);
myMainSplitter.setHonorComponentsMinimumSize(false);
myMainSplitter.setProportion(myProperties.getFloat(VERTICAL_DIVIDER_PROPORTION, 0.5f));
final JPanel panel = new JPanel(new BorderLayout());
panel.add(splitter, BorderLayout.CENTER);
panel.add(myMainSplitter, BorderLayout.CENTER);
panel.setBorder(IdeBorderFactory.createEmptyBorder(2, 2, 0, 2));
return panel;
}
@@ -16,6 +16,7 @@
package com.intellij.tools;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.util.IconLoader;
@@ -25,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.IOException;
public class ToolConfigurable implements SearchableConfigurable {
public class ToolConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private static final Icon ourIcon = IconLoader.getIcon("/general/externalTools.png");
private ToolsPanel myPanel;
@@ -131,28 +131,9 @@ public class ToolEditorDialog extends DialogWrapper {
panel.add(myDescriptionField, constr);
// check boxes
JPanel panel0 = new JPanel(new GridBagLayout());
constr = new GridBagConstraints();
constr.gridheight = 2;
panel0.add(getShowInPanel(), constr);
constr = new GridBagConstraints();
constr.gridx = 1;
constr.weightx = 1.0;
constr.anchor = GridBagConstraints.NORTHEAST;
constr.fill = GridBagConstraints.HORIZONTAL;
constr.insets = new Insets(5, 10, 0, 0);
panel0.add(myUseConsoleCheckbox, constr);
constr = new GridBagConstraints();
constr.gridx = 1;
constr.gridy = 1;
constr.weightx = 1.0;
constr.anchor = GridBagConstraints.NORTHEAST;
constr.fill = GridBagConstraints.HORIZONTAL;
constr.insets = new Insets(0, 10, 0, 0);
panel0.add(mySynchronizedAfterRunCheckbox, constr);
// Placed temporarily here, might be moved elsewhere in the future.
panel0.add(myOutputFiltersButton);
JPanel panel0 = new JPanel(new BorderLayout());
panel0.add(getOptionsPanel(), BorderLayout.NORTH);
panel0.add(getShowInPanel(), BorderLayout.SOUTH);
constr = new GridBagConstraints();
constr.gridy = 4;
@@ -162,14 +143,6 @@ public class ToolEditorDialog extends DialogWrapper {
constr.insets = new Insets(5, 0, 0, 0);
panel.add(panel0, constr);
constr = new GridBagConstraints();
constr.gridx = 0;
constr.gridy = 6;
constr.gridwidth = 2;
constr.anchor = GridBagConstraints.WEST;
constr.insets = new Insets(10, 0, 0, 0);
panel.add(Box.createVerticalStrut(10), constr);
// custom panels (put into same place)
constr = new GridBagConstraints();
constr.gridx = 0;
@@ -461,7 +434,7 @@ public class ToolEditorDialog extends DialogWrapper {
}
private JPanel getShowInPanel() {
JPanel panel = new JPanel(new GridLayout(2, 2, 10, 3));
JPanel panel = new JPanel(new GridLayout(1, 4, 10, 0));
panel.setBorder(IdeBorderFactory.createTitledBorder(ToolsBundle.message("tools.menu.group"), false, true, true));
panel.add(myShowInMainMenuCheckbox);
panel.add(myShowInEditorCheckbox);
@@ -470,6 +443,14 @@ public class ToolEditorDialog extends DialogWrapper {
return panel;
}
private JPanel getOptionsPanel() {
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
panel.add(mySynchronizedAfterRunCheckbox);
panel.add(myUseConsoleCheckbox);
panel.add(myOutputFiltersButton);
return panel;
}
private String convertString(String s) {
if (s != null && s.trim().length() == 0) return null;
return s;
@@ -31,7 +31,7 @@ import javax.swing.*;
/**
* @author spleaner
*/
public class FileColorsConfigurable implements SearchableConfigurable {
public class FileColorsConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private final Project myProject;
private FileColorsConfigurablePanel myPanel;
@@ -21,10 +21,13 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.util.CommonProcessors;
import com.intellij.util.Processor;
import com.intellij.util.containers.SLRUCache;
import com.intellij.util.io.*;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.KeyDescriptor;
import com.intellij.util.io.PersistentMap;
import org.jetbrains.annotations.NotNull;
import java.io.*;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -58,8 +61,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu
}
private void initMapAndCache() throws IOException {
final PersistentMap<Key, ValueContainer<Value>> map =
new ValueContainerMap<Key, Value>(myStorageFile, myKeyDescriptor, myDataExternalizer);
final ValueContainerMap<Key, Value> map = new ValueContainerMap<Key, Value>(myStorageFile, myKeyDescriptor, myDataExternalizer);
myCache = new SLRUCache<Key, ChangeTrackingValueContainer<Value>>(myCacheSize, (int)(Math.ceil(myCacheSize * 0.25)) /* 25% from the main cache size*/) {
@Override
@NotNull
@@ -67,7 +69,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu
return new ChangeTrackingValueContainer<Value>(new ChangeTrackingValueContainer.Initializer<Value>() {
@Override
public Object getLock() {
return map;
return map.getDataAccessLock();
}
@Override
@@ -14,11 +14,11 @@ import java.util.Iterator;
* @author Dmitry Avdeev
* Date: 8/10/11
*/
public class ValueContainerMap<Key, Value> extends PersistentHashMap<Key, ValueContainer<Value>> {
class ValueContainerMap<Key, Value> extends PersistentHashMap<Key, ValueContainer<Value>> {
private final ValueContainerExternalizer<Value> myValueContainerExternalizer;
public ValueContainerMap(final File file,
ValueContainerMap(final File file,
KeyDescriptor<Key> keyKeyDescriptor,
DataExternalizer<Value> valueExternalizer) throws IOException {
@@ -26,6 +26,10 @@ public class ValueContainerMap<Key, Value> extends PersistentHashMap<Key, ValueC
myValueContainerExternalizer = (ValueContainerExternalizer<Value>)myValueExternalizer;
}
Object getDataAccessLock() {
return myEnumerator;
}
@Override
protected void doPut(Key key, ValueContainer<Value> container) throws IOException {
synchronized (myEnumerator) {
@@ -10,7 +10,7 @@
<children>
<component id="e9af6" class="javax.swing.JLabel" binding="myLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
@@ -43,7 +44,7 @@ import java.util.List;
/**
* @author peter
*/
public abstract class LanguagePerFileConfigurable<T> implements SearchableConfigurable {
public abstract class LanguagePerFileConfigurable<T> implements SearchableConfigurable, Configurable.NoScroll {
protected final Project myProject;
private final Class<T> myValueClass;
private final PerFileMappings<T> myMappings;
@@ -87,11 +87,11 @@ public class JBOptionButton extends JButton implements MouseMotionListener {
@Override
public void mouseMoved(MouseEvent e) {
final MouseEvent event = SwingUtilities.convertMouseEvent(e.getComponent(), e, this);
final boolean insideMoreRec = myMoreRecMouse.contains(event.getPoint());
if (!myPopupIsShowing && insideMoreRec) {
final MouseEvent event = SwingUtilities.convertMouseEvent(e.getComponent(), e, getParent());
final boolean insideRec = getBounds().contains(event.getPoint());
if (!myPopupIsShowing && insideRec) {
showPopup(null);
} else if (myPopupIsShowing && !insideMoreRec) {
} else if (myPopupIsShowing && !insideRec) {
final Component over = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY());
if (over != null && myPopup.isShowing()) {
final Rectangle rec = new Rectangle(myPopup.getLocationOnScreen(), myPopup.getSize());
@@ -191,7 +191,7 @@ public class JBOptionButton extends JButton implements MouseMotionListener {
}
});
myPopup.addPopupMenuListener(listener.get());
myPopup.show(this, myMoreRec.x, getY() + getHeight() - getInsets().bottom);
myPopup.show(this, 0, getY() + getHeight());
SwingUtilities.invokeLater(new Runnable() {
@Override
@@ -24,6 +24,7 @@ import com.intellij.openapi.wm.impl.content.GraphicsConfig;
import com.intellij.ui.ComponentWithExpandableItems;
import com.intellij.ui.ExpandableItemsHandler;
import com.intellij.ui.ExpandableItemsHandlerFactory;
import com.intellij.ui.LoadingNode;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.ui.AsyncProcessIcon;
import com.intellij.util.ui.ComponentWithEmptyText;
@@ -106,7 +107,19 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
TreeModel model = getModel();
if (model == null) return true;
if (model.getRoot() == null) return true;
return !isRootVisible() && model.getChildCount(model.getRoot()) == 0;
if (!isRootVisible()) {
final int childCount = model.getChildCount(model.getRoot());
if (childCount == 0) {
return true;
}
if (childCount == 1) {
final Object node = model.getChild(model.getRoot(), 0);
if (node instanceof LoadingNode) {
return true;
}
}
}
return false;
}
protected boolean isCustomUI() {
@@ -15,6 +15,7 @@
*/
package com.intellij.util.net;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.util.Comparing;
import org.jetbrains.annotations.Nls;
@@ -33,7 +34,7 @@ import java.awt.event.ActionListener;
* Time: 3:52:47 PM
* To change this template use Options | File Templates.
*/
public class HTTPProxySettingsPanel implements SearchableConfigurable {
public class HTTPProxySettingsPanel implements SearchableConfigurable, Configurable.NoScroll {
private JPanel myMainPanel;
private JTextField myProxyLoginTextField;
@@ -16,6 +16,7 @@
package com.intellij.application.options.pathMacros;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
@@ -31,7 +32,7 @@ import javax.swing.*;
/**
* @author dsl
*/
public class PathMacroConfigurable implements SearchableConfigurable {
public class PathMacroConfigurable implements SearchableConfigurable, Configurable.NoScroll {
public static final Icon ICON = IconLoader.getIcon("/general/pathVariables.png");
@NonNls
public static final String HELP_ID = "preferences.pathVariables";
@@ -36,7 +36,7 @@ import java.util.List;
* <p>
* A new instance of the specified class will be created each time then the Settings dialog is opened
*/
public class GeneralSettingsConfigurable extends CompositeConfigurable<SearchableConfigurable> implements SearchableConfigurable {
public class GeneralSettingsConfigurable extends CompositeConfigurable<SearchableConfigurable> implements SearchableConfigurable, Configurable.NoScroll {
private static ExtensionPointName<GeneralSettingsConfigurableEP> EP_NAME = ExtensionPointName.create("com.intellij.generalOptionsProvider");
private MyComponent myComponent;
@@ -1,6 +1,7 @@
package com.intellij.ide.passwordSafe.config;
import com.intellij.ide.passwordSafe.PasswordSafe;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import org.jetbrains.annotations.Nls;
@@ -11,7 +12,7 @@ import javax.swing.*;
/**
* A configurable for password safe
*/
public class PasswordSafeConfigurable implements SearchableConfigurable {
public class PasswordSafeConfigurable implements SearchableConfigurable, Configurable.NoScroll {
/**
* The settings for the password safe
*/
@@ -1,17 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.passwordSafe.config.PasswordSafeOptionsPanel">
<grid id="27dc6" binding="myRoot" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myRoot" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="625" height="179"/>
<xy x="20" y="20" width="445" height="183"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="62956" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<hspacer id="f4ecf">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="9d0fb" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="97bd4" class="javax.swing.JButton" binding="myResetMasterPasswordButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Reset Master Password"/>
<toolTipText value="Reset or specify a password for the password database"/>
</properties>
</component>
<hspacer id="a66d3">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="b7651" class="javax.swing.JButton" binding="myChangeMasterPasswordButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Change Master Password"/>
<toolTipText value="Change master password for the password database."/>
</properties>
</component>
</children>
</grid>
<grid id="62956" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<clientProperties>
@@ -19,74 +57,41 @@
</clientProperties>
<border type="etched" title="Remembering passwords"/>
<children>
<grid id="9d0fb" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<component id="496c6" class="javax.swing.JRadioButton" binding="myDoNotRememberPasswordsRadioButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="b7651" class="javax.swing.JButton" binding="myChangeMasterPasswordButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Change Master Password"/>
<toolTipText value="Change master password for the password database."/>
</properties>
</component>
<component id="97bd4" class="javax.swing.JButton" binding="myResetMasterPasswordButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="&amp;Reset Master Password"/>
<toolTipText value="Reset or specify a password for the password database"/>
</properties>
</component>
</children>
</grid>
<grid id="a29e3" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<properties>
<text value="Do &amp;not remember passwords"/>
<toolTipText value="Password asked from user each time they are needed."/>
</properties>
</component>
<component id="286da" class="javax.swing.JRadioButton" binding="myRememberPasswordsUntilClosingRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="496c6" class="javax.swing.JRadioButton" binding="myDoNotRememberPasswordsRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Do &amp;not remember passwords"/>
<toolTipText value="Password asked from user each time they are needed."/>
</properties>
</component>
<component id="286da" class="javax.swing.JRadioButton" binding="myRememberPasswordsUntilClosingRadioButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Remember passwords &amp;until closing of the application"/>
<toolTipText value="The passwords are stored only in the memory. They will be forgotten when IDEA session terminates."/>
</properties>
</component>
<component id="4e7bb" class="javax.swing.JRadioButton" binding="myRememberOnDiskProtectedRadioButton" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Remember on &amp;disk (protected with master password)"/>
<toolTipText value="The passwords are saved on disk and after restart only master password will be asked."/>
</properties>
</component>
</children>
</grid>
<properties>
<text value="Remember passwords &amp;until closing of the application"/>
<toolTipText value="The passwords are stored only in the memory. They will be forgotten when IDEA session terminates."/>
</properties>
</component>
<component id="4e7bb" class="javax.swing.JRadioButton" binding="myRememberOnDiskProtectedRadioButton" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Remember on &amp;disk (protected with master password)"/>
<toolTipText value="The passwords are saved on disk and after restart only master password will be asked."/>
</properties>
</component>
</children>
</grid>
<vspacer id="57a63">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
</grid>
<buttonGroups>
@@ -60,7 +60,7 @@ public class AvailablePluginsManagerMain extends PluginManagerMain {
}
}
});
myActionsPanel.add(manageRepositoriesBtn);
myActionsPanel.add(manageRepositoriesBtn, BorderLayout.EAST);
final JButton httpProxySettingsButton = new JButton(IdeBundle.message("button.http.proxy.settings"));
httpProxySettingsButton.addActionListener(new ActionListener() {
@@ -73,7 +73,7 @@ public class AvailablePluginsManagerMain extends PluginManagerMain {
}
}
});
myActionsPanel.add(httpProxySettingsButton, BorderLayout.NORTH);
myActionsPanel.add(httpProxySettingsButton, BorderLayout.WEST);
}
@Override
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.Messages;
@@ -41,7 +42,7 @@ import java.util.List;
* Time: 9:30:44 PM
* To change this template use Options | File Templates.
*/
public class PluginManagerConfigurable extends BaseConfigurable implements SearchableConfigurable {
public class PluginManagerConfigurable extends BaseConfigurable implements SearchableConfigurable, Configurable.NoScroll {
@NonNls private static final String POSTPONE = "&Postpone";
public boolean EXPANDED = false;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.plugins.PluginManagerMain">
<grid id="a6e0d" binding="main" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="a6e0d" binding="main" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="49" y="40" width="589" height="540"/>
@@ -10,15 +10,40 @@
</properties>
<border type="none"/>
<children>
<grid id="496e3" layout-manager="BorderLayout" hgap="0" vgap="0">
<hspacer id="f3d0f">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="ae7cb" binding="myActionsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="64782" binding="myToolbarPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="6373a" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<splitpane id="70cdc">
<constraints border-constraint="Center"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<continuousLayout value="true"/>
<oneTouchExpandable value="false"/>
@@ -26,7 +51,7 @@
<border type="empty"/>
<children>
<grid id="7d113" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="6" left="0" bottom="0" right="0"/>
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<splitpane position="right"/>
</constraints>
@@ -65,32 +90,12 @@
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="64745" binding="myToolbarPanel" layout-manager="GridBagLayout">
<constraints border-constraint="North"/>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
<children/>
</grid>
</children>
</splitpane>
</children>
</grid>
<hspacer id="f3d0f">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="ae7cb" binding="myActionsPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
</children>
</grid>
</form>
@@ -27,6 +27,7 @@ import com.intellij.openapi.actionSystem.ActionToolbar;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.ui.Messages;
@@ -120,17 +121,8 @@ public abstract class PluginManagerMain implements Disposable {
myToolbarPanel.setLayout(new BorderLayout());
myActionToolbar = ActionManager.getInstance().createActionToolbar("PluginManaer", getActionGroup(true), true);
final JComponent component = myActionToolbar.getComponent();
component.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
JPanel panel = new JPanel(new BorderLayout()) {
@Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
};
panel.add(component, BorderLayout.CENTER);
myToolbarPanel.add(panel, BorderLayout.WEST);
myFilter.setMinimumSize(new Dimension(150, -1));
myToolbarPanel.add(myFilter, BorderLayout.CENTER);
myToolbarPanel.add(component, BorderLayout.WEST);
myToolbarPanel.add(myFilter, BorderLayout.EAST);
}
protected abstract JScrollPane createTable();
@@ -17,6 +17,7 @@ package com.intellij.ide.ui.customization;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.util.IconLoader;
@@ -29,7 +30,7 @@ import javax.swing.*;
* User: anna
* Date: Mar 17, 2005
*/
public class CustomizationConfigurable extends BaseConfigurable implements SearchableConfigurable{
public class CustomizationConfigurable extends BaseConfigurable implements SearchableConfigurable, Configurable.NoScroll {
private CustomizableActionsPanel myPanel;
public JComponent createComponent() {
@@ -1,23 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.internal.statistic.configurable.StatisticsConfigurationComponent">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="648" height="223"/>
<xy x="20" y="20" width="335" height="259"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="9c047" class="javax.swing.JLabel" binding="myTitle">
<vspacer id="4250b">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font/>
<text value="Help improve our products by sending anonymous usage statistics to JetBrains"/>
</properties>
</component>
<grid id="2f6db" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
</vspacer>
<grid id="ef0a7" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -25,78 +21,91 @@
<properties/>
<border type="none"/>
<children>
<component id="6149c" class="javax.swing.JCheckBox" binding="myAllowToSendUsagesCheckBox" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Allow to send usages statistics to JetBrains"/>
</properties>
</component>
<hspacer id="c3386">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="d4bdc" binding="myRadioButtonPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="2f6db" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="2" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c628d" class="javax.swing.JRadioButton" binding="myDailyRadioButton" default-binding="true">
<component id="6149c" class="javax.swing.JCheckBox" binding="myAllowToSendUsagesCheckBox" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Daily"/>
</properties>
</component>
<component id="1f52" class="javax.swing.JRadioButton" binding="myWeeklyRadioButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Weekly"/>
<text value="Allow to send usages statistics to JetBrains"/>
</properties>
</component>
<component id="181ac" class="javax.swing.JRadioButton" binding="myMonthlyRadioButton" default-binding="true">
<grid id="d4bdc" binding="myRadioButtonPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Monthly"/>
</properties>
<properties/>
<border type="none"/>
<children>
<component id="c628d" class="javax.swing.JRadioButton" binding="myDailyRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Daily"/>
</properties>
</component>
<component id="1f52" class="javax.swing.JRadioButton" binding="myWeeklyRadioButton" default-binding="true">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Weekly"/>
</properties>
</component>
<component id="181ac" class="javax.swing.JRadioButton" binding="myMonthlyRadioButton" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Monthly"/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
<grid id="edf0a" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="30" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="67819" class="javax.swing.JLabel" binding="myLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</children>
</grid>
<vspacer id="4250b">
<component id="9c047" class="javax.swing.JLabel" binding="myTitle">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<grid id="edf0a" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="30" left="0" bottom="0" right="0"/>
<properties>
<text value="&lt;html&gt;Help improve our products by sending anonymous usage statistics to JetBrains&lt;/html&gt;"/>
</properties>
</component>
<hspacer id="244b1">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="67819" class="javax.swing.JLabel" binding="myLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
</children>
</grid>
</hspacer>
</children>
</grid>
<buttonGroups>
@@ -29,7 +29,7 @@ import javax.swing.*;
/**
* @author spleaner
*/
public class NotificationsConfigurable implements Configurable, SearchableConfigurable, OptionalConfigurable {
public class NotificationsConfigurable implements Configurable, SearchableConfigurable, OptionalConfigurable, Configurable.NoScroll {
public static final String DISPLAY_NAME = "Notifications";
private NotificationsConfigurablePanel myComponent;
@@ -236,6 +236,7 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
actionManager.fireBeforeActionPerformed(action, myContext, event);
Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(event.getDataContext());
if (component != null && !isInTree(component)) {
typeahead.setDone();
return;
}
@@ -258,6 +259,8 @@ public class ActionMenuItem extends JCheckBoxMenuItem {
action.actionPerformed(event);
actionManager.queueActionPerformedEvent(action, myContext, event);
} else {
typeahead.setDone();
}
}
});
@@ -1178,8 +1178,14 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
setBorder(new EmptyBorder(0, 0, 0, 0));
setOpaque(false);
} else {
if (isInsideNavBar()) {
setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
}
else {
setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
}
setMinimumButtonSize(DEFAULT_MINIMUM_BUTTON_SIZE);
setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
setOpaque(true);
setLayoutPolicy(AUTO_LAYOUT_POLICY);
}
@@ -93,7 +93,7 @@
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="10" height="0"/>
<preferred-size width="20" height="0"/>
</grid>
</constraints>
<properties/>
@@ -59,6 +59,7 @@ import com.intellij.ui.Splash;
import com.intellij.util.Consumer;
import com.intellij.util.EventDispatcher;
import com.intellij.util.ReflectionCache;
import com.intellij.util.Restarter;
import com.intellij.util.concurrency.ReentrantWriterPreferenceReadWriteLock;
import com.intellij.util.containers.Stack;
import com.intellij.util.io.storage.HeavyProcessLatch;
@@ -143,6 +144,9 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
}
}
};
if (ApplicationInfoImpl.getShadowInstance().isEAP() && i > 10) {
LOG.info("Not enough pooled threads; creating one at:", new Throwable());
}
thread.setPriority(Thread.NORM_PRIORITY - 1);
return thread;
}
@@ -243,13 +247,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
});
}
final String s = System.getProperty("jb.restart.code");
if (s != null) {
try {
myRestartCode = Integer.parseInt(s);
} catch (NumberFormatException ignore) {
}
}
myRestartCode = Restarter.getRestartCode();
registerFont("/fonts/Inconsolata.ttf");
}
@@ -1294,23 +1292,23 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
}
public boolean isRestartCapable() {
return SystemInfo.isWindows || SystemInfo.isMacOSSnowLeopard || myRestartCode > 0;
return Restarter.isSupported() || myRestartCode > 0;
}
public void restart() {
if (SystemInfo.isWindows) {
Win32Restarter.restart();
boolean restarted = false;
try {
restarted = Restarter.restart();
}
else if (SystemInfo.isMacOSSnowLeopard) {
MacRestarter.restart();
catch (Restarter.CannotRestartException e) {
LOG.warn(e);
}
else if (myRestartCode > 0) {
if (!restarted) {
myExitCode = myRestartCode;
exit(true);
}
else {
exit(true);
}
exit(true);
}
public boolean isSaving() {
@@ -1,71 +0,0 @@
/*
* Copyright 2000-2010 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.openapi.application.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.ui.mac.foundation.Foundation;
import com.intellij.ui.mac.foundation.ID;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
/**
* User: spLeaner
*/
public class MacRestarter {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.impl.MacRestarter");
private MacRestarter() {
}
@SuppressWarnings({"RedundantArrayCreation"})
public static void restart() {
final ID autoReleasePool = Foundation.invoke("NSAutoreleasePool", "new");
final ID app = Foundation.invoke("NSRunningApplication", "currentApplication");
final ID executableURL = Foundation.invoke(app, Foundation.createSelector("executableURL"));
final ID stringURL = Foundation.invoke(executableURL, Foundation.createSelector("absoluteString"));
try {
final String executablePath = Foundation.toStringViaUTF8(stringURL);
final URL url = new URL(executablePath);
final String path = url.getPath().replace("%20", " ");
if (path.contains(".app")) {
final int appIndex = path.indexOf(".app");
final String appPath = path.substring(0, appIndex + 4);
final String relaunchPath = path.substring(0, path.lastIndexOf('/')) + "/../../bin/relaunch";
if (new File(relaunchPath).exists()) {
final long processId = Foundation.invoke(app, Foundation.createSelector("processIdentifier")).longValue();
final ID args = Foundation.invoke(Foundation.getClass("NSArray"), Foundation.createSelector("arrayWithObjects:"),
new Object[]{Foundation.nsString(appPath), Foundation.nsString(String.valueOf(processId))});
Foundation.invoke(Foundation.getClass("NSTask"), Foundation.createSelector("launchedTaskWithLaunchPath:arguments:"),
Foundation.nsString(relaunchPath), args);
}
}
}
catch (MalformedURLException e) {
LOG.error(e);
}
finally {
Foundation.invoke(autoReleasePool, Foundation.createSelector("release"));
((ApplicationEx)ApplicationManager.getApplication()).exit(true);
}
}
}
@@ -1,70 +0,0 @@
/*
* Copyright 2000-2009 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.openapi.application.impl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.ui.Messages;
import com.sun.jna.Native;
import com.sun.jna.WString;
import com.sun.jna.win32.StdCallLibrary;
import java.io.File;
import java.io.IOException;
/**
* @author yole
*/
public class Win32Restarter {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.application.impl.Win32Restarter");
private Win32Restarter() {
}
public static void restart() {
Kernel32 kernel32 = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
WString cline = kernel32.GetCommandLineW();
int pid = kernel32.GetCurrentProcessId();
try {
String command = "restarter " + Integer.toString(pid) + " " + cline;
LOG.info("Restarter command: " + command);
Runtime.getRuntime().exec(command, null, new File(PathManager.getBinPath()));
}
catch (IOException ex) {
Messages.showMessageDialog("Restart failed: " + ex.getMessage(), "Restart", Messages.getErrorIcon());
return;
}
// Since the process ID is passed through the command line, we want to make sure that we don't exit before the "restarter"
// process has a chance to open the handle to our process, and that it doesn't wait for the termination of an unrelated
// process which happened to have the same process ID.
try {
Thread.sleep(500);
}
catch (InterruptedException e1) {
// ignore
}
((ApplicationEx)ApplicationManager.getApplication()).exit(true);
}
private interface Kernel32 extends StdCallLibrary {
WString GetCommandLineW();
int GetCurrentProcessId();
}
}

Some files were not shown because too many files have changed in this diff Show More