/** * Checks if it is possible to rename the element to the specified name, * and throws an exception if the rename is not possible. Does not actually modify anything. * * @param name the new name to check the renaming possibility for. * @throws IncorrectOperationException if the rename is not supported or not possible for some reason. */ @Override public void checkSetName(String name) throws IncorrectOperationException { throw new IncorrectOperationException(CAN_NOT_MODIFY_MESSAGE); }
@NotNull @Override public Shortcut[] getShortcut() { throw new IncorrectOperationException("see getActionIdForShortcut()"); }
/** * Renames the element. * * @param name the new element name. * @return the element corresponding to this element after the rename (either <code>this</code> * or a different element if the rename caused the element to be replaced). * @throws IncorrectOperationException if the modification is not supported or not possible for some reason. */ @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { throw new IncorrectOperationException("Cannot modify module name in Beam files"); }
/** * Renames the element. * * @param name the new element name. * @return the element corresponding to this element after the rename (either <code>this</code> * or a different element if the rename caused the element to be replaced). * @throws IncorrectOperationException if the modification is not supported or not possible for some reason. */ @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { throw new IncorrectOperationException(CAN_NOT_MODIFY_MESSAGE); }
/** * Renames the element. * * @param name the new element name. * @return the element corresponding to this element after the rename (either <code>this</code> * or a different element if the rename caused the element to be replaced). * @throws IncorrectOperationException if the modification is not supported or not possible for some reason. */ @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { throw new IncorrectOperationException("Cannot modify module name in Beam files"); }
throw new IncorrectOperationException("Cannot invoke fix with ambiguous imports on editor ()" + editor + ". Packages: " + packages);
@Nullable @Override public PerlNamespaceElement getNamespaceElement() { throw new IncorrectOperationException("should not"); }
@NotNull @Override public List<Sdk> getSdksOfType(@NotNull SdkTypeId type) { throw new IncorrectOperationException(); }
@Override public PerlHeredocTerminatorElement handleContentChange(@NotNull PerlHeredocTerminatorElement element, @NotNull TextRange range, String newContent) throws IncorrectOperationException { if (newContent.isEmpty()) { throw new IncorrectOperationException("You can't set heredoc terminator to the empty one"); } return (PerlHeredocTerminatorElement)((LeafPsiElement)element).replaceWithText(newContent); } }
@NotNull private ElementManipulator<BashFileReferenceImpl> getManipulator() { ElementManipulator<BashFileReferenceImpl> manipulator = ElementManipulators.getManipulator(element); if (manipulator == null) { throw new IncorrectOperationException("no implementation found to rename " + element); } return manipulator; }
@NotNull private ElementManipulator<AbstractBashCommand<?>> getManipulator() { ElementManipulator<AbstractBashCommand<?>> manipulator = ElementManipulators.<AbstractBashCommand<?>>getManipulator(cmd); if (manipulator == null) { throw new IncorrectOperationException("No element manipulator found for " + cmd); } return manipulator; }
@NotNull private ElementManipulator<AbstractBashCommand<?>> getManipulator() { ElementManipulator<AbstractBashCommand<?>> manipulator = ElementManipulators.<AbstractBashCommand<?>>getManipulator(cmd); if (manipulator == null) { throw new IncorrectOperationException("No element manipulator found for " + cmd); } return manipulator; }
@Override public PsiElement setName(@NotNull String name) throws IncorrectOperationException { if (name.isEmpty()) { throw new IncorrectOperationException("You can't set an empty method name"); } PsiElement nameIdentifier = getNameIdentifier(); if (nameIdentifier instanceof LeafPsiElement) { ((LeafPsiElement)nameIdentifier).replaceWithText(name); } return this; }
@Override public PsiElement setName(@NotNull String name) throws IncorrectOperationException { if (name.isEmpty()) { throw new IncorrectOperationException("You can't set an empty method name"); } PsiElement nameIdentifier = getNameIdentifier(); if (nameIdentifier != null) { ElementManipulators.handleContentChange(nameIdentifier, name); } return this; } }
@Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { if (element instanceof BashFunctionDef) { return handleElementRename(((BashFunctionDef) element).getName()); } throw new IncorrectOperationException("unsupported for element " + element); }
@Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { if (!HTML_MASON_IDENTIFIER_PATTERN.matcher(name).matches()) { throw new IncorrectOperationException("Incorrect HTML::Mason identifier"); } PsiElement nameIdentifier = getNameIdentifier(); if (nameIdentifier instanceof LeafPsiElement) { ((LeafPsiElement)nameIdentifier).replaceWithText(name); } return this; }
@Override public PerlNamespaceElement handleContentChange(@NotNull PerlNamespaceElement element, @NotNull TextRange range, String newContent) throws IncorrectOperationException { if (newContent.isEmpty()) { throw new IncorrectOperationException("You can't set empty package name"); } return (PerlNamespaceElement)((PerlNamespaceElementImpl)element).replaceWithText(range.replace(element.getText(), newContent)); }
public PsiElement bindToElement(@NotNull PsiElement targetElement) throws IncorrectOperationException { if (targetElement instanceof PsiFile) { //findRelativePath already leaves the injection host file PsiFile currentFile = BashPsiUtils.findFileContext(this.element); String relativeFilePath = BashPsiFileUtils.findRelativeFilePath(currentFile, (PsiFile) targetElement); return handleElementRename(relativeFilePath); } throw new IncorrectOperationException("Unsupported for element type " + targetElement); }
@Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { if (!BashIdentifierUtil.isValidHeredocIdentifier(newElementName)) {//fixme check the allowed character set for heredoc markers throw new IncorrectOperationException("Invalid name " + newElementName); } return BashPsiUtils.replaceElement(marker, createMarkerElement(newElementName)); }
public PsiElement setName(@NotNull @NonNls String newName) throws IncorrectOperationException { if (!BashIdentifierUtil.isValidNewVariableName(newName)) { throw new IncorrectOperationException("Invalid variable name"); } PsiElement original = findAssignmentWord(); PsiElement replacement = BashPsiElementFactory.createAssignmentWord(getProject(), newName); return BashPsiUtils.replaceElement(original, replacement); }