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:
+19
-19
@@ -13,35 +13,35 @@ INSTALLATION INSTRUCTIONS
|
||||
|
||||
./@@product@@.sh
|
||||
|
||||
to start the application.
|
||||
to start the application. As a side effect, this will initialize various
|
||||
configuration files in the ~/.@@system_selector@@ directory.
|
||||
|
||||
3. [OPTIONAL] Add the "{installation home}/bin" to your PATH environmental
|
||||
3. [OPTIONAL] Add "{installation home}/bin" to your PATH environment
|
||||
variable so that you may start @@product_full@@ from any directory.
|
||||
|
||||
4. [OPTIONAL] To adjust the value of JVM heap size open @@product@@.vmoptions
|
||||
(@@product@@64.vmoptions for 64-bit JDK), and modify the -Xms and -Xmx parameters.
|
||||
4. [OPTIONAL] To adjust the value of the JVM heap size, create
|
||||
~/.@@system_selector@@/@@product@@.vmoptions (or @@product@@64.vmoptions
|
||||
if using a 64-bit JDK), and set the -Xms and -Xms paramters. To see how
|
||||
to do this, you can reference the vmoptions file under
|
||||
"{installation home}/bin" as a model.
|
||||
|
||||
|
||||
[OPTIONAL] Changing location of "config" and "system" directory
|
||||
[OPTIONAL] Changing the location of "config" and "system" directories
|
||||
------------------------------------------------------------------------------
|
||||
By default @@product_full@@ stores all your settings under ~/.@@system_selector@@/config directory
|
||||
and stores data cache under ~/.@@system_selector@@/system directory.
|
||||
By default, @@product_full@@ stores all your settings under the ~/.@@system_selector@@/config
|
||||
directory and uses ~/.@@system_selector@@/system as a data cache.
|
||||
If you want to change these settings,
|
||||
|
||||
1. Open a console and cd into "{installation home}/bin"
|
||||
1. Open a console and cd into ~/.@@system_selector@@/
|
||||
|
||||
2. Open file "idea.properties" in an editor. You should find strings like
|
||||
2. Create the file "idea.properties" and open it in an editor. Set the
|
||||
idea.system.path and/or idea.config.path variables as desired, for
|
||||
example:
|
||||
|
||||
idea.system.path=~/.@@settings_dir@@/system
|
||||
idea.system.path=~/custom/system
|
||||
idea.config.path=~/custom/config
|
||||
|
||||
and
|
||||
|
||||
idea.config.path=~/.@@settings_dir@@/config
|
||||
|
||||
and change them.
|
||||
|
||||
3. Note that we recommend to store data cache ("system" directory) at a disk
|
||||
with at least 1G bytes free space
|
||||
3. Note that we recommend to store data cache ("system" directory) on a disk
|
||||
with at least 1GB of free space.
|
||||
|
||||
|
||||
|
||||
|
||||
+39
-3
@@ -32,8 +32,11 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
|
||||
import com.intellij.xdebugger.impl.XSourcePositionImpl;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaLineBreakpointProperties;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -50,6 +53,10 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
super("java-line", DebuggerBundle.message("line.breakpoints.tab.title"));
|
||||
}
|
||||
|
||||
protected JavaLineBreakpointType(@NonNls @NotNull String id, @Nls @NotNull String title) {
|
||||
super(id, title);
|
||||
}
|
||||
|
||||
//@Override
|
||||
protected String getHelpID() {
|
||||
return HelpID.LINE_BREAKPOINTS;
|
||||
@@ -129,7 +136,36 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
return res;
|
||||
}
|
||||
|
||||
class JavaBreakpointVariant extends XLineBreakpointVariant {
|
||||
public boolean matchesPosition(@NotNull LineBreakpoint breakpoint, @NotNull SourcePosition position) {
|
||||
JavaBreakpointProperties properties = breakpoint.getProperties();
|
||||
if (properties == null || properties instanceof JavaLineBreakpointProperties) {
|
||||
if (properties != null && ((JavaLineBreakpointProperties)properties).getLambdaOrdinal() == null) return true;
|
||||
PsiElement containingMethod = getContainingMethod(breakpoint);
|
||||
if (containingMethod == null) return false;
|
||||
return DebuggerUtilsEx.inTheMethod(position, containingMethod);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getContainingMethod(@NotNull LineBreakpoint breakpoint) {
|
||||
SourcePosition position = breakpoint.getSourcePosition();
|
||||
if (position == null) return null;
|
||||
|
||||
JavaBreakpointProperties properties = breakpoint.getProperties();
|
||||
if (properties instanceof JavaLineBreakpointProperties) {
|
||||
Integer ordinal = ((JavaLineBreakpointProperties)properties).getLambdaOrdinal();
|
||||
if (ordinal > -1) {
|
||||
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
|
||||
if (ordinal < lambdas.size()) {
|
||||
return lambdas.get(ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
return DebuggerUtilsEx.getContainingMethod(position);
|
||||
}
|
||||
|
||||
public class JavaBreakpointVariant extends XLineBreakpointVariant {
|
||||
protected final XSourcePosition mySourcePosition;
|
||||
|
||||
private JavaBreakpointVariant(XSourcePosition position) {
|
||||
@@ -158,7 +194,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
}
|
||||
}
|
||||
|
||||
private class ExactJavaBreakpointVariant extends JavaBreakpointVariant {
|
||||
public class ExactJavaBreakpointVariant extends JavaBreakpointVariant {
|
||||
private final PsiElement myElement;
|
||||
private final Integer myLambdaOrdinal;
|
||||
|
||||
@@ -200,7 +236,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
|
||||
if (ordinal != null) {
|
||||
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
|
||||
if (javaBreakpoint instanceof LineBreakpoint) {
|
||||
PsiElement method = ((LineBreakpoint)javaBreakpoint).getContainingMethod();
|
||||
PsiElement method = getContainingMethod((LineBreakpoint)javaBreakpoint);
|
||||
if (method != null) {
|
||||
return method.getTextRange();
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ public abstract class JavaLineBreakpointTypeBase<P extends JavaBreakpointPropert
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean canPutAt(@NotNull final VirtualFile file, final int line, @NotNull Project project) {
|
||||
public boolean canPutAt(@NotNull final VirtualFile file, final int line, @NotNull Project project) {
|
||||
final PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
// JSPX supports jvm debugging, but not in XHTML files
|
||||
if (psiFile == null || psiFile.getViewProvider().getFileType() == StdFileTypes.XHTML) {
|
||||
|
||||
@@ -63,7 +63,6 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaLineBreakpointProperties;
|
||||
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -210,34 +209,18 @@ public class LineBreakpoint<P extends JavaBreakpointProperties> extends Breakpoi
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
if (getProperties() instanceof JavaLineBreakpointProperties) {
|
||||
Integer ordinal = ((JavaLineBreakpointProperties)getProperties()).getLambdaOrdinal();
|
||||
if (ordinal == null) return true;
|
||||
PsiElement containingMethod = getContainingMethod();
|
||||
if (containingMethod == null) return false;
|
||||
SourcePosition position = debugProcess.getPositionManager().getSourcePosition(loc);
|
||||
if (position == null) return false;
|
||||
return DebuggerUtilsEx.inTheMethod(position, containingMethod);
|
||||
}
|
||||
return true;
|
||||
SourcePosition position = debugProcess.getPositionManager().getSourcePosition(loc);
|
||||
if (position == null) return false;
|
||||
JavaLineBreakpointType type = getXBreakpointType();
|
||||
if (type == null) return true;
|
||||
return type.matchesPosition(LineBreakpoint.this, position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getContainingMethod() {
|
||||
SourcePosition position = getSourcePosition();
|
||||
if (position == null) return null;
|
||||
if (getProperties() instanceof JavaLineBreakpointProperties) {
|
||||
Integer ordinal = ((JavaLineBreakpointProperties)getProperties()).getLambdaOrdinal();
|
||||
if (ordinal > -1) {
|
||||
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(position, true);
|
||||
if (ordinal < lambdas.size()) {
|
||||
return lambdas.get(ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
return DebuggerUtilsEx.getContainingMethod(position);
|
||||
protected JavaLineBreakpointType getXBreakpointType() {
|
||||
return (JavaLineBreakpointType)myXBreakpoint.getType();
|
||||
}
|
||||
|
||||
private boolean isInScopeOf(DebugProcessImpl debugProcess, String className) {
|
||||
|
||||
+14
-14
@@ -17,15 +17,13 @@ package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.debugger.SourcePosition;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.xdebugger.XDebuggerUtil;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
import com.sun.jdi.Location;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpointType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.java.debugger.breakpoints.properties.JavaBreakpointProperties;
|
||||
@@ -47,6 +45,7 @@ public class RunToCursorBreakpoint<P extends JavaBreakpointProperties> extends L
|
||||
myRestoreBreakpoints = restoreBreakpoints;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SourcePosition getSourcePosition() {
|
||||
return myCustomPosition;
|
||||
@@ -125,17 +124,18 @@ public class RunToCursorBreakpoint<P extends JavaBreakpointProperties> extends L
|
||||
return false; // always enabled
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected boolean acceptLocation(final DebugProcessImpl debugProcess, ReferenceType classType, final Location loc) {
|
||||
if (!super.acceptLocation(debugProcess, classType, loc)) return false;
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
SourcePosition position = debugProcess.getPositionManager().getSourcePosition(loc);
|
||||
if (position == null) return false;
|
||||
return DebuggerUtilsEx.inTheSameMethod(myCustomPosition, position);
|
||||
protected JavaLineBreakpointType getXBreakpointType() {
|
||||
SourcePosition position = getSourcePosition();
|
||||
VirtualFile file = position.getFile().getVirtualFile();
|
||||
int line = position.getLine();
|
||||
for (XLineBreakpointType<?> type : XDebuggerUtil.getInstance().getLineBreakpointTypes()) {
|
||||
if (type instanceof JavaLineBreakpointType && type.canPutAt(file, line, getProject())) {
|
||||
return ((JavaLineBreakpointType)type);
|
||||
}
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -67,7 +67,8 @@ public interface DocumentationProvider {
|
||||
* @param element the element for which the documentation is requested (for example, if the mouse is over
|
||||
* a method reference, this will be the method to which the reference is resolved).
|
||||
* @param originalElement the element under the mouse cursor
|
||||
* @return target element's documentation (if any)
|
||||
* @return target element's documentation, or <code>null</code> if provider is unable to generage documentation
|
||||
* for the given element
|
||||
*/
|
||||
@Nullable
|
||||
String generateDoc(PsiElement element, @Nullable PsiElement originalElement);
|
||||
|
||||
+1
@@ -1132,6 +1132,7 @@ public class DocumentationManager extends DockablePopupManager<DocumentationComp
|
||||
}
|
||||
}
|
||||
);
|
||||
LOG.debug("Using provider ", provider);
|
||||
|
||||
if (provider instanceof ExternalDocumentationProvider) {
|
||||
final List<String> urls = ApplicationManager.getApplication().runReadAction(
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -32,6 +33,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.notification.NotificationDisplayType.STICKY_BALLOON;
|
||||
|
||||
@@ -94,11 +97,16 @@ public abstract class ExecutableValidator {
|
||||
* @return true if process with the supplied executable completed without errors and with exit code 0.
|
||||
*/
|
||||
protected boolean isExecutableValid(@NotNull String executable) {
|
||||
return doCheckExecutable(executable, Collections.<String>emptyList());
|
||||
}
|
||||
|
||||
protected static boolean doCheckExecutable(@NotNull String executable, @NotNull List<String> processParameters) {
|
||||
try {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
commandLine.setExePath(executable);
|
||||
commandLine.addParameters(processParameters);
|
||||
CapturingProcessHandler handler = new CapturingProcessHandler(commandLine.createProcess(), CharsetToolkit.getDefaultSystemCharset());
|
||||
ProcessOutput result = handler.runProcess(60 * 1000);
|
||||
ProcessOutput result = handler.runProcess(Registry.intValue("vcs.executable.validator.timeout.sec", 60) * 1000);
|
||||
boolean timeout = result.isTimeout();
|
||||
int exitCode = result.getExitCode();
|
||||
String stderr = result.getStderr();
|
||||
@@ -106,7 +114,7 @@ public abstract class ExecutableValidator {
|
||||
LOG.warn("Validation of " + executable + " failed with a timeout");
|
||||
}
|
||||
if (exitCode != 0) {
|
||||
LOG.warn("Validation of " + executable + " failed with non-zero exit code: " + exitCode);
|
||||
LOG.warn("Validation of " + executable + " failed with a non-zero exit code: " + exitCode);
|
||||
}
|
||||
if (!stderr.isEmpty()) {
|
||||
LOG.warn("Validation of " + executable + " failed with a non-empty error output: " + stderr);
|
||||
|
||||
@@ -321,6 +321,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
}
|
||||
});
|
||||
toolWindows.addKeyListener(this);
|
||||
ListScrollingUtil.installActions(toolWindows);
|
||||
toolWindows.addMouseListener(this);
|
||||
toolWindows.addMouseMotionListener(this);
|
||||
ListScrollingUtil.ensureSelectionExists(toolWindows);
|
||||
@@ -511,6 +512,7 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
files.setCellRenderer(filesRenderer);
|
||||
files.setBorder(IdeBorderFactory.createEmptyBorder(5, 5, 5, 20));
|
||||
files.addKeyListener(this);
|
||||
ListScrollingUtil.installActions(files);
|
||||
files.addMouseListener(this);
|
||||
files.addMouseMotionListener(this);
|
||||
myClickListener.installOn(files);
|
||||
@@ -660,37 +662,6 @@ public class Switcher extends AnAction implements DumbAware {
|
||||
if (mySpeedSearch != null && mySpeedSearch.isPopupActive() || lastEvent == e) return;
|
||||
lastEvent = e;
|
||||
switch (e.getKeyCode()) {
|
||||
case VK_UP:
|
||||
if (!isPinnedMode()) {
|
||||
goBack();
|
||||
}
|
||||
else {
|
||||
//getSelectedList().processKeyEvent(e);
|
||||
}
|
||||
break;
|
||||
case VK_DOWN:
|
||||
if (!isPinnedMode()) {
|
||||
goForward();
|
||||
}
|
||||
else {
|
||||
//getSelectedList().processKeyEvent(e);
|
||||
}
|
||||
break;
|
||||
case VK_ESCAPE:
|
||||
cancel();
|
||||
break;
|
||||
case VK_END:
|
||||
ListScrollingUtil.moveEnd(getSelectedList());
|
||||
break;
|
||||
case VK_PAGE_DOWN:
|
||||
ListScrollingUtil.movePageDown(getSelectedList());
|
||||
break;
|
||||
case VK_HOME:
|
||||
ListScrollingUtil.moveHome(getSelectedList());
|
||||
break;
|
||||
case VK_PAGE_UP:
|
||||
ListScrollingUtil.movePageUp(getSelectedList());
|
||||
break;
|
||||
case VK_DELETE:
|
||||
case VK_BACK_SPACE: // Mac users
|
||||
case VK_Q:
|
||||
|
||||
@@ -42,10 +42,7 @@ import org.jetbrains.io.MessageDecoder;
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
@@ -66,8 +63,8 @@ public final class SocketLock {
|
||||
private BuiltInServer server;
|
||||
|
||||
public SocketLock(@NotNull String configPath, @NotNull String systemPath) {
|
||||
this.configPath = configPath;
|
||||
this.systemPath = systemPath;
|
||||
this.configPath = canonicalPath(configPath);
|
||||
this.systemPath = canonicalPath(systemPath);
|
||||
}
|
||||
|
||||
public void setExternalInstanceListener(@Nullable Consumer<List<String>> consumer) {
|
||||
@@ -355,4 +352,13 @@ public final class SocketLock {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String canonicalPath(@NotNull String configPath) {
|
||||
try {
|
||||
return new File(configPath).getCanonicalPath();
|
||||
} catch (IOException ignore) {
|
||||
return configPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -116,10 +116,13 @@ public final class EditorTabbedContainer implements Disposable, CloseAction.Clos
|
||||
oldEditor.deselectNotify();
|
||||
}
|
||||
|
||||
final FileEditor newEditor = editorManager.getSelectedEditor((VirtualFile)newSelection.getObject());
|
||||
VirtualFile newFile = (VirtualFile)newSelection.getObject();
|
||||
final FileEditor newEditor = editorManager.getSelectedEditor(newFile);
|
||||
if (newEditor != null) {
|
||||
newEditor.selectNotify();
|
||||
}
|
||||
|
||||
newFile.refresh(true, false);
|
||||
}
|
||||
}).setAdditionalSwitchProviderWhenOriginal(new MySwitchProvider())
|
||||
.setSelectionChangeHandler(new JBTabs.SelectionChangeHandler() {
|
||||
|
||||
-1
@@ -789,7 +789,6 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
final Boolean pin,
|
||||
final int index) {
|
||||
assert ApplicationManager.getApplication().isDispatchThread() || !ApplicationManager.getApplication().isReadAccessAllowed() : "must not open files under read action since we are doing a lot of invokeAndWaits here";
|
||||
file.refresh(true, false);
|
||||
|
||||
final Ref<EditorWithProviderComposite> compositeRef = new Ref<EditorWithProviderComposite>();
|
||||
|
||||
|
||||
+8
-2
@@ -183,15 +183,21 @@ public class ConfigurableExtensionPointUtil {
|
||||
String id = "configurable.group." + groupId;
|
||||
ResourceBundle bundle = getBundle(id + ".settings.display.name", configurables, alternative);
|
||||
if (bundle == null) {
|
||||
bundle = OptionsBundle.getBundle();
|
||||
if ("root".equals(groupId)) {
|
||||
LOG.error("OptionsBundle does not contain root group");
|
||||
try {
|
||||
String value = bundle.getString("configurable.group.root.settings.display.name");
|
||||
LOG.error("OptionsBundle does not contain root group", value);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
LOG.error("OptionsBundle does not contain root group", exception);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.warn("use other group instead of unexpected one: " + groupId);
|
||||
groupId = "other";
|
||||
id = "configurable.group." + groupId;
|
||||
}
|
||||
bundle = OptionsBundle.getBundle();
|
||||
}
|
||||
Node<SortedConfigurableGroup> node = Node.get(tree, groupId);
|
||||
if (node.myValue == null) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.idea;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
@@ -22,11 +23,31 @@ import org.junit.Test;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class LockSupportTest {
|
||||
@Test(timeout = 30000)
|
||||
public void testUseCanonicalPathLock() throws Exception {
|
||||
if (SystemInfo.isFileSystemCaseSensitive) return;
|
||||
File temp = FileUtil.createTempDirectory("c", null);
|
||||
SocketLock lock = new SocketLock(temp.getPath() + "/c", temp.getPath() + "/s");
|
||||
final String tempPathUpperCased = temp.getPath().toUpperCase(Locale.ENGLISH);
|
||||
SocketLock lock2 = new SocketLock(tempPathUpperCased + "/c", tempPathUpperCased + "/s");
|
||||
try {
|
||||
lock.lock();
|
||||
assertThat(lock2.lock(), equalTo(SocketLock.ActivateStatus.ACTIVATED));
|
||||
}
|
||||
finally {
|
||||
lock.dispose();
|
||||
lock2.dispose();
|
||||
|
||||
FileUtil.delete(temp);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout = 30000)
|
||||
public void testLock() throws Exception {
|
||||
File temp = FileUtil.createTempDirectory("c", null);
|
||||
|
||||
@@ -238,6 +238,8 @@ vcs.log.bek.sort=true
|
||||
vcs.log.bek.sort.disabled=false
|
||||
vcs.log.linear.bek.sort=false
|
||||
|
||||
vcs.executable.validator.timeout.sec=60
|
||||
|
||||
psi.incremental.reparse.depth.limit=1000
|
||||
psi.deferIconLoading=true
|
||||
psi.track.invalidation=true
|
||||
|
||||
@@ -16,15 +16,13 @@
|
||||
package git4idea.config;
|
||||
|
||||
import com.intellij.execution.ExecutableValidator;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.CapturingProcessHandler;
|
||||
import com.intellij.execution.process.ProcessOutput;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import git4idea.i18n.GitBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Project service that is used to check whether currently set git executable is valid (just calls 'git version' and parses the output),
|
||||
* and to display notification to the user proposing to fix the project set up.
|
||||
@@ -49,16 +47,7 @@ public class GitExecutableValidator extends ExecutableValidator {
|
||||
|
||||
@Override
|
||||
public boolean isExecutableValid(@NotNull String executable) {
|
||||
try {
|
||||
GeneralCommandLine commandLine = new GeneralCommandLine();
|
||||
commandLine.setExePath(executable);
|
||||
commandLine.addParameter("--version");
|
||||
CapturingProcessHandler handler = new CapturingProcessHandler(commandLine.createProcess(), CharsetToolkit.getDefaultSystemCharset());
|
||||
ProcessOutput result = handler.runProcess(30 * 1000);
|
||||
return !result.isTimeout() && (result.getExitCode() == 0) && result.getStderr().isEmpty();
|
||||
} catch (Throwable e) {
|
||||
return false;
|
||||
}
|
||||
return doCheckExecutable(executable, Collections.singletonList("--version"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
<executeFile implementation="com.jetbrains.edu.coursecreator.PyCCRunTests"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="Pythonid">
|
||||
<pyReferenceResolveProvider implementation="com.jetbrains.edu.coursecreator.PyCCReferenceResolveProvider"/>
|
||||
</extensions>
|
||||
|
||||
<application-components>
|
||||
<!-- Add your application components here -->
|
||||
</application-components>
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.jetbrains.edu.coursecreator;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.edu.PyEduUtils;
|
||||
import com.jetbrains.python.psi.PyQualifiedExpression;
|
||||
import com.jetbrains.python.psi.resolve.PyReferenceResolveProvider;
|
||||
import com.jetbrains.python.psi.resolve.RatedResolveResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PyCCReferenceResolveProvider implements PyReferenceResolveProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<RatedResolveResult> resolveName(@NotNull final PyQualifiedExpression element,
|
||||
@NotNull final List<PsiElement> definers) {
|
||||
if (CCProjectService.getInstance(element.getProject()).getCourse() == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return PyEduUtils.getResolveResultFromContainingDirectory(element, definers);
|
||||
}
|
||||
}
|
||||
@@ -18,5 +18,6 @@
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit3" level="project" />
|
||||
<orderEntry type="module" module-name="educational" />
|
||||
<orderEntry type="module" module-name="python-educational" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -23,6 +23,7 @@
|
||||
</extensions>
|
||||
<extensions defaultExtensionNs="Pythonid">
|
||||
<visitorFilter language="Python" implementationClass="com.jetbrains.edu.learning.highlighting.PyStudyVisitorFilter"/>
|
||||
<pyReferenceResolveProvider implementation="com.jetbrains.edu.learning.PyStudyReferenceResolveProvider"/>
|
||||
</extensions>
|
||||
<extensions defaultExtensionNs="Edu">
|
||||
<StudyExecutor implementationClass="com.jetbrains.edu.learning.PyStudyExecutor" language="Python"/>
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.jetbrains.edu.learning;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.jetbrains.python.edu.PyEduUtils;
|
||||
import com.jetbrains.python.psi.PyQualifiedExpression;
|
||||
import com.jetbrains.python.psi.resolve.PyReferenceResolveProvider;
|
||||
import com.jetbrains.python.psi.resolve.RatedResolveResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class PyStudyReferenceResolveProvider implements PyReferenceResolveProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<RatedResolveResult> resolveName(@NotNull final PyQualifiedExpression element,
|
||||
@NotNull final List<PsiElement> definers) {
|
||||
if (StudyTaskManager.getInstance(element.getProject()).getCourse() == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return PyEduUtils.getResolveResultFromContainingDirectory(element, definers);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.jetbrains.python.edu;
|
||||
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.jetbrains.python.psi.PyQualifiedExpression;
|
||||
import com.jetbrains.python.psi.resolve.ImportedResolveResult;
|
||||
import com.jetbrains.python.psi.resolve.RatedResolveResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PyEduUtils {
|
||||
private PyEduUtils() {
|
||||
}
|
||||
|
||||
public static List<RatedResolveResult> getResolveResultFromContainingDirectory(@NotNull PyQualifiedExpression element,
|
||||
@NotNull List<PsiElement> definers) {
|
||||
final List<RatedResolveResult> result = new ArrayList<RatedResolveResult>();
|
||||
final PsiFile containingFile = element.getContainingFile();
|
||||
if (containingFile == null) return result;
|
||||
final PsiDirectory directory = containingFile.getContainingDirectory();
|
||||
if (directory == null) return result;
|
||||
final String elementName = element.getName();
|
||||
final PsiFile file = directory.findFile(elementName + ".py");
|
||||
if (file != null) {
|
||||
result.add(new ImportedResolveResult(file, RatedResolveResult.RATE_NORMAL, definers));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.jetbrains.plugins.ipnb.configuration;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.RunContentExecutor;
|
||||
@@ -28,7 +27,6 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.HyperlinkAdapter;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.io.HttpRequests;
|
||||
import com.jetbrains.python.PythonHelpersLocator;
|
||||
import com.jetbrains.python.packaging.PyPackage;
|
||||
import com.jetbrains.python.packaging.PyPackageManager;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
@@ -263,7 +261,6 @@ public final class IpnbConnectionManager implements ProjectComponent {
|
||||
}
|
||||
catch (ExecutionException ignored) {
|
||||
}
|
||||
final Map<String, String> env = ImmutableMap.of("PYCHARM_EP_DIST", "ipython", "PYCHARM_EP_NAME", "ipython");
|
||||
|
||||
final Pair<String, String> hostPort = getHostPortFromUrl(url);
|
||||
if (hostPort == null) {
|
||||
@@ -271,8 +268,10 @@ public final class IpnbConnectionManager implements ProjectComponent {
|
||||
new IpnbSettingsAdapter());
|
||||
return false;
|
||||
}
|
||||
final String ipython = PythonHelpersLocator.getHelperPath("pycharm/pycharm_load_entry_point.py");
|
||||
final ArrayList<String> parameters = Lists.newArrayList(sdk.getHomePath(), ipython, "notebook", "--no-browser");
|
||||
final String homePath = sdk.getHomePath();
|
||||
if (homePath == null) return false;
|
||||
final String ipython = PythonSdkType.getExecutablePath(homePath, "ipython");
|
||||
final ArrayList<String> parameters = Lists.newArrayList(homePath, ipython, "notebook", "--no-browser");
|
||||
if (hostPort.getFirst() != null) {
|
||||
parameters.add("--ip");
|
||||
parameters.add(hostPort.getFirst());
|
||||
@@ -281,8 +280,7 @@ public final class IpnbConnectionManager implements ProjectComponent {
|
||||
parameters.add("--port");
|
||||
parameters.add(hostPort.getSecond());
|
||||
}
|
||||
final GeneralCommandLine commandLine = new GeneralCommandLine(parameters).withWorkDirectory(myProject.getBasePath()).
|
||||
withEnvironment(env);
|
||||
final GeneralCommandLine commandLine = new GeneralCommandLine(parameters).withWorkDirectory(myProject.getBasePath());
|
||||
|
||||
try {
|
||||
final KillableColoredProcessHandler processHandler = new KillableColoredProcessHandler(commandLine) {
|
||||
|
||||
@@ -38,6 +38,8 @@ import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.DumbModePermission;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.*;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
@@ -496,14 +498,20 @@ public class PythonSdkType extends SdkType {
|
||||
public void setupSdkPaths(@NotNull final Sdk sdk) {
|
||||
final Project project;
|
||||
final WeakReference<Component> ownerComponentRef = sdk.getUserData(SDK_CREATOR_COMPONENT_KEY);
|
||||
Component ownerComponent = SoftReference.dereference(ownerComponentRef);
|
||||
final Component ownerComponent = SoftReference.dereference(ownerComponentRef);
|
||||
if (ownerComponent != null) {
|
||||
project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(ownerComponent));
|
||||
}
|
||||
else {
|
||||
project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
}
|
||||
setupSdkPaths(sdk, project, ownerComponent);
|
||||
|
||||
DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_BACKGROUND, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setupSdkPaths(sdk, project, ownerComponent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user