Merge commit 'origin/master'

This commit is contained in:
Sascha Weinreuter
2011-12-14 17:50:01 +01:00
66 changed files with 1074 additions and 438 deletions
+216
View File
@@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<option name="JAVA_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="JSP_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="XML_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
<option name="LABEL_INDENT_ABSOLUTE" value="false" />
<option name="USE_RELATIVE_INDENTS" value="false" />
</value>
</option>
<option name="FIELD_NAME_PREFIX" value="my" />
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
<option name="RIGHT_MARGIN" value="140" />
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<ADDITIONAL_INDENT_OPTIONS fileType="feature">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="gsp">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="haml">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="html">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="jsp">
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="rb">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sass">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="sql">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<ADDITIONAL_INDENT_OPTIONS fileType="yml">
<option name="INDENT_SIZE" value="2" />
</ADDITIONAL_INDENT_OPTIONS>
<codeStyleSettings language="Groovy">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="LINE_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="BLOCK_COMMENT_AT_FIRST_COLUMN" value="false" />
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="ELSE_ON_NEW_LINE" value="true" />
<option name="WHILE_ON_NEW_LINE" value="true" />
<option name="CATCH_ON_NEW_LINE" value="true" />
<option name="FINALLY_ON_NEW_LINE" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_THROWS_LIST" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="SPACE_AFTER_TYPE_CAST" value="false" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_WRAP" value="5" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="5" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_WRAP" value="5" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="5" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="IF_BRACE_FORCE" value="1" />
<option name="DOWHILE_BRACE_FORCE" value="1" />
<option name="WHILE_BRACE_FORCE" value="1" />
<option name="FOR_BRACE_FORCE" value="1" />
<option name="FIELD_ANNOTATION_WRAP" value="0" />
<option name="PARENT_SETTINGS_INSTALLED" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="8" />
</indentOptions>
</codeStyleSettings>
</value>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
</project>
@@ -38,14 +38,14 @@ import java.beans.PropertyChangeListener;
*
* @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
*/
public class ImageEditorImpl implements ImageEditor {
class ImageEditorImpl implements ImageEditor {
private final PropertyChangeListener optionsChangeListener = new OptionsChangeListener();
private final Project project;
private final ImageContentProvider contentProvider;
private final ImageEditorUI editorUI;
private boolean disposed;
public ImageEditorImpl(@NotNull Project project, @NotNull final ImageContentProvider contentProvider) {
ImageEditorImpl(@NotNull Project project, @NotNull final ImageContentProvider contentProvider) {
this.project = project;
this.contentProvider = contentProvider;
@@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull;
*
* @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
*/
final class ImageFileEditorProvider implements FileEditorProvider, DumbAware {
public final class ImageFileEditorProvider implements FileEditorProvider, DumbAware {
@NonNls private static final String EDITOR_TYPE_ID = "images";
private final ImageFileTypeManager typeManager;
@@ -45,7 +45,11 @@ final class ImageFileEditorProvider implements FileEditorProvider, DumbAware {
@NotNull
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
ImageContentProvider contentProvider = new VirtualFileImageContentProvider(file);
return createImageEditor(project, new VirtualFileImageContentProvider(file));
}
@NotNull
public static FileEditor createImageEditor(@NotNull Project project, @NotNull ImageContentProvider contentProvider) {
ImageFileEditorImpl editor = new ImageFileEditorImpl(project, contentProvider);
Disposer.register(editor, contentProvider);
return editor;
@@ -135,7 +135,7 @@ public class JavaExecutionUtil {
@Nullable
public static PsiClass findMainClass(final Module module, final String mainClassName) {
return findMainClass(module.getProject(), mainClassName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
return findMainClass(module.getProject(), mainClassName, module.getModuleRuntimeScope(true));
}
@Nullable
@@ -53,8 +53,7 @@ public class JavaRunConfigurationModule extends RunConfigurationModule {
final Module module = getModule();
final GlobalSearchScope scope;
if (module != null) {
scope = myClassesInLibraries ? GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module)
: GlobalSearchScope.moduleWithDependenciesScope(module);
scope = myClassesInLibraries ? module.getModuleRuntimeScope(true) : GlobalSearchScope.moduleWithDependenciesScope(module);
}
else {
scope = myClassesInLibraries ? GlobalSearchScope.allScope(getProject()) : GlobalSearchScope.projectScope(getProject());
@@ -29,6 +29,7 @@ import com.intellij.openapi.roots.ModifiableModelsProvider;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import com.intellij.openapi.util.Disposer;
import com.intellij.ui.GuiUtils;
import com.intellij.util.ui.EmptyIcon;
import org.jetbrains.annotations.NotNull;
@@ -125,6 +126,7 @@ public class OldFrameworkSupportProviderWrapper extends FrameworkSupportInModule
private final FrameworkLibraryVersionFilter myVersionFilter;
public FrameworkSupportConfigurableWrapper(FrameworkSupportConfigurable configurable) {
Disposer.register(this, configurable);
myConfigurable = configurable;
if (configurable instanceof FrameworkSupportWithLibrary) {
myVersionFilter = FrameworkLibraryVersionFilter.ALL;
@@ -74,6 +74,11 @@ public class JavaWithRunnableSurrounder extends JavaStatementsSurrounder{
editor.getCaretModel().moveToOffset(textOffset);
editor.getSelectionModel().removeSelection();
new VariableInplaceRenamer(variable, editor){
@Override
protected boolean shouldSelectAll() {
return true;
}
@Override
protected void moveOffsetAfter(boolean success) {
super.moveOffsetAfter(success);
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.javadoc.JavadocGenerationPanel">
<grid id="a2c87" binding="myPanel" layout-manager="GridLayoutManager" row-count="7" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<margin top="10" left="5" bottom="0" right="5"/>
<grid id="a2c87" binding="myPanel" layout-manager="GridLayoutManager" row-count="8" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="7">
<margin top="2" left="5" bottom="0" right="5"/>
<constraints>
<xy x="47" y="80" width="511" height="410"/>
<xy x="47" y="80" width="511" height="440"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="34b10" class="javax.swing.JLabel">
<constraints>
<grid row="3" 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="4" 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>
<labelFor value="eefb8"/>
@@ -19,7 +19,7 @@
</component>
<component id="eefb8" class="javax.swing.JTextField" binding="myOtherOptionsField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@@ -28,7 +28,7 @@
<grid id="35953" layout-manager="GridLayoutManager" row-count="1" column-count="3" 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="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="2" 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/>
<border type="none"/>
@@ -172,7 +172,7 @@
</grid>
<component id="7c67a" class="javax.swing.JLabel">
<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="1" 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>
<labelFor value="61630"/>
@@ -181,7 +181,7 @@
</component>
<component id="61630" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myTfOutputDir">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@@ -189,7 +189,7 @@
</component>
<component id="d6470" class="javax.swing.JLabel">
<constraints>
<grid row="4" 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="5" 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>
<labelFor value="c592b"/>
@@ -198,7 +198,7 @@
</component>
<component id="c592b" class="javax.swing.JTextField" binding="myHeapSizeField">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
@@ -208,7 +208,7 @@
</component>
<component id="61bae" class="javax.swing.JCheckBox" binding="myOpenInBrowserCheckBox">
<constraints>
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="6" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<borderPaintedFlat value="false"/>
@@ -221,12 +221,12 @@
</component>
<vspacer id="b3b4c">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="b7872" class="javax.swing.JLabel">
<constraints>
<grid row="2" 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="3" 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>
<labelFor value="3b6ec"/>
@@ -235,12 +235,21 @@
</component>
<component id="3b6ec" class="javax.swing.JTextField" binding="myLocaleTextField">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="fef9d" class="javax.swing.JCheckBox" binding="myIncludeLibraryCb">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<margin top="0" left="8" bottom="10" right="3"/>
<text value="Include jdk and library sources in -sourcepath"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -50,6 +50,7 @@ public final class JavadocConfigurable implements Configurable {
configuration.OPTION_DOCUMENT_TAG_VERSION = myPanel.myTagVersion.isSelected();
configuration.OPTION_DOCUMENT_TAG_DEPRECATED = myPanel.myTagDeprecated.isSelected();
configuration.OPTION_DEPRECATED_LIST = myPanel.myDeprecatedList.isSelected();
configuration.OPTION_INCLUDE_LIBS = myPanel.myIncludeLibraryCb.isSelected();
}
public void loadFrom(JavadocConfiguration configuration) {
@@ -71,6 +72,8 @@ public final class JavadocConfigurable implements Configurable {
myPanel.mySeparateIndex.setEnabled(myPanel.myIndex.isSelected());
myPanel.myDeprecatedList.setEnabled(myPanel.myTagDeprecated.isSelected());
myPanel.myIncludeLibraryCb.setSelected(configuration.OPTION_INCLUDE_LIBS);
}
public boolean isModified() {
@@ -91,6 +94,7 @@ public final class JavadocConfigurable implements Configurable {
isModified |= myPanel.myTagVersion.isSelected() != configuration.OPTION_DOCUMENT_TAG_VERSION;
isModified |= myPanel.myTagDeprecated.isSelected() != configuration.OPTION_DOCUMENT_TAG_DEPRECATED;
isModified |= myPanel.myDeprecatedList.isSelected() != configuration.OPTION_DEPRECATED_LIST;
isModified |= myPanel.myIncludeLibraryCb.isSelected() != configuration.OPTION_INCLUDE_LIBS;
return isModified;
}
@@ -83,6 +83,7 @@ public class JavadocConfiguration implements ModuleRunProfile, JDOMExternalizabl
private final Project myProject;
private AnalysisScope myGenerationScope;
private static final Logger LOGGER = Logger.getInstance("#" + JavadocConfiguration.class.getName());
public boolean OPTION_INCLUDE_LIBS = false;
public void setGenerationScope(AnalysisScope generationScope) {
myGenerationScope = generationScope;
@@ -274,7 +275,11 @@ public class JavadocConfiguration implements ModuleRunProfile, JDOMExternalizabl
writer.println(source);
}
writer.println("-sourcepath");
final PathsList pathsList = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getSourcePathsList();
OrderEnumerator enumerator = OrderEnumerator.orderEntries(myProject);
if (!OPTION_INCLUDE_LIBS) {
enumerator = enumerator.withoutSdk().withoutLibraries();
}
final PathsList pathsList = enumerator.getSourcePathsList();
final List<VirtualFile> files = pathsList.getRootDirs();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
final StringBuilder sourcePath = new StringBuilder();
@@ -46,6 +46,7 @@ final class JavadocGenerationPanel extends JPanel {
JCheckBox myDeprecatedList;
JCheckBox myOpenInBrowserCheckBox;
JTextField myLocaleTextField;
JCheckBox myIncludeLibraryCb;
JavadocGenerationPanel() {
myTfOutputDir.addBrowseFolderListener(JavadocBundle.message("javadoc.generate.output.directory.browse"), null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
@@ -98,6 +98,7 @@ public class ExtractMethodObjectHandler implements RefactoringActionHandler {
PsiDocumentManager.getInstance(project).commitAllDocuments();
if (processor.isCreateInnerClass()) {
processor.moveUsedMethodsToInner();
PsiDocumentManager.getInstance(project).commitAllDocuments();
DuplicatesImpl.processDuplicates(extractProcessor, project, editor);
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@@ -80,7 +80,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
private PsiMethod myInnerMethod;
private boolean myMadeStatic = false;
private final Set<MethodToMoveUsageInfo> myUsages = new HashSet<MethodToMoveUsageInfo>();
private final Set<MethodToMoveUsageInfo> myUsages = new LinkedHashSet<MethodToMoveUsageInfo>();
private PsiClass myInnerClass;
private ChangeSignatureProcessor myChangeSignatureProcessor;
private Runnable myCopyMethodToInner;
@@ -109,7 +109,7 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
}
}
if (isCreateInnerClass()) {
final Set<PsiMethod> usedMethods = new HashSet<PsiMethod>();
final Set<PsiMethod> usedMethods = new LinkedHashSet<PsiMethod>();
getMethod().accept(new JavaRecursiveElementWalkingVisitor() {
@Override
public void visitMethodCallExpression(PsiMethodCallExpression expression) {
@@ -224,13 +224,16 @@ public class ExtractMethodObjectProcessor extends BaseRefactoringProcessor {
};
dlg.show();
if (dlg.isOK()) {
for (MemberInfoBase<PsiMember> memberInfo : panel.getTable().getSelectedMemberInfos()) {
if (memberInfo.isChecked()) {
myInnerClass.add(memberInfo.getMember().copy());
memberInfo.getMember().delete();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
for (MemberInfoBase<PsiMember> memberInfo : panel.getTable().getSelectedMemberInfos()) {
if (memberInfo.isChecked()) {
myInnerClass.add(memberInfo.getMember().copy());
memberInfo.getMember().delete();
}
}
}
}
});
}
}
}
@@ -33,7 +33,10 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.MoveDestination;
import com.intellij.refactoring.PackageWrapper;
import com.intellij.ui.*;
import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.ComboboxSpeedSearch;
import com.intellij.ui.ComboboxWithBrowseButton;
import com.intellij.ui.EditorComboBox;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -46,6 +49,7 @@ import java.util.*;
* Date: 9/13/11
*/
public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton {
private static final String LEAVE_IN_SAME_SOURCE_ROOT = "Leave in same source root";
private PsiDirectory myInitialTargetDirectory;
private VirtualFile[] mySourceRoots;
@@ -81,6 +85,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
new ComboboxSpeedSearch(getComboBox()) {
@Override
protected String getElementText(Object element) {
if (element == null) return LEAVE_IN_SAME_SOURCE_ROOT;
if (element instanceof DirectoryChooser.ItemWrapper) {
final VirtualFile virtualFile = ((DirectoryChooser.ItemWrapper)element).getDirectory().getVirtualFile();
final Module module = ModuleUtil.findModuleForFile(virtualFile, project);
@@ -105,7 +110,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
setText(getPresentableText(itemWrapper, project));
}
else {
setText("Leave in same source root");
setText(LEAVE_IN_SAME_SOURCE_ROOT);
}
}
});
@@ -0,0 +1,54 @@
import java.util.Date;
public class TestClass {
private Date expiry;
private Date maturity;
private int commitment;
private double outstanding;
private Iterable payments;
private Date today;
private Date start;
private int riskRating;
public double cal<caret>culate() {
return ( outstandingRiskAmount() * duration() * riskFactor() ) + ( unusedRiskAmount() * duration() * unusedRiskFactor() );
}
private double riskFactor() {
return 5.0;
}
private double unusedRiskFactor() {
return 6.0;
}
private double unusedRiskAmount() {
return ( commitment - outstanding );
}
private double outstandingRiskAmount() {
return outstanding;
}
private double getUsedPercentage() {
return 1.0;
}
private double duration() {
if ( expiry == null && maturity != null ) {
return 1.0;
} else if ( expiry != null && maturity == null ) {
return yearsTo( expiry );
}
return 0.0;
}
private double yearsTo( final Date endDate ) {
Date beginDate = ( today == null ? start : today );
return ( ( endDate.getTime() - beginDate.getTime() ));
}
}
@@ -0,0 +1,59 @@
import java.util.Date;
public class TestClass {
private Date expiry;
private Date maturity;
private int commitment;
private double outstanding;
private Iterable payments;
private Date today;
private Date start;
private int riskRating;
public double calculate() {
return new InnerClass().invoke();
}
private double getUsedPercentage() {
return 1.0;
}
private double yearsTo( final Date endDate ) {
Date beginDate = ( today == null ? start : today );
return ( ( endDate.getTime() - beginDate.getTime() ));
}
private class InnerClass {
public double invoke() {
return ( outstandingRiskAmount() * duration() * riskFactor() ) + ( unusedRiskAmount() * duration() * unusedRiskFactor() );
}
private double outstandingRiskAmount() {
return outstanding;
}
private double duration() {
if ( expiry == null && maturity != null ) {
return 1.0;
} else if ( expiry != null && maturity == null ) {
return yearsTo( expiry );
}
return 0.0;
}
private double riskFactor() {
return 5.0;
}
private double unusedRiskAmount() {
return ( commitment - outstanding );
}
private double unusedRiskFactor() {
return 6.0;
}
}
}
@@ -4,7 +4,8 @@ import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.lookup.*;
import com.intellij.codeInsight.lookup.impl.LookupImpl;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.ThrowableRunnable;
import org.jetbrains.annotations.NonNls;
@SuppressWarnings({"ALL"})
@@ -75,10 +76,16 @@ public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
public void testNewStaticProblem() throws Throwable { doTest(); }
public void testChainingPerformance() throws Throwable {
long time = System.currentTimeMillis();
configure();
IdeaTestUtil.assertTiming("", 3000, System.currentTimeMillis() - time);
assertNotNull(myItems);
configureByFileNoComplete(BASE_PATH + "/" + getTestName(false) + ".java");
PlatformTestUtil.startPerformanceTest(getTestName(false), 1000, new ThrowableRunnable() {
@Override
public void run() throws Exception {
configure();
assertNotNull(myItems);
LookupManager.getInstance(getProject()).hideActiveLookup();
}
}).cpuBound().assertTiming();
}
public void testArrayMemberAccess() throws Throwable { doTest(); }
@@ -110,6 +110,10 @@ public class ExtractMethodObjectTest extends LightRefactoringTestCase {
public void testWithPrivateMethodUsed() throws Exception {
doTest();
}
public void testWithPrivateMethodUsed1() throws Exception {
doTest();
}
public void testWithPrivateMethodWhichCantBeMoved() throws Exception {
doTest();
@@ -108,6 +108,7 @@ public class ModuleUtil {
if (!element.isValid()) return null;
Project project = element.getProject();
if (project.isDefault()) return null;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (element instanceof PsiFileSystemItem && (!(element instanceof PsiFile) || element.getContext() == null)) {
@@ -275,8 +275,10 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
LocalInspectionTool tool = wrapper.getTool();
if (!checkDumbAwareness || tool instanceof DumbAware) {
map.putValue(tool, language);
for (Language dialect : lang.getDialects()) {
map.putValue(tool, dialect.getID());
if (wrapper.applyToDialects()) {
for (Language dialect : lang.getDialects()) {
map.putValue(tool, dialect.getID());
}
}
}
}
@@ -19,6 +19,10 @@ package com.intellij.codeInsight.highlighting;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageBraceMatching;
import com.intellij.lang.PairedBraceMatcher;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.FileType;
@@ -30,6 +34,7 @@ import com.intellij.psi.tree.IElementType;
import com.intellij.util.containers.Stack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;
import java.util.HashMap;
import java.util.List;
@@ -57,6 +62,17 @@ public class BraceMatchingUtil {
BRACE_MATCHERS.put(fileType, braceMatcher);
}
@TestOnly
public static int getMatchedBraceOffset(Editor editor, boolean forward, PsiFile file) {
Document document = editor.getDocument();
int offset = editor.getCaretModel().getOffset();
EditorHighlighter editorHighlighter = ((EditorEx)editor).getHighlighter();
HighlighterIterator iterator = editorHighlighter.createIterator(offset);
boolean matched = matchBrace(document.getCharsSequence(), file.getFileType(), iterator, forward);
assert matched;
return iterator.getStart();
}
private static class MatchBraceContext {
CharSequence fileText;
FileType fileType;
@@ -154,7 +154,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
panel.add(createTemplateOptionsPanel(), gb.nextLine().next().next().coverColumn(2).weighty(1));
panel.add(createShortContextPanel(allowNoContexts), gb.nextLine().next().fillCellNone().anchor(GridBagConstraints.WEST));
panel.add(createShortContextPanel(allowNoContexts), gb.nextLine().next().weighty(0).fillCellNone().anchor(GridBagConstraints.WEST));
myTemplateEditor.getDocument().addDocumentListener(
new DocumentAdapter() {
@@ -29,14 +29,16 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SchemesManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.InputValidator;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.*;
import com.intellij.util.*;
import com.intellij.util.Alarm;
import com.intellij.util.NullableFunction;
import com.intellij.util.ObjectUtils;
import com.intellij.util.PlatformIcons;
import com.intellij.util.containers.Convertor;
import com.intellij.util.ui.tree.TreeUtil;
import com.intellij.util.ui.update.UiNotifyConnector;
@@ -46,7 +48,10 @@ import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
@@ -92,8 +97,11 @@ public class TemplateListPanel extends JPanel implements Disposable {
createTemplateEditor(MOCK_TEMPLATE, "Tab", MOCK_TEMPLATE.createOptions(), MOCK_TEMPLATE.createContext());
add(createExpandByPanel(), BorderLayout.NORTH);
add(createTable(), BorderLayout.CENTER);
add(myDetailsPanel, BorderLayout.SOUTH);
Splitter splitter = new Splitter(true, 0.9f);
splitter.setFirstComponent(createTable());
splitter.setSecondComponent(myDetailsPanel);
add(splitter, BorderLayout.CENTER);
}
public void dispose() {
@@ -190,7 +198,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
@Nullable
public JComponent getPreferredFocusedComponent() {
if (getTemplate(getSelectedIndex()) != null) {
if (getTemplate(getSingleSelectedIndex()) != null) {
return myCurrentTemplateEditor.getKeyField();
}
return null;
@@ -290,7 +298,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
myCurrentTemplateEditor = new LiveTemplateSettingsEditor(template, shortcut, options, context, new Runnable() {
@Override
public void run() {
DefaultMutableTreeNode node = getNode(getSelectedIndex());
DefaultMutableTreeNode node = getNode(getSingleSelectedIndex());
if (node != null) {
((DefaultTreeModel)myTree.getModel()).nodeChanged(node);
TemplateSettings.getInstance().setLastSelectedTemplate(template.getGroupName(), template.getKey());
@@ -315,7 +323,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
private void exportCurrentGroup() {
int selected = getSelectedIndex();
int selected = getSingleSelectedIndex();
if (selected < 0) return;
ExportSchemeAction.doExport(getGroup(selected), getSchemesManager());
@@ -332,7 +340,6 @@ public class TemplateListPanel extends JPanel implements Disposable {
gbConstraints.weighty = 0;
gbConstraints.weightx = 0;
gbConstraints.gridy = 0;
// panel.add(createLabel("By default expand with "), gbConstraints);
panel.add(new JLabel(CodeInsightBundle.message("templates.dialog.shortcut.chooser.label")), gbConstraints);
gbConstraints.gridx = 1;
@@ -350,20 +357,6 @@ public class TemplateListPanel extends JPanel implements Disposable {
return panel;
}
@Nullable
private TemplateKey getTemplateKey(int row) {
JTree tree = myTree;
TreePath path = tree.getPathForRow(row);
if (path != null) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
if (node.getUserObject() instanceof TemplateImpl) {
return new TemplateKey((TemplateImpl)node.getUserObject());
}
}
return null;
}
@Nullable
private TemplateImpl getTemplate(int row) {
JTree tree = myTree;
@@ -392,19 +385,31 @@ public class TemplateListPanel extends JPanel implements Disposable {
return null;
}
private void moveTemplate(TemplateImpl template, String newGroupName, DefaultMutableTreeNode oldTemplateNode) {
TemplateGroup oldGroup = getTemplateGroup(template.getGroupName());
if (oldGroup != null) {
oldGroup.removeElement(template);
private void moveTemplates(Map<TemplateImpl, DefaultMutableTreeNode> map, String newGroupName) {
List<TreePath> toSelect = new ArrayList<TreePath>();
for (TemplateImpl template : map.keySet()) {
DefaultMutableTreeNode oldTemplateNode = map.get(template);
TemplateGroup oldGroup = getTemplateGroup(template.getGroupName());
if (oldGroup != null) {
oldGroup.removeElement(template);
}
template.setGroupName(newGroupName);
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)oldTemplateNode.getParent();
removeNodeFromParent(oldTemplateNode);
if (parent.getChildCount() == 0) removeNodeFromParent(parent);
toSelect.add(new TreePath(registerTemplate(template).getPath()));
}
template.setGroupName(newGroupName);
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)oldTemplateNode.getParent();
removeNodeFromParent(oldTemplateNode);
if (parent.getChildCount() == 0) removeNodeFromParent(parent);
registerTemplate(template);
myTree.getSelectionModel().clearSelection();
for (TreePath path : toSelect) {
myTree.expandPath(path.getParentPath());
myTree.addSelectionPath(path);
myTree.scrollRowToVisible(myTree.getRowForPath(path));
}
}
@Nullable
@@ -430,7 +435,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
private void addRow() {
String defaultGroup = TemplateSettings.USER_GROUP_NAME;
final DefaultMutableTreeNode node = getNode(getSelectedIndex());
final DefaultMutableTreeNode node = getNode(getSingleSelectedIndex());
if (node != null) {
if (node.getUserObject() instanceof TemplateImpl) {
defaultGroup = ((TemplateImpl) node.getUserObject()).getGroupName();
@@ -456,7 +461,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
private void copyRow() {
int selected = getSelectedIndex();
int selected = getSingleSelectedIndex();
if (selected < 0) return;
TemplateImpl orTemplate = getTemplate(selected);
@@ -470,38 +475,45 @@ public class TemplateListPanel extends JPanel implements Disposable {
updateTemplateDetails(true);
}
private int getSelectedIndex() {
TreePath selectionPath = myTree.getSelectionPath();
if (selectionPath == null) {
return -1;
}
else {
return myTree.getRowForPath(selectionPath);
}
private int getSingleSelectedIndex() {
int[] rows = myTree.getSelectionRows();
return rows != null && rows.length == 1 ? rows[0] : -1;
}
private void removeRow() {
int selected = getSelectedIndex();
TemplateKey templateKey = getTemplateKey(selected);
if (templateKey != null) {
removeTemplateAt(selected);
}
else {
TemplateGroup group = getGroup(selected);
if (group != null) {
int result = Messages.showOkCancelDialog(this, CodeInsightBundle.message("template.delete.group.confirmation.text"),
CodeInsightBundle.message("template.delete.confirmation.title"),
Messages.getQuestionIcon());
if (result != DialogWrapper.OK_EXIT_CODE) return;
private void removeRows() {
TreeNode toSelect = null;
myTemplateGroups.remove(group);
TreePath[] paths = myTree.getSelectionPaths();
if (paths == null) return;
for (TreePath path : paths) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
Object o = node.getUserObject();
if (o instanceof TemplateGroup) {
//noinspection SuspiciousMethodCalls
myTemplateGroups.remove(o);
removeNodeFromParent(node);
} else if (o instanceof TemplateImpl) {
TemplateImpl template = (TemplateImpl)o;
TemplateGroup templateGroup = getTemplateGroup(template.getGroupName());
if (templateGroup != null) {
templateGroup.removeElement(template);
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent();
removeNodeFromParent((DefaultMutableTreeNode)myTree.getPathForRow(selected).getLastPathComponent());
if (templateGroup.getElements().isEmpty()) {
myTemplateGroups.remove(templateGroup);
removeNodeFromParent(parent);
} else {
toSelect = parent.getChildAfter(node);
removeNodeFromParent(node);
}
}
}
}
if (toSelect instanceof DefaultMutableTreeNode) {
setSelectedNode((DefaultMutableTreeNode)toSelect);
}
}
private JPanel createTable() {
@@ -560,14 +572,10 @@ public class TemplateListPanel extends JPanel implements Disposable {
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
DefaultTreeSelectionModel selModel = new DefaultTreeSelectionModel();
myTree.setSelectionModel(selModel);
selModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener(){
public void valueChanged(final TreeSelectionEvent e) {
TemplateSettings templateSettings = TemplateSettings.getInstance();
TemplateImpl template = getTemplate(getSelectedIndex());
TemplateImpl template = getTemplate(getSingleSelectedIndex());
if (template != null) {
templateSettings.setLastSelectedTemplate(template.getGroupName(), template.getKey());
} else {
@@ -610,20 +618,18 @@ public class TemplateListPanel extends JPanel implements Disposable {
Point point = dnDActionInfo.getPoint();
if (myTree.getPathForLocation(point.x, point.y) == null) return null;
int selectedIndex = getSelectedIndex();
TemplateImpl template = getTemplate(selectedIndex);
return template != null ? new DnDDragStartBean(Pair.create(template, getNode(selectedIndex))) : null;
Map<TemplateImpl, DefaultMutableTreeNode> templates = getSelectedTemplates();
return !templates.isEmpty() ? new DnDDragStartBean(templates) : null;
}
}).
setDisposableParent(this)
.setTargetChecker(new DnDTargetChecker() {
@Override
public boolean update(DnDEvent event) {
@SuppressWarnings("unchecked") Pair<TemplateImpl, DefaultMutableTreeNode> pair = (Pair<TemplateImpl, DefaultMutableTreeNode>)event.getAttachedObject();
TemplateImpl template = pair.first;
String oldGroupName = template.getGroupName();
@SuppressWarnings("unchecked") Set<String> oldGroupNames = getAllGroups((Map<TemplateImpl, DefaultMutableTreeNode>)event.getAttachedObject());
TemplateGroup group = getDropGroup(event);
boolean differentGroup = group != null && !oldGroupName.equals(group.getName());
boolean differentGroup = group != null && !oldGroupNames.contains(group.getName());
boolean possible = differentGroup && !getSchemesManager().isShared(group);
event.setDropPossible(possible, differentGroup && !possible ? "Cannot modify a shared group" : "");
return true;
@@ -632,8 +638,9 @@ public class TemplateListPanel extends JPanel implements Disposable {
.setDropHandler(new DnDDropHandler() {
@Override
public void drop(DnDEvent event) {
@SuppressWarnings("unchecked") Pair<TemplateImpl, DefaultMutableTreeNode> pair = (Pair<TemplateImpl, DefaultMutableTreeNode>)event.getAttachedObject();
moveTemplate(pair.first, ObjectUtils.assertNotNull(getDropGroup(event)).getName(), pair.second);
//noinspection unchecked
moveTemplates((Map<TemplateImpl, DefaultMutableTreeNode>)event.getAttachedObject(),
ObjectUtils.assertNotNull(getDropGroup(event)).getName());
}
})
.setImageProvider(new NullableFunction<DnDActionInfo, DnDImage>() {
@@ -665,7 +672,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
.setRemoveAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton anActionButton) {
removeRow();
removeRows();
}
})
.disableDownAction()
@@ -678,7 +685,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
@Override
public void updateButton(AnActionEvent e) {
e.getPresentation().setEnabled(getTemplate(getSelectedIndex()) != null);
e.getPresentation().setEnabled(getTemplate(getSingleSelectedIndex()) != null);
}
});
if (getSchemesManager().isExportAvailable()) {
@@ -690,7 +697,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
@Override
public void updateButton(AnActionEvent e) {
TemplateGroup group = getGroup(getSelectedIndex());
TemplateGroup group = getGroup(getSingleSelectedIndex());
e.getPresentation().setEnabled(group != null && !getSchemesManager().isShared(group));
}
});
@@ -738,7 +745,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
@Override
public void update(AnActionEvent e) {
final int selected = getSelectedIndex();
final int selected = getSingleSelectedIndex();
final TemplateGroup templateGroup = getGroup(selected);
boolean enabled = templateGroup != null;
e.getPresentation().setEnabled(enabled);
@@ -756,24 +763,24 @@ public class TemplateListPanel extends JPanel implements Disposable {
final DefaultActionGroup move = new DefaultActionGroup("Move", true) {
@Override
public void update(AnActionEvent e) {
final int selected = getSelectedIndex();
final TemplateImpl template = getTemplate(selected);
boolean enabled = template != null;
final Map<TemplateImpl, DefaultMutableTreeNode> templates = getSelectedTemplates();
boolean enabled = !templates.isEmpty();
e.getPresentation().setEnabled(enabled);
e.getPresentation().setVisible(enabled);
if (enabled) {
final String oldGroupName = template.getGroupName();
Set<String> oldGroups = getAllGroups(templates);
removeAll();
SchemesManager<TemplateGroup, TemplateGroup> schemesManager = TemplateSettings.getInstance().getSchemesManager();
for (TemplateGroup group : getTemplateGroups()) {
final String newGroupName = group.getName();
if (!Comparing.equal(newGroupName, oldGroupName) && !schemesManager.isShared(group)) {
if (!oldGroups.contains(newGroupName) && !schemesManager.isShared(group)) {
add(new DumbAwareAction(newGroupName) {
@Override
public void actionPerformed(AnActionEvent e) {
moveTemplate(template, newGroupName, getNode(selected));
moveTemplates(templates, newGroupName);
}
});
}
@@ -782,9 +789,9 @@ public class TemplateListPanel extends JPanel implements Disposable {
add(new DumbAwareAction("New group...") {
@Override
public void actionPerformed(AnActionEvent e) {
String newName = Messages.showInputDialog(myTree, "Enter the new group name:", "Move to a new group", null, "", new TemplateGroupInputValidator(null));
String newName = Messages.showInputDialog(myTree, "Enter the new group name:", "Move to a New Group", null, "", new TemplateGroupInputValidator(null));
if (newName != null) {
moveTemplate(template, newName, getNode(selected));
moveTemplates(templates, newName);
}
}
});
@@ -803,8 +810,33 @@ public class TemplateListPanel extends JPanel implements Disposable {
});
}
private static Set<String> getAllGroups(Map<TemplateImpl, DefaultMutableTreeNode> templates) {
Set<String> oldGroups = new HashSet<String>();
for (TemplateImpl template : templates.keySet()) {
oldGroups.add(template.getGroupName());
}
return oldGroups;
}
private Map<TemplateImpl, DefaultMutableTreeNode> getSelectedTemplates() {
TreePath[] paths = myTree.getSelectionPaths();
if (paths == null) {
return Collections.emptyMap();
}
Map<TemplateImpl, DefaultMutableTreeNode> templates = new LinkedHashMap<TemplateImpl, DefaultMutableTreeNode>();
for (TreePath path : paths) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
Object o = node.getUserObject();
if (!(o instanceof TemplateImpl)) {
return Collections.emptyMap();
}
templates.put((TemplateImpl)o, node);
}
return templates;
}
private void renameGroup() {
final int selected = getSelectedIndex();
final int selected = getSingleSelectedIndex();
final TemplateGroup templateGroup = getGroup(selected);
if (templateGroup == null) return;
@@ -819,7 +851,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
private void updateTemplateDetails(boolean focusKey) {
int selected = getSelectedIndex();
int selected = getSingleSelectedIndex();
CardLayout layout = (CardLayout)myDetailsPanel.getLayout();
if (selected < 0 || getTemplate(selected) == null) {
layout.show(myDetailsPanel, NO_SELECTION);
@@ -840,7 +872,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
}
private void registerTemplate(TemplateImpl template) {
private CheckedTreeNode registerTemplate(TemplateImpl template) {
TemplateGroup newGroup = getTemplateGroup(template.getGroupName());
if (newGroup == null) {
newGroup = new TemplateGroup(template.getGroupName());
@@ -862,6 +894,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
setSelectedNode(node);
}
}
return node;
}
private void insertNewGroup(final TemplateGroup newGroup) {
@@ -896,34 +929,6 @@ public class TemplateListPanel extends JPanel implements Disposable {
myTree.scrollRowToVisible(row);
}
private void removeTemplateAt(int row) {
JTree tree = myTree;
TreePath path = tree.getPathForRow(row);
DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
LOG.assertTrue(node.getUserObject() instanceof TemplateImpl);
TemplateImpl template = (TemplateImpl)node.getUserObject();
TemplateGroup templateGroup = getTemplateGroup(template.getGroupName());
if (templateGroup != null) {
templateGroup.removeElement(template);
}
DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent();
TreePath treePathToSelect = (parent.getChildAfter(node) != null || parent.getChildCount() == 1 ?
tree.getPathForRow(row + 1) :
tree.getPathForRow(row - 1));
DefaultMutableTreeNode toSelect = treePathToSelect != null ? (DefaultMutableTreeNode)treePathToSelect.getLastPathComponent() : null;
removeNodeFromParent(node);
if (parent.getChildCount() == 0) {
myTemplateGroups.remove((TemplateGroup)parent.getUserObject());
removeNodeFromParent(parent);
}
if (toSelect != null) {
setSelectedNode(toSelect);
}
}
private void removeNodeFromParent(DefaultMutableTreeNode node) {
TreeNode parent = node.getParent();
int idx = parent.getIndex(node);
@@ -985,33 +990,6 @@ public class TemplateListPanel extends JPanel implements Disposable {
}
}
private static class TemplateKey {
private final String myKey;
private final String myGroupName;
public TemplateKey(TemplateImpl template) {
String key = template.getKey();
if (key == null) {
key = "";
}
myKey = key;
String groupName = template.getGroupName();
if (groupName == null) {
groupName = "";
}
myGroupName =groupName;
}
public boolean equals(Object obj) {
if (!(obj instanceof TemplateKey)) {
return false;
}
TemplateKey templateKey = (TemplateKey)obj;
return myGroupName.equals(templateKey.myGroupName) && myKey.equals(templateKey.myKey);
}
}
private class TemplateGroupInputValidator implements InputValidator {
private final String myOldName;
@@ -37,7 +37,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
private final Project myProject;
@@ -51,11 +54,15 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
private Pattern myCompiledPattern;
private final PatternMatcher myMatcher = new Perl5Matcher();
private Map<AnAction, String> myActionsMap = new HashMap<AnAction, String>();
public GotoActionModel(Project project, final Component component) {
myProject = project;
myContextComponent = component;
final ActionGroup mainMenu = (ActionGroup)myActionManager.getActionOrStub(IdeActions.GROUP_MAIN_MENU);
collectActions(myActionsMap, mainMenu, mainMenu.getTemplatePresentation().getText());
}
public String getPromptText() {
@@ -113,7 +120,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
final DataContext dataContext = DataManager.getInstance().getDataContext(myContextComponent);
final AnActionEvent event = updateActionBeforShow(anAction, dataContext);
final AnActionEvent event = updateActionBeforeShow(anAction, dataContext);
final Presentation presentation = event.getPresentation();
final Color fg = defaultActionForeground(isSelected, presentation);
@@ -157,7 +164,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
return actionLabel;
}
protected AnActionEvent updateActionBeforShow(AnAction anAction, DataContext dataContext) {
protected static AnActionEvent updateActionBeforeShow(AnAction anAction, DataContext dataContext) {
final AnActionEvent event = new AnActionEvent(null, dataContext,
ActionPlaces.UNKNOWN, new Presentation(), ActionManager.getInstance(),
0);
@@ -166,7 +173,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
return event;
}
protected Color defaultActionForeground(boolean isSelected, Presentation presentation) {
protected static Color defaultActionForeground(boolean isSelected, Presentation presentation) {
return isSelected ? UIUtil.getListSelectionForeground()
: presentation.isEnabled() && presentation.isVisible()
? UIUtil.getListForeground()
@@ -175,7 +182,10 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
public String[] getNames(boolean checkBoxState) {
final ArrayList<String> result = new ArrayList<String>();
collectActionIds(result, (ActionGroup)myActionManager.getActionOrStub(IdeActions.GROUP_MAIN_MENU));
for (AnAction action : myActionsMap.keySet()) {
if (action instanceof ActionGroup) continue;
result.add(getActionId(action));
}
if (checkBoxState) {
final Set<String> ids = ((ActionManagerImpl)myActionManager).getActionIds();
for (String id : ids) {
@@ -188,22 +198,10 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
return ArrayUtil.toStringArray(result);
}
private void collectActionIds(Collection<String> result, ActionGroup group){
final AnAction[] actions = group.getChildren(null);
for (AnAction action : actions) {
if (action instanceof ActionGroup) {
collectActionIds(result, (ActionGroup)action);
}
else if (action != null) {
result.add(getActionId(action));
}
}
}
public Object[] getElementsByName(final String id, final boolean checkBoxState, final String pattern) {
final HashMap<AnAction, String> map = new HashMap<AnAction, String>();
final ActionGroup mainMenu = (ActionGroup)myActionManager.getActionOrStub(IdeActions.GROUP_MAIN_MENU);
collectActions(id, map, mainMenu, mainMenu.getTemplatePresentation().getText());
final AnAction act = myActionManager.getAction(id);
map.put(act, myActionsMap.get(act));
if (checkBoxState) {
final Set<String> ids = ((ActionManagerImpl)myActionManager).getActionIds();
for (AnAction action : map.keySet()) { //do not add already included actions
@@ -219,15 +217,15 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
return map.entrySet().toArray(new Map.Entry[map.size()]);
}
private void collectActions(String id, Map<AnAction, String> result, ActionGroup group, final String containingGroupName){
private static void collectActions(Map<AnAction, String> result, ActionGroup group, final String containingGroupName){
final AnAction[] actions = group.getChildren(null);
for (AnAction action : actions) {
if (action != null) {
if (action instanceof ActionGroup) {
final ActionGroup actionGroup = (ActionGroup)action;
final String groupName = actionGroup.getTemplatePresentation().getText();
collectActions(id, result, actionGroup, groupName != null ? groupName : containingGroupName);
} else if (getActionId(action) == id) {
collectActions(result, actionGroup, groupName != null ? groupName : containingGroupName);
} else {
final String groupName = group.getTemplatePresentation().getText();
result.put(action, groupName != null && groupName.length() > 0 ? groupName : containingGroupName);
}
@@ -265,6 +263,10 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
(description != null && myMatcher.matches(description, compiledPattern))) {
return true;
}
final String groupName = myActionsMap.get(anAction);
if (groupName != null && text != null && myMatcher.matches(groupName + " " + text, compiledPattern)) {
return true;
}
}
return false;
}
@@ -292,7 +294,7 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
pattern = pattern.substring(0, 80);
}
final @NonNls StringBuffer buffer = new StringBuffer(".*");
final @NonNls StringBuilder buffer = new StringBuilder(".*");
pattern = pattern.toLowerCase();
for (int i = 0; i < pattern.length(); i++) {
final char c = pattern.charAt(i);
@@ -23,6 +23,7 @@ import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.LocalQuickFixProvider;
import com.intellij.lang.LangBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Iconable;
@@ -61,6 +62,8 @@ public class FileReference implements FileReferenceOwner, PsiPolyVariantReferenc
QuickFixProvider<FileReference>, LocalQuickFixProvider,
EmptyResolveMessageProvider, BindablePsiReference {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReference");
public static final FileReference[] EMPTY = new FileReference[0];
private static final TObjectHashingStrategy<ResolveResult> RESOLVE_RESULT_HASHING_STRATEGY = new TObjectHashingStrategy<ResolveResult>() {
@Override
@@ -123,7 +126,11 @@ public class FileReference implements FileReferenceOwner, PsiPolyVariantReferenc
protected Collection<PsiFileSystemItem> getContexts() {
final FileReference contextRef = getContextReference();
if (contextRef == null) {
return myFileReferenceSet.getDefaultContexts();
Collection<PsiFileSystemItem> defaultContexts = myFileReferenceSet.getDefaultContexts();
for (PsiFileSystemItem context : defaultContexts) {
LOG.assertTrue(context != null, myFileReferenceSet.getClass() + " provided a null context");
}
return defaultContexts;
}
ResolveResult[] resolveResults = contextRef.multiResolve(false);
ArrayList<PsiFileSystemItem> result = new ArrayList<PsiFileSystemItem>();
@@ -80,6 +80,11 @@ public class InplaceVariableIntroducer<E extends PsiElement> extends VariableInp
initOccurrencesMarkers();
}
@Override
protected boolean shouldSelectAll() {
return true;
}
@Override
protected StartMarkAction startRename() throws StartMarkAction.AlreadyStartedException {
return null;
@@ -115,7 +115,12 @@ public class RenameDialog extends RefactoringDialog {
private void createNewNameComponent() {
String[] suggestedNames = getSuggestedNames();
myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, FileTypes.PLAIN_TEXT, myEditor);
myNameSuggestionsField = new NameSuggestionsField(suggestedNames, myProject, FileTypes.PLAIN_TEXT, myEditor) {
@Override
protected boolean shouldSelectAll() {
return false;
}
};
if (myPsiElement instanceof PsiFile && myEditor == null) {
myNameSuggestionsField.selectNameWithoutExtension();
}
@@ -404,6 +404,8 @@ public class VariableInplaceRenamer {
myEditor.getCaretModel().moveToOffset(rangeMarker.isValid() ? rangeMarker.getStartOffset() : offset);
if (selectedRange != null){
myEditor.getSelectionModel().setSelection(selectedRange.getStartOffset(), selectedRange.getEndOffset());
} else if (!shouldSelectAll()){
myEditor.getSelectionModel().removeSelection();
}
}
};
@@ -444,6 +446,10 @@ public class VariableInplaceRenamer {
return true;
}
protected boolean shouldSelectAll() {
return false;
}
protected void navigateToAlreadyStarted(Document oldDocument, int exitCode) {
final PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(oldDocument);
if (file != null) {
@@ -36,7 +36,8 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.EventListenerList;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.List;
@@ -104,7 +105,7 @@ public class NameSuggestionsField extends JPanel {
if (selectionModel.hasSelection() && selected != null && !selected.isEmpty()) {
myEditor.getSelectionModel().setSelection(selected.getStartOffset(), selected.getEndOffset());
}
else {
else if (shouldSelectAll()) {
myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength());
}
break;
@@ -113,6 +114,10 @@ public class NameSuggestionsField extends JPanel {
});
}
protected boolean shouldSelectAll() {
return true;
}
public void selectNameWithoutExtension() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
@@ -308,7 +308,7 @@ public class Messages {
doNotAskOption);
}
return showDialog(project, message, title, new String[]{okText, cancelText}, 0, icon);
return showDialog(project, message, title, new String[]{okText, cancelText}, 0, icon, doNotAskOption);
}
public static int showOkCancelDialog(Project project, String message, String title, String okText, String cancelText, Icon icon) {
@@ -25,15 +25,12 @@ import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.ui.mac.foundation.Foundation;
import com.intellij.ui.mac.foundation.ID;
import com.intellij.ui.mac.foundation.MacUtil;
import com.sun.jna.Callback;
import com.sun.jna.IntegerType;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.awt.datatransfer.DataTransferer;
import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.io.IOException;
@@ -182,35 +179,8 @@ public class ClipboardSynchronizer implements ApplicationComponent {
}
private static class MacClipboardHandler extends ClipboardHandler {
private static final String CLIPBOARD_CONTENTS = "CLIPBOARD_CONTENTS";
private static final String MAC_CLIPBOARD_SYNC_ACTIVE = "Mac.Clipboard.Sync.Active";
private Pair<String,Transferable> myFullTransferable;
private static Callback myClipboardQueryCallback = new Callback() {
public void callback(ID self, String selector, ID params) {
JRootPane pane = getRootPane();
if (pane != null) {
Transferable transferable = getClipboardContentNatively();
if (transferable != null) {
pane.putClientProperty(CLIPBOARD_CONTENTS, transferable);
}
pane.putClientProperty(MAC_CLIPBOARD_SYNC_ACTIVE, null);
}
}
};
static {
if (SystemInfo.isMac) {
final ID delegateClass = Foundation.allocateObjcClassPair(Foundation.getClass("NSObject"), "ClipboardSynchronizer_");
if (!Foundation.addMethod(delegateClass, Foundation.createSelector("run:"), myClipboardQueryCallback, "v*")) {
throw new RuntimeException("Unable to add method to objective-c delegate class!");
}
Foundation.registerObjcClassPair(delegateClass);
}
}
@Nullable
private Transferable doGetContents() throws IllegalStateException {
if (Registry.is("ide.mac.useNativeClipboard")) {
@@ -277,59 +247,21 @@ public class ClipboardSynchronizer implements ApplicationComponent {
}
}
@Nullable
private static JRootPane getRootPane() {
Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
if (window == null) return null;
return SwingUtilities.getRootPane(window);
}
@Nullable
public static Transferable getContentsSafe() {
final Ref<Transferable> result = new Ref<Transferable>();
final JRootPane pane = getRootPane();
if (pane != null) {
try {
Runnable run = new Runnable() {
@Override
public void run() {
ID synchronizer_ = Foundation.getClass("ClipboardSynchronizer_");
final ID synchronizer = Foundation.invoke(Foundation.invoke(synchronizer_, "alloc"), "init");
Foundation
.invoke(synchronizer, "performSelectorOnMainThread:withObject:waitUntilDone:", Foundation.createSelector("run:"), null,
false);
pane.putClientProperty(MAC_CLIPBOARD_SYNC_ACTIVE, Boolean.TRUE);
MacUtil.startModal(pane, MAC_CLIPBOARD_SYNC_ACTIVE);
Foundation.cfRelease(synchronizer);
Object contents = pane.getClientProperty(CLIPBOARD_CONTENTS);
pane.putClientProperty(CLIPBOARD_CONTENTS, null);
if (contents != null) {
result.set((Transferable)contents);
}
}
};
if (SwingUtilities.isEventDispatchThread()) {
run.run();
} else {
SwingUtilities.invokeAndWait(run);
}
Transferable transferable = result.get();
if (transferable != null) return transferable;
}
catch (InterruptedException e) {
// do nothing
}
catch (InvocationTargetException e) {
// do nothing
Foundation.executeOnMainThread(new Runnable() {
@Override
public void run() {
Transferable transferable = getClipboardContentNatively();
if (transferable != null) {
result.set(transferable);
}
}
return null;
}, true, true);
return result.get();
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.ide.actions;
import com.intellij.CommonBundle;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.util.ExecUtil;
@@ -28,6 +29,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.impl.LaterInvocator;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.ListPopup;
@@ -234,10 +236,46 @@ public class ShowFilePathAction extends AnAction {
return PlatformDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
}
public static void showDialog(Project project, String message, String title, File file) {
public static Boolean showDialog(Project project, String message, String title, File file) {
final Boolean[] ref = new Boolean[1];
final DialogWrapper.DoNotAskOption option = new DialogWrapper.DoNotAskOption() {
@Override
public boolean isToBeShown() {
return true;
}
@Override
public void setToBeShown(boolean value, int exitCode) {
if (!value) {
if (exitCode == 0) {
// yes
ref[0] = true;
}
else {
ref[0] = false;
}
}
}
@Override
public boolean canBeHidden() {
return true;
}
@Override
public boolean shouldSaveOptionsOnCancel() {
return true;
}
@Override
public String getDoNotShowMessage() {
return CommonBundle.message("dialog.options.do.not.ask");
}
};
if (Messages.showOkCancelDialog(project, message, title, RevealFileAction.getActionName(),
IdeBundle.message("action.close"), Messages.getInformationIcon()) == 0) {
IdeBundle.message("action.close"), Messages.getInformationIcon(), option) == 0) {
open(file, file);
}
return ref[0];
}
}
@@ -190,7 +190,10 @@ public class FSRecords implements Forceable {
myNames = new PersistentStringEnumerator(namesFile);
myAttributes = new Storage(attributesFile.getCanonicalPath());
myContents = new RefCountingStorage(contentsFile.getCanonicalPath());
myRecords = new ResizeableMappedFile(recordsFile, 20 * 1024, new PagedFileStorage.StorageLock(false));
boolean aligned = PagedFileStorage.BUFFER_SIZE % RECORD_SIZE == 0;
assert aligned; // for performance
myRecords = new ResizeableMappedFile(recordsFile, 20 * 1024, new PagedFileStorage.StorageLock(false),
PagedFileStorage.BUFFER_SIZE, aligned);
if (myRecords.length() == 0) {
cleanRecord(0); // Clean header
@@ -514,32 +514,33 @@ action.CloneElement.text=Clo_ne...
action.CloneElement.description=Create a copy of the selected class, file or directory in the same package/directory
action.SafeDelete.text=Safe _Delete...
action.SafeDelete.description=Delete the selected class, method or field, checking for usages
action.ExtractMethod.text=E_xtract Method...
action.ExtractMethod.text=_Method...
action.ExtractMethod.description=Turn the selected code fragment into a method
action.RemoveMiddleman.text=Remove _Middleman
action.RemoveMiddleman.text=Remove _Middleman...
action.RemoveMiddleman.description=Get the client to call the delegate directly
action.MethodDuplicates.text=Replace Met_hod Code Duplicates...
action.MethodDuplicates.description=Finds code in current file that can be transformed into a call of selected method
action.InvertBoolean.text=Invert _Boolean...
action.InvertBoolean.description=Makes the method return or variable contain the opposite value and corrects the references
action.IntroduceParameterObject.text=Introduce Parameter Ob_ject...
action.IntroduceParameterObject.text=Parameter Ob_ject...
action.IntroduceParameterObject.description=Replaces method parameters list with object
action.ExtractClass.text=E_xtract Class...
action.ExtractClass.text=Cla_ss...
action.ExtractClass.description=Extract Delegate
action.IntroduceVariable.text=Introduce _Variable...
action.IntroduceVariable.text=_Variable...
action.IntroduceVariable.description=Put a result of the selected expression into a variable
action.IntroduceField.text=Introduce _Field...
action.IntroduceField.text=_Field...
action.IntroduceField.description=Put a result of the selected expression into a field
action.IntroduceConstant.text=Introduce _Constant...
action.IntroduceConstant.text=_Constant...
action.IntroduceConstant.description=Replace selected expression with a constant (static final field)
action.IntroduceParameter.text=Introduce _Parameter...
action.IntroduceParameter.text=_Parameter...
action.IntroduceParameter.description=Turn the selected expression into method parameter
action.ExtractInterface.text=Extract _Interface...
action.ExtractInterface.text=_Interface...
action.ExtractInterface.description=Extract interface from the selected class
action.ExtractModule.text=Extract _Module...
action.ExtractModule.text=_Module...
action.ExtractModule.description=Extract module from the selected class
action.ExtractSuperclass.text=Extract S_uperclass...
action.ExtractSuperclass.text=S_uperclass...
action.ExtractSuperclass.description=Extract superclass from the selected class
group.IntroduceActionsGroup.text=E_xtract
action.TurnRefsToSuper.text=Use Interface _Where Possible...
action.TurnRefsToSuper.description=Change usages of a class to those of its superclass or interface
action.MembersPullUp.text=Pu_ll Members Up...
@@ -558,7 +559,7 @@ action.ReplaceTempWithQuery.text=Replace Temp with _Query...
action.ReplaceTempWithQuery.description=Turn the selected variable into a method
action.ReplaceConstructorWithFactory.text=Replace Constructor with F_actory Method...
action.ReplaceConstructorWithFactory.description=Create a static factory method and use it instead of a constructor
action.ReplaceMethodWithMethodObject.text=Extract Method Ob_ject...
action.ReplaceMethodWithMethodObject.text=Method Ob_ject...
action.ReplaceMethodWithMethodObject.description=Turn the method into its own object so that all the parameters become fields on that object
action.Generify.text=Ge_nerify...
action.Generify.description=Convert your code to use generic types
@@ -566,7 +567,7 @@ action.Migrate.text=_Migrate...
action.Migrate.description=Open migration dialog
action.Type\ Migration.text=Type Migration...
action.Type\ Migration.description=Migrate one type to another
action.ExtractInclude.text=E_xtract Include File...
action.ExtractInclude.text=_Include File...
action.ExtractInclude.description=Turn the selected code fragment into included file
group.BuildMenu.text=_Build
action.CompileProject.text=_Rebuild Project
@@ -281,8 +281,6 @@ templates.dialog.table.column.description=Description
templates.dialog.table.column.active=Active
templates.dialog.shortcut.chooser.label=By default expand with
dialog.copy.live.template.title=Copy Live Template
template.delete.confirmation.title=Confirm Delete
template.delete.group.confirmation.text=Do you want to delete this template group?
dialog.edit.template.shortcut.default=Default ({0})
dialog.edit.template.template.text.title=&Template text:
dialog.edit.template.button.edit.variables=&Edit variables
@@ -153,7 +153,7 @@ dir.diff.default.trg.folder=
show.live.templates.in.completion=false
documentation.component.editor.font=false
ide.mac.useNativeClipboard=true
ide.mac.useNativeClipboard=false
show.all.classes.on.first.completion=false
limited.relevance.sorting.in.completion=false
@@ -7,9 +7,9 @@
<application-components>
<description>ReSharper makes C# development a real pleasure. It decreases the time you spend on routine, repetitive
<description>Our product makes development a real pleasure. It decreases the time you spend on routine, repetitive
handwork, giving you more time to focus on the task at hand. Its robust set of features for automatic error-checking
and code correction cuts development time and increases your efficiency. You'll find that ReSharper quickly
and code correction cuts development time and increases your efficiency. You'll find that our product quickly
pays back it's cost in increased developer productivity and improved code quality.
</description>
@@ -261,21 +261,25 @@
<action id="CloneElement" class="com.intellij.ide.actions.CloneElementAction"/>
<action id="SafeDelete" class="com.intellij.refactoring.actions.SafeDeleteAction"/>
<separator/>
<action id="IntroduceVariable" class="com.intellij.refactoring.actions.IntroduceVariableAction"/>
<action id="IntroduceConstant" class="com.intellij.refactoring.actions.IntroduceConstantAction"/>
<action id="IntroduceField" class="com.intellij.refactoring.actions.IntroduceFieldAction"/>
<action id="IntroduceParameter" class="com.intellij.refactoring.actions.IntroduceParameterAction"/>
<group id="IntroduceActionsGroup" popup="true">
<action id="IntroduceVariable" class="com.intellij.refactoring.actions.IntroduceVariableAction"/>
<action id="IntroduceConstant" class="com.intellij.refactoring.actions.IntroduceConstantAction"/>
<action id="IntroduceField" class="com.intellij.refactoring.actions.IntroduceFieldAction"/>
<action id="IntroduceParameter" class="com.intellij.refactoring.actions.IntroduceParameterAction"/>
<separator/>
<action id="ExtractMethod" class="com.intellij.refactoring.actions.ExtractMethodAction"/>
<separator/>
<action id="ExtractClass" class="com.intellij.refactoring.actions.ExtractClassAction"/>
<action id="ExtractInclude" class="com.intellij.refactoring.actions.ExtractIncludeAction"/>
<action id="ExtractInterface" class="com.intellij.refactoring.actions.ExtractInterfaceAction"/>
<action id="ExtractSuperclass" class="com.intellij.refactoring.actions.ExtractSuperclassAction"/>
<action id="ExtractModule" class="com.intellij.refactoring.actions.ExtractModuleAction"/>
</group>
<action id="Inline" class="com.intellij.refactoring.actions.InlineAction"/>
<action id="ExtractMethod" class="com.intellij.refactoring.actions.ExtractMethodAction"/>
<action id="ExtractClass" class="com.intellij.refactoring.actions.ExtractClassAction"/>
<separator/>
<action id="MembersPullUp" class="com.intellij.refactoring.actions.PullUpAction"/>
<action id="MemberPushDown" class="com.intellij.refactoring.actions.PushDownAction"/>
<separator/>
<action id="ExtractInclude" class="com.intellij.refactoring.actions.ExtractIncludeAction"/>
<action id="ExtractInterface" class="com.intellij.refactoring.actions.ExtractInterfaceAction"/>
<action id="ExtractSuperclass" class="com.intellij.refactoring.actions.ExtractSuperclassAction"/>
<action id="ExtractModule" class="com.intellij.refactoring.actions.ExtractModuleAction"/>
<add-to-group group-id="MainMenu" anchor="after" relative-to-action="CodeMenu"/>
</group>
@@ -313,20 +313,27 @@ public class TestAll implements Test {
}
return adapter;
}
return new TestSuite(testCaseClass){
final int[] testsCount = {0};
TestSuite suite = new TestSuite(testCaseClass) {
@Override
public void addTest(Test test) {
if (!(test instanceof TestCase)) {
if (!(test instanceof TestCase)) {
testsCount[0]++;
super.addTest(test);
} else {
if (isPerformanceTestsRun() ^ (hasPerformance(((TestCase)test).getName()) || hasPerformance(testCaseClass.getSimpleName()))) return;
}
else {
String name = ((TestCase)test).getName();
if ("warning".equals(name)) return; // Mute TestSuite's "no tests found" warning
if (isPerformanceTestsRun() ^ (hasPerformance(name) || hasPerformance(testCaseClass.getSimpleName())))
return;
Method method = findTestMethod((TestCase)test);
if (method == null || !TestCaseLoader.isBombed(method)) {
testsCount[0]++;
super.addTest(test);
}
}
}
@Nullable
@@ -334,6 +341,8 @@ public class TestAll implements Test {
return safeFindMethod(testCase.getClass(), testCase.getName());
}
};
return testsCount[0] > 0 ? suite : null;
}
return null;
@@ -353,6 +362,14 @@ public class TestAll implements Test {
}
}
private static Set<String> normalizePaths(String[] array) {
Set<String> answer = new LinkedHashSet<String>(array.length);
for (String path : array) {
answer.add(path.replace('\\', '/'));
}
return answer;
}
public static String[] getClassRoots() {
String testRoots = System.getProperty("test.roots");
if (testRoots != null) {
@@ -363,8 +380,8 @@ public class TestAll implements Test {
if (roots != null) {
if (Comparing.equal(System.getProperty(TestCaseLoader.SKIP_COMMUNITY_TESTS), "true")) {
System.out.println("Skipping community tests");
Set<String> set = new LinkedHashSet<String>(Arrays.asList(roots));
set.removeAll(Arrays.asList(ExternalClasspathClassLoader.getExcludeRoots()));
Set<String> set = normalizePaths(roots);
set.removeAll(normalizePaths(ExternalClasspathClassLoader.getExcludeRoots()));
roots = set.toArray(new String[set.size()]);
}
@@ -44,7 +44,7 @@ public class PagedFileStorage implements Forceable {
private final static int LOWER_LIMIT;
private final static int UPPER_LIMIT;
private final static int BUFFER_SIZE;
public final static int BUFFER_SIZE;
private static final int UNKNOWN_PAGE = -1;
static {
@@ -49,7 +49,7 @@ public class JarMemoryLoader {
ZipInputStream zipStream = new ZipInputStream(inputStream);
try {
ZipEntry sizeEntry = zipStream.getNextEntry();
if (!sizeEntry.getName().equals(SIZE_ENTRY)) return null;
if (sizeEntry == null || !sizeEntry.getName().equals(SIZE_ENTRY)) return null;
byte[] bytes = FileUtil.loadBytes(zipStream, 2);
int size = ZipShort.getValue(bytes);
@@ -88,6 +88,7 @@ public final class VcsConfiguration implements PersistentStateComponent<Element>
public boolean INCLUDE_TEXT_INTO_PATCH = false;
public boolean INCLUDE_TEXT_INTO_SHELF = false;
public boolean CREATE_PATCH_EXPAND_DETAILS_DEFAULT = true;
public Boolean SHOW_PATCH_IN_EXPLORER = null;
public enum StandardOption {
ADD(VcsBundle.message("vcs.command.name.add")),
@@ -16,6 +16,7 @@
package com.intellij.openapi.vcs.changes.patch;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.diff.impl.patch.PatchReader;
import com.intellij.openapi.diff.impl.patch.PatchSyntaxException;
@@ -32,6 +33,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.ui.popup.PopupStep;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Getter;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Pair;
@@ -47,8 +49,7 @@ import com.intellij.openapi.vcs.changes.actions.DiffRequestPresentable;
import com.intellij.openapi.vcs.changes.actions.ShowDiffAction;
import com.intellij.openapi.vcs.changes.actions.ShowDiffUIContext;
import com.intellij.openapi.vcs.changes.ui.*;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.*;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
@@ -94,6 +95,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
private JLabel myPatchFileLabel;
private PatchReader myReader;
private CommitContext myCommitContext;
private final VirtualFileAdapter myListener;
public ApplyPatchDifferentiatedDialog(final Project project, final ApplyPatchExecutor callback, final List<ApplyPatchExecutor> executors,
@NotNull final ApplyPatchMode applyPatchMode, @NotNull final VirtualFile patchFile) {
@@ -163,6 +165,24 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
}
myPatchFileLabel.setVisible(applyPatchMode.isCanChangePatchFile());
myPatchFile.setVisible(applyPatchMode.isCanChangePatchFile());
myListener = new VirtualFileAdapter() {
@Override
public void contentsChanged(VirtualFileEvent event) {
if (myRecentPathFileChange.get() != null && myRecentPathFileChange.get().getVf() != null &&
myRecentPathFileChange.get().getVf().equals(event.getFile())) {
myLoadQueue.queue(myUpdater);
}
}
};
final VirtualFileManager fileManager = VirtualFileManager.getInstance();
fileManager.addVirtualFileListener(myListener);
Disposer.register(getDisposable(), new Disposable() {
@Override
public void dispose() {
fileManager.removeVirtualFileListener(myListener);
}
});
}
public static FileChooserDescriptor createSelectPatchDescriptor() {
@@ -239,7 +259,9 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
}
final VirtualFile file = filePresentation.getVf();
final PatchReader patchReader = loadPatches(file);
final PatchReader patchReader = loadPatches(filePresentation);
if (patchReader == null) return;
final List<FilePatchInProgress> matchedPathes = patchReader == null ? Collections.<FilePatchInProgress>emptyList() :
new AutoMatchIterator(myProject).execute(patchReader.getPatches());
@@ -256,10 +278,13 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
}
@Nullable
private PatchReader loadPatches(final VirtualFile patchFile) {
private PatchReader loadPatches(final FilePresentation filePresentation) {
final VirtualFile patchFile = filePresentation.getVf();
patchFile.refresh(false, false);
if (! patchFile.isValid()) {
return null;
}
PatchReader reader;
try {
reader = PatchVirtualFileReader.create(patchFile);
@@ -344,6 +369,12 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
group.add(new StripDown());
group.add(new ResetStrip());
group.add(new ZeroStrip());
group.add(new AnAction("Refresh", "Refresh", IconLoader.getIcon("/actions/sync.png")) {
@Override
public void actionPerformed(AnActionEvent e) {
myLoadQueue.queue(myUpdater);
}
});
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("APPLY_PATCH", group, true);
myCenterPanel.add(toolbar.getComponent(), gb);
@@ -207,7 +207,15 @@ public class CreatePatchCommitExecutor implements CommitExecutorWithHelp, Projec
}
WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
public void run() {
ShowFilePathAction.showDialog(myProject, message, VcsBundle.message("create.patch.commit.action.title"), file);
final VcsConfiguration configuration = VcsConfiguration.getInstance(myProject);
if (Boolean.TRUE.equals(configuration.SHOW_PATCH_IN_EXPLORER)) {
ShowFilePathAction.open(file, file);
} else if (Boolean.FALSE.equals(configuration.SHOW_PATCH_IN_EXPLORER)) {
return;
} else {
configuration.SHOW_PATCH_IN_EXPLORER =
ShowFilePathAction.showDialog(myProject, message, VcsBundle.message("create.patch.commit.action.title"), file);
}
}
}, null, myProject);
} catch (ProcessCanceledException e) {
@@ -152,7 +152,7 @@
<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>
<grid id="aa6eb" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="aa6eb" layout-manager="GridLayoutManager" row-count="5" 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="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -184,9 +184,9 @@
<text resource-bundle="messages/VcsBundle" key="checkbox.show.clear.read.only.status.dialog"/>
</properties>
</component>
<grid id="da366" layout-manager="FlowLayout" hgap="5" vgap="5" flow-align="0">
<grid id="da366" layout-manager="FlowLayout" hgap="5" vgap="2" flow-align="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"/>
<grid row="4" 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"/>
@@ -210,6 +210,32 @@
</component>
</children>
</grid>
<grid id="6c335" layout-manager="FlowLayout" hgap="5" vgap="2" flow-align="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"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="381ee" class="javax.swing.JLabel">
<constraints/>
<properties>
<labelFor value="aec57"/>
<text value="Show patch in explorer after creation:"/>
</properties>
</component>
<component id="aec57" class="javax.swing.JComboBox" binding="myOnPatchCreation">
<constraints/>
<properties>
<model>
<item value="Ask"/>
<item value="Yes"/>
<item value="No"/>
</model>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</children>
@@ -19,6 +19,7 @@ import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
@@ -60,6 +61,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
private JPanel myAddConfirmationPanel;
private JCheckBox myCbOfferToMoveChanges;
private JComboBox myFailedCommitChangelistCombo;
private JComboBox myOnPatchCreation;
private ButtonGroup myEmptyChangelistRemovingGroup;
public VcsGeneralConfigurationPanel(final Project project) {
@@ -91,7 +93,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
}
myPromptsPanel.setSize(myPromptsPanel.getPreferredSize());
myOnPatchCreation.setName((SystemInfo.isMac ? "Reveal patch in" : "Show patch in ") + SystemInfo.nativeFileManagerName + " after creation:");
}
public void apply() throws ConfigurationException {
@@ -109,11 +111,26 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
getAddConfirmation().setValue(getSelected(myOnFileAddingGroup));
getRemoveConfirmation().setValue(getSelected(myOnFileRemovingGroup));
applyPatchOption(settings);
getReadOnlyStatusHandler().getState().SHOW_DIALOG = myShowReadOnlyStatusDialog.isSelected();
}
private void applyPatchOption(VcsConfiguration settings) {
settings.SHOW_PATCH_IN_EXPLORER = getShowPatchValue();
}
private Boolean getShowPatchValue() {
final int index = myOnPatchCreation.getSelectedIndex();
if (index == 0) {
return null;
} else if (index == 1) {
return true;
} else {
return false;
}
}
private VcsShowConfirmationOption.Value getFailedCommitConfirm() {
switch(myFailedCommitChangelistCombo.getSelectedIndex()) {
case 0: return VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY;
@@ -180,6 +197,7 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
if (getSelected(myOnFileAddingGroup) != getAddConfirmation().getValue()) return true;
if (getSelected(myOnFileRemovingGroup) != getRemoveConfirmation().getValue()) return true;
if (! Comparing.equal(settings.SHOW_PATCH_IN_EXPLORER, getShowPatchValue())) return true;
return false;
}
@@ -207,6 +225,13 @@ public class VcsGeneralConfigurationPanel implements SearchableConfigurable {
selectInGroup(myOnFileAddingGroup, getAddConfirmation());
selectInGroup(myOnFileRemovingGroup, getRemoveConfirmation());
if (settings.SHOW_PATCH_IN_EXPLORER == null) {
myOnPatchCreation.setSelectedIndex(0);
} else if (Boolean.TRUE.equals(settings.SHOW_PATCH_IN_EXPLORER)) {
myOnPatchCreation.setSelectedIndex(1);
} else {
myOnPatchCreation.setSelectedIndex(2);
}
}
private static void selectInGroup(final JRadioButton[] group, final VcsShowConfirmationOption confirmation) {
@@ -382,6 +382,12 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name");
Content content = contentManager.findContent(displayName);
if (content == null) {
if (myEditorAdapter != null) {
final Editor editor = myEditorAdapter.getEditor();
if (! editor.isDisposed()) {
EditorFactory.getInstance().releaseEditor(editor);
}
}
final EditorFactory editorFactory = EditorFactory.getInstance();
final Editor editor = editorFactory.createViewer(editorFactory.createDocument(""), myProject);
EditorSettings editorSettings = editor.getSettings();
@@ -229,16 +229,16 @@ public class AndroidProguardCompiler implements ClassPostProcessingCompiler {
if (logDirOutputOsPath != null) {
commands.add("-dump");
commands.add(new File(logDirOutputOsPath, "dump.txt").getAbsolutePath());
commands.add(quotePath(new File(logDirOutputOsPath, "dump.txt").getAbsolutePath()));
commands.add("-printseeds");
commands.add(new File(logDirOutputOsPath, "seeds.txt").getAbsolutePath());
commands.add(quotePath(new File(logDirOutputOsPath, "seeds.txt").getAbsolutePath()));
commands.add("-printusage");
commands.add(new File(logDirOutputOsPath, "usage.txt").getAbsolutePath());
commands.add(quotePath(new File(logDirOutputOsPath, "usage.txt").getAbsolutePath()));
commands.add("-printmapping");
commands.add(new File(logDirOutputOsPath, "mapping.txt").getAbsolutePath());
commands.add(quotePath(new File(logDirOutputOsPath, "mapping.txt").getAbsolutePath()));
}
LOG.info(AndroidUtils.command2string(commands));
@@ -157,7 +157,7 @@ public class AndroidResourcesPackagingCompiler implements ClassPostProcessingCom
preprocessedManifestFile.getPath(),
item.myResourceDirPaths,
item.myAssetsDirPath,
outputPath, null, false, 0);
outputPath, null, !releasePackage, 0);
AndroidCompileUtil.addMessages(context, messages, presentableFilesMap);
}
catch (final IOException e) {
@@ -2,6 +2,7 @@ package org.jetbrains.android.uipreview;
import com.android.AndroidConstants;
import com.android.ide.common.resources.ResourceResolver;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.common.resources.configuration.LanguageQualifier;
import com.android.ide.common.resources.configuration.RegionQualifier;
import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
@@ -252,12 +253,12 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
optionsGroup.addAction(new CheckboxAction("Hide for non-layout files") {
@Override
public boolean isSelected(AnActionEvent e) {
return mySettings.getState().isHideForNonLayoutFiles();
return mySettings.getGlobalState().isHideForNonLayoutFiles();
}
@Override
public void setSelected(AnActionEvent e, boolean state) {
mySettings.getState().setHideForNonLayoutFiles(state);
mySettings.getGlobalState().setHideForNonLayoutFiles(state);
}
}).setAsSecondary(true);
@@ -391,6 +392,7 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
}
public void setFile(@Nullable PsiFile file) {
final boolean fileChanged = !Comparing.equal(myFile, file);
myFile = file;
final AndroidPlatform newPlatform = getPlatform(file);
@@ -403,9 +405,16 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
if (!myResetFlag) {
reset();
myResetFlag = true;
return;
}
}
}
if (file != null && fileChanged) {
myResetFlag = false;
reset();
myResetFlag = true;
}
}
@Nullable
@@ -427,9 +436,14 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
}
return null;
}
@Nullable
private VirtualFile getVirtualFile() {
return myFile != null ? myFile.getVirtualFile() : null;
}
private void saveState() {
final AndroidLayoutPreviewToolWindowSettings.State state = mySettings.getState();
final AndroidLayoutPreviewToolWindowSettings.GlobalState state = mySettings.getGlobalState();
if (myResetFlag) {
final LayoutDevice selectedDevice = getSelectedDevice();
@@ -438,8 +452,18 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
}
final LayoutDeviceConfiguration deviceConfig = getSelectedDeviceConfiguration();
if (deviceConfig != null) {
state.setDeviceConfiguration(deviceConfig.getName());
final VirtualFile vFile = getVirtualFile();
if (deviceConfig != null && vFile != null) {
final LayoutDeviceConfiguration defaultConfig = getDefaultDeviceConfigForFile(vFile);
final String defaultConfigName = defaultConfig != null ? defaultConfig.getName() : null;
final String deviceConfigName = deviceConfig.getName();
if (Comparing.equal(deviceConfigName, defaultConfigName)) {
mySettings.removeDeviceConfiguration(vFile);
}
else {
mySettings.setDeviceConfiguration(vFile, deviceConfigName);
}
}
final UiMode dockMode = getSelectedDockMode();
@@ -473,7 +497,7 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
}
private void reset() {
final AndroidLayoutPreviewToolWindowSettings.State state = mySettings.getState();
final AndroidLayoutPreviewToolWindowSettings.GlobalState state = mySettings.getGlobalState();
final String savedDeviceName = state.getDevice();
if (savedDeviceName != null) {
@@ -489,17 +513,28 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
}
}
final String savedDeviceConfigName = state.getDeviceConfiguration();
if (savedDeviceConfigName != null) {
LayoutDeviceConfiguration savedDeviceConfig = null;
for (LayoutDeviceConfiguration config : myDeviceConfigurations) {
if (savedDeviceConfigName.equals(config.getName())) {
savedDeviceConfig = config;
break;
final VirtualFile vFile = getVirtualFile();
if (vFile != null) {
final String savedDeviceConfigName = mySettings.getDeviceConfiguration(vFile);
if (savedDeviceConfigName != null) {
LayoutDeviceConfiguration savedDeviceConfig = null;
for (LayoutDeviceConfiguration config : myDeviceConfigurations) {
if (savedDeviceConfigName.equals(config.getName())) {
savedDeviceConfig = config;
break;
}
}
if (savedDeviceConfig != null) {
myDeviceConfigurationsCombo.setSelectedItem(savedDeviceConfig);
}
}
if (savedDeviceConfig != null) {
myDeviceConfigurationsCombo.setSelectedItem(savedDeviceConfig);
else {
final LayoutDeviceConfiguration defaultConfig = getDefaultDeviceConfigForFile(vFile);
if (defaultConfig != null) {
myDeviceConfigurationsCombo.setSelectedItem(defaultConfig);
}
}
}
@@ -556,8 +591,32 @@ class AndroidLayoutPreviewToolWindowForm implements Disposable {
}
}
@Nullable
private LayoutDeviceConfiguration getDefaultDeviceConfigForFile(@NotNull VirtualFile vFile) {
final VirtualFile folder = vFile.getParent();
if (folder == null) {
return null;
}
final String[] folderSegments = folder.getName().split(AndroidConstants.RES_QUALIFIER_SEP);
if (folderSegments.length == 0) {
return null;
}
final FolderConfiguration config = FolderConfiguration.getConfig(folderSegments);
if (config != null) {
for (LayoutDeviceConfiguration deviceConfig : myDeviceConfigurations) {
if (deviceConfig.getConfiguration().isMatchFor(config)) {
return deviceConfig;
}
}
}
return null;
}
private void resetThemes(Collection<Object> themes) {
final String savedThemeName = mySettings.getState().getTheme();
final String savedThemeName = mySettings.getGlobalState().getTheme();
if (savedThemeName != null) {
ThemeData savedTheme = null;
for (Object o : themes) {
@@ -185,7 +185,7 @@ public class AndroidLayoutPreviewToolWindowManager implements ProjectComponent {
final ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(toolWindowId);
if (window != null && window.isAvailable()) {
final boolean visible = window.isVisible();
AndroidLayoutPreviewToolWindowSettings.getInstance(myProject).getState().setVisible(visible);
AndroidLayoutPreviewToolWindowSettings.getInstance(myProject).getGlobalState().setVisible(visible);
if (visible && !myVisible) {
render();
@@ -244,7 +244,7 @@ public class AndroidLayoutPreviewToolWindowManager implements ProjectComponent {
}
final AndroidLayoutPreviewToolWindowSettings settings = AndroidLayoutPreviewToolWindowSettings.getInstance(myProject);
final boolean hideForNonLayoutFiles = settings.getState().isHideForNonLayoutFiles();
final boolean hideForNonLayoutFiles = settings.getGlobalState().isHideForNonLayoutFiles();
if (activeEditor == null) {
myToolWindowForm.setFile(null);
@@ -266,7 +266,7 @@ public class AndroidLayoutPreviewToolWindowManager implements ProjectComponent {
}
myToolWindow.setAvailable(true, null);
final boolean visible = AndroidLayoutPreviewToolWindowSettings.getInstance(myProject).getState().isVisible();
final boolean visible = AndroidLayoutPreviewToolWindowSettings.getInstance(myProject).getGlobalState().isVisible();
if (visible) {
myToolWindow.show(null);
}
@@ -364,12 +364,12 @@ public class AndroidLayoutPreviewToolWindowManager implements ProjectComponent {
synchronized (RENDERING_LOCK) {
final StringBuilder warnBuilder = new StringBuilder();
if (target != null && theme != null &&
RenderUtil.renderLayout(myProject, layoutXmlText, layoutXmlFile, imgPath,
target, facet, config, xdpi, ydpi, theme, warnBuilder)) {
if (target != null && theme != null &&
RenderUtil.renderLayout(myProject, layoutXmlText, layoutXmlFile, imgPath,
target, facet, config, xdpi, ydpi, theme, warnBuilder)) {
warnMessage = warnBuilder.toString();
final File input = new File(imgPath);
image = ImageIO.read(input);
final File input = new File(imgPath);
image = ImageIO.read(input);
}
}
}
@@ -5,8 +5,15 @@ import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.containers.HashMap;
import com.intellij.util.xmlb.annotations.MapAnnotation;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.annotations.NotNull;
import java.util.Map;
/**
* @author Eugene.Kudelevsky
*/
@@ -16,26 +23,93 @@ import org.jetbrains.annotations.NotNull;
@Storage(id = "AndroidLayoutPreviewToolWindow", file = "$WORKSPACE_FILE$")
}
)
public class AndroidLayoutPreviewToolWindowSettings implements PersistentStateComponent<AndroidLayoutPreviewToolWindowSettings.State> {
private State myState = new State();
public class AndroidLayoutPreviewToolWindowSettings implements PersistentStateComponent<AndroidLayoutPreviewToolWindowSettings.MyState> {
private final Map<VirtualFile, String> myFile2DeviceConfig = new HashMap<VirtualFile, String>();
private GlobalState myGlobalState = new GlobalState();
public static AndroidLayoutPreviewToolWindowSettings getInstance(@NotNull Project project) {
return ServiceManager.getService(project, AndroidLayoutPreviewToolWindowSettings.class);
return ServiceManager.getService(project, AndroidLayoutPreviewToolWindowSettings.class);
}
@NotNull
public GlobalState getGlobalState() {
return myGlobalState;
}
public String getDeviceConfiguration(@NotNull VirtualFile file) {
synchronized (myFile2DeviceConfig) {
return myFile2DeviceConfig.get(file);
}
}
public void setDeviceConfiguration(@NotNull VirtualFile file, @NotNull String deviceConfiguration) {
synchronized (myFile2DeviceConfig) {
myFile2DeviceConfig.put(file, deviceConfiguration);
}
}
public void removeDeviceConfiguration(@NotNull VirtualFile file) {
synchronized (myFile2DeviceConfig) {
myFile2DeviceConfig.remove(file);
}
}
@Override
public MyState getState() {
final Map<String, String> url2DeviceConfig = new HashMap<String, String>();
synchronized (myFile2DeviceConfig) {
for (Map.Entry<VirtualFile, String> entry : myFile2DeviceConfig.entrySet()) {
url2DeviceConfig.put(entry.getKey().getUrl(), entry.getValue());
}
}
final MyState state = new MyState();
state.setUrl2DeviceConfig(url2DeviceConfig);
state.setState(myGlobalState);
return state;
}
@Override
public void loadState(MyState state) {
myGlobalState = state.getState();
synchronized (myFile2DeviceConfig) {
myFile2DeviceConfig.clear();
for (Map.Entry<String, String> entry : state.getUrl2DeviceConfig().entrySet()) {
final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(entry.getKey());
if (file != null) {
myFile2DeviceConfig.put(file, entry.getValue());
}
}
}
}
public static class MyState {
private GlobalState myGlobalState = new GlobalState();
private Map<String, String> myUrl2DeviceConfig = new HashMap<String, String>();
public GlobalState getState() {
return myGlobalState;
}
@Override
public void loadState(State state) {
myState = state;
@Tag("device-configurations")
@MapAnnotation(surroundWithTag = false)
public Map<String, String> getUrl2DeviceConfig() {
return myUrl2DeviceConfig;
}
public void setState(GlobalState state) {
myGlobalState = state;
}
public void setUrl2DeviceConfig(Map<String, String> url2DeviceConfig) {
myUrl2DeviceConfig = url2DeviceConfig;
}
}
@Override
public State getState() {
return myState;
}
public static class State {
public static class GlobalState {
private String myDevice;
private String myDeviceConfiguration;
private String myDockMode;
private String myNightMode;
private String myTargetHashString;
@@ -53,14 +127,6 @@ public class AndroidLayoutPreviewToolWindowSettings implements PersistentStateCo
myDevice = device;
}
public String getDeviceConfiguration() {
return myDeviceConfiguration;
}
public void setDeviceConfiguration(String deviceConfiguration) {
myDeviceConfiguration = deviceConfiguration;
}
public String getDockMode() {
return myDockMode;
}
@@ -64,9 +64,6 @@ public final class ReflectedProject {
iterator.remove();
}
else {
if (pair.first != null && pair.first.getProject() == null) {
iterator.remove();
}
if (pair.second == classLoader) {
return pair.first;
}
@@ -76,35 +73,35 @@ public final class ReflectedProject {
finally {
ourProjectsLock.unlock();
}
final ReflectedProject project = new ReflectedProject(classLoader);
if (project.getProject() != null) { // do not cache partially-loaded stuff
final ReflectedProject reflectedProj = new ReflectedProject(classLoader);
if (reflectedProj.getProject() != null) { // do not cache partially-loaded stuff
ourProjectsLock.lock();
try {
ourProjects.add(new SoftReference<Pair<ReflectedProject, ClassLoader>>(
new Pair<ReflectedProject, ClassLoader>(project, classLoader)
new Pair<ReflectedProject, ClassLoader>(reflectedProj, classLoader)
));
}
finally {
ourProjectsLock.unlock();
}
}
return project;
return reflectedProj;
}
ReflectedProject(final ClassLoader classLoader) {
Object myProject = null;
Object project = null;
try {
final Class projectClass = classLoader.loadClass("org.apache.tools.ant.Project");
if (projectClass != null) {
myProject = projectClass.newInstance();
project = projectClass.newInstance();
Method method = projectClass.getMethod(INIT_METHOD_NAME);
method.invoke(myProject);
method.invoke(project);
method = getMethod(projectClass, GET_TASK_DEFINITIONS_METHOD_NAME);
myTaskDefinitions = (Hashtable)method.invoke(myProject);
myTaskDefinitions = (Hashtable)method.invoke(project);
method = getMethod(projectClass, GET_DATA_TYPE_DEFINITIONS_METHOD_NAME);
myDataTypeDefinitions = (Hashtable)method.invoke(myProject);
myDataTypeDefinitions = (Hashtable)method.invoke(project);
method = getMethod(projectClass, GET_PROPERTIES_METHOD_NAME);
myProperties = (Hashtable)method.invoke(myProject);
myProperties = (Hashtable)method.invoke(project);
myTargetClass = classLoader.loadClass("org.apache.tools.ant.Target");
}
}
@@ -118,7 +115,7 @@ public final class ReflectedProject {
}
else {
LOG.info(e);
myProject = null;
project = null;
}
}
catch (InvocationTargetException e) {
@@ -128,14 +125,14 @@ public final class ReflectedProject {
}
else {
LOG.info(e);
myProject = null;
project = null;
}
}
catch (Throwable e) {
LOG.info(e);
myProject = null;
project = null;
}
this.myProject = myProject;
myProject = project;
}
private static Method getMethod(final Class introspectionHelperClass, final String name) throws NoSuchMethodException {
@@ -84,7 +84,7 @@ public class GradleScriptType extends GroovyScriptType {
@Override
public boolean isConfigurationByLocation(@NotNull GroovyScriptRunConfiguration existing, @NotNull Location location) {
final String params = existing.getProgramParameters();
final String params = existing.getScriptParameters();
final String s = getTaskTarget(location);
return s != null && params != null && (params.startsWith(s + " ") || params.equals(s));
}
@@ -890,13 +890,6 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator {
}
}
}
if (regex instanceof GrRegex && ((GrRegex)regex).getInjections().length > 0) {
if (!config.isVersionAtLeast(regex, GroovyConfigUtils.GROOVY1_8)) {
myHolder.createErrorAnnotation(regex, GroovyBundle
.message("slashy.strings.with.injections.are.not.allowed.in.groovy.0", config.getSDKVersion(regex)));
}
}
}
@Override
@@ -126,7 +126,7 @@ public class GantRunner extends GroovyScriptRunner {
params.getProgramParametersList().add("--debug");
}
params.getProgramParametersList().addParametersString(configuration.getProgramParameters());
params.getProgramParametersList().addParametersString(configuration.getScriptParameters());
}
}
@@ -15,16 +15,16 @@
*/
package org.jetbrains.plugins.groovy.gant;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.execution.Location;
import com.intellij.execution.RunManagerEx;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.NonClasspathDirectoryScope;
import com.intellij.compiler.options.CompileStepBeforeRun;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -65,7 +65,7 @@ public class GantScriptType extends GroovyScriptType {
@Override
public boolean isConfigurationByLocation(@NotNull GroovyScriptRunConfiguration existing, @NotNull Location place) {
final String params = existing.getProgramParameters();
final String params = existing.getScriptParameters();
final String s = getTargetName(place);
return s != null && params != null && (params.startsWith(s + " ") || params.equals(s));
}
@@ -93,7 +93,7 @@ public class GantScriptType extends GroovyScriptType {
public void tuneConfiguration(@NotNull GroovyFile file, @NotNull GroovyScriptRunConfiguration configuration, Location location) {
String target = getTargetName(location);
if (target != null) {
configuration.setProgramParameters(target);
configuration.setScriptParameters(target);
configuration.setName(configuration.getName() + "." + target);
}
final CompileStepBeforeRun.MakeBeforeRunTask runTask =
+1 -1
View File
@@ -2,7 +2,7 @@ print (/abc/)
print (<error descr="Multi-line slashy strings are not allowed in Groovy 1.6">/ab
c/</error>)
print (<error descr="Slashy strings with injections are not allowed in Groovy 1.6">/abc${false}def/</error>)
print (/abc${false}def/)
print (<error descr="Multi-line slashy strings are not allowed in Groovy 1.6">/abc${false}d
ef/</error>)
+1 -1
View File
@@ -49,7 +49,7 @@
</extensions>
<actions>
<action id="I18nize" class="com.intellij.codeInspection.i18n.I18nizeAction">
<add-to-group group-id="RefactoringMenu" anchor="before" relative-to-action="ExtractInclude" />
<add-to-group group-id="RefactoringMenu" anchor="last" />
</action>
</actions>
</idea-plugin>
@@ -388,9 +388,9 @@
</action>
<group id="Maven.RefactoringGroup" text="Refactoring">
<add-to-group group-id="RefactoringMenu" anchor="last"/>
<add-to-group group-id="IntroduceActionsGroup" anchor="after" relative-to-action="IntroduceParameter"/>
<separator/>
<action id="refactoring.introduce.property" text="Introduce Property"
<action id="refactoring.introduce.property" text="Property"
class="org.jetbrains.idea.maven.dom.refactorings.introduce.IntroducePropertyAction"
use-shortcut-of="IntroduceVariable"/>
@@ -25,6 +25,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.impl.text.TextEditorPsiDataProvider;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
@@ -106,6 +107,10 @@ public class RenameTo extends ShowSuggestions implements SpellCheckerQuickFix {
DataContext dataContext = SimpleDataContext.getSimpleContext(map, DataManager.getInstance().getDataContext(editor.getComponent()));
AnAction action = new RenameElementAction();
final TextRange range = psiElement.getTextRange();
if (range != null) {
editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset());
}
AnActionEvent event = new AnActionEvent(null, dataContext, "", action.getTemplatePresentation(), ActionManager.getInstance(), 0);
action.actionPerformed(event);
if (provider != null) {
@@ -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.tasks.config.TaskRepositoriesConfigurable">
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="3" 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="4" 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="579" height="400"/>
@@ -28,12 +28,22 @@
</grid>
<grid id="51b17" binding="myRepositoryEditor" layout-manager="CardLayout" hgap="0" vgap="0">
<constraints>
<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"/>
<grid row="3" 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"/>
<children/>
</grid>
<component id="4840c" class="com.intellij.openapi.ui.Splitter" binding="mySplitter">
<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>
<firstComponent value="7efb3"/>
<orientation value="true"/>
<secondComponent value="51b17"/>
</properties>
</component>
</children>
</grid>
</form>
@@ -10,6 +10,7 @@ import com.intellij.openapi.options.Configurable;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ui.configuration.actions.IconWithTextAction;
import com.intellij.openapi.ui.Splitter;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.tasks.TaskManager;
@@ -49,6 +50,7 @@ public class TaskRepositoriesConfigurable extends BaseConfigurable implements Co
private JPanel myToolbarPanel;
private JPanel myRepositoryEditor;
private JBLabel myServersLabel;
private Splitter mySplitter;
private final List<TaskRepository> myRepositories = new ArrayList<TaskRepository>();
private final Project myProject;
@@ -150,6 +152,8 @@ public class TaskRepositoriesConfigurable extends BaseConfigurable implements Co
String name = myRepoNames.get(repository);
assert name != null;
((CardLayout)myRepositoryEditor.getLayout()).show(myRepositoryEditor, name);
mySplitter.doLayout();
mySplitter.repaint();
}
}
});
@@ -53,7 +53,6 @@ public class TaskCompletionContributor extends CompletionContributor {
}
if (consumer != null) {
result.stopHere();
String text = parameters.getOriginalFile().getText();
int i = text.lastIndexOf(' ', parameters.getOffset() - 1) + 1;
+11 -4
View File
@@ -1,4 +1,4 @@
<component xmlns:xi="http://www.w3.org/2001/XInclude">
<component>
<actions>
<group id="JavaGenerateGroup1">
<action id="GenerateTestMethod" class="com.intellij.testIntegration.GenerateTestMethodAction"/>
@@ -59,12 +59,19 @@
<group id="RefactoringMenu2">
<action id="MethodDuplicates" class="com.intellij.refactoring.actions.MethodDuplicatesAction"/>
<action id="ReplaceMethodWithMethodObject" class="com.intellij.refactoring.actions.ReplaceMethodWithMethodObjectAction"/>
<action id="IntroduceParameterObject" class="com.intellij.refactoring.actions.IntroduceParameterObjectAction"/>
<action id="InvertBoolean" class="com.intellij.refactoring.actions.InvertBooleanAction"/>
<add-to-group group-id="RefactoringMenu" anchor="after" relative-to-action="ExtractMethod"/>
<add-to-group group-id="RefactoringMenu" anchor="after" relative-to-action="Inline"/>
</group>
<action id="ReplaceMethodWithMethodObject" class="com.intellij.refactoring.actions.ReplaceMethodWithMethodObjectAction">
<add-to-group group-id="IntroduceActionsGroup" anchor="after" relative-to-action="ExtractMethod"/>
</action>
<action id="IntroduceParameterObject" class="com.intellij.refactoring.actions.IntroduceParameterObjectAction">
<add-to-group group-id="IntroduceActionsGroup" anchor="after" relative-to-action="IntroduceParameter"/>
</action>
<group id="RefactoringMenu4">
<action id="TurnRefsToSuper" class="com.intellij.refactoring.actions.TurnRefsToSuperAction"/>
<action id="InheritanceToDelegation" class="com.intellij.refactoring.actions.InheritanceToDelegationAction"/>
@@ -84,14 +84,15 @@ public class CreateNSDeclarationIntentionFix implements HintAction, LocalQuickFi
}
protected CreateNSDeclarationIntentionFix(@NotNull final PsiElement element,
@NotNull final String namespacePrefix, XmlFile containingFile) {
@NotNull final String namespacePrefix,
@NotNull XmlFile containingFile) {
this(element, namespacePrefix, null, containingFile);
}
public CreateNSDeclarationIntentionFix(final PsiElement element,
final String namespacePrefix,
@Nullable final XmlToken token,
XmlFile containingFile) {
@NotNull XmlFile containingFile) {
myNamespacePrefix = namespacePrefix;
myElement = element;
myFile = containingFile;
@@ -132,7 +133,7 @@ public class CreateNSDeclarationIntentionFix implements HintAction, LocalQuickFi
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
if (!myElement.isValid() || !CodeInsightUtilBase.prepareFileForWrite(file)) return;
final Set<String> set = XmlExtension.getExtension(file).guessUnboundNamespaces(myElement, (XmlFile)file);
final Set<String> set = XmlExtension.getExtension(myFile).guessUnboundNamespaces(myElement, myFile);
final String[] namespaces = ArrayUtil.toStringArray(set);
Arrays.sort(namespaces);