summaryrefslogtreecommitdiff
path: root/platform/core-impl
diff options
context:
space:
mode:
Diffstat (limited to 'platform/core-impl')
-rw-r--r--platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java1
-rw-r--r--platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java4
-rw-r--r--platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java14
-rw-r--r--platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java18
-rw-r--r--platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationInfoEx.java4
-rw-r--r--platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java6
-rw-r--r--platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java14
-rw-r--r--platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java14
-rw-r--r--platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCommentImpl.java45
-rw-r--r--platform/core-impl/src/com/intellij/psi/impl/source/tree/injected/CommentLiteralEscaper.java59
10 files changed, 153 insertions, 26 deletions
diff --git a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java
index 633c25a0145a..f82e7a80d5fb 100644
--- a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java
+++ b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java
@@ -234,6 +234,7 @@ public class CoreApplicationEnvironment {
protected void doCheckCanceled() throws ProcessCanceledException {
}
+ @NotNull
@Override
public NonCancelableSection startNonCancelableSection() {
return NonCancelableSection.EMPTY;
diff --git a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
index 24e12524dc97..72d290e61e25 100644
--- a/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
+++ b/platform/core-impl/src/com/intellij/ide/plugins/IdeaPluginDescriptorImpl.java
@@ -121,9 +121,7 @@ public class IdeaPluginDescriptorImpl implements IdeaPluginDescriptor {
@NotNull
public static String intern(@NotNull String s) {
- synchronized (ourInterner) {
- return ourInterner.intern(s);
- }
+ return ourInterner.intern(s);
}
public static void internJDOMElement(@NotNull Element rootElement) {
diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
index e834e33f0f42..d80d36822eb1 100644
--- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
+++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java
@@ -322,15 +322,8 @@ public class PluginManagerCore {
Extensions.registerAreaClass(ExtensionAreas.IDEA_MODULE, ExtensionAreas.IDEA_PROJECT);
}
- @SuppressWarnings({"HardCodedStringLiteral"})
- static Method getAddUrlMethod(final ClassLoader loader) throws NoSuchMethodException {
- if (loader instanceof URLClassLoader) {
- final Method addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
- addUrlMethod.setAccessible(true);
- return addUrlMethod;
- }
-
- return loader.getClass().getDeclaredMethod("addURL", URL.class);
+ private static Method getAddUrlMethod(final ClassLoader loader) {
+ return ReflectionUtil.getDeclaredMethod(loader instanceof URLClassLoader ? URLClassLoader.class : loader.getClass(), "addURL", URL.class);
}
@Nullable
@@ -351,9 +344,6 @@ public class PluginManagerCore {
return loader;
}
- catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
catch (IOException e) {
e.printStackTrace();
}
diff --git a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java
index b68fa936af23..d67ae891d3bf 100644
--- a/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java
+++ b/platform/core-impl/src/com/intellij/lang/impl/PsiBuilderImpl.java
@@ -1113,7 +1113,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
if (curDepth > maxDepth) maxDepth = curDepth;
}
else if (item instanceof DoneMarker) {
- if (((DoneMarker)item).myStart != curNode) LOG.error(UNBALANCED_MESSAGE);
+ assertMarkersBalanced(((DoneMarker)item).myStart == curNode, item);
curNode = nodes.pop();
curDepth--;
}
@@ -1143,7 +1143,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
myLexStarts[myCurrentLexeme + 1] = 0;
myLexTypes[myCurrentLexeme] = null;
- LOG.assertTrue(curNode == rootMarker, UNBALANCED_MESSAGE);
+ assertMarkersBalanced(curNode == rootMarker, curNode);
checkTreeDepth(maxDepth, rootMarker.getTokenType() instanceof IFileElementType);
@@ -1151,6 +1151,16 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
return rootMarker;
}
+ private void assertMarkersBalanced(boolean condition, @Nullable ProductionMarker marker) {
+ if (condition) return;
+
+ int index = marker != null ? marker.getStartIndex() + 1 : myLexStarts.length;
+ CharSequence context =
+ index < myLexStarts.length ? myText.subSequence(Math.max(0, myLexStarts[index] - 1000), myLexStarts[index]) : "<none>";
+ String language = myFile != null ? myFile.getLanguage() + ", " : "";
+ LOG.error(UNBALANCED_MESSAGE + "\n" + language + context);
+ }
+
private void balanceWhiteSpaces() {
RelativeTokenTypesView wsTokens = new RelativeTokenTypesView();
RelativeTokenTextView tokenTextGetter = new RelativeTokenTextView();
@@ -1158,8 +1168,8 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
for (int i = 1, size = myProduction.size() - 1; i < size; i++) {
ProductionMarker item = myProduction.get(i);
- if (item instanceof StartMarker && ((StartMarker)item).myDoneMarker == null) {
- LOG.error(UNBALANCED_MESSAGE);
+ if (item instanceof StartMarker) {
+ assertMarkersBalanced(((StartMarker)item).myDoneMarker != null, item);
}
int prevProductionLexIndex = myProduction.get(i - 1).myLexemeIndex;
diff --git a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationInfoEx.java b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationInfoEx.java
index 4282eb20ff26..d1251c9c9ad0 100644
--- a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationInfoEx.java
+++ b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationInfoEx.java
@@ -16,6 +16,7 @@
package com.intellij.openapi.application.ex;
import com.intellij.openapi.application.ApplicationInfo;
+import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.util.Calendar;
@@ -117,4 +118,7 @@ public abstract class ApplicationInfoEx extends ApplicationInfo {
/** @deprecated to remove in IDEA 14 */
@SuppressWarnings("UnusedDeclaration")
public abstract String getWelcomeScreenDeveloperSloganUrl();
+
+ @Nullable
+ public abstract String getCustomizeIDEWizardStepsProvider();
}
diff --git a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java
index 663cd6f9e0b3..1d7de90e5f61 100644
--- a/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java
+++ b/platform/core-impl/src/com/intellij/openapi/application/ex/ApplicationUtil.java
@@ -35,6 +35,12 @@ public class ApplicationUtil {
throw new CannotRunReadActionException();
}
+ public static void tryRunReadAction(@NotNull final Runnable computable) throws CannotRunReadActionException {
+ if (!((ApplicationEx)ApplicationManager.getApplication()).tryRunReadAction(computable)) {
+ throw new CannotRunReadActionException();
+ }
+ }
+
public static class CannotRunReadActionException extends RuntimeException{
@Override
public Throwable fillInStackTrace() {
diff --git a/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java b/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
index 62fbfa502c79..13d580ef0834 100644
--- a/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
+++ b/platform/core-impl/src/com/intellij/openapi/application/impl/ApplicationInfoImpl.java
@@ -75,6 +75,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
private boolean myShowLicensee = true;
private String myWelcomeScreenCaptionUrl;
private String myWelcomeScreenDeveloperSloganUrl;
+ private String myCustomizeIDEWizardStepsProvider;
private UpdateUrls myUpdateUrls;
private String myDocumentationUrl;
private String mySupportUrl;
@@ -171,6 +172,8 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
@NonNls private static final String ELEMENT_THIRD_PARTY = "third-party";
+ @NonNls private static final String CUSTOMIZE_IDE_WIZARD_STEPS = "customize-ide-wizard";
+ @NonNls private static final String STEPS_PROVIDER = "provider";
public void initComponent() { }
@@ -311,6 +314,12 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
return myWelcomeScreenLogoUrl;
}
+ @Nullable
+ @Override
+ public String getCustomizeIDEWizardStepsProvider() {
+ return myCustomizeIDEWizardStepsProvider;
+ }
+
@Override
public String getEditorBackgroundImageUrl() {
return myEditorBackgroundImageUrl;
@@ -598,6 +607,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
myWelcomeScreenDeveloperSloganUrl = welcomeScreen.getAttributeValue(SLOGAN_URL_ATTR);
}
+ Element wizardSteps = parentNode.getChild(CUSTOMIZE_IDE_WIZARD_STEPS);
+ if (wizardSteps != null) {
+ myCustomizeIDEWizardStepsProvider = wizardSteps.getAttributeValue(STEPS_PROVIDER);
+ }
+
Element editor = parentNode.getChild(ELEMENT_EDITOR);
if (editor != null) {
myEditorBackgroundImageUrl = editor.getAttributeValue(BACKGROUND_URL_ATTR);
diff --git a/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java b/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java
index a42d7a1944f0..670aaf1d8493 100644
--- a/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java
+++ b/platform/core-impl/src/com/intellij/psi/impl/DocumentCommitProcessor.java
@@ -51,20 +51,20 @@ public abstract class DocumentCommitProcessor {
public abstract void commitAsynchronously(@NotNull final Project project, @NotNull final Document document, @NonNls @NotNull Object reason);
protected static class CommitTask {
- public final Document document;
- public final Project project;
+ @NotNull public final Document document;
+ @NotNull public final Project project;
// when queued it's not started
// when dequeued it's started
// when failed it's canceled
- public final ProgressIndicator indicator; // progress to commit this doc under.
- public final Object reason;
+ @NotNull public final ProgressIndicator indicator; // progress to commit this doc under.
+ @NotNull public final Object reason;
public boolean removed; // task marked as removed, should be ignored.
public CommitTask(@NotNull Document document,
- @NotNull Project project,
- @NotNull ProgressIndicator indicator,
- @NotNull Object reason) {
+ @NotNull Project project,
+ @NotNull ProgressIndicator indicator,
+ @NotNull Object reason) {
this.document = document;
this.project = project;
this.indicator = indicator;
diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCommentImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCommentImpl.java
new file mode 100644
index 000000000000..70bc987a91f8
--- /dev/null
+++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/PsiCommentImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.intellij.psi.impl.source.tree;
+
+import com.intellij.psi.LiteralTextEscaper;
+import com.intellij.psi.PsiLanguageInjectionHost;
+import com.intellij.psi.impl.source.tree.injected.CommentLiteralEscaper;
+import com.intellij.psi.tree.IElementType;
+import org.jetbrains.annotations.NotNull;
+
+public class PsiCommentImpl extends PsiCoreCommentImpl implements PsiLanguageInjectionHost {
+ public PsiCommentImpl(IElementType type, CharSequence text) {
+ super(type, text);
+ }
+
+ @Override
+ public boolean isValidHost() {
+ return true;
+ }
+
+ @Override
+ public PsiLanguageInjectionHost updateText(@NotNull final String text) {
+ return (PsiCommentImpl)replaceWithText(text);
+ }
+
+ @Override
+ @NotNull
+ public LiteralTextEscaper<PsiCommentImpl> createLiteralTextEscaper() {
+ return new CommentLiteralEscaper(this);
+ }
+}
diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/injected/CommentLiteralEscaper.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/injected/CommentLiteralEscaper.java
new file mode 100644
index 000000000000..3374a2b59f87
--- /dev/null
+++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/injected/CommentLiteralEscaper.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.intellij.psi.impl.source.tree.injected;
+
+import com.intellij.openapi.util.ProperTextRange;
+import com.intellij.lang.CodeDocumentationAwareCommenter;
+import com.intellij.lang.Commenter;
+import com.intellij.lang.LanguageCommenters;
+import com.intellij.openapi.util.TextRange;
+import com.intellij.psi.LiteralTextEscaper;
+import com.intellij.psi.impl.source.tree.PsiCommentImpl;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * @author cdr
+*/
+public class CommentLiteralEscaper extends LiteralTextEscaper<PsiCommentImpl> {
+ public CommentLiteralEscaper(PsiCommentImpl host) {
+ super(host);
+ }
+
+ @Override
+ public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) {
+ ProperTextRange.assertProperRange(rangeInsideHost);
+ outChars.append(myHost.getText(), rangeInsideHost.getStartOffset(), rangeInsideHost.getEndOffset());
+ return true;
+ }
+
+ @Override
+ public int getOffsetInHost(int offsetInDecoded, @NotNull final TextRange rangeInsideHost) {
+ int offset = offsetInDecoded + rangeInsideHost.getStartOffset();
+ if (offset < rangeInsideHost.getStartOffset()) offset = rangeInsideHost.getStartOffset();
+ if (offset > rangeInsideHost.getEndOffset()) offset = rangeInsideHost.getEndOffset();
+ return offset;
+ }
+
+ @Override
+ public boolean isOneLine() {
+ final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(myHost.getLanguage());
+ if (commenter instanceof CodeDocumentationAwareCommenter) {
+ return myHost.getTokenType() == ((CodeDocumentationAwareCommenter) commenter).getLineCommentTokenType();
+ }
+ return false;
+ }
+} \ No newline at end of file