Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-01-18 15:13:40 +04:00
20 changed files with 200 additions and 31 deletions
+4 -2
View File
@@ -1,9 +1,11 @@
<component name="libraryTable">
<library name="winp">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/winp-1.16.jar!/" />
<root url="jar://$PROJECT_DIR$/lib/winp-1.16-patched.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/src/winp-1.16-patched-src.zip!/" />
</SOURCES>
</library>
</component>
+1 -1
View File
@@ -222,7 +222,7 @@ libraryLicense(name: "TestNG", version: "5.7 snapshot", license: "Apache 2.0", u
libraryLicense(name: "Trilead SSH", libraryName: "trilead-ssh2", version: "build 213", license: "BSD style (see LICENSE.txt in trilead.jar)", url: "http://www.trilead.com/SSH_Library/")
libraryLicense(name: "Trove4j", version: "1.1 (with patches by JetBrains)", license: "LGPL", url: "http://trove4j.sourceforge.net/", licenseUrl: "http://trove4j.sourceforge.net/html/license.html")
libraryLicense(name: "Velocity", version: "1.7", license: "Apache 2.0", url: "http://velocity.apache.org/", licenseUrl: "http://velocity.apache.org/index.html")
libraryLicense(name: "winp", version: "1.16", license: "MIT", url: "http://winp.dev.java.net/", licenseUrl: "https://winp.dev.java.net/license.html")
libraryLicense(name: "winp", version: "1.16 (patched)", license: "MIT", url: "http://winp.dev.java.net/", licenseUrl: "https://winp.dev.java.net/license.html")
libraryLicense(name: "Xalan", libraryName:"Xalan-2.7.1", version: "2.7.1", license: "Apache 2.0", url: "http://xml.apache.org/xalan-j/", licenseUrl: "http://xml.apache.org/xalan-j/")
libraryLicense(name: "Xerces", version: "2.9.1", license: "Apache 2.0", url: "http://xerces.apache.org/xerces2-j/", licenseUrl: "http://xerces.apache.org/xerces2-j/")
libraryLicense(name: "XML Commons (xml-apis.jar, resolver.jar)", version: "", license: "Apache 2.0, W3C Software License , public domain", url: "http://xml.apache.org/commons/", licenseUrl: "http://xml.apache.org/commons/licenses.html")
@@ -30,6 +30,7 @@ import com.intellij.util.containers.OrderedSet;
import gnu.trove.TObjectHashingStrategy;
import java.io.File;
import java.util.Collection;
import java.util.Set;
public class CompilerPathsEx extends CompilerPaths {
@@ -75,7 +76,7 @@ public class CompilerPathsEx extends CompilerPaths {
}
}
public static void visitFiles(final VirtualFile[] directories, final FileVisitor visitor) {
public static void visitFiles(final Collection<VirtualFile> directories, final FileVisitor visitor) {
for (final VirtualFile outputDir : directories) {
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
@@ -20,14 +20,15 @@ import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.compiler.ex.CompilerPathsEx;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.OrderEnumerator;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.HashMap;
import org.jetbrains.annotations.NotNull;
@@ -68,25 +69,58 @@ public class HotSwapManager extends AbstractProjectComponent {
myTimeStamps.put(session, Long.valueOf(tStamp));
}
public Map<String, HotSwapFile> scanForModifiedClasses(final DebuggerSession session, final HotSwapProgress progress) {
public Map<String, HotSwapFile> scanForModifiedClasses(final DebuggerSession session, final HotSwapProgress progress, final boolean scanWithVFS) {
DebuggerManagerThreadImpl.assertIsManagerThread();
final List<File> outputRoots = new ArrayList<File>();
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
final List<VirtualFile> allClasses = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
for (VirtualFile dir : VfsUtil.toVirtualFileArray(allClasses)) {
outputRoots.add(new File(dir.getPath()));
}
}
});
final long timeStamp = getTimeStamp(session);
final Map<String, HotSwapFile> modifiedClasses = new HashMap<String, HotSwapFile>();
for (File root : outputRoots) {
final String rootPath = FileUtil.toCanonicalPath(root.getPath());
collectModifiedClasses(root, rootPath, rootPath + "/", modifiedClasses, progress, timeStamp);
if (scanWithVFS) {
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
final List<VirtualFile> allDirs = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
CompilerPathsEx.visitFiles(allDirs, new CompilerPathsEx.FileVisitor() {
protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) {
if (!progress.isCancelled()) {
progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath));
super.acceptDirectory(file, fileRoot, filePath);
}
}
protected void acceptFile(VirtualFile file, String fileRoot, String filePath) {
if (progress.isCancelled()) {
return;
}
if (file.getTimeStamp() > timeStamp && StdFileTypes.CLASS.equals(file.getFileType())) {
//noinspection HardCodedStringLiteral
if (SystemInfo.isFileSystemCaseSensitive ? filePath.endsWith(CLASS_EXTENSION) : StringUtil.endsWithIgnoreCase(filePath, CLASS_EXTENSION)) {
progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath));
//noinspection HardCodedStringLiteral
final String qualifiedName = filePath.substring(fileRoot.length() + 1, filePath.length() - CLASS_EXTENSION.length()).replace('/', '.');
modifiedClasses.put(qualifiedName, new HotSwapFile(new File(filePath)));
}
}
}
});
}
});
}
else {
final List<File> outputRoots = new ArrayList<File>();
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
final List<VirtualFile> allDirs = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
for (VirtualFile dir : allDirs) {
outputRoots.add(new File(dir.getPath()));
}
}
});
for (File root : outputRoots) {
final String rootPath = FileUtil.toCanonicalPath(root.getPath());
collectModifiedClasses(root, rootPath, rootPath + "/", modifiedClasses, progress, timeStamp);
}
}
return modifiedClasses;
}
@@ -158,7 +192,7 @@ public class HotSwapManager extends AbstractProjectComponent {
}
public static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClasses(final List<DebuggerSession> sessions, final HotSwapProgress swapProgress) {
public static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClasses(final List<DebuggerSession> sessions, final HotSwapProgress swapProgress, final boolean scanWithVFS) {
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses = new HashMap<DebuggerSession, Map<String, HotSwapFile>>();
final MultiProcessCommand scanClassesCommand = new MultiProcessCommand();
@@ -174,7 +208,7 @@ public class HotSwapManager extends AbstractProjectComponent {
scanClassesCommand.addCommand(debuggerSession.getProcess(), new DebuggerCommandImpl() {
protected void action() throws Exception {
swapProgress.setDebuggerSession(debuggerSession);
final Map<String, HotSwapFile> sessionClasses = getInstance(swapProgress.getProject()).scanForModifiedClasses(debuggerSession, swapProgress);
final Map<String, HotSwapFile> sessionClasses = getInstance(swapProgress.getProject()).scanForModifiedClasses(debuggerSession, swapProgress, scanWithVFS);
if (!sessionClasses.isEmpty()) {
modifiedClasses.put(debuggerSession, sessionClasses);
}
@@ -16,6 +16,7 @@
package com.intellij.debugger.ui;
import com.intellij.CommonBundle;
import com.intellij.compiler.CompilerWorkspaceConfiguration;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerManagerEx;
import com.intellij.debugger.impl.DebuggerSession;
@@ -157,11 +158,16 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent{
return;
}
final HotSwapProgressImpl findClassesProgress = generatedPaths == null? new HotSwapProgressImpl(myProject) : null;
final boolean isServerMode = CompilerWorkspaceConfiguration.getInstance(myProject).useCompileServer();
final boolean shouldPerformScan = !isServerMode || generatedPaths == null;
final HotSwapProgressImpl findClassesProgress = shouldPerformScan ? new HotSwapProgressImpl(myProject) : null;
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses = generatedPaths == null? scanForModifiedClassesWithProgress(sessions, findClassesProgress) : HotSwapManager.findModifiedClasses(sessions, generatedPaths);
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses = shouldPerformScan?
scanForModifiedClassesWithProgress(sessions, findClassesProgress, !isServerMode) :
HotSwapManager.findModifiedClasses(sessions, generatedPaths);
final Application application = ApplicationManager.getApplication();
if (modifiedClasses.isEmpty()) {
@@ -216,12 +222,12 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent{
});
}
private static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress(final List<DebuggerSession> sessions, final HotSwapProgressImpl progress) {
private static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress(final List<DebuggerSession> sessions, final HotSwapProgressImpl progress, final boolean scanWithVFS) {
final Ref<Map<DebuggerSession, Map<String, HotSwapFile>>> result = Ref.create(null);
ProgressManager.getInstance().runProcess(new Runnable() {
public void run() {
try {
result.set(HotSwapManager.scanForModifiedClasses(sessions, progress));
result.set(HotSwapManager.scanForModifiedClasses(sessions, progress, scanWithVFS));
}
finally {
progress.finished();
@@ -157,6 +157,9 @@ public class GenericsHighlightUtil {
if (pparent instanceof PsiTypeElement) {
PsiElement variable = pparent.getParent();
if (variable instanceof PsiVariable) {
if (targetParametersNum == 0) {
QuickFixAction.registerQuickFixAction(highlightInfo, new RemoveTypeArgumentsFix(variable), null);
}
VariableParameterizedTypeFix.registerIntentions(highlightInfo, (PsiVariable)variable, referenceParameterList);
}
}
@@ -0,0 +1,75 @@
/*
* Copyright 2000-2012 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.codeInsight.daemon.impl.quickfix;
import com.intellij.codeInsight.intention.HighPriorityAction;
import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* User: anna
* Date: 1/18/12
*/
public class RemoveTypeArgumentsFix extends LocalQuickFixAndIntentionActionOnPsiElement implements HighPriorityAction {
private static final Logger LOGGER = Logger.getInstance("#" + RemoveTypeArgumentsFix.class.getName());
public RemoveTypeArgumentsFix(@Nullable PsiElement element) {
super(element);
}
@NotNull
@Override
public String getText() {
return "Remove type arguments";
}
@NotNull
@Override
public String getFamilyName() {
return getText();
}
@Override
public boolean isAvailable(@NotNull Project project,
@NotNull PsiFile file,
@NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
return startElement instanceof PsiVariable && startElement.isValid() && ((PsiVariable)startElement).getTypeElement() != null;
}
@Override
public void invoke(@NotNull Project project,
@NotNull PsiFile file,
@Nullable("is null when called from inspection") Editor editor,
@NotNull PsiElement startElement,
@NotNull PsiElement endElement) {
final PsiVariable psiVariable = (PsiVariable)startElement;
final PsiTypeElement typeElement = psiVariable.getTypeElement();
LOGGER.assertTrue(typeElement != null);
final PsiJavaCodeReferenceElement referenceElement = typeElement.getInnermostComponentReferenceElement();
if (referenceElement != null) {
final PsiReferenceParameterList parameterList = referenceElement.getParameterList();
if (parameterList != null) {
parameterList.delete();
}
}
}
}
@@ -0,0 +1,7 @@
// "Remove type arguments" "true"
abstract class SomeClass<K, T> implements Some<K, T> {
public abstract void doSomething(K key, Node<caret> root);
}
class Node {}
interface Some<II, OO>{}
@@ -0,0 +1,7 @@
// "Remove type arguments" "true"
abstract class SomeClass<K, T> implements Some<K, T> {
public abstract void doSomething(K key, Node<caret><K, T> root);
}
class Node {}
interface Some<II, OO>{}
@@ -0,0 +1,7 @@
// "Remove type arguments" "false"
abstract class SomeClass<K, T> implements Some<K, T> {
public abstract void doSomething(K key, Node<caret><K, T> root);
}
class Node<G> {}
interface Some<II, OO>{}
@@ -0,0 +1,25 @@
/*
* Copyright 2000-2012 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.codeInsight.daemon.quickFix;
public class RemoveTypeArgumentsTest extends LightQuickFixTestCase {
public void test() throws Exception { doAllTests(); }
@Override
protected String getBasePath() {
return "/codeInsight/daemonCodeAnalyzer/quickFix/removeTypeArguments";
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ sanselan-0.98-snapshot.jar
serviceMessages.jar
trove4j.jar
velocity.jar
winp-1.16.jar
winp-1.16-patched.jar
xbean.jar
xerces.jar
xmlrpc-2.0.jar
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
@@ -1275,7 +1275,8 @@ public class PsiViewerDialog extends DialogWrapper implements DataProvider, Disp
final PsiElement rootElement = treeStructure.getRootPsiElement();
final SelectionModel selection = myEditor.getSelectionModel();
PsiElement rootPsiElement = treeStructure.getRootPsiElement();
int baseOffset = rootPsiElement.getTextRange().getStartOffset();
final TextRange textRange = rootPsiElement.getTextRange();
int baseOffset = textRange != null ? textRange.getStartOffset() : 0;
final int start = selection.getSelectionStart()+baseOffset;
final int end = selection.getSelectionEnd()+baseOffset - 1;
final PsiElement element =
@@ -114,7 +114,7 @@ public class IdeFrameImpl extends JFrame implements IdeFrame, DataProvider {
// http://lists.apple.com/archives/java-dev/2009/Dec/msg00240.html
if (SystemInfo.isMac) setIconImage(null);
// enable fullscreen titlebar button
if (SystemInfo.isMacOSLion) FullScreenUtilities.setWindowCanFullScreen(this, true);
if (SystemInfo.isMacOSLion && MacMainFrameDecorator.FULL_SCREEN_AVAILABLE) FullScreenUtilities.setWindowCanFullScreen(this, true);
MouseGestureManager.getInstance().add(this);
}
@@ -53,6 +53,7 @@ public class MacMainFrameDecorator implements UISettingsListener, Disposable {
public static final Key<Boolean> SHOULD_OPEN_IN_FULLSCREEN = Key.create("mac.should.open.in.fullscreen");
public static final String FULL_SCREEN = "Idea.Is.In.FullScreen.Mode.Now";
public static final boolean FULL_SCREEN_AVAILABLE = SystemInfo.isJavaVersionAtLeast("1.6.0_29");
private static boolean SHOWN = false;
@@ -136,6 +137,8 @@ public class MacMainFrameDecorator implements UISettingsListener, Disposable {
});
try {
if (SystemInfo.isMacOSLion) {
if (!FULL_SCREEN_AVAILABLE) return;
FullScreenUtilities.addFullScreenListenerTo(frame, new FullScreenAdapter() {
@Override
public void windowEnteredFullScreen(AppEvent.FullScreenEvent event) {
@@ -106,8 +106,6 @@ public class Patches {
/**
* Lion eAWT FullScreen mode leads to visual artifacts
*
* @see com.intellij.util.concurrency.LockFactory
*/
public static final boolean APPLE_BUG_ID_10207064 =
SystemInfo.isMac && (!SystemInfo.isMacOSLeopard || !SystemInfo.isJavaVersionAtLeast("1.6.0_30"));
@@ -119,7 +119,7 @@ class ClassPath {
List<Loader> loaders = myCache.getLoaders(s);
for (int j = 0, size = loaders.size(); j < size; ++j ) {
final Loader loader = loaders.get(j);
if (!myCache.loaderHasName(s, loader)) continue;
//if (!myCache.loaderHasName(s, loader)) continue;
final Resource resource = loader.getResource(s, flag);
if (resource != null) {
if (ourDumpOrder) {