Merge remote branch 'origin/master'

This commit is contained in:
Dmitry Cheryasov
2011-06-04 19:19:17 +03:00
61 changed files with 702 additions and 400 deletions
+1 -1
View File
@@ -8,4 +8,4 @@
<root url="jar://$PROJECT_DIR$/lib/src/xpp3-1.1.4-min-src.jar!/" />
</SOURCES>
</library>
</component>
</component>
+3
View File
@@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="IDEA Test Sources" pattern="test:*..*" />
</component>
+5
View File
@@ -0,0 +1,5 @@
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.debugger.ui.CompletionEditor;
import com.intellij.debugger.ui.DebuggerExpressionComboBox;
import com.intellij.debugger.ui.DebuggerStatementEditor;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.ide.util.ClassFilter;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
@@ -190,7 +191,7 @@ public abstract class BreakpointPropertiesPanel {
final JComboBox baseBreakpointCombo = new ComboBox();
myBreakpointComboboxHandler = new BreakpointComboboxHandler(myProject, baseBreakpointCombo);
baseBreakpointCombo.setRenderer(new BreakpointComboRenderer());
baseBreakpointCombo.setRenderer(new BreakpointComboRenderer(baseBreakpointCombo.getRenderer()));
baseBreakpointCombo.addItemListener(new ItemListener() {
public void itemStateChanged(final ItemEvent e) {
ComboboxItem item = (ComboboxItem)baseBreakpointCombo.getSelectedItem();
@@ -674,29 +675,29 @@ public abstract class BreakpointPropertiesPanel {
}
}
private static class BreakpointComboRenderer extends DefaultListCellRenderer {
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
setPreferredSize(new Dimension(MAX_COMBO_WIDTH, getPreferredSize().height));
private static class BreakpointComboRenderer extends ListCellRendererWrapper {
public BreakpointComboRenderer(final ListCellRenderer listCellRenderer) {
super(listCellRenderer);
}
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
Breakpoint breakpoint = ((ComboboxItem)value).getBreakpoint();
final String text = breakpoint != null ? breakpoint.getDisplayName() : DebuggerBundle.message("value.none");
setText(text);
final Icon icon;
if (breakpoint != null) {
icon = breakpoint instanceof BreakpointWithHighlighter ?
breakpoint.ENABLED? ((BreakpointWithHighlighter)breakpoint).getSetIcon(false) : ((BreakpointWithHighlighter)breakpoint)
.getDisabledIcon(false) : breakpoint.getIcon();
icon = breakpoint instanceof BreakpointWithHighlighter
? breakpoint.ENABLED
? ((BreakpointWithHighlighter)breakpoint).getSetIcon(false)
: ((BreakpointWithHighlighter)breakpoint).getDisabledIcon(false)
: breakpoint.getIcon();
}
else {
icon = null;
}
setIcon(icon);
setDisabledIcon(icon);
return this;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,13 +15,13 @@
*/
package com.intellij.facet.impl.ui.libraries;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer;
import com.intellij.ui.EnumComboBoxModel;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
@@ -40,15 +40,13 @@ class LibraryNameAndLevelPanel {
levels.put(LibrariesContainer.LibraryLevel.GLOBAL, ProjectBundle.message("combobox.item.global.library"));
levels.put(LibrariesContainer.LibraryLevel.PROJECT, ProjectBundle.message("combobox.item.project.library"));
levels.put(LibrariesContainer.LibraryLevel.MODULE, ProjectBundle.message("combobox.item.module.library"));
myLevelComboBox.setRenderer(new DefaultListCellRenderer() {
myLevelComboBox.setRenderer(new ListCellRendererWrapper(myLevelComboBox.getRenderer()) {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof LibrariesContainer.LibraryLevel) {
final LibrariesContainer.LibraryLevel level = (LibrariesContainer.LibraryLevel)value;
setText(levels.get(level));
}
return component;
}
});
myLevelComboBox.setModel(new EnumComboBoxModel<LibrariesContainer.LibraryLevel>(LibrariesContainer.LibraryLevel.class));
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
@@ -26,7 +27,6 @@ import com.intellij.util.ui.FormBuilder;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
import java.util.List;
/**
@@ -48,14 +48,12 @@ public class CreateNewLibraryDialog extends LibraryEditorDialogBase {
}
myLibraryLevelCombobox = new ComboBox(model);
myLibraryLevelCombobox.setSelectedIndex(selectedTable);
myLibraryLevelCombobox.setRenderer(new DefaultListCellRenderer() {
myLibraryLevelCombobox.setRenderer(new ListCellRendererWrapper(myLibraryLevelCombobox.getRenderer()) {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof LibraryTable) {
setText(((LibraryTable)value).getPresentation().getDisplayName(false));
}
return component;
}
});
init();
@@ -26,6 +26,7 @@ import com.intellij.openapi.progress.ProgressManager;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.RedundantCastUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.IncorrectOperationException;
@@ -34,6 +35,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;
class ControlFlowAnalyzer extends JavaElementVisitor {
@@ -525,13 +527,20 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
startElement(switchStmt);
PsiElementFactory psiFactory = JavaPsiFacade.getInstance(switchStmt.getProject()).getElementFactory();
PsiExpression caseExpression = switchStmt.getExpression();
Set<PsiEnumConstant> enumVals = null;
if (caseExpression != null /*&& !(caseExpression instanceof PsiReferenceExpression)*/) {
caseExpression.accept(this);
generateBoxingUnboxingInstructionFor(caseExpression, PsiType.INT);
if (TypeConversionUtil.isEnumType(caseExpression.getType())) {
final PsiClass psiClass = PsiUtil.resolveClassInType(caseExpression.getType());
if (psiClass != null && psiClass.isEnum()) {
addInstruction(new FieldReferenceInstruction(caseExpression, "switch statement expression"));
enumVals = new HashSet<PsiEnumConstant>();
for (PsiField f : psiClass.getFields()) {
if (f instanceof PsiEnumConstant) {
enumVals.add((PsiEnumConstant)f);
}
}
} else {
addInstruction(new PopInstruction());
}
@@ -567,6 +576,12 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
addInstruction(new ConditionalGotoInstruction(offset, false, statement));
if (enumVals != null) {
if (caseValue instanceof PsiReferenceExpression) {
enumVals.remove(((PsiReferenceExpression)caseValue).resolve());
}
}
}
catch (IncorrectOperationException e) {
LOG.error(e);
@@ -575,8 +590,10 @@ class ControlFlowAnalyzer extends JavaElementVisitor {
}
}
int offset = defaultLabel != null ? getStartOffset(defaultLabel) : getEndOffset(body);
addInstruction(new GotoInstruction(offset));
if (enumVals == null || !enumVals.isEmpty()) {
int offset = defaultLabel != null ? getStartOffset(defaultLabel) : getEndOffset(body);
addInstruction(new GotoInstruction(offset));
}
body.accept(this);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,15 +16,24 @@
package com.intellij.codeInspection.internal;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.InheritanceUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class GtkPreferredJComboBoxRendererInspection extends InternalInspection {
private static final String RENDERER_CLASS_NAME = DefaultListCellRenderer.class.getName();
private static final String MESSAGE = "Please use ListCellRendererWrapper instead to prevent artifacts under GTK+ Look and Feel.";
private static final String COMBO_BOX_CLASS_NAME = JComboBox.class.getName();
private static final String RIGHT_RENDERER_CLASS_NAME = ListCellRendererWrapper.class.getName();
private static final String SETTER_METHOD_NAME = "setRenderer";
private static final String MESSAGE =
"Default ListCellRenderer implementations are known to cause UI artifacts under GTK+ Look and Feel," +
"so please use ListCellRendererWrapper instead.";
@Nls
@NotNull
@@ -40,26 +49,32 @@ public class GtkPreferredJComboBoxRendererInspection extends InternalInspection
}
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly) {
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
return new JavaElementVisitor() {
@Override
public void visitReferenceExpression(PsiReferenceExpression expression) {
}
public void visitMethodCallExpression(final PsiMethodCallExpression expression) {
super.visitMethodCallExpression(expression);
@Override
public void visitClass(final PsiClass aClass) {
final PsiClass superClass = aClass.getSuperClass();
if (superClass != null && RENDERER_CLASS_NAME.equals(superClass.getQualifiedName())){
final PsiIdentifier nameIdentifier = aClass.getNameIdentifier();
holder.registerProblem(nameIdentifier != null ? nameIdentifier : aClass, MESSAGE);
}
}
final Project project = expression.getProject();
final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
@Override
public void visitAnonymousClass(final PsiAnonymousClass aClass) {
if (RENDERER_CLASS_NAME.equals(aClass.getBaseClassReference().getQualifiedName())){
holder.registerProblem(aClass.getBaseClassReference(), MESSAGE);
}
final PsiElement target = expression.getMethodExpression().resolve();
if (!(target instanceof PsiMethod)) return;
final PsiMethod method = (PsiMethod)target;
if (!SETTER_METHOD_NAME.equals(method.getName())) return;
final PsiClass aClass = ((PsiMethod)target).getContainingClass();
final PsiClass comboClass = facade.findClass(COMBO_BOX_CLASS_NAME, GlobalSearchScope.allScope(project));
if (!InheritanceUtil.isInheritorOrSelf(aClass, comboClass, true)) return;
final PsiExpression[] arguments = expression.getArgumentList().getExpressions();
if (arguments.length != 1) return;
final PsiType type = arguments[0].getType();
if (!(type instanceof PsiClassType)) return;
final PsiClass rendererClass = ((PsiClassType)type).resolve();
final PsiClass rightClass = facade.findClass(RIGHT_RENDERER_CLASS_NAME, GlobalSearchScope.allScope(project));
if (InheritanceUtil.isInheritorOrSelf(rendererClass, rightClass, true)) return;
holder.registerProblem(expression, MESSAGE);
}
};
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ import com.intellij.ExtensionPoints;
import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInspection.*;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.LanguageLevelUtil;
@@ -39,6 +40,7 @@ import gnu.trove.THashSet;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -71,6 +73,7 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
loadForbiddenApi("ignore16List.txt", ourIgnored16ClassesAPI);
}
@Nullable
private static Set<String> getForbiddenApi(@NotNull LanguageLevel languageLevel) {
if (!ourPresentableShortMessage.containsKey(languageLevel)) return null;
Reference<Set<String>> ref = ourForbiddenAPI.get(languageLevel);
@@ -84,34 +87,22 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
}
private static void loadForbiddenApi(@NonNls String fileName, Set<String> set) {
BufferedReader reader = null;
try {
final InputStream stream = Java15APIUsageInspection.class.getResourceAsStream(fileName);
reader = new BufferedReader(new InputStreamReader(stream, CharsetToolkit.UTF8_CHARSET));
do {
String line = reader.readLine();
if (line == null) break;
set.add(line);
} while(true);
}
catch (UnsupportedEncodingException e) {
// can't be.
}
catch (IOException e) {
// can't be
}
finally {
if (reader != null) {
try {
reader.close();
}
catch (IOException e) {
// Will not happen
}
final BufferedReader reader = new BufferedReader(new InputStreamReader(stream, CharsetToolkit.UTF8_CHARSET));
try {
do {
String line = reader.readLine();
if (line == null) break;
set.add(line);
} while(true);
}
finally {
reader.close();
}
}
catch (UnsupportedEncodingException ignored) { }
catch (IOException ignored) { }
}
@NotNull
@@ -186,13 +177,12 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
cModel.addElement(level);
}
llCombo.setSelectedItem(myEffectiveLanguageLevel != null ? myEffectiveLanguageLevel : LanguageLevel.JDK_1_3);
llCombo.setRenderer(new DefaultListCellRenderer(){
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
llCombo.setRenderer(new ListCellRendererWrapper(llCombo.getRenderer()) {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof LanguageLevel) {
setText(((LanguageLevel)value).getPresentableText());
}
return rendererComponent;
}
});
llCombo.addActionListener(new ActionListener() {
@@ -348,7 +338,8 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
private static boolean isForbiddenSignature(@NotNull PsiMember member, @NotNull LanguageLevel languageLevel) {
Set<String> forbiddenApi = getForbiddenApi(languageLevel);
return forbiddenApi != null && isForbiddenSignature(getSignature(member), languageLevel, forbiddenApi);
String signature = getSignature(member);
return forbiddenApi != null && signature != null && isForbiddenSignature(signature, languageLevel, forbiddenApi);
}
private static boolean isForbiddenSignature(@NotNull String signature, @NotNull LanguageLevel languageLevel, @NotNull Set<String> forbiddenApi) {
@@ -363,6 +354,7 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
return nextForbiddenApi != null && isForbiddenSignature(signature, nextLanguageLevel, nextForbiddenApi);
}
@Nullable
public static String getSignature(PsiMember member) {
if (member instanceof PsiClass) {
return ((PsiClass)member).getQualifiedName();
@@ -388,5 +380,4 @@ public class Java15APIUsageInspection extends BaseJavaLocalInspectionTool {
assert false;
return null;
}
}
@@ -123,9 +123,12 @@ public class RefClassImpl extends RefJavaElementImpl implements RefClass {
setServlet(servlet != null && psiClass.isInheritor(servlet, true));
}
if (!isApplet() && !isServlet()) {
setTestCase(TestUtil.isTestClass(psiClass));
for (RefClass refBase : getBaseClasses()) {
((RefClassImpl)refBase).setTestCase(true);
final boolean isTestClass = TestUtil.isTestClass(psiClass);
setTestCase(isTestClass);
if (isTestClass) {
for (RefClass refBase : getBaseClasses()) {
((RefClassImpl)refBase).setTestCase(true);
}
}
}
@@ -406,7 +406,7 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
Pair<PsiType, ConstraintType> substitution = null;
if (owner instanceof PsiMethod && parent instanceof PsiCallExpression) {
PsiCallExpression methodCall = (PsiCallExpression)parent;
substitution = inferMethodTypeParameterFromParent(methodCall.getParent(), methodCall, typeParameter, substitutor, forCompletion);
substitution = inferMethodTypeParameterFromParent(skipParenthesizedExprUp(methodCall.getParent()), methodCall, typeParameter, substitutor, forCompletion);
}
return substitution;
}
@@ -612,11 +612,15 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
Pair<PsiType, ConstraintType> constraint = null;
PsiType expectedType = null;
if (parent instanceof PsiVariable && methodCall.equals(((PsiVariable)parent).getInitializer())) {
expectedType = ((PsiVariable)parent).getType();
if (parent instanceof PsiVariable) {
if (methodCall.equals(skipParenthesizedExprDown(((PsiVariable)parent).getInitializer()))) {
expectedType = ((PsiVariable)parent).getType();
}
}
else if (parent instanceof PsiAssignmentExpression && methodCall.equals(((PsiAssignmentExpression)parent).getRExpression())) {
expectedType = ((PsiAssignmentExpression)parent).getLExpression().getType();
else if (parent instanceof PsiAssignmentExpression) {
if (methodCall.equals(skipParenthesizedExprDown(((PsiAssignmentExpression)parent).getRExpression()))) {
expectedType = ((PsiAssignmentExpression)parent).getLExpression().getType();
}
}
else if (parent instanceof PsiReturnStatement) {
PsiMethod method = PsiTreeUtil.getParentOfType(parent, PsiMethod.class);
@@ -702,6 +706,21 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
return result;
}
@Nullable
private static PsiExpression skipParenthesizedExprDown(PsiExpression initializer) {
while (initializer instanceof PsiParenthesizedExpression) {
initializer = ((PsiParenthesizedExpression)initializer).getExpression();
}
return initializer;
}
private static PsiElement skipParenthesizedExprUp(PsiElement parent) {
while (parent instanceof PsiParenthesizedExpression) {
parent = parent.getParent();
}
return parent;
}
@Nullable
private static Pair<PsiType, ConstraintType> inferTypeForCompletionFromCallContext(final PsiCallExpression innerMethodCall,
final PsiExpressionList expressionList,
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import com.intellij.refactoring.util.classMembers.MemberInfo;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -47,7 +48,6 @@ import java.util.Collections;
public class InheritanceToDelegationDialog extends RefactoringDialog {
private final PsiClass[] mySuperClasses;
private final PsiClass myClass;
private final HashMap<PsiClass, Collection<MemberInfo>> myBasesToMemberInfos;
@@ -91,6 +91,7 @@ public class InheritanceToDelegationDialog extends RefactoringDialog {
return myFieldNameField.getEnteredName();
}
@Nullable
public String getInnerClassName() {
if (myInnerClassNameField != null) {
return myInnerClassNameField.getEnteredName();
@@ -168,7 +169,7 @@ public class InheritanceToDelegationDialog extends RefactoringDialog {
gbc.insets = new Insets(4, 8, 0, 8);
myClassCombo = new JComboBox(mySuperClasses);
myClassCombo.setRenderer(new ClassCellRenderer());
myClassCombo.setRenderer(new ClassCellRenderer(myClassCombo.getRenderer()));
gbc.gridwidth = 2;
final JLabel classComboLabel = new JLabel();
panel.add(classComboLabel, gbc);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,15 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Created by IntelliJ IDEA.
* User: dsl
* Date: 18.06.2002
* Time: 13:16:29
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package com.intellij.refactoring.memberPullUp;
import com.intellij.openapi.help.HelpManager;
@@ -44,6 +35,7 @@ import com.intellij.refactoring.util.classMembers.UsesAndInterfacesDependencyMem
import com.intellij.ui.IdeBorderFactory;
import com.intellij.usageView.UsageViewUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -52,6 +44,10 @@ import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* @author dsl
* Date: 18.06.2002
*/
public class PullUpDialog extends RefactoringDialog {
private final Callback myCallback;
private MemberSelectionPanel myMemberSelectionPanel;
@@ -61,16 +57,13 @@ public class PullUpDialog extends RefactoringDialog {
private final MemberInfoStorage myMemberInfoStorage;
private List<MemberInfo> myMemberInfos;
private DocCommentPanel myJavaDocPanel;
private JComboBox myClassCombo;
public static interface Callback {
public interface Callback {
boolean checkConflicts(PullUpDialog dialog);
}
public PullUpDialog(Project project, PsiClass aClass, List<PsiClass> superClasses,
MemberInfoStorage memberInfoStorage, Callback callback) {
public PullUpDialog(Project project, PsiClass aClass, List<PsiClass> superClasses, MemberInfoStorage memberInfoStorage, Callback callback) {
super(project, true);
myClass = aClass;
mySuperClasses = superClasses;
@@ -83,6 +76,7 @@ public class PullUpDialog extends RefactoringDialog {
init();
}
@Nullable
public PsiClass getSuperClass() {
if (myClassCombo != null) {
return (PsiClass) myClassCombo.getSelectedItem();
@@ -133,10 +127,9 @@ public class PullUpDialog extends RefactoringDialog {
panel.add(classComboLabel, gbConstraints);
myClassCombo = new JComboBox(mySuperClasses.toArray());
myClassCombo.setRenderer(new ClassCellRenderer());
myClassCombo.setRenderer(new ClassCellRenderer(myClassCombo.getRenderer()));
classComboLabel.setText(RefactoringBundle.message("pull.up.members.to", UsageViewUtil.getLongName(myClass)));
classComboLabel.setLabelFor(myClassCombo);
// myClassCombo.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
PsiClass nearestBase = RefactoringHierarchyUtil.getNearestBaseClass(myClass, false);
int indexToSelect = 0;
@@ -210,7 +203,6 @@ public class PullUpDialog extends RefactoringDialog {
super(myClass, getSuperClass(), false, myInterfaceContainmentVerifier);
}
public boolean isMemberEnabled(MemberInfo member) {
PsiClass currentSuperClass = getSuperClass();
if(currentSuperClass == null) return true;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,15 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Created by IntelliJ IDEA.
* User: dsl
* Date: 06.06.2002
* Time: 11:30:13
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package com.intellij.refactoring.turnRefsToSuper;
import com.intellij.openapi.help.HelpManager;
@@ -37,11 +28,16 @@ import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.components.JBList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.List;
/**
* @author dsl
* Date: 06.06.2002
*/
public class TurnRefsToSuperDialog extends RefactoringDialog {
@NotNull private final PsiClass mySubClass;
private final List mySuperClasses;
@@ -59,6 +55,7 @@ public class TurnRefsToSuperDialog extends RefactoringDialog {
init();
}
@Nullable
public PsiClass getSuperClass() {
if(mySuperClassesList != null) {
return (PsiClass) mySuperClassesList.getSelectedValue();
@@ -99,7 +96,7 @@ public class TurnRefsToSuperDialog extends RefactoringDialog {
panel.add(classListLabel, gbConstraints);
mySuperClassesList = new JBList(mySuperClasses.toArray());
mySuperClassesList.setCellRenderer(new ClassCellRenderer());
mySuperClassesList.setCellRenderer(new ClassCellRenderer(mySuperClassesList.getCellRenderer()));
mySuperClassesList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
classListLabel.setText(RefactoringBundle.message("turnRefsToSuper.change.usages.to", mySubClass.getQualifiedName()));
@@ -127,9 +124,10 @@ public class TurnRefsToSuperDialog extends RefactoringDialog {
protected void doAction() {
JavaRefactoringSettings.getInstance().TURN_REFS_TO_SUPER_PREVIEW_USAGES = isPreviewUsages();
final TurnRefsToSuperProcessor processor = new TurnRefsToSuperProcessor(
getProject(), mySubClass, getSuperClass(), isUseInInstanceOf());
invokeRefactoring(processor);
final PsiClass superClass = getSuperClass();
if (superClass != null) {
invokeRefactoring(new TurnRefsToSuperProcessor(getProject(), mySubClass, superClass, isUseInInstanceOf()));
}
}
protected JComponent createCenterPanel() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,66 +13,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Created by IntelliJ IDEA.
* User: dsl
* Date: 18.06.2002
* Time: 13:47:11
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package com.intellij.refactoring.ui;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.util.Iconable;
import com.intellij.psi.PsiClass;
import com.intellij.refactoring.RefactoringBundle;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
/**
* Renders a list cell which contains a class
* Renders a list cell which contains a class.
*
* @author dsl
* Date: 18.06.2002
*/
public class ClassCellRenderer extends DefaultListCellRenderer {
public class ClassCellRenderer extends ListCellRendererWrapper<PsiClass> {
private final boolean myShowReadOnly;
public ClassCellRenderer() {
setOpaque(true);
public ClassCellRenderer(ListCellRenderer original) {
super(original);
myShowReadOnly = true;
}
public ClassCellRenderer(boolean showReadOnly) {
setOpaque(true);
myShowReadOnly = showReadOnly;
}
@Override
public void customize(JList list, PsiClass aClass, int index, boolean selected, boolean hasFocus) {
if (aClass != null) {
setText(getClassText(aClass));
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
return customizeRenderer(this, value, myShowReadOnly);
int flags = Iconable.ICON_FLAG_VISIBILITY;
if (myShowReadOnly) {
flags |= Iconable.ICON_FLAG_READ_STATUS;
}
Icon icon = aClass.getIcon(flags);
if (icon != null) {
setIcon(icon);
}
}
return rendererComponent;
}
public static JLabel customizeRenderer(final JLabel cellRendererComponent, @NotNull final Object value, final boolean showReadOnly) {
PsiClass aClass = (PsiClass) value;
cellRendererComponent.setText(getClassText(aClass));
int flags = Iconable.ICON_FLAG_VISIBILITY;
if (showReadOnly) {
flags |= Iconable.ICON_FLAG_READ_STATUS;
}
Icon icon = aClass.getIcon(flags);
if(icon != null) {
cellRendererComponent.setIcon(icon);
}
return cellRendererComponent;
}
private static String getClassText(@NotNull PsiClass aClass) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package com.intellij.refactoring.util;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.refactoring.ui.TypeSelector;
@@ -24,9 +25,10 @@ import com.intellij.ui.BooleanTableCellRenderer;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.TableUtil;
import com.intellij.ui.UIBundle;
import com.intellij.ui.table.JBTable;
import com.intellij.util.ui.AbstractTableCellEditor;
import com.intellij.util.ui.Table;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -45,7 +47,7 @@ public abstract class ParameterTablePanel extends JPanel {
private final VariableData[] myVariableData;
private final TypeSelector[] myParameterTypeSelectors;
private final Table myTable;
private final JBTable myTable;
private final MyTableModel myTableModel;
private final JButton myUpButton;
private final JButton myDownButton;
@@ -88,7 +90,7 @@ public abstract class ParameterTablePanel extends JPanel {
myVariableData = variableData;
myTableModel = new MyTableModel();
myTable = new Table(myTableModel);
myTable = new JBTable(myTableModel);
DefaultCellEditor defaultEditor = (DefaultCellEditor)myTable.getDefaultEditor(Object.class);
defaultEditor.setClickCountToStart(1);
@@ -122,28 +124,24 @@ public abstract class ParameterTablePanel extends JPanel {
myTypeRendererCombo = new JComboBox(getVariableData());
myTypeRendererCombo.setOpaque(true);
myTypeRendererCombo.setBorder(null);
myTypeRendererCombo.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(final JList list,
final Object value,
final int index, final boolean isSelected, final boolean cellHasFocus) {
setText(((VariableData)value).type.getPresentableText());
return this;
myTypeRendererCombo.setRenderer(new ListCellRendererWrapper<VariableData>(myTypeRendererCombo.getRenderer()) {
@Override
public void customize(JList list, VariableData value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
setText(value.type.getPresentableText());
}
}
});
myTable.getColumnModel().getColumn(MyTableModel.PARAMETER_TYPE_COLUMN).setCellEditor(new AbstractTableCellEditor() {
TypeSelector myCurrentSelector;
@Nullable
public Object getCellEditorValue() {
return myCurrentSelector.getSelectedType();
}
public Component getTableCellEditorComponent(final JTable table,
final Object value,
final boolean isSelected,
final int row,
final int column) {
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
myCurrentSelector = myParameterTypeSelectors[row];
return myCurrentSelector.getComponent();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package com.intellij.refactoring.wrapreturnvalue;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.ide.util.TreeClassChooser;
import com.intellij.ide.util.TreeClassChooserFactory;
import com.intellij.openapi.help.HelpManager;
@@ -39,7 +40,6 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -107,7 +107,10 @@ class WrapReturnValueDialog extends RefactoringDialog {
if (myCreateInnerClassButton.isSelected()) {
final String innerClassName = getInnerClassName().trim();
if (!nameHelper.isIdentifier(innerClassName)) throw new ConfigurationException("\'" + innerClassName + "\' is invalid inner class name");
if (sourceMethod.getContainingClass().findInnerClassByName(innerClassName, false) != null) throw new ConfigurationException("Inner class with name \'" + innerClassName + "\' already exist");
final PsiClass containingClass = sourceMethod.getContainingClass();
if (containingClass != null && containingClass.findInnerClassByName(innerClassName, false) != null) {
throw new ConfigurationException("Inner class with name \'" + innerClassName + "\' already exist");
}
} else if (useExistingClassButton.isSelected()) {
final String className = existingClassField.getText().trim();
if (className.length() == 0 || !nameHelper.isQualifiedName(className)) {
@@ -168,7 +171,10 @@ class WrapReturnValueDialog extends RefactoringDialog {
}
final PsiClass containingClass = sourceMethod.getContainingClass();
final String containingClassName = containingClass instanceof PsiAnonymousClass ? "Anonymous " + ((PsiAnonymousClass)containingClass).getBaseClassType().getClassName() : containingClass.getName();
assert containingClass != null : sourceMethod;
final String containingClassName = containingClass instanceof PsiAnonymousClass
? "Anonymous " + ((PsiAnonymousClass)containingClass).getBaseClassType().getClassName()
: containingClass.getName();
final String sourceMethodName = sourceMethod.getName();
sourceMethodTextField.setText(containingClassName + '.' + sourceMethodName);
final ButtonGroup buttonGroup = new ButtonGroup();
@@ -188,26 +194,21 @@ class WrapReturnValueDialog extends RefactoringDialog {
final DefaultComboBoxModel model = new DefaultComboBoxModel();
myFieldsCombo.setModel(model);
myFieldsCombo.setRenderer(new DefaultListCellRenderer(){
myFieldsCombo.setRenderer(new ListCellRendererWrapper(myFieldsCombo.getRenderer()) {
@Override
public Component getListCellRendererComponent(final JList list,
final Object value,
final int index,
final boolean isSelected,
final boolean cellHasFocus) {
final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof PsiField) {
final PsiField field = (PsiField)value;
setText(field.getName());
setIcon(field.getIcon(Iconable.ICON_FLAG_VISIBILITY));
}
return rendererComponent;
}
});
existingClassField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentAdapter() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
final PsiClass currentClass = JavaPsiFacade.getInstance(myProject).findClass(existingClassField.getText(), GlobalSearchScope.allScope(myProject));
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject);
final PsiClass currentClass = facade.findClass(existingClassField.getText(), GlobalSearchScope.allScope(myProject));
if (currentClass != null) {
model.removeAllElements();
for (PsiField field : currentClass.getFields()) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author cdr
*/
package com.intellij.unscramble;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.extensions.Extensions;
@@ -50,7 +47,10 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class UnscrambleDialog extends DialogWrapper{
/**
* @author cdr
*/
public class UnscrambleDialog extends DialogWrapper {
@NonNls private static final String PROPERTY_LOG_FILE_HISTORY_URLS = "UNSCRAMBLE_LOG_FILE_URL";
@NonNls private static final String PROPERTY_LOG_FILE_LAST_URL = "UNSCRAMBLE_LOG_FILE_LAST_URL";
@NonNls private static final String PROPERTY_UNSCRAMBLER_NAME_USED = "UNSCRAMBLER_NAME_USED";
@@ -204,17 +204,13 @@ public class UnscrambleDialog extends DialogWrapper{
private void populateRegisteredUnscramblerList() {
List<UnscrambleSupport> unscrambleComponents = getRegisteredUnscramblers();
//myUnscrambleChooser.addItem(null);
for (final UnscrambleSupport unscrambleSupport : unscrambleComponents) {
myUnscrambleChooser.addItem(unscrambleSupport);
}
myUnscrambleChooser.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
UnscrambleSupport unscrambleSupport = (UnscrambleSupport)value;
myUnscrambleChooser.setRenderer(new ListCellRendererWrapper<UnscrambleSupport>(myUnscrambleChooser.getRenderer()) {
@Override
public void customize(JList list, UnscrambleSupport unscrambleSupport, int index, boolean selected, boolean hasFocus) {
setText(unscrambleSupport == null ? IdeBundle.message("unscramble.no.unscrambler.item") : unscrambleSupport.getPresentableName());
return this;
}
});
}
@@ -291,7 +287,7 @@ public class UnscrambleDialog extends DialogWrapper{
}
if (!first && mustHaveNewLineBefore(line)) {
builder.append("\n");
if (line.startsWith("\"")) builder.append("\n"); // Additional linebreak for thread names
if (line.startsWith("\"")) builder.append("\n"); // Additional line break for thread names
}
first = false;
int i = builder.lastIndexOf("\n");
@@ -312,12 +308,12 @@ public class UnscrambleDialog extends DialogWrapper{
}
private static boolean mustHaveNewLineBefore(String line) {
final int nonws = CharArrayUtil.shiftForward(line, 0, " \t");
if (nonws < line.length()) {
line = line.substring(nonws);
final int nonWs = CharArrayUtil.shiftForward(line, 0, " \t");
if (nonWs < line.length()) {
line = line.substring(nonWs);
}
if (line.startsWith("at")) return true; // Start of the new stackframe entry
if (line.startsWith("at")) return true; // Start of the new stack frame entry
if (line.startsWith("Caused")) return true; // Caused by message
if (line.startsWith("- locked")) return true; // "Locked a monitor" logging
if (line.startsWith("- waiting")) return true; // "Waiting for monitor" logging
@@ -135,3 +135,21 @@ class TestLocal<X> {
class QualifiedTest {
java.util.Map<String, String> s = new java.util.HashMap<>();
}
class TZ {
}
class ParenthTest<T extends TZ> {
public ParenthTest(T x) {
}
public T z = null;
public int a() {
ParenthTest<T> x = (new ParenthTest<>(null)); //red code is here
return 1;
}
}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
<problem>
<file>Test.java</file>
<line>72</line>
<description>Method invocation &lt;code&gt;foo.length()&lt;/code&gt; may produce &lt;code&gt;java.lang.NullPointerException&lt;/code&gt;</description>
</problem>
</problems>
@@ -0,0 +1,78 @@
public class Test {
void withDefaultWithoutBreak(MyEnum e) {
String foo = null;
switch (e) {
case FOO:
foo = "foo";
case BAR:
foo = "bar";
default:
foo = "default";
}
int l = foo.length();
}
void withDefaultWithBreak(MyEnum e) {
String foo = null;
switch (e) {
case FOO:
foo = "foo";
break;
case BAR:
foo = "bar";
break;
default:
foo = "default";
}
int l = foo.length();
}
void withDefaultWithoutBar(MyEnum e) {
String foo = null;
switch (e) {
case FOO:
foo = "foo";
break;
default:
foo = "default";
}
int l = foo.length();
}
void withoutDefaultWithBreak(MyEnum e) {
String foo = null;
switch (e) {
case FOO:
foo = "foo";
break;
case BAR:
foo = "bar";
break;
}
int l = foo.length();
}
void withoutDefaultWithoutBreak(MyEnum e) {
String foo = null;
switch (e) {
case FOO:
foo = "foo";
case BAR:
foo = "bar";
}
int l = foo.length();
}
void withoutDefaultWithoutBar(MyEnum e) {
String foo = null;
switch (e) {
case FOO:
foo = "foo";
}
int l = foo.length();
}
}
enum MyEnum {
FOO, BAR;
}
@@ -140,4 +140,5 @@ public class DataFlowInspectionTest extends InspectionTestCase {
public void testIDEADEV13156() throws Exception { doTest15(); }
//public void testIDEADEV11033() throws Exception { doTest15(); }
public void testSwitchEnumCases() throws Exception { doTest15(); }
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@ import org.jetbrains.annotations.Nullable;
import java.util.Set;
public class InheritanceUtil {
private InheritanceUtil() { }
/**
* @deprecated Use {@link PsiClass#isInheritor(com.intellij.psi.PsiClass, boolean)} instead.
*/
@@ -33,16 +35,19 @@ public class InheritanceUtil {
}
/**
* @param aClass a class to check.
* @param baseClass supposed base class.
* @param checkDeep true to check deeper than aClass.super (see {@linkplain PsiClass#isInheritor(com.intellij.psi.PsiClass, boolean)}).
* @return true if aClass is the baseClass or baseClass inheritor
*/
public static boolean isInheritorOrSelf(@Nullable PsiClass aClass, @Nullable PsiClass baseClass, boolean checkDeep) { //TODO: remove this method!!
public static boolean isInheritorOrSelf(@Nullable PsiClass aClass, @Nullable PsiClass baseClass, boolean checkDeep) {
if (aClass == null || baseClass == null) return false;
PsiManager manager = aClass.getManager();
return manager.areElementsEquivalent(baseClass, aClass) || aClass.isInheritor(baseClass, checkDeep);
}
/**
* @return true if aClass is the baseClass or baseClass inheritor
* @deprecated use {@linkplain #isInheritorOrSelf(com.intellij.psi.PsiClass, com.intellij.psi.PsiClass, boolean)}.
*/
public static boolean isCorrectDescendant(@Nullable PsiClass aClass, @Nullable PsiClass baseClass, boolean checkDeep) {
return isInheritorOrSelf(aClass, baseClass, checkDeep);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
package com.intellij.ide.util.frameworkSupport;
import com.intellij.facet.ui.libraries.LibraryInfo;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
@@ -44,7 +45,8 @@ public class FrameworkSupportConfigurableBase extends FrameworkSupportConfigurab
this(frameworkSupportProvider, model, Collections.<FrameworkVersion>emptyList(), null);
}
public FrameworkSupportConfigurableBase(final FrameworkSupportProviderBase frameworkSupportProvider, FrameworkSupportModel model, List<FrameworkVersion> versions, String versionLabelText) {
public FrameworkSupportConfigurableBase(FrameworkSupportProviderBase frameworkSupportProvider, FrameworkSupportModel model,
List<FrameworkVersion> versions, @Nullable String versionLabelText) {
myFrameworkSupportProvider = frameworkSupportProvider;
myFrameworkSupportModel = model;
if (versions.size() > 0) {
@@ -62,14 +64,12 @@ public class FrameworkSupportConfigurableBase extends FrameworkSupportConfigurab
}
}
myVersionComboBox.setPrototypeDisplayValue(maxValue + "_");
myVersionComboBox.setRenderer(new DefaultListCellRenderer() {
myVersionComboBox.setRenderer(new ListCellRendererWrapper(myVersionComboBox.getRenderer()) {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof FrameworkVersion) {
setText(((FrameworkVersion)value).getVersionName());
}
return component;
}
});
myVersionComboBox.setSelectedItem(defaultVersion);
@@ -101,5 +101,4 @@ public class FrameworkSupportConfigurableBase extends FrameworkSupportConfigurab
public FrameworkVersion getSelectedVersion() {
return (FrameworkVersion)myVersionComboBox.getSelectedItem();
}
}
@@ -23,15 +23,15 @@ import org.jetbrains.annotations.Nullable;
/**
* {@link LineWrapPositionStrategy} implementation that uses
* {@link LanguageLineWrapPositionStrategy#getDefaultImplementation() default line wrap strategy} but restricts its scope
* by {@link #PsiAwareDefaultLineWrapPositionStrategy(IElementType...) target tokens/elements}.
* by {@link #PsiAwareDefaultLineWrapPositionStrategy(boolean, IElementType...) target tokens/elements}.
*
* @author Denis Zhdanov
* @since 5/12/11 12:50 PM
*/
public class PsiAwareDefaultLineWrapPositionStrategy extends PsiAwareLineWrapPositionStrategy {
public PsiAwareDefaultLineWrapPositionStrategy(@NotNull IElementType ... enabledTypes) {
super(enabledTypes);
public PsiAwareDefaultLineWrapPositionStrategy(boolean nonVirtualOnly, @NotNull IElementType ... enabledTypes) {
super(nonVirtualOnly, enabledTypes);
}
@Override
@@ -40,10 +40,11 @@ public class PsiAwareDefaultLineWrapPositionStrategy extends PsiAwareLineWrapPos
int startOffset,
int endOffset,
int maxPreferredOffset,
boolean allowToBeyondMaxPreferredOffset)
boolean allowToBeyondMaxPreferredOffset,
boolean virtual)
{
LineWrapPositionStrategy implementation = LanguageLineWrapPositionStrategy.INSTANCE.getDefaultImplementation();
return implementation.calculateWrapPosition(document, project, startOffset, endOffset, maxPreferredOffset,
allowToBeyondMaxPreferredOffset);
allowToBeyondMaxPreferredOffset, virtual);
}
}
@@ -39,14 +39,17 @@ public abstract class PsiAwareLineWrapPositionStrategy implements LineWrapPositi
private static final Logger LOG = Logger.getInstance("#" + PsiAwareLineWrapPositionStrategy.class.getName());
private final TokenSet myEnabledTypes;
private final boolean myNonVirtualOnly;
/**
* Creates new <code>PsiAwareLineWrapPositionStrategy</code> object.
*
* @param nonVirtualOnly defines if current PSI-aware logic should be exploited only for 'real wrap' position requests
* @param enabledTypes target element/token types where line wrapping is allowed
*/
public PsiAwareLineWrapPositionStrategy(@NotNull IElementType ... enabledTypes) {
public PsiAwareLineWrapPositionStrategy(boolean nonVirtualOnly, @NotNull IElementType ... enabledTypes) {
myEnabledTypes = TokenSet.create(enabledTypes);
myNonVirtualOnly = nonVirtualOnly;
if (enabledTypes.length <= 0) {
LOG.warn(String.format("%s instance is created with empty token/element types. That will lead to inability to perform line wrap",
getClass().getName()));
@@ -59,11 +62,19 @@ public abstract class PsiAwareLineWrapPositionStrategy implements LineWrapPositi
int startOffset,
int endOffset,
int maxPreferredOffset,
boolean allowToBeyondMaxPreferredOffset) {
boolean allowToBeyondMaxPreferredOffset,
boolean virtual) {
if (virtual && myNonVirtualOnly) {
LineWrapPositionStrategy implementation = LanguageLineWrapPositionStrategy.INSTANCE.getDefaultImplementation();
return implementation.calculateWrapPosition(
document, project, startOffset, endOffset, maxPreferredOffset, allowToBeyondMaxPreferredOffset, virtual
);
}
if (project == null) {
return -1;
}
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
if (documentManager == null) {
return -1;
@@ -84,7 +95,7 @@ public abstract class PsiAwareLineWrapPositionStrategy implements LineWrapPositi
TextRange textRange = element.getTextRange();
int start = Math.max(textRange.getStartOffset(), startOffset);
int end = Math.min(textRange.getEndOffset(), endOffset);
int result = doCalculateWrapPosition(document, project, start, end, end, false);
int result = doCalculateWrapPosition(document, project, start, end, end, false, virtual);
if (result >= 0) {
return result;
}
@@ -96,15 +107,15 @@ public abstract class PsiAwareLineWrapPositionStrategy implements LineWrapPositi
if (start > startOffset) {
return start;
}
}
}
}
return -1;
}
/**
* Serves for the same purposes as {@link #calculateWrapPosition(Document, Project, int, int, int, boolean)} but ensures that given
* offsets target {@link #PsiAwareLineWrapPositionStrategy(IElementType...) enabled token/element types}.
* Serves for the same purposes as {@link #calculateWrapPosition(Document, Project, int, int, int, boolean, boolean)} but ensures
* that given offsets target {@link #PsiAwareLineWrapPositionStrategy(boolean, IElementType...) enabled token/element types}.
*
* @param document target document which text is being processed
* @param project target project
@@ -117,12 +128,13 @@ public abstract class PsiAwareLineWrapPositionStrategy implements LineWrapPositi
* @param allowToBeyondMaxPreferredOffset indicates if it's allowed to return value from
* <code>(maxPreferredOffset; endOffset]</code> interval in case of inability to
* find appropriate offset from <code>(startOffset; maxPreferredOffset]</code> interval
* @param virtual identifies if current request is for virtual wrap (soft wrap) position
* @return offset from <code>(startOffset; endOffset]</code> interval where
* target line should be wrapped OR <code>-1</code> if no wrapping should be performed
*/
protected abstract int doCalculateWrapPosition(
@NotNull Document document, @Nullable Project project, int startOffset, int endOffset, int maxPreferredOffset,
boolean allowToBeyondMaxPreferredOffset
boolean allowToBeyondMaxPreferredOffset, boolean virtual
);
/**
@@ -134,7 +146,10 @@ public abstract class PsiAwareLineWrapPositionStrategy implements LineWrapPositi
*/
private boolean allowToWrapInside(@NotNull PsiElement element) {
TextRange textRange = element.getTextRange();
for (PsiElement parent = element; parent != null && parent.getTextRange().equals(textRange); parent = parent.getParent()) {
if (textRange == null) {
return false;
}
for (PsiElement parent = element; parent != null && textRange.equals(parent.getTextRange()); parent = parent.getParent()) {
ASTNode parentNode = parent.getNode();
if (parentNode != null && myEnabledTypes.contains(parentNode.getElementType())) {
return true;
@@ -150,7 +150,7 @@ public class AutoHardWrapHandler {
new VisualPosition(caretModel.getVisualPosition().line, margin - FormatConstants.RESERVED_LINE_WRAP_WIDTH_IN_COLUMNS)
));
int wrapOffset = strategy.calculateWrapPosition(document, project, startOffset, endOffset, maxPreferredOffset, true);
int wrapOffset = strategy.calculateWrapPosition(document, project, startOffset, endOffset, maxPreferredOffset, true, false);
if (wrapOffset < 0) {
return;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -356,7 +356,7 @@ public class FileTypeConfigurable extends BaseConfigurable implements Searchable
public RecognizedFileTypes() {
super(new BorderLayout());
add(myWholePanel, BorderLayout.CENTER);
myFileTypesList.setCellRenderer(new FileTypeRenderer(new FileTypeRenderer.FileTypeListProvider(){
myFileTypesList.setCellRenderer(new FileTypeRenderer(myFileTypesList.getCellRenderer(), new FileTypeRenderer.FileTypeListProvider() {
public Iterable<FileType> getCurrentFileTypeList() {
ArrayList<FileType> result = new ArrayList<FileType>();
for (int i = 0; i < myFileTypesList.getModel().getSize(); i++) {
@@ -0,0 +1,46 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.module;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.pom.Navigatable;
import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Bulenkov
*/
public class ModuleNavigatable implements Navigatable {
private final Module module;
public ModuleNavigatable(@NotNull Module module) {
this.module = module;
}
@Override
public void navigate(boolean requestFocus) {
ProjectSettingsService.getInstance(module.getProject()).openContentEntriesSettings(module);
}
@Override
public boolean canNavigate() {
return !module.isDisposed();
}
@Override
public boolean canNavigateToSource() {
return false;
}
}
@@ -0,0 +1,59 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.roots.libraries;
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.roots.LibraryOrderEntry;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.ui.configuration.ProjectSettingsService;
import com.intellij.pom.Navigatable;
import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Bulenkov
*/
public class LibraryNavigatable implements Navigatable {
private final Module module;
private NamedLibraryElement element;
public LibraryNavigatable(@NotNull Library library, @NotNull Module module) {
this.module = module;
for (OrderEntry entry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (entry instanceof LibraryOrderEntry) {
if (((LibraryOrderEntry)entry).getLibrary() == library) {
element = new NamedLibraryElement(module, entry);
}
}
}
}
@Override
public void navigate(boolean requestFocus) {
ProjectSettingsService.getInstance(module.getProject()).openProjectLibrarySettings(element);
}
@Override
public boolean canNavigate() {
return !module.isDisposed() && element != null;
}
@Override
public boolean canNavigateToSource() {
return false;
}
}
@@ -381,7 +381,7 @@ public class CodeFormatterFacade {
// We know that current line exceeds right margin if control flow reaches this place, so, wrap it.
int wrapOffset = strategy.calculateWrapPosition(
document, editor.getProject(), Math.max(startLineOffset, startOffsetToUse), Math.min(endLineOffset, endOffsetToUse),
preferredWrapPosition, false
preferredWrapPosition, false, false
);
if (wrapOffset < 0) {
continue;
@@ -104,7 +104,9 @@ public interface EditorSettings {
void setUseSoftWraps(boolean use);
boolean isAllSoftWrapsShown();
boolean isUseCustomSoftWrapIndent();
void setUseCustomSoftWrapIndent(boolean useCustomSoftWrapIndent);
int getCustomSoftWrapIndent();
void setCustomSoftWrapIndent(int indent);
boolean isAllowSingleLogicalLineFolding();
void setAllowSingleLogicalLineFolding(boolean allow);
@@ -48,7 +48,8 @@ public class GenericLineWrapPositionStrategy implements LineWrapPositionStrategy
int startOffset,
int endOffset,
int maxPreferredOffset,
boolean allowToBeyondMaxPreferredOffset)
boolean allowToBeyondMaxPreferredOffset,
boolean virtual)
{
if (endOffset <= startOffset) {
return endOffset;
@@ -45,11 +45,12 @@ public interface LineWrapPositionStrategy {
* @param allowToBeyondMaxPreferredOffset indicates if it's allowed to return value from
* <code>(maxPreferredOffset; endOffset]</code> interval in case of inability to
* find appropriate offset from <code>(startOffset; maxPreferredOffset]</code> interval
* @param virtual identifies if current request is for virtual wrap (soft wrap) position
* @return offset from <code>(startOffset; endOffset]</code> interval where
* target line should be wrapped OR <code>-1</code> if no wrapping should be performed
*/
int calculateWrapPosition(
@NotNull Document document, @Nullable Project project, int startOffset, int endOffset, int maxPreferredOffset,
boolean allowToBeyondMaxPreferredOffset
boolean allowToBeyondMaxPreferredOffset, boolean virtual
);
}
@@ -85,7 +85,8 @@ public class DefaultLineWrapPositionStrategyTest {
final Context context = new Context(document);
context.init();
int actual = myStrategy.calculateWrapPosition(
createMockDocument(context.document), myProject, 0, context.document.length(), context.edgeIndex, allowToBeyondMaxPreferredOffset
createMockDocument(context.document), myProject, 0, context.document.length(), context.edgeIndex,
allowToBeyondMaxPreferredOffset, true
);
assertSame(context.wrapIndex, actual);
}
@@ -77,6 +77,8 @@ public class SettingsImpl implements EditorSettings {
private Boolean myIsRefrainFromScrolling = null;
private Boolean myUseSoftWraps = null;
private Boolean myIsAllSoftWrapsShown = null;
private Boolean myUseCustomSoftWrapIndent = null;
private Integer myCustomSoftWrapIndent = null;
public boolean isRightMarginShown() {
return myIsRightMarginShown != null
@@ -206,8 +208,6 @@ public class SettingsImpl implements EditorSettings {
public void reinitSettings() {
myCachedTabSize = null;
//TODO den check
//myUseSoftWraps = null;
}
public int getTabSize(Project project) {
@@ -419,12 +419,23 @@ public class SettingsImpl implements EditorSettings {
@Override
public boolean isUseCustomSoftWrapIndent() {
return EditorSettingsExternalizable.getInstance().isUseCustomSoftWrapIndent();
return myUseCustomSoftWrapIndent == null ? EditorSettingsExternalizable.getInstance().isUseCustomSoftWrapIndent()
: myUseCustomSoftWrapIndent;
}
@Override
public void setUseCustomSoftWrapIndent(boolean useCustomSoftWrapIndent) {
myUseCustomSoftWrapIndent = useCustomSoftWrapIndent;
}
@Override
public int getCustomSoftWrapIndent() {
return EditorSettingsExternalizable.getInstance().getCustomSoftWrapIndent();
return myCustomSoftWrapIndent == null ? EditorSettingsExternalizable.getInstance().getCustomSoftWrapIndent() : myCustomSoftWrapIndent;
}
@Override
public void setCustomSoftWrapIndent(int indent) {
myCustomSoftWrapIndent = indent;
}
@Override
@@ -517,10 +517,14 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
myLineWrapPositionStrategy = LanguageLineWrapPositionStrategy.INSTANCE.forEditor(myEditor);
}
softWrapOffset = myLineWrapPositionStrategy.calculateWrapPosition(document, myEditor.getProject(), minOffset, maxOffset, preferredOffset, true);
softWrapOffset = myLineWrapPositionStrategy.calculateWrapPosition(
document, myEditor.getProject(), minOffset, maxOffset, preferredOffset, true, true
);
}
if (softWrapOffset >= lineData.endLineOffset || softWrapOffset < 0) {
if (softWrapOffset >= lineData.endLineOffset || softWrapOffset < 0
|| (myCustomIndentUsedLastTime && softWrapOffset == lineData.nonWhiteSpaceSymbolOffset))
{
return null;
}
@@ -787,8 +791,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
public int indentInColumns;
public int indentInPixels;
public int endLineOffset;
private int myNonWhiteSpaceSymbolOffset;
public int nonWhiteSpaceSymbolOffset;
public void update(int logicalLine, int spaceWidth, Editor editor) {
Document document = myEditor.getDocument();
@@ -803,7 +806,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
CharSequence text = document.getCharsSequence();
indentInColumns = 0;
indentInPixels = 0;
myNonWhiteSpaceSymbolOffset = -1;
nonWhiteSpaceSymbolOffset = -1;
for (int i = startLineOffset; i < endLineOffset; i++) {
char c = text.charAt(i);
@@ -814,7 +817,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
indentInColumns += calculateWidthInColumns(c, x - indentInPixels, spaceWidth);
indentInPixels = x;
break;
default: myNonWhiteSpaceSymbolOffset = i; return;
default: nonWhiteSpaceSymbolOffset = i; return;
}
}
}
@@ -828,7 +831,7 @@ public class SoftWrapApplianceManager implements SoftWrapFoldingListener, Docume
* @param softWrapOffset offset of the soft wrap that occurred on document line which data is stored at the current object
*/
public void update(int softWrapOffset) {
if (myNonWhiteSpaceSymbolOffset >= 0 && softWrapOffset > myNonWhiteSpaceSymbolOffset) {
if (nonWhiteSpaceSymbolOffset >= 0 && softWrapOffset > nonWhiteSpaceSymbolOffset) {
return;
}
indentInColumns = 0;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.ListScrollingUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
@@ -33,8 +34,7 @@ import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.Comparator;
public class FileTypeChooser extends DialogWrapper{
private final DefaultListModel myModel = new DefaultListModel();
public class FileTypeChooser extends DialogWrapper {
private JList myList;
private JLabel myTitleLabel;
private JTextField myPattern;
@@ -62,13 +62,13 @@ public class FileTypeChooser extends DialogWrapper{
}
});
final DefaultListModel model = new DefaultListModel();
for (FileType type : fileTypes) {
if (!type.isReadOnly() && type != FileTypes.UNKNOWN && !(type instanceof NativeFileType)) {
myModel.addElement(type);
model.addElement(type);
}
}
myList.setModel(myModel);
myList.setModel(model);
myPattern.setText(pattern);
setTitle(FileTypesBundle.message("filetype.chooser.title"));
@@ -79,7 +79,7 @@ public class FileTypeChooser extends DialogWrapper{
myTitleLabel.setText(FileTypesBundle.message("filetype.chooser.prompt", myFileName));
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myList.setCellRenderer(new FileTypeRenderer());
myList.setCellRenderer(new FileTypeRenderer(myList.getCellRenderer()));
myList.addMouseListener(
new MouseAdapter() {
@@ -125,22 +125,27 @@ public class FileTypeChooser extends DialogWrapper{
* Otherwise asks user to select file type and associates it with fileName extension if any selected.
* @return Known file type or null. Never returns {@link com.intellij.openapi.fileTypes.FileTypes#UNKNOWN}.
*/
@Nullable
public static FileType getKnownFileTypeOrAssociate(VirtualFile file) {
FileTypeManager fileTypeManager = FileTypeManager.getInstance();
FileType type = fileTypeManager.getFileTypeByFile(file);
if (type == FileTypes.UNKNOWN)
if (type == FileTypes.UNKNOWN) {
type = getKnownFileTypeOrAssociate(file.getName());
}
return type;
}
@Nullable
public static FileType getKnownFileTypeOrAssociate(String fileName) {
FileTypeManager fileTypeManager = FileTypeManager.getInstance();
FileType type = fileTypeManager.getFileTypeByFileName(fileName);
if (type == FileTypes.UNKNOWN)
if (type == FileTypes.UNKNOWN) {
type = associateFileType(fileName);
}
return type;
}
@Nullable
public static FileType associateFileType(String fileName) {
final FileTypeChooser chooser = new FileTypeChooser(suggestPatternText(fileName), fileName);
chooser.show();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,35 +15,36 @@
*/
package com.intellij.openapi.fileTypes.impl;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.ui.LayeredIcon;
import com.intellij.util.ui.EmptyIcon;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.Arrays;
import java.util.List;
public class FileTypeRenderer extends DefaultListCellRenderer {
public class FileTypeRenderer extends ListCellRendererWrapper<FileType> {
private static final Icon EMPTY_ICON = EmptyIcon.ICON_18;
private final FileTypeListProvider myFileTypeListProvider;
public FileTypeRenderer(final FileTypeListProvider fileTypeListProvider) {
myFileTypeListProvider = fileTypeListProvider;
}
public FileTypeRenderer() {
this(new DefaultFileTypeListProvider());
}
public static interface FileTypeListProvider {
public interface FileTypeListProvider {
Iterable<FileType> getCurrentFileTypeList();
}
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
FileType type = (FileType)value;
private final FileTypeListProvider myFileTypeListProvider;
public FileTypeRenderer(final ListCellRenderer renderer) {
this(renderer, new DefaultFileTypeListProvider());
}
public FileTypeRenderer(final ListCellRenderer renderer, final FileTypeListProvider fileTypeListProvider) {
super(renderer);
myFileTypeListProvider = fileTypeListProvider;
}
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
LayeredIcon layeredIcon = new LayeredIcon(2);
layeredIcon.setIcon(EMPTY_ICON, 0);
final Icon icon = type.getIcon();
@@ -60,7 +61,6 @@ public class FileTypeRenderer extends DefaultListCellRenderer {
else {
setText(type.getDescription());
}
return this;
}
private boolean isDuplicated(final String description) {
@@ -79,12 +79,12 @@ public class FileTypeRenderer extends DefaultListCellRenderer {
return false;
}
public Dimension getPreferredSize() {
return new Dimension(0, 20);
}
//public Dimension getPreferredSize() {
// return new Dimension(0, 20);
//}
private static class DefaultFileTypeListProvider implements FileTypeListProvider {
private final java.util.List<FileType> myFileTypes;
private final List<FileType> myFileTypes;
public DefaultFileTypeListProvider() {
myFileTypes = Arrays.asList(FileTypeManager.getInstance().getRegisteredFileTypes());
@@ -17,6 +17,7 @@ package com.intellij.openapi.editor.impl.softwrap.mapping;
import com.intellij.codeInsight.folding.CodeFoldingManager;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.SoftWrapModelEx;
import com.intellij.openapi.editor.impl.AbstractEditorProcessingOnDocumentModificationTest;
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
@@ -793,6 +794,21 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorP
assertEquals(new VisualPosition(1, 8), getEditor().offsetToVisualPosition(getEditor().getDocument().getTextLength() - 1));
}
public void testNoWrapAtFirstNonWsSymbolWithCustomIndent() throws IOException {
String text =
" 1111111111111111111111111111111";
init(70, text);
getEditor().getSettings().setCustomSoftWrapIndent(0);
getEditor().getSettings().setUseCustomSoftWrapIndent(true);
int textLength = getEditor().getDocument().getTextLength();
//Trigger soft wraps recalculation.
assertEquals(new LogicalPosition(0, textLength), myEditor.offsetToLogicalPosition(textLength));
// Don't expect soft wraps to be registered as there is no point in wrapping at the first non-white space symbol position
// in all cases when soft wrap is located at the left screen edge.
assertEmpty(getSoftWrapModel().getRegisteredSoftWraps());
}
public void testXmlWithLongCdata() throws IOException {
String text =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
@@ -75,7 +75,7 @@ jdk.1.3.language.level.description=1.3 - Plain old Java
jdk.1.4.language.level.description=1.4 - 'assert' keyword
jdk.1.5.language.level.description=5.0 - 'enum' keyword, autoboxing, etc.
jdk.1.6.language.level.description=6.0 - @Override in interfaces
jdk.1.7.language.level.description=7.0 - "Diamonds", strings in switch, etc.
jdk.1.7.language.level.description=7.0 - Diamonds, ARM, multi-catch, etc.
jdk.1.8.language.level.description=8.0 - Type annotations
#access levels
@@ -53,8 +53,9 @@ public class TeamCityLogger {
public static void warning(String message, @Nullable Throwable throwable) {
if (isUnderTC) {
tcLog(message, "WARNING");
} else {
LOG.warn(message, throwable);
}
LOG.warn(message, throwable);
}
public static void error(String message) {
@@ -63,8 +64,9 @@ public class TeamCityLogger {
public static void error(String message, @Nullable Throwable throwable) {
if (isUnderTC) {
tcLog(message, "ERROR");
} else {
LOG.error(message, throwable);
}
LOG.error(message, throwable);
}
private static void tcLog(String message, String level) {
@@ -24,8 +24,8 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.HtmlListCellRenderer;
import com.intellij.ui.ShiftTabAction;
import com.intellij.ui.SimpleTextAttributes;
import org.intellij.plugins.intelliLang.inject.InjectedLanguage;
@@ -42,9 +42,7 @@ import java.util.HashSet;
import java.util.Set;
public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
private JPanel myRoot;
private ComboBox myLanguage;
private EditorTextField myPrefix;
private EditorTextField mySuffix;
@@ -57,12 +55,11 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
Arrays.sort(languageIDs);
myLanguage.setModel(new DefaultComboBoxModel(languageIDs));
myLanguage.setRenderer(new ColoredListCellRenderer() {
myLanguage.setRenderer(new HtmlListCellRenderer<String>(myLanguage.getRenderer()) {
final Set<String> IDs = new HashSet<String>(Arrays.asList(languageIDs));
protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) {
final String s = String.valueOf(value);
@Override
protected void doCustomize(JList list, String s, int index, boolean selected, boolean hasFocus) {
final SimpleTextAttributes attributes =
IDs.contains(s) ? SimpleTextAttributes.REGULAR_ATTRIBUTES : SimpleTextAttributes.ERROR_ATTRIBUTES;
append(s, attributes);
@@ -74,11 +71,6 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
setIcon(fileType.getIcon());
append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
append("(" + fileType.getDescription() + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
// } else if (language == StdLanguages.EL) {
// // IDEA-10012
// setIcon(StdFileTypes.JSP.getIcon());
// append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES);
// append("(Expression Language)", SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
package org.jetbrains.idea.devkit.projectRoots;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
@@ -44,7 +45,7 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* User: anna
* @author anna
* Date: Nov 22, 2004
*/
public class IdeaJdkConfigurable implements AdditionalDataConfigurable {
@@ -110,15 +111,12 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable {
GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
wholePanel.add(myInternalJres, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1, 1, GridBagConstraints.EAST,
GridBagConstraints.HORIZONTAL, new Insets(0, 30, 0, 0), 0, 0));
myInternalJres.setRenderer(new DefaultListCellRenderer(){
public Component getListCellRendererComponent(final JList list,
final Object value,
final int index, final boolean isSelected, final boolean cellHasFocus) {
final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
myInternalJres.setRenderer(new ListCellRendererWrapper(myInternalJres.getRenderer()) {
@Override
public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
if (value instanceof Sdk) {
setText(((Sdk)value).getName());
}
return rendererComponent;
}
});
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
package org.jetbrains.idea.devkit.run;
import com.intellij.execution.configurations.LogFileOptions;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.ide.ui.ListCellRendererWrapper;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.ConfigurationException;
@@ -24,7 +24,6 @@ import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.util.Computable;
import com.intellij.ui.RawCommandLineEditor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -122,18 +121,13 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
public JComponent createEditor() {
myModulesModel = new DefaultComboBoxModel(myPRC.getModules());
myModules.setModel(myModulesModel);
myModules.setRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(JList list, final Object value, int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
setText(ApplicationManager.getApplication().runReadAction(new Computable<String >() {
public String compute() {
return ((Module)value).getName();
}
}));
setIcon(((Module)value).getModuleType().getNodeIcon(true));
myModules.setRenderer(new ListCellRendererWrapper<Module>(myModules.getRenderer()) {
@Override
public void customize(JList list, final Module module, int index, boolean selected, boolean hasFocus) {
if (module != null) {
setText(module.getName());
setIcon(module.getModuleType().getNodeIcon(true));
}
return this;
}
});
JPanel wholePanel = new JPanel(new GridBagLayout());
@@ -150,7 +150,7 @@ public class GitChangeProvider implements ChangeProvider {
for (FilePath filePath : myDirty) {
final VirtualFile vf = filePath.getVirtualFile();
if (vf != null) {
if ((! FileStatus.ADDED.equals(myAddGate.getStatus(vf))) && myFileDocumentManager.isFileModified(vf)) {
if ((myAddGate.getStatus(vf) == null) && myFileDocumentManager.isFileModified(vf)) {
final VirtualFile root = myVcsManager.getVcsRootFor(vf);
if (root != null) {
final GitRevisionNumber beforeRevisionNumber = GitChangeUtils.loadRevision(myProject, root, "HEAD");
@@ -253,7 +253,7 @@ public class GitCommittedChangeListProvider implements CommittedChangesProvider<
return new Pair<CommittedChangeList, FilePath>(commit, filePath);
}
}
final List<VcsFileRevision> history = GitHistoryUtils.history(myProject, filePath, null, number.asString() + "^..");
final List<VcsFileRevision> history = GitHistoryUtils.history(myProject, filePath, null, number.asString() + "..");
return new Pair<CommittedChangeList, FilePath>(commit, ((GitFileRevision) history.get(history.size() - 1)).getPath());
}
@@ -373,7 +373,9 @@ public class GitTask {
}
public void dispose() {
myTimer.cancel();
if (myTimer != null) {
myTimer.cancel();
}
}
}
@@ -72,7 +72,8 @@ public class GroovyStatementMover extends StatementUpDownMover {
final GroovyPsiElement pivot = getElementToMove((GroovyFileBase)file, offset);
if (pivot == null) return false;
range = getLineRange(pivot);
final LineRange pivotRange = getLineRange(pivot);
range = new LineRange(Math.min(range.startLine, pivotRange.startLine), Math.max(range.endLine, pivotRange.endLine));
final GroovyPsiElement scope = PsiTreeUtil.getParentOfType(pivot, GrMethod.class, GrTypeDefinitionBody.class, GroovyFileBase.class);
@@ -92,6 +92,8 @@ public class GroovyMoveStatementTest extends LightCodeInsightFixtureTestCase {
public void testInSwitchCaseUp4() throws Throwable { bothTest(); }
public void testInSwitchCaseUp5() throws Throwable { bothTest(); }
public void testTwoStatements() throws Throwable { bothTest(); }
private void bothTest() {
final List<String> data = TestUtils.readInput(getTestDataPath() + getTestName(true) + ".test");
final String initial = data.get(0);
@@ -0,0 +1,13 @@
public static void main(String[] args) {
for (String s : args) {
}
<selection><caret>println("a")
println("b")</selection>
}
-----
public static void main(String[] args) {
for (String s : args) {
<selection><caret>println("a")
println("b")</selection>
}
}
@@ -109,12 +109,12 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
SvnUtil.checkRepositoryVersion15(myVcs, url);
final SVNRevision svnRevision = ((SvnRevisionNumber)revision.getRevisionNumber()).getRevision();
final MySteppedLogGetter logGetter = new MySteppedLogGetter(myVcs, ioFile, progress, client, endRevision, result, url);
final MySteppedLogGetter logGetter = new MySteppedLogGetter(myVcs, ioFile, progress, client, endRevision, result, url, calculateMergeinfo);
logGetter.go();
final LinkedList<SVNRevision> rp = logGetter.getRevisionPoints();
for (int i = 0; i < rp.size() - 1; i++) {
client.doAnnotate(ioFile, SVNRevision.UNDEFINED, rp.get(i + 1), rp.get(i), true, calculateMergeinfo, annotateHandler, null);
client.doAnnotate(ioFile, svnRevision, rp.get(i + 1), rp.get(i), true, calculateMergeinfo, annotateHandler, null);
}
if (rp.get(1).getNumber() > 0) {
@@ -189,7 +189,10 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
@Override
public VcsAnnotation createCacheable(FileAnnotation fileAnnotation) {
final SvnFileAnnotation svnFileAnnotation = (SvnFileAnnotation)fileAnnotation;
svnFileAnnotation.getAnnotationSourceSwitcher().switchTo(AnnotationSource.LOCAL);
final AnnotationSourceSwitcher annotationSourceSwitcher = svnFileAnnotation.getAnnotationSourceSwitcher();
if (annotationSourceSwitcher != null) {
annotationSourceSwitcher.switchTo(AnnotationSource.LOCAL);
}
final int size = svnFileAnnotation.getNumLines();
final VcsUsualLineAnnotationData lineAnnotationData = new VcsUsualLineAnnotationData(size);
@@ -198,24 +201,28 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
lineAnnotationData.put(i, revisionNumber);
}
final VcsRareLineAnnotationData merged = new VcsRareLineAnnotationData(size);
final Map<VcsRevisionNumber, VcsFileRevision> addMap = new HashMap<VcsRevisionNumber, VcsFileRevision>();
svnFileAnnotation.getAnnotationSourceSwitcher().switchTo(AnnotationSource.MERGE);
for (int i = 0; i < size; i++) {
if (svnFileAnnotation.getAnnotationSourceSwitcher().mergeSourceAvailable(i)) {
final VcsRevisionNumber number = svnFileAnnotation.getLineRevisionNumber(i);
if (number == null) continue;
merged.put(i, number);
addMap.put(number, svnFileAnnotation.getRevision(((SvnRevisionNumber) number).getRevision().getNumber()));
final VcsAnnotation vcsAnnotation = new VcsAnnotation(new FilePathImpl(svnFileAnnotation.getFile()), lineAnnotationData,
svnFileAnnotation.getFirstRevisionNumber());
if (annotationSourceSwitcher != null) {
final VcsRareLineAnnotationData merged = new VcsRareLineAnnotationData(size);
final Map<VcsRevisionNumber, VcsFileRevision> addMap = new HashMap<VcsRevisionNumber, VcsFileRevision>();
annotationSourceSwitcher.switchTo(AnnotationSource.MERGE);
for (int i = 0; i < size; i++) {
if (annotationSourceSwitcher.mergeSourceAvailable(i)) {
final VcsRevisionNumber number = svnFileAnnotation.getLineRevisionNumber(i);
if (number == null) continue;
merged.put(i, number);
addMap.put(number, svnFileAnnotation.getRevision(((SvnRevisionNumber) number).getRevision().getNumber()));
}
}
if (! merged.isEmpty()) {
vcsAnnotation.addAnnotation(MERGED_KEY, merged);
vcsAnnotation.addCachedOtherRevisions(addMap);
}
}
final VcsAnnotation vcsAnnotation = new VcsAnnotation(new FilePathImpl(svnFileAnnotation.getFile()), lineAnnotationData,
svnFileAnnotation.getFirstRevisionNumber());
if (! merged.isEmpty()) {
vcsAnnotation.addAnnotation(MERGED_KEY, merged);
vcsAnnotation.addCachedOtherRevisions(addMap);
}
return vcsAnnotation;
}
@@ -264,18 +271,18 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
private final ProgressIndicator myProgress;
private final SVNLogClient myClient;
private final SVNRevision myEndRevision;
private final boolean mySupportsMergeinfo;
private final boolean myCalculateMergeinfo;
private final SvnFileAnnotation myResult;
private final String myUrl;
private MySteppedLogGetter(final SvnVcs vcs, final File ioFile, final ProgressIndicator progress, final SVNLogClient client,
final SVNRevision endRevision, final SvnFileAnnotation result, final String url) {
final SVNRevision endRevision, final SvnFileAnnotation result, final String url, final boolean calculateMergeinfo) {
myVcs = vcs;
myIoFile = ioFile;
myProgress = progress;
myClient = client;
myEndRevision = endRevision;
mySupportsMergeinfo = SvnUtil.checkRepositoryVersion15(myVcs, url);
myCalculateMergeinfo = calculateMergeinfo;
myResult = result;
myUrl = url;
myRevisionPoints = new LinkedList<SVNRevision>();
@@ -293,14 +300,14 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
}
if (! longHistory) {
doLog(mySupportsMergeinfo, null, 0);
doLog(myCalculateMergeinfo, null, 0);
putDefaultBounds();
} else {
doLog(false, null, 0);
final List<VcsFileRevision> fileRevisionList = myResult.getRevisions();
if (fileRevisionList.size() < maxAnnotateRevisions) {
putDefaultBounds();
if (mySupportsMergeinfo) {
if (myCalculateMergeinfo) {
doLog(true, null, 0);
}
return;
@@ -311,8 +318,8 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
((SvnRevisionNumber)fileRevisionList.get(maxAnnotateRevisions - 1).getRevisionNumber()).getRevision();
myRevisionPoints.add(truncateTo);
myResult.clearRevisions();
if (mySupportsMergeinfo) {
// todo file history can be asked in parallel
if (myCalculateMergeinfo) {
doLog(true, truncateTo, maxAnnotateRevisions);
}
}
@@ -322,13 +329,15 @@ public class SvnAnnotationProvider implements AnnotationProvider, VcsCacheableAn
myRevisionPoints.add(myEndRevision);
myRevisionPoints.add(SVNRevision.create(0));
}
private void doLog(final boolean includeMerged, final SVNRevision truncateTo, final int max) throws SVNException {
myClient.doLog(new File[]{myIoFile}, myEndRevision, truncateTo == null ? SVNRevision.create(1L) : truncateTo,
SVNRevision.UNDEFINED, false, false, includeMerged, max, null,
new ISVNLogEntryHandler() {
public void handleLogEntry(SVNLogEntry logEntry) {
if (SVNRevision.UNDEFINED.getNumber() == logEntry.getRevision()) return;
if (SVNRevision.UNDEFINED.getNumber() == logEntry.getRevision()) {
return;
}
if (myProgress != null) {
myProgress.checkCanceled();
@@ -239,9 +239,9 @@ public class SvnFileAnnotation implements FileAnnotation {
}
final LineInfo info = myInfos.get(lineNumber);
if (info == null) return null;
SvnFileRevision svnRevision = myRevisionMap.get(info.getRevision());
if (svnRevision != null) {
return svnRevision.getRevisionNumber();
final long revision = info.getRevision();
if (revision >= 0) {
return new SvnRevisionNumber(SVNRevision.create(revision));
}
return null;
}
@@ -310,9 +310,10 @@ public class SvnFileAnnotation implements FileAnnotation {
@Override
protected void showAffectedPaths(int lineNum) {
if (lineNum >= 0 && lineNum < myInfos.size()) {
SvnFileRevision svnRevision = myRevisionMap.get(getRevision(lineNum));
if (svnRevision != null) {
ShowAllAffectedGenericAction.showSubmittedFiles(myVcs.getProject(), svnRevision.getRevisionNumber(), myFile, myVcs.getKeyInstanceMethod());
final long revision = getRevision(lineNum);
if (revision >= 0) {
ShowAllAffectedGenericAction.showSubmittedFiles(myVcs.getProject(), new SvnRevisionNumber(SVNRevision.create(revision)),
myFile, myVcs.getKeyInstanceMethod());
}
}
}
@@ -332,14 +332,15 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn
}
public void start() {
start = System.currentTimeMillis();
if (start == 0) {
start = System.currentTimeMillis();
}
tree.getSelectionModel().setSelectionPath(new TreePath(treeBuilder.getNodeForElement(rootNode)));
rootNode.setInProgress(true);
rootNode.setStarted(true);
}
public void finish() {
if (end > 0) return;
if (start > 0) {
end = System.currentTimeMillis();
}
@@ -322,15 +322,17 @@ public class CompletionLists {
XmlElement context,
boolean allowDefault) {
if (namespaceContext == null) return true;
if (uri == null) return true;
final String namespaceURI;
if (prefixedName.getPrefix() != null) {
if (uri == null || uri.length() == 0) return false;
namespaceURI = namespaceContext.getNamespaceURI(prefixedName.getPrefix(), context);
} else {
if (!allowDefault) return false;
if (!allowDefault) return (uri == null || uri.length() == 0);
if ((namespaceURI = namespaceContext.getDefaultNamespace(context)) == null) {
return false;
return (uri == null || uri.length() == 0);
}
}
return uri.equals(namespaceURI);
@@ -23,7 +23,6 @@ import com.intellij.psi.xml.XmlElement;
import org.intellij.lang.xpath.XPathFileType;
import org.intellij.lang.xpath.context.ContextProvider;
import org.intellij.lang.xpath.context.NamespaceContext;
import org.intellij.lang.xpath.context.XPathVersion;
import org.intellij.lang.xpath.psi.PrefixedName;
import org.intellij.lang.xpath.psi.XPathNodeTest;
import org.jetbrains.annotations.NonNls;
@@ -141,15 +140,18 @@ public class CheckNodeTest extends XPathInspection {
boolean b = prefixedName.getLocalName().equals(element.getLocalPart()) || "*".equals(element.getLocalPart());
final String prefix = prefixedName.getPrefix();
if (prefix != null || allowDefaultNamespace) {
if (prefix != null) {
if (!"*".equals(prefix)) {
final String namespaceURI = prefix != null ? namespaceContext.getNamespaceURI(prefix, context) : namespaceContext.getDefaultNamespace(context);
final String namespaceURI = namespaceContext.getNamespaceURI(prefix, context);
b = b && element.getNamespaceURI().equals(namespaceURI);
}
} else if (allowDefaultNamespace) {
final String namespaceURI = namespaceContext.getDefaultNamespace(context);
b = b && (element.getNamespaceURI().equals(namespaceURI) || (element.getNamespaceURI().length() == 0 && namespaceURI == null));
} else {
b = b && element.getNamespaceURI().length() == 0;
}
return b;
return b;
}
}
}
@@ -234,16 +234,17 @@ class XsltRunSettingsEditor extends SettingsEditor<XsltRunConfiguration> {
myClasspathAndJDKPanel.setVisible(ALLOW_CHOOSING_SDK);
updateOutputState();
myFileType.setRenderer(new FileTypeRenderer() {
public Component getListCellRendererComponent(JList jList, Object object, int i, boolean b, boolean b1) {
if (object == null) {
super.getListCellRendererComponent(jList, StdFileTypes.ARCHIVE, i, b, b1);
setIcon(IconLoader.getIcon("/actions/cancel.png"));
setText("Disabled");
return this;
}
return super.getListCellRendererComponent(jList, object, i, b, b1);
myFileType.setRenderer(new FileTypeRenderer(myFileType.getRenderer()) {
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
if (type == null) {
setIcon(IconLoader.getIcon("/actions/cancel.png"));
setText("Disabled");
}
else {
super.customize(list, type, index, selected, hasFocus);
}
}
});
myFileType.setModel(new DefaultComboBoxModel(getFileTypes(project)));
+12 -2
View File
@@ -7,6 +7,8 @@
<module value="com.intellij.modules.all"/>
<xi:include href="/idea/JavaActions.xml" xpointer="xpointer(/component/*)"/>
<xi:include href="/componentSets/Debugger.xml" xpointer="xpointer(/components/*)"/>
<application-components>
<component>
<implementation-class>com.intellij.util.xml.impl.JavaDomApplicationComponent</implementation-class>
@@ -651,8 +653,6 @@
<liveTemplateContext implementation="com.intellij.codeInsight.template.JavaStringContextType"/>
<liveTemplateContext implementation="com.intellij.codeInsight.template.SmartCompletionContextType"/>
<projectExtension implementation="com.intellij.openapi.roots.impl.LanguageLevelProjectExtensionImpl$MyProjectExtension"/>
<projectExtension implementation="com.intellij.openapi.roots.impl.CompilerProjectExtensionImpl$MyProjectExtension"/>
<roots.watchedRootsProvider implementation="com.intellij.openapi.roots.impl.CompilerProjectExtensionImpl$MyWatchedRootsProvider"/>
<moduleExtension implementation="com.intellij.openapi.roots.impl.CompilerModuleExtensionImpl"/>
@@ -688,8 +688,11 @@
<configurationType implementation="com.intellij.execution.applet.AppletConfigurationType"/>
<configurationProducer implementation="com.intellij.execution.applet.AppletConfigurationProducer"/>
<configurationType implementation="com.intellij.execution.application.ApplicationConfigurationType"/>
<configurationProducer implementation="com.intellij.execution.application.ApplicationConfigurationProducer"/>
<configurationType implementation="com.intellij.execution.remote.RemoteConfigurationType"/>
<javaExpressionSurrounder implementation="com.intellij.debugger.codeinsight.JavaWithRuntimeCastSurrounder"/>
<applicationService serviceInterface="com.intellij.packageDependencies.DependenciesVisitorFactory"
serviceImplementation="com.intellij.packageDependencies.JavaDependenciesVisitorFactory"/>
@@ -883,6 +886,13 @@
serviceImplementation="com.intellij.profile.codeInspection.JavaAwareInspectionProfileManager"/>
<resolveScopeEnlarger implementation="com.intellij.psi.NonClasspathResolveScopeEnlarger"/>
<xdebugger.debuggerSupport implementation="com.intellij.debugger.ui.JavaDebuggerSupport"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.LineBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.ExceptionBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.AnyExceptionBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.FieldBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.MethodBreakpointFactory"/>
</extensions>
</idea-plugin>
@@ -35,7 +35,6 @@
<xi:include href="Toolwindows.xml" xpointer="xpointer(/components/*)"/>
<xi:include href="/componentSets/Editor.xml" xpointer="xpointer(/components/*)"/>
<xi:include href="Misc.xml" xpointer="xpointer(/components/*)"/>
<xi:include href="Debugger.xml" xpointer="xpointer(/components/*)"/>
<xi:include href="Compiler.xml" xpointer="xpointer(/components/*)"/>
<xi:include href="/componentSets/Execution.xml" xpointer="xpointer(/components/*)"/>
<xi:include href="/componentSets/VCS.xml" xpointer="xpointer(/components/*)"/>
+2 -13
View File
@@ -234,12 +234,6 @@
<daemon.highlightInfoFilter implementation="com.intellij.codeInsight.daemon.impl.HighlightInfoFilterImpl"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.LineBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.ExceptionBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.AnyExceptionBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.FieldBreakpointFactory"/>
<debugger.breakpointFactory implementation="com.intellij.debugger.ui.breakpoints.MethodBreakpointFactory"/>
<projectService serviceInterface="com.intellij.debugger.ui.DebuggerRecents"
serviceImplementation="com.intellij.debugger.ui.DebuggerRecents"/>
@@ -283,10 +277,6 @@
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.CodeAnalysisCheckinHandlerFactory"/>
<checkinHandlerFactory implementation="com.intellij.openapi.vcs.checkin.TodoCheckinHandlerFactory"/>
<configurationProducer implementation="com.intellij.execution.application.ApplicationConfigurationProducer"/>
<javaExpressionSurrounder implementation="com.intellij.debugger.codeinsight.JavaWithRuntimeCastSurrounder"/>
<checkoutListener implementation="com.intellij.openapi.vcs.checkout.ProjectCheckoutListener"/>
<checkoutListener implementation="com.intellij.openapi.vcs.checkout.ProjectDirCheckoutListener"/>
<checkoutCompletedListener implementation="com.intellij.openapi.vcs.checkout.NewProjectCheckoutListener"/>
@@ -365,12 +355,11 @@
<applicationService serviceInterface="com.intellij.openapi.roots.ModifiableModelsProvider"
serviceImplementation="com.intellij.openapi.roots.IdeaModifiableModelsProvider"/>
<projectExtension implementation="com.intellij.openapi.roots.impl.CompilerProjectExtensionImpl$MyProjectExtension"/>
<roots.watchedRootsProvider implementation="com.intellij.openapi.roots.impl.CompilerProjectExtensionImpl$MyWatchedRootsProvider"/>
</extensions>
<xi:include href="/META-INF/xdebugger.xml" xpointer="xpointer(/root/*)"/>
<extensions defaultExtensionNs="com.intellij">
<xdebugger.debuggerSupport implementation="com.intellij.debugger.ui.JavaDebuggerSupport"/>
</extensions>
<xi:include href="/META-INF/XmlPlugin.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="/META-INF/RegExpPlugin.xml" xpointer="xpointer(/idea-plugin/*)"/>
@@ -30,6 +30,6 @@ import com.intellij.psi.xml.XmlTokenType;
public class MarkupLineWrapPositionStrategy extends PsiAwareDefaultLineWrapPositionStrategy {
public MarkupLineWrapPositionStrategy() {
super(XmlElementType.XML_TEXT, TokenType.WHITE_SPACE);
super(true, XmlElementType.XML_TEXT, TokenType.WHITE_SPACE);
}
}