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

This commit is contained in:
Dmitry Trofimov
2014-09-06 01:33:47 +02:00
15 changed files with 118 additions and 59 deletions
@@ -24,13 +24,13 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.WriteExternalException;
import com.intellij.util.SmartList;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
/**
@@ -44,8 +44,8 @@ public abstract class RunConfigurationBase extends UserDataHolderBase
private final Project myProject;
private String myName = "";
private List<LogFileOptions> myLogFiles = new SmartList<LogFileOptions>();
private List<PredefinedLogFile> myPredefinedLogFiles = new SmartList<PredefinedLogFile>();
private ArrayList<LogFileOptions> myLogFiles = new ArrayList<LogFileOptions>();
private ArrayList<PredefinedLogFile> myPredefinedLogFiles = new ArrayList<PredefinedLogFile>();
@NonNls private static final String LOG_FILE = "log_file";
@NonNls private static final String PREDEFINED_LOG_FILE_ELEMENT = "predefined_log_file";
@@ -127,8 +127,8 @@ public abstract class RunConfigurationBase extends UserDataHolderBase
@Override
public RunConfiguration clone() {
final RunConfigurationBase runConfiguration = (RunConfigurationBase)super.clone();
runConfiguration.myLogFiles = new SmartList<LogFileOptions>(myLogFiles);
runConfiguration.myPredefinedLogFiles = new SmartList<PredefinedLogFile>(myPredefinedLogFiles);
runConfiguration.myLogFiles = new ArrayList<LogFileOptions>(myLogFiles);
runConfiguration.myPredefinedLogFiles = new ArrayList<PredefinedLogFile>(myPredefinedLogFiles);
runConfiguration.myFileOutputPath = myFileOutputPath;
runConfiguration.mySaveOutput = mySaveOutput;
runConfiguration.myShowConsoleOnStdOut = myShowConsoleOnStdOut;
@@ -150,13 +150,13 @@ public abstract class RunConfigurationBase extends UserDataHolderBase
myPredefinedLogFiles.add(predefinedLogFile);
}
public List<PredefinedLogFile> getPredefinedLogFiles() {
public ArrayList<PredefinedLogFile> getPredefinedLogFiles() {
return myPredefinedLogFiles;
}
@NotNull
public List<LogFileOptions> getAllLogFiles() {
List<LogFileOptions> list = new SmartList<LogFileOptions>(myLogFiles);
public ArrayList<LogFileOptions> getAllLogFiles() {
ArrayList<LogFileOptions> list = new ArrayList<LogFileOptions>(myLogFiles);
for (PredefinedLogFile predefinedLogFile : myPredefinedLogFiles) {
final LogFileOptions options = getOptionsForPredefinedLogFile(predefinedLogFile);
if (options != null) {
@@ -166,7 +166,7 @@ public abstract class RunConfigurationBase extends UserDataHolderBase
return list;
}
public List<LogFileOptions> getLogFiles() {
public ArrayList<LogFileOptions> getLogFiles() {
return myLogFiles;
}
@@ -24,7 +24,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.editor.colors.CodeInsightColors;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.event.*;
@@ -53,9 +52,7 @@ import java.io.PrintStream;
import java.util.*;
import java.util.List;
public class LivePreview extends DocumentAdapter implements SearchResults.SearchResultsListener,
SelectionListener {
public class LivePreview extends DocumentAdapter implements SearchResults.SearchResultsListener, SelectionListener {
private static final Key<Object> IN_SELECTION_KEY = Key.create("LivePreview.IN_SELECTION_KEY");
private static final Object IN_SELECTION1 = new Object();
private static final Object IN_SELECTION2 = new Object();
@@ -73,6 +70,13 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
private String myReplacementPreviewText;
private static boolean NotFound;
private final Set<RangeHighlighter> myHighlighters = new HashSet<RangeHighlighter>();
private RangeHighlighter myCursorHighlighter;
private final List<VisibleAreaListener> myVisibleAreaListenersToRemove = new ArrayList<VisibleAreaListener>();
private Delegate myDelegate;
private final SearchResults mySearchResults;
private Balloon myReplacementBalloon;
@Override
public void selectionChanged(SelectionEvent e) {
updateInSelectionHighlighters();
@@ -87,27 +91,15 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
}
public interface Delegate {
@Nullable
String getStringToReplace(Editor editor, FindResult findResult);
String getStringToReplace(@NotNull Editor editor, @Nullable FindResult findResult);
}
private final Set<RangeHighlighter> myHighlighters = new HashSet<RangeHighlighter>();
private RangeHighlighter myCursorHighlighter;
private final List<VisibleAreaListener> myVisibleAreaListenersToRemove = new ArrayList<VisibleAreaListener>();
private static TextAttributes strikout() {
return EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES).clone();
private static TextAttributes strikeout() {
Color color = EditorColorsManager.getInstance().getGlobalScheme().getDefaultForeground();
return new TextAttributes(null, null, color, EffectType.STRIKEOUT, 0);
}
private Delegate myDelegate;
private final SearchResults mySearchResults;
private Balloon myReplacementBalloon;
@Override
public void searchResultsUpdated(SearchResults sr) {
final Project project = mySearchResults.getProject();
@@ -323,7 +315,7 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
attributes.setEffectColor(attributes.getBackgroundColor());
}
if (mySearchResults.isExcluded(range)) {
highlightRange(range, strikout(), myHighlighters);
highlightRange(range, strikeout(), myHighlighters);
} else {
highlightRange(range, attributes, myHighlighters);
}
@@ -19,7 +19,9 @@ import com.intellij.find.*;
import com.intellij.find.impl.FindResultImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.SelectionEvent;
@@ -29,6 +31,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.util.Alarm;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -147,7 +150,7 @@ public class LivePreviewController implements LivePreview.Delegate, FindUtil.Rep
}
@Override
public String getStringToReplace(Editor editor, FindResult findResult) {
public String getStringToReplace(@NotNull Editor editor, @Nullable FindResult findResult) {
if (findResult == null) {
return null;
}
@@ -43,12 +43,8 @@ public abstract class CheckboxAction extends ToggleAction implements CustomCompo
public JComponent createCustomComponent(Presentation presentation) {
// this component cannot be stored right here because of action system architecture:
// one action can be shown on multiple toolbars simultaneously
JCheckBox checkBox = new JCheckBox(presentation.getText());
JCheckBox checkBox = new JCheckBox();
checkBox.setOpaque(false);
checkBox.setToolTipText(presentation.getDescription());
checkBox.setMnemonic(presentation.getMnemonic());
checkBox.setDisplayedMnemonicIndex(presentation.getDisplayedMnemonicIndex());
checkBox.setSelected(Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY)));
checkBox.addActionListener(new ActionListener() {
@Override
@@ -69,13 +65,19 @@ public abstract class CheckboxAction extends ToggleAction implements CustomCompo
@Override
public void update(final AnActionEvent e) {
super.update(e);
Object property = e.getPresentation().getClientProperty(CUSTOM_COMPONENT_PROPERTY);
Presentation presentation = e.getPresentation();
Object property = presentation.getClientProperty(CUSTOM_COMPONENT_PROPERTY);
if (property instanceof JCheckBox) {
JCheckBox checkBox = (JCheckBox)property;
checkBox.setSelected(Boolean.TRUE.equals(e.getPresentation().getClientProperty(SELECTED_PROPERTY)));
checkBox.setEnabled(e.getPresentation().isEnabled());
checkBox.setVisible(e.getPresentation().isVisible());
checkBox.setText(presentation.getText());
checkBox.setToolTipText(presentation.getDescription());
checkBox.setMnemonic(presentation.getMnemonic());
checkBox.setDisplayedMnemonicIndex(presentation.getDisplayedMnemonicIndex());
checkBox.setSelected(Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY)));
checkBox.setEnabled(presentation.isEnabled());
checkBox.setVisible(presentation.isVisible());
}
}
}
@@ -15,12 +15,14 @@
*/
package com.intellij.openapi.vfs.ex.dummy;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.BidirectionalMap;
@@ -75,11 +77,13 @@ public abstract class DummyCachingFileSystem<T extends VirtualFile> extends Dumm
@Override
public void projectOpened(final Project project) {
onProjectOpened(project);
}
@Override
public void projectClosed(final Project project) {
onProjectClosed(project);
// use Disposer instead of projectClosed() because dispose() is called later
Disposer.register(project, new Disposable() {
@Override
public void dispose() {
onProjectClosed(project);
}
});
}
});
initProjectMap();
@@ -817,7 +817,8 @@
<action id="SendEOF" class="com.intellij.execution.actions.EOFAction" text="Send EOF"/>
<group>
<action class="com.intellij.execution.testframework.actions.ViewAssertEqualsDiffAction" text="View assertEquals Difference" id="openAssertEqualsDiff"/>
<action class="com.intellij.execution.testframework.actions.ViewAssertEqualsDiffAction"
text="View assertEquals Difference" id="openAssertEqualsDiff" use-shortcut-of="CompareDirs"/>
<separator/>
<add-to-group anchor="first" group-id="TestTreePopupMenu"/>
</group>
@@ -162,7 +162,6 @@ public abstract class TestTreeView extends Tree implements DataProvider, CopyPro
});
TreeUtil.installActions(this);
PopupHandler.installPopupHandler(this, IdeActions.GROUP_TESTTREE_POPUP, ActionPlaces.TESTTREE_VIEW_POPUP);
ViewAssertEqualsDiffAction.registerShortcut(this);
}
@JdkConstants.TreeSelectionMode
@@ -0,0 +1,19 @@
/*
* Copyright 2000-2014 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.execution.testframework;
public interface TestTreeViewAction {
}
@@ -0,0 +1,38 @@
/*
* Copyright 2000-2014 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.execution.testframework;
import com.intellij.openapi.actionSystem.ActionPromoter;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DataContext;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class TestTreeViewActionsPromoter implements ActionPromoter {
@Override
public List<AnAction> promote(List<AnAction> actions, DataContext context) {
if (AbstractTestProxy.DATA_KEY.getData(context) != null) {
for (AnAction action : actions) {
if (action instanceof TestTreeViewAction) {
return Arrays.asList(action);
}
}
}
return Collections.emptyList();
}
}
@@ -57,6 +57,7 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
@@ -311,18 +312,18 @@ public class AbstractRerunFailedTestsAction extends AnAction implements AnAction
}
@Override
public List<PredefinedLogFile> getPredefinedLogFiles() {
public ArrayList<PredefinedLogFile> getPredefinedLogFiles() {
return myConfiguration.getPredefinedLogFiles();
}
@NotNull
@Override
public List<LogFileOptions> getAllLogFiles() {
public ArrayList<LogFileOptions> getAllLogFiles() {
return myConfiguration.getAllLogFiles();
}
@Override
public List<LogFileOptions> getLogFiles() {
public ArrayList<LogFileOptions> getLogFiles() {
return myConfiguration.getLogFiles();
}
}
@@ -17,12 +17,13 @@
package com.intellij.execution.testframework.actions;
import com.intellij.execution.testframework.AbstractTestProxy;
import com.intellij.execution.testframework.TestTreeViewAction;
import com.intellij.openapi.actionSystem.*;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
public class ViewAssertEqualsDiffAction extends AnAction {
public class ViewAssertEqualsDiffAction extends AnAction implements TestTreeViewAction {
@NonNls public static final String ACTION_ID = "openAssertEqualsDiff";
public void actionPerformed(final AnActionEvent e) {
@@ -54,8 +55,4 @@ public class ViewAssertEqualsDiffAction extends AnAction {
presentation.setEnabled(enabled);
presentation.setVisible(enabled);
}
public static void registerShortcut(final JComponent component) {
ActionManager.getInstance().getAction(ACTION_ID).registerCustomShortcutSet(CommonShortcuts.ALT_ENTER, component);
}
}
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.execution.Location;
import com.intellij.execution.junit.JUnitUtil;
import com.intellij.execution.junit2.PsiMemberParameterizedLocation;
import com.intellij.execution.testframework.TestTreeViewAction;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
@@ -45,7 +46,7 @@ import java.util.List;
/**
* @author yole
*/
public class NavigateToTestDataAction extends AnAction {
public class NavigateToTestDataAction extends AnAction implements TestTreeViewAction {
@Override
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
+1 -1
View File
@@ -167,7 +167,7 @@ public layoutEducational(String classesPath, Set usedJars) {
def appInfo = appInfoFile()
if (!dryRun) {
wireBuildDate(${buildNumber}, appInfo)
wireBuildDate(buildNumber, appInfo)
}
Map args = [
+1
View File
@@ -1546,6 +1546,7 @@
implementation="com.intellij.codeInsight.ExternalAnnotationsNonProjectFileWritingAccessExtension"/>
<lang.inspectionSuppressor language="JAVA" implementationClass="com.intellij.codeInspection.SuppressManagerImpl"/>
<refactoring.moveInnerClassUsagesHandler language="JAVA" implementationClass="com.intellij.refactoring.move.moveInner.MoveInnerClassJavaUsagesHandler" id="java"/>
<actionPromoter implementation="com.intellij.execution.testframework.TestTreeViewActionsPromoter"/>
</extensions>
<actions>
@@ -30,6 +30,7 @@ import com.intellij.psi.xml.XmlAttributeValue;
import com.intellij.psi.xml.XmlTokenType;
import com.intellij.util.CharTable;
import com.intellij.util.IncorrectOperationException;
import com.intellij.xml.util.XmlUtil;
import org.jetbrains.annotations.NotNull;
/**
@@ -63,7 +64,7 @@ public class XmlAttributeValueManipulator extends AbstractElementManipulator<Xml
final int offsetInParent = elementToReplace.getStartOffsetInParent();
String textBeforeRange = text.substring(0, range.getStartOffset() - offsetInParent);
String textAfterRange = text.substring(range.getEndOffset()- offsetInParent, text.length());
text = textBeforeRange + newContent + textAfterRange;
text = textBeforeRange + XmlUtil.escape(newContent) + textAfterRange;
} catch(StringIndexOutOfBoundsException e) {
LOG.error("Range: " + range + " in text: '" + element.getText() + "'", e);
throw e;