diff --git a/.idea/compiler.xml b/.idea/compiler.xml index a926e428e3b8..d21b8497ae77 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -54,6 +54,7 @@ + diff --git a/build/conf/nsis/idea.nsi b/build/conf/nsis/idea.nsi index b763f60c489c..73c5c50deb06 100644 --- a/build/conf/nsis/idea.nsi +++ b/build/conf/nsis/idea.nsi @@ -852,10 +852,15 @@ skip_properties: ; set the current time for installation files under $INSTDIR\bin ExecCmd::exec 'copy "$INSTDIR\bin\*.*s" +,,' call winVersion - ${If} $0 == "1" + ${If} $0 == "1" ;ExecCmd::exec 'icacls "$INSTDIR" /grant %username%:F /T >"$INSTDIR"\installation_log.txt 2>"$INSTDIR"\installation_error.txt' AccessControl::GrantOnFile \ "$INSTDIR" "(S-1-5-32-545)" "GenericRead + GenericExecute" + AccessControl::GrantOnFile \ + "$INSTDIR\bin\${PRODUCT_EXE_FILE}.vmoptions" "(S-1-5-32-545)" "GenericRead + GenericWrite" + ${StrRep} $0 ${PRODUCT_EXE_FILE} ".exe" "64.exe.vmoptions" + AccessControl::GrantOnFile \ + "$INSTDIR\bin\$0" "(S-1-5-32-545)" "GenericRead + GenericWrite" ${EndIf} SectionEnd diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java index 8d7f05cb3daf..d19015f2677d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java +++ b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.MultiLineLabelUI; import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.ScrollPaneFactory; import com.intellij.util.ArrayUtil; @@ -129,19 +130,13 @@ public class GenerateAntBuildDialog extends DialogWrapper { private void saveSettings() { final PropertiesComponent properties = PropertiesComponent.getInstance(myProject); - properties.setValue(SINGLE_FILE_PROPERTY, Boolean.toString(myRbGenerateSingleFileBuild.isSelected())); - properties.setValue(UI_FORM_PROPERTY, Boolean.toString(myCbEnableUIFormsCompilation.isSelected())); - properties.setValue(FORCE_TARGET_JDK_PROPERTY, Boolean.toString(myCbForceTargetJdk.isSelected())); - properties.setValue(BACKUP_FILES_PROPERTY, Boolean.toString(myRbBackupFiles.isSelected())); - properties.setValue(INLINE_RUNTIME_CLASSPATH_PROPERTY, Boolean.toString(myCbInlineRuntimeClasspath.isSelected())); - properties.setValue(GENERATE_IDEA_HOME_PROPERTY, Boolean.toString(myGenerateIdeaHomeProperty.isSelected())); - final String outputFileName = getOutputFileName(); - if (outputFileName.length() > 0) { - properties.setValue(OUTPUT_FILE_NAME_PROPERTY, outputFileName); - } - else { - properties.unsetValue(OUTPUT_FILE_NAME_PROPERTY); - } + properties.setValue(SINGLE_FILE_PROPERTY, myRbGenerateSingleFileBuild.isSelected()); + properties.setValue(UI_FORM_PROPERTY, myCbEnableUIFormsCompilation.isSelected()); + properties.setValue(FORCE_TARGET_JDK_PROPERTY, myCbForceTargetJdk.isSelected()); + properties.setValue(BACKUP_FILES_PROPERTY, myRbBackupFiles.isSelected()); + properties.setValue(INLINE_RUNTIME_CLASSPATH_PROPERTY, myCbInlineRuntimeClasspath.isSelected()); + properties.setValue(GENERATE_IDEA_HOME_PROPERTY, myGenerateIdeaHomeProperty.isSelected()); + properties.setValue(OUTPUT_FILE_NAME_PROPERTY, StringUtil.nullize(getOutputFileName())); } public void dispose() { diff --git a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/completion/lookup/ChainCompletionMethodCallLookupElement.java b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/completion/lookup/ChainCompletionMethodCallLookupElement.java index d49ac3e04cfd..a9b369bf0ae9 100644 --- a/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/completion/lookup/ChainCompletionMethodCallLookupElement.java +++ b/java/compiler/impl/src/com/intellij/compiler/classFilesIndex/chainsSearch/completion/lookup/ChainCompletionMethodCallLookupElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package com.intellij.compiler.classFilesIndex.chainsSearch.completion.lookup; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.completion.JavaMethodCallElement; import com.intellij.codeInsight.completion.StaticallyImportable; -import com.intellij.compiler.classFilesIndex.chainsSearch.completion.lookup.sub.SubLookupElement; import com.intellij.codeInsight.lookup.AutoCompletionPolicy; +import com.intellij.compiler.classFilesIndex.chainsSearch.completion.lookup.sub.SubLookupElement; import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.application.ApplicationManager; import com.intellij.psi.PsiClass; @@ -64,7 +64,7 @@ public class ChainCompletionMethodCallLookupElement extends JavaMethodCallElemen private void configureAutoCompletionPolicy() { if (ApplicationManager.getApplication().isUnitTestMode()) { - if (PropertiesComponent.getInstance(myMethod.getProject()).getBoolean(PROP_METHODS_CHAIN_COMPLETION_AUTO_COMPLETION, false)) { + if (PropertiesComponent.getInstance(myMethod.getProject()).getBoolean(PROP_METHODS_CHAIN_COMPLETION_AUTO_COMPLETION)) { setAutoCompletionPolicy(AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java b/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java index 454b130307cf..727cb31f7b41 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/ObjectMarkupPropertiesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import java.awt.*; */ public class ObjectMarkupPropertiesDialog extends ValueMarkerPresentationDialogBase { @NonNls private static final String MARK_ALL_REFERENCED_VALUES_KEY = "debugger.mark.all.referenced.values"; + private static final boolean MARK_ALL_REFERENCED_VALUES_DEFAULT_VALUE = true; private JCheckBox myCbMarkAdditionalFields; private final boolean mySuggestAdditionalMarkup; private JPanel myAdditionalPropertiesPanel; @@ -41,14 +42,14 @@ public class ObjectMarkupPropertiesDialog extends ValueMarkerPresentationDialogB mySuggestAdditionalMarkup = suggestAdditionalMarkup; myDescriptionLabel.setText("If the value is referenced by a constant field of an abstract class,\n" + "IDEA could additionally mark all values referenced from this class with the names of referencing fields."); - myCbMarkAdditionalFields.setSelected(PropertiesComponent.getInstance().getBoolean(MARK_ALL_REFERENCED_VALUES_KEY, true)); + myCbMarkAdditionalFields.setSelected(PropertiesComponent.getInstance().getBoolean(MARK_ALL_REFERENCED_VALUES_KEY, MARK_ALL_REFERENCED_VALUES_DEFAULT_VALUE)); init(); } @Override protected void doOKAction() { if (mySuggestAdditionalMarkup) { - PropertiesComponent.getInstance().setValue(MARK_ALL_REFERENCED_VALUES_KEY, Boolean.toString(myCbMarkAdditionalFields.isSelected())); + PropertiesComponent.getInstance().setValue(MARK_ALL_REFERENCED_VALUES_KEY, myCbMarkAdditionalFields.isSelected(), MARK_ALL_REFERENCED_VALUES_DEFAULT_VALUE); } super.doOKAction(); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerParametersRunnerConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerParametersRunnerConfigurable.java index 59073f3cd373..baf7072785b9 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerParametersRunnerConfigurable.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/GenericDebuggerParametersRunnerConfigurable.java @@ -26,7 +26,6 @@ import com.intellij.openapi.options.ShowSettingsUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtilRt; -import com.intellij.ui.PortField; import com.intellij.xdebugger.impl.settings.DebuggerConfigurable; import org.jetbrains.annotations.NotNull; @@ -40,7 +39,7 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor< private JTextField myAddressField; private JPanel myShMemPanel; private JPanel myPortPanel; - private PortField myPortField; + private JTextField myPortField; private boolean myIsLocal = false; private JButton myDebuggerSettings; private JRadioButton mySocketTransport; @@ -94,7 +93,6 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor< myPortPanel.setVisible(isSocket()); myShMemPanel.setVisible(!isSocket()); myAddressField.setEditable(!myIsLocal); - myPortField.setEditable(!myIsLocal); mySocketTransport.setEnabled(!myIsLocal); myShmemTransport.setEnabled(!myIsLocal); } @@ -142,7 +140,7 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor< private String getPort() { if (isSocket()) { - return String.valueOf(myPortField.getNumber()); + return String.valueOf(myPortField.getText()); } else { return myAddressField.getText(); @@ -150,10 +148,18 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor< } private void checkPort() throws ConfigurationException { - if (isSocket() && !myPortField.isSpecified()) { + if (isSocket() && parsePort() == 0) { throw new ConfigurationException(DebuggerBundle.message("error.text.invalid.port")); } } + private int parsePort() { + try { + return Math.max(0, Integer.parseInt(myPortField.getText())); + } + catch (NumberFormatException e) { + return 0; + } + } private void setTransport(int transport) { mySocketTransport.setSelected(transport == DebuggerSettings.SOCKET_TRANSPORT); @@ -168,7 +174,7 @@ public class GenericDebuggerParametersRunnerConfigurable extends SettingsEditor< private void setPort(String port) { if (isSocket()) { - myPortField.setNumber(StringUtilRt.parseInt(port, 0)); + myPortField.setText(String.valueOf(StringUtilRt.parseInt(port, 0))); } else { myAddressField.setText(port); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/GenericDebuggerParametersPatcherConfigurable.form b/java/debugger/impl/src/com/intellij/debugger/ui/GenericDebuggerParametersPatcherConfigurable.form index 3cb1ef9bf190..d4c5f184e324 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/GenericDebuggerParametersPatcherConfigurable.form +++ b/java/debugger/impl/src/com/intellij/debugger/ui/GenericDebuggerParametersPatcherConfigurable.form @@ -52,11 +52,13 @@ - + - + + + diff --git a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java index 47ebf9379eb9..2e0d33398975 100644 --- a/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java +++ b/java/execution/impl/src/com/intellij/execution/application/ApplicationRunLineMarkerProvider.java @@ -35,9 +35,9 @@ public class ApplicationRunLineMarkerProvider extends RunLineMarkerContributor { if (e instanceof PsiIdentifier) { PsiElement element = e.getParent(); if (element instanceof PsiClass && PsiMethodUtil.findMainInClass((PsiClass)element) != null) - return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.ACTIONS); + return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.ACTIONS(0)); if (element instanceof PsiMethod && "main".equals(((PsiMethod)element).getName()) && PsiMethodUtil.isMainMethod((PsiMethod)element)) - return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.ACTIONS); + return new Info(ApplicationConfigurationType.getInstance().getIcon(), null, ExecutorAction.ACTIONS(0)); } return null; } diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/LibraryEditingUtil.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/LibraryEditingUtil.java index 5be63aa9861c..01bae640c333 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/LibraryEditingUtil.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/LibraryEditingUtil.java @@ -182,7 +182,7 @@ public class LibraryEditingUtil { @Override public Icon getIconFor(LibraryType aValue) { - return aValue != null ? aValue.getIcon() : PlatformIcons.LIBRARY_ICON; + return aValue != null ? aValue.getIcon(null) : PlatformIcons.LIBRARY_ICON; } @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryPresentationManagerImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryPresentationManagerImpl.java index d5db34bcb5d3..39036239ebe3 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryPresentationManagerImpl.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraries/impl/LibraryPresentationManagerImpl.java @@ -38,6 +38,31 @@ import java.util.*; public class LibraryPresentationManagerImpl extends LibraryPresentationManager { private Map> myPresentationProviders; + public static List getLibraryKinds(@NotNull Library library, @Nullable StructureConfigurableContext context) { + final List result = new SmartList(); + final LibraryKind kind = ((LibraryEx)library).getKind(); + if (kind != null) { + result.add(kind); + } + final VirtualFile[] files = getLibraryFiles(library, context); + LibraryDetectionManager.getInstance().processProperties(Arrays.asList(files), new LibraryDetectionManager.LibraryPropertiesProcessor() { + @Override + public

boolean processProperties(@NotNull LibraryKind kind, @NotNull P properties) { + result.add(kind); + return true; + } + }); + return result; + } + + @NotNull + private static VirtualFile[] getLibraryFiles(@NotNull Library library, @Nullable StructureConfigurableContext context) { + if (((LibraryEx)library).isDisposed()) { + return VirtualFile.EMPTY_ARRAY; + } + return context != null ? context.getLibraryFiles(library, OrderRootType.CLASSES) : library.getFiles(OrderRootType.CLASSES); + } + private

LibraryPresentationProvider

getPresentationProvider(LibraryKind kind) { if (myPresentationProviders == null) { final Map> providers = new HashMap>(); @@ -62,9 +87,10 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager { @Override public Icon getCustomIcon(@NotNull Library library, StructureConfigurableContext context) { - final LibraryKind kind = ((LibraryEx)library).getKind(); + LibraryEx libraryEx = (LibraryEx)library; + final LibraryKind kind = libraryEx.getKind(); if (kind != null) { - return LibraryType.findByKind(kind).getIcon(); + return LibraryType.findByKind(kind).getIcon(libraryEx.getProperties()); } final List icons = getCustomIcons(library, context); if (icons.size() == 1) { @@ -83,7 +109,7 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager { public

boolean processProperties(@NotNull LibraryKind kind, @NotNull P properties) { final LibraryPresentationProvider

provider = getPresentationProvider(kind); if (provider != null) { - ContainerUtil.addIfNotNull(icons, provider.getIcon()); + ContainerUtil.addIfNotNull(icons, provider.getIcon(properties)); } return true; } @@ -117,23 +143,6 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager { }); } - public static List getLibraryKinds(@NotNull Library library, @Nullable StructureConfigurableContext context) { - final List result = new SmartList(); - final LibraryKind kind = ((LibraryEx)library).getKind(); - if (kind != null) { - result.add(kind); - } - final VirtualFile[] files = getLibraryFiles(library, context); - LibraryDetectionManager.getInstance().processProperties(Arrays.asList(files), new LibraryDetectionManager.LibraryPropertiesProcessor() { - @Override - public

boolean processProperties(@NotNull LibraryKind kind, @NotNull P properties) { - result.add(kind); - return true; - } - }); - return result; - } - @NotNull @Override public List getDescriptions(@NotNull Library library, StructureConfigurableContext context) { @@ -141,14 +150,6 @@ public class LibraryPresentationManagerImpl extends LibraryPresentationManager { return getDescriptions(files, Collections.emptySet()); } - @NotNull - private static VirtualFile[] getLibraryFiles(@NotNull Library library, @Nullable StructureConfigurableContext context) { - if (((LibraryEx)library).isDisposed()) { - return VirtualFile.EMPTY_ARRAY; - } - return context != null ? context.getLibraryFiles(library, OrderRootType.CLASSES) : library.getFiles(OrderRootType.CLASSES); - } - @NotNull @Override public List getDescriptions(@NotNull VirtualFile[] classRoots, final Set excludedKinds) { diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/CreateNewLibraryAction.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/CreateNewLibraryAction.java index 42861a4e84e4..6da7c1c6a004 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/CreateNewLibraryAction.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/CreateNewLibraryAction.java @@ -61,20 +61,6 @@ public class CreateNewLibraryAction extends DumbAwareAction { myProject = project; } - @Override - public void actionPerformed(AnActionEvent e) { - Library library = - createLibrary(myType, myLibrariesConfigurable.getTree(), myProject, myLibrariesConfigurable.getModelProvider().getModifiableModel()); - if (library == null) return; - - final BaseLibrariesConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myProject).getConfigurableFor(library); - final DefaultMutableTreeNode - libraryNode = MasterDetailsComponent.findNodeByObject((TreeNode)rootConfigurable.getTree().getModel().getRoot(), library); - rootConfigurable.selectNodeInTree(libraryNode); - LibraryEditingUtil.showDialogAndAddLibraryToDependencies(library, myProject, true); - } - - @Nullable public static Library createLibrary(@Nullable final LibraryType type, @NotNull final JComponent parentComponent, @NotNull final Project project, @NotNull final LibrariesModifiableModel modifiableModel) { @@ -82,7 +68,8 @@ public class CreateNewLibraryAction extends DumbAwareAction { if (configuration == null) return null; final LibraryType libraryType = configuration.getLibraryType(); final Library library = modifiableModel.createLibrary( - LibraryEditingUtil.suggestNewLibraryName(modifiableModel, configuration.getDefaultLibraryName()), libraryType != null ? libraryType.getKind() : null); + LibraryEditingUtil.suggestNewLibraryName(modifiableModel, configuration.getDefaultLibraryName()), + libraryType != null ? libraryType.getKind() : null); final NewLibraryEditor editor = new NewLibraryEditor(libraryType, configuration.getProperties()); configuration.addRoots(editor); @@ -136,9 +123,22 @@ public class CreateNewLibraryAction extends DumbAwareAction { for (LibraryType type : suitableTypes) { final String actionName = type.getCreateActionName(); if (actionName != null) { - actions.add(new CreateNewLibraryAction(actionName, type.getIcon(), type, librariesConfigurable, project)); + actions.add(new CreateNewLibraryAction(actionName, type.getIcon(null), type, librariesConfigurable, project)); } } return actions.toArray(new AnAction[actions.size()]); } + + @Override + public void actionPerformed(AnActionEvent e) { + Library library = + createLibrary(myType, myLibrariesConfigurable.getTree(), myProject, myLibrariesConfigurable.getModelProvider().getModifiableModel()); + if (library == null) return; + + final BaseLibrariesConfigurable rootConfigurable = ProjectStructureConfigurable.getInstance(myProject).getConfigurableFor(library); + final DefaultMutableTreeNode + libraryNode = MasterDetailsComponent.findNodeByObject((TreeNode)rootConfigurable.getTree().getModel().getRoot(), library); + rootConfigurable.selectNodeInTree(libraryNode); + LibraryEditingUtil.showDialogAndAddLibraryToDependencies(library, myProject, true); + } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java index 6b0b3b12928c..ff96f4025ca5 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/LambdaCanBeMethodReferenceInspection.java @@ -19,6 +19,8 @@ import com.intellij.codeInsight.FileModificationService; import com.intellij.codeInsight.daemon.GroupNames; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.Conditions; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; import com.intellij.psi.codeStyle.JavaCodeStyleManager; @@ -217,7 +219,26 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp } private static boolean checkQualifier(PsiElement qualifier) { - return !(qualifier instanceof PsiCallExpression); + if (qualifier == null) { + return true; + } + final Condition callExpressionCondition = Conditions.instanceOf(PsiCallExpression.class); + final Condition nonFinalFieldRefCondition = new Condition() { + @Override + public boolean value(PsiElement expression) { + if (expression instanceof PsiReferenceExpression) { + PsiElement element = ((PsiReferenceExpression)expression).resolve(); + if (element instanceof PsiField && !((PsiField)element).hasModifierProperty(PsiModifier.FINAL)) { + return true; + } + } + return false; + } + }; + return SyntaxTraverser + .psiTraverser() + .withRoot(qualifier) + .filter(Conditions.or(callExpressionCondition, nonFinalFieldRefCondition)).toList().isEmpty(); } @Nullable diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java b/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java index c3472a58937f..39a74f7a5e29 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/DefaultInsertHandler.java @@ -26,11 +26,9 @@ import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiDocumentManager; -import com.intellij.psi.PsiFile; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; -import org.jetbrains.annotations.NotNull; -public class DefaultInsertHandler extends TemplateInsertHandler implements Cloneable { +public class DefaultInsertHandler implements InsertHandler { public static final DefaultInsertHandler NO_TAIL_HANDLER = new DefaultInsertHandler(){ @Override @@ -40,13 +38,9 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone }; @Override - public void handleInsert(final InsertionContext context, LookupElement item) { - super.handleInsert(context, item); - - handleInsertInner(context, (LookupItem)item, context.getCompletionChar()); - } - - private void handleInsertInner(InsertionContext context, LookupItem item, final char completionChar) { + public void handleInsert(final InsertionContext context, LookupElement lookupElement) { + LookupItem item = (LookupItem)lookupElement; + char completionChar = context.getCompletionChar(); final Project project = context.getProject(); final Editor editor = context.getEditor(); final Document document = editor.getDocument(); @@ -170,11 +164,6 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone return editor.getCaretModel().getOffset(); } - @Override - protected void populateInsertMap(@NotNull final PsiFile file, @NotNull final OffsetMap offsetMap) { - JavaCompletionUtil.initOffsets(file, offsetMap); - } - public static class InsertHandlerState{ int tailOffset; int caretOffset; diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index c0f82668f74a..785486644cfb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -250,7 +250,6 @@ public class JavaMethodCallElement extends LookupItem implements Type presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(this, presentation.isReal())); presentation.setStrikeout(JavaElementLookupRenderer.isToStrikeout(this)); - presentation.setItemTextBold(getAttribute(HIGHLIGHTED_ATTR) != null); MemberLookupHelper helper = myHelper != null ? myHelper : new MemberLookupHelper(myMethod, myContainingClass, false, false); final Boolean qualify = getAttribute(FORCE_QUALIFY) != null ? Boolean.TRUE : myHelper == null ? Boolean.FALSE : null; diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaPsiClassReferenceElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaPsiClassReferenceElement.java index a5fcdadeaf06..789117879bd2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaPsiClassReferenceElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaPsiClassReferenceElement.java @@ -147,11 +147,9 @@ public class JavaPsiClassReferenceElement extends LookupItem { presentation.setIcon(DefaultLookupItemRenderer.getRawIcon(item, presentation.isReal())); } - final boolean bold = item.getAttribute(LookupItem.HIGHLIGHTED_ATTR) != null; boolean strikeout = JavaElementLookupRenderer.isToStrikeout(item); presentation.setItemText(getName(psiClass, item, diamond)); presentation.setStrikeout(strikeout); - presentation.setItemTextBold(bold); String tailText = getLocationString(item); PsiSubstitutor substitutor = (PsiSubstitutor)item.getAttribute(LookupItem.SUBSTITUTOR); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionTemplateItem.java b/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionTemplateItem.java index 3936b22bf89d..fd5cd78f3b8d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionTemplateItem.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/SmartCompletionTemplateItem.java @@ -1,32 +1,29 @@ package com.intellij.codeInsight.completion; -import com.intellij.codeInsight.lookup.LookupItem; import com.intellij.codeInsight.lookup.TypedLookupItem; import com.intellij.codeInsight.template.Template; +import com.intellij.codeInsight.template.impl.LiveTemplateLookupElementImpl; import com.intellij.codeInsight.template.impl.TemplateImpl; import com.intellij.psi.JavaPsiFacade; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiExpression; import com.intellij.psi.PsiType; import com.intellij.util.IncorrectOperationException; -import org.jetbrains.annotations.NonNls; /** * @author peter */ -public class SmartCompletionTemplateItem extends LookupItem