mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -58,6 +58,7 @@ import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.MessageCategory;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -194,28 +195,39 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
}
|
||||
|
||||
private void stopAppIconProgress() {
|
||||
AppIcon appIcon = AppIcon.getInstance();
|
||||
if (appIcon.hideProgress(APP_ICON_ID)) {
|
||||
if (myErrorCount > 0) {
|
||||
appIcon.setBadge(String.valueOf(myErrorCount));
|
||||
appIcon.requestAttention(true);
|
||||
} else {
|
||||
appIcon.setBadge(null);
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
AppIcon appIcon = AppIcon.getInstance();
|
||||
if (appIcon.hideProgress(APP_ICON_ID)) {
|
||||
if (myErrorCount > 0) {
|
||||
appIcon.setBadge(String.valueOf(myErrorCount));
|
||||
appIcon.requestAttention(true);
|
||||
} else {
|
||||
appIcon.setBadge(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setText(final String text) {
|
||||
super.setText(text);
|
||||
updateProgressText();
|
||||
}
|
||||
|
||||
public void setText2(final String text) {
|
||||
super.setText2(text);
|
||||
updateProgressText();
|
||||
}
|
||||
|
||||
public void setFraction(final double fraction) {
|
||||
super.setFraction(fraction);
|
||||
updateProgressText();
|
||||
AppIcon.getInstance().setProgress(APP_ICON_ID, AppIconScheme.Progress.BUILD, fraction, true);
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
AppIcon.getInstance().setProgress(APP_ICON_ID, AppIconScheme.Progress.BUILD, fraction, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void onProgressChange() {
|
||||
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.application.options;
|
||||
|
||||
import com.intellij.psi.codeStyle.CodeStyleCustomizationsConsumer;
|
||||
import com.intellij.psi.codeStyle.CodeStyleOptionsCustomizer;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaCodeStyleOptionsCustomizer extends CodeStyleOptionsCustomizer {
|
||||
@Override
|
||||
public void customizeSpacingOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
consumer.showAllStandardOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customizeBlankLinesOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
consumer.showAllStandardOptions();
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,6 @@ public class DfaUtil {
|
||||
return codeBlock;
|
||||
}
|
||||
|
||||
@Nullable("null means DFA analysis has failed (too complex to analyze)")
|
||||
public static Collection<? extends PsiElement> getPossibleInitializationElements(final PsiElement qualifierExpression) {
|
||||
if (qualifierExpression instanceof PsiMethodCallExpression) {
|
||||
return Collections.singletonList(qualifierExpression);
|
||||
@@ -152,8 +151,7 @@ public class DfaUtil {
|
||||
final PsiElement targetElement = ((PsiReferenceExpression)qualifierExpression).resolve();
|
||||
if (targetElement instanceof PsiVariable) {
|
||||
final Collection<? extends PsiElement> variableValues = getCachedVariableValues((PsiVariable)targetElement, qualifierExpression);
|
||||
if (variableValues == null) return null;
|
||||
if (variableValues.isEmpty() && targetElement instanceof PsiField) {
|
||||
if ((variableValues == null || variableValues.isEmpty())) {
|
||||
return getVariableAssignmentsInFile((PsiVariable)targetElement, false);
|
||||
}
|
||||
return variableValues;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.ide;
|
||||
import com.intellij.application.options.codeStyle.LanguageCodeStyleSettingsProvider;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.psi.codeStyle.CodeStyleCustomizationsConsumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -44,6 +45,17 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
return GENERAL_CODE_SAMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customizeSpacingOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
consumer.showAllStandardOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customizeBlankLinesOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
consumer.showAllStandardOptions();
|
||||
}
|
||||
|
||||
|
||||
private static final String GENERAL_CODE_SAMPLE = "public class Foo {\n" +
|
||||
" public int[] X = new int[]{1, 3, 5 7, 9, 11};\n" +
|
||||
"\n" +
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.impl.source.tree.Factory;
|
||||
import com.intellij.psi.impl.source.tree.LeafElement;
|
||||
import com.intellij.psi.impl.source.tree.SharedImplUtil;
|
||||
import com.intellij.psi.infos.CandidateInfo;
|
||||
import com.intellij.psi.javadoc.PsiDocComment;
|
||||
import com.intellij.psi.javadoc.PsiDocTagValue;
|
||||
import com.intellij.psi.javadoc.PsiDocToken;
|
||||
import com.intellij.psi.scope.PsiScopeProcessor;
|
||||
@@ -50,7 +51,9 @@ public class PsiDocParamRef extends CompositePsiElement implements PsiDocTagValu
|
||||
public PsiReference getReference() {
|
||||
PsiReference cachedReference = myCachedReference;
|
||||
if (cachedReference != null) return cachedReference;
|
||||
final PsiDocCommentOwner owner = PsiTreeUtil.getParentOfType(this, PsiDocCommentOwner.class);
|
||||
final PsiDocComment comment = PsiTreeUtil.getParentOfType(this, PsiDocComment.class);
|
||||
if (comment == null) return null;
|
||||
final PsiDocCommentOwner owner = comment.getOwner();
|
||||
if (!(owner instanceof PsiMethod) &&
|
||||
!(owner instanceof PsiClass)) return null;
|
||||
final ASTNode valueToken = findChildByType(JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
|
||||
@@ -108,16 +108,16 @@ public interface ASTNode extends UserDataHolder {
|
||||
ASTNode getLastChildNode();
|
||||
|
||||
/**
|
||||
* Returns the previous sibling of this node in the tree.
|
||||
* Returns the next sibling of this node in the tree.
|
||||
*
|
||||
* @return the previous sibling node.
|
||||
* @return the next sibling node.
|
||||
*/
|
||||
ASTNode getTreeNext();
|
||||
|
||||
/**
|
||||
* Returns the next sibling of this node in the tree.
|
||||
* Returns the previous sibling of this node in the tree.
|
||||
*
|
||||
* @return the next sibling node.
|
||||
* @return the previous sibling node.
|
||||
*/
|
||||
ASTNode getTreePrev();
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.psi.codeStyle;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class CodeStyleOptionsCustomizer {
|
||||
public static final ExtensionPointName<CodeStyleOptionsCustomizer> EP_NAME = ExtensionPointName.create("com.intellij.codeStyleOptionsCustomizer");
|
||||
|
||||
public void customizeSpacingOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
}
|
||||
|
||||
public void customizeBlankLinesOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
}
|
||||
}
|
||||
@@ -44,4 +44,8 @@ public abstract class CodeStyleSettingsProvider {
|
||||
public String getConfigurableDisplayName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasSettingsPage() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+7
-5
@@ -208,11 +208,13 @@ public class CodeStyleSchemesConfigurable extends SearchableConfigurable.Parent.
|
||||
myPanels = new ArrayList<CodeStyleConfigurableWrapper>();
|
||||
|
||||
for (final CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
|
||||
myPanels.add(new CodeStyleConfigurableWrapper(provider, new CodeStyleSettingsPanelFactory() {
|
||||
public NewCodeStyleSettingsPanel createPanel(final CodeStyleScheme scheme) {
|
||||
return new NewCodeStyleSettingsPanel(provider.createSettingsPage(scheme.getCodeStyleSettings(), ensureModel().getCloneSettings(scheme)));
|
||||
}
|
||||
}));
|
||||
if (provider.hasSettingsPage()) {
|
||||
myPanels.add(new CodeStyleConfigurableWrapper(provider, new CodeStyleSettingsPanelFactory() {
|
||||
public NewCodeStyleSettingsPanel createPanel(final CodeStyleScheme scheme) {
|
||||
return new NewCodeStyleSettingsPanel(provider.createSettingsPage(scheme.getCodeStyleSettings(), ensureModel().getCloneSettings(scheme)));
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return myPanels.toArray(new Configurable[myPanels.size()]);
|
||||
|
||||
+2
-3
@@ -20,7 +20,6 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleCustomizationsConsumer;
|
||||
import com.intellij.psi.codeStyle.CodeStyleOptionsCustomizer;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
|
||||
import com.intellij.ui.OptionGroup;
|
||||
@@ -43,8 +42,8 @@ public class CodeStyleBlankLinesPanel extends MultilanguageCodeStyleAbstractPane
|
||||
public CodeStyleBlankLinesPanel(CodeStyleSettings settings) {
|
||||
super(settings);
|
||||
|
||||
for(CodeStyleOptionsCustomizer customizer: Extensions.getExtensions(CodeStyleOptionsCustomizer.EP_NAME)) {
|
||||
customizer.customizeBlankLinesOptions(this);
|
||||
for(LanguageCodeStyleSettingsProvider provider: Extensions.getExtensions(LanguageCodeStyleSettingsProvider.EP_NAME)) {
|
||||
provider.customizeBlankLinesOptions(this);
|
||||
}
|
||||
|
||||
myPanel
|
||||
|
||||
+2
-3
@@ -18,7 +18,6 @@ package com.intellij.application.options.codeStyle;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.psi.codeStyle.CodeStyleOptionsCustomizer;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CustomCodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleCustomizationsConsumer;
|
||||
@@ -47,8 +46,8 @@ public class CodeStyleSpacesPanel extends OptionTreeWithPreviewPanel implements
|
||||
protected void initTables() {
|
||||
myAllowedOptions = new HashSet<String>();
|
||||
myCustomOptions = new MultiMap<String, Trinity<Class<? extends CustomCodeStyleSettings>, String, String>>();
|
||||
for(CodeStyleOptionsCustomizer contributor: Extensions.getExtensions(CodeStyleOptionsCustomizer.EP_NAME)) {
|
||||
contributor.customizeSpacingOptions(this);
|
||||
for(LanguageCodeStyleSettingsProvider provider: Extensions.getExtensions(LanguageCodeStyleSettingsProvider.EP_NAME)) {
|
||||
provider.customizeSpacingOptions(this);
|
||||
}
|
||||
|
||||
initBooleanField("SPACE_BEFORE_METHOD_CALL_PARENTHESES", ApplicationBundle.message("checkbox.spaces.method.call.parentheses"), BEFORE_PARENTHESES);
|
||||
|
||||
+7
@@ -18,6 +18,7 @@ package com.intellij.application.options.codeStyle;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.psi.codeStyle.CodeStyleCustomizationsConsumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -41,6 +42,12 @@ public abstract class LanguageCodeStyleSettingsProvider {
|
||||
|
||||
public abstract String getCodeSample(@NotNull SettingsType settingsType);
|
||||
|
||||
public void customizeSpacingOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
}
|
||||
|
||||
public void customizeBlankLinesOptions(CodeStyleCustomizationsConsumer consumer) {
|
||||
}
|
||||
|
||||
public static Language[] getLanguagesWithCodeStyleSettings() {
|
||||
ArrayList<Language> langs = new ArrayList<Language>();
|
||||
for (LanguageCodeStyleSettingsProvider provider : Extensions.getExtensions(EP_NAME)) {
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl {
|
||||
}
|
||||
return getRootFiles(OrderRootType.CLASSES);
|
||||
}
|
||||
else if (type == OrderRootType.CLASSES_AND_OUTPUT || type == OrderRootType.CLASSES) {
|
||||
else if (type == OrderRootType.CLASSES_AND_OUTPUT) {
|
||||
return myScope == DependencyScope.PROVIDED ? VirtualFile.EMPTY_ARRAY : getRootFiles(OrderRootType.CLASSES);
|
||||
}
|
||||
return getRootFiles(type);
|
||||
@@ -80,7 +80,7 @@ abstract class LibraryOrderEntryBaseImpl extends OrderEntryBaseImpl {
|
||||
}
|
||||
return rootProvider.getUrls(OrderRootType.CLASSES);
|
||||
}
|
||||
else if (type == OrderRootType.CLASSES_AND_OUTPUT || type == OrderRootType.CLASSES) {
|
||||
else if (type == OrderRootType.CLASSES_AND_OUTPUT) {
|
||||
return myScope == DependencyScope.PROVIDED ? ArrayUtil.EMPTY_STRING_ARRAY : rootProvider.getUrls(OrderRootType.CLASSES);
|
||||
}
|
||||
return rootProvider.getUrls(type);
|
||||
|
||||
@@ -33,7 +33,7 @@ public class AppIconScheme {
|
||||
|
||||
static final Progress BUILD = new Progress() {
|
||||
public Color getOkColor() {
|
||||
return Color.blue;
|
||||
return new Color(51, 102, 255);
|
||||
}
|
||||
|
||||
public Color getErrorColor() {
|
||||
@@ -43,7 +43,7 @@ public class AppIconScheme {
|
||||
|
||||
static final Progress INDEXING = new Progress() {
|
||||
public Color getOkColor() {
|
||||
return Color.yellow;
|
||||
return new Color(255, 153, 0);
|
||||
}
|
||||
|
||||
public Color getErrorColor() {
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.containers.Queue;
|
||||
import com.intellij.util.io.storage.HeavyProcessLatch;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -271,16 +272,24 @@ public class DumbServiceImpl extends DumbService {
|
||||
if (indicator instanceof ProgressIndicatorEx) {
|
||||
((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
|
||||
@Override
|
||||
public void setFraction(double fraction) {
|
||||
AppIcon.getInstance().setProgress("indexUpdate", AppIconScheme.Progress.INDEXING, fraction, true);
|
||||
public void setFraction(final double fraction) {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
AppIcon.getInstance().setProgress("indexUpdate", AppIconScheme.Progress.INDEXING, fraction, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish(@NotNull TaskInfo task) {
|
||||
AppIcon appIcon = AppIcon.getInstance();
|
||||
if (appIcon.hideProgress("indexUpdate")) {
|
||||
appIcon.requestAttention(false);
|
||||
}
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
AppIcon appIcon = AppIcon.getInstance();
|
||||
if (appIcon.hideProgress("indexUpdate")) {
|
||||
appIcon.requestAttention(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.AppIconScheme;
|
||||
@@ -63,6 +65,8 @@ public abstract class AppIcon {
|
||||
private double myLastValue;
|
||||
|
||||
private BufferedImage getAppImage() {
|
||||
assertIsDispatchThread();
|
||||
|
||||
try {
|
||||
if (myAppImage != null) return myAppImage;
|
||||
|
||||
@@ -91,6 +95,8 @@ public abstract class AppIcon {
|
||||
|
||||
@Override
|
||||
public void setBadge(String text) {
|
||||
assertIsDispatchThread();
|
||||
|
||||
try {
|
||||
getAppMethod("setDockIconBadge", String.class).invoke(getApp(), text);
|
||||
}
|
||||
@@ -104,6 +110,8 @@ public abstract class AppIcon {
|
||||
|
||||
@Override
|
||||
public void requestAttention(boolean critical) {
|
||||
assertIsDispatchThread();
|
||||
|
||||
try {
|
||||
getAppMethod("requestUserAttention", boolean.class).invoke(getApp(), critical);
|
||||
}
|
||||
@@ -117,6 +125,8 @@ public abstract class AppIcon {
|
||||
|
||||
@Override
|
||||
public boolean hideProgress(Object processId) {
|
||||
assertIsDispatchThread();
|
||||
|
||||
if (getAppImage() == null) return false;
|
||||
if (myCurrentProcessId != null && !myCurrentProcessId.equals(processId)) return false;
|
||||
|
||||
@@ -128,6 +138,8 @@ public abstract class AppIcon {
|
||||
}
|
||||
|
||||
public boolean setProgress(Object processId, AppIconScheme.Progress scheme, double value, boolean isOk) {
|
||||
assertIsDispatchThread();
|
||||
|
||||
if (getAppImage() == null) return false;
|
||||
if (myCurrentProcessId != null && !myCurrentProcessId.equals(processId)) return false;
|
||||
|
||||
@@ -136,10 +148,10 @@ public abstract class AppIcon {
|
||||
if (Math.abs(myLastValue - value) < 0.02d) return true;
|
||||
|
||||
try {
|
||||
int progressHeight = 20;
|
||||
int xInset = 15;
|
||||
int yInset = 10;
|
||||
int bound = 2;
|
||||
int progressHeight = (int)(myAppImage.getHeight() * 0.15);
|
||||
int xInset = (int)(myAppImage.getWidth() * 0.05);
|
||||
int yInset = (int)(myAppImage.getHeight() * 0.15);
|
||||
int bound = (int)(myAppImage.getWidth() * 0.03);
|
||||
|
||||
Rectangle progressRec = new Rectangle(new Point(xInset, myAppImage.getHeight() - progressHeight - yInset),
|
||||
new Dimension(myAppImage.getWidth() - xInset * 2, progressHeight));
|
||||
@@ -147,23 +159,20 @@ public abstract class AppIcon {
|
||||
BufferedImage current = new BufferedImage(myAppImage.getWidth(), myAppImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = current.createGraphics();
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
|
||||
g.drawImage(getAppImage(), null, null);
|
||||
|
||||
Rectangle bgRec = new Rectangle(progressRec.x - bound, progressRec.y - bound, progressRec.width + bound * 2, progressRec.height + bound * 2);
|
||||
g.setColor(Color.white);
|
||||
g.fillRect(bgRec.x, bgRec.y, bgRec.width, bgRec.height);
|
||||
|
||||
|
||||
g.setColor(Color.black);
|
||||
g.fillRect(progressRec.x, progressRec.y, progressRec.width, progressRec.height);
|
||||
|
||||
|
||||
g.setColor(isOk ? scheme.getOkColor() : scheme.getErrorColor());
|
||||
|
||||
int currentWidth = (int)Math.ceil(progressRec.width * value);
|
||||
|
||||
g.fillRect(progressRec.x, progressRec.y, currentWidth, progressRec.height);
|
||||
|
||||
g.setColor(Color.black);
|
||||
g.drawRect(bgRec.x, bgRec.y, bgRec.width - 1, bgRec.height - 1);
|
||||
|
||||
|
||||
setDockIcon(current);
|
||||
|
||||
@@ -222,5 +231,15 @@ public abstract class AppIcon {
|
||||
}
|
||||
}
|
||||
|
||||
private static void assertIsDispatchThread() {
|
||||
Application app = ApplicationManager.getApplication();
|
||||
if (app != null) {
|
||||
if (!app.isUnitTestMode()) {
|
||||
app.assertIsDispatchThread();
|
||||
}
|
||||
} else {
|
||||
assert EventQueue.isDispatchThread();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@
|
||||
|
||||
<extensionPoint name="codeStyleSettingsProvider"
|
||||
interface="com.intellij.psi.codeStyle.CodeStyleSettingsProvider"/>
|
||||
<extensionPoint name="codeStyleOptionsCustomizer"
|
||||
interface="com.intellij.psi.codeStyle.CodeStyleOptionsCustomizer"/>
|
||||
|
||||
<extensionPoint name="daemon.highlightInfoFilter"
|
||||
interface="com.intellij.codeInsight.daemon.impl.HighlightInfoFilter"/>
|
||||
|
||||
@@ -47,6 +47,10 @@ public class CollectionFactory {
|
||||
return new ArrayList<T>();
|
||||
}
|
||||
|
||||
public static <T> HashSet<T> hashSet() {
|
||||
return new HashSet<T>();
|
||||
}
|
||||
|
||||
public static <T, V> LinkedHashMap<T, V> linkedMap() {
|
||||
return new LinkedHashMap<T,V>();
|
||||
}
|
||||
|
||||
+4
-3
@@ -53,9 +53,10 @@ public class GroovyConditionalWithIdenticalBranchesInspection extends BaseInspec
|
||||
return "Collapse conditional expression";
|
||||
}
|
||||
|
||||
public void doFix(Project project, ProblemDescriptor descriptor)
|
||||
throws IncorrectOperationException {
|
||||
final GrConditionalExpression expression = (GrConditionalExpression) descriptor.getPsiElement();
|
||||
public void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
|
||||
final PsiElement element = descriptor.getPsiElement();
|
||||
if (!(element instanceof GrConditionalExpression)) return;
|
||||
final GrConditionalExpression expression = (GrConditionalExpression)element;
|
||||
final GrExpression thenBranch = expression.getThenBranch();
|
||||
replaceExpression(expression, thenBranch.getText());
|
||||
}
|
||||
|
||||
+15
-14
@@ -37,9 +37,10 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.PsiImplUtil;
|
||||
*/
|
||||
public class BuiltInTypeFilter implements ElementFilter {
|
||||
public boolean isAcceptable(Object element, PsiElement context) {
|
||||
PsiElement previous = PsiImplUtil.realPrevious(context.getParent().getPrevSibling());
|
||||
if (previous != null &&
|
||||
GroovyTokenTypes.mAT.equals(previous.getNode().getElementType())) {
|
||||
final PsiElement parent = context.getParent();
|
||||
if (parent == null) return false;
|
||||
PsiElement previous = PsiImplUtil.realPrevious(parent.getPrevSibling());
|
||||
if (previous != null && GroovyTokenTypes.mAT.equals(previous.getNode().getElementType())) {
|
||||
return false;
|
||||
}
|
||||
if (GroovyCompletionUtil.asSimpleVariable(context) ||
|
||||
@@ -47,29 +48,29 @@ public class BuiltInTypeFilter implements ElementFilter {
|
||||
GroovyCompletionUtil.asVariableInBlock(context)) {
|
||||
return true;
|
||||
}
|
||||
if ((context.getParent() instanceof GrParameter &&
|
||||
((GrParameter) context.getParent()).getTypeElementGroovy() == null) ||
|
||||
context.getParent() instanceof GrReferenceElement &&
|
||||
!(context.getParent().getParent() instanceof GrImportStatement) &&
|
||||
!(context.getParent().getParent() instanceof GrPackageDefinition) &&
|
||||
!(context.getParent().getParent() instanceof GrArgumentList)) {
|
||||
if ((parent instanceof GrParameter &&
|
||||
((GrParameter)parent).getTypeElementGroovy() == null) ||
|
||||
parent instanceof GrReferenceElement &&
|
||||
!(parent.getParent() instanceof GrImportStatement) &&
|
||||
!(parent.getParent() instanceof GrPackageDefinition) &&
|
||||
!(parent.getParent() instanceof GrArgumentList)) {
|
||||
PsiElement prevSibling = context.getPrevSibling();
|
||||
if (context.getParent() instanceof GrReferenceElement && prevSibling != null && prevSibling.getNode() != null) {
|
||||
if (parent instanceof GrReferenceElement && prevSibling != null && prevSibling.getNode() != null) {
|
||||
ASTNode node = prevSibling.getNode();
|
||||
return !GroovyTokenTypes.DOTS.contains(node.getElementType());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (PsiImplUtil.realPrevious(context.getParent().getPrevSibling()) instanceof GrModifierList) {
|
||||
if (PsiImplUtil.realPrevious(parent.getPrevSibling()) instanceof GrModifierList) {
|
||||
return true;
|
||||
}
|
||||
if (PsiImplUtil.realPrevious(context.getPrevSibling()) instanceof GrModifierList) {
|
||||
return true;
|
||||
}
|
||||
return context.getParent() instanceof GrExpression &&
|
||||
context.getParent().getParent() instanceof GroovyFile &&
|
||||
GroovyCompletionUtil.isNewStatement(context, false);
|
||||
return parent instanceof GrExpression &&
|
||||
parent.getParent() instanceof GroovyFile &&
|
||||
GroovyCompletionUtil.isNewStatement(context, false);
|
||||
}
|
||||
|
||||
public boolean isClassAcceptable(Class hintClass) {
|
||||
|
||||
+8
-3
@@ -346,9 +346,14 @@ public class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory {
|
||||
|
||||
public GrMethod createMethodFromText(@NotNull String methodText) {
|
||||
GroovyFileBase file = createDummyFile(methodText);
|
||||
GrTopLevelDefintion defintion = file.getTopLevelDefinitions()[0];
|
||||
assert defintion != null && defintion instanceof GrMethod;
|
||||
return ((GrMethod) defintion);
|
||||
try {
|
||||
GrTopLevelDefintion defintion = file.getTopLevelDefinitions()[0];
|
||||
assert defintion != null && defintion instanceof GrMethod;
|
||||
return ((GrMethod)defintion);
|
||||
}
|
||||
catch (Error error) {
|
||||
throw new IncorrectOperationException("Can't create method from text: '" + file.getText() + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
|
||||
public class GroovyWithTypeCastSurrounder extends GroovyExpressionSurrounder {
|
||||
protected TextRange surroundExpression(GrExpression expression) {
|
||||
GrParenthesizedExpression parenthesized = (GrParenthesizedExpression) GroovyPsiElementFactory.getInstance(expression.getProject()).createTopElementFromText("((Type)a)");
|
||||
parenthesized = (GrParenthesizedExpression) expression.replaceWithExpression(parenthesized, true);
|
||||
parenthesized = (GrParenthesizedExpression) expression.replaceWithExpression(parenthesized, false);
|
||||
GrTypeCastExpression typeCast = (GrTypeCastExpression) parenthesized.getOperand();
|
||||
replaceToOldExpression(typeCast.getOperand(), expression);
|
||||
GrTypeElement typeElement = typeCast.getCastTypeElement();
|
||||
|
||||
@@ -720,8 +720,6 @@
|
||||
|
||||
<langCodeStyleSettingsProvider implementation="com.intellij.ide.JavaLanguageCodeStyleSettingsProvider"/>
|
||||
|
||||
<codeStyleOptionsCustomizer implementation="com.intellij.application.options.JavaCodeStyleOptionsCustomizer"/>
|
||||
|
||||
<!-- new project wizard -->
|
||||
<wizardMode implementation="com.intellij.ide.util.newProjectWizard.modes.CreateFromScratchMode"/>
|
||||
<wizardMode implementation="com.intellij.ide.util.newProjectWizard.modes.CreateFromSourcesMode"/>
|
||||
|
||||
Reference in New Issue
Block a user