Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="consulo:run-desktop-awt" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<configuration default="false" name="consulo:run-desktop-awt-fork" type="MavenRunConfiguration" factoryName="Maven" singleton="true">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings">
Expand All @@ -14,7 +14,7 @@
<option name="passParentEnv" value="true" />
<option name="runMavenInBackground" value="true" />
<option name="skipTests" value="false" />
<option name="vmOptions" value="--add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.desktop/sun.swing=ALL-UNNAMED --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED --add-opens=java.desktop/sun.java2d=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED" />
<option name="vmOptions" value="" />
</MavenRunnerSettings>
</option>
<option name="myRunnerParameters">
Expand All @@ -24,7 +24,7 @@
</option>
<option name="goals">
<list>
<option value="consulo:run-desktop-awt" />
<option value="consulo:run-desktop-awt-fork" />
<option value="-pl" />
<option value=":consulo.java" />
</list>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,56 @@
import consulo.language.editor.inspection.LocalQuickFix;
import consulo.language.editor.inspection.ProblemDescriptor;
import consulo.language.editor.localize.CodeInsightLocalize;
import consulo.language.psi.SmartPointerManager;
import consulo.language.psi.SmartPsiElementPointer;
import consulo.language.util.IncorrectOperationException;
import consulo.localize.LocalizeValue;
import consulo.logging.Logger;
import consulo.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable;

/**
* @author yole
*/
public class RemoveAnnotationQuickFix implements LocalQuickFix {
private static final Logger LOG = Logger.getInstance(RemoveAnnotationQuickFix.class);
private final PsiAnnotation myAnnotation;
private final PsiModifierListOwner myListOwner;
private static final Logger LOG = Logger.getInstance(RemoveAnnotationQuickFix.class);
private final SmartPsiElementPointer<PsiAnnotation> myAnnotation;
private final SmartPsiElementPointer<PsiModifierListOwner> myListOwner;
private final boolean myRemoveInheritors;

public RemoveAnnotationQuickFix(PsiAnnotation annotation, final PsiModifierListOwner listOwner) {
myAnnotation = annotation;
myListOwner = listOwner;
}
public RemoveAnnotationQuickFix(@NotNull PsiAnnotation annotation, @Nullable PsiModifierListOwner listOwner) {
this(annotation, listOwner, false);
}

public RemoveAnnotationQuickFix(@NotNull PsiAnnotation annotation, @Nullable PsiModifierListOwner listOwner, boolean removeInheritors) {
Project project = annotation.getProject();
SmartPointerManager pm = SmartPointerManager.getInstance(project);
myAnnotation = pm.createSmartPsiElementPointer(annotation);
myListOwner = listOwner == null ? null : pm.createSmartPsiElementPointer(listOwner);
myRemoveInheritors = removeInheritors;
}

@Override
public LocalizeValue getName() {
return CodeInsightLocalize.removeAnnotation();
}
@Override
public LocalizeValue getName() {
return CodeInsightLocalize.removeAnnotation();
}

@Override
public void applyFix(Project project, ProblemDescriptor descriptor) {
if (myAnnotation.isPhysical()) {
try {
if (!FileModificationService.getInstance().preparePsiElementForWrite(myAnnotation)) return;
myAnnotation.delete();
} catch (IncorrectOperationException e) {
LOG.error(e);
}
} else {
ExternalAnnotationsManager.getInstance(project).deannotate(myListOwner, myAnnotation.getQualifiedName());
@Override
public void applyFix(Project project, ProblemDescriptor descriptor) {
if (myAnnotation.isPhysical()) {
try {
if (!FileModificationService.getInstance().preparePsiElementForWrite(myAnnotation)) {
return;
}
myAnnotation.delete();
}
catch (IncorrectOperationException e) {
LOG.error(e);
}
}
else {
ExternalAnnotationsManager.getInstance(project).deannotate(myListOwner, myAnnotation.getQualifiedName());
}
}
}
}
Loading
Loading