Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Oleg Shpynov
2009-10-22 19:41:23 +04:00
13 changed files with 51 additions and 39 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
@@ -122,7 +122,12 @@ public class ChooseRunConfigurationAction extends AnAction {
popup.registerAction("invokeAction", KeyStroke.getKeyStroke("shift ENTER"), new AbstractAction() {
public void actionPerformed(ActionEvent e) {
popup.handleSelect(true);
try {
popup.handleSelect(true);
}
finally {
myCurrentExecutor = null;
}
}
});
@@ -613,7 +618,7 @@ public class ChooseRunConfigurationAction extends AnAction {
if (finalChoice && wrapper.available(executor)) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if (myAction.getCurrentExecutor() == myAction.getAlternateExecutor()) {
if (executor == myAction.getAlternateExecutor()) {
PropertiesComponent.getInstance().setValue(myAction.getAdKey(), Boolean.toString(true));
}
@@ -30,14 +30,15 @@ import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.util.StatusBarProgress;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.vcs.FileStatusListener;
import com.intellij.openapi.vcs.FileStatusManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.psi.*;
import com.intellij.psi.search.PsiSearchHelper;
import com.intellij.psi.util.PsiTreeUtil;
@@ -143,8 +144,12 @@ public abstract class TodoTreeBuilder extends AbstractTreeBuilder {
final void setUpdatable(boolean updatable) {
if (myUpdatable != updatable) {
myUpdatable = updatable;
if (myUpdatable) {
updateTree(false);
if (updatable) {
DumbService.getInstance(myProject).runWhenSmart(new Runnable() {
public void run() {
updateTree(false);
}
});
}
}
}
@@ -86,12 +86,11 @@ public class ModulePathMacroManager extends BasePathMacroManager /*ProjectPathMa
String macro = "$" + PathMacrosImpl.MODULE_DIR_MACRO_NAME + "$";
boolean check = false;
while (f != null) {
while (f != null && f.getParentFile() != null) {
@NonNls String path = PathMacroMap.quotePath(f.getAbsolutePath());
String s = macro;
if (StringUtil.endsWithChar(path, '/')) s += "/";
if (path.equals("/")) break;
putIfAbsent(result, "file://" + path, "file://" + s, check);
putIfAbsent(result, "file:/" + path, "file:/" + s, check);
@@ -165,8 +165,10 @@ public class PopupChooserBuilder {
@NotNull
public JBPopup createPopup() {
JList list = null;
if (myChooserComponent instanceof JList) {
myChooserComponent = ListWithFilter.wrap((JList)myChooserComponent, new MyListWrapper((JList)myChooserComponent), myItemsNamer);
list = (JList)myChooserComponent;
myChooserComponent = ListWithFilter.wrap(list, new MyListWrapper(list), myItemsNamer);
}
JPanel contentPane = new JPanel(new BorderLayout());
@@ -177,8 +179,7 @@ public class PopupChooserBuilder {
contentPane.add(label, BorderLayout.NORTH);
}
if (myChooserComponent instanceof ListWithFilter) {
JList list = ((ListWithFilter)myChooserComponent).getList();
if (list != null) {
if (list.getSelectedIndex() == -1 && myAutoselect) {
list.setSelectedIndex(0);
}
@@ -186,7 +187,7 @@ public class PopupChooserBuilder {
myChooserComponent.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
myChooserComponent.addMouseListener(new MouseAdapter() {
(list != null ? list : myChooserComponent).addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (UIUtil.isActionClick(e) && !isSelectionButtonDown(e) && !e.isConsumed()) {
@@ -76,7 +76,7 @@ public class ListWithFilter<T> extends JPanel {
}, mySpeedSearch);
setBackground(list.getBackground());
setFocusable(true);
//setFocusable(true);
}
public boolean resetFilter() {
@@ -57,12 +57,11 @@ public class ProjectPathMacroManager extends BasePathMacroManager {
String macro = "$" + PathMacrosImpl.PROJECT_DIR_MACRO_NAME + "$";
boolean check = false;
while (f != null) {
while (f != null && f.getParentFile() != null) {
String path = PathMacroMap.quotePath(f.getAbsolutePath());
String s = macro;
if (StringUtil.endsWithChar(path, '/')) s += "/";
if (path.equals("/")) break;
putIfAbsent(result, "file://" + path, "file://" + s, check);
putIfAbsent(result, "file:/" + path, "file:/" + s, check);
@@ -19,8 +19,14 @@
*/
package com.intellij.openapi.vfs.newvfs.persistent;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.impl.win32.Win32LocalFileSystem;
import com.intellij.openapi.vfs.newvfs.ManagingFS;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.openapi.vfs.newvfs.NewVirtualFileSystem;
@@ -53,11 +59,11 @@ public class RefreshWorker {
root.markClean();
}
else {
//ApplicationEx applicationEx = ApplicationManagerEx.getApplicationEx();
//if (delegate.getProtocol().equals(LocalFileSystem.PROTOCOL) && SystemInfo.isWindows && root.isDirectory() &&
// (applicationEx.isUnitTestMode() || applicationEx.isInternal())) {
// delegate = new Win32LocalFileSystem();
//}
ApplicationEx applicationEx = ApplicationManagerEx.getApplicationEx();
if (delegate.getProtocol().equals(LocalFileSystem.PROTOCOL) && SystemInfo.isWindows && root.isDirectory() &&
(applicationEx.isUnitTestMode() || Registry.is("filesystem.useNative"))) {
delegate = new Win32LocalFileSystem();
}
final PersistentFS persistence = (PersistentFS)ManagingFS.getInstance();
@@ -37,4 +37,6 @@ ide.tree.ensureSelectionOnFocusGained=true
ide.tabbedPane.bufferedPaint=true
debugger.valueTooltipAutoShow=true
debugger.valueTooltipAutoShow.description=Auto show tooltip on mouse over
debugger.valueTooltipAutoShow.description=Auto show tooltip on mouse over
filesystem.useNative=true
@@ -56,7 +56,9 @@ public class ConvertConcatenationToGstringIntention extends Intention {
final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(element.getProject());
final GrExpression newExpr = factory.createExpressionFromText(GrStringUtil.addQuotes(builder.toString(), true));
final GrExpression expression = ((GrBinaryExpression)element).replaceWithExpression(newExpr, true);
GrStringUtil.removeUnnecessaryBracesInGString((GrString)expression);
if (expression instanceof GrString) {
GrStringUtil.removeUnnecessaryBracesInGString((GrString)expression);
}
}
private static void performIntention(GrBinaryExpression expr, StringBuilder builder) {
@@ -15,28 +15,27 @@
*/
package com.intellij.xml.actions;
import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.Function;
import org.jetbrains.annotations.NotNull;
/**
* @author mike
*/
public class ValidateXmlAction extends AnAction /*extends BaseCodeInsightAction*/ {
public class ValidateXmlAction extends AnAction {
private static final Key<String> runningValidationKey = Key.create("xml.running.validation.indicator");
public ValidateXmlAction() {
}
private CodeInsightActionHandler getHandler(final @NotNull PsiFile file) {
private Function<PsiFile, Void> getHandler(final @NotNull PsiFile file) {
ValidateXmlActionHandler handler = new ValidateXmlActionHandler(true);
handler.setErrorReporter(
handler.new StdErrorReporter(
@@ -52,22 +51,18 @@ public class ValidateXmlAction extends AnAction /*extends BaseCodeInsightAction*
}
public void actionPerformed(AnActionEvent e) {
final PsiFile psiFile = LangDataKeys.PSI_FILE.getData(e.getDataContext());
if (psiFile == null) return;
doRunAction(psiFile);
doRunAction(LangDataKeys.PSI_FILE.getData(e.getDataContext()));
}
private void doRunAction(final @NotNull PsiFile psiFile) {
final Project project = psiFile.getProject();
CommandProcessor.getInstance().executeCommand(
project, new Runnable(){
CommandProcessor.getInstance().executeCommand(psiFile.getProject(), new Runnable(){
public void run(){
final Runnable action = new Runnable() {
public void run() {
try {
psiFile.putUserData(runningValidationKey, "");
getHandler(psiFile).invoke(project, null, psiFile);
getHandler(psiFile).fun(psiFile);
}
finally {
psiFile.putUserData(runningValidationKey, null);
@@ -15,13 +15,11 @@
*/
package com.intellij.xml.actions;
import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
import com.intellij.javaee.UriUtil;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
@@ -35,6 +33,7 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.xml.*;
import com.intellij.ui.content.*;
import com.intellij.util.Function;
import com.intellij.util.ui.ErrorTreeView;
import com.intellij.util.ui.MessageCategory;
import com.intellij.xml.XmlBundle;
@@ -44,7 +43,6 @@ import org.apache.xerces.jaxp.JAXPConstants;
import org.apache.xerces.jaxp.SAXParserFactoryImpl;
import org.apache.xerces.util.XMLGrammarPoolImpl;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
@@ -66,7 +64,7 @@ import java.util.concurrent.Future;
/**
* @author Mike
*/
public class ValidateXmlActionHandler implements CodeInsightActionHandler {
public class ValidateXmlActionHandler implements Function<PsiFile, Void> {
private static final Logger LOG = Logger.getInstance("#com.intellij.xml.actions.ValidateXmlAction");
private static final Key<NewErrorTreeViewPanel> KEY = Key.create("ValidateXmlAction.KEY");
@NonNls private static final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http://apache.org/xml/features/validation/schema-full-checking";
@@ -83,8 +81,6 @@ public class ValidateXmlActionHandler implements CodeInsightActionHandler {
private final boolean myForceChecking;
@NonNls
private static final String ENTITY_RESOLVER_PROPERTY_NAME = "http://apache.org/xml/properties/internal/entity-resolver";
@NonNls
public static final String XMLNS_PREFIX = "xmlns";
public ValidateXmlActionHandler(boolean _forceChecking) {
myForceChecking = _forceChecking;
@@ -349,10 +345,12 @@ public class ValidateXmlActionHandler implements CodeInsightActionHandler {
}
}
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
public Void fun(PsiFile file) {
Project project = file.getProject();
PsiDocumentManager.getInstance(project).commitAllDocuments();
doValidate(project,file);
return null;
}
public void doValidate(Project project, PsiFile file) {