mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
code samples: cleanup
This commit is contained in:
parent
c02301a869
commit
316a58e200
@ -26,7 +26,6 @@ public class CustomDefaultActionGroup extends DefaultActionGroup {
|
|||||||
* Requires an editor to be active in order to enable the group functionality.
|
* Requires an editor to be active in order to enable the group functionality.
|
||||||
*
|
*
|
||||||
* @param event Event received when the associated group-id menu is chosen.
|
* @param event Event received when the associated group-id menu is chosen.
|
||||||
* @see com.intellij.openapi.actionSystem.AnAction#update(AnActionEvent)
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(AnActionEvent event) {
|
public void update(AnActionEvent event) {
|
||||||
|
@ -13,8 +13,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
* the group at runtime. See plugin.xml for the declaration of {@link DynamicActionGroup}, and note the group
|
* the group at runtime. See plugin.xml for the declaration of {@link DynamicActionGroup}, and note the group
|
||||||
* declaration does not contain an action. {@link DynamicActionGroup} is based on {@link ActionGroup} because menu
|
* declaration does not contain an action. {@link DynamicActionGroup} is based on {@link ActionGroup} because menu
|
||||||
* children are determined on rules other than just positional constraints.
|
* children are determined on rules other than just positional constraints.
|
||||||
*
|
|
||||||
* @see ActionGroup
|
|
||||||
*/
|
*/
|
||||||
public class DynamicActionGroup extends ActionGroup {
|
public class DynamicActionGroup extends ActionGroup {
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@ public class PopupDialogAction extends AnAction {
|
|||||||
/**
|
/**
|
||||||
* This default constructor is used by the IntelliJ Platform framework to instantiate this class based on plugin.xml
|
* This default constructor is used by the IntelliJ Platform framework to instantiate this class based on plugin.xml
|
||||||
* declarations. Only needed in {@link PopupDialogAction} class because a second constructor is overridden.
|
* declarations. Only needed in {@link PopupDialogAction} class because a second constructor is overridden.
|
||||||
*
|
|
||||||
* @see AnAction#AnAction()
|
|
||||||
*/
|
*/
|
||||||
public PopupDialogAction() {
|
public PopupDialogAction() {
|
||||||
super();
|
super();
|
||||||
|
@ -28,7 +28,6 @@ final class ComparingStringReferencesInspection extends AbstractBaseJavaLocalIns
|
|||||||
* @param holder object for the visitor to register problems found
|
* @param holder object for the visitor to register problems found
|
||||||
* @param isOnTheFly true if inspection was run in non-batch mode
|
* @param isOnTheFly true if inspection was run in non-batch mode
|
||||||
* @return non-null visitor for this inspection
|
* @return non-null visitor for this inspection
|
||||||
* @see JavaElementVisitor
|
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
@ -139,5 +138,7 @@ final class ComparingStringReferencesInspection extends AbstractBaseJavaLocalIns
|
|||||||
public String getFamilyName() {
|
public String getFamilyName() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
Extend the IntelliJ Platform local inspection type and connect it to the implementation class in this plugin.
|
Extend the IntelliJ Platform local inspection type and connect it to the implementation class in this plugin.
|
||||||
<localInspection> type element is applied within the scope of a file under edit.
|
<localInspection> type element is applied within the scope of a file under edit.
|
||||||
It is preferred over <inspectionToolProvider>
|
It is preferred over <inspectionToolProvider>
|
||||||
@see intellij.platform.resources.LangExtensionPoints
|
|
||||||
@see com.intellij.codeInspection.InspectionProfileEntry
|
@see com.intellij.codeInspection.InspectionProfileEntry
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
|
@ -54,16 +54,15 @@ final class ConditionalOperatorConverter extends PsiElementBaseIntentionAction i
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies the Psi to change a ternary expression to an if-then-else statement.
|
* Modifies the PSI to change a ternary expression to an if-then-else statement.
|
||||||
* If the ternary is part of a declaration, the declaration is separated and moved above the if-then-else statement.
|
* If the ternary is part of a declaration, the declaration is separated and moved above the if-then-else statement.
|
||||||
* Called when user selects this intention action from the available intentions list.
|
* Called when user selects this intention action from the available intentions list.
|
||||||
*
|
*
|
||||||
* @param project a reference to the Project object being edited.
|
* @param project a reference to the Project object being edited.
|
||||||
* @param editor a reference to the object editing the project source
|
* @param editor a reference to the object editing the project source
|
||||||
* @param element a reference to the PSI element currently under the caret
|
* @param element a reference to the PSI element currently under the caret
|
||||||
* @throws IncorrectOperationException Thrown by underlying (Psi model) write action context
|
* @throws IncorrectOperationException Thrown by underlying (PSI model) write action context
|
||||||
* when manipulation of the psi tree fails.
|
* when manipulation of the PSI tree fails.
|
||||||
* @see ConditionalOperatorConverter#startInWriteAction()
|
|
||||||
*/
|
*/
|
||||||
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element)
|
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element)
|
||||||
throws IncorrectOperationException {
|
throws IncorrectOperationException {
|
||||||
@ -84,7 +83,7 @@ final class ConditionalOperatorConverter extends PsiElementBaseIntentionAction i
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep searching up the Psi Tree in case the ternary is part of a FOR statement.
|
// Keep searching up the PSI Tree in case the ternary is part of a FOR statement.
|
||||||
PsiElement originalStatement = PsiTreeUtil.getParentOfType(conditionalExpression, PsiStatement.class, false);
|
PsiElement originalStatement = PsiTreeUtil.getParentOfType(conditionalExpression, PsiStatement.class, false);
|
||||||
while (originalStatement instanceof PsiForStatement) {
|
while (originalStatement instanceof PsiForStatement) {
|
||||||
originalStatement = PsiTreeUtil.getParentOfType(originalStatement, PsiStatement.class, true);
|
originalStatement = PsiTreeUtil.getParentOfType(originalStatement, PsiStatement.class, true);
|
||||||
|
@ -13,8 +13,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If conditions support it, makes a menu visible to display information about the caret.
|
* If conditions support it, makes a menu visible to display information about the caret.
|
||||||
*
|
|
||||||
* @see AnAction
|
|
||||||
*/
|
*/
|
||||||
public class EditorAreaIllustration extends AnAction {
|
public class EditorAreaIllustration extends AnAction {
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu action to clone a new caret based on an existing one.
|
* Menu action to clone a new caret based on an existing one.
|
||||||
*
|
|
||||||
* @see AnAction
|
|
||||||
*/
|
*/
|
||||||
public class EditorHandlerIllustration extends AnAction {
|
public class EditorHandlerIllustration extends AnAction {
|
||||||
|
|
||||||
|
@ -15,8 +15,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu action to replace a selection of characters with a fixed string.
|
* Menu action to replace a selection of characters with a fixed string.
|
||||||
*
|
|
||||||
* @see AnAction
|
|
||||||
*/
|
*/
|
||||||
public class EditorIllustrationAction extends AnAction {
|
public class EditorIllustrationAction extends AnAction {
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ final class SimpleAnnotator implements Annotator {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the Psi element contains a string that starts with the prefix and separator
|
// Ensure the PSI element contains a string that starts with the prefix and separator
|
||||||
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
||||||
if (value == null || !value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR)) {
|
if (value == null || !value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR)) {
|
||||||
return;
|
return;
|
||||||
|
@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Please note, it is recommended to utilize the new DocumentationTarget API for
|
* TODO Please note, it is recommended to utilize the new DocumentationTarget API for
|
||||||
* plugins targeting IntelliJ Platform version 2023.1 or later.
|
* plugins targeting IntelliJ Platform version 2023.1 or later.
|
||||||
*
|
*
|
||||||
* @see <a href="https://plugins.jetbrains.com/docs/intellij/documentation.html">Documentation (IntelliJ Platform Docs)</a>
|
* @see <a href="https://plugins.jetbrains.com/docs/intellij/documentation.html">Documentation (IntelliJ Platform Docs)</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user