mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+4
-1
@@ -680,7 +680,10 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
}
|
||||
|
||||
if (method != null) {
|
||||
method = (PsiMethod)method.getNavigationElement();
|
||||
final PsiElement navElement = method.getNavigationElement();
|
||||
if (navElement instanceof PsiMethod) {
|
||||
method = (PsiMethod)navElement;
|
||||
}
|
||||
PsiExpression[] expressions = list.getExpressions();
|
||||
int index = -1;
|
||||
for (int i = 0; i < expressions.length; i++) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 212 B |
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.actions.CreateFileFromTemplateDialog">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="27dc6" binding="myPanel" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="76"/>
|
||||
<xy x="20" y="20" width="500" height="84"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -28,7 +28,7 @@
|
||||
</component>
|
||||
<component id="48008" class="javax.swing.JComboBox" binding="myKindCombo">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
@@ -42,6 +42,14 @@
|
||||
<columns value="30"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="70da6" class="javax.swing.JLabel" binding="myUpDownHint">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<toolTipText value="Pressing Up or Down arrows while in editor changes the kind"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
@@ -16,19 +16,26 @@
|
||||
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.ui.ComboboxSpeedSearch;
|
||||
import com.intellij.util.Icons;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -38,6 +45,7 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
|
||||
private JTextField myNameField;
|
||||
private JComboBox myKindCombo;
|
||||
private JPanel myPanel;
|
||||
private JLabel myUpDownHint;
|
||||
|
||||
private ElementCreator myCreator;
|
||||
|
||||
@@ -69,6 +77,30 @@ public class CreateFileFromTemplateDialog extends DialogWrapper {
|
||||
}
|
||||
};
|
||||
|
||||
final AnAction arrow = new AnAction() {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
if (e.getInputEvent() instanceof KeyEvent) {
|
||||
final int code = ((KeyEvent)e.getInputEvent()).getKeyCode();
|
||||
final int delta = code == KeyEvent.VK_DOWN ? 1 : code == KeyEvent.VK_UP ? -1 : 0;
|
||||
|
||||
final int size = myKindCombo.getModel().getSize();
|
||||
int next = myKindCombo.getSelectedIndex() + delta;
|
||||
if (next < 0 || next >= size) {
|
||||
if (!UISettings.getInstance().CYCLE_SCROLLING) {
|
||||
return;
|
||||
}
|
||||
next = (next + size) % size;
|
||||
}
|
||||
myKindCombo.setSelectedIndex(next);
|
||||
}
|
||||
}
|
||||
};
|
||||
final KeyboardShortcut up = new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_UP, 0), null);
|
||||
final KeyboardShortcut down = new KeyboardShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, 0), null);
|
||||
arrow.registerCustomShortcutSet(new CustomShortcutSet(up, down), myNameField);
|
||||
|
||||
myUpDownHint.setIcon(Icons.UP_DOWN_ARROWS);
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@@ -780,8 +780,14 @@ public class AbstractTreeUi {
|
||||
}
|
||||
|
||||
private boolean _update(NodeDescriptor nodeDescriptor) {
|
||||
nodeDescriptor.setUpdateCount(nodeDescriptor.getUpdateCount() + 1);
|
||||
return getBuilder().updateNodeDescriptor(nodeDescriptor);
|
||||
try {
|
||||
nodeDescriptor.setUpdateCount(nodeDescriptor.getUpdateCount() + 1);
|
||||
return getBuilder().updateNodeDescriptor(nodeDescriptor);
|
||||
}
|
||||
catch (IndexNotReadyException e) {
|
||||
warnOnIndexNotReady();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void assertIsDispatchThread() {
|
||||
@@ -1283,10 +1289,7 @@ public class AbstractTreeUi {
|
||||
passOne = getTreeStructure().getChildElements(element);
|
||||
}
|
||||
catch (IndexNotReadyException e) {
|
||||
if (!myWasEverIndexNotReady) {
|
||||
myWasEverIndexNotReady = true;
|
||||
LOG.warn("Tree is not dumb-mode-aware; treeBuilder=" + getBuilder() + " treeStructure=" + getTreeStructure());
|
||||
}
|
||||
warnOnIndexNotReady();
|
||||
return ArrayUtil.EMPTY_OBJECT_ARRAY;
|
||||
}
|
||||
|
||||
@@ -1315,6 +1318,13 @@ public class AbstractTreeUi {
|
||||
return passOne;
|
||||
}
|
||||
|
||||
private void warnOnIndexNotReady() {
|
||||
if (!myWasEverIndexNotReady) {
|
||||
myWasEverIndexNotReady = true;
|
||||
LOG.warn("Tree is not dumb-mode-aware; treeBuilder=" + getBuilder() + " treeStructure=" + getTreeStructure());
|
||||
}
|
||||
}
|
||||
|
||||
private void updateNodesToInsert(final ArrayList<TreeNode> nodesToInsert,
|
||||
TreeUpdatePass pass,
|
||||
boolean canSmartExpand,
|
||||
|
||||
@@ -124,4 +124,6 @@ public abstract class Icons {
|
||||
|
||||
public static final Icon CONTENT_ROOT_ICON_OPEN = IconLoader.getIcon("/nodes/ModuleOpen.png");
|
||||
public static final Icon CONTENT_ROOT_ICON_CLOSED = IconLoader.getIcon("/nodes/ModuleClosed.png");
|
||||
|
||||
public static final Icon UP_DOWN_ARROWS = IconLoader.getIcon("/ide/upDown.png");
|
||||
}
|
||||
|
||||
+6
-5
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.annotator.intentions.dynamic.elements;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.PsiModifier;
|
||||
import com.intellij.psi.PsiVariable;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.annotator.intentions.dynamic.DynamicManager;
|
||||
@@ -57,7 +54,11 @@ public class DPropertyElement extends DItemElement {
|
||||
if (isStatic != null && isStatic.booleanValue()) {
|
||||
hashSet.add(PsiModifier.STATIC);
|
||||
}
|
||||
myPsi = new GrDynamicImplicitProperty(manager, getName(), getType(), containingClassName, new LightModifierList(manager, hashSet), null) {
|
||||
String type = getType();
|
||||
if (type == null) {
|
||||
type = CommonClassNames.JAVA_LANG_OBJECT;
|
||||
}
|
||||
myPsi = new GrDynamicImplicitProperty(manager, getName(), type, containingClassName, new LightModifierList(manager, hashSet), null) {
|
||||
@Override
|
||||
public PsiElement setName(@NotNull String name) throws IncorrectOperationException {
|
||||
DynamicManager.getInstance(getProject()).replaceDynamicPropertyName(containingClassName, getName(), name);
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class GrDynamicImplicitProperty extends GrImplicitVariableImpl implements
|
||||
private final Project myProject;
|
||||
private final PsiElement myNavigationalElement;
|
||||
|
||||
public GrDynamicImplicitProperty(PsiManager manager, @NonNls String name, @NonNls String type, String containingClassName,
|
||||
public GrDynamicImplicitProperty(PsiManager manager, @NonNls String name, @NonNls @NotNull String type, String containingClassName,
|
||||
LightModifierList modifierList, PsiElement navigationalElement) {
|
||||
super(modifierList, manager, name, type, navigationalElement);
|
||||
myContainingClassName = containingClassName;
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ public class GrImplicitVariableImpl extends LightVariableBase implements GrImpli
|
||||
myInnerModifierList = modifierList != null ? modifierList : myModifierList;
|
||||
}
|
||||
|
||||
public GrImplicitVariableImpl(PsiModifierList modifierList, PsiManager manager, @NonNls String name, @NonNls String type, PsiElement referenceExpression) {
|
||||
public GrImplicitVariableImpl(PsiModifierList modifierList, PsiManager manager, @NonNls String name, @NonNls @NotNull String type, PsiElement referenceExpression) {
|
||||
this(modifierList, manager, null, JavaPsiFacade.getElementFactory(manager.getProject()).
|
||||
createTypeFromText(type, referenceExpression), false, referenceExpression);
|
||||
myNameIdentifier = new GrLightIdentifier(myManager, name);
|
||||
|
||||
+17
-1
@@ -22,6 +22,7 @@ import com.intellij.execution.configurations.ConfigurationTypeUtil;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.execution.configurations.RunConfigurationModule;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -70,7 +71,22 @@ public class GroovyScriptRunConfigurationType implements LocatableConfigurationT
|
||||
}
|
||||
|
||||
public boolean isConfigurationByLocation(RunConfiguration configuration, Location location) {
|
||||
return false;
|
||||
final String path = ((GroovyScriptRunConfiguration)configuration).scriptPath;
|
||||
if (path == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final PsiFile file = location.getPsiElement().getContainingFile();
|
||||
if (file == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final VirtualFile vfile = file.getVirtualFile();
|
||||
if (vfile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return FileUtil.toSystemIndependentName(path).equals(vfile.getPath());
|
||||
}
|
||||
|
||||
private RunnerAndConfigurationSettings createConfiguration(final PsiClass aClass) {
|
||||
|
||||
Reference in New Issue
Block a user