Merge remote-tracking branch 'origin/master'

This commit is contained in:
Maxim.Mossienko
2011-06-23 13:51:17 +04:00
12 changed files with 97 additions and 49 deletions
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.CodeInsightSettings;
import com.intellij.codeInsight.highlighting.BraceMatcher;
import com.intellij.codeInsight.highlighting.BraceMatchingUtil;
import com.intellij.codeInsight.highlighting.NontrivialBraceMatcher;
import com.intellij.codeInsight.template.impl.editorActions.TypedActionHandlerBase;
import com.intellij.injected.editor.DocumentWindow;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
@@ -61,18 +62,16 @@ import org.jetbrains.annotations.Nullable;
import java.util.HashMap;
import java.util.Map;
public class TypedHandler implements TypedActionHandler {
public class TypedHandler extends TypedActionHandlerBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.TypedHandler");
private final TypedActionHandler myOriginalHandler;
private static final Map<FileType,QuoteHandler> quoteHandlers = new HashMap<FileType, QuoteHandler>();
private static final Map<Class<? extends Language>, QuoteHandler> ourBaseLanguageQuoteHandlers = new HashMap<Class<? extends Language>, QuoteHandler>();
public TypedHandler(TypedActionHandler originalHandler){
myOriginalHandler = originalHandler;
super(originalHandler);
}
@Nullable
@@ -25,6 +25,7 @@ import com.intellij.codeInsight.editorActions.CompletionAutoPopupHandler;
import com.intellij.codeInsight.lookup.CharFilter;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.template.impl.editorActions.TypedActionHandlerBase;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Document;
@@ -38,12 +39,11 @@ import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
public class TypedHandler implements TypedActionHandler {
private final TypedActionHandler myOriginalHandler;
public class TypedHandler extends TypedActionHandlerBase {
private static boolean inside = false;
public TypedHandler(TypedActionHandler originalHandler){
myOriginalHandler = originalHandler;
super(originalHandler);
}
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext dataContext){
@@ -52,7 +52,7 @@ public class TypedHandler implements TypedActionHandler {
try {
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);
if (lookup == null){
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
return;
}
@@ -100,7 +100,7 @@ public class TypedHandler implements TypedActionHandler {
}
lookup.hide();
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
}
finally {
inside = false;
@@ -17,8 +17,9 @@
package com.intellij.codeInsight.navigation;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.hint.HintUtil;
import com.intellij.codeInsight.hint.HintManagerImpl;
import com.intellij.codeInsight.hint.HintUtil;
import com.intellij.codeInsight.template.impl.editorActions.TypedActionHandlerBase;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.IdeActions;
@@ -45,6 +46,7 @@ import com.intellij.util.text.StringSearcher;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@@ -343,17 +345,15 @@ public class IncrementalSearchHandler {
}
}
public static class MyTypedHandler implements TypedActionHandler {
private final TypedActionHandler myOriginalHandler;
public MyTypedHandler(TypedActionHandler originalAction) {
myOriginalHandler = originalAction;
public static class MyTypedHandler extends TypedActionHandlerBase {
public MyTypedHandler(@Nullable TypedActionHandler originalHandler) {
super(originalHandler);
}
public void execute(@NotNull Editor editor, char charTyped, @NotNull DataContext dataContext) {
PerEditorSearchData data = editor.getUserData(SEARCH_DATA_IN_EDITOR_VIEW_KEY);
if (data == null || data.hint == null){
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
}
else{
LightweightHint hint = data.hint;
@@ -16,37 +16,36 @@
package com.intellij.codeInsight.template.impl.editorActions;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.codeInsight.template.impl.TemplateManagerImpl;
import com.intellij.codeInsight.template.impl.TemplateSettings;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
public class SpaceHandler implements TypedActionHandler {
private final TypedActionHandler myOriginalHandler;
public class SpaceHandler extends TypedActionHandlerBase {
public SpaceHandler(TypedActionHandler originalHandler) {
myOriginalHandler = originalHandler;
super(originalHandler);
}
public void execute(@NotNull Editor editor, char charTyped, @NotNull DataContext dataContext) {
if (charTyped != ' ') {
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
return;
}
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
return;
}
TemplateManagerImpl templateManager = (TemplateManagerImpl) TemplateManagerImpl.getInstance(project);
TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(project);
if (!templateManager.startTemplate(editor, TemplateSettings.SPACE_CHAR)) {
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
}
}
}
@@ -0,0 +1,28 @@
/*
* Copyright 2000-2011 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.template.impl.editorActions;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import org.jetbrains.annotations.Nullable;
public abstract class TypedActionHandlerBase implements TypedActionHandler {
@Nullable protected final TypedActionHandler myOriginalHandler;
public TypedActionHandlerBase(@Nullable TypedActionHandler originalHandler) {
myOriginalHandler = originalHandler;
}
}
@@ -17,6 +17,7 @@
package com.intellij.execution.impl;
import com.intellij.codeInsight.navigation.IncrementalSearchHandler;
import com.intellij.codeInsight.template.impl.editorActions.TypedActionHandlerBase;
import com.intellij.execution.ConsoleFolding;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.actions.ConsoleActionsPostProcessor;
@@ -1000,17 +1001,16 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
return myTokens.size();
}
private static class MyTypedHandler implements TypedActionHandler {
private final TypedActionHandler myOriginalHandler;
private static class MyTypedHandler extends TypedActionHandlerBase {
private MyTypedHandler(final TypedActionHandler originalAction) {
myOriginalHandler = originalAction;
super(originalAction);
}
public void execute(@NotNull final Editor editor, final char charTyped, @NotNull final DataContext dataContext) {
final ConsoleViewImpl consoleView = editor.getUserData(CONSOLE_VIEW_IN_EDITOR_VIEW);
if (consoleView == null || !consoleView.myState.isRunning() || consoleView.isViewer) {
myOriginalHandler.execute(editor, charTyped, dataContext);
if (myOriginalHandler != null) myOriginalHandler.execute(editor, charTyped, dataContext);
}
else {
final String s = String.valueOf(charTyped);
@@ -1078,6 +1078,21 @@ public class FileUtil {
return found;
}
@NotNull
public static List<File> findFilesOrDirsByMask(@NotNull Pattern pattern, @NotNull File dir) {
final ArrayList<File> found = new ArrayList<File>();
for (File file : dir.listFiles()) {
if (file.isDirectory()) {
found.addAll(findFilesOrDirsByMask(pattern, file));
}
if (pattern.matcher(file.getName()).matches()) {
found.add(file);
}
}
return found;
}
/**
* Returns empty string for empty path.
* First checks whether provided path is a path of a file with sought-for name.
@@ -202,9 +202,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
synchronized (myDataLock) {
listCopy = getChangeListsCopy();
}
if (! listCopy.isEmpty()) {
myProject.getMessageBus().syncPublisher(LISTS_LOADED).processLoadedLists(listCopy);
}
myProject.getMessageBus().syncPublisher(LISTS_LOADED).processLoadedLists(listCopy);
}
private void initializeForNewProject() {
@@ -99,6 +99,7 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
// todo group somewhere
private JPanel myNoDetailsPanel;
private JPanel myNothingSelected;
private JPanel myNotLoadedYet;
private boolean myDetailsOn;
private ChangesViewManager.MyFileListener myFileListener;
private final SLRUMap<FilePath, Pair<JPanel, Disposable>> myDetailsCache;
@@ -106,6 +107,8 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
private final MyDocumentListener myDocumentListener;
private ZipperUpdater myDetailsUpdater;
private Runnable myUpdateDetails;
private MessageBusConnection myConnection;
private ChangesViewManager.ToggleDetailsAction myToggleDetailsAction;
public static ChangesViewI getInstance(Project project) {
return PeriodicalTasksCloser.getInstance().safeGetComponent(project, ChangesViewI.class);
@@ -118,6 +121,7 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
myView = new ChangesListView(project);
myNoDetailsPanel = VcsChangeDetailsManager.errorPanel("No details available", false);
myNothingSelected = VcsChangeDetailsManager.errorPanel("Nothing selected", false);
myNotLoadedYet = VcsChangeDetailsManager.errorPanel("Changes content is not loaded yet", false);
Disposer.register(project, myView);
myRepaintAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, project);
@@ -154,8 +158,8 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
myContentManager.addContent(content);
scheduleRefresh();
final MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
connection.subscribe(RemoteRevisionsCache.REMOTE_VERSION_CHANGED, new Runnable() {
myConnection = myProject.getMessageBus().connect(myProject);
myConnection.subscribe(RemoteRevisionsCache.REMOTE_VERSION_CHANGED, new Runnable() {
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
@@ -167,6 +171,7 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
}
public void projectClosed() {
myConnection.disconnect();
myDetailsCache.clear();
myDisposed = true;
myRepaintAlarm.cancelAllRequests();
@@ -210,7 +215,8 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
visualActionsGroup.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COPY));
visualActionsGroup.add(new ToggleShowIgnoredAction());
visualActionsGroup.add(new IgnoredSettingsAction());
visualActionsGroup.add(new ToggleDetailsAction());
myToggleDetailsAction = new ToggleDetailsAction();
visualActionsGroup.add(myToggleDetailsAction);
visualActionsGroup.add(new ContextHelpAction(ChangesListView.ourHelpId));
toolbarPanel.add(createToolbarComponent(visualActionsGroup), BorderLayout.CENTER);
@@ -257,6 +263,12 @@ public class ChangesViewManager implements ChangesViewI, JDOMExternalizable, Pro
Pair<JPanel, Disposable> details = null;
FilePath filePath = null;
for (Change change : selectedChanges) {
if (change.getBeforeRevision() instanceof FakeRevision || change.getAfterRevision() instanceof FakeRevision) {
mySplitter.setSecondComponent(myNotLoadedYet);
mySplitter.revalidate();
mySplitter.repaint();
return;
}
filePath = ChangesUtil.getFilePath(change);
details = myDetailsCache.get(filePath);
if (details != null) break;
@@ -110,15 +110,7 @@ public class PluginRunConfiguration extends RunConfigurationBase implements Modu
fillParameterList(vm, VM_PARAMETERS);
fillParameterList(params.getProgramParametersList(), PROGRAM_PARAMETERS);
if (!VM_PARAMETERS.contains("-Xms")) {
vm.add("-Xms128m");
}
if (!VM_PARAMETERS.contains("-Xmx")) {
vm.add("-Xmx512m");
}
if (!VM_PARAMETERS.contains("-XX:MaxPermSize")) {
vm.add("-XX:MaxPermSize=250m");
}
@NonNls String libPath = ideaJdk.getHomePath() + File.separator + "lib";
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
@@ -274,6 +274,7 @@ public class SvnVcs extends AbstractVcs<CommittedChangeList> {
final MessageBusConnection connection = bus.connect();
connection.subscribe(ChangeListManagerImpl.LISTS_LOADED, new LocalChangeListsLoadedListener() {
public void processLoadedLists(final List<LocalChangeList> lists) {
if (lists.isEmpty()) return;
SvnConfiguration.SvnSupportOptions supportOptions = null;
try {
ChangeListManager.getInstance(myProject).setReadOnly(SvnChangeProvider.ourDefaultListName, true);
+5 -1
View File
@@ -22,7 +22,7 @@
<configuration name="&lt;template&gt;" type="JUnit" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="VM_PARAMETERS" value="-ea"/>
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
@@ -34,6 +34,10 @@
<option name="PORT" value="5005" />
</configuration>
<configuration name="&lt;template&gt;" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false">
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m" />
</configuration>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>