mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge commit 'origin/master'
This commit is contained in:
+1
-1
@@ -110,7 +110,7 @@ public class DebuggerDataViewsConfigurable implements SearchableConfigurable {
|
||||
ButtonGroup group = new ButtonGroup();
|
||||
group.add(myRbAllThatOverride);
|
||||
group.add(myRbFromList);
|
||||
myToStringFilterEditor = new ClassFilterEditor(myProject);
|
||||
myToStringFilterEditor = new ClassFilterEditor(myProject, null, "reference.viewBreakpoints.classFilters.newPattern");
|
||||
myCbEnableToString.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
final boolean enabled = myCbEnableToString.isSelected();
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class DebuggerSteppingConfigurable implements SearchableConfigurable, Con
|
||||
panel.add(myCbSkipSimpleGetters, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0),0, 0));
|
||||
panel.add(myCbStepInfoFiltersEnabled, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(8, 0, 0, 0),0, 0));
|
||||
|
||||
mySteppingFilterEditor = new ClassFilterEditor(myProject);
|
||||
mySteppingFilterEditor = new ClassFilterEditor(myProject, null, "reference.viewBreakpoints.classFilters.newPattern");
|
||||
panel.add(mySteppingFilterEditor, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 5, 0, 0),0, 0));
|
||||
|
||||
myCbStepInfoFiltersEnabled.addActionListener(new ActionListener() {
|
||||
|
||||
+8
-4
@@ -20,12 +20,12 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui.breakpoints;
|
||||
|
||||
import com.intellij.ide.util.ClassFilter;
|
||||
import com.intellij.ui.classFilter.ClassFilterEditor;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.ide.util.ClassFilter;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.ui.classFilter.ClassFilterEditor;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -54,13 +54,13 @@ public class EditClassFiltersDialog extends DialogWrapper {
|
||||
|
||||
Box mainPanel = Box.createHorizontalBox();
|
||||
|
||||
myClassFilterEditor = new ClassFilterEditor(myProject, myChooserFilter);
|
||||
myClassFilterEditor = new ClassFilterEditor(myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern");
|
||||
myClassFilterEditor.setPreferredSize(new Dimension(400, 200));
|
||||
myClassFilterEditor.setBorder(IdeBorderFactory.createTitledBorder(
|
||||
DebuggerBundle.message("class.filters.dialog.inclusion.filters.group"), false, false, true));
|
||||
mainPanel.add(myClassFilterEditor);
|
||||
|
||||
myClassExclusionFilterEditor = new ClassFilterEditor(myProject, myChooserFilter);
|
||||
myClassExclusionFilterEditor = new ClassFilterEditor(myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern");
|
||||
myClassExclusionFilterEditor.setPreferredSize(new Dimension(400, 200));
|
||||
myClassExclusionFilterEditor.setBorder(IdeBorderFactory.createTitledBorder(
|
||||
DebuggerBundle.message("class.filters.dialog.exclusion.filters.group"), false, false, true));
|
||||
@@ -92,4 +92,8 @@ public class EditClassFiltersDialog extends DialogWrapper {
|
||||
public com.intellij.ui.classFilter.ClassFilter[] getExclusionFilters() {
|
||||
return myClassExclusionFilterEditor.getFilters();
|
||||
}
|
||||
|
||||
protected String getHelpId() {
|
||||
return "reference.viewBreakpoints.classFilters";
|
||||
}
|
||||
}
|
||||
@@ -59,13 +59,20 @@ public class ClassFilterEditor extends JPanel implements ComponentWithEmptyText
|
||||
private final JButton myRemoveButton;
|
||||
protected final Project myProject;
|
||||
private final ClassFilter myChooserFilter;
|
||||
@Nullable
|
||||
private final String myPatternsHelpId;
|
||||
|
||||
public ClassFilterEditor(Project project) {
|
||||
this (project, null);
|
||||
}
|
||||
|
||||
public ClassFilterEditor(Project project, com.intellij.ide.util.ClassFilter classFilter) {
|
||||
public ClassFilterEditor(Project project, ClassFilter classFilter) {
|
||||
this (project, classFilter, null);
|
||||
}
|
||||
|
||||
public ClassFilterEditor(Project project, ClassFilter classFilter, @Nullable String patternsHelpId) {
|
||||
super(new GridBagLayout());
|
||||
myPatternsHelpId = patternsHelpId;
|
||||
myAddClassButton = new JButton(getAddButtonText());
|
||||
myAddPatternButton = new JButton(getAddPatternButtonText());
|
||||
myRemoveButton = new JButton(UIBundle.message("button.remove"));
|
||||
@@ -302,7 +309,7 @@ public class ClassFilterEditor extends JPanel implements ComponentWithEmptyText
|
||||
}
|
||||
|
||||
protected void addPatternFilter() {
|
||||
ClassFilterEditorAddDialog dialog = new ClassFilterEditorAddDialog(myProject);
|
||||
ClassFilterEditorAddDialog dialog = new ClassFilterEditorAddDialog(myProject, myPatternsHelpId);
|
||||
dialog.show();
|
||||
if (dialog.isOK()) {
|
||||
String pattern = dialog.getPattern();
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.ui.UIBundle;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -39,10 +40,13 @@ import java.awt.event.ActionListener;
|
||||
class ClassFilterEditorAddDialog extends DialogWrapper {
|
||||
private final Project myProject;
|
||||
private TextFieldWithBrowseButton myClassName;
|
||||
@Nullable
|
||||
private final String myHelpId;
|
||||
|
||||
public ClassFilterEditorAddDialog(Project project) {
|
||||
public ClassFilterEditorAddDialog(Project project, @Nullable String helpId) {
|
||||
super(project, true);
|
||||
myProject = project;
|
||||
myHelpId = helpId;
|
||||
setTitle(UIBundle.message("class.filter.editor.add.dialog.title"));
|
||||
init();
|
||||
}
|
||||
@@ -104,4 +108,9 @@ class ClassFilterEditorAddDialog extends DialogWrapper {
|
||||
protected String getDimensionServiceKey(){
|
||||
return "#com.intellij.debugger.ui.breakpoints.BreakpointsConfigurationDialogFactory.BreakpointsConfigurationDialog.AddFieldBreakpointDialog";
|
||||
}
|
||||
|
||||
@Override @Nullable
|
||||
protected String getHelpId() {
|
||||
return myHelpId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,8 +137,7 @@ public class GroovyBuilder extends Builder {
|
||||
|
||||
final StringBuffer unparsedBuffer = handler.getStdErr();
|
||||
if (unparsedBuffer.length() != 0) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, unparsedBuffer.toString()));
|
||||
hasMessages = true;
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.INFO, unparsedBuffer.toString()));
|
||||
}
|
||||
|
||||
final int exitValue = handler.getProcess().exitValue();
|
||||
|
||||
@@ -130,7 +130,7 @@ public class StopAction extends DumbAwareAction implements AnAction.TransparentU
|
||||
if (!processHandler.isProcessTerminating()) {
|
||||
enable = true;
|
||||
}
|
||||
else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillProcess()) {
|
||||
else if (processHandler instanceof KillableProcess && ((KillableProcess)processHandler).canKillSoftly()) {
|
||||
enable = true;
|
||||
icon = KILL_PROCESS_ICON;
|
||||
description = "Kill process";
|
||||
|
||||
+1
-1
@@ -551,7 +551,7 @@ public class FileReference implements FileReferenceOwner, PsiPolyVariantReferenc
|
||||
public String getUnresolvedMessagePattern() {
|
||||
return LangBundle.message("error.cannot.resolve")
|
||||
+ " " + (isLast() ? LangBundle.message("terms.file") : LangBundle.message("terms.directory"))
|
||||
+ " ''" + decode(getCanonicalText()) + "''";
|
||||
+ " ''" + StringUtil.escapePattern(decode(getCanonicalText())) + "''";
|
||||
}
|
||||
|
||||
public final boolean isLast() {
|
||||
|
||||
+24
-21
@@ -66,12 +66,12 @@ class ChangeTrackingValueContainer<Value> extends UpdatableValueContainer<Value>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllValues(int inputId) {
|
||||
public void removeAssociatedValue(int inputId) {
|
||||
if (myMerged != null) {
|
||||
myMerged.removeAllValues(inputId);
|
||||
myMerged.removeAssociatedValue(inputId);
|
||||
}
|
||||
myAdded.removeAllValues(inputId);
|
||||
myRemoved.removeAllValues(inputId);
|
||||
myAdded.removeAssociatedValue(inputId);
|
||||
myRemoved.removeAssociatedValue(inputId);
|
||||
myInvalidated.add(inputId);
|
||||
}
|
||||
|
||||
@@ -103,11 +103,6 @@ class ChangeTrackingValueContainer<Value> extends UpdatableValueContainer<Value>
|
||||
return getMergedData().toValueList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getInputIds(final Value value) {
|
||||
return getMergedData().getInputIds(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAssociated(final Value value, final int inputId) {
|
||||
return getMergedData().isAssociated(value, inputId);
|
||||
@@ -117,6 +112,11 @@ class ChangeTrackingValueContainer<Value> extends UpdatableValueContainer<Value>
|
||||
public IntIterator getInputIdsIterator(final Value value) {
|
||||
return getMergedData().getInputIdsIterator(value);
|
||||
}
|
||||
|
||||
public void dropMergedData() {
|
||||
myMerged = null;
|
||||
}
|
||||
|
||||
// need 'synchronized' to ensure atomic initialization of merged data
|
||||
// because several threads that acquired read lock may simultaneously execute the method
|
||||
private ValueContainer<Value> getMergedData() {
|
||||
@@ -133,29 +133,32 @@ class ChangeTrackingValueContainer<Value> extends UpdatableValueContainer<Value>
|
||||
|
||||
final ValueContainer<Value> fromDisk = myInitializer.compute();
|
||||
|
||||
final ContainerAction<Value> addAction = new ContainerAction<Value>() {
|
||||
fromDisk.forEach(new ContainerAction<Value>() {
|
||||
@Override
|
||||
public void perform(final int id, final Value value) {
|
||||
newMerged.addValue(id, value);
|
||||
}
|
||||
};
|
||||
final ContainerAction<Value> removeAction = new ContainerAction<Value>() {
|
||||
});
|
||||
myInvalidated.forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int inputId) {
|
||||
newMerged.removeAssociatedValue(inputId);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
myRemoved.forEach(new ContainerAction<Value>() {
|
||||
@Override
|
||||
public void perform(final int id, final Value value) {
|
||||
newMerged.removeValue(id, value);
|
||||
}
|
||||
};
|
||||
|
||||
fromDisk.forEach(addAction);
|
||||
myInvalidated.forEach(new TIntProcedure() {
|
||||
});
|
||||
myAdded.forEach(new ContainerAction<Value>() {
|
||||
@Override
|
||||
public boolean execute(int inputId) {
|
||||
newMerged.removeAllValues(inputId);
|
||||
return true;
|
||||
public void perform(final int id, final Value value) {
|
||||
newMerged.removeAssociatedValue(id); // enforcing "one-value-per-file for particular key" invariant
|
||||
newMerged.addValue(id, value);
|
||||
}
|
||||
});
|
||||
myRemoved.forEach(removeAction);
|
||||
myAdded.forEach(addAction);
|
||||
setNeedsCompacting(fromDisk.needsCompacting());
|
||||
|
||||
myMerged = newMerged;
|
||||
|
||||
@@ -248,7 +248,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu
|
||||
try {
|
||||
myMap.markDirty();
|
||||
// important: assuming the key exists in the index
|
||||
read(key).removeAllValues(inputId);
|
||||
read(key).removeAssociatedValue(inputId);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new StorageException(e);
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
* Date: Dec 10, 2007
|
||||
*/
|
||||
public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value> {
|
||||
private final Map<Key, UpdatableValueContainer<Value>> myMap = new HashMap<Key,UpdatableValueContainer<Value>>();
|
||||
private final Map<Key, ChangeTrackingValueContainer<Value>> myMap = new HashMap<Key,ChangeTrackingValueContainer<Value>>();
|
||||
private final IndexStorage<Key, Value> myBackendStorage;
|
||||
private final List<BufferingStateListener> myListeners = ContainerUtil.createEmptyCOWList();
|
||||
private final AtomicBoolean myBufferingEnabled = new AtomicBoolean(false);
|
||||
@@ -114,13 +114,17 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value>
|
||||
if (stopList.contains(key)) return true;
|
||||
|
||||
final UpdatableValueContainer<Value> container = myMap.get(key);
|
||||
if (container != null && container.size() == 0) return true;
|
||||
if (container != null && container.size() == 0) {
|
||||
return true;
|
||||
}
|
||||
return processor.process(key);
|
||||
}
|
||||
};
|
||||
|
||||
for (Key key : myMap.keySet()) {
|
||||
if (!decoratingProcessor.process(key)) return false;
|
||||
if (!decoratingProcessor.process(key)) {
|
||||
return false;
|
||||
}
|
||||
stopList.add(key);
|
||||
}
|
||||
return myBackendStorage.processKeys(decoratingProcessor);
|
||||
@@ -132,9 +136,9 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value>
|
||||
getMemValueContainer(key).addValue(inputId, value);
|
||||
return;
|
||||
}
|
||||
final UpdatableValueContainer<Value> valueContainer = myMap.get(key);
|
||||
final ChangeTrackingValueContainer<Value> valueContainer = myMap.get(key);
|
||||
if (valueContainer != null) {
|
||||
valueContainer.addValue(inputId, value);
|
||||
valueContainer.dropMergedData();
|
||||
}
|
||||
|
||||
myBackendStorage.addValue(key, inputId, value);
|
||||
@@ -146,9 +150,9 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value>
|
||||
getMemValueContainer(key).removeValue(inputId, value);
|
||||
return;
|
||||
}
|
||||
final UpdatableValueContainer<Value> valueContainer = myMap.get(key);
|
||||
final ChangeTrackingValueContainer<Value> valueContainer = myMap.get(key);
|
||||
if (valueContainer != null) {
|
||||
valueContainer.removeValue(inputId, value);
|
||||
valueContainer.dropMergedData();
|
||||
}
|
||||
myBackendStorage.removeValue(key, inputId, value);
|
||||
}
|
||||
@@ -156,19 +160,19 @@ public class MemoryIndexStorage<Key, Value> implements IndexStorage<Key, Value>
|
||||
@Override
|
||||
public void removeAllValues(Key key, int inputId) throws StorageException {
|
||||
if (myBufferingEnabled.get()) {
|
||||
getMemValueContainer(key).removeAllValues(inputId);
|
||||
getMemValueContainer(key).removeAssociatedValue(inputId);
|
||||
return;
|
||||
}
|
||||
final UpdatableValueContainer<Value> valueContainer = myMap.get(key);
|
||||
final ChangeTrackingValueContainer<Value> valueContainer = myMap.get(key);
|
||||
if (valueContainer != null) {
|
||||
valueContainer.removeAllValues(inputId);
|
||||
valueContainer.dropMergedData();
|
||||
}
|
||||
|
||||
myBackendStorage.removeAllValues(key, inputId);
|
||||
}
|
||||
|
||||
private UpdatableValueContainer<Value> getMemValueContainer(final Key key) {
|
||||
UpdatableValueContainer<Value> valueContainer = myMap.get(key);
|
||||
ChangeTrackingValueContainer<Value> valueContainer = myMap.get(key);
|
||||
if (valueContainer == null) {
|
||||
valueContainer = new ChangeTrackingValueContainer<Value>(new ChangeTrackingValueContainer.Initializer<Value>() {
|
||||
@Override
|
||||
|
||||
@@ -26,5 +26,5 @@ public abstract class UpdatableValueContainer<T> extends ValueContainer<T>{
|
||||
|
||||
public abstract boolean removeValue(int inputId, T value);
|
||||
|
||||
public abstract void removeAllValues(int inputId);
|
||||
public abstract void removeAssociatedValue(int inputId);
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ public abstract class ValueContainer<Value> {
|
||||
|
||||
public abstract Iterator<Value> getValueIterator();
|
||||
|
||||
public abstract int[] getInputIds(Value value);
|
||||
|
||||
public abstract List<Value> toValueList();
|
||||
|
||||
public abstract int size();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.util.indexing;
|
||||
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntIterator;
|
||||
|
||||
@@ -32,7 +31,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
|
||||
public ValueContainerImpl() {
|
||||
myInputIdMapping = new HashMap<Value, Object>(16, 0.98f);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addValue(int inputId, Value value) {
|
||||
final Object input = myInputIdMapping.get(value);
|
||||
@@ -60,16 +59,18 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllValues(int inputId) {
|
||||
final List<Value> toRemove= new ArrayList<Value>();
|
||||
public void removeAssociatedValue(int inputId) {
|
||||
Value toRemove = null;
|
||||
for (final Iterator<Value> valueIterator = getValueIterator(); valueIterator.hasNext();) {
|
||||
final Value value = valueIterator.next();
|
||||
if (isAssociated(value, inputId)) {
|
||||
toRemove.add(value);
|
||||
assert toRemove == null;
|
||||
toRemove = value;
|
||||
}
|
||||
}
|
||||
for (Value value : toRemove) {
|
||||
removeValue(inputId, value);
|
||||
|
||||
if (toRemove != null) {
|
||||
removeValue(inputId, toRemove);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,22 +112,6 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
|
||||
return new ArrayList<Value>(myInputIdMapping.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getInputIds(final Value value) {
|
||||
final Object input = myInputIdMapping.get(value);
|
||||
final int[] idSet;
|
||||
if (input instanceof TIntHashSet) {
|
||||
idSet = ((TIntHashSet)input).toArray();
|
||||
}
|
||||
else if (input instanceof Integer ){
|
||||
idSet = new int[] {((Integer)input).intValue()};
|
||||
}
|
||||
else {
|
||||
idSet = ArrayUtil.EMPTY_INT_ARRAY;
|
||||
}
|
||||
return idSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAssociated(final Value value, final int inputId) {
|
||||
final Object input = myInputIdMapping.get(value);
|
||||
@@ -237,7 +222,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
|
||||
return mySize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private HashMap<Value, Object> mapCopy(final HashMap<Value, Object> map) {
|
||||
if (map == null) {
|
||||
return null;
|
||||
|
||||
@@ -116,7 +116,7 @@ class ValueContainerMap<Key, Value> extends PersistentHashMap<Key, ValueContaine
|
||||
while (stream.available() > 0) {
|
||||
final int valueCount = DataInputOutputUtil.readSINT(in);
|
||||
if (valueCount < 0) {
|
||||
valueContainer.removeAllValues(-valueCount);
|
||||
valueContainer.removeAssociatedValue(-valueCount);
|
||||
valueContainer.setNeedsCompacting(true);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -19,7 +19,7 @@ package com.intellij.execution;
|
||||
* @author nik
|
||||
*/
|
||||
public interface KillableProcess {
|
||||
boolean canKillProcess();
|
||||
boolean canKillSoftly();
|
||||
|
||||
void killProcess();
|
||||
}
|
||||
|
||||
+2
-2
@@ -39,14 +39,14 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canKillProcess() {
|
||||
public boolean canKillSoftly() {
|
||||
// soft-kill works on Unix systems
|
||||
return SystemInfo.isUnix;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doDestroyProcess() {
|
||||
if (!canKillProcess()) {
|
||||
if (!canKillSoftly()) {
|
||||
// if soft kill isn't supported - use default implementation
|
||||
super.doDestroyProcess();
|
||||
return;
|
||||
|
||||
@@ -28,6 +28,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.ImageProducer;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -38,7 +41,9 @@ import java.util.List;
|
||||
public class AppUIUtil {
|
||||
private static final String VENDOR_PREFIX = "jetbrains-";
|
||||
|
||||
private AppUIUtil() { }
|
||||
private static boolean isDebugMode() {
|
||||
return "true".equals(System.getProperty("idea.debug.mode"));
|
||||
}
|
||||
|
||||
public static void updateFrameIcon(final Frame frame) {
|
||||
frame.setIconImages(getAppIconImages());
|
||||
@@ -86,7 +91,10 @@ public class AppUIUtil {
|
||||
|
||||
public static String getFrameClass() {
|
||||
final String name = ApplicationNamesInfo.getInstance().getProductName().toLowerCase();
|
||||
final String wmClass = VENDOR_PREFIX + StringUtil.replaceChar(name, ' ', '-');
|
||||
String wmClass = VENDOR_PREFIX + StringUtil.replaceChar(name, ' ', '-');
|
||||
if (isDebugMode()) {
|
||||
wmClass += "-debug";
|
||||
}
|
||||
return PlatformUtils.isCommunity() ? wmClass + "-ce" : wmClass;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,11 @@ public class StringUtil {
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
public static String escapePattern(final @NotNull String text) {
|
||||
return text.replace("'", "''").replace("{", "'{'");
|
||||
}
|
||||
|
||||
public static <T> Function<T, String> createToStringFunction(Class<T> cls) {
|
||||
return new Function<T, String>() {
|
||||
@Override
|
||||
|
||||
@@ -234,8 +234,7 @@ public abstract class GroovyCompilerBase implements TranslatingCompiler {
|
||||
|
||||
StringBuffer unparsedBuffer = processHandler.getStdErr();
|
||||
if (unparsedBuffer.length() != 0) {
|
||||
compileContext.addMessage(CompilerMessageCategory.ERROR, unparsedBuffer.toString(), null, -1, -1);
|
||||
hasMessages = true;
|
||||
compileContext.addMessage(CompilerMessageCategory.INFORMATION, unparsedBuffer.toString(), null, -1, -1);
|
||||
}
|
||||
|
||||
final int exitCode = processHandler.getProcess().exitValue();
|
||||
|
||||
@@ -630,11 +630,10 @@ public abstract class MvcFramework {
|
||||
|
||||
final Project project = module.getProject();
|
||||
|
||||
final ModificationTracker tracker = MvcModuleStructureSynchronizer.getInstance(project).getFileAndRootsModificationTracker();
|
||||
|
||||
return CachedValuesManager.getManager(project).getCachedValue(module, new CachedValueProvider<MvcFramework>() {
|
||||
@Override
|
||||
public Result<MvcFramework> compute() {
|
||||
final ModificationTracker tracker = MvcModuleStructureSynchronizer.getInstance(project).getFileAndRootsModificationTracker();
|
||||
for (final MvcFramework framework : EP_NAME.getExtensions()) {
|
||||
if (framework.hasSupport(module)) {
|
||||
return Result.create(framework, tracker);
|
||||
|
||||
+35
-9
@@ -23,7 +23,6 @@ import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.lang.properties.PropertiesLanguage;
|
||||
import com.intellij.lang.properties.ResourceBundle;
|
||||
import com.intellij.lang.properties.ResourceBundleImpl;
|
||||
import com.intellij.lang.properties.charset.Native2AsciiCharset;
|
||||
import com.intellij.lang.properties.editor.ResourceBundleAsVirtualFile;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
@@ -42,8 +41,8 @@ import gnu.trove.TIntLongHashMap;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -132,12 +131,9 @@ public class PropertiesSeparatorManager implements PersistentStateComponent<Elem
|
||||
for (Element fileElement : files) {
|
||||
String url = fileElement.getAttributeValue(URL_ELEMENT, "");
|
||||
String separator = fileElement.getAttributeValue(SEPARATOR_ATTR,"");
|
||||
try {
|
||||
@NonNls String baseCharset = "ISO-8859-1";
|
||||
separator = new String(separator.getBytes(baseCharset), Native2AsciiCharset.makeNative2AsciiEncodingName(baseCharset));
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
//can't be
|
||||
separator = decodeSeparator(separator);
|
||||
if (separator == null) {
|
||||
continue;
|
||||
}
|
||||
VirtualFile file;
|
||||
ResourceBundle resourceBundle = ResourceBundleImpl.createByUrl(url);
|
||||
@@ -153,6 +149,36 @@ public class PropertiesSeparatorManager implements PersistentStateComponent<Elem
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String decodeSeparator(String separator) {
|
||||
if (separator.length() % 6 != 0) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
int pos = 0;
|
||||
while (pos < separator.length()) {
|
||||
String encodedCharacter = separator.substring(pos, pos+6);
|
||||
if (!encodedCharacter.startsWith("\\u")) {
|
||||
return null;
|
||||
}
|
||||
int d1 = Character.digit(encodedCharacter.charAt(2), 16);
|
||||
int d2 = Character.digit(encodedCharacter.charAt(3), 16);
|
||||
int d3 = Character.digit(encodedCharacter.charAt(4), 16);
|
||||
int d4 = Character.digit(encodedCharacter.charAt(5), 16);
|
||||
if (d1 == -1 || d2 == -1 || d3 == -1 || d4 == -1) {
|
||||
return null;
|
||||
}
|
||||
int b1 = (d1 << 12) & 0xF000;
|
||||
int b2 = (d2 << 8) & 0x0F00;
|
||||
int b3 = (d3 << 4) & 0x00F0;
|
||||
int b4 = (d4 << 0) & 0x000F;
|
||||
char code = (char) (b1 | b2 | b3 | b4);
|
||||
result.append(code);
|
||||
pos += 6;
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public Element getState() {
|
||||
Element element = new Element("PropertiesSeparatorManager");
|
||||
for (VirtualFile file : mySeparators.keySet()) {
|
||||
@@ -165,7 +191,7 @@ public class PropertiesSeparatorManager implements PersistentStateComponent<Elem
|
||||
url = file.getUrl();
|
||||
}
|
||||
String separator = mySeparators.get(file);
|
||||
StringBuffer encoded = new StringBuffer(separator.length());
|
||||
StringBuilder encoded = new StringBuilder(separator.length());
|
||||
for (int i=0;i<separator.length();i++) {
|
||||
char c = separator.charAt(i);
|
||||
encoded.append("\\u");
|
||||
|
||||
@@ -650,7 +650,7 @@ public class XmlHighlightVisitor extends XmlElementVisitor implements HighlightV
|
||||
catch (IllegalArgumentException ex) {
|
||||
// unresolvedMessage provided by third-party reference contains wrong format string (e.g. {}), tolerate it
|
||||
description = message;
|
||||
LOG.warn(XmlErrorMessages.message("plugin.reference.message.problem", reference.getClass().getName(), message));
|
||||
LOG.error(XmlErrorMessages.message("plugin.reference.message.problem", reference.getClass().getName(), message));
|
||||
}
|
||||
return description;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user