mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -24,6 +24,7 @@ import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelBase;
|
||||
import com.intellij.ide.util.projectWizard.*;
|
||||
import com.intellij.ide.wizard.CommitStepException;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
@@ -596,7 +597,12 @@ public class ProjectTypeStep extends ModuleWizardStep implements SettingsStep, D
|
||||
}
|
||||
|
||||
void loadRemoteTemplates(final ChooseTemplateStep chooseTemplateStep) {
|
||||
UiNotifyConnector.doWhenFirstShown(myPanel, () -> startLoadingRemoteTemplates(chooseTemplateStep));
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
UiNotifyConnector.doWhenFirstShown(myPanel, () -> startLoadingRemoteTemplates(chooseTemplateStep));
|
||||
}
|
||||
else {
|
||||
startLoadingRemoteTemplates(chooseTemplateStep);
|
||||
}
|
||||
}
|
||||
|
||||
private void startLoadingRemoteTemplates(ChooseTemplateStep chooseTemplateStep) {
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ public class RemoveUnusedVariableUtil {
|
||||
!(variable.getParent() instanceof PsiDeclarationStatement &&
|
||||
((PsiDeclarationStatement)variable.getParent()).getDeclaredElements().length > 1)) {
|
||||
if (deleteMode == RemoveMode.MAKE_STATEMENT) {
|
||||
element = element.replace(createStatementIfNeeded(expression, factory, element));
|
||||
element = element.getParent().replace(createStatementIfNeeded(expression, factory, element));
|
||||
List<PsiElement> references = new ArrayList<>();
|
||||
collectReferences(element, variable, references);
|
||||
deleteReferences(variable, references, deleteMode);
|
||||
|
||||
+1
@@ -47,6 +47,7 @@ public class InvertIfConditionAction extends PsiElementBaseIntentionAction {
|
||||
if (ifStatement == null) return false;
|
||||
final PsiExpression condition = ifStatement.getCondition();
|
||||
if (condition == null) return false;
|
||||
if (condition instanceof PsiPrefixExpression && ((PsiPrefixExpression)condition).getOperand() == null) return false;
|
||||
if (ifStatement.getThenBranch() == null) return false;
|
||||
if (element instanceof PsiKeyword) {
|
||||
PsiKeyword keyword = (PsiKeyword) element;
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.javadoc;
|
||||
|
||||
import com.intellij.codeInsight.*;
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.ExceptionUtil;
|
||||
import com.intellij.codeInsight.documentation.DocumentationManagerProtocol;
|
||||
import com.intellij.codeInsight.documentation.DocumentationManagerUtil;
|
||||
import com.intellij.javadoc.JavadocGeneratorRunProfile;
|
||||
@@ -1617,7 +1619,7 @@ public class JavaDocInfoGenerator {
|
||||
if (valueElement == null) return false;
|
||||
if (Arrays.stream(localTags)
|
||||
.map(PsiDocTag::getValueElement)
|
||||
.map(ObjectUtils::notNull)
|
||||
.filter(Objects::nonNull)
|
||||
.anyMatch(docTagValue -> areWeakEqual(docTagValue.getText(), valueElement.getText()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Invert 'if' condition" "false"
|
||||
class A {
|
||||
public void foo(boolean c) {
|
||||
if (<caret>!) return;
|
||||
}
|
||||
}
|
||||
+14
-3
@@ -70,9 +70,19 @@ public class JavaCodeInsightSanityTest extends LightPlatformCodeInsightFixtureTe
|
||||
}
|
||||
|
||||
private static boolean shouldGoInsiderDir(@NotNull String name) {
|
||||
return !name.equals("out") &&
|
||||
!name.equals("gen") && // https://youtrack.jetbrains.com/issue/IDEA-175404
|
||||
!name.endsWith("system") && !name.endsWith("config");
|
||||
return !name.equals("gen") && // https://youtrack.jetbrains.com/issue/IDEA-175404
|
||||
!name.equals("reports") && // no idea what this is
|
||||
!name.equals("android") && // no 'android' repo on agents in some builds
|
||||
!containsBinariesOnly(name) &&
|
||||
!name.endsWith("system") && !name.endsWith("config"); // temporary stuff from tests or debug IDE
|
||||
}
|
||||
|
||||
private static boolean containsBinariesOnly(@Nullable String name) {
|
||||
return name.equals("jdk") ||
|
||||
name.equals("jre") ||
|
||||
name.equals("lib") ||
|
||||
name.equals("bin") ||
|
||||
name.equals("out");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -114,6 +124,7 @@ public class JavaCodeInsightSanityTest extends LightPlatformCodeInsightFixtureTe
|
||||
}
|
||||
|
||||
List<File> toChoose = preferDirs(data, children);
|
||||
Collections.sort(toChoose);
|
||||
int index = data.drawInt(IntDistribution.uniform(0, toChoose.size() - 1));
|
||||
File generated = generateRandomFile(data, toChoose.get(index), exhausted);
|
||||
if (generated != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.diff.tools.util.DiffDataKeys;
|
||||
import com.intellij.diff.util.DiffUserDataKeys;
|
||||
import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.ide.actions.EditSourceAction;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataKey;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
@@ -44,7 +43,7 @@ public class OpenInEditorAction extends EditSourceAction implements DumbAware {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
if (!ActionPlaces.isToolbarPlace(e.getPlace())) {
|
||||
if (!e.isActionToolbar()) {
|
||||
e.getPresentation().setEnabledAndVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
+8
-5
@@ -714,6 +714,13 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
myUpdateDocAlarm.addRequest(() -> {
|
||||
if (myProject.isDisposed()) return;
|
||||
LOG.debug("Started fetching documentation...");
|
||||
|
||||
final PsiElement element = ReadAction.compute(() -> provider.getElement());
|
||||
if (element == null) {
|
||||
LOG.debug("Element for which documentation was requested is not available anymore");
|
||||
return;
|
||||
}
|
||||
|
||||
final Throwable[] ex = new Throwable[1];
|
||||
String text = null;
|
||||
try {
|
||||
@@ -738,11 +745,6 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
|
||||
LOG.debug("Documentation fetched successfully:\n", text);
|
||||
|
||||
final PsiElement element = ReadAction.compute(() -> provider.getElement());
|
||||
if (element == null) {
|
||||
LOG.debug("Element for which documentation was requested is not available anymore");
|
||||
return;
|
||||
}
|
||||
final String documentationText = text;
|
||||
PsiDocumentManager.getInstance(myProject).performLaterWhenAllCommitted(() -> {
|
||||
if (!element.isValid()) {
|
||||
@@ -1132,6 +1134,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
|
||||
final Ref<String> result = new Ref<>();
|
||||
QuickDocUtil.runInReadActionWithWriteActionPriorityWithRetries(() -> {
|
||||
if (!myElement.isValid()) return;
|
||||
final SmartPsiElementPointer originalElement = myElement.getUserData(ORIGINAL_ELEMENT_KEY);
|
||||
String doc = provider.generateDoc(myElement, originalElement != null ? originalElement.getElement() : null);
|
||||
result.set(doc);
|
||||
|
||||
+17
-6
@@ -22,31 +22,42 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class CreateFromTemplateAction extends CreateFromTemplateActionBase {
|
||||
private final Supplier<FileTemplate> myTemplate;
|
||||
|
||||
private final FileTemplate myTemplate;
|
||||
// Avoid calling the constructor from normal IDE actions, because:
|
||||
// - Normal actions are preloaded at startup
|
||||
// - Accessing FileTemplate out of FileTemplateManager triggers costly initialization
|
||||
public CreateFromTemplateAction(@NotNull FileTemplate template) {
|
||||
this(template.getName(), FileTemplateUtil.getIcon(template), () -> template);
|
||||
}
|
||||
|
||||
public CreateFromTemplateAction(FileTemplate template){
|
||||
super(template.getName(), null, FileTemplateUtil.getIcon(template));
|
||||
public CreateFromTemplateAction(String templateName, @Nullable Icon icon, @NotNull Supplier<FileTemplate> template){
|
||||
super(templateName, null, icon);
|
||||
myTemplate = template;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected FileTemplate getTemplate(final Project project, final PsiDirectory dir) {
|
||||
return myTemplate;
|
||||
return myTemplate.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e){
|
||||
super.update(e);
|
||||
Presentation presentation = e.getPresentation();
|
||||
boolean isEnabled = CreateFromTemplateGroup.canCreateFromTemplate(e, myTemplate);
|
||||
boolean isEnabled = CreateFromTemplateGroup.canCreateFromTemplate(e, myTemplate.get());
|
||||
presentation.setEnabled(isEnabled);
|
||||
presentation.setVisible(isEnabled);
|
||||
}
|
||||
|
||||
public FileTemplate getTemplate() {
|
||||
return myTemplate;
|
||||
return myTemplate.get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.ide.SelectInContext;
|
||||
import com.intellij.ide.SelectInManager;
|
||||
import com.intellij.ide.StandardTargetWeights;
|
||||
import com.intellij.ide.impl.ProjectViewSelectInTarget;
|
||||
import com.intellij.ide.scratch.ScratchUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.packageDependencies.DependencyValidationManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -53,6 +54,7 @@ public class ScopePaneSelectInTarget extends ProjectViewSelectInTarget {
|
||||
@Nullable
|
||||
private NamedScope getContainingScope(@Nullable PsiFile file) {
|
||||
if (file == null) return null;
|
||||
if (ScratchUtil.isScratch(file.getVirtualFile())) return null;
|
||||
NamedScopesHolder scopesHolder = DependencyValidationManager.getInstance(myProject);
|
||||
for (NamedScope scope : ScopeViewPane.getShownScopes(myProject)) {
|
||||
PackageSet packageSet = scope.getValue();
|
||||
|
||||
@@ -21,11 +21,9 @@ import com.intellij.openapi.editor.markup.EffectType;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.accessibility.Accessible;
|
||||
import javax.accessibility.AccessibleAction;
|
||||
import javax.accessibility.AccessibleContext;
|
||||
import javax.accessibility.AccessibleRole;
|
||||
import javax.swing.*;
|
||||
@@ -40,7 +38,6 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
protected Icon myIcon;
|
||||
protected int myIconTextGap;
|
||||
protected ArrayList<HighlightedRegion> myHighlightedRegions;
|
||||
protected TIntObjectHashMap<FontMetrics> myFontMetrics;
|
||||
protected boolean myIsSelected;
|
||||
protected boolean myHasFocus;
|
||||
protected boolean myPaintUnfocusedSelection = false;
|
||||
@@ -48,20 +45,13 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
|
||||
public HighlightableComponent() {
|
||||
myIconTextGap = 4;
|
||||
myFontMetrics = new TIntObjectHashMap<>();
|
||||
setText("");
|
||||
fillFontMetricsMap();
|
||||
setOpaque(true);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
protected void fillFontMetricsMap() {
|
||||
Font font = getFont();
|
||||
if (font != null){
|
||||
myFontMetrics.put(Font.PLAIN, getFontMetrics(font.deriveFont(Font.PLAIN)));
|
||||
myFontMetrics.put(Font.BOLD, getFontMetrics(font.deriveFont(Font.BOLD)));
|
||||
myFontMetrics.put(Font.ITALIC, getFontMetrics(font.deriveFont(Font.ITALIC)));
|
||||
myFontMetrics.put(Font.BOLD | Font.ITALIC, getFontMetrics(font.deriveFont(Font.BOLD | Font.ITALIC)));
|
||||
}
|
||||
@Override public void updateUI() {
|
||||
UISettings.setupComponentAntialiasing(this);
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
@@ -88,13 +78,6 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
myIcon = icon;
|
||||
}
|
||||
|
||||
public void setFont(Font font) {
|
||||
if (!font.equals(getFont())){
|
||||
super.setFont(font);
|
||||
fillFontMetricsMap();
|
||||
}
|
||||
}
|
||||
|
||||
public void addHighlighter(int startOffset, int endOffset, TextAttributes attributes) {
|
||||
addHighlighter(0, startOffset, endOffset, attributes);
|
||||
}
|
||||
@@ -298,7 +281,8 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
offset += defFontMetrics.stringWidth(text);
|
||||
}
|
||||
|
||||
FontMetrics fontMetrics = myFontMetrics.get(hRegion.textAttributes.getFontType());
|
||||
Font regFont = getFont().deriveFont(hRegion.textAttributes.getFontType());
|
||||
FontMetrics fontMetrics = getFontMetrics(regFont);
|
||||
|
||||
text = myText.substring(hRegion.startOffset, hRegion.endOffset);
|
||||
|
||||
@@ -313,8 +297,7 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
|
||||
if (hRegion.textAttributes.getForegroundColor() != null && paintHighlightsForeground) {
|
||||
g.setColor(hRegion.textAttributes.getForegroundColor());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
g.setColor(fgColor);
|
||||
}
|
||||
|
||||
@@ -323,7 +306,7 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
|
||||
// draw highlight underscored line
|
||||
|
||||
if (hRegion.textAttributes.getEffectColor() != null) {
|
||||
if (hRegion.textAttributes.getEffectType() != null && hRegion.textAttributes.getEffectColor() != null) {
|
||||
g.setColor(hRegion.textAttributes.getEffectColor());
|
||||
int y = yOffset/*fontMetrics.getMaxAscent()*/ + 2;
|
||||
UIUtil.drawLine(g, offset, y, offset + fontMetrics.stringWidth(text) - 1, y);
|
||||
@@ -385,7 +368,9 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
if (width > x) return null;
|
||||
|
||||
String text = getRegionText(hRegion);
|
||||
FontMetrics fontMetrics = myFontMetrics.get(hRegion.textAttributes.getFontType());
|
||||
Font regFont = getFont().deriveFont(hRegion.textAttributes.getFontType());
|
||||
FontMetrics fontMetrics = getFontMetrics(regFont);
|
||||
|
||||
width += fontMetrics.stringWidth(text);
|
||||
if (width > x) return hRegion;
|
||||
}
|
||||
@@ -409,7 +394,9 @@ public class HighlightableComponent extends JComponent implements Accessible {
|
||||
endIndex = hRegion.endOffset;
|
||||
|
||||
String text = getRegionText(hRegion);
|
||||
FontMetrics fontMetrics = myFontMetrics.get(hRegion.textAttributes.getFontType());
|
||||
Font regFont = getFont().deriveFont(hRegion.textAttributes.getFontType());
|
||||
FontMetrics fontMetrics = getFontMetrics(regFont);
|
||||
|
||||
width += fontMetrics.stringWidth(text);
|
||||
}
|
||||
width += defFontMetrics.stringWidth(myText.substring(endIndex, myText.length()));
|
||||
|
||||
@@ -59,6 +59,9 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
private final TextAttributes myAnchorAttributes;
|
||||
private HyperlinkListener myHyperlinkListener = null;
|
||||
|
||||
private boolean myMouseHover;
|
||||
private boolean myMousePressed;
|
||||
|
||||
public HyperlinkLabel() {
|
||||
this("");
|
||||
}
|
||||
@@ -72,8 +75,10 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
}
|
||||
|
||||
public HyperlinkLabel(String text, final Color textForegroundColor, final Color textBackgroundColor, final Color textEffectColor) {
|
||||
myAnchorAttributes =
|
||||
myAnchorAttributes = UIUtil.isUnderWin10LookAndFeel() ?
|
||||
new Win10TextAttributes(textBackgroundColor) :
|
||||
new TextAttributes(textForegroundColor, textBackgroundColor, textEffectColor, EffectType.LINE_UNDERSCORE, Font.PLAIN);
|
||||
|
||||
enforceBackgroundOutsideText(textBackgroundColor);
|
||||
setHyperlinkText(text);
|
||||
enableEvents(AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
|
||||
@@ -114,11 +119,21 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
}
|
||||
|
||||
protected void processMouseEvent(MouseEvent e) {
|
||||
if (e.getID() == MouseEvent.MOUSE_EXITED) {
|
||||
if (e.getID() == MouseEvent.MOUSE_ENTERED && isOnLink(e.getX())) {
|
||||
myMouseHover = true;
|
||||
repaint();
|
||||
} else if (e.getID() == MouseEvent.MOUSE_EXITED) {
|
||||
setCursor(Cursor.getDefaultCursor());
|
||||
}
|
||||
else if (UIUtil.isActionClick(e, MouseEvent.MOUSE_PRESSED) && isOnLink(e.getX())) {
|
||||
myMouseHover = false;
|
||||
myMousePressed = false;
|
||||
repaint();
|
||||
} else if (UIUtil.isActionClick(e, MouseEvent.MOUSE_PRESSED) && isOnLink(e.getX())) {
|
||||
fireHyperlinkEvent();
|
||||
myMousePressed = true;
|
||||
repaint();
|
||||
} else if (e.getID() == MouseEvent.MOUSE_RELEASED) {
|
||||
myMousePressed = false;
|
||||
repaint();
|
||||
}
|
||||
super.processMouseEvent(e);
|
||||
}
|
||||
@@ -126,7 +141,14 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
@Override
|
||||
protected void processMouseMotionEvent(MouseEvent e) {
|
||||
if (e.getID() == MouseEvent.MOUSE_MOVED) {
|
||||
setCursor(isOnLink(e.getX()) ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) : Cursor.getDefaultCursor());
|
||||
boolean onLink = isOnLink(e.getX());
|
||||
boolean needRepaint = myMouseHover != onLink;
|
||||
myMouseHover = onLink;
|
||||
setCursor(myMouseHover ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR) : Cursor.getDefaultCursor());
|
||||
|
||||
if (needRepaint) {
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
super.processMouseMotionEvent(e);
|
||||
}
|
||||
@@ -240,6 +262,7 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
setFont(UIUtil.getLabelFont());
|
||||
}
|
||||
|
||||
@@ -253,7 +276,7 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
|
||||
/**
|
||||
* Hyperlink accessibility: "HYPERLINK" role and expose a "click" action.
|
||||
* @see javax.swing.AbstractButton.AccessibleAbstractButton
|
||||
* @see AbstractButton.AccessibleAbstractButton
|
||||
*/
|
||||
protected class AccessibleHyperlinkLabel extends AccessibleHighlightable implements AccessibleAction {
|
||||
@Override
|
||||
@@ -291,4 +314,35 @@ public class HyperlinkLabel extends HighlightableComponent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class Win10TextAttributes extends TextAttributes {
|
||||
private Win10TextAttributes(Color textBackgroundColor) {
|
||||
super(null, textBackgroundColor, null, null, Font.PLAIN);
|
||||
}
|
||||
|
||||
@Override public Color getForegroundColor() {
|
||||
return !isEnabled() ? UIManager.getColor("Label.disabledForeground") :
|
||||
myMousePressed ? UIManager.getColor("link.pressed.foreground") :
|
||||
myMouseHover ? UIManager.getColor("link.hover.foreground") :
|
||||
UIManager.getColor("link.foreground");
|
||||
}
|
||||
|
||||
@Override public Color getEffectColor() {
|
||||
return getForegroundColor();
|
||||
}
|
||||
|
||||
@Override public EffectType getEffectType() {
|
||||
return !isEnabled() || myMouseHover || myMousePressed ? EffectType.LINE_UNDERSCORE : null;
|
||||
}
|
||||
|
||||
@Override public void setForegroundColor(Color color) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override public void setEffectColor(Color color) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
@Override public void setEffectType(EffectType effectType) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class ActionButton extends JComponent implements ActionButtonComponent, A
|
||||
}
|
||||
});
|
||||
popupMenu.setDataContextProvider(() -> this.getDataContext());
|
||||
if (ActionPlaces.isToolbarPlace(event.getPlace())) {
|
||||
if (event.isActionToolbar()) {
|
||||
popupMenu.getComponent().show(this, 0, getHeight());
|
||||
}
|
||||
else {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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,7 +36,7 @@ public class ToggleUseSoftWrapsMenuAction extends AbstractToggleUseSoftWrapsActi
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e){
|
||||
super.update(e);
|
||||
if (!ActionPlaces.isToolbarPlace(e.getPlace())) {
|
||||
if (!e.isActionToolbar()) {
|
||||
e.getPresentation().setIcon(null);
|
||||
}
|
||||
if (ActionPlaces.UNKNOWN.equals(e.getPlace())) {
|
||||
|
||||
+21
-3
@@ -1,9 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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.coverage.actions;
|
||||
|
||||
import com.intellij.coverage.CoverageDataManager;
|
||||
import com.intellij.coverage.CoverageSuitesBundle;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.Project;
|
||||
|
||||
public class HideCoverageInfoAction extends AnAction {
|
||||
@@ -19,8 +37,8 @@ public class HideCoverageInfoAction extends AnAction {
|
||||
public void update(AnActionEvent e) {
|
||||
final Presentation presentation = e.getPresentation();
|
||||
presentation.setEnabled(false);
|
||||
presentation.setVisible(ActionPlaces.isToolbarPlace(e.getPlace()));
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
presentation.setVisible(e.isActionToolbar());
|
||||
final Project project = e.getProject();
|
||||
if (project != null) {
|
||||
final CoverageSuitesBundle suitesBundle = CoverageDataManager.getInstance(project).getCurrentSuitesBundle();
|
||||
presentation.setEnabled(suitesBundle != null);
|
||||
|
||||
@@ -178,7 +178,7 @@ public final class GitCommit extends VcsCommitMetadataImpl implements VcsFullCom
|
||||
|
||||
@NotNull
|
||||
private ParsedChanges parseChanges() throws VcsException {
|
||||
List<Change> mergedChanges = parseStatusInfo(getMergedStatusInfo(), ContainerUtil.map(getParents(), Hash::asString));
|
||||
List<Change> mergedChanges = parseStatusInfo(getMergedStatusInfo(), 0);
|
||||
List<Collection<Change>> changes = computeChanges(mergedChanges);
|
||||
ParsedChanges parsedChanges = new ParsedChanges(mergedChanges, changes);
|
||||
myChanges.compareAndSet(this, parsedChanges);
|
||||
@@ -230,17 +230,19 @@ public final class GitCommit extends VcsCommitMetadataImpl implements VcsFullCom
|
||||
else {
|
||||
List<Collection<Change>> changes = ContainerUtil.newArrayListWithCapacity(myChangesOutput.size());
|
||||
for (int i = 0; i < myChangesOutput.size(); i++) {
|
||||
List<GitLogStatusInfo> statusInfos = myChangesOutput.get(i);
|
||||
changes.add(parseStatusInfo(statusInfos, Collections.singletonList(getParents().get(i).asString())));
|
||||
changes.add(parseStatusInfo(myChangesOutput.get(i), i));
|
||||
}
|
||||
return changes;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<Change> parseStatusInfo(@NotNull List<GitLogStatusInfo> changes,
|
||||
@NotNull List<String> parentHashes) throws VcsException {
|
||||
return GitChangesParser.parse(myProject, getRoot(), changes, getId().asString(), new Date(getCommitTime()), parentHashes);
|
||||
private List<Change> parseStatusInfo(@NotNull List<GitLogStatusInfo> changes, int parentIndex) throws VcsException {
|
||||
String parentHash = null;
|
||||
if (parentIndex < getParents().size()) {
|
||||
parentHash = getParents().get(parentIndex).asString();
|
||||
}
|
||||
return GitChangesParser.parse(myProject, getRoot(), changes, getId().asString(), new Date(getCommitTime()), parentHash);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.intellij.openapi.vcs.history.VcsRevisionNumber;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import git4idea.GitContentRevision;
|
||||
import git4idea.GitRevisionNumber;
|
||||
import git4idea.history.wholeTree.AbstractHash;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -41,37 +40,27 @@ public class GitChangesParser {
|
||||
@NotNull List<GitLogStatusInfo> statusInfos,
|
||||
@NotNull String hash,
|
||||
@NotNull Date date,
|
||||
@NotNull List<String> parentsHashes) throws VcsException {
|
||||
@Nullable String parentsHash) throws VcsException {
|
||||
GitRevisionNumber thisRevision = new GitRevisionNumber(hash, date);
|
||||
List<GitRevisionNumber> parentRevisions = prepareParentRevisions(parentsHashes);
|
||||
GitRevisionNumber parentRevision = parentsHash == null ? null : new GitRevisionNumber(parentsHash);
|
||||
|
||||
List<Change> result = new ArrayList<>();
|
||||
for (GitLogStatusInfo statusInfo : statusInfos) {
|
||||
result.add(parseChange(project, root, parentRevisions, statusInfo, thisRevision));
|
||||
result.add(parseChange(project, root, thisRevision, parentRevision, statusInfo));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static List<GitRevisionNumber> prepareParentRevisions(List<String> parentsHashes) {
|
||||
final List<AbstractHash> parents = new ArrayList<>(parentsHashes.size());
|
||||
for (String parentsShortHash : parentsHashes) {
|
||||
parents.add(AbstractHash.create(parentsShortHash));
|
||||
}
|
||||
|
||||
final List<GitRevisionNumber> parentRevisions = new ArrayList<>(parents.size());
|
||||
for (AbstractHash parent : parents) {
|
||||
parentRevisions.add(new GitRevisionNumber(parent.getString()));
|
||||
}
|
||||
return parentRevisions;
|
||||
}
|
||||
|
||||
private static Change parseChange(final Project project, final VirtualFile vcsRoot, final List<GitRevisionNumber> parentRevisions,
|
||||
final GitLogStatusInfo statusInfo, final VcsRevisionNumber thisRevision) throws VcsException {
|
||||
@NotNull
|
||||
private static Change parseChange(@NotNull Project project,
|
||||
@NotNull VirtualFile vcsRoot,
|
||||
@NotNull VcsRevisionNumber thisRevision,
|
||||
@Nullable VcsRevisionNumber parentRevision,
|
||||
@NotNull GitLogStatusInfo statusInfo) throws VcsException {
|
||||
final ContentRevision before;
|
||||
final ContentRevision after;
|
||||
FileStatus status = null;
|
||||
final String path = statusInfo.getFirstPath();
|
||||
@Nullable GitRevisionNumber firstParent = parentRevisions.isEmpty() ? null : parentRevisions.get(0);
|
||||
|
||||
switch (statusInfo.getType()) {
|
||||
case ADDED:
|
||||
@@ -86,13 +75,13 @@ public class GitChangesParser {
|
||||
status = FileStatus.MODIFIED;
|
||||
}
|
||||
final FilePath filePath = GitContentRevision.createPath(vcsRoot, path, true, true);
|
||||
before = GitContentRevision.createRevision(vcsRoot, path, firstParent, project, false, true);
|
||||
before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, false, true);
|
||||
after = GitContentRevision.createRevision(filePath, thisRevision, project, null);
|
||||
break;
|
||||
case DELETED:
|
||||
status = FileStatus.DELETED;
|
||||
final FilePath filePathDeleted = GitContentRevision.createPath(vcsRoot, path, true, true);
|
||||
before = GitContentRevision.createRevision(filePathDeleted, firstParent, project, null);
|
||||
before = GitContentRevision.createRevision(filePathDeleted, parentRevision, project, null);
|
||||
after = null;
|
||||
break;
|
||||
case COPIED:
|
||||
@@ -101,13 +90,13 @@ public class GitChangesParser {
|
||||
String secondPath = statusInfo.getSecondPath();
|
||||
final FilePath filePathAfterRename = GitContentRevision.createPath(vcsRoot, secondPath == null ? path : secondPath,
|
||||
false, true);
|
||||
before = GitContentRevision.createRevision(vcsRoot, path, firstParent, project, true, true);
|
||||
before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, true, true);
|
||||
after = GitContentRevision.createRevision(filePathAfterRename, thisRevision, project, null);
|
||||
break;
|
||||
case TYPE_CHANGED:
|
||||
status = FileStatus.MODIFIED;
|
||||
final FilePath filePath2 = GitContentRevision.createPath(vcsRoot, path, true, true);
|
||||
before = GitContentRevision.createRevision(vcsRoot, path, firstParent, project, false, true);
|
||||
before = GitContentRevision.createRevision(vcsRoot, path, parentRevision, project, false, true);
|
||||
after = GitContentRevision.createRevision(filePath2, thisRevision, project, null);
|
||||
break;
|
||||
default:
|
||||
@@ -115,5 +104,4 @@ public class GitChangesParser {
|
||||
}
|
||||
return new Change(before, after, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -256,7 +256,8 @@ class GitLogRecord {
|
||||
|
||||
@NotNull
|
||||
public List<Change> parseChanges(@NotNull Project project, @NotNull VirtualFile vcsRoot) throws VcsException {
|
||||
return GitChangesParser.parse(project, vcsRoot, myStatusInfo, getHash(), getDate(), Arrays.asList(getParentsHashes()));
|
||||
String[] hashes = getParentsHashes();
|
||||
return GitChangesParser.parse(project, vcsRoot, myStatusInfo, getHash(), getDate(), hashes.length == 0 ? null : hashes[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 git4idea.history.wholeTree;
|
||||
|
||||
import com.intellij.vcs.log.Hash;
|
||||
import com.intellij.vcs.log.impl.HashImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author irengrig
|
||||
*/
|
||||
@Deprecated
|
||||
public class AbstractHash {
|
||||
|
||||
@NotNull private final Hash myHash;
|
||||
|
||||
private AbstractHash(@NotNull Hash hash) {
|
||||
myHash = hash;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static AbstractHash create(final String hash) {
|
||||
return new AbstractHash(HashImpl.build(hash));
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return myHash.asString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
AbstractHash hash = (AbstractHash)o;
|
||||
|
||||
if (!myHash.equals(hash.myHash)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myHash.hashCode();
|
||||
}
|
||||
|
||||
public static boolean hashesEqual(@NotNull final AbstractHash hash1, @NotNull final AbstractHash hash2) {
|
||||
if (hash1.equals(hash2)) return true;
|
||||
final String s1 = hash1.getString();
|
||||
final String s2 = hash2.getString();
|
||||
if (s1.startsWith(s2) || s2.startsWith(s1)) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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 git4idea.tests;
|
||||
|
||||
import git4idea.history.wholeTree.AbstractHash;
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* @author irengrig
|
||||
*/
|
||||
public class AbstractHashTest extends TestCase {
|
||||
public void testSimple() throws Exception {
|
||||
final String hash = "0a5b9f";
|
||||
final AbstractHash abstractHash = AbstractHash.create(hash);
|
||||
Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash, abstractHash.getString());
|
||||
}
|
||||
public void testShort() throws Exception {
|
||||
final String hash = "f";
|
||||
final AbstractHash abstractHash = AbstractHash.create(hash);
|
||||
Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash, abstractHash.getString());
|
||||
|
||||
final String hash1 = "ff";
|
||||
final AbstractHash abstractHash1 = AbstractHash.create(hash1);
|
||||
Assert.assertFalse(abstractHash1.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash1, abstractHash1.getString());
|
||||
}
|
||||
public void testLong() throws Exception {
|
||||
final String hash = "0123456789abcdef0123456789abcdef01234567";
|
||||
final AbstractHash abstractHash = AbstractHash.create(hash);
|
||||
Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash, abstractHash.getString());
|
||||
}
|
||||
public void testLeadingNulls() throws Exception {
|
||||
final String hash0 = "0";
|
||||
final AbstractHash abstractHash0 = AbstractHash.create(hash0);
|
||||
Assert.assertFalse(abstractHash0.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash0, abstractHash0.getString());
|
||||
|
||||
final String hash = "0f";
|
||||
final AbstractHash abstractHash = AbstractHash.create(hash);
|
||||
Assert.assertFalse(abstractHash.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash, abstractHash.getString());
|
||||
|
||||
final String hash1 = "001";
|
||||
final AbstractHash abstractHash1 = AbstractHash.create(hash1);
|
||||
Assert.assertFalse(abstractHash1.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash1, abstractHash1.getString());
|
||||
|
||||
final String hash2 = "000";
|
||||
final AbstractHash abstractHash2 = AbstractHash.create(hash2);
|
||||
Assert.assertFalse(abstractHash2.getClass().getName().contains("AbstractHash.StringPresentation"));
|
||||
Assert.assertEquals(hash2, abstractHash2.getString());
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,10 @@ import com.intellij.execution.ui.ConsoleView;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
import com.intellij.execution.ui.actions.CloseAction;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
@@ -39,7 +42,6 @@ import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.PathsList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.runner.DefaultGroovyScriptRunner;
|
||||
@@ -216,12 +218,7 @@ public class GroovyConsole {
|
||||
|
||||
private static JavaParameters createJavaParameters(@NotNull Module module) throws ExecutionException {
|
||||
JavaParameters res = GroovyScriptRunConfiguration.createJavaParametersWithSdk(module);
|
||||
DefaultGroovyScriptRunner
|
||||
.configureGenericGroovyRunner(res, module, "groovy.ui.GroovyMain", !GroovyConsoleUtil.hasGroovyAll(module), true);
|
||||
PathsList list = GroovyScriptRunner.getClassPathFromRootModel(module, true, res, true, res.getClassPath());
|
||||
if (list != null) {
|
||||
res.getClassPath().addAll(list.getPathList());
|
||||
}
|
||||
DefaultGroovyScriptRunner.configureGenericGroovyRunner(res, module, "groovy.ui.GroovyMain", !GroovyConsoleUtil.hasGroovyAll(module), true, true, false);
|
||||
res.getProgramParametersList().addAll("-p", GroovyScriptRunner.getPathInConf("console.txt"));
|
||||
res.setWorkingDirectory(ModuleRootManager.getInstance(module).getContentRoots()[0].getPath());
|
||||
res.setUseDynamicClasspath(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -184,7 +184,7 @@ public class GrabDependencies implements IntentionAction {
|
||||
//javaParameters.getVMParametersList().add("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5239");
|
||||
|
||||
try {
|
||||
DefaultGroovyScriptRunner.configureGenericGroovyRunner(javaParameters, module, GRAPE_RUNNER, false, true);
|
||||
DefaultGroovyScriptRunner.configureGenericGroovyRunner(javaParameters, module, GRAPE_RUNNER, false, true, true, false);
|
||||
javaParameters.getClassPath().add(PathUtil.getJarPathForClass(GrapeRunner.class));
|
||||
javaParameters.getProgramParametersList().add(queries.get(grabText));
|
||||
javaParameters.setUseDynamicClasspath(true);
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -35,7 +35,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.incremental.groovy.GroovycOutputParser;
|
||||
import org.jetbrains.plugins.groovy.config.GroovyFacetUtil;
|
||||
import org.jetbrains.plugins.groovy.grape.GrabDependencies;
|
||||
import org.jetbrains.plugins.groovy.util.LibrariesUtil;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
@@ -63,7 +62,7 @@ public class DefaultGroovyScriptRunner extends GroovyScriptRunner {
|
||||
|
||||
@Override
|
||||
public void configureCommandLine(JavaParameters params, @Nullable Module module, boolean tests, VirtualFile script, GroovyScriptRunConfiguration configuration) throws CantRunException {
|
||||
configureGenericGroovyRunner(params, module, "groovy.ui.GroovyMain", false, tests, configuration.isAddClasspathToTheRunner());
|
||||
configureGenericGroovyRunner(params, module, "groovy.ui.GroovyMain", false, tests, configuration.isAddClasspathToTheRunner(), true);
|
||||
|
||||
//addClasspathFromRootModel(module, tests, params, true);
|
||||
|
||||
@@ -85,7 +84,7 @@ public class DefaultGroovyScriptRunner extends GroovyScriptRunner {
|
||||
@NotNull String mainClass,
|
||||
boolean useBundled,
|
||||
boolean tests) throws CantRunException {
|
||||
configureGenericGroovyRunner(params, module, mainClass, useBundled, tests, true);
|
||||
configureGenericGroovyRunner(params, module, mainClass, useBundled, tests, true, true);
|
||||
}
|
||||
|
||||
public static void configureGenericGroovyRunner(@NotNull JavaParameters params,
|
||||
@@ -93,7 +92,8 @@ public class DefaultGroovyScriptRunner extends GroovyScriptRunner {
|
||||
@NotNull String mainClass,
|
||||
boolean useBundled,
|
||||
boolean tests,
|
||||
boolean addClasspathToRunner) throws CantRunException {
|
||||
boolean addClasspathToRunner,
|
||||
boolean addClassPathToStarter) throws CantRunException {
|
||||
final VirtualFile groovyJar = findGroovyJar(module);
|
||||
if (useBundled) {
|
||||
params.getClassPath().add(GroovyFacetUtil.getBundledGroovyJar());
|
||||
@@ -127,7 +127,7 @@ public class DefaultGroovyScriptRunner extends GroovyScriptRunner {
|
||||
params.getProgramParametersList().add("--main");
|
||||
params.getProgramParametersList().add(mainClass);
|
||||
|
||||
if (!GrabDependencies.GRAPE_RUNNER.equals(mainClass)) {
|
||||
if (addClassPathToStarter) {
|
||||
addClasspathFromRootModel(module, tests, params, true);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -200,11 +200,11 @@ public class EduStepicConnector {
|
||||
}
|
||||
|
||||
private static void setCourseLanguage(RemoteCourse info) {
|
||||
if (info.isAdaptive()) {
|
||||
info.setLanguage("Python"); // adaptive courses available only in PyCharm now
|
||||
String courseType = info.getType();
|
||||
if (info.isAdaptive() && StringUtil.isEmptyOrSpaces(courseType)) {
|
||||
info.setLanguage("Python");
|
||||
return;
|
||||
}
|
||||
String courseType = info.getType();
|
||||
final int separator = courseType.indexOf(" ");
|
||||
assert separator != -1;
|
||||
final String language = courseType.substring(separator + 1);
|
||||
|
||||
@@ -161,6 +161,14 @@ def mkdtemp_ifneeded():
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
# As a workaround for #885 in setuptools, don't expose other helpers
|
||||
# in sys.path so as not no confuse it with possible combination of
|
||||
# namespace/ordinary packages
|
||||
sys.path.remove(os.path.dirname(__file__))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
retcode = 0
|
||||
try:
|
||||
if len(sys.argv) < 2:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.jetbrains.python.packaging.setupPy;
|
||||
|
||||
import com.intellij.ide.IdeView;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.fileTemplates.actions.AttributesDefaults;
|
||||
import com.intellij.ide.fileTemplates.actions.CreateFromTemplateAction;
|
||||
@@ -38,6 +37,7 @@ import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.util.SystemProperties;
|
||||
import com.jetbrains.python.PythonFileType;
|
||||
import com.jetbrains.python.packaging.PyPackageUtil;
|
||||
import com.jetbrains.python.psi.PyUtil;
|
||||
|
||||
@@ -50,18 +50,17 @@ import java.util.Properties;
|
||||
public class CreateSetupPyAction extends CreateFromTemplateAction {
|
||||
private static final String AUTHOR_PROPERTY = "python.packaging.author";
|
||||
private static final String EMAIL_PROPERTY = "python.packaging.author.email";
|
||||
static final String SETUP_SCRIPT_TEMPLATE_NAME = "Setup Script";
|
||||
|
||||
public CreateSetupPyAction() {
|
||||
super(FileTemplateManager.getDefaultInstance().getInternalTemplate("Setup Script"));
|
||||
super(
|
||||
SETUP_SCRIPT_TEMPLATE_NAME,
|
||||
PythonFileType.INSTANCE.getIcon(),
|
||||
() -> FileTemplateManager.getDefaultInstance().getInternalTemplate(SETUP_SCRIPT_TEMPLATE_NAME)
|
||||
);
|
||||
getTemplatePresentation().setText("Create setup.py");
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTemplate getTemplate() {
|
||||
// to ensure changes are picked up, reload the template on every call (PY-6681)
|
||||
return FileTemplateManager.getDefaultInstance().getInternalTemplate("Setup Script");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
final Module module = e.getData(LangDataKeys.MODULE);
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import com.intellij.openapi.util.text.StringUtil
|
||||
class PyCreateSetupPyFromTemplateHandler : DefaultCreateFromTemplateHandler() {
|
||||
|
||||
override fun handlesTemplate(template: FileTemplate?): Boolean {
|
||||
return template == FileTemplateManager.getDefaultInstance().getInternalTemplate("Setup Script")
|
||||
return template == FileTemplateManager.getDefaultInstance().getInternalTemplate(CreateSetupPyAction.SETUP_SCRIPT_TEMPLATE_NAME)
|
||||
}
|
||||
|
||||
override fun prepareProperties(props: MutableMap<String, Any>?) {
|
||||
|
||||
Reference in New Issue
Block a user