Merge remote-tracking branch 'origin/master'

This commit is contained in:
irengrig
2015-02-05 18:03:14 +01:00
35 changed files with 226 additions and 111 deletions
@@ -50,6 +50,7 @@ import com.intellij.ui.classFilter.ClassFilter;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xdebugger.XSourcePosition;
import com.intellij.xdebugger.frame.XValueNode;
import com.intellij.xdebugger.impl.XSourcePositionImpl;
import com.sun.jdi.*;
import com.sun.jdi.event.Event;
@@ -66,8 +67,6 @@ import java.util.regex.PatternSyntaxException;
public abstract class DebuggerUtilsEx extends DebuggerUtils {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.impl.DebuggerUtilsEx");
private static final int MAX_LABEL_SIZE = 255;
/**
* @param context
* @return all CodeFragmentFactoryProviders that provide code fragment factories suitable in the context given
@@ -594,8 +593,9 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
}
public static String truncateString(final String str) {
if (str.length() > MAX_LABEL_SIZE) {
return str.substring(0, MAX_LABEL_SIZE) + "...";
// leave a small gap over XValueNode.MAX_VALUE_LENGTH to detect oversize
if (str.length() > XValueNode.MAX_VALUE_LENGTH + 5) {
return str.substring(0, XValueNode.MAX_VALUE_LENGTH + 5);
}
return str;
}
@@ -633,17 +633,23 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
@Nullable
public static XSourcePosition toXSourcePosition(@NotNull SourcePosition position) {
if (position.getFile().getVirtualFile() == null) {
VirtualFile file = position.getFile().getVirtualFile();
if (file == null) {
file = position.getFile().getOriginalFile().getVirtualFile();
}
if (file == null) {
return null;
}
return new JavaXSourcePosition(position);
return new JavaXSourcePosition(position, file);
}
private static class JavaXSourcePosition implements XSourcePosition {
private final SourcePosition mySourcePosition;
@NotNull private final VirtualFile myFile;
public JavaXSourcePosition(@NotNull SourcePosition sourcePosition) {
public JavaXSourcePosition(@NotNull SourcePosition sourcePosition, @NotNull VirtualFile file) {
mySourcePosition = sourcePosition;
myFile = file;
}
@Override
@@ -659,7 +665,7 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
@NotNull
@Override
public VirtualFile getFile() {
return mySourcePosition.getFile().getVirtualFile();
return myFile;
}
@NotNull
@@ -42,6 +42,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiManager;
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.testFramework.fixtures.impl.GlobalInspectionContextForTests;
import com.intellij.util.ArrayUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
@@ -145,7 +146,7 @@ public abstract class InspectionTestCase extends PsiTestCase {
InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject());
InspectionToolWrapper[] toolWrappers = runDeadCodeFirst ? new InspectionToolWrapper []{getUnusedDeclarationWrapper(), toolWrapper} : new InspectionToolWrapper []{toolWrapper};
toolWrappers = ArrayUtil.mergeArrays(toolWrappers, additional);
final GlobalInspectionContextImpl globalContext =
final GlobalInspectionContextForTests globalContext =
CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, toolWrappers);
InspectionTestUtil.runTool(toolWrapper, scope, globalContext);
+2
View File
@@ -1,3 +1,5 @@
* pty4j - Java PTY implementation - https://github.com/traff/pty4j
* cyglaunch.exe is a part of pty4j library licensed under Eclipse Public License and is linked with Cygwin™ according to Cygwin™ Open Source
Licensing Exception (see https://cygwin.com/licensing.html)
* purejavacomm - we use forked version that fixes JNA and YourKit Profiler incompatibility - https://github.com/traff/purejavacomm
* libwinpty.dll and winpty-agent.exe - Windows PTY native implementation used by pty4j, we use forked version from https://github.com/traff/winpty
Binary file not shown.
@@ -175,7 +175,7 @@ public class PerformanceWatcher implements ApplicationComponent {
//System.out.println("EDT is not responding at " + myPrintDateFormat.format(new Date()));
myCurHangLogDir = new File(mySessionLogDir, myDateFormat.format(new Date()));
}
dumpThreads(false);
dumpThreads("", false);
}
}
else {
@@ -197,7 +197,7 @@ public class PerformanceWatcher implements ApplicationComponent {
}
private String getLogDirForHang() {
StringBuilder name = new StringBuilder(myCurHangLogDir.getName());
StringBuilder name = new StringBuilder("freeze-" + myCurHangLogDir.getName());
name.append("-").append(myUnresponsiveDuration);
if (myStacktraceCommonPart != null && !myStacktraceCommonPart.isEmpty()) {
final StackTraceElement element = myStacktraceCommonPart.get(0);
@@ -206,13 +206,13 @@ public class PerformanceWatcher implements ApplicationComponent {
return name.toString();
}
public void dumpThreads(boolean millis) {
public void dumpThreads(String pathPrefix, boolean millis) {
if (shallNotWatch()) return;
final String suffix = millis ? "-" + String.valueOf(System.currentTimeMillis()) : "";
myCurHangLogDir.mkdirs();
File f = new File(myCurHangLogDir, "threadDump-" + myDateFormat.format(new Date()) + suffix + ".txt");
File f = new File(myCurHangLogDir, pathPrefix + "threadDump-" + myDateFormat.format(new Date()) + suffix + ".txt");
FileOutputStream fos;
try {
fos = new FileOutputStream(f);
@@ -65,7 +65,7 @@ public final class PooledThreadExecutor {
};
if (ApplicationInfoImpl.getShadowInstance().isEAP() && count > ourReasonableThreadPoolSize) {
LOG.info("Not enough pooled threads; dumping threads into a file");
PerformanceWatcher.getInstance().dumpThreads(true);
PerformanceWatcher.getInstance().dumpThreads("newPooledThread/", true);
}
thread.setPriority(Thread.NORM_PRIORITY - 1);
return thread;
@@ -337,7 +337,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
}
if (Registry.is("dump.threads.on.empty.lookup") && myLookup.isCalculating() && myLookup.getItems().isEmpty()) {
PerformanceWatcher.getInstance().dumpThreads(true);
PerformanceWatcher.getInstance().dumpThreads("emptyLookup/", true);
}
if (!myLookup.showLookup()) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -18,6 +18,8 @@ package com.intellij.execution.actions;
import com.intellij.execution.process.ProcessHandler;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NonNls;
@@ -32,7 +34,9 @@ public class EOFAction extends DumbAwareAction implements AnAction.TransparentUp
@Override
public void update(AnActionEvent e) {
e.getPresentation().setEnabledAndVisible(StopAction.getHandler(e.getDataContext()) != null);
e.getPresentation().setEnabledAndVisible(e.getData(LangDataKeys.CONSOLE_VIEW) != null
&& e.getData(CommonDataKeys.EDITOR) != null
&& StopAction.getHandler(e.getDataContext()) != null);
}
@Override
@@ -51,10 +51,7 @@ import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
import javax.script.*;
import javax.swing.*;
import java.awt.*;
import java.io.IOException;
@@ -171,6 +168,7 @@ public class RunIdeConsoleAction extends DumbAwareAction {
ConsoleViewImpl consoleView = (ConsoleViewImpl)descriptor.getExecutionConsole();
try {
class IDE {
private final Map<Object, Object> bindings = ContainerUtil.newConcurrentMap();
public final Application application = ApplicationManager.getApplication();
public final Project project = project_;
public void print(Object o) {
@@ -179,12 +177,19 @@ public class RunIdeConsoleAction extends DumbAwareAction {
public void error(Object o) {
printInContent(descriptor, o, ConsoleViewContentType.ERROR_OUTPUT);
}
public Object put(Object key, Object value) {
return value == null ? bindings.remove(key) : bindings.put(key, value);
}
public Object get(Object key) {
return bindings.get(key);
}
}
//myHistoryController.getModel().addToHistory(command);
consoleView.print("> " + command, ConsoleViewContentType.USER_INPUT);
consoleView.print("\n", ConsoleViewContentType.USER_INPUT);
engine.getBindings(ScriptContext.ENGINE_SCOPE).put("IDE", new IDE());
Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
if (bindings.get("IDE") == null) bindings.put("IDE", new IDE());
Object o = engine.eval(profile == null ? command : profile + "\n" + command);
consoleView.print("=> " + o, ConsoleViewContentType.NORMAL_OUTPUT);
consoleView.print("\n", ConsoleViewContentType.NORMAL_OUTPUT);
@@ -220,11 +225,12 @@ public class RunIdeConsoleAction extends DumbAwareAction {
ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
DefaultActionGroup toolbarActions = new DefaultActionGroup();
JComponent consoleComponent = new JPanel(new BorderLayout());
consoleComponent.add(consoleView.getComponent(), BorderLayout.CENTER);
consoleComponent.add(ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false).getComponent(),
BorderLayout.WEST);
final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, consoleComponent, file.getName()) {
JComponent panel = new JPanel(new BorderLayout());
panel.add(consoleView.getComponent(), BorderLayout.CENTER);
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false);
toolbar.setTargetComponent(consoleView.getComponent());
panel.add(toolbar.getComponent(), BorderLayout.WEST);
final RunContentDescriptor descriptor = new RunContentDescriptor(consoleView, null, panel, file.getName()) {
@Override
public boolean isContentReuseProhibited() {
return true;
@@ -245,10 +251,10 @@ public class RunIdeConsoleAction extends DumbAwareAction {
// rerunRunnable.run();
// }
//});
toolbarActions.add(new CloseAction(executor, descriptor, project));
for (AnAction action : consoleView.createConsoleActions()) {
toolbarActions.add(action);
}
toolbarActions.add(new CloseAction(executor, descriptor, project));
psiFile.putCopyableUserData(DESCRIPTOR_KEY, new WeakReference<RunContentDescriptor>(descriptor));
ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor);
return descriptor;
@@ -52,9 +52,11 @@ public abstract class FileTemplateManager{
public static final String PROJECT_NAME_VARIABLE = "PROJECT_NAME";
public static FileTemplateManager getInstance(@NotNull Project project){
return ServiceManager.getService(project, FileTemplateManager.class);
return ServiceManager.getService(project, FileTemplateManager.class).checkInitialized();
}
protected FileTemplateManager checkInitialized() { return this; }
/** Use {@link #getInstance(Project)} instead */
@Deprecated
public static FileTemplateManager getInstance(){
@@ -65,9 +65,11 @@ public class FileTemplateManagerImpl extends FileTemplateManager implements Pers
private final FileTypeManagerEx myTypeManager;
private final Project myProject;
/** Null for default project. */
@Nullable
private final FileTemplatesScheme myProjectScheme;
private FileTemplatesScheme myScheme = FileTemplatesScheme.DEFAULT;
private boolean myInitialized;
private final FTManager myInternalTemplatesManager;
private final FTManager myDefaultTemplatesManager;
@@ -130,19 +132,27 @@ public class FileTemplateManagerImpl extends FileTemplateManager implements Pers
@Override
public void setCurrentScheme(@NotNull FileTemplatesScheme scheme) {
setScheme(scheme, true);
for (FTManager child : myAllManagers) {
child.saveTemplates();
}
setScheme(scheme);
}
private void setScheme(@NotNull FileTemplatesScheme scheme, boolean saveBefore) {
if (saveBefore) {
for (FTManager child : myAllManagers) {
child.saveTemplates();
}
}
private void setScheme(@NotNull FileTemplatesScheme scheme) {
myScheme = scheme;
for (FTManager manager : myAllManagers) {
manager.setScheme(scheme);
}
myInitialized = true;
}
@Override
protected FileTemplateManager checkInitialized() {
if (!myInitialized) {
// loadState() not called; init default scheme
setScheme(myScheme);
}
return this;
}
@Nullable
@@ -436,7 +446,8 @@ public class FileTemplateManagerImpl extends FileTemplateManager implements Pers
@Override
public void loadState(State state) {
XmlSerializerUtil.copyBean(state, myState);
setScheme(myProjectScheme != null && myProjectScheme.getName().equals(state.SCHEME) ? myProjectScheme : FileTemplatesScheme.DEFAULT, false);
FileTemplatesScheme scheme = myProjectScheme != null && myProjectScheme.getName().equals(state.SCHEME) ? myProjectScheme : FileTemplatesScheme.DEFAULT;
setScheme(scheme);
}
public static class State {
@@ -107,9 +107,9 @@ public class ScratchFileServiceImpl extends ScratchFileService implements Persis
@Nullable
@Override
public RootType getRootType(@NotNull VirtualFile file) {
if (!(file instanceof VirtualFileWithId)) return null;
if (!file.isValid()) return null;
RootType result = myIndex.getInfoForFile(file);
VirtualFile parent = file.getParent();
if (!(parent instanceof VirtualFileWithId)) return null;
RootType result = myIndex.getInfoForFile(parent);
return result == NULL_TYPE ? null : result;
}
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
@@ -29,7 +30,7 @@ import java.util.Collection;
/**
* @author Rustam Vishnyakov
*/
public class MarkAsOriginalTypeAction extends AnAction {
public class MarkAsOriginalTypeAction extends DumbAwareAction {
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
@@ -19,11 +19,12 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeManager;
import com.intellij.openapi.project.DumbAware;
/**
* @author Rustam Vishnyakov
*/
public class MarkFileGroup extends DefaultActionGroup {
public class MarkFileGroup extends DefaultActionGroup implements DumbAware {
@Override
public void update(AnActionEvent e) {
final Presentation presentation = e.getPresentation();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -80,6 +80,7 @@ public class DefaultLanguageColorsPage implements ColorSettingsPage, DisplayPrio
TAG_HIGHLIGHTING_MAP.put("interface", DefaultLanguageHighlighterColors.INTERFACE_NAME);
TAG_HIGHLIGHTING_MAP.put("doc_markup", DefaultLanguageHighlighterColors.DOC_COMMENT_MARKUP);
TAG_HIGHLIGHTING_MAP.put("doc_tag", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG);
TAG_HIGHLIGHTING_MAP.put("doc_tag_value", DefaultLanguageHighlighterColors.DOC_COMMENT_TAG_VALUE);
TAG_HIGHLIGHTING_MAP.put("valid_esc_seq", DefaultLanguageHighlighterColors.VALID_STRING_ESCAPE);
TAG_HIGHLIGHTING_MAP.put("invalid_esc_seq", DefaultLanguageHighlighterColors.INVALID_STRING_ESCAPE);
TAG_HIGHLIGHTING_MAP.put("predefined", DefaultLanguageHighlighterColors.PREDEFINED_SYMBOL);
@@ -128,6 +129,8 @@ public class DefaultLanguageColorsPage implements ColorSettingsPage, DisplayPrio
OptionsBundle.message("options.language.defaults.doc.markup"), DefaultLanguageHighlighterColors.DOC_COMMENT_MARKUP),
new AttributesDescriptor(
OptionsBundle.message("options.language.defaults.doc.tag"), DefaultLanguageHighlighterColors.DOC_COMMENT_TAG),
new AttributesDescriptor(
OptionsBundle.message("options.language.defaults.doc.tag.value"), DefaultLanguageHighlighterColors.DOC_COMMENT_TAG_VALUE),
new AttributesDescriptor(
OptionsBundle.message("options.language.defaults.label"), DefaultLanguageHighlighterColors.LABEL),
new AttributesDescriptor(
@@ -203,6 +206,7 @@ public class DefaultLanguageColorsPage implements ColorSettingsPage, DisplayPrio
"<doc_comment>/** \n" +
" * Doc comment\n" +
" * <doc_tag>@tag</doc_tag> <doc_markup><code>Markup</code></doc_markup>\n" +
" * <doc_tag>@param</doc_tag> <doc_tag_value>param_name</doc_tag_value> documentation\n" +
" */</doc_comment>\n" +
"<label>:Label</label>\n" +
"<predefined>predefined_symbol()</predefined>\n" +
@@ -17,7 +17,6 @@ package com.intellij.openapi.application.impl;
import com.intellij.BundleBase;
import com.intellij.CommonBundle;
import com.intellij.diagnostic.PerformanceWatcher;
import com.intellij.diagnostic.ThreadDumper;
import com.intellij.ide.*;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
@@ -119,8 +118,6 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
private final Disposable myLastDisposable = Disposer.newDisposable(); // will be disposed last
private final AtomicBoolean mySaveSettingsIsInProgress = new AtomicBoolean(false);
@SuppressWarnings({"UseOfArchaicSystemPropertyAccessors"})
private static final int ourDumpThreadsOnLongWriteActionWaiting = Integer.getInteger("dump.threads.on.long.write.action.waiting", 0);
private final ExecutorService ourThreadExecutorsService = PooledThreadExecutor.INSTANCE;
private boolean myIsFiringLoadingEvent = false;
@@ -1179,19 +1176,6 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
}
if (!myLock.writeLock().tryLock()) {
final AtomicBoolean lockAcquired = new AtomicBoolean(false);
if (ourDumpThreadsOnLongWriteActionWaiting > 0) {
executeOnPooledThread(new Runnable() {
@Override
public void run() {
while (!lockAcquired.get()) {
TimeoutUtil.sleep(ourDumpThreadsOnLongWriteActionWaiting);
if (!lockAcquired.get()) {
PerformanceWatcher.getInstance().dumpThreads(true);
}
}
}
});
}
myLock.writeLock().lockInterruptibly();
lockAcquired.set(true);
}
@@ -561,20 +561,19 @@ public class SchemesManagerImpl<T extends Scheme, E extends ExternalizableScheme
file = DirectoryBasedStorage.getFile(fileName, myDir, this);
}
final VirtualFile finalFile = file;
ApplicationManager.getApplication().runWriteAction(new ThrowableComputable<Object, IOException>() {
@Override
public Object compute() throws IOException {
OutputStream out = finalFile.getOutputStream(this);
try {
byteOut.writeTo(out);
}
finally {
out.close();
}
return null;
AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(DocumentRunnable.IgnoreDocumentRunnable.class);
try {
OutputStream out = file.getOutputStream(this);
try {
byteOut.writeTo(out);
}
});
finally {
out.close();
}
}
finally {
token.finish();
}
}
else if (renamed) {
myFilesToDelete.add(currentFileNameWithoutExtension);
@@ -70,12 +70,18 @@ public class TableSpeedSearch extends SpeedSearchBase<JTable> {
@Override
protected void selectElement(Object element, String selectedText) {
final int index = ((Integer)element).intValue();
final int row = index / myComponent.getColumnCount();
final int col = index % myComponent.getColumnCount();
myComponent.getSelectionModel().setSelectionInterval(row, row);
myComponent.getColumnModel().getSelectionModel().setSelectionInterval(col, col);
TableUtil.scrollSelectionToVisible(myComponent);
if (element instanceof Integer) {
final int index = ((Integer)element).intValue();
final int row = index / myComponent.getColumnCount();
final int col = index % myComponent.getColumnCount();
myComponent.getSelectionModel().setSelectionInterval(row, row);
myComponent.getColumnModel().getSelectionModel().setSelectionInterval(col, col);
TableUtil.scrollSelectionToVisible(myComponent);
}
else {
myComponent.getSelectionModel().clearSelection();
myComponent.getColumnModel().getSelectionModel().clearSelection();
}
}
@Override
@@ -170,6 +170,7 @@ options.language.defaults.block.comment=Block comment
options.language.defaults.doc.comment=Doc comment
options.language.defaults.doc.markup=Doc comment markup
options.language.defaults.doc.tag=Doc comment tag
options.language.defaults.doc.tag.value=Doc comment tag value
options.language.defaults.label=Label
options.language.defaults.constant=Constant
options.language.defaults.local.variable=Local variable
@@ -1667,6 +1667,11 @@
<option name="ERROR_STRIPE_COLOR" value="43698d" />
</value>
</option>
<option name="DEFAULT_DOC_COMMENT_TAG_VALUE">
<value>
<option name="FOREGROUND" value="8a653b" />
</value>
</option>
<option name="DOC_COMMENT_TAG_VALUE">
<value>
<option name="FOREGROUND" value="8a653b" />
@@ -22,7 +22,7 @@ import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.codeInspection.ui.InspectionToolPresentation;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import com.intellij.testFramework.fixtures.impl.GlobalInspectionContextForTests;
import com.intellij.util.ui.UIUtil;
import org.jdom.Document;
import org.jdom.Element;
@@ -153,7 +153,7 @@ expected:
public static void runTool(@NotNull InspectionToolWrapper toolWrapper,
@NotNull final AnalysisScope scope,
@NotNull final GlobalInspectionContextImpl globalContext) {
@NotNull final GlobalInspectionContextForTests globalContext) {
final String shortName = toolWrapper.getShortName();
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null){
@@ -164,6 +164,6 @@ expected:
do {
UIUtil.dispatchAllInvocationEvents();
}
while (!CodeInsightTestFixtureImpl.isInspectionsFinished(globalContext));
while (!globalContext.isFinished());
}
}
@@ -462,19 +462,19 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
scope.invalidate();
InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject());
GlobalInspectionContextImpl globalContext = createGlobalContextForTool(scope, getProject(), inspectionManager, toolWrapper);
GlobalInspectionContextForTests globalContext = createGlobalContextForTool(scope, getProject(), inspectionManager, toolWrapper);
InspectionTestUtil.runTool(toolWrapper, scope, globalContext);
InspectionTestUtil.compareToolResults(globalContext, toolWrapper, false, new File(getTestDataPath(), testDir).getPath());
}
@NotNull
public static GlobalInspectionContextImpl createGlobalContextForTool(@NotNull AnalysisScope scope,
public static GlobalInspectionContextForTests createGlobalContextForTool(@NotNull AnalysisScope scope,
@NotNull final Project project,
@NotNull InspectionManagerEx inspectionManager,
@NotNull final InspectionToolWrapper ... toolWrappers) {
final InspectionProfileImpl profile = InspectionProfileImpl.createSimple("test", project, toolWrappers);
GlobalInspectionContextImpl context = new GlobalInspectionContextImpl(project, inspectionManager.getContentManager()) {
GlobalInspectionContextForTests context = new GlobalInspectionContextForTests(project, inspectionManager.getContentManager()) {
@Override
protected List<Tools> getUsedTools() {
try {
@@ -488,21 +488,11 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
InspectionProfileImpl.INIT_INSPECTIONS = false;
}
}
@Override
protected void notifyInspectionsFinished() {
super.notifyInspectionsFinished();
putUserData(FINISHED, true);
}
};
context.setCurrentScope(scope);
return context;
}
private static final Key<Boolean> FINISHED = Key.create("Inspections finished");
public static boolean isInspectionsFinished(@NotNull GlobalInspectionContext context) {
return context.getUserData(FINISHED) == Boolean.TRUE;
}
@Override
@Nullable
@@ -0,0 +1,43 @@
/*
* Copyright 2000-2015 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.testFramework.fixtures.impl;
import com.intellij.codeInspection.ex.GlobalInspectionContextImpl;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NotNullLazyValue;
import com.intellij.ui.content.ContentManager;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public class GlobalInspectionContextForTests extends GlobalInspectionContextImpl {
private volatile boolean myFinished;
public GlobalInspectionContextForTests(@NotNull Project project, @NotNull NotNullLazyValue<ContentManager> contentManager) {
super(project, contentManager);
}
@Override
protected void notifyInspectionsFinished() {
super.notifyInspectionsFinished();
myFinished = true;
}
public boolean isFinished() {
return myFinished;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -102,13 +102,16 @@ public class ValueLookupManager extends EditorMouseAdapter implements EditorMous
}
private void requestHint(final QuickEvaluateHandler handler, final Editor editor, final Point point, @NotNull final ValueHintType type) {
final Rectangle area = editor.getScrollingModel().getVisibleArea();
myAlarm.cancelAllRequests();
if (type == ValueHintType.MOUSE_OVER_HINT) {
if (Registry.is("debugger.valueTooltipAutoShow")) {
myAlarm.addRequest(new Runnable() {
@Override
public void run() {
showHint(handler, editor, point, type);
if (area.equals(editor.getScrollingModel().getVisibleArea())) {
showHint(handler, editor, point, type);
}
}
}, handler.getValueLookupDelay(myProject));
}
@@ -38,8 +38,10 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer {
private int myLinkWidth;
public XDebuggerTreeRenderer() {
Insets ipad = myLink.getIpad();
myLink.setIpad(new JBInsets(ipad.top, 0, ipad.bottom, ipad.right));
Insets myLinkIpad = myLink.getIpad();
myLink.setIpad(new JBInsets(myLinkIpad.top, 0, myLinkIpad.bottom, myLinkIpad.right));
Insets myIpad = getIpad();
setIpad(new JBInsets(myLinkIpad.top, myIpad.left, myLinkIpad.bottom, 0));
}
public void customizeCellRenderer(@NotNull final JTree tree,
+1 -1
View File
@@ -50,7 +50,7 @@
</group>
<group id="GitRepositoryActions">
<action id="Git.Branches" class="git4idea.ui.branch.GitBranchesAction" text="_Branches..." icon="Git4ideaIcons.Branch"/>
<action id="Git.Branches" class="git4idea.ui.branch.GitBranchesAction" text="_Branches..." icon="VcsLogIcons.Branch"/>
<action id="Git.Tag" class="git4idea.actions.GitTag" text="Tag..."/>
<action id="Git.Merge" class="git4idea.actions.GitMerge" text="Merge Changes..." icon="AllIcons.Vcs.MergeSourcesTree"/>
<action id="Git.Stash" class="git4idea.actions.GitStash" text="Stash Changes..."/>
@@ -93,7 +93,7 @@ public class GitQuickListContentProvider implements VcsQuickListContentProvider
private static void add(String actionName, ActionManager manager, List<AnAction> actions) {
final AnAction action = manager.getAction(actionName);
assert action != null;
assert action != null : "Can not find action " + actionName;
actions.add(action);
}
}
@@ -153,6 +153,11 @@ public class AppEngineFacetEditor extends FacetEditorTab {
public void disposeUIResources() {
}
@Override
public String getHelpTopic() {
return "Google_App_Engine_Facet";
}
@Override
public void onFacetInitialized(@NotNull Facet facet) {
AppEngineWebIntegration.getInstance().setupDevServer(((AppEngineFacet)facet).getSdk());
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -34,7 +34,7 @@ import org.jetbrains.plugins.groovy.highlighter.DefaultHighlighter;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.psi.GrNamedElement;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotationNameValuePair;
@@ -51,11 +51,11 @@ import java.util.List;
* @author Max Medvedev
*/
public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPass implements DumbAware {
private final GroovyFile myFile;
private final GroovyFileBase myFile;
private List<HighlightInfo> toHighlight;
protected GrKeywordAndDeclarationHighlighter(GroovyFile file, Document document) {
public GrKeywordAndDeclarationHighlighter(GroovyFileBase file, Document document) {
super(file.getProject(), document);
myFile = file;
}
@@ -103,7 +103,9 @@ public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPa
return false; //It is allowed to name packages 'as', 'in' or 'def'
}
}
else if (token == GroovyTokenTypes.kDEF && element.getParent() instanceof GrAnnotationNameValuePair) return false;
else if (token == GroovyTokenTypes.kDEF && element.getParent() instanceof GrAnnotationNameValuePair) {
return false;
}
else if (parent instanceof GrReferenceExpression && element == ((GrReferenceExpression)parent).getReferenceNameElement()) {
if (token == GroovyTokenTypes.kSUPER && ((GrReferenceExpression)parent).getQualifier() == null) return true;
if (token == GroovyTokenTypes.kTHIS && ((GrReferenceExpression)parent).getQualifier() == null) return true;
@@ -117,7 +119,9 @@ public class GrKeywordAndDeclarationHighlighter extends TextEditorHighlightingPa
@Override
public void doApplyInformationToEditor() {
if (toHighlight == null || myDocument == null) return;
UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, 0, myFile.getTextLength(), toHighlight, getColorsScheme(), getId());
UpdateHighlightersUtil.setHighlightersToEditor(
myProject, myDocument, 0, myFile.getTextLength(), toHighlight, getColorsScheme(), getId()
);
}
@Nullable
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2015 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.
@@ -50,7 +50,7 @@ public class GrReferenceHighlighter extends TextEditorHighlightingPass {
@Override
public void doApplyInformationToEditor() {
if (myInfos == null) return;
if (myInfos == null || myDocument == null) return;
UpdateHighlightersUtil.setHighlightersToEditor(myProject, myDocument, 0, myFile.getTextLength(), myInfos, getColorsScheme(), getId());
}
}
@@ -142,7 +142,9 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile {
XmlTag entry = rootTag.createChildTag("entry", "", value, false);
entry.setAttribute("key", key);
rootTag.addSubTag(entry, false);
return new XmlProperty(entry, this);
final XmlProperty property = new XmlProperty(entry, this);
myPropertiesMap.getValue().putValue(key, property);
return property;
}
+1 -1
View File
@@ -79,7 +79,7 @@
implementationClass="com.intellij.codeInspection.TrailingSpacesInPropertyInspection"/>
<localInspection language="Properties" shortName="AlphaUnsortedPropertiesFile" bundle="messages.PropertiesBundle"
key="alpha.unsorted.properties.file.inspection.display.name" groupKey="properties.files.inspection.group.display.name"
enabledByDefault="true" level="INFO"
enabledByDefault="false" level="INFO"
implementationClass="com.intellij.codeInspection.unsorted.AlphaUnsortedPropertiesFileInspection"/>
<idIndexer filetype="Properties" implementationClass="com.intellij.psi.impl.cache.impl.idCache.PropertiesIdIndexer"/>
@@ -55,6 +55,32 @@ public class XmlPropertiesTest extends LightPlatformCodeInsightFixtureTestCase {
assertEquals("vvv", property.getValue());
}
public void testAddProperty2() {
final PsiFile psiFile = myFixture.configureByFile("foo.xml");
final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(psiFile);
assertNotNull(propertiesFile);
WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
public void run() {
propertiesFile.addProperty("kkk", "vvv");
}
});
final IProperty property = propertiesFile.findPropertyByKey("kkk");
assertNotNull(property);
assertEquals("vvv", property.getValue());
WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
public void run() {
propertiesFile.addProperty("kkk2", "vvv");
}
});
final IProperty property2 = propertiesFile.findPropertyByKey("kkk2");
assertNotNull(property2);
assertEquals("vvv", property2.getValue());
}
@Override
protected String getTestDataPath() {
return PluginPathManager.getPluginHomePath("properties") + "/testData/xml/";
@@ -245,4 +245,10 @@ public class MapExternalResourceDialog extends DialogWrapper {
}
};
}
@Nullable
@Override
protected String getHelpId() {
return "Map External Resource dialog";
}
}
@@ -37,7 +37,7 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
private boolean myAutomaticallyInsertRequiredAttributes = true;
private boolean myAutomaticallyInsertRequiredSubTags = true;
private boolean myAutoCloseTag = true;
private boolean mySyncTagEditing = false;
private boolean mySyncTagEditing = true;
private boolean myAutomaticallyStartAttribute = true;
private boolean myInsertQuotesForAttributeValue = true;
@@ -47,6 +47,7 @@ public class WebEditorOptions implements PersistentStateComponent<WebEditorOptio
public WebEditorOptions() {
setTagTreeHighlightingEnabled(!ApplicationManager.getApplication().isUnitTestMode());
setSyncTagEditing(!ApplicationManager.getApplication().isUnitTestMode());
}
public static WebEditorOptions getInstance() {