summaryrefslogtreecommitdiff
path: root/java/java-impl/src/com/intellij/psi/impl/source
diff options
context:
space:
mode:
Diffstat (limited to 'java/java-impl/src/com/intellij/psi/impl/source')
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java57
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java57
-rw-r--r--java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java44
3 files changed, 0 insertions, 158 deletions
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java
deleted file mode 100644
index 34c1d9df885f..000000000000
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiDocTagValueManipulator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.resolve.reference.impl.manipulators;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.psi.AbstractElementManipulator;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.javadoc.PsiDocTag;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Gregory.Shrago
- */
-public class PsiDocTagValueManipulator extends AbstractElementManipulator<PsiDocTag> {
-
- @Override
- public PsiDocTag handleContentChange(@NotNull PsiDocTag tag, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
- final StringBuilder replacement = new StringBuilder( tag.getText() );
-
- replacement.replace(
- range.getStartOffset(),
- range.getEndOffset(),
- newContent
- );
- return (PsiDocTag)tag.replace(JavaPsiFacade.getInstance(tag.getProject()).getElementFactory().createDocTagFromText(replacement.toString()));
- }
-
- @NotNull
- @Override
- public TextRange getRangeInElement(@NotNull final PsiDocTag tag) {
- final PsiElement[] elements = tag.getDataElements();
- if (elements.length == 0) {
- final PsiElement name = tag.getNameElement();
- final int offset = name.getStartOffsetInParent() + name.getTextLength();
- return new TextRange(offset, offset);
- }
- final PsiElement first = elements[0];
- final PsiElement last = elements[elements.length - 1];
- return new TextRange(first.getStartOffsetInParent(), last.getStartOffsetInParent()+last.getTextLength());
- }
-} \ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java
deleted file mode 100644
index 9d9b1f1ce9e2..000000000000
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/StringLiteralManipulator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.resolve.reference.impl.manipulators;
-
-import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.*;
-import com.intellij.util.IncorrectOperationException;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author ven
- */
-public class StringLiteralManipulator extends AbstractElementManipulator<PsiLiteralExpression> {
- @Override
- public PsiLiteralExpression handleContentChange(@NotNull PsiLiteralExpression expr, @NotNull TextRange range, String newContent) throws IncorrectOperationException {
- String oldText = expr.getText();
- if (oldText.startsWith("\"")) {
- newContent = StringUtil.escapeStringCharacters(newContent);
- }
- else if (oldText.startsWith("'") && newContent.length() <= 1) {
- newContent = newContent.length() == 1 && newContent.charAt(0) == '\''? "\\'" : newContent;
- }
- else {
- throw new IncorrectOperationException("cannot handle content change for: " + oldText + ", expr: " + expr);
- }
-
- String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset());
- final PsiExpression newExpr = JavaPsiFacade.getInstance(expr.getProject()).getElementFactory().createExpressionFromText(newText, null);
- return (PsiLiteralExpression)expr.replace(newExpr);
- }
-
- @NotNull
- @Override
- public TextRange getRangeInElement(@NotNull final PsiLiteralExpression element) {
- return getValueRange(element);
- }
-
- public static TextRange getValueRange(PsiLiteralExpression element) {
- final Object value = element.getValue();
- if (!(value instanceof String || value instanceof Character)) return TextRange.from(0, element.getTextLength());
- return new TextRange(1, Math.max(1, element.getTextLength() - 1));
- }
-}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java
deleted file mode 100644
index 216dcddb351f..000000000000
--- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/GenericReferenceProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2000-2009 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.resolve.reference.impl.providers;
-
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiReferenceProvider;
-import com.intellij.psi.scope.PsiScopeProcessor;
-import com.intellij.psi.scope.util.PsiScopesUtil;
-
-/**
- * Created by IntelliJ IDEA.
- * User: ik
- * Date: 27.03.2003
- * Time: 17:23:43
- * To change this template use Options | File Templates.
- */
-public abstract class GenericReferenceProvider extends PsiReferenceProvider {
- private boolean mySoft = false;
-
- public void handleEmptyContext(PsiScopeProcessor processor, PsiElement position) {
- PsiScopesUtil.treeWalkUp(processor, position, null);
- }
-
- public void setSoft(boolean softFlag) {
- mySoft = softFlag;
- }
-
- public boolean isSoft() {
- return mySoft;
- }
-}