mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
@@ -39,6 +39,13 @@
|
||||
<string>@@version@@</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@@build@@</string>
|
||||
<key>LSArchitecturePriority</key>
|
||||
<array>
|
||||
<string>i386</string>
|
||||
<string>x86_64</string>
|
||||
<string>ppc</string>
|
||||
</array>
|
||||
|
||||
<key>Java</key>
|
||||
<dict>
|
||||
<key>ClassPath</key>
|
||||
@@ -47,20 +54,6 @@
|
||||
<key>JVMVersion</key>
|
||||
<string>@@jdk_req@@</string>
|
||||
|
||||
<key>JVMArchs</key>
|
||||
<array>
|
||||
<string>i386</string>
|
||||
<string>x86_64</string>
|
||||
<string>ppc</string>
|
||||
</array>
|
||||
|
||||
<key>LSArchitecturePriority</key>
|
||||
<array>
|
||||
<string>i386</string>
|
||||
<string>x86_64</string>
|
||||
<string>ppc</string>
|
||||
</array>
|
||||
|
||||
<key>MainClass</key>
|
||||
<string>com.intellij.idea.Main</string>
|
||||
<key>Properties</key>
|
||||
|
||||
@@ -88,6 +88,10 @@ public class JavaParametersUtil {
|
||||
if (module == null) {
|
||||
throw CantRunException.noModuleConfigured(runConfigurationModule.getModuleName());
|
||||
}
|
||||
configureModule(module, parameters, classPathType, jreHome);
|
||||
}
|
||||
|
||||
public static void configureModule(Module module, JavaParameters parameters, int classPathType, String jreHome) throws CantRunException {
|
||||
parameters.configureByModule(module, classPathType, createModuleJdk(module, jreHome));
|
||||
}
|
||||
|
||||
|
||||
@@ -212,6 +212,17 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
|
||||
return builder.append(">").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LookupItem<PsiMethod> forceQualify() {
|
||||
if (myContainingClass != null) {
|
||||
String className = myContainingClass.getName();
|
||||
if (className != null) {
|
||||
addLookupStrings(className + "." + myMethod.getName());
|
||||
}
|
||||
}
|
||||
return super.forceQualify();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderElement(LookupElementPresentation presentation) {
|
||||
final String className = myContainingClass == null ? "???" : myContainingClass.getName();
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import java.util.Collections;
|
||||
|
||||
class Foo {
|
||||
java.util.List<String> foo() {
|
||||
return Collections.emptyList();<caret>
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Foo {
|
||||
java.util.List<String> foo() {
|
||||
return Collect<caret>;
|
||||
}
|
||||
}
|
||||
+7
-15
@@ -884,25 +884,17 @@ public class SmartTypeCompletionTest extends LightFixtureCompletionTestCase {
|
||||
assertEquals(4, myItems.length);
|
||||
}
|
||||
|
||||
public void testInsertTypeParametersOnImporting() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
public void testInsertTypeParametersOnImporting() throws Throwable { doTest(); }
|
||||
|
||||
public void testEmptyListInReturn() throws Throwable {
|
||||
doItemTest();
|
||||
}
|
||||
public void testEmptyListInReturn() throws Throwable { doItemTest(); }
|
||||
|
||||
public void testEmptyListInReturn2() throws Throwable {
|
||||
doTest();
|
||||
}
|
||||
public void testEmptyListInReturn2() throws Throwable { doTest(); }
|
||||
|
||||
public void testEmptyListInReturnTernary() throws Throwable {
|
||||
doItemTest();
|
||||
}
|
||||
public void testEmptyListInReturnTernary() throws Throwable { doItemTest(); }
|
||||
|
||||
public void testEmptyListBeforeSemicolon() throws Throwable {
|
||||
doItemTest();
|
||||
}
|
||||
public void testEmptyListBeforeSemicolon() throws Throwable { doItemTest(); }
|
||||
|
||||
public void testEmptyListWithCollectionsPrefix() throws Throwable { doItemTest(); }
|
||||
|
||||
public void testStaticallyImportedMagicMethod() throws Throwable {
|
||||
configureByTestName();
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
The MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@@ -50,6 +50,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
|
||||
protected final Project myProject;
|
||||
|
||||
public String PROJECT_PROFILE;
|
||||
public boolean USE_PROJECT_PROFILE = true;
|
||||
|
||||
private final ApplicationProfileManager myApplicationProfileManager;
|
||||
|
||||
@@ -178,6 +179,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
|
||||
public void setProjectProfile(final String projectProfile) {
|
||||
final String profileName = PROJECT_PROFILE;
|
||||
PROJECT_PROFILE = projectProfile;
|
||||
USE_PROJECT_PROFILE = projectProfile != null;
|
||||
for (ProfileChangeAdapter adapter : myProfilesListener) {
|
||||
adapter.profileActivated(profileName != null ? getProfile(profileName) : null, projectProfile != null ? getProfile(projectProfile) : null);
|
||||
}
|
||||
@@ -185,6 +187,7 @@ public abstract class DefaultProjectProfileManager extends ProjectProfileManager
|
||||
|
||||
@NotNull
|
||||
public Profile getProjectProfileImpl(){
|
||||
if (!USE_PROJECT_PROFILE) return myApplicationProfileManager.getRootProfile();
|
||||
if (PROJECT_PROFILE == null || myProfiles.isEmpty()){
|
||||
setProjectProfile(PROJECT_DEFAULT_PROFILE_NAME);
|
||||
final Profile projectProfile = myApplicationProfileManager.createProfile();
|
||||
|
||||
+2
@@ -490,6 +490,8 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
|
||||
// the insert handler may have started a live template with completion
|
||||
if (CompletionService.getCompletionService().getCurrentCompletion() == null) {
|
||||
indicator.liveAfterDeath(null);
|
||||
} else {
|
||||
LOG.assertTrue(indicator.isZombie(), indicator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-8
@@ -289,7 +289,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
if (code == KeyEvent.VK_CONTROL || code == KeyEvent.VK_META || code == KeyEvent.VK_ALT || code == KeyEvent.VK_SHIFT) {
|
||||
myState.modifiersChanged();
|
||||
if (myState.isWaitingAfterAutoInsertion()) {
|
||||
unregisterItself();
|
||||
unregisterItself(true);
|
||||
}
|
||||
contentComponent.removeKeyListener(this);
|
||||
}
|
||||
@@ -297,6 +297,10 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
});
|
||||
}
|
||||
|
||||
boolean isZombie() {
|
||||
return myState.isZombie();
|
||||
}
|
||||
|
||||
private void setMergeCommand() {
|
||||
CommandProcessor.getInstance().setCurrentCommandGroupId(getCompletionCommandName());
|
||||
}
|
||||
@@ -330,23 +334,23 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
|
||||
final HintListener hintListener = new HintListener() {
|
||||
public void hintHidden(final EventObject event) {
|
||||
unregisterItself();
|
||||
unregisterItself(true);
|
||||
}
|
||||
};
|
||||
final DocumentAdapter documentListener = new DocumentAdapter() {
|
||||
@Override
|
||||
public void beforeDocumentChange(DocumentEvent e) {
|
||||
unregisterItself();
|
||||
unregisterItself(true);
|
||||
}
|
||||
};
|
||||
final SelectionListener selectionListener = new SelectionListener() {
|
||||
public void selectionChanged(SelectionEvent e) {
|
||||
unregisterItself();
|
||||
unregisterItself(true);
|
||||
}
|
||||
};
|
||||
final CaretListener caretListener = new CaretListener() {
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
unregisterItself();
|
||||
unregisterItself(true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -475,7 +479,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
Disposer.dispose(myQueue);
|
||||
unregisterItself();
|
||||
unregisterItself(false);
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@@ -486,8 +490,8 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterItself() {
|
||||
myState.handleDeath();
|
||||
private void unregisterItself(boolean afterDeath) {
|
||||
myState.handleDeath(afterDeath);
|
||||
CompletionProgressIndicator currentCompletion = CompletionServiceImpl.getCompletionService().getCurrentCompletion();
|
||||
assert currentCompletion == this : currentCompletion + "!=" + this;
|
||||
CompletionServiceImpl.getCompletionService().setCurrentCompletion(null);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class CompletionState {
|
||||
}
|
||||
|
||||
public boolean isWaitingAfterAutoInsertion() {
|
||||
return myRestorePrefix != null;
|
||||
return myRestorePrefix != null && isZombie();
|
||||
}
|
||||
|
||||
public void setRestorePrefix(Runnable restorePrefix) {
|
||||
@@ -127,10 +127,12 @@ public class CompletionState {
|
||||
}
|
||||
}
|
||||
|
||||
public void handleDeath() {
|
||||
public void handleDeath(boolean afterDeath) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
boolean zombie = isZombie();
|
||||
LOG.assertTrue(afterDeath == zombie, this);
|
||||
assertDisposed();
|
||||
if (myZombieCleanup != null) {
|
||||
if (zombie) {
|
||||
myZombieCleanup.run();
|
||||
}
|
||||
myZombieCleanup = null;
|
||||
@@ -138,6 +140,10 @@ public class CompletionState {
|
||||
setRestorePrefix(null);
|
||||
}
|
||||
|
||||
public boolean isZombie() {
|
||||
return myZombieCleanup != null;
|
||||
}
|
||||
|
||||
int incCount() {
|
||||
return ++myCount;
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
|
||||
Map<GridImpl, Wrapper> myMinimizedButtonsPlaceholder = new HashMap<GridImpl, Wrapper>();
|
||||
Map<GridImpl, Wrapper> myCommonActionsPlaceholder = new HashMap<GridImpl, Wrapper>();
|
||||
Map<GridImpl, Set<Content>> myContextActions = new HashMap<GridImpl, Set<Content>>();
|
||||
Map<GridImpl, AnAction[]> myContextActions = new HashMap<GridImpl, AnAction[]>();
|
||||
|
||||
boolean myUiLastStateWasRestored;
|
||||
|
||||
@@ -447,7 +447,8 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
groupToBuild = group;
|
||||
}
|
||||
|
||||
if (!contents.equals(myContextActions.get(entry.getKey()))) {
|
||||
final AnAction[] actions = groupToBuild.getChildren(null);
|
||||
if (!Arrays.equals(actions, myContextActions.get(entry.getKey()))) {
|
||||
ActionToolbar tb = myActionManager.createActionToolbar(myActionsPlace, groupToBuild, true);
|
||||
tb.setTargetComponent(contextComponent);
|
||||
eachPlaceholder.setContent(tb.getComponent());
|
||||
@@ -457,7 +458,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
hasToolbarContent = true;
|
||||
}
|
||||
|
||||
myContextActions.put(entry.getKey(), contents);
|
||||
myContextActions.put(entry.getKey(), actions);
|
||||
}
|
||||
|
||||
return hasToolbarContent;
|
||||
@@ -486,7 +487,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
hasToolbarContent |= updateTabUI(each);
|
||||
}
|
||||
|
||||
myTabs.getPresentation().setHideTabs(!hasToolbarContent);
|
||||
myTabs.getPresentation().setHideTabs(!hasToolbarContent && tabs.size() <= 1);
|
||||
|
||||
myTabs.updateTabActions(validateNow);
|
||||
|
||||
|
||||
@@ -93,6 +93,12 @@ public class SafeDeleteProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
if (ancestor instanceof PsiFile) {
|
||||
for (PsiFile file : ((PsiFile)ancestor).getViewProvider().getAllFiles()) {
|
||||
if (PsiTreeUtil.isAncestor(file, place, false)) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return PsiTreeUtil.isAncestor(ancestor, place, false);
|
||||
}
|
||||
|
||||
|
||||
+14
-3
@@ -143,9 +143,20 @@ public class FSRecords implements Forceable {
|
||||
return myFreeRecords.remove(myFreeRecords.size() - 1);
|
||||
}
|
||||
|
||||
private static void createBrokenMarkerFile() {
|
||||
private static void createBrokenMarkerFile(Throwable reason) {
|
||||
File brokenMarker = getCorruptionMarkerFile();
|
||||
try {
|
||||
|
||||
final ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
final PrintStream stream = new PrintStream(out);
|
||||
new Exception().printStackTrace(stream);
|
||||
if (reason != null) {
|
||||
stream.print("\nReason:\n");
|
||||
reason.printStackTrace(stream);
|
||||
}
|
||||
stream.close();
|
||||
LOG.info("Creating VFS corruption marker; Trace=\n" + out.toString());
|
||||
|
||||
final FileWriter writer = new FileWriter(brokenMarker);
|
||||
writer.write("These files are corrupted and must be rebuilt from the scratch on next startup");
|
||||
writer.close();
|
||||
@@ -429,7 +440,7 @@ public class FSRecords implements Forceable {
|
||||
|
||||
private static RuntimeException handleError(final Throwable e) {
|
||||
if (!myCorrupted) {
|
||||
createBrokenMarkerFile();
|
||||
createBrokenMarkerFile(e);
|
||||
myCorrupted = true;
|
||||
force();
|
||||
}
|
||||
@@ -1193,7 +1204,7 @@ public class FSRecords implements Forceable {
|
||||
}
|
||||
|
||||
public static void invalidateCaches() {
|
||||
DbConnection.createBrokenMarkerFile();
|
||||
DbConnection.createBrokenMarkerFile(null);
|
||||
}
|
||||
|
||||
public static void checkSanity() {
|
||||
|
||||
@@ -59,16 +59,10 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget.
|
||||
@Override
|
||||
protected void paintComponent(@NotNull final Graphics g) {
|
||||
super.paintComponent(g);
|
||||
if (actionEnabled) {
|
||||
setForeground(UIUtil.getActiveTextColor());
|
||||
if (getText() != null) {
|
||||
final Rectangle r = getBounds();
|
||||
final Insets insets = getInsets();
|
||||
ARROWS_ICON.paintIcon(this, g, r.width - insets.right - ARROWS_ICON.getIconWidth() - 2, r.height / 2 - ARROWS_ICON.getIconHeight() / 2);
|
||||
}
|
||||
}
|
||||
else {
|
||||
setForeground(UIUtil.getInactiveTextColor());
|
||||
if (actionEnabled && getText() != null) {
|
||||
final Rectangle r = getBounds();
|
||||
final Insets insets = getInsets();
|
||||
ARROWS_ICON.paintIcon(this, g, r.width - insets.right - ARROWS_ICON.getIconWidth() - 2, r.height / 2 - ARROWS_ICON.getIconHeight() / 2);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -87,7 +81,6 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget.
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fileOpened(FileEditorManager source, VirtualFile file) {
|
||||
update();
|
||||
@@ -179,6 +172,20 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget.
|
||||
}
|
||||
myComponent.setToolTipText(toolTip);
|
||||
myComponent.setText(text);
|
||||
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (actionEnabled) {
|
||||
myComponent.setForeground(UIUtil.getActiveTextColor());
|
||||
}
|
||||
else {
|
||||
myComponent.setForeground(UIUtil.getInactiveTextColor());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
myStatusBar.updateWidget(ID());
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ copy.configuration.action.name=Copy Configuration
|
||||
junit.configuration.display.name=JUnit
|
||||
junit.configuration.description=JUnit test configuration
|
||||
no.junit.error.message=No junit.jar
|
||||
no.junit.in.scope.error.message=No junit.jar: {0}
|
||||
no.junit.in.scope.error.message=No junit.jar in {0}
|
||||
junit.not.found.in.module.error.message=JUnit not found in module ''{0}''
|
||||
cannot.browse.test.inheritors.dialog.title=Can't Browse TestCase Inheritors
|
||||
seaching.test.progress.title=Searching For Tests...
|
||||
|
||||
@@ -671,6 +671,27 @@
|
||||
<action id="XDebugger.ToggleSortValues" class="com.intellij.xdebugger.impl.ui.tree.actions.SortValuesToggleAction" icon="/objectBrowser/sorted.png"/>
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.ToolWindow.TopToolbar">
|
||||
<reference ref="ShowExecutionPoint"/>
|
||||
<separator/>
|
||||
<reference ref="StepOver"/>
|
||||
<reference ref="StepInto"/>
|
||||
<reference ref="ForceStepInto"/>
|
||||
<reference ref="StepOut"/>
|
||||
<reference ref="RunToCursor"/>
|
||||
<separator/>
|
||||
<reference ref="XDebugger.ToggleSortValues"/>
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.ToolWindow.LeftToolbar">
|
||||
<reference ref="Resume"/>
|
||||
<reference ref="Pause"/>
|
||||
<reference ref="Stop"/>
|
||||
<separator/>
|
||||
<reference ref="ViewBreakpoints"/>
|
||||
<reference ref="XDebugger.MuteBreakpoints"/>
|
||||
</group>
|
||||
|
||||
<group id="XDebugger.Evaluation.Dialog.Tree.Popup">
|
||||
<reference ref="XDebugger.Inspect"/>
|
||||
<reference ref="XDebugger.SetValue"/>
|
||||
|
||||
@@ -89,6 +89,7 @@ public class LeakedProjectHunter {
|
||||
Class rootClass = backLink.aClass;
|
||||
List<Field> fields = getAllFields(rootClass);
|
||||
for (Field field : fields) {
|
||||
if (root instanceof Reference && "referent".equals(field.getName())) continue; // do not follow weak/soft refs
|
||||
Object value = field.get(root);
|
||||
if (value == null) continue;
|
||||
Class valueClass = value.getClass();
|
||||
@@ -97,7 +98,6 @@ public class LeakedProjectHunter {
|
||||
processor.process(newBackLink);
|
||||
}
|
||||
else {
|
||||
if (root instanceof Reference && "referent".equals(field.getName())) continue; // do not follow weak/soft refs
|
||||
BackLink newBackLink = new BackLink(valueClass, value, field, backLink);
|
||||
if (toFollow(valueClass)) {
|
||||
toVisit.push(newBackLink);
|
||||
@@ -113,7 +113,7 @@ public class LeakedProjectHunter {
|
||||
toVisit.push(new BackLink(oClass, o, null, backLink));
|
||||
}
|
||||
}
|
||||
catch (ClassCastException e) {
|
||||
catch (ClassCastException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,6 @@ public class LeakedProjectHunter {
|
||||
noFollowClasses.add("java.lang.Object");
|
||||
noFollowClasses.add("java.lang.Short");
|
||||
noFollowClasses.add("java.lang.String");
|
||||
noFollowClasses.add("java.lang.ref.WeakReference");
|
||||
}
|
||||
|
||||
private static boolean toFollow(Class oClass) {
|
||||
|
||||
@@ -34,12 +34,11 @@ class JarLoader extends Loader {
|
||||
private final boolean myCanLockJar;
|
||||
private static final boolean myDebugTime = false;
|
||||
|
||||
//private SoftReference<ZipFile> myZipFileRef;
|
||||
private final TimedComputable<ZipFile> myZipFileRef = new TimedComputable<ZipFile>(null) {
|
||||
@NotNull
|
||||
protected ZipFile calc() {
|
||||
try {
|
||||
final ZipFile zipFile = _getZipFile();
|
||||
final ZipFile zipFile = doGetZipFile();
|
||||
if (zipFile == null) throw new RuntimeException("Can't load zip file");
|
||||
return zipFile;
|
||||
}
|
||||
@@ -60,20 +59,27 @@ class JarLoader extends Loader {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ZipFile getZipFile() throws IOException {
|
||||
private ZipFile acquireZipFile() throws IOException {
|
||||
if (myCanLockJar) {
|
||||
return myZipFileRef.acquire();
|
||||
}
|
||||
else {
|
||||
return _getZipFile();
|
||||
return doGetZipFile();
|
||||
}
|
||||
|
||||
private void releaseZipFile(final ZipFile zipFile) throws IOException {
|
||||
if (myCanLockJar) {
|
||||
myZipFileRef.release();
|
||||
}
|
||||
else if (zipFile != null) {
|
||||
zipFile.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ZipFile _getZipFile() throws IOException {
|
||||
private ZipFile doGetZipFile() throws IOException {
|
||||
if (FILE_PROTOCOL.equals(myURL.getProtocol())) {
|
||||
String s = FileUtil.unquote(myURL.getFile());
|
||||
if (!(new File(s)).exists()) {
|
||||
if (!new File(s).exists()) {
|
||||
throw new FileNotFoundException(s);
|
||||
}
|
||||
else {
|
||||
@@ -85,48 +91,44 @@ class JarLoader extends Loader {
|
||||
}
|
||||
|
||||
void buildCache(final ClasspathCache cache) throws IOException {
|
||||
final ZipFile zipFile = getZipFile();
|
||||
if (zipFile == null) return;
|
||||
final Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
ZipFile zipFile = null;
|
||||
try {
|
||||
zipFile = acquireZipFile();
|
||||
if (zipFile == null) return;
|
||||
final Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
||||
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry zipEntry = entries.nextElement();
|
||||
cache.addResourceEntry(zipEntry.getName(), this);
|
||||
while (entries.hasMoreElements()) {
|
||||
ZipEntry zipEntry = entries.nextElement();
|
||||
cache.addResourceEntry(zipEntry.getName(), this);
|
||||
}
|
||||
}
|
||||
|
||||
releaseZipFile(zipFile);
|
||||
}
|
||||
|
||||
private void releaseZipFile(final ZipFile zipFile) throws IOException {
|
||||
if (myCanLockJar) {
|
||||
myZipFileRef.release();
|
||||
}
|
||||
else {
|
||||
zipFile.close();
|
||||
finally {
|
||||
releaseZipFile(zipFile);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Resource getResource(String name, boolean flag) {
|
||||
final long started = myDebugTime ? System.nanoTime():0;
|
||||
ZipFile file = null;
|
||||
try {
|
||||
final ZipFile file = getZipFile();
|
||||
file = acquireZipFile();
|
||||
if (file == null) return null;
|
||||
|
||||
try {
|
||||
ZipEntry entry = file.getEntry(name);
|
||||
if (entry != null) return new MyResource(entry, new URL(getBaseURL(), name));
|
||||
}
|
||||
finally {
|
||||
releaseZipFile(file);
|
||||
}
|
||||
ZipEntry entry = file.getEntry(name);
|
||||
if (entry != null) return new MyResource(entry, new URL(getBaseURL(), name));
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
} finally {
|
||||
final long doneFor = myDebugTime ? (System.nanoTime() - started):0;
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
releaseZipFile(file);
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
final long doneFor = myDebugTime ? System.nanoTime() - started :0;
|
||||
if (doneFor > NS_THRESHOLD) {
|
||||
System.out.println((doneFor/1000000) + " ms for jar loader get resource:"+name);
|
||||
System.out.println(doneFor/1000000 + " ms for jar loader get resource:"+name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,24 +158,28 @@ class JarLoader extends Loader {
|
||||
|
||||
@Nullable
|
||||
public InputStream getInputStream() throws IOException {
|
||||
final ZipFile file = getZipFile();
|
||||
if (file == null) return null;
|
||||
|
||||
final boolean[] wasReleased = new boolean[]{false};
|
||||
final boolean[] wasReleased = {false};
|
||||
ZipFile file = null;
|
||||
|
||||
try {
|
||||
file = acquireZipFile();
|
||||
if (file == null) {
|
||||
releaseZipFile(file);
|
||||
return null;
|
||||
}
|
||||
|
||||
final InputStream inputStream = file.getInputStream(myEntry);
|
||||
if (inputStream == null) {
|
||||
releaseZipFile(file);
|
||||
return null; // if entry was not found
|
||||
}
|
||||
final ZipFile finalFile = file;
|
||||
return new FilterInputStream(inputStream) {
|
||||
private boolean myClosed = false;
|
||||
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
if (!myClosed) {
|
||||
releaseZipFile(file);
|
||||
releaseZipFile(finalFile);
|
||||
}
|
||||
myClosed = true;
|
||||
wasReleased[0] = true;
|
||||
@@ -182,8 +188,8 @@ class JarLoader extends Loader {
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
assert !wasReleased[0];
|
||||
releaseZipFile(file);
|
||||
assert !wasReleased[0];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.ui.ExecutionConsole;
|
||||
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.stepping.XSmartStepIntoHandler;
|
||||
@@ -158,6 +159,12 @@ public abstract class XDebugProcess {
|
||||
public void registerAdditionalContent(@NotNull RunnerLayoutUi ui) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to provide additional actions in 'Debug' tool window
|
||||
*/
|
||||
public void registerAdditionalActions(@NotNull DefaultActionGroup leftToolbar, @NotNull DefaultActionGroup topToolbar) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return message to show in Variables View when debugger isn't paused
|
||||
*/
|
||||
|
||||
@@ -39,6 +39,8 @@ public interface XDebuggerActions {
|
||||
|
||||
@NonNls String EVALUATE_EXPRESSION = "EvaluateExpression";
|
||||
|
||||
@NonNls String TOOL_WINDOW_TOP_TOOLBAR_GROUP = "XDebugger.ToolWindow.TopToolbar";
|
||||
@NonNls String TOOL_WINDOW_LEFT_TOOLBAR_GROUP = "XDebugger.ToolWindow.LeftToolbar";
|
||||
@NonNls String EVALUATE_DIALOG_TREE_POPUP_GROUP = "XDebugger.Evaluation.Dialog.Tree.Popup";
|
||||
@NonNls String INSPECT_TREE_POPUP_GROUP = "XDebugger.Inspect.Tree.Popup";
|
||||
@NonNls String VARIABLES_TREE_POPUP_GROUP = "XDebugger.Variables.Tree.Popup";
|
||||
|
||||
@@ -71,8 +71,10 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
|
||||
myUi = RunnerLayoutUi.Factory.getInstance(project).create("Debug", "unknown!", sessionName, this);
|
||||
myUi.getDefaults().initTabDefaults(0, "Debug", null);
|
||||
}
|
||||
|
||||
myUi.getOptions().setTopToolbar(createTopToolbar(), ActionPlaces.DEBUGGER_TOOLBAR);
|
||||
private static ActionGroup getActionGroup(final String id) {
|
||||
return (ActionGroup)ActionManager.getInstance().getAction(id);
|
||||
}
|
||||
|
||||
private Content createConsoleContent() {
|
||||
@@ -94,7 +96,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
Content watchesContent = myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView.getMainPanel(),
|
||||
XDebuggerBundle.message("debugger.session.tab.watches.title"), XDebuggerUIConstants.WATCHES_TAB_ICON, null);
|
||||
|
||||
ActionGroup group = (ActionGroup)ActionManager.getInstance().getAction(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP);
|
||||
ActionGroup group = getActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP);
|
||||
watchesContent.setActions(group, ActionPlaces.DEBUGGER_TOOLBAR, myWatchesView.getTree());
|
||||
return watchesContent;
|
||||
}
|
||||
@@ -114,21 +116,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
return framesContent;
|
||||
}
|
||||
|
||||
private static DefaultActionGroup createTopToolbar() {
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
ActionManager actionManager = ActionManager.getInstance();
|
||||
group.add(actionManager.getAction(XDebuggerActions.SHOW_EXECUTION_POINT));
|
||||
group.addSeparator();
|
||||
group.add(actionManager.getAction(XDebuggerActions.STEP_OVER));
|
||||
group.add(actionManager.getAction(XDebuggerActions.STEP_INTO));
|
||||
group.add(actionManager.getAction(XDebuggerActions.FORCE_STEP_INTO));
|
||||
group.add(actionManager.getAction(XDebuggerActions.STEP_OUT));
|
||||
group.add(actionManager.getAction(XDebuggerActions.RUN_TO_CURSOR));
|
||||
group.addSeparator();
|
||||
group.add(actionManager.getAction(XDebuggerActions.TOGGLE_SORT_VALUES));
|
||||
return group;
|
||||
}
|
||||
|
||||
public XDebugSessionData saveData() {
|
||||
final List<String> watchExpressions = myWatchesView.getWatchExpressions();
|
||||
return new XDebugSessionData(ArrayUtil.toStringArray(watchExpressions));
|
||||
@@ -191,37 +178,35 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
return myRunContentDescriptor;
|
||||
}
|
||||
|
||||
DefaultActionGroup group = new DefaultActionGroup();
|
||||
DefaultActionGroup leftToolbar = new DefaultActionGroup();
|
||||
final Executor executor = DefaultDebugExecutor.getDebugExecutorInstance();
|
||||
if (runner != null && environment != null) {
|
||||
RestartAction restartAction = new RestartAction(executor, runner, myRunContentDescriptor.getProcessHandler(), XDebuggerUIConstants.DEBUG_AGAIN_ICON,
|
||||
myRunContentDescriptor, environment);
|
||||
group.add(restartAction);
|
||||
leftToolbar.add(restartAction);
|
||||
restartAction.registerShortcut(myUi.getComponent());
|
||||
}
|
||||
|
||||
addActionToGroup(group, XDebuggerActions.RESUME);
|
||||
addActionToGroup(group, XDebuggerActions.PAUSE);
|
||||
addActionToGroup(group, IdeActions.ACTION_STOP_PROGRAM);
|
||||
leftToolbar.addAll(getActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP));
|
||||
|
||||
group.addSeparator();
|
||||
|
||||
addActionToGroup(group, XDebuggerActions.VIEW_BREAKPOINTS);
|
||||
addActionToGroup(group, XDebuggerActions.MUTE_BREAKPOINTS);
|
||||
|
||||
group.addSeparator();
|
||||
//group.addSeparator();
|
||||
//addAction(group, DebuggerActions.EXPORT_THREADS);
|
||||
group.addSeparator();
|
||||
leftToolbar.addSeparator();
|
||||
|
||||
group.add(myUi.getOptions().getLayoutActions());
|
||||
leftToolbar.add(myUi.getOptions().getLayoutActions());
|
||||
|
||||
group.addSeparator();
|
||||
leftToolbar.addSeparator();
|
||||
|
||||
group.add(PinToolwindowTabAction.getPinAction());
|
||||
group.add(new CloseAction(executor, myRunContentDescriptor, getProject()));
|
||||
group.add(new ContextHelpAction(executor.getHelpId()));
|
||||
leftToolbar.add(PinToolwindowTabAction.getPinAction());
|
||||
leftToolbar.add(new CloseAction(executor, myRunContentDescriptor, getProject()));
|
||||
leftToolbar.add(new ContextHelpAction(executor.getHelpId()));
|
||||
|
||||
myUi.getOptions().setLeftToolbar(group, ActionPlaces.DEBUGGER_TOOLBAR);
|
||||
DefaultActionGroup topToolbar = new DefaultActionGroup();
|
||||
topToolbar.addAll(getActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP));
|
||||
|
||||
session.getDebugProcess().registerAdditionalActions(leftToolbar, topToolbar);
|
||||
myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
|
||||
myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
|
||||
|
||||
if (environment != null) {
|
||||
final RunProfile runConfiguration = environment.getRunProfile();
|
||||
@@ -234,11 +219,6 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
|
||||
return myRunContentDescriptor;
|
||||
}
|
||||
|
||||
private static void addActionToGroup(final DefaultActionGroup group, final String actionId) {
|
||||
AnAction action = ActionManager.getInstance().getAction(actionId);
|
||||
if (action != null) group.add(action);
|
||||
}
|
||||
|
||||
public RunnerLayoutUi getUi() {
|
||||
return myUi;
|
||||
}
|
||||
|
||||
+3
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2009 Dave Griffith, Bas Leijdekkers
|
||||
* Copyright 2003-2011 Dave Griffith, Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -155,8 +155,7 @@ public class DeclareCollectionAsInterfaceInspection extends BaseInspection {
|
||||
extends BaseInspectionVisitor {
|
||||
|
||||
@Override public void visitVariable(@NotNull PsiVariable variable) {
|
||||
if (isOnTheFly() &&
|
||||
variable.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
if (isOnTheFly() && !isCheapEnoughToSearch(variable)) {
|
||||
return;
|
||||
}
|
||||
if (ignoreLocalVariables && variable instanceof PsiLocalVariable) {
|
||||
@@ -234,8 +233,7 @@ public class DeclareCollectionAsInterfaceInspection extends BaseInspection {
|
||||
method.hasModifierProperty(PsiModifier.PRIVATE)) {
|
||||
return;
|
||||
}
|
||||
if (isOnTheFly() &&
|
||||
method.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
if (isOnTheFly() && !isCheapEnoughToSearch(method)) {
|
||||
return;
|
||||
}
|
||||
final PsiType type = method.getReturnType();
|
||||
|
||||
@@ -390,11 +390,11 @@ public abstract class GitHandler {
|
||||
}
|
||||
|
||||
try {
|
||||
LOG.info(myCommandLine.getCommandLineString());
|
||||
// setup environment
|
||||
if (!myProject.isDefault() && !mySilent && (myVcs != null)) {
|
||||
myVcs.showCommandLine("cd " + myWorkingDirectory);
|
||||
myVcs.showCommandLine(printableCommandLine());
|
||||
LOG.info(myCommandLine.getCommandLineString());
|
||||
}
|
||||
if (!myNoSSHFlag && myProjectSettings.isIdeaSsh()) {
|
||||
GitSSHService ssh = GitSSHIdeaService.getInstance();
|
||||
|
||||
@@ -30,7 +30,12 @@ import git4idea.GitBranch;
|
||||
import git4idea.GitRevisionNumber;
|
||||
import git4idea.GitVcs;
|
||||
import git4idea.actions.GitShowAllSubmittedFilesAction;
|
||||
import git4idea.commands.*;
|
||||
import git4idea.commands.GitCommand;
|
||||
import git4idea.commands.GitHandlerUtil;
|
||||
import git4idea.commands.GitLineHandler;
|
||||
import git4idea.commands.GitLineHandlerAdapter;
|
||||
import git4idea.commands.GitSimpleHandler;
|
||||
import git4idea.commands.StringScanner;
|
||||
import git4idea.config.GitConfigUtil;
|
||||
import git4idea.config.GitVersionSpecialty;
|
||||
import git4idea.i18n.GitBundle;
|
||||
@@ -166,7 +171,6 @@ public class GitUnstashDialog extends DialogWrapper {
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
GitSimpleHandler h = dropHandler(stash.myStash);
|
||||
try {
|
||||
h.setSilent(true);
|
||||
h.run();
|
||||
h.unsilence();
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ import static org.zmlx.hg4idea.test.HgTestOutputParser.added;
|
||||
/**
|
||||
* Tests adding files to the Mercurial repository.
|
||||
*/
|
||||
public class HgAddTestCase extends HgSingleUserTestCase {
|
||||
public class HgAddTest extends HgSingleUserTest {
|
||||
|
||||
@BeforeMethod
|
||||
@Override
|
||||
+1
-1
@@ -20,7 +20,7 @@ package org.zmlx.hg4idea.test;
|
||||
* This is used to test collaborative tasks, such as push, pull, merge and others.
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class HgCollaborativeTestCase extends HgAbstractTestCase {
|
||||
public class HgCollaborativeTest extends HgTest {
|
||||
|
||||
protected HgTestRepository myParentRepo;
|
||||
protected HgTestRepository myRepo;
|
||||
+1
-1
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class HgCopyTestCase extends HgSingleUserTestCase {
|
||||
public class HgCopyTest extends HgSingleUserTest {
|
||||
|
||||
@Test
|
||||
public void testCopyUnmodifiedFile() throws Exception {
|
||||
+1
-1
@@ -21,7 +21,7 @@ import java.io.File;
|
||||
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
public class HgDeleteTestCase extends HgSingleUserTestCase {
|
||||
public class HgDeleteTest extends HgSingleUserTest {
|
||||
|
||||
@Test
|
||||
public void testDeleteUnmodifiedFile() throws Exception {
|
||||
+2
-2
@@ -15,9 +15,9 @@ import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* HgHistoryTestCase tests retrieving file history and specific revisions.
|
||||
* HgHistoryTest tests retrieving file history and specific revisions.
|
||||
*/
|
||||
public class HgHistoryTestCase extends HgSingleUserTestCase {
|
||||
public class HgHistoryTest extends HgSingleUserTest {
|
||||
|
||||
/**
|
||||
* 1. Make two versions of a file (create, add, commit, modify, commit).
|
||||
+1
-1
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
public class HgLogTestCase extends HgSingleUserTestCase {
|
||||
public class HgLogTest extends HgSingleUserTest {
|
||||
|
||||
@Test
|
||||
public void testCommitMessagesWithMultipleLines() throws Exception {
|
||||
+1
-1
@@ -37,7 +37,7 @@ import static org.testng.Assert.fail;
|
||||
* All Mercurial operations are performed natively to test only HgMergeProvider functionality.
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class HgMergeProviderTestCase extends HgCollaborativeTestCase {
|
||||
public class HgMergeProviderTest extends HgCollaborativeTest {
|
||||
|
||||
private MergeProvider myMergeProvider;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class HgMoveTestCase extends HgSingleUserTestCase {
|
||||
public class HgMoveTest extends HgSingleUserTest {
|
||||
|
||||
@Test
|
||||
public void testMoveNewFile() throws Exception {
|
||||
+1
-1
@@ -27,7 +27,7 @@ import static org.testng.Assert.assertNotNull;
|
||||
/**
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class HgPushTestCase extends HgCollaborativeTestCase {
|
||||
public class HgPushTest extends HgCollaborativeTest {
|
||||
|
||||
/**
|
||||
* Tests 'push' using only native commands.
|
||||
+1
-1
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class HgRenameTestCase extends HgSingleUserTestCase {
|
||||
public class HgRenameTest extends HgSingleUserTest {
|
||||
|
||||
@Test
|
||||
public void testRenameUnmodifiedFile() throws Exception {
|
||||
+1
-1
@@ -9,7 +9,7 @@ import java.nio.charset.Charset;
|
||||
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
public class HgRevertTestCase extends HgSingleUserTestCase {
|
||||
public class HgRevertTest extends HgSingleUserTest {
|
||||
@Test
|
||||
public void testRevertToCurrentRevision() throws Exception {
|
||||
fillFile(myProjectDir, new String[]{"file.txt"}, "initial contents");
|
||||
+2
-2
@@ -16,11 +16,11 @@
|
||||
package org.zmlx.hg4idea.test;
|
||||
|
||||
/**
|
||||
* HgSingleUserTestCase is the parent of test cases for single user workflow.
|
||||
* HgSingleUserTest is the parent of test cases for single user workflow.
|
||||
* It doesn't include collaborate tasks such as cloning, pushing, etc.
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class HgSingleUserTestCase extends HgAbstractTestCase {
|
||||
public class HgSingleUserTest extends HgTest {
|
||||
|
||||
protected HgTestRepository myRepo;
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ import static org.testng.Assert.assertTrue;
|
||||
/**
|
||||
* The ancestor of all hg4idea test cases.
|
||||
*/
|
||||
public abstract class HgAbstractTestCase extends AbstractVcsTestCase {
|
||||
public abstract class HgTest extends AbstractVcsTestCase {
|
||||
|
||||
public static final String HG_EXECUTABLE_PATH = "IDEA_TEST_HG_EXECUTABLE_PATH";
|
||||
public static final String HG_EXECUTABLE = "hg";
|
||||
@@ -33,12 +33,12 @@ import java.io.IOException;
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
public class HgTestRepository {
|
||||
@NotNull private final HgAbstractTestCase myTest;
|
||||
@NotNull private final HgTest myTest;
|
||||
@NotNull private final TempDirTestFixture myDirFixture;
|
||||
private VirtualFile myDir;
|
||||
@Nullable private final HgTestRepository myParent; // cloned from
|
||||
|
||||
public HgTestRepository(@NotNull HgAbstractTestCase test, @NotNull TempDirTestFixture dir) {
|
||||
public HgTestRepository(@NotNull HgTest test, @NotNull TempDirTestFixture dir) {
|
||||
this(test, dir, null);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class HgTestRepository {
|
||||
* @param dir repository root
|
||||
* @param parent parent repository where this repository is cloned from, if one exists.
|
||||
*/
|
||||
public HgTestRepository(@NotNull HgAbstractTestCase test, @NotNull TempDirTestFixture dir, @Nullable HgTestRepository parent) {
|
||||
public HgTestRepository(@NotNull HgTest test, @NotNull TempDirTestFixture dir, @Nullable HgTestRepository parent) {
|
||||
myTest = test;
|
||||
myDirFixture = dir;
|
||||
myParent = parent;
|
||||
@@ -55,15 +55,15 @@ public class HgTestRepository {
|
||||
|
||||
/**
|
||||
* Creates a new Mercurial repository in a new temporary test directory.
|
||||
* @param testCase reference to the test case instance.
|
||||
* @param test reference to the test case instance.
|
||||
* @return created repository.
|
||||
*/
|
||||
public static HgTestRepository create(HgAbstractTestCase testCase) throws Exception {
|
||||
public static HgTestRepository create(HgTest test) throws Exception {
|
||||
final TempDirTestFixture dirFixture = createFixtureDir();
|
||||
final File repo = new File(dirFixture.getTempDirPath());
|
||||
final ProcessOutput processOutput = testCase.runHg(repo, "init");
|
||||
final ProcessOutput processOutput = test.runHg(repo, "init");
|
||||
AbstractVcsTestCase.verify(processOutput);
|
||||
return new HgTestRepository(testCase, dirFixture);
|
||||
return new HgTestRepository(test, dirFixture);
|
||||
}
|
||||
|
||||
private static TempDirTestFixture createFixtureDir() throws Exception {
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
@SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"})
|
||||
public class HgUpdateTestCase extends HgCollaborativeTestCase {
|
||||
public class HgUpdateTest extends HgCollaborativeTest {
|
||||
|
||||
private VirtualFile projectRepoVirtualFile;
|
||||
private File projectRepo;
|
||||
@@ -24,6 +24,8 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.JavaExecutionUtil;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -35,6 +37,7 @@ import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class TestsPattern extends TestObject {
|
||||
@@ -49,22 +52,32 @@ public class TestsPattern extends TestObject {
|
||||
protected void initialize() throws ExecutionException {
|
||||
super.initialize();
|
||||
final JUnitConfiguration.Data data = myConfiguration.getPersistentData();
|
||||
RunConfigurationModule module = myConfiguration.getConfigurationModule();
|
||||
JavaParametersUtil.configureModule(module, myJavaParameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS,
|
||||
myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null);
|
||||
|
||||
final Project project = module.getProject();
|
||||
final Project project = myConfiguration.getProject();
|
||||
boolean isJUnit4 = false;
|
||||
final ArrayList<String> classNames = new ArrayList<String>();
|
||||
final Set<Module> modules = new HashSet<Module>();
|
||||
for (String className : data.getPatterns()) {
|
||||
final PsiClass psiClass = JavaExecutionUtil.findMainClass(project, className, GlobalSearchScope.allScope(project));
|
||||
if (psiClass != null && JUnitUtil.isTestClass(psiClass)) {
|
||||
classNames.add(className);
|
||||
modules.add(ModuleUtil.findModuleForPsiElement(psiClass));
|
||||
if (JUnitUtil.isJUnit4TestClass(psiClass)) {
|
||||
isJUnit4 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
final String jreHome = myConfiguration.isAlternativeJrePathEnabled() ? myConfiguration.getAlternativeJrePath() : null;
|
||||
|
||||
Module module = myConfiguration.getConfigurationModule().getModule();
|
||||
if (module == null && modules.size() == 1 && modules.iterator().next() != null) {
|
||||
module = modules.iterator().next();
|
||||
}
|
||||
|
||||
if (module != null) {
|
||||
JavaParametersUtil.configureModule(module, myJavaParameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS, jreHome);
|
||||
} else {
|
||||
JavaParametersUtil.configureProject(project, myJavaParameters, JavaParameters.JDK_AND_CLASSES_AND_TESTS, jreHome);
|
||||
}
|
||||
addClassesListToJavaParameters(classNames, new Function.Self<String, String>(), "", true, isJUnit4);
|
||||
}
|
||||
|
||||
|
||||
+23
-2
@@ -22,6 +22,7 @@ import com.intellij.execution.junit.JUnitConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfigurationType;
|
||||
import com.intellij.execution.junit.JUnitUtil;
|
||||
import com.intellij.execution.junit.TestClassFilter;
|
||||
import com.intellij.execution.testframework.SourceScope;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.execution.ui.AlternativeJREPanel;
|
||||
import com.intellij.execution.ui.ClassBrowser;
|
||||
@@ -36,10 +37,12 @@ import com.intellij.openapi.ui.FixedSizeButton;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.ui.ex.MessagesEx;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.util.Icons;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -260,8 +263,14 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
|
||||
final TIntArrayList enabledFields = ourEnabledFields.get(newType);
|
||||
for (int i = 0; i < myTestLocations.length; i++)
|
||||
getTestLocation(i).setEnabled(enabledFields.contains(i));
|
||||
if (newType != JUnitConfigurationModel.ALL_IN_PACKAGE) myModule.setEnabled(true);
|
||||
else onScopeChanged();
|
||||
if (newType == JUnitConfigurationModel.PATTERN) {
|
||||
myModule.setEnabled(false);
|
||||
} else if (newType != JUnitConfigurationModel.ALL_IN_PACKAGE) {
|
||||
myModule.setEnabled(true);
|
||||
}
|
||||
else {
|
||||
onScopeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private static class PackageChooserActionListener extends BrowseModuleValueActionListener {
|
||||
@@ -287,6 +296,18 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> {
|
||||
textField.setText(text + (text.length() > 0 ? "||" : "") + psiClass.getQualifiedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassFilter.ClassFilterWithScope getFilter() throws NoFilterException {
|
||||
try {
|
||||
return TestClassFilter.create(SourceScope.wholeProject(getProject()), null);
|
||||
}
|
||||
catch (JUnitUtil.NoJUnitException ignore) {
|
||||
throw new NoFilterException(new MessagesEx.MessageInfo(getProject(),
|
||||
ignore.getMessage(),
|
||||
ExecutionBundle.message("cannot.browse.test.inheritors.dialog.title")));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
showDialog();
|
||||
|
||||
@@ -262,6 +262,7 @@ tooltips
|
||||
trinary
|
||||
twitter
|
||||
uncomment
|
||||
uncommented
|
||||
underwave
|
||||
undofile
|
||||
unhandled
|
||||
|
||||
@@ -32,8 +32,12 @@ public class XmlAttributeValuePattern extends XmlElementPattern<XmlAttributeValu
|
||||
}
|
||||
};
|
||||
|
||||
protected XmlAttributeValuePattern() {
|
||||
super(CONDITION);
|
||||
public XmlAttributeValuePattern() {
|
||||
this(CONDITION);
|
||||
}
|
||||
|
||||
public XmlAttributeValuePattern(InitialPatternCondition<XmlAttributeValue> condition) {
|
||||
super(condition);
|
||||
}
|
||||
|
||||
public XmlAttributeValuePattern withLocalName(@NonNls String... names) {
|
||||
|
||||
Reference in New Issue
Block a user