Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Kirill Kalishev
2011-04-15 21:45:11 +04:00
50 changed files with 765 additions and 225 deletions
+8
View File
@@ -1,6 +1,7 @@
<project name="IntelliJ IDEA Community Edition" default="all">
<property name="project.home" value="${basedir}"/>
<property name="out.dir" value="${project.home}/out"/>
<property name="tmp.dir" value="${project.home}/out/tmp"/>
<property name="gant.home" value="${project.home}/build/lib/gant"/>
<target name="cleanup">
@@ -9,6 +10,7 @@
<target name="init">
<mkdir dir="${out.dir}"/>
<mkdir dir="${tmp.dir}"/>
</target>
<macrodef name="call_gant">
@@ -17,6 +19,8 @@
<java failonerror="true" classname="org.apache.tools.ant.Main" fork="true">
<jvmarg line="-Xms64m -Xmx512m"/>
<jvmarg line="&quot;-Dgant.script=@{script}&quot;"/>
<jvmarg line="&quot;-Dteamcity.build.tempDir=${tmp.dir}&quot;"/>
<jvmarg line="&quot;-Didea.test.group=ALL_EXCLUDE_DEFINED&quot;"/>
<classpath>
<fileset dir="${project.home}/lib/ant/lib">
@@ -37,5 +41,9 @@
<call_gant script="${project.home}/build/scripts/dist.gant"/>
</target>
<target name="test" depends="init">
<call_gant script="${project.home}/build/scripts/tests.gant"/>
</target>
<target name="all" depends="cleanup,build"/>
</project>
@@ -203,9 +203,9 @@ public class Cache {
}
}
public int[] getReferencedClasses(int classId) throws CacheCorruptedException {
public int[] getReferencedClasses(int qName) throws CacheCorruptedException {
try {
return myQNameToReferencedClassesMap.getValues(classId);
return myQNameToReferencedClassesMap.getValues(qName);
}
catch (Throwable e) {
throw new CacheCorruptedException(e);
@@ -31,10 +31,7 @@ import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.cls.ClsUtil;
import gnu.trove.TIntHashSet;
import gnu.trove.TIntObjectHashMap;
import gnu.trove.TIntObjectIterator;
import gnu.trove.TIntObjectProcedure;
import gnu.trove.*;
import org.jetbrains.annotations.NonNls;
import java.util.*;
@@ -304,11 +301,13 @@ class JavaDependencyProcessor {
extractMethods(myAddedMembers, methodsToCheck, false);
if (!MakeUtil.isAnonymous(myDependencyCache.resolve(myQName))) {
// these checks make no sence for anonymous classes
// these checks make no sense for anonymous classes
final TIntHashSet fieldNames = new TIntHashSet();
extractFieldNames(myAddedMembers, fieldNames);
int addedFieldsCount = fieldNames.size();
extractFieldNames(myRemovedMembers, fieldNames);
if (!fieldNames.isEmpty()) {
cacheNavigator.walkSuperClasses(myQName, new ClassInfoProcessor() {
public boolean process(final int classQName) throws CacheCorruptedException {
@@ -317,6 +316,7 @@ class JavaDependencyProcessor {
}
});
}
if (addedFieldsCount > 0 && MakeUtil.isInterface(oldCache.getFlags(myQName))) {
final TIntHashSet visitedClasses = new TIntHashSet();
visitedClasses.add(myQName);
@@ -354,8 +354,60 @@ class JavaDependencyProcessor {
}
});
}
// check referencing members in subclasses
final TIntHashSet addedOrRemovedFields = new TIntHashSet();
final TIntHashSet addedOrRemovedMethods = new TIntHashSet();
for (Set<MemberInfo> infos : Arrays.asList(myAddedMembers, myRemovedMembers)) {
for (MemberInfo member : infos) {
if (!member.isPrivate()) {
if (member instanceof FieldInfo) {
addedOrRemovedFields.add(member.getName());
}
else if (member instanceof MethodInfo){
addedOrRemovedMethods.add(member.getName());
}
}
}
}
if (!addedOrRemovedFields.isEmpty() || !addedOrRemovedMethods.isEmpty()) {
cacheNavigator.walkSubClasses(myQName, new ClassInfoProcessor() {
public boolean process(final int subclassQName) throws CacheCorruptedException {
if (!myDependencyCache.isClassInfoMarked(subclassQName)) {
if (referencesMembersWithNames(oldCache, subclassQName, addedOrRemovedFields, addedOrRemovedMethods)) {
final boolean marked = myDependencyCache.markClass(subclassQName);
if (marked && LOG.isDebugEnabled()) {
LOG.debug("Mark dependent class " + myDependencyCache.resolve(subclassQName) + "; Reason: members were added/removed in superclass with names, that may clash with the names of members of another classes that this class references");
}
}
}
return true;
}
});
}
}
}
private static boolean referencesMembersWithNames(Cache cache, final int qName, TIntHashSet fieldNames, TIntHashSet methodNames) throws CacheCorruptedException {
for (final int referencedClass : cache.getReferencedClasses(qName)) {
for (Dependency dependency : cache.getBackDependencies(referencedClass)) {
if (dependency.getClassQualifiedName() == qName) {
for (Dependency.FieldRef ref : dependency.getFieldRefs()) {
if (fieldNames.contains(ref.name)) {
return true;
}
}
for (Dependency.MethodRef ref : dependency.getMethodRefs()) {
if (methodNames.contains(ref.name)) {
return true;
}
}
}
}
}
return false;
}
private void markAnnotationDependenciesRecursively(final Dependency[] dependencies, final @NonNls String reason, final TIntHashSet visitedAnnotations)
throws CacheCorruptedException {
@@ -585,7 +637,9 @@ class JavaDependencyProcessor {
private void markUseDependenciesOnEquivalentMethods(final int checkedInfoQName, Set<MethodInfo> methodsToCheck, int methodsClassName) throws CacheCorruptedException {
final Dependency[] backDependencies = myDependencyCache.getCache().getBackDependencies(checkedInfoQName);
for (Dependency dependency : backDependencies) {
if (myDependencyCache.isTargetClassInfoMarked(dependency)) continue;
if (myDependencyCache.isTargetClassInfoMarked(dependency)) {
continue;
}
if (isDependentOnEquivalentMethods(dependency.getMethodRefs(), methodsToCheck)) {
if (myDependencyCache.markTargetClassInfo(dependency)) {
if (LOG.isDebugEnabled()) {
@@ -600,8 +654,7 @@ class JavaDependencyProcessor {
private void markUseDependenciesOnFields(final int classQName, TIntHashSet fieldNames) throws CacheCorruptedException {
final Cache oldCache = myDependencyCache.getCache();
final Dependency[] backDependencies = oldCache.getBackDependencies(classQName);
for (Dependency useDependency : backDependencies) {
for (Dependency useDependency : oldCache.getBackDependencies(classQName)) {
if (!myDependencyCache.isTargetClassInfoMarked(useDependency)) {
for (Dependency.FieldRef field : useDependency.getFieldRefs()) {
if (fieldNames.contains(field.name)) {
@@ -37,7 +37,6 @@ public interface DebuggerActions extends XDebuggerActions {
@NonNls String REMOVE_WATCH = "Debugger.RemoveWatch";
@NonNls String NEW_WATCH = "Debugger.NewWatch";
@NonNls String EDIT_WATCH = "Debugger.EditWatch";
@NonNls String MARK_OBJECT = "Debugger.MarkObject";
@NonNls String COPY_VALUE = "Debugger.CopyValue";
@NonNls String SET_VALUE = "Debugger.SetValue";
@NonNls String EDIT_FRAME_SOURCE = "Debugger.EditFrameSource";
@@ -16,6 +16,7 @@
package com.intellij.debugger.actions;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.DebuggerUtils;
import com.intellij.debugger.engine.events.DebuggerContextCommandImpl;
@@ -26,17 +27,18 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
import com.intellij.debugger.ui.tree.ValueDescriptor;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.Ref;
import com.intellij.util.containers.HashMap;
import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.sun.jdi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -51,14 +53,13 @@ import java.util.Map;
* Class SetValueAction
* @author Jeka
*/
public class MarkObjectAction extends DebuggerAction {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.actions.MarkObjectAction");
public class JavaMarkObjectActionHandler extends MarkObjectActionHandler {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.actions.JavaMarkObjectActionHandler");
public static final long AUTO_MARKUP_REFERRING_OBJECTS_LIMIT = 100L; // todo: some reasonable limit
private final String MARK_TEXT = ActionsBundle.message("action.Debugger.MarkObject.text");
private final String UNMARK_TEXT = ActionsBundle.message("action.Debugger.MarkObject.unmark.text");
public void actionPerformed(final AnActionEvent event) {
final DebuggerTreeNodeImpl node = getSelectedNode(event.getDataContext());
@Override
public void perform(@NotNull Project project, AnActionEvent event) {
final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext());
if (node == null) {
return;
}
@@ -233,24 +234,27 @@ public class MarkObjectAction extends DebuggerAction {
return builder.append("<br><b>").append(refType.name()).append(".").append(fieldName).append("</b>").toString();
}
@Override
public boolean isEnabled(@NotNull Project project, AnActionEvent event) {
final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext());
return node != null && node.getDescriptor() instanceof ValueDescriptor;
}
public void update(AnActionEvent e) {
boolean enable = false;
String text = MARK_TEXT;
final DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
if (node != null) {
final NodeDescriptorImpl descriptor = node.getDescriptor();
enable = (descriptor instanceof ValueDescriptor);
if (enable) {
final ValueMarkup markup = ((ValueDescriptor)descriptor).getMarkup(node.getTree().getDebuggerContext().getDebugProcess());
if (markup != null) { // already exists
text = UNMARK_TEXT;
}
}
}
final Presentation presentation = e.getPresentation();
presentation.setVisible(enable);
presentation.setText(text);
@Override
public boolean isHidden(@NotNull Project project, AnActionEvent event) {
return DebuggerAction.getSelectedNode(event.getDataContext()) == null;
}
@Override
public boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event) {
final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext());
if (node == null) return false;
final NodeDescriptorImpl descriptor = node.getDescriptor();
if (!(descriptor instanceof ValueDescriptor)) return false;
DebugProcess debugProcess = node.getTree().getDebuggerContext().getDebugProcess();
return ((ValueDescriptor)descriptor).getMarkup(debugProcess) != null;
}
public static Color getAutoMarkupColor() {
@@ -17,7 +17,7 @@ package com.intellij.debugger.actions;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.ui.ex.MultiLineLabel;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialogBase;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -28,7 +28,7 @@ import java.awt.*;
* @author Eugene Zhuravlev
* Date: Feb 4, 2007
*/
public class ObjectMarkupPropertiesDialog extends ValueMarkerPresentationDialog {
public class ObjectMarkupPropertiesDialog extends ValueMarkerPresentationDialogBase {
@NonNls private static final String MARK_ALL_REFERENCED_VALUES_KEY = "debugger.mark.all.referenced.values";
private JCheckBox myCbMarkAdditionalFields;
private final boolean mySuggestAdditionalMarkup;
@@ -29,8 +29,8 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.xdebugger.AbstractDebuggerSession;
import com.intellij.xdebugger.impl.DebuggerSupport;
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler;
import com.intellij.xdebugger.impl.actions.*;
import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler;
import com.intellij.xdebugger.impl.breakpoints.ui.AbstractBreakpointPanel;
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider;
import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler;
@@ -63,6 +63,7 @@ public class JavaDebuggerSupport extends DebuggerSupport {
private final MuteBreakpointsActionHandler myMuteBreakpointsHandler = new MuteBreakpointsActionHandler();
private final DebuggerActionHandler mySmartStepIntoHandler = new SmartStepIntoActionHandler();
private final DebuggerActionHandler myAddToWatchedActionHandler = new AddToWatchActionHandler();
private JavaMarkObjectActionHandler myMarkObjectActionHandler = new JavaMarkObjectActionHandler();
@NotNull
public BreakpointPanelProvider<?> getBreakpointPanelProvider() {
@@ -150,6 +151,12 @@ public class JavaDebuggerSupport extends DebuggerSupport {
return myMuteBreakpointsHandler;
}
@NotNull
@Override
public MarkObjectActionHandler getMarkObjectHandler() {
return myMarkObjectActionHandler;
}
@Override
public AbstractDebuggerSession getCurrentSession(@NotNull Project project) {
final DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();
@@ -19,7 +19,6 @@
*/
package com.intellij.debugger.ui.impl;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
@@ -30,6 +29,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
import com.intellij.ui.PopupHandler;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import javax.swing.*;
import java.awt.*;
@@ -68,7 +68,7 @@ public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements
final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark");
final CustomShortcutSet shortcutSet = shortcuts.length > 0? new CustomShortcutSet(shortcuts) : new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0));
overrideShortcut(myTree, DebuggerActions.MARK_OBJECT, shortcutSet);
overrideShortcut(myTree, XDebuggerActions.MARK_OBJECT, shortcutSet);
}
protected abstract DebuggerTree createTreeView();
@@ -48,6 +48,8 @@ import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.refactoring.util.occurences.OccurenceManager;
import com.intellij.ui.StateRestoringCheckBox;
import com.intellij.ui.TitlePanel;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -261,14 +263,24 @@ public class InplaceIntroduceConstantPopup {
}
public void performInplaceIntroduce() {
startIntroduceTemplate(false);
startIntroduceTemplate(false, null);
}
private void startIntroduceTemplate(final boolean replaceAllOccurrences) {
private void startIntroduceTemplate(final boolean replaceAllOccurrences, @Nullable final PsiType fieldDefaultType) {
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
public void run() {
myTypeSelectorManager.setAllOccurences(replaceAllOccurrences);
final PsiType defaultType = myTypeSelectorManager.getTypeSelector().getSelectedType();
PsiType defaultType = myTypeSelectorManager.getTypeSelector().getSelectedType();
if (fieldDefaultType != null) {
if (replaceAllOccurrences) {
if (ArrayUtil.find(myTypeSelectorManager.getTypesForAll(), fieldDefaultType) != -1) {
defaultType = fieldDefaultType;
}
}
else if (ArrayUtil.find(myTypeSelectorManager.getTypesForOne(), fieldDefaultType) != -1) {
defaultType = fieldDefaultType;
}
}
final String propName = myLocalVariable != null ? JavaCodeStyleManager
.getInstance(myProject).variableNameToPropertyName(myLocalVariable.getName(), VariableKind.LOCAL_VARIABLE) : null;
final String[] names = IntroduceConstantDialog.createNameSuggestionGenerator(propName, myExpr, JavaCodeStyleManager.getInstance(myProject))
@@ -337,7 +349,7 @@ public class InplaceIntroduceConstantPopup {
private SmartTypePointer myFieldTypePointer;
public FieldInplaceIntroducer(PsiField field) {
super(myProject, new TypeExpression(myProject, myTypeSelectorManager.getTypesForAll()),
super(myProject, new TypeExpression(myProject, myReplaceAllCb.isSelected() ? myTypeSelectorManager.getTypesForAll() : myTypeSelectorManager.getTypesForOne()),
myEditor, field, false,
myTypeSelectorManager.getTypesForAll().length > 1,
myExpr != null && myExpr.isPhysical() ? myEditor.getDocument().createRangeMarker(myExpr.getTextRange()) : null, InplaceIntroduceConstantPopup.this.getOccurrenceMarkers(),
@@ -456,8 +468,8 @@ public class InplaceIntroduceConstantPopup {
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
if (templateState != null) {
templateState.gotoEnd(true);
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myFieldTypePointer.getType(), null, myExpr, myOccurrences);
startIntroduceTemplate(isReplaceAllOccurrences());
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myDefaultParameterTypePointer.getType(), null, myExpr, myOccurrences);
startIntroduceTemplate(isReplaceAllOccurrences(), myFieldTypePointer.getType());
}
}
});
@@ -35,6 +35,8 @@ import com.intellij.refactoring.rename.inplace.VariableInplaceRenamer;
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
import com.intellij.refactoring.util.occurences.OccurenceManager;
import com.intellij.ui.TitlePanel;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -151,15 +153,24 @@ public class InplaceIntroduceFieldPopup {
}
public void startTemplate() {
startTemplate(false);
startTemplate(false, null);
}
public void startTemplate(final boolean replaceAllOccurrences) {
public void startTemplate(final boolean replaceAllOccurrences, @Nullable final PsiType fieldDefaultType) {
CommandProcessor.getInstance().executeCommand(myProject, new Runnable() {
public void run() {
myTypeSelectorManager.setAllOccurences(replaceAllOccurrences);
final PsiType defaultType = myTypeSelectorManager.getTypeSelector().getSelectedType();
PsiType defaultType = myTypeSelectorManager.getTypeSelector().getSelectedType();
if (fieldDefaultType != null) {
if (replaceAllOccurrences) {
if (ArrayUtil.find(myTypeSelectorManager.getTypesForAll(), fieldDefaultType) != -1) {
defaultType = fieldDefaultType;
}
} else if (ArrayUtil.find(myTypeSelectorManager.getTypesForOne(), fieldDefaultType) != -1){
defaultType = fieldDefaultType;
}
}
final SuggestedNameInfo suggestedNameInfo =
IntroduceFieldDialog.createGenerator(myStatic, myLocalVariable, myInitializerExpression, myLocalVariable != null)
@@ -227,7 +238,7 @@ public class InplaceIntroduceFieldPopup {
private SmartTypePointer myFieldTypePointer;
public FieldInplaceIntroducer(PsiVariable psiVariable) {
super(myProject, new TypeExpression(myProject, myTypeSelectorManager.getTypesForAll()),
super(myProject, new TypeExpression(myProject, myIntroduceFieldPanel.isReplaceAllOccurrences() ? myTypeSelectorManager.getTypesForAll() : myTypeSelectorManager.getTypesForOne()),
myEditor, psiVariable, false,
myTypeSelectorManager.getTypesForAll().length > 1,
myInitializerExpression != null && myInitializerExpression.isPhysical() ? myEditor.getDocument().createRangeMarker(myInitializerExpression.getTextRange()) : null, InplaceIntroduceFieldPopup.this.getOccurrenceMarkers(),
@@ -296,8 +307,8 @@ public class InplaceIntroduceFieldPopup {
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
if (templateState != null) {
templateState.gotoEnd(true);
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myFieldTypePointer.getType(), null, myInitializerExpression, myOccurrences);
startTemplate(myIntroduceFieldPanel.isReplaceAllOccurrences());
myTypeSelectorManager = new TypeSelectorManagerImpl(myProject, myDefaultParameterTypePointer.getType(), null, myInitializerExpression, myOccurrences);
startTemplate(myIntroduceFieldPanel.isReplaceAllOccurrences(), myFieldTypePointer.getType());
}
}
});
@@ -116,7 +116,9 @@ public abstract class IntroduceFieldCentralPanel {
if (myCbReplaceAll != null && myAllowInitInMethod) {
updateInitializerSelection();
}
updateTypeSelector();
if (shouldUpdateTypeSelector()) {
updateTypeSelector();
}
}
};
ItemListener finalUpdater = new ItemListener() {
@@ -137,6 +139,10 @@ public abstract class IntroduceFieldCentralPanel {
protected void updateInitializerSelection() {
}
protected boolean shouldUpdateTypeSelector() {
return true;
}
private JPanel appendCheckboxes(ItemListener itemListener) {
GridBagConstraints gbConstraints = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1,1,0,0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0,0);
JPanel panel = new JPanel(new GridBagLayout());
@@ -232,6 +232,11 @@ public class IntroduceFieldPopupPanel extends IntroduceFieldCentralPanel {
return allowFinal;
}
@Override
protected boolean shouldUpdateTypeSelector() {
return false;
}
protected JPanel composeWholePanel(JComponent initializerPlacePanel, JPanel checkboxPanel) {
final JPanel panel = new JPanel(new GridBagLayout());
final GridBagConstraints constraints =
@@ -456,8 +456,9 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
final IntroduceVariableSettings settings =
getSettings(project, editor, expr, occurrences, typeSelectorManager, inFinalContext, hasWriteAccess, validator, choice);
if (!settings.isOK()) return;
typeSelectorManager.setAllOccurences(choice != OccurrencesChooser.ReplaceChoice.NO);
final TypeExpression expression = new TypeExpression(project, typeSelectorManager.getTypesForAll());
final boolean allOccurences = choice != OccurrencesChooser.ReplaceChoice.NO;
typeSelectorManager.setAllOccurences(allOccurences);
final TypeExpression expression = new TypeExpression(project, allOccurences ? typeSelectorManager.getTypesForAll() : typeSelectorManager.getTypesForOne());
final RangeMarker exprMarker = editor.getDocument().createRangeMarker(expr.getTextRange());
final SuggestedNameInfo suggestedName = getSuggestedName(settings.getSelectedType(), expr);
final List<RangeMarker> occurrenceMarkers = new ArrayList<RangeMarker>();
@@ -179,10 +179,12 @@ public class PullUpConflictsUtil {
}
});
if (abstractMethod.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) && toDifferentPackage) {
String message = "Can't make " + RefactoringUIUtil.getDescription(abstractMethod, false) +
" abstract as it won't be accessible from the subclass.";
message = CommonRefactoringUtil.capitalize(message);
conflicts.putValue(abstractMethod, message);
if (!isInterfaceTarget) {
String message = "Can't make " + RefactoringUIUtil.getDescription(abstractMethod, false) +
" abstract as it won't be accessible from the subclass.";
message = CommonRefactoringUtil.capitalize(message);
conflicts.putValue(abstractMethod, message);
}
}
}
return conflicts;
@@ -133,6 +133,10 @@ public class TypeSelectorManagerImpl implements TypeSelectorManager {
return myTypesForAll;
}
public PsiType[] getTypesForOne() {
return myTypesForMain;
}
public PsiType getDefaultType() {
if (myDefaultType.isValid()) {
return myDefaultType;
@@ -51,15 +51,14 @@ public abstract class AbstractMemberResolveConverter extends ResolvingConverter<
return true;
}
protected boolean isPropertyNameUsed() {
return true;
protected String getPropertyName(final String s, final ConvertContext context) {
return s;
}
public PsiMember fromString(final String s, final ConvertContext context) {
if (s == null) return null;
final PsiClass psiClass = getTargetClass(context);
if (psiClass == null) return null;
final String propertyName = isPropertyNameUsed() ? s : PropertyUtil.getPropertyName(s);
for (PropertyMemberType type : getMemberTypes(context)) {
switch (type) {
case FIELD:
@@ -67,11 +66,11 @@ public abstract class AbstractMemberResolveConverter extends ResolvingConverter<
if (field != null) return field;
break;
case GETTER:
final PsiMethod getter = PropertyUtil.findPropertyGetter(psiClass, propertyName, false, isLookDeep());
final PsiMethod getter = PropertyUtil.findPropertyGetter(psiClass, getPropertyName(s, context), false, isLookDeep());
if (getter != null) return getter;
break;
case SETTER:
final PsiMethod setter = PropertyUtil.findPropertySetter(psiClass, propertyName, false, isLookDeep());
final PsiMethod setter = PropertyUtil.findPropertySetter(psiClass, getPropertyName(s, context), false, isLookDeep());
if (setter != null) return setter;
break;
}
@@ -80,9 +79,8 @@ public abstract class AbstractMemberResolveConverter extends ResolvingConverter<
}
public String toString(final PsiMember t, final ConvertContext context) {
return t == null? null : isPropertyNameUsed()? PropertyUtil.getPropertyName(t) : t.getName();
return t == null? null : getPropertyName(t.getName(), context);
}
public String getErrorMessage(final String s, final ConvertContext context) {
@@ -131,13 +129,13 @@ public abstract class AbstractMemberResolveConverter extends ResolvingConverter<
}
public void handleElementRename(final GenericDomValue<PsiMember> genericValue, final ConvertContext context, final String newElementName) {
super.handleElementRename(genericValue, context, isPropertyNameUsed()? PropertyUtil.getPropertyName(newElementName) : newElementName);
super.handleElementRename(genericValue, context, getPropertyName(newElementName, context));
}
public void bindReference(final GenericDomValue<PsiMember> genericValue, final ConvertContext context, final PsiElement newTarget) {
if (newTarget instanceof PsiMember) {
final String elementName = ((PsiMember)newTarget).getName();
genericValue.setStringValue(isPropertyNameUsed() ? PropertyUtil.getPropertyName(elementName) : elementName);
genericValue.setStringValue(getPropertyName(elementName, context));
}
}
}
@@ -40,6 +40,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -281,17 +282,22 @@ public class ChangeSignatureGestureDetector extends PsiTreeChangeAdapter impleme
return myCurrentInfo;
}
private final @NonNls String PASTE_COMMAND_NAME = EditorBundle.message("paste.command.name");
private final @NonNls String TYPING_COMMAND_NAME = EditorBundle.message("typing.in.editor.command.name");
@Override
public void beforeDocumentChange(DocumentEvent e) {
if (myDeaf) return;
if (myInitialText == null) {
final Document document = e.getDocument();
final PsiDocumentManager documentManager = myPsiDocumentManager;
if (!documentManager.isUncommited(document)) {
final CommandProcessor processor = CommandProcessor.getInstance();
final String currentCommandName = processor.getCurrentCommandName();
if (!Comparing.strEqual(EditorBundle.message("typing.in.editor.command.name"), currentCommandName) &&
!Comparing.strEqual(EditorBundle.message("paste.command.name"), currentCommandName) &&
if (!Comparing.strEqual(TYPING_COMMAND_NAME, currentCommandName) &&
!Comparing.strEqual(PASTE_COMMAND_NAME, currentCommandName) &&
!Comparing.strEqual("Cut", currentCommandName) &&
!Comparing.strEqual(LanguageChangeSignatureDetector.MOVE_PARAMETER, currentCommandName) &&
!Comparing.equal(EditorActionUtil.DELETE_COMMAND_GROUP, processor.getCurrentCommandGroupId())) {
@@ -413,9 +413,11 @@ public class VariableInplaceRenamer {
ourRenamersStack.pop();
}
if (myHighlighters != null) {
final HighlightManager highlightManager = HighlightManager.getInstance(myProject);
for (RangeHighlighter highlighter : myHighlighters) {
highlightManager.removeSegmentHighlighter(myEditor, highlighter);
if (!myProject.isDisposed()) {
final HighlightManager highlightManager = HighlightManager.getInstance(myProject);
for (RangeHighlighter highlighter : myHighlighters) {
highlightManager.removeSegmentHighlighter(myEditor, highlighter);
}
}
myHighlighters = null;
@@ -672,6 +672,7 @@
icon="/debugger/muteBreakpoints.png"/>
<action id="XDebugger.AutoTooltip" class="com.intellij.xdebugger.impl.actions.ValueTooltipAutoShowAction"/>
<action id="XDebugger.ToggleSortValues" class="com.intellij.xdebugger.impl.ui.tree.actions.SortValuesToggleAction" icon="/objectBrowser/sorted.png"/>
<action id="Debugger.MarkObject" class="com.intellij.xdebugger.impl.actions.MarkObjectAction"/>
</group>
<group id="XDebugger.ToolWindow.TopToolbar">
@@ -699,12 +700,14 @@
<reference ref="XDebugger.Inspect"/>
<reference ref="XDebugger.SetValue"/>
<reference ref="XDebugger.CopyValue"/>
<reference ref="Debugger.MarkObject"/>
</group>
<group id="XDebugger.Variables.Tree.Popup">
<reference ref="XDebugger.Inspect"/>
<reference ref="XDebugger.SetValue"/>
<reference ref="XDebugger.CopyValue"/>
<reference ref="Debugger.MarkObject"/>
<reference ref="XDebugger.JumpToSource"/>
<reference ref="XDebugger.AddToWatches"/>
</group>
@@ -717,6 +720,7 @@
<reference ref="XDebugger.Inspect"/>
<reference ref="XDebugger.SetValue"/>
<reference ref="XDebugger.CopyValue"/>
<reference ref="Debugger.MarkObject"/>
</group>
<group id="XDebugger.Watches.Tree.Toolbar">
@@ -727,6 +731,7 @@
<group id="XDebugger.Inspect.Tree.Popup">
<reference ref="XDebugger.Inspect"/>
<reference ref="XDebugger.CopyValue"/>
<reference ref="Debugger.MarkObject"/>
</group>
<group id="XDebugger.Value.Hint.Tree.Popup">
@@ -23,17 +23,15 @@ import org.jetbrains.annotations.NotNull;
* @author peter
*/
public abstract class NotNullLazyValue<T> {
private boolean myComputed;
@NotNull private T myValue;
private T myValue;
@NotNull
protected abstract T compute();
@NotNull
public T getValue() {
if (!myComputed) {
if (myValue == null) {
myValue = compute();
myComputed = true;
}
return myValue;
}
@@ -24,6 +24,7 @@ import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
import com.intellij.xdebugger.frame.XValueMarkerProvider;
import com.intellij.xdebugger.stepping.XSmartStepIntoHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -161,6 +162,15 @@ public abstract class XDebugProcess {
return consoleBuilder.getConsole();
}
/**
* Override this method to enable 'Mark Object' action
* @return new instance of {@link XValueMarkerProvider}'s implementation or {@code null} if 'Mark Object' feature isn't supported
*/
@Nullable
public XValueMarkerProvider<?,?> createValueMarkerProvider() {
return null;
}
/**
* Override this method to provide additional tabs for 'Debug' tool window
*/
@@ -116,7 +116,6 @@ public abstract class XDebuggerEvaluator {
* Override this method to format selected text before it is shown in 'Evaluate' dialog
*/
@NotNull
@SuppressWarnings({"MethodMayBeStatic"})
public String formatTextForEvaluation(@NotNull String text) {
return text;
}
@@ -0,0 +1,68 @@
/*
* 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.xdebugger.frame;
import org.jetbrains.annotations.NotNull;
/**
* Provides implementation of 'Mark Object' feature. <p>
*
* If debugger values have unique ids just return these ids from {@link #getMarker(XValue)} method.
* Alternatively implement {@link #markValue(XValue)} to store a value in some registry and implement {@link #unmarkValue(XValue, Object)}
* to remote it from the registry. In such a case the {@link #getMarker(XValue)} method can return {@code null} if the {@code value} isn't marked.
*
* @author nik
*/
public abstract class XValueMarkerProvider<V extends XValue, M> {
private final Class<V> myValueClass;
protected XValueMarkerProvider(Class<V> valueClass) {
myValueClass = valueClass;
}
/**
* @return {@code true} if 'Mark Object' action should be enabled for {@code value}
*/
public abstract boolean canMark(@NotNull V value);
/**
* This method is used to determine whether the {@code value} was marked or not. The returned object is compared using {@link Object#equals(Object)}
* method with markers returned by {@link #markValue(XValue)} methods. <p>
* This method may return {@code null} if the {@code value} wasn't marked by {@link #markValue(XValue)} method.
* @return a marker for {@code value}
*/
public abstract M getMarker(@NotNull V value);
/**
* This method is called when 'Mark Object' action is invoked. Return an unique marker for {@code value} and store it in some registry
* if necessary.
* @return a marker for {@code value}
*/
@NotNull
public M markValue(@NotNull V value) {
return getMarker(value);
}
/**
* This method is called when 'Unmark Object' action is invoked.
*/
public void unmarkValue(@NotNull V value, @NotNull M marker) {
}
public final Class<V> getValueClass() {
return myValueClass;
}
}
@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.AbstractDebuggerSession;
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler;
import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler;
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider;
import com.intellij.xdebugger.impl.evaluate.quick.common.QuickEvaluateHandler;
import com.intellij.xdebugger.impl.settings.DebuggerSettingsPanelProvider;
@@ -33,7 +34,7 @@ import org.jetbrains.annotations.Nullable;
public abstract class DebuggerSupport {
private static final ExtensionPointName<DebuggerSupport> EXTENSION_POINT = ExtensionPointName.create("com.intellij.xdebugger.debuggerSupport");
@NotNull
@NotNull
public static DebuggerSupport[] getDebuggerSupports() {
return Extensions.getExtensions(EXTENSION_POINT);
}
@@ -96,6 +97,10 @@ public abstract class DebuggerSupport {
@NotNull
public abstract DebuggerToggleActionHandler getMuteBreakpointsHandler();
@NotNull
public abstract MarkObjectActionHandler getMarkObjectHandler();
@Nullable
public abstract AbstractDebuggerSession getCurrentSession(@NotNull Project project);
}
@@ -29,6 +29,7 @@ import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.diagnostic.Logger;
@@ -46,8 +47,10 @@ import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
import com.intellij.xdebugger.frame.XExecutionStack;
import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.frame.XSuspendContext;
import com.intellij.xdebugger.frame.XValueMarkerProvider;
import com.intellij.xdebugger.impl.breakpoints.*;
import com.intellij.xdebugger.impl.evaluate.quick.common.ValueLookupManager;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.intellij.xdebugger.impl.ui.XDebugSessionData;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
@@ -78,6 +81,7 @@ public class XDebugSessionImpl implements XDebugSession {
private XSourcePosition myCurrentPosition;
private boolean myPaused;
private MyDependentBreakpointListener myDependentBreakpointListener;
private XValueMarkers<?,?> myValueMarkers;
private String mySessionName;
private XDebugSessionTab mySessionTab;
private XDebugSessionData mySessionData;
@@ -255,6 +259,17 @@ public class XDebugSessionImpl implements XDebugSession {
ExecutionManager.getInstance(getProject()).getContentManager().showRunContent(DefaultDebugExecutor.getDebugExecutorInstance(), descriptor);
}
public XValueMarkers<?, ?> getValueMarkers() {
ApplicationManager.getApplication().assertIsDispatchThread();
if (myValueMarkers == null) {
XValueMarkerProvider<?,?> provider = myDebugProcess.createValueMarkerProvider();
if (provider != null) {
myValueMarkers = XValueMarkers.createValueMarkers(provider);
}
}
return myValueMarkers;
}
private static <B extends XBreakpoint<?>> XBreakpointType<?, ?> getBreakpointTypeClass(final XBreakpointHandler<B> handler) {
return XDebuggerUtil.getInstance().findBreakpointType(handler.getBreakpointTypeClass());
}
@@ -22,6 +22,7 @@ import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.impl.actions.DebuggerActionHandler;
import com.intellij.xdebugger.impl.actions.DebuggerToggleActionHandler;
import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler;
import com.intellij.xdebugger.impl.actions.XDebuggerSuspendedActionHandler;
import com.intellij.xdebugger.impl.actions.handlers.*;
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointPanelProvider;
@@ -54,6 +55,7 @@ public class XDebuggerSupport extends DebuggerSupport {
private final XAddToWatchesFromEditorActionHandler myAddToWatchesActionHandler;
private final DebuggerToggleActionHandler myMuteBreakpointsHandler;
private final DebuggerActionHandler mySmartStepIntoHandler;
private final XMarkObjectActionHandler myMarkObjectActionHandler;
public XDebuggerSupport() {
myBreakpointPanelProvider = new XBreakpointPanelProvider();
@@ -106,6 +108,7 @@ public class XDebuggerSupport extends DebuggerSupport {
myEvaluateHandler = new XDebuggerEvaluateActionHandler();
myQuickEvaluateHandler = new XQuickEvaluateHandler();
mySettingsPanelProvider = new XDebuggerSettingsPanelProviderImpl();
myMarkObjectActionHandler = new XMarkObjectActionHandler();
}
@NotNull
@@ -194,6 +197,12 @@ public class XDebuggerSupport extends DebuggerSupport {
return myMuteBreakpointsHandler;
}
@NotNull
@Override
public MarkObjectActionHandler getMarkObjectHandler() {
return myMarkObjectActionHandler;
}
@Override
public AbstractDebuggerSession getCurrentSession(@NotNull Project project) {
return XDebuggerManager.getInstance(project).getCurrentSession();
@@ -0,0 +1,64 @@
/*
* 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.xdebugger.impl.actions;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.impl.DebuggerSupport;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public class MarkObjectAction extends XDebuggerActionBase {
@Override
public void update(AnActionEvent event) {
Project project = event.getData(PlatformDataKeys.PROJECT);
boolean enabled = false;
Presentation presentation = event.getPresentation();
boolean hidden = true;
if (project != null) {
for (DebuggerSupport support : DebuggerSupport.getDebuggerSupports()) {
MarkObjectActionHandler handler = support.getMarkObjectHandler();
hidden &= handler.isHidden(project, event);
if (handler.isEnabled(project, event)) {
enabled = true;
String text;
if (handler.isMarked(project, event)) {
text = ActionsBundle.message("action.Debugger.MarkObject.unmark.text");
}
else {
text = ActionsBundle.message("action.Debugger.MarkObject.text");
}
presentation.setText(text);
break;
}
}
}
presentation.setVisible(!hidden && (!ActionPlaces.isPopupPlace(event.getPlace()) || enabled));
presentation.setEnabled(enabled);
}
@NotNull
@Override
protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) {
return debuggerSupport.getMarkObjectHandler();
}
}
@@ -0,0 +1,27 @@
/*
* 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.xdebugger.impl.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public abstract class MarkObjectActionHandler extends DebuggerActionHandler {
public abstract boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event);
}
@@ -62,4 +62,5 @@ public interface XDebuggerActions {
@NonNls String TOGGLE_SORT_VALUES = "XDebugger.ToggleSortValues";
@NonNls String AUTO_TOOLTIP = "XDebugger.AutoTooltip";
@NonNls String MARK_OBJECT = "Debugger.MarkObject";
}
@@ -0,0 +1,90 @@
/*
* 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.xdebugger.impl.actions.handlers;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.XDebuggerManager;
import com.intellij.xdebugger.frame.XValue;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.intellij.xdebugger.impl.actions.MarkObjectActionHandler;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author nik
*/
public class XMarkObjectActionHandler extends MarkObjectActionHandler {
@Override
public void perform(@NotNull Project project, AnActionEvent event) {
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
if (session == null) return;
XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
if (markers == null || node == null) return;
XValue value = node.getValueContainer();
ValueMarkup existing = markers.getMarkup(value);
if (existing != null) {
markers.unmarkValue(value);
}
else {
ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(node.getName());
dialog.show();
ValueMarkup markup = dialog.getConfiguredMarkup();
if (dialog.isOK() && markup != null) {
markers.markValue(value, markup);
}
}
session.rebuildViews();
}
@Override
public boolean isEnabled(@NotNull Project project, AnActionEvent event) {
XValueMarkers<?, ?> markers = getValueMarkers(project);
if (markers == null) return false;
XValue value = XDebuggerTreeActionBase.getSelectedValue(event.getDataContext());
return value != null && markers.canMarkValue(value);
}
@Override
public boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event) {
XValueMarkers<?, ?> markers = getValueMarkers(project);
if (markers == null) return false;
XValue value = XDebuggerTreeActionBase.getSelectedValue(event.getDataContext());
return value != null && markers.getMarkup(value) != null;
}
@Override
public boolean isHidden(@NotNull Project project, AnActionEvent event) {
return getValueMarkers(project) == null;
}
@Nullable
private static XValueMarkers<?, ?> getValueMarkers(@NotNull Project project) {
XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
return session != null ? ((XDebugSessionImpl)session).getValueMarkers() : null;
}
}
@@ -0,0 +1,77 @@
/*
* 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.xdebugger.impl.frame;
import com.intellij.xdebugger.frame.XValue;
import com.intellij.xdebugger.frame.XValueMarkerProvider;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
/**
* @author nik
*/
public class XValueMarkers<V extends XValue, M> {
private final XValueMarkerProvider<V, M> myProvider;
private final Map<M, ValueMarkup> myMarkers;
private XValueMarkers(@NotNull XValueMarkerProvider<V, M> provider) {
myProvider = provider;
myMarkers = new HashMap<M, ValueMarkup>();
}
public static <V extends XValue, M> XValueMarkers<V, M> createValueMarkers(@NotNull XValueMarkerProvider<V, M> provider) {
return new XValueMarkers<V, M>(provider);
}
@Nullable
public ValueMarkup getMarkup(@NotNull XValue value) {
Class<V> valueClass = myProvider.getValueClass();
if (!valueClass.isInstance(value)) return null;
V v = valueClass.cast(value);
if (!myProvider.canMark(v)) return null;
M m = myProvider.getMarker(v);
if (m == null) return null;
return myMarkers.get(m);
}
public boolean canMarkValue(@NotNull XValue value) {
Class<V> valueClass = myProvider.getValueClass();
if (!valueClass.isInstance(value)) return false;
return myProvider.canMark(valueClass.cast(value));
}
public void markValue(@NotNull XValue value, @NotNull ValueMarkup markup) {
//noinspection unchecked
M m = myProvider.markValue((V)value);
myMarkers.put(m, markup);
}
public void unmarkValue(@NotNull XValue value) {
//noinspection unchecked
M m = myProvider.getMarker((V)value);
if (m != null) {
myMarkers.remove(m);
}
}
}
@@ -15,83 +15,14 @@
*/
package com.intellij.xdebugger.impl.ui.tree;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.FixedSizeButton;
import com.intellij.ui.ColorChooser;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author nik
*/
public abstract class ValueMarkerPresentationDialog extends DialogWrapper {
private static final Color DEFAULT_COLOR = Color.RED;
private SimpleColoredComponent myColorSample;
private Color myColor;
private JPanel myMainPanel;
private JTextField myLabelField;
private FixedSizeButton myChooseColorButton;
private JPanel mySamplePanel;
public ValueMarkerPresentationDialog(final @Nullable String defaultText) {
super(true);
setTitle("Select Object Label");
setModal(true);
myLabelField.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
updateLabelSample();
}
});
myChooseColorButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Color color = ColorChooser.chooseColor(myColorSample, "Choose Label Color", myColor);
if (color != null) {
myColor = color;
updateLabelSample();
}
}
});
myColor = DEFAULT_COLOR;
if (defaultText != null) {
myLabelField.setText(defaultText.trim());
updateLabelSample();
}
}
public JComponent getPreferredFocusedComponent() {
return myLabelField;
}
@Override
protected JComponent createCenterPanel() {
return myMainPanel;
}
private void updateLabelSample() {
myColorSample.clear();
SimpleTextAttributes attributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, myColor);
myColorSample.append(myLabelField.getText().trim(), attributes);
}
@Nullable
public ValueMarkup getConfiguredMarkup() {
final String text = myLabelField.getText().trim();
return text.isEmpty() ? null : new ValueMarkup(text, myColor, null);
}
private void createUIComponents() {
myColorSample = new SimpleColoredComponent();
mySamplePanel = new JPanel(new BorderLayout());
mySamplePanel.setBorder(BorderFactory.createEtchedBorder());
mySamplePanel.add(BorderLayout.CENTER, myColorSample);
myChooseColorButton = new FixedSizeButton(mySamplePanel);
public class ValueMarkerPresentationDialog extends ValueMarkerPresentationDialogBase {
public ValueMarkerPresentationDialog(@Nullable String defaultText) {
super(defaultText);
init();
}
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialog">
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.xdebugger.impl.ui.tree.ValueMarkerPresentationDialogBase">
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="0" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
@@ -0,0 +1,97 @@
/*
* 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.xdebugger.impl.ui.tree;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.FixedSizeButton;
import com.intellij.ui.ColorChooser;
import com.intellij.ui.DocumentAdapter;
import com.intellij.ui.SimpleColoredComponent;
import com.intellij.ui.SimpleTextAttributes;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author nik
*/
public abstract class ValueMarkerPresentationDialogBase extends DialogWrapper {
private static final Color DEFAULT_COLOR = Color.RED;
private SimpleColoredComponent myColorSample;
private Color myColor;
private JPanel myMainPanel;
private JTextField myLabelField;
private FixedSizeButton myChooseColorButton;
private JPanel mySamplePanel;
public ValueMarkerPresentationDialogBase(final @Nullable String defaultText) {
super(true);
setTitle("Select Object Label");
setModal(true);
myLabelField.getDocument().addDocumentListener(new DocumentAdapter() {
protected void textChanged(final DocumentEvent e) {
updateLabelSample();
}
});
myChooseColorButton.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Color color = ColorChooser.chooseColor(myColorSample, "Choose Label Color", myColor);
if (color != null) {
myColor = color;
updateLabelSample();
}
}
});
myColor = DEFAULT_COLOR;
if (defaultText != null) {
myLabelField.setText(defaultText.trim());
updateLabelSample();
}
}
public JComponent getPreferredFocusedComponent() {
return myLabelField;
}
@Override
protected JComponent createCenterPanel() {
return myMainPanel;
}
private void updateLabelSample() {
myColorSample.clear();
SimpleTextAttributes attributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, myColor);
myColorSample.append(myLabelField.getText().trim(), attributes);
}
@Nullable
public ValueMarkup getConfiguredMarkup() {
final String text = myLabelField.getText().trim();
return text.isEmpty() ? null : new ValueMarkup(text, myColor, null);
}
private void createUIComponents() {
myColorSample = new SimpleColoredComponent();
mySamplePanel = new JPanel(new BorderLayout());
mySamplePanel.setBorder(BorderFactory.createEtchedBorder());
mySamplePanel.add(BorderLayout.CENTER, myColorSample);
myChooseColorButton = new FixedSizeButton(mySamplePanel);
}
}
@@ -18,6 +18,7 @@ package com.intellij.xdebugger.impl.ui.tree;
import com.intellij.ide.dnd.aware.DnDAwareTree;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.changes.issueLinks.TreeLinkMouseListener;
import com.intellij.ui.PopupHandler;
@@ -210,6 +211,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
actionManager.getAction(XDebuggerActions.SET_VALUE).unregisterCustomShortcutSet(this);
actionManager.getAction(XDebuggerActions.COPY_VALUE).unregisterCustomShortcutSet(this);
actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE).unregisterCustomShortcutSet(this);
actionManager.getAction(XDebuggerActions.MARK_OBJECT).unregisterCustomShortcutSet(this);
}
private void registerShortcuts() {
@@ -217,6 +219,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
actionManager.getAction(XDebuggerActions.SET_VALUE).registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), this);
actionManager.getAction(XDebuggerActions.COPY_VALUE).registerCustomShortcutSet(CommonShortcuts.getCopy(), this);
actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE).registerCustomShortcutSet(CommonShortcuts.getEditSource(), this);
actionManager.getAction(XDebuggerActions.MARK_OBJECT).registerCustomShortcutSet(new CustomShortcutSet( KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark")), this);
}
private static void markNodesObsolete(final XValueContainerNode<?> node) {
@@ -24,6 +24,7 @@ import com.intellij.xdebugger.frame.XValue;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -34,7 +35,7 @@ import javax.swing.*;
public class XInspectDialog extends DialogWrapper {
private final XDebuggerTreePanel myTreePanel;
public XInspectDialog(final XDebugSession session, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition, String nodeName, XValue value) {
public XInspectDialog(final XDebugSession session, XDebuggerEditorsProvider editorsProvider, XSourcePosition sourcePosition, @NotNull String nodeName, @NotNull XValue value) {
super(session.getProject(), false);
setTitle(XDebuggerBundle.message("inspect.value.dialog.title", nodeName));
setModal(false);
@@ -53,7 +53,7 @@ public abstract class XDebuggerTreeActionBase extends AnAction {
}
@Nullable
protected static XValueNodeImpl getSelectedNode(final DataContext dataContext) {
public static XValueNodeImpl getSelectedNode(final DataContext dataContext) {
XDebuggerTree tree = XDebuggerTree.getTree(dataContext);
if (tree == null) return null;
@@ -17,12 +17,13 @@ package com.intellij.xdebugger.impl.ui.tree.nodes;
import com.intellij.xdebugger.frame.XStackFrame;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public class XStackFrameNode extends XValueContainerNode<XStackFrame> {
public XStackFrameNode(final XDebuggerTree tree, final XStackFrame xStackFrame) {
public XStackFrameNode(final @NotNull XDebuggerTree tree, final @NotNull XStackFrame xStackFrame) {
super(tree, null, xStackFrame);
setLeaf(false);
}
@@ -39,7 +39,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
protected final ValueContainer myValueContainer;
private volatile boolean myObsolete;
protected XValueContainerNode(XDebuggerTree tree, final XDebuggerTreeNode parent, ValueContainer valueContainer) {
protected XValueContainerNode(XDebuggerTree tree, final XDebuggerTreeNode parent, @NotNull ValueContainer valueContainer) {
super(tree, parent, true);
myValueContainer = valueContainer;
myText.append(XDebuggerUIConstants.COLLECTING_DATA_MESSAGE, XDebuggerUIConstants.COLLECTING_DATA_HIGHLIGHT_ATTRIBUTES);
@@ -162,6 +162,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
return myCachedAllChildren;
}
@NotNull
public ValueContainer getValueContainer() {
return myValueContainer;
}
@@ -20,8 +20,11 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.StringBuilderSpinAllocator;
import com.intellij.xdebugger.frame.*;
import com.intellij.xdebugger.impl.XDebugSessionImpl;
import com.intellij.xdebugger.impl.frame.XValueMarkers;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.impl.ui.tree.ValueMarkup;
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -48,7 +51,7 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
private String mySeparator;
private boolean myChanged;
public XValueNodeImpl(XDebuggerTree tree, final XDebuggerTreeNode parent, String name, final XValue value) {
public XValueNodeImpl(XDebuggerTree tree, final XDebuggerTreeNode parent, String name, final @NotNull XValue value) {
super(tree, parent, value);
myName = name;
if (myName != null) {
@@ -106,6 +109,13 @@ public class XValueNodeImpl extends XValueContainerNode<XValue> implements XValu
private void updateText() {
myText.clear();
XValueMarkers<?,?> markers = ((XDebugSessionImpl)myTree.getSession()).getValueMarkers();
if (markers != null) {
ValueMarkup markup = markers.getMarkup(myValueContainer);
if (markup != null) {
myText.append("[" + markup.getText() + "] ", new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, markup.getColor()));
}
}
myText.append(myName, XDebuggerUIConstants.VALUE_NAME_ATTRIBUTES);
myText.append(mySeparator, SimpleTextAttributes.REGULAR_ATTRIBUTES);
if (myType != null) {
@@ -95,7 +95,8 @@ public class ContextComputationProcessor {
else if (expression instanceof PsiExpression) {
final SmartList<PsiExpression> uncomputables = new SmartList<PsiExpression>();
final Object o = myEvaluationHelper.computeExpression((PsiExpression)expression, uncomputables);
addStringFragment(String.valueOf(o), result);
// in many languages 'null' is a reserved word
addStringFragment(o == null? "missingValue" : String.valueOf(o), result);
if (uncomputables.size() > 0) {
unparsable.set(Boolean.TRUE);
}
@@ -49,24 +49,12 @@ import java.util.List;
public class AndroidLogcatToolWindowFactory implements ToolWindowFactory, Condition<Project> {
public static final String TOOL_WINDOW_ID = AndroidBundle.message("android.logcat.title");
public void createToolWindowContent(Project project, final ToolWindow toolWindow) {
public void createToolWindowContent(final Project project, final ToolWindow toolWindow) {
toolWindow.setIcon(AndroidUtils.ANDROID_ICON);
toolWindow.setAvailable(true, null);
toolWindow.setToHideOnEmptyContent(true);
toolWindow.setTitle(TOOL_WINDOW_ID);
List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
if (facets.size() == 0) {
Messages.showErrorDialog(project, AndroidBundle.message("android.logcat.no.android.facets.error"), CommonBundle.getErrorTitle());
return;
}
AndroidFacet facet = facets.get(0);
AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
if (platform == null) {
Messages.showErrorDialog(project, AndroidBundle.message("specify.platform.error"), CommonBundle.getErrorTitle());
return;
}
final AndroidLogcatToolWindowView view = new AndroidLogcatToolWindowView(project) {
@Override
protected boolean isActive() {
@@ -85,6 +73,9 @@ public class AndroidLogcatToolWindowFactory implements ToolWindowFactory, Condit
if (visible != myToolWindowVisible) {
myToolWindowVisible = visible;
view.activate();
if (visible) {
checkFacetAndSdk(project);
}
}
}
}
@@ -104,6 +95,20 @@ public class AndroidLogcatToolWindowFactory implements ToolWindowFactory, Condit
});
}
private static void checkFacetAndSdk(Project project) {
List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
if (facets.size() == 0) {
Messages.showErrorDialog(project, AndroidBundle.message("android.logcat.no.android.facets.error"), CommonBundle.getErrorTitle());
return;
}
AndroidFacet facet = facets.get(0);
AndroidPlatform platform = facet.getConfiguration().getAndroidPlatform();
if (platform == null) {
Messages.showErrorDialog(project, AndroidBundle.message("specify.platform.error"), CommonBundle.getErrorTitle());
}
}
public boolean value(Project project) {
ModuleManager manager = ModuleManager.getInstance(project);
for (Module module : manager.getModules()) {
@@ -17,19 +17,15 @@ package org.jetbrains.android.maven;
import com.android.sdklib.IAndroidTarget;
import com.intellij.facet.FacetType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.HashSet;
import org.jdom.Element;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.facet.AndroidFacetConfiguration;
@@ -48,10 +44,7 @@ import org.jetbrains.idea.maven.importing.MavenRootModelAdapter;
import org.jetbrains.idea.maven.project.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
@@ -100,20 +93,13 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
Map<MavenProject, String> mavenProjectToModuleName,
List<MavenProjectsProcessorTask> postTasks) {
configurePaths(facet, mavenProject);
configureAndroidPlatform(facet, mavenProject);
configureAndroidPlatform(facet, mavenProject, modelsProvider);
}
private void configureAndroidPlatform(AndroidFacet facet, MavenProject project) {
private void configureAndroidPlatform(AndroidFacet facet, MavenProject project, MavenModifiableModelsProvider modelsProvider) {
Sdk platformLib = findOrCreateAndroidPlatform(project);
if (platformLib != null) {
final ModifiableRootModel model = ModuleRootManager.getInstance(facet.getModule()).getModifiableModel();
model.setSdk(platformLib);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
model.commit();
}
});
modelsProvider.getRootModel(facet.getModule()).setSdk(platformLib);
}
//facet.getConfiguration().ADD_ANDROID_LIBRARY = false;
}
@@ -123,11 +109,27 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
String sdkPath = System.getenv("ANDROID_HOME");
LOG.info("android home: " + sdkPath);
if (sdkPath == null) {
sdkPath = suggestAndroidSdkPath();
LOG.info("suggested sdk: " + sdkPath);
if (sdkPath != null) {
final Sdk sdk = findOrCreateAndroidPlatform(project, sdkPath);
if (sdk != null) {
return sdk;
}
}
final Collection<String> candidates = suggestAndroidSdkPaths();
LOG.info("suggested sdks: " + candidates);
for (String candidate : candidates) {
final Sdk sdk = findOrCreateAndroidPlatform(project, candidate);
if (sdk != null) {
return sdk;
}
}
return null;
}
@Nullable
private Sdk findOrCreateAndroidPlatform(MavenProject project, String sdkPath) {
String apiLevel = null;
if (sdkPath != null) {
Element sdkRoot = getConfig(project, "sdk");
@@ -148,13 +150,7 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
if (target != null) {
Sdk library = AndroidUtils.findAppropriateAndroidPlatform(target, sdk);
if (library == null) {
final LibraryTable.ModifiableModel model = LibraryTablesRegistrar.getInstance().getLibraryTable().getModifiableModel();
library = AndroidSdkUtils.createNewAndroidPlatform(target, sdkPath, true);
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
model.commit();
}
});
}
return library;
}
@@ -163,18 +159,23 @@ public class AndroidFacetImporter extends FacetImporter<AndroidFacet, AndroidFac
return null;
}
@Nullable
private static String suggestAndroidSdkPath() {
@NotNull
private static Collection<String> suggestAndroidSdkPaths() {
final List<Sdk> androidSdks = ProjectJdkTable.getInstance().getSdksOfType(AndroidSdkType.getInstance());
final Set<String> result = new HashSet<String>(androidSdks.size());
for (Sdk androidSdk : androidSdks) {
final VirtualFile sdkHome = androidSdk.getHomeDirectory();
if (sdkHome != null && sdkHome.exists() && sdkHome.isValid() && sdkHome.isDirectory()) {
return sdkHome.getPath();
final String path = sdkHome.getPath();
if (path != null) {
result.add(path);
}
}
}
return null;
return result;
}
private void configurePaths(AndroidFacet facet, MavenProject project) {
@@ -81,7 +81,7 @@ public abstract class AndroidSdk {
public IAndroidTarget findTargetByApiLevel(@NotNull String apiLevel) {
IAndroidTarget candidate = null;
for (IAndroidTarget target : getTargets()) {
if (apiLevel.equals(target.getVersion().getApiString())) {
if (apiLevel.equals(target.getVersion().getApiString()) || apiLevel.equals(target.getVersionName())) {
if (target.isPlatform()) {
return target;
}
-1
View File
@@ -299,7 +299,6 @@
<action id="Debugger.RemoveAllWatches" class="com.intellij.debugger.actions.RemoveAllWatchesAction"/>
<action id="Debugger.RemoveWatch" class="com.intellij.debugger.actions.RemoveWatchAction" icon="/actions/delete.png"/>
<action id="Debugger.ViewAsGroup" class="com.intellij.debugger.actions.ViewAsGroup"/>
<action id="Debugger.MarkObject" class="com.intellij.debugger.actions.MarkObjectAction"/>
<action id="Debugger.SetValue" class="com.intellij.debugger.actions.SetValueAction"/>
<!--<action id="Debugger.ShowAsHex" class="com.intellij.debugger.actions.ShowAsHexAction" text="Show as Hex"/>-->
<action id="Debugger.ShowFrame" class="com.intellij.debugger.actions.ShowFrameAction"/>
@@ -83,6 +83,8 @@
<xs:element ref="xhtml:span"/>
<xs:element ref="xhtml:bdo"/>
<xs:element ref="xhtml:br"/>
<xs:element ref="xhtml:wbr"/>
<xs:element ref="xhtml:s"/>
<xs:group ref="xhtml:ins.elem.phrasing"/>
<xs:group ref="xhtml:del.elem.phrasing"/>
<xs:element ref="xhtml:img"/>
@@ -200,6 +202,7 @@
<xs:attribute ref="xml:id"/>
<xs:attribute name="class" type="common.data.tokens"/>
<xs:attribute name="title"/>
<xs:attribute name="role"/>
<xs:attribute ref="xml:base"/>
<xs:attribute ref="xml:space"/>
</xs:attributeGroup>
@@ -1167,6 +1170,18 @@
<xs:attributeGroup ref="xhtml:br.attrs"/>
</xs:complexType>
</xs:element>
<xs:element name="wbr">
<xs:complexType>
<xs:attributeGroup ref="xhtml:common.attrs"/>
</xs:complexType>
</xs:element>
<xs:element name="s">
<xs:complexType>
<xs:attributeGroup ref="xhtml:common.attrs"/>
</xs:complexType>
</xs:element>
<xs:attributeGroup name="br.attrs">
<xs:attributeGroup ref="common.attrs"/>
</xs:attributeGroup>
@@ -89,7 +89,7 @@ public class HtmlUtil {
private HtmlUtil() {}
@NonNls private static final String[] EMPTY_TAGS = {
"base","hr","meta","link","frame","br","basefont","param","img","area","input","isindex","col", /*html 5*/ "source"
"base","hr","meta","link","frame","br","basefont","param","img","area","input","isindex","col", /*html 5*/ "source","wbr"
};
private static final Set<String> EMPTY_TAGS_MAP = new THashSet<String>();
@NonNls private static final String[] OPTIONAL_END_TAGS = {
@@ -92,9 +92,7 @@ public class HtmlDescriptorsTable {
private static void loadHtmlElements(final String resourceName, List<String> htmlTagNames) throws JDOMException, IOException {
final Document document = JDOMUtil.loadDocument(HtmlDescriptorsTable.class.getResourceAsStream(resourceName));
final List elements = document.getRootElement().getChildren(TAG_ELEMENT_NAME);
HtmlDocumentationProvider.setBaseHtmlExtDocUrl(
document.getRootElement().getAttribute(BASE_HELP_REF_ATTR).getValue()
);
final String baseHtmlExtDocUrl = document.getRootElement().getAttribute(BASE_HELP_REF_ATTR).getValue();
for (Object object : elements) {
final Element element = (Element)object;
@@ -103,7 +101,7 @@ public class HtmlDescriptorsTable {
HtmlTagDescriptor value = new HtmlTagDescriptor();
ourTagTable.put(htmlTagName, value);
value.setHelpRef(element.getAttributeValue(HELPREF_ATTR));
value.setHelpRef(baseHtmlExtDocUrl + element.getAttributeValue(HELPREF_ATTR));
value.setDescription(element.getAttributeValue(DESCRIPTION_ATTR));
value.setName(htmlTagName);
@@ -41,7 +41,6 @@ import java.util.List;
* @author maxim
*/
public class HtmlDocumentationProvider implements DocumentationProvider {
private static String ourBaseHtmlExtDocUrl;
private static DocumentationProvider ourStyleProvider;
private static DocumentationProvider ourScriptProvider;
@@ -75,7 +74,7 @@ public class HtmlDocumentationProvider implements DocumentationProvider {
final EntityDescriptor descriptor = findDocumentationDescriptor(element, context);
if (descriptor!=null) {
return ourBaseHtmlExtDocUrl + descriptor.getHelpRef();
return descriptor.getHelpRef();
} else {
return null;
}
@@ -311,14 +310,6 @@ public class HtmlDocumentationProvider implements DocumentationProvider {
return PsiTreeUtil.getParentOfType(context,XmlTag.class,false);
}
public static void setBaseHtmlExtDocUrl(String baseHtmlExtDocUrl) {
ourBaseHtmlExtDocUrl = baseHtmlExtDocUrl;
}
static String getBaseHtmlExtDocUrl() {
return ourBaseHtmlExtDocUrl;
}
public static void registerScriptDocumentationProvider(final DocumentationProvider provider) {
ourScriptProvider = provider;
}
@@ -228,7 +228,7 @@ public class XmlDocumentationProvider implements DocumentationProvider {
if (descriptor != null && append) {
buf.append("<br>");
buf.append(XmlBundle.message("html.quickdoc.additional.template",
HtmlDocumentationProvider.getBaseHtmlExtDocUrl() + descriptor.getHelpRef(),
descriptor.getHelpRef(),
BASE_SITEPOINT_URL + tag.getName()));
}
}