mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+14
-2
@@ -9,6 +9,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.indexing.*;
|
||||
import com.intellij.util.io.DataExternalizer;
|
||||
import com.intellij.util.io.IOUtil;
|
||||
import com.intellij.util.io.KeyDescriptor;
|
||||
import com.intellij.util.io.PersistentHashMap;
|
||||
import org.jetbrains.asm4.ClassReader;
|
||||
@@ -49,15 +50,26 @@ public abstract class CompilerOutputBaseIndex<K, V> {
|
||||
rewriteIndex.set(true);
|
||||
}
|
||||
final File storageFile = getStorageFile(indexId);
|
||||
final MapIndexStorage<K, V> indexStorage = new MapIndexStorage<K, V>(storageFile, myKeyDescriptor, myValueExternalizer, 1024);
|
||||
MapIndexStorage<K, V> indexStorage = null;
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
try {
|
||||
indexStorage = new MapIndexStorage<K, V>(storageFile, myKeyDescriptor, myValueExternalizer, 1024);
|
||||
} catch (IOException ex) {
|
||||
if (i == 1) throw ex;
|
||||
IOUtil.deleteAllFilesStartingWith(storageFile);
|
||||
}
|
||||
}
|
||||
|
||||
assert indexStorage != null;
|
||||
index = new MapReduceIndex<K, V, ClassReader>(indexId, getIndexer(), indexStorage);
|
||||
final MapIndexStorage<K, V> finalIndexStorage = indexStorage;
|
||||
index.setInputIdToDataKeysIndex(new Factory<PersistentHashMap<Integer, Collection<K>>>() {
|
||||
@Override
|
||||
public PersistentHashMap<Integer, Collection<K>> create() {
|
||||
Exception failCause = null;
|
||||
for (int attempts = 0; attempts < 2; attempts++) {
|
||||
try {
|
||||
return FileBasedIndexImpl.createIdToDataKeysIndex(indexId, myKeyDescriptor, new MemoryIndexStorage<K, V>(indexStorage));
|
||||
return FileBasedIndexImpl.createIdToDataKeysIndex(indexId, myKeyDescriptor, new MemoryIndexStorage<K, V>(finalIndexStorage));
|
||||
}
|
||||
catch (IOException e) {
|
||||
failCause = e;
|
||||
|
||||
+5
-1
@@ -17,6 +17,7 @@ package com.intellij.refactoring.extractInterface;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.refactoring.HelpID;
|
||||
import com.intellij.refactoring.JavaRefactoringSettings;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
@@ -37,6 +38,9 @@ class ExtractInterfaceDialog extends JavaExtractSuperBaseDialog {
|
||||
|
||||
public ExtractInterfaceDialog(Project project, PsiClass sourceClass) {
|
||||
super(project, sourceClass, collectMembers(sourceClass), ExtractInterfaceHandler.REFACTORING_NAME);
|
||||
for (MemberInfo memberInfo : myMemberInfos) {
|
||||
memberInfo.setToAbstract(true);
|
||||
}
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -85,7 +89,7 @@ class ExtractInterfaceDialog extends JavaExtractSuperBaseDialog {
|
||||
protected JComponent createCenterPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
final MemberSelectionPanel memberSelectionPanel = new MemberSelectionPanel(RefactoringBundle.message("members.to.form.interface"),
|
||||
myMemberInfos, null);
|
||||
myMemberInfos, RefactoringBundle.message("make.abstract"));
|
||||
memberSelectionPanel.getTable()
|
||||
.setMemberInfoModel(new DelegatingMemberInfoModel<PsiMember, MemberInfo>(memberSelectionPanel.getTable().getMemberInfoModel()) {
|
||||
public Boolean isFixedAbstract(MemberInfo member) {
|
||||
|
||||
+3
-1
@@ -64,7 +64,9 @@ public class MethodTextOccurrenceProcessor extends RequestResultProcessor {
|
||||
return consumer.process(ref);
|
||||
}
|
||||
|
||||
return processInexactReference(ref, ref.resolve(), method, consumer);
|
||||
if (!processInexactReference(ref, ref.resolve(), method, consumer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+1
@@ -1,2 +1,3 @@
|
||||
public class A {
|
||||
|
||||
}
|
||||
|
||||
@@ -92,11 +92,7 @@ public class JavaModuleBuilder extends ModuleBuilder implements SourcePathsBuild
|
||||
|
||||
@Override
|
||||
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ModulesProvider modulesProvider, boolean forNewWizard) {
|
||||
if (forNewWizard) return ModuleWizardStep.EMPTY_ARRAY;
|
||||
ModuleType moduleType = getModuleType();
|
||||
return moduleType == null
|
||||
? ModuleWizardStep.EMPTY_ARRAY
|
||||
: moduleType.createWizardSteps(wizardContext, this, modulesProvider, false);
|
||||
return getModuleType().createWizardSteps(wizardContext, this, modulesProvider, forNewWizard);
|
||||
}
|
||||
|
||||
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
|
||||
|
||||
@@ -27,6 +27,7 @@ jsr166e.jar
|
||||
jsr173_1.0_api.jar
|
||||
junit-4.10.jar
|
||||
junit.jar
|
||||
jzlib-1.1.1.jar
|
||||
log4j.jar
|
||||
markdownj-core-0.4.2-SNAPSHOT.jar
|
||||
microba.jar
|
||||
|
||||
@@ -130,9 +130,12 @@ public class InspectionEP extends LanguageExtensionPoint implements InspectionPr
|
||||
public boolean hasStaticDescription;
|
||||
|
||||
@Nullable
|
||||
private String getLocalizedString(String bundleName, @NotNull String key) {
|
||||
private String getLocalizedString(String bundleName, String key) {
|
||||
final String baseName = bundleName != null ? bundleName : bundle == null ? ((IdeaPluginDescriptor)myPluginDescriptor).getResourceBundleBaseName() : bundle;
|
||||
if (baseName == null) {
|
||||
if (baseName == null || key == null) {
|
||||
if (bundleName != null) {
|
||||
LOG.warn(implementationClass);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
final ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(baseName, myPluginDescriptor.getPluginClassLoader());
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.options.ex.IdeConfigurablesGroup;
|
||||
import com.intellij.openapi.options.ex.ProjectConfigurablesGroup;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.DumbServiceImpl;
|
||||
@@ -80,6 +79,7 @@ import com.intellij.util.Consumer;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.indexing.FindSymbolParameters;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
import com.intellij.util.ui.StatusText;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -107,9 +107,11 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
private GotoClassModel2 myClassModel;
|
||||
private GotoFileModel myFileModel;
|
||||
private GotoActionModel myActionModel;
|
||||
private GotoSymbolModel2 mySymbolsModel;
|
||||
private String[] myClasses;
|
||||
private String[] myFiles;
|
||||
private String[] myActions;
|
||||
private String[] mySymbols;
|
||||
private Component myFocusComponent;
|
||||
private JBPopup myPopup;
|
||||
private SearchListModel myListModel = new SearchListModel();
|
||||
@@ -147,7 +149,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
return false;
|
||||
}
|
||||
ourOtherKeyWasPressed.set(false);
|
||||
if (System.currentTimeMillis() - ourLastTimePressed.get() > 400) {
|
||||
if (System.currentTimeMillis() - ourLastTimePressed.get() > 300) {
|
||||
ourPressed.set(false);
|
||||
ourReleased.set(false);
|
||||
}
|
||||
@@ -806,66 +808,74 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//noinspection SSBasedInspection
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myTitleIndexes.clear();
|
||||
clearModel();
|
||||
myAlreadyAddedFiles.clear();
|
||||
try {
|
||||
myList.getEmptyText().setText("Searching...");
|
||||
//noinspection SSBasedInspection
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myTitleIndexes.clear();
|
||||
clearModel();
|
||||
myAlreadyAddedFiles.clear();
|
||||
}
|
||||
});
|
||||
if (pattern.trim().length() == 0) {
|
||||
buildModelFromRecentFiles();
|
||||
updatePopup();
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (pattern.trim().length() == 0) {
|
||||
buildModelFromRecentFiles();
|
||||
updatePopup();
|
||||
return;
|
||||
}
|
||||
|
||||
checkModelsUpToDate();
|
||||
buildTopHit(pattern);
|
||||
buildRecentFiles(pattern);
|
||||
updatePopup();
|
||||
AccessToken readLock = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
if (!DumbServiceImpl.getInstance(project).isDumb()) {
|
||||
checkModelsUpToDate();
|
||||
buildTopHit(pattern);
|
||||
buildRecentFiles(pattern);
|
||||
updatePopup();
|
||||
buildToolWindows(pattern);
|
||||
updatePopup();
|
||||
|
||||
AccessToken readLock = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
if (!DumbServiceImpl.getInstance(project).isDumb()) {
|
||||
try {
|
||||
buildClasses(pattern, false);
|
||||
} finally {readLock.finish();}
|
||||
updatePopup();
|
||||
}
|
||||
|
||||
readLock = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
buildClasses(pattern, false);
|
||||
buildFiles(pattern);
|
||||
} finally {readLock.finish();}
|
||||
|
||||
buildActionsAndSettings(pattern);
|
||||
updatePopup();
|
||||
|
||||
readLock = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
buildSymbols(pattern);
|
||||
} finally {readLock.finish();}
|
||||
updatePopup();
|
||||
}
|
||||
|
||||
readLock = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
try {
|
||||
buildFiles(pattern);
|
||||
} finally {readLock.finish();}
|
||||
|
||||
buildActionsAndSettings(pattern);
|
||||
updatePopup();
|
||||
catch (Exception ignore) {
|
||||
}
|
||||
finally {
|
||||
myList.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
private void buildActionsAndSettings(String pattern) {
|
||||
final Set<AnAction> actions = new HashSet<AnAction>();
|
||||
final Set<Object> settings = new HashSet<Object>();
|
||||
private void buildToolWindows(String pattern) {
|
||||
if (myActions == null) {
|
||||
myActions = myActionModel.getNames(true);
|
||||
}
|
||||
final HashSet<AnAction> toolWindows = new HashSet<AnAction>();
|
||||
final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE);
|
||||
|
||||
List<MatchResult> matches = collectResults(pattern, myActions, myActionModel);
|
||||
|
||||
for (MatchResult o : matches) {
|
||||
myProgressIndicator.checkCanceled();
|
||||
Object[] objects = myActionModel.getElementsByName(o.elementName, true, pattern);
|
||||
for (Object object : objects) {
|
||||
myProgressIndicator.checkCanceled();
|
||||
if (isSetting(object) && settings.size() < 7) {
|
||||
if (matcher.matches(getSettingText((OptionDescription)object))) {
|
||||
settings.add(object);
|
||||
}
|
||||
}
|
||||
else if (isToolWindowAction(object) && toolWindows.size() < 10) {
|
||||
if (isToolWindowAction(object) && toolWindows.size() < 10) {
|
||||
toolWindows.add((AnAction)((Map.Entry)object).getKey());
|
||||
}
|
||||
else if (isActionValue(object) && actions.size() < 7) {
|
||||
actions.add((AnAction)((Map.Entry)object).getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -881,6 +891,42 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
myListModel.addElement(toolWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildActionsAndSettings(String pattern) {
|
||||
final Set<AnAction> actions = new HashSet<AnAction>();
|
||||
final Set<Object> settings = new HashSet<Object>();
|
||||
final MinusculeMatcher matcher = new MinusculeMatcher("*" +pattern, NameUtil.MatchingCaseSensitivity.NONE);
|
||||
if (myActions == null) {
|
||||
myActions = myActionModel.getNames(true);
|
||||
}
|
||||
|
||||
List<MatchResult> matches = collectResults(pattern, myActions, myActionModel);
|
||||
|
||||
for (MatchResult o : matches) {
|
||||
myProgressIndicator.checkCanceled();
|
||||
Object[] objects = myActionModel.getElementsByName(o.elementName, true, pattern);
|
||||
for (Object object : objects) {
|
||||
myProgressIndicator.checkCanceled();
|
||||
if (isSetting(object) && settings.size() < 7) {
|
||||
if (matcher.matches(getSettingText((OptionDescription)object))) {
|
||||
settings.add(object);
|
||||
}
|
||||
}
|
||||
else if (!isToolWindowAction(object) && isActionValue(object) && actions.size() < 7) {
|
||||
actions.add((AnAction)((Map.Entry)object).getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myProgressIndicator.checkCanceled();
|
||||
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myProgressIndicator.isCanceled()) return;
|
||||
if (actions.size() > 0) {
|
||||
myTitleIndexes.actions = myListModel.size();
|
||||
for (Object action : actions) {
|
||||
@@ -901,6 +947,9 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
|
||||
private void buildFiles(String pattern) {
|
||||
int filesCounter = 0;
|
||||
if (myFiles == null) {
|
||||
myFiles = myFileModel.getNames(false);
|
||||
}
|
||||
List<MatchResult> matches = collectResults(pattern, myFiles, myFileModel);
|
||||
final List<VirtualFile> files = new ArrayList<VirtualFile>();
|
||||
FindSymbolParameters parameters = FindSymbolParameters.wrap(pattern, project, false);
|
||||
@@ -944,9 +993,52 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
}
|
||||
|
||||
private void buildSymbols(String pattern) {
|
||||
int symbolCounter = 0;
|
||||
if (mySymbols == null) {
|
||||
mySymbols = mySymbolsModel.getNames(false);
|
||||
}
|
||||
List<MatchResult> matches = collectResults(pattern, mySymbols, mySymbolsModel);
|
||||
final List<Object> symbols = new ArrayList<Object>();
|
||||
|
||||
final int maxFiles = 8;
|
||||
for (MatchResult o : matches) {
|
||||
if (symbolCounter > maxFiles) break;
|
||||
|
||||
Object[] objects = mySymbolsModel.getElementsByName(o.elementName, false, pattern);
|
||||
for (Object object : objects) {
|
||||
if (!myListModel.contains(object)) {
|
||||
symbols.add(object);
|
||||
symbolCounter++;
|
||||
if (symbolCounter > maxFiles) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myProgressIndicator.checkCanceled();
|
||||
|
||||
if (symbols.size() > 0) {
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!myProgressIndicator.isCanceled()) {
|
||||
myTitleIndexes.symbols = myListModel.size();
|
||||
for (Object file : symbols) {
|
||||
myListModel.addElement(file);
|
||||
}
|
||||
myMoreFilesIndex = symbols.size() >= maxFiles ? myListModel.size() - 1 : -1;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void buildClasses(String pattern, boolean includeLibraries) {
|
||||
int clsCounter = 0;
|
||||
final int maxCount = includeLibraries ? 5 : 8;
|
||||
if (myClasses == null) {
|
||||
myClasses = myClassModel.getNames(false);
|
||||
}
|
||||
List<MatchResult> matches = collectResults(pattern, includeLibraries ? myClassModel.getNames(true) : myClasses, myClassModel);
|
||||
FindSymbolParameters parameters = FindSymbolParameters.wrap(pattern, project, includeLibraries);
|
||||
final List<Object> classes = new ArrayList<Object>();
|
||||
@@ -999,7 +1091,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
|
||||
private void buildRecentFiles(String pattern) {
|
||||
final MinusculeMatcher matcher = new MinusculeMatcher(pattern, NameUtil.MatchingCaseSensitivity.NONE);
|
||||
final MinusculeMatcher matcher = new MinusculeMatcher("*" + pattern, NameUtil.MatchingCaseSensitivity.NONE);
|
||||
final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
|
||||
for (VirtualFile file : ArrayUtil.reverseArray(EditorHistoryManager.getInstance(project).getFiles())) {
|
||||
if (StringUtil.isEmptyOrSpaces(pattern) || matcher.matches(file.getName())) {
|
||||
@@ -1062,9 +1154,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
myClassModel = new GotoClassModel2(project);
|
||||
myFileModel = new GotoFileModel(project);
|
||||
myActionModel = createActionModel();
|
||||
myClasses = myClassModel.getNames(false);
|
||||
myFiles = myFileModel.getNames(false);
|
||||
myActions = myActionModel.getNames(true);
|
||||
mySymbolsModel = new GotoSymbolModel2(project);
|
||||
myConfigurables.clear();
|
||||
fillConfigurablesIds(null, new IdeConfigurablesGroup().getConfigurables());
|
||||
fillConfigurablesIds(null, new ProjectConfigurablesGroup(project).getConfigurables());
|
||||
@@ -1163,10 +1253,6 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
|
||||
myRenderer.recalculateWidth();
|
||||
if (myPopup == null || !myPopup.isVisible()) {
|
||||
//final Font editorFont = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
|
||||
//myList.setFont(editorFont);
|
||||
//getField().getTextEditor().setFont(editorFont);
|
||||
//More.instance.label.setFont(editorFont);
|
||||
final ActionCallback callback = ListDelegationUtil.installKeyboardDelegation(getField().getTextEditor(), myList);
|
||||
final ComponentPopupBuilder builder = JBPopupFactory.getInstance()
|
||||
.createComponentPopupBuilder(new JBScrollPane(myList), null);
|
||||
@@ -1250,7 +1336,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
MatchResult result;
|
||||
|
||||
for (String name : names) {
|
||||
//myProgressIndicator.checkCanceled();
|
||||
myProgressIndicator.checkCanceled();
|
||||
result = null;
|
||||
if (model instanceof CustomMatcherModel) {
|
||||
try {
|
||||
@@ -1285,9 +1371,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
}
|
||||
|
||||
public void start() {
|
||||
if (!myProgressIndicator.isCanceled()) {
|
||||
ProgressManager.getInstance().runProcess(this, myProgressIndicator);
|
||||
}
|
||||
ApplicationManager.getApplication().executeOnPooledThread(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,12 +1441,14 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
int actions;
|
||||
int settings;
|
||||
int toolWindows;
|
||||
int symbols;
|
||||
|
||||
final String gotoClassTitle;
|
||||
final String gotoFileTitle;
|
||||
final String gotoActionTitle;
|
||||
final String gotoSettingsTitle;
|
||||
final String gotoRecentFilesTitle;
|
||||
final String gotoSymbolTitle;
|
||||
static final String toolWindowsTitle = "Tool Windows";
|
||||
|
||||
TitleIndexes() {
|
||||
@@ -1376,6 +1462,8 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
gotoSettingsTitle = StringUtil.isEmpty(gotoAction) ? "Preferences" : "Preferences (" + gotoSettings + ")";
|
||||
String gotoRecentFiles = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction("RecentFiles"));
|
||||
gotoRecentFilesTitle = StringUtil.isEmpty(gotoRecentFiles) ? "Recent Files" : "Recent Files (" + gotoRecentFiles + ")";
|
||||
String gotoSymbol = KeymapUtil.getFirstKeyboardShortcutText(ActionManager.getInstance().getAction("GotoSymbol"));
|
||||
gotoSymbolTitle = StringUtil.isEmpty(gotoClass) ? "Symbols" : "Symbols (" + gotoSymbol + ")";
|
||||
}
|
||||
|
||||
String getTitle(int index) {
|
||||
@@ -1386,6 +1474,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
if (index == toolWindows) return toolWindowsTitle;
|
||||
if (index == actions) return gotoActionTitle;
|
||||
if (index == settings) return gotoSettingsTitle;
|
||||
if (index == symbols) return gotoSymbolTitle;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1449,7 +1538,7 @@ public class SearchEverywhereAction extends AnAction implements CustomComponentA
|
||||
titleLabel.setForeground(UIUtil.getLabelDisabledForeground());
|
||||
final Color bg = UIUtil.getListBackground();
|
||||
SeparatorComponent separatorComponent =
|
||||
new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._240, Gray._80), null);
|
||||
new SeparatorComponent(titleLabel.getPreferredSize().height / 2, new JBColor(Gray._220, Gray._80), null);
|
||||
|
||||
JPanel result = new JPanel(new BorderLayout(5, 10));
|
||||
result.add(titleLabel, BorderLayout.WEST);
|
||||
|
||||
@@ -40,7 +40,7 @@ public class AnalyzeStacktraceDialog extends DialogWrapper {
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.add(new JLabel("Put a thread dump here:"), BorderLayout.NORTH);
|
||||
panel.add(new JLabel("Put a stacktrace here:"), BorderLayout.NORTH);
|
||||
myEditorPanel = AnalyzeStacktraceUtil.createEditorPanel(myProject, myDisposable);
|
||||
myEditorPanel.pasteTextFromClipboard();
|
||||
panel.add(myEditorPanel, BorderLayout.CENTER);
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.util.Consumer;
|
||||
@@ -236,6 +237,9 @@ public class QueueProcessor<T> {
|
||||
try {
|
||||
run.run();
|
||||
}
|
||||
catch (ProcessCanceledException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
try {
|
||||
LOG.error(e);
|
||||
|
||||
@@ -153,7 +153,7 @@ public class ActionInstallPlugin extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
if (needToRestart) {
|
||||
PluginManagerMain.notifyPluginsWereInstalled(list.size() == 1 ? list.get(0).getName() : null);
|
||||
PluginManagerMain.notifyPluginsWereInstalled(list.size() == 1 ? list.get(0).getName() : null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.updateSettings.impl.PluginDownloader;
|
||||
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
|
||||
@@ -520,13 +521,13 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
}
|
||||
|
||||
|
||||
public static void notifyPluginsWereInstalled(@Nullable String pluginName) {
|
||||
public static void notifyPluginsWereInstalled(@Nullable String pluginName, final Project project) {
|
||||
notifyPluginsWereUpdated(pluginName != null
|
||||
? "Plugin \'" + pluginName + "\' was successfully installed"
|
||||
: "Plugins were installed");
|
||||
: "Plugins were installed", project);
|
||||
}
|
||||
|
||||
public static void notifyPluginsWereUpdated(final String title) {
|
||||
public static void notifyPluginsWereUpdated(final String title, final Project project) {
|
||||
final ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
||||
final boolean restartCapable = app.isRestartCapable();
|
||||
String message =
|
||||
@@ -550,7 +551,7 @@ public abstract class PluginManagerMain implements Disposable {
|
||||
app.exit(true);
|
||||
}
|
||||
}
|
||||
}).notify(null);
|
||||
}).notify(project);
|
||||
}
|
||||
|
||||
protected class SortByStatusAction extends ToggleAction {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# suppress inspection "UnusedProperty" for whole file
|
||||
intellijlaf.background=e8e8e8
|
||||
intellijlaf.selectionBackground=4696ff
|
||||
intellijlaf.selectionBackground=3875D6
|
||||
intellijlaf.textBackground=cccccc
|
||||
intellijlaf.foreground=000000
|
||||
intellijlaf.textForeground=000000
|
||||
@@ -30,6 +30,8 @@ control=cccccc
|
||||
link.foreground=589df6
|
||||
ScrollBarUI=com.intellij.ide.ui.laf.darcula.ui.DarculaScrollBarUI
|
||||
|
||||
Label.disabledForeground=777777
|
||||
|
||||
TableHeaderUI=com.intellij.ide.ui.laf.darcula.DarculaTableHeaderUI
|
||||
Table.gridColor=2c2c2c
|
||||
Table.ascendingSortIcon=AllIcons.General.SplitUp
|
||||
@@ -67,7 +69,7 @@ TextField.darcula.search.icon=/com/intellij/ide/ui/laf/icons/search.png
|
||||
TextField.darcula.searchWithHistory.icon=/com/intellij/ide/ui/laf/icons/searchWithHistory.png
|
||||
TextField.darcula.clear.icon=/com/intellij/ide/ui/laf/icons/clear.png
|
||||
|
||||
TextArea.selectionForeground=bbbbbb
|
||||
TextArea.selectionForeground=ffffff
|
||||
TextArea.background=ffffff
|
||||
|
||||
Panel.background=e8e8e8
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class PluginAdvertiserEditorNotificationProvider extends EditorNotificati
|
||||
myEnabledExtensions.add(extension);
|
||||
PluginManagerCore.enablePlugin(disabledPlugin.getPluginId().getIdString());
|
||||
myNotifications.updateAllNotifications();
|
||||
PluginManagerMain.notifyPluginsWereUpdated("Plugin was successfully enabled");
|
||||
PluginManagerMain.notifyPluginsWereUpdated("Plugin was successfully enabled", myProject);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
+12
-8
@@ -20,6 +20,7 @@ import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManager;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.ide.plugins.RepositoryHelper;
|
||||
import com.intellij.notification.*;
|
||||
@@ -177,21 +178,24 @@ public class PluginsAdvertiser implements StartupActivity {
|
||||
indicator.setText("Searching for plugin supporting \'" + feature.getImplementationName() + "\'");
|
||||
final List<PluginId> pluginId = retrieve(feature);
|
||||
if (pluginId != null) {
|
||||
//do not suggest to download disabled plugins
|
||||
final List<String> disabledPlugins = PluginManagerCore.getDisabledPlugins();
|
||||
for (PluginId id : pluginId) {
|
||||
if (!disabledPlugins.contains(id.getIdString())) {
|
||||
ids.add(id);
|
||||
}
|
||||
}
|
||||
ids.addAll(pluginId);
|
||||
}
|
||||
indicator.setFraction(((double) idx++) / unknownFeatures.size());
|
||||
}
|
||||
|
||||
try {
|
||||
final List<String> disabledPlugins = PluginManagerCore.getDisabledPlugins();
|
||||
//include disabled plugins
|
||||
for (PluginId id : ids) {
|
||||
final IdeaPluginDescriptor plugin = PluginManager.getPlugin(id);
|
||||
if (plugin != null) {
|
||||
myPlugins.add(PluginDownloader.createDownloader(plugin));
|
||||
}
|
||||
}
|
||||
myAllPlugins = RepositoryHelper.loadPluginsFromRepository(indicator);
|
||||
for (IdeaPluginDescriptor loadedPlugin : myAllPlugins) {
|
||||
if (ids.contains(loadedPlugin.getPluginId())) {
|
||||
final PluginId pluginId = loadedPlugin.getPluginId();
|
||||
if (ids.contains(pluginId) && !disabledPlugins.contains(pluginId.getIdString())) {
|
||||
myPlugins.add(PluginDownloader.createDownloader(loadedPlugin));
|
||||
}
|
||||
}
|
||||
|
||||
+27
-13
@@ -15,10 +15,9 @@
|
||||
*/
|
||||
package com.intellij.openapi.updateSettings.impl.pluginsAdvertisement;
|
||||
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.ide.plugins.PluginManagerMain;
|
||||
import com.intellij.ide.plugins.PluginNode;
|
||||
import com.intellij.ide.plugins.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.PluginId;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.updateSettings.impl.DetectedPluginsPanel;
|
||||
@@ -39,15 +38,17 @@ import java.util.Set;
|
||||
public class PluginsAdvertiserDialog extends DialogWrapper {
|
||||
private static final Logger LOG = Logger.getInstance("#" + PluginsAdvertiserDialog.class.getName());
|
||||
|
||||
@Nullable private final Project myProject;
|
||||
private final PluginDownloader[] myUploadedPlugins;
|
||||
private final List<IdeaPluginDescriptor> myAllPlugins;
|
||||
private final HashSet<String> mySkippedPlugins = new HashSet<String>();
|
||||
|
||||
PluginsAdvertiserDialog(@Nullable Project project, PluginDownloader[] plugins, List<IdeaPluginDescriptor> allPlugins) {
|
||||
super(project);
|
||||
myProject = project;
|
||||
myUploadedPlugins = plugins;
|
||||
myAllPlugins = allPlugins;
|
||||
setTitle("Choose Plugins to Install");
|
||||
setTitle("Choose Plugins to Install or Enable");
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -70,26 +71,39 @@ public class PluginsAdvertiserDialog extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
protected void doOKAction() {
|
||||
final Set<IdeaPluginDescriptor> pluginsToEnable = new HashSet<IdeaPluginDescriptor>();
|
||||
final List<PluginNode> nodes = new ArrayList<PluginNode>();
|
||||
for (PluginDownloader downloader : myUploadedPlugins) {
|
||||
if (!mySkippedPlugins.contains(downloader.getPluginId())) {
|
||||
final PluginNode pluginNode = PluginDownloader.createPluginNode(null, downloader);
|
||||
if (pluginNode != null) {
|
||||
nodes.add(pluginNode);
|
||||
final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(PluginId.getId(downloader.getPluginId()));
|
||||
if (descriptor != null) {
|
||||
pluginsToEnable.add(descriptor);
|
||||
} else {
|
||||
final PluginNode pluginNode = PluginDownloader.createPluginNode(null, downloader);
|
||||
if (pluginNode != null) {
|
||||
nodes.add(pluginNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final Runnable notifyRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PluginManagerMain.notifyPluginsWereInstalled(null, myProject);
|
||||
}
|
||||
};
|
||||
try {
|
||||
PluginManagerMain.downloadPlugins(nodes, myAllPlugins, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PluginManagerMain.notifyPluginsWereInstalled(null);
|
||||
}
|
||||
}, null);
|
||||
PluginManagerMain.downloadPlugins(nodes, myAllPlugins, notifyRunnable, null);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
for (IdeaPluginDescriptor pluginDescriptor : pluginsToEnable) {
|
||||
PluginManagerCore.enablePlugin(pluginDescriptor.getPluginId().getIdString());
|
||||
}
|
||||
if (nodes.isEmpty()) {
|
||||
notifyRunnable.run();
|
||||
}
|
||||
super.doOKAction();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -105,4 +105,5 @@ add.to.resources=Add to resources
|
||||
add.type.customizer.to.resources=Add type customizer script to resources
|
||||
target.0.does.not.exist=Target ''{0}'' does not exist
|
||||
target.annotation.is.unused=@Target is unused
|
||||
change.lvalue.type=Change variable ''{0}'' type to ''{1}''
|
||||
change.lvalue.type=Change variable ''{0}'' type to ''{1}''
|
||||
replace.qualified.name.with.import=Replace qualified name with import
|
||||
+7
-3
@@ -50,6 +50,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
|
||||
public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
|
||||
private static final Logger LOG = Logger.getInstance(UnnecessaryQualifiedReferenceInspection.class);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected BaseInspectionVisitor buildVisitor() {
|
||||
return new BaseInspectionVisitor() {
|
||||
@@ -84,7 +85,10 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
|
||||
final PsiElement parent = ref.getParent();
|
||||
if (parent instanceof GrMethodCall) {
|
||||
final GrMethodCall copy = (GrMethodCall)parent.copy();
|
||||
((GrReferenceExpression)copy.getInvokedExpression()).setQualifier(null);
|
||||
GrReferenceExpression invoked = (GrReferenceExpression)copy.getInvokedExpression();
|
||||
assert invoked != null;
|
||||
|
||||
invoked.setQualifier(null);
|
||||
|
||||
copyResolved = ((GrReferenceExpression)copy.getInvokedExpression()).resolve();
|
||||
}
|
||||
@@ -116,7 +120,7 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GroovyFix buildFix(PsiElement location) {
|
||||
protected GroovyFix buildFix(@NotNull PsiElement location) {
|
||||
return new GroovyFix() {
|
||||
@Override
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
|
||||
@@ -128,7 +132,7 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return GroovyInspectionBundle.message("unnecessary.qualified.reference");
|
||||
return GroovyInspectionBundle.message("replace.qualified.name.with.import");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,8 +22,6 @@ import java.util.*;
|
||||
|
||||
%%
|
||||
|
||||
%{@SuppressWarnings({"UnnecessaryFullyQualifiedName", "FieldCanBeLocal", "UnusedDeclaration", "UnusedAssignment", "AccessStaticViaInstance",
|
||||
"AssignmentToStaticFieldFromInstanceMethod", "MethodMayBeStatic", "CStyleArrayDeclaration", "UnnecessarySemicolon"}) %}
|
||||
%class _GroovyLexer
|
||||
%implements FlexLexer, GroovyTokenTypes, TokenType
|
||||
%unicode
|
||||
|
||||
+2
-2
@@ -143,10 +143,10 @@ public class CompoundStringExpression implements GroovyElementTypes {
|
||||
final PsiBuilder.Marker injection = myBuilder.mark();
|
||||
ParserUtils.getToken(myBuilder, mDOLLAR);
|
||||
|
||||
if (mIDENT.equals(myBuilder.getTokenType())) {
|
||||
if (myBuilder.getTokenType() == mIDENT || myBuilder.getTokenType() == kTHIS) {
|
||||
PathExpression.parse(myBuilder, myParser);
|
||||
}
|
||||
else if (mLCURLY.equals(myBuilder.getTokenType())) {
|
||||
else if (myBuilder.getTokenType() == mLCURLY) {
|
||||
OpenOrClosableBlock.parseClosableBlock(myBuilder, myParser);
|
||||
}
|
||||
else {
|
||||
|
||||
+2
-1
@@ -84,7 +84,6 @@ public class ClosureParameterEnhancer extends AbstractClosureParameterEnhancer {
|
||||
simpleTypes.put("replaceAll", "java.util.regex.Matcher");
|
||||
simpleTypes.put("replaceFirst", "java.util.regex.Matcher");
|
||||
simpleTypes.put("splitEachLine", "java.util.List<java.lang.String>");
|
||||
simpleTypes.put("takeWhile", "java.lang.Character");
|
||||
|
||||
iterations.add("each");
|
||||
iterations.add("any");
|
||||
@@ -104,6 +103,8 @@ public class ClosureParameterEnhancer extends AbstractClosureParameterEnhancer {
|
||||
iterations.add("findIndexValues");
|
||||
iterations.add("findIndexOf");
|
||||
iterations.add("count");
|
||||
iterations.add("takeWhile");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
@@ -148,6 +148,8 @@ public class ExpressionsParsingTest extends GroovyParsingTestCase {
|
||||
|
||||
public void testgstring$ugly_lexer() throws Throwable { doTest(); }
|
||||
|
||||
public void testgstring$this() {doTest()}
|
||||
|
||||
public void testmapLiteral() throws Throwable { doTest(); }
|
||||
|
||||
public void testnew$arr_decl() throws Throwable { doTest(); }
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
print "abc $this.prop test"
|
||||
-----
|
||||
Groovy script
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('print')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Compound Gstring
|
||||
PsiElement(Gstring begin)('"')
|
||||
GrStringContentImpl(GString content element)
|
||||
PsiElement(Gstring content)('abc ')
|
||||
GString injection
|
||||
PsiElement($)('$')
|
||||
Reference expression
|
||||
PsiElement(this)('this')
|
||||
GrStringContentImpl(GString content element)
|
||||
PsiElement(Gstring content)('.prop test')
|
||||
PsiElement(Gstring end)('"')
|
||||
@@ -15,8 +15,12 @@
|
||||
*/
|
||||
package com.jetbrains.python.module;
|
||||
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.ide.util.projectWizard.SourcePathsBuilder;
|
||||
import com.intellij.ide.util.projectWizard.WizardContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -41,4 +45,11 @@ public class PythonModuleBuilder extends PythonModuleBuilderBase implements Sour
|
||||
}
|
||||
mySourcePaths.add(sourcePathInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext,
|
||||
@NotNull ModulesProvider modulesProvider,
|
||||
boolean forNewWizard) {
|
||||
return getModuleType().createWizardSteps(wizardContext, this, modulesProvider, forNewWizard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,13 +39,16 @@ public class PythonModuleType extends PythonModuleTypeBase<PythonModuleBuilderBa
|
||||
@Override
|
||||
public ModuleWizardStep[] createWizardSteps(@NotNull final WizardContext wizardContext,
|
||||
@NotNull final PythonModuleBuilderBase moduleBuilder,
|
||||
@NotNull final ModulesProvider modulesProvider) {
|
||||
@NotNull final ModulesProvider modulesProvider,
|
||||
boolean forNewWizard) {
|
||||
ArrayList<ModuleWizardStep> steps = new ArrayList<ModuleWizardStep>();
|
||||
final Project project = getProject(wizardContext);
|
||||
steps.add(new PythonSdkSelectStep(moduleBuilder, "reference.project.structure.sdk.python", project));
|
||||
final List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getProviders(getInstance(), DefaultFacetsProvider.INSTANCE);
|
||||
if (!providers.isEmpty()) {
|
||||
steps.add(new SupportForFrameworksStep(wizardContext, moduleBuilder, LibrariesContainerFactory.createContainer(project)));
|
||||
if (!forNewWizard) {
|
||||
final List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getProviders(getInstance(), DefaultFacetsProvider.INSTANCE);
|
||||
if (!providers.isEmpty()) {
|
||||
steps.add(new SupportForFrameworksStep(wizardContext, moduleBuilder, LibrariesContainerFactory.createContainer(project)));
|
||||
}
|
||||
}
|
||||
return steps.toArray(new ModuleWizardStep[steps.size()]);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Gregory.Shrago
|
||||
@@ -43,15 +42,15 @@ public class GenericValueUtil {
|
||||
};
|
||||
|
||||
|
||||
public static boolean containsString(final List<? extends GenericValue<?>> list, String value) {
|
||||
for (GenericValue<?> o : list) {
|
||||
public static boolean containsString(final Collection<? extends GenericValue<?>> collection, String value) {
|
||||
for (GenericValue<?> o : collection) {
|
||||
if (Comparing.equal(value, o.getStringValue())) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static <T> boolean containsValue(final List<? extends GenericValue<? extends T>> list, T value) {
|
||||
for (GenericValue<? extends T> o : list) {
|
||||
public static <T> boolean containsValue(final Collection<? extends GenericValue<? extends T>> collection, T value) {
|
||||
for (GenericValue<? extends T> o : collection) {
|
||||
if (Comparing.equal(value, o.getValue())) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user