mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 16:57:49 +08:00
Cleanup code_samples JavaDocs
This commit is contained in:
parent
09c3ed4620
commit
5942892ddb
@ -14,8 +14,8 @@ import icons.SdkIcons;
|
||||
public class CustomDefaultActionGroup extends DefaultActionGroup {
|
||||
|
||||
/**
|
||||
* Given CustomDefaultActionGroup is derived from ActionGroup, in this context
|
||||
* update() determines whether the action group itself should be enabled or disabled.
|
||||
* Given {@link CustomDefaultActionGroup} is derived from {@link com.intellij.openapi.actionSystem.ActionGroup},
|
||||
* in this context {@code update()} determines whether the action group itself should be enabled or disabled.
|
||||
* 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.
|
||||
|
@ -9,11 +9,10 @@ import icons.SdkIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Demonstrates adding an action group to a menu statically in plugin.xml, and then creating a menu item
|
||||
* within the group at runtime. See plugin.xml for the declaration of DynamicActionGroup,
|
||||
* and note the group declaration does not contain an action.
|
||||
* DynamicActionGroup is based on ActionGroup because menu children are determined
|
||||
* on rules other than just positional constraints.
|
||||
* Demonstrates adding an action group to a menu statically in plugin.xml, and then creating a menu item within
|
||||
* 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
|
||||
* children are determined on rules other than just positional constraints.
|
||||
*
|
||||
* @see ActionGroup
|
||||
*/
|
||||
@ -23,8 +22,8 @@ public class DynamicActionGroup extends ActionGroup {
|
||||
* Returns an array of menu actions for the group.
|
||||
*
|
||||
* @param e Event received when the associated group-id menu is chosen.
|
||||
* @return AnAction[] An instance of AnAction, in this case containing a single instance of the
|
||||
* PopupDialogAction class.
|
||||
* @return AnAction[] An instance of {@link AnAction}, in this case containing a single instance of the
|
||||
* {@link PopupDialogAction} class.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
|
@ -22,9 +22,8 @@ import javax.swing.*;
|
||||
public class PopupDialogAction extends AnAction {
|
||||
|
||||
/**
|
||||
* This default constructor is used by the IntelliJ Platform framework to
|
||||
* instantiate this class based on plugin.xml declarations. Only needed in PopupDialogAction
|
||||
* class because a second constructor is overridden.
|
||||
* 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.
|
||||
*
|
||||
* @see AnAction#AnAction()
|
||||
*/
|
||||
@ -48,7 +47,7 @@ public class PopupDialogAction extends AnAction {
|
||||
/**
|
||||
* Gives the user feedback when the dynamic action menu is chosen.
|
||||
* Pops a simple message dialog. See the psi_demo plugin for an
|
||||
* example of how to use AnActionEvent to access data.
|
||||
* example of how to use {@link AnActionEvent} to access data.
|
||||
*
|
||||
* @param event Event received when the associated menu item is chosen.
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@ import java.util.StringTokenizer;
|
||||
import static com.siyeh.ig.psiutils.ExpressionUtils.isNullLiteral;
|
||||
|
||||
/**
|
||||
* Implements an inspection to detect when object references are compared using 'a==b' or 'a!=b'
|
||||
* Implements an inspection to detect when object references are compared using 'a==b' or 'a!=b'.
|
||||
* The quick fix converts these comparisons to 'a.equals(b) or '!a.equals(b)' respectively.
|
||||
*/
|
||||
public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspectionTool {
|
||||
@ -38,8 +38,7 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
/**
|
||||
* This method is called to get the panel describing the inspection.
|
||||
* It is called every time the user selects the inspection in preferences.
|
||||
* The user has the option to edit the list of CHECKED_CLASSES.
|
||||
* Adds a document listener to see if
|
||||
* The user has the option to edit the list of {@link #CHECKED_CLASSES}.
|
||||
*
|
||||
* @return panel to display inspection information.
|
||||
*/
|
||||
@ -57,8 +56,8 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is overridden to provide a custom visitor
|
||||
* that inspects expressions with relational operators '==' and '!='
|
||||
* This method is overridden to provide a custom visitor.
|
||||
* that inspects expressions with relational operators '==' and '!='.
|
||||
* The visitor must not be recursive and must be thread-safe.
|
||||
*
|
||||
* @param holder object for visitor to register problems found.
|
||||
@ -72,8 +71,8 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
return new JavaElementVisitor() {
|
||||
|
||||
/**
|
||||
* This string defines the short message shown to a user signaling the inspection
|
||||
* found a problem. It reuses a string from the inspections bundle.
|
||||
* This string defines the short message shown to a user signaling the inspection found a problem.
|
||||
* It reuses a string from the inspections bundle.
|
||||
*/
|
||||
@NonNls
|
||||
private final String DESCRIPTION_TEMPLATE = "SDK " +
|
||||
@ -82,21 +81,18 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
/**
|
||||
* Avoid defining visitors for both Reference and Binary expressions.
|
||||
*
|
||||
* @param psiReferenceExpression The expression to be evaluated.
|
||||
* @param psiReferenceExpression The expression to be evaluated.
|
||||
*/
|
||||
@Override
|
||||
public void visitReferenceExpression(PsiReferenceExpression psiReferenceExpression) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluate binary psi expressions to see if they contain
|
||||
* relational operators '==' and '!=', AND they contain
|
||||
* classes contained in CHECKED_CLASSES. The evaluation
|
||||
* ignores expressions comparing an object to null.
|
||||
* IF this criteria is met, add the expression to the
|
||||
* problems list.
|
||||
* Evaluate binary psi expressions to see if they contain relational operators '==' and '!=', AND they contain
|
||||
* classes contained in CHECKED_CLASSES. The evaluation ignores expressions comparing an object to null.
|
||||
* IF this criteria is met, add the expression to the problems list.
|
||||
*
|
||||
* @param expression The binary expression to be evaluated.
|
||||
* @param expression The binary expression to be evaluated.
|
||||
*/
|
||||
@Override
|
||||
public void visitBinaryExpression(PsiBinaryExpression expression) {
|
||||
@ -123,9 +119,9 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
/**
|
||||
* Verifies the input is the correct {@code PsiType} for this inspection.
|
||||
*
|
||||
* @param type The {@code PsiType} to be examined for a match
|
||||
* @return {@code true} if input is {@code PsiClassType} and matches
|
||||
* one of the classes in the CHECKED_CLASSES list.
|
||||
* @param type The {@code PsiType} to be examined for a match
|
||||
* @return {@code true} if input is {@code PsiClassType} and matches one of the classes
|
||||
* in the {@link ComparingReferencesInspection#CHECKED_CLASSES} list.
|
||||
*/
|
||||
private boolean isCheckedType(PsiType type) {
|
||||
if (!(type instanceof PsiClassType)) {
|
||||
@ -145,8 +141,8 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
}
|
||||
|
||||
/**
|
||||
* This class provides a solution to inspection problem expressions by manipulating
|
||||
* the PSI tree to use a.equals(b) instead of '==' or '!='
|
||||
* This class provides a solution to inspection problem expressions by manipulating the PSI tree to use 'a.equals(b)'
|
||||
* instead of '==' or '!='.
|
||||
*/
|
||||
private static class CriQuickFix implements LocalQuickFix {
|
||||
|
||||
@ -163,8 +159,7 @@ public class ComparingReferencesInspection extends AbstractBaseJavaLocalInspecti
|
||||
}
|
||||
|
||||
/**
|
||||
* This method manipulates the PSI tree to replace 'a==b' with 'a.equals(b)
|
||||
* or 'a!=b' with '!a.equals(b)'
|
||||
* This method manipulates the PSI tree to replace 'a==b' with 'a.equals(b)' or 'a!=b' with '!a.equals(b)'.
|
||||
*
|
||||
* @param project The project that contains the file being edited.
|
||||
* @param descriptor A problem found by this inspection.
|
||||
|
@ -11,13 +11,13 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* Class for testing ComparingReferencesInspection.
|
||||
* Requires idea.home.path to be set in build.gradle
|
||||
* Requires {@code idea.home.path} to be set in build.gradle.
|
||||
* doTest() does the work for individual test cases.
|
||||
*/
|
||||
public class ComparingReferencesInspectionTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
/**
|
||||
* Defines path to files used for running tests
|
||||
* Defines path to files used for running tests.
|
||||
*
|
||||
* @return The path from this module's root directory ($MODULE_WORKING_DIR$) to the
|
||||
* directory containing files for these tests.
|
||||
@ -50,14 +50,14 @@ public class ComparingReferencesInspectionTest extends LightJavaCodeInsightFixtu
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the "==" case
|
||||
* Test the '==' case.
|
||||
*/
|
||||
public void testRelationalEq() {
|
||||
doTest("Eq");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the "!=" case
|
||||
* Test the '!=' case.
|
||||
*/
|
||||
public void testRelationalNeq() {
|
||||
doTest("Neq");
|
||||
|
@ -15,14 +15,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Implements an intention action to replace a ternary statement with if-then-else
|
||||
* Implements an intention action to replace a ternary statement with if-then-else.
|
||||
*/
|
||||
@NonNls
|
||||
public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction implements IntentionAction {
|
||||
|
||||
/**
|
||||
* If this action is applicable, returns the text to be shown in the list of
|
||||
* intention actions available.
|
||||
* If this action is applicable, returns the text to be shown in the list of intention actions available.
|
||||
*/
|
||||
@NotNull
|
||||
public String getText() {
|
||||
@ -30,8 +29,8 @@ public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns text for name of this family of intentions. It is used to externalize
|
||||
* "auto-show" state of intentions.
|
||||
* Returns text for name of this family of intentions.
|
||||
* It is used to externalize "auto-show" state of intentions.
|
||||
* It is also the directory name for the descriptions.
|
||||
*
|
||||
* @return the intention family name.
|
||||
@ -42,20 +41,17 @@ public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this intention is available at the caret offset in file - the caret
|
||||
* must sit just before a "?" character in a ternary statement. If this condition is met,
|
||||
* this intention's entry is shown in the available intentions list.
|
||||
* <p>
|
||||
* Note: this method must do its checks quickly and return.
|
||||
* Checks whether this intention is available at the caret offset in file - the caret must sit just before a "?"
|
||||
* character in a ternary statement. If this condition is met, this intention's entry is shown in the available
|
||||
* intentions list.
|
||||
*
|
||||
* <p>Note: this method must do its checks quickly and return.</p>
|
||||
*
|
||||
* @param project a reference to the Project object being edited.
|
||||
* @param editor a reference to the object editing the project source
|
||||
* @param element a reference to the PSI element currently under the caret
|
||||
* @return <ul>
|
||||
* <li> true if the caret is in a literal string element, so this functionality
|
||||
* should be added to the intention menu.</li>
|
||||
* <li> false for all other types of caret positions</li>
|
||||
* </ul>
|
||||
* @return {@code true} if the caret is in a literal string element, so this functionality should be added to the
|
||||
* intention menu or {@code false} for all other types of caret positions
|
||||
*/
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, @Nullable PsiElement element) {
|
||||
// Quick sanity check
|
||||
@ -82,9 +78,8 @@ public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction
|
||||
|
||||
/**
|
||||
* 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. Called when user selects this intention action
|
||||
* from the available intentions list.
|
||||
* 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.
|
||||
*
|
||||
* @param project a reference to the Project object being edited.
|
||||
* @param editor a reference to the object editing the project source
|
||||
@ -195,13 +190,10 @@ public class ConditionalOperatorConverter extends PsiElementBaseIntentionAction
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates this intention action expects the Psi framework to provide the write action
|
||||
* context for any changes.
|
||||
* Indicates this intention action expects the Psi framework to provide the write action context for any changes.
|
||||
*
|
||||
* @return <ul>
|
||||
* <li> true if the intention requires a write action context to be provided</li>
|
||||
* <li> false if this intention action will start a write action</li>
|
||||
* </ul>
|
||||
* @return {@code true} if the intention requires a write action context to be provided or {@code false} if this
|
||||
* intention action will start a write action
|
||||
*/
|
||||
public boolean startInWriteAction() {
|
||||
return true;
|
||||
|
@ -8,9 +8,9 @@ import org.junit.Assert;
|
||||
public class ConditionalOperatorConverterTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
/**
|
||||
* Defines path to files used for running tests
|
||||
* Defines path to files used for running tests.
|
||||
*
|
||||
* @return The path from this module's root directory ($MODULE_WORKING_DIR$) to the
|
||||
* @return The path from this module's root directory ({@code $MODULE_WORKING_DIR$}) to the
|
||||
* directory containing files for these tests.
|
||||
*/
|
||||
@Override
|
||||
|
@ -11,10 +11,9 @@ import com.intellij.openapi.ui.Messages;
|
||||
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 com.intellij.openapi.actionSystem.AnAction
|
||||
* @see AnAction
|
||||
*/
|
||||
public class EditorAreaIllustration extends AnAction {
|
||||
|
||||
@ -42,8 +41,10 @@ public class EditorAreaIllustration extends AnAction {
|
||||
|
||||
/**
|
||||
* Sets visibility and enables this action menu item if:
|
||||
* A project is open,
|
||||
* An editor is active,
|
||||
* <ul>
|
||||
* <li>a project is open</li>
|
||||
* <li>an editor is active</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param e Event related to this action
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Menu action to clone a new caret based on an existing one.
|
||||
*
|
||||
* @see com.intellij.openapi.actionSystem.AnAction
|
||||
* @see AnAction
|
||||
*/
|
||||
public class EditorHandlerIllustration extends AnAction {
|
||||
|
||||
@ -39,9 +39,11 @@ public class EditorHandlerIllustration extends AnAction {
|
||||
|
||||
/**
|
||||
* Enables and sets visibility of this action menu item if:
|
||||
* A project is open,
|
||||
* An editor is active,
|
||||
* At least one caret exists
|
||||
* <ul>
|
||||
* <li>a project is open</li>
|
||||
* <li>an editor is active</li>
|
||||
* <li>at least one caret exists</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param e Event related to this action
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Menu action to replace a selection of characters with a fixed string.
|
||||
*
|
||||
* @see com.intellij.openapi.actionSystem.AnAction
|
||||
* @see AnAction
|
||||
*/
|
||||
public class EditorIllustrationAction extends AnAction {
|
||||
|
||||
@ -46,9 +46,11 @@ public class EditorIllustrationAction extends AnAction {
|
||||
|
||||
/**
|
||||
* Sets visibility and enables this action menu item if:
|
||||
* A project is open,
|
||||
* An editor is active,
|
||||
* Some characters are selected
|
||||
* <ul>
|
||||
* <li>a project is open</li>
|
||||
* <li>an editor is active</li>
|
||||
* <li>some characters are selected</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param e Event related to this action
|
||||
*/
|
||||
|
@ -11,8 +11,7 @@ import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This is a custom TypedHandlerDelegate that handles actions activated
|
||||
* keystrokes in the editor.
|
||||
* This is a custom {@link TypedHandlerDelegate} that handles actions activated keystrokes in the editor.
|
||||
* The execute method inserts a fixed string at Offset 0 of the document.
|
||||
* Document changes are made in the context of a write action.
|
||||
*/
|
||||
|
@ -34,8 +34,7 @@ public class DemoFacetConfiguration implements FacetConfiguration, PersistentSta
|
||||
|
||||
/**
|
||||
* Called by the IntelliJ Platform when this facet's state is loaded.
|
||||
* The method can and will be called several times, if
|
||||
* config files were externally changed while IDEA running.
|
||||
* The method can and will be called several times, if config files were externally changed while IDEA running.
|
||||
*/
|
||||
@Override
|
||||
public void loadState(@NotNull DemoFacetState state) {
|
||||
@ -47,7 +46,7 @@ public class DemoFacetConfiguration implements FacetConfiguration, PersistentSta
|
||||
*
|
||||
* @param context The context in which a facet is being added/deleted, or modified.
|
||||
* @param manager The manager which can be used to access custom validators.
|
||||
* @return Array of DemoFacetEditorTabs. In this case size is always 1.
|
||||
* @return Array of {@link DemoFacetEditorTab}. In this case size is always 1.
|
||||
*/
|
||||
@Override
|
||||
public FacetEditorTab[] createEditorTabs(FacetEditorContext context, FacetValidatorsManager manager) {
|
||||
|
@ -24,13 +24,11 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
private final JTextField myPath;
|
||||
|
||||
/**
|
||||
* Only org.intellij.sdk.facet.DemoFacetState is captured so it can be updated per user changes
|
||||
* in the EditorTab.
|
||||
* Only org.intellij.sdk.facet.DemoFacetState is captured so it can be updated per user changes in the EditorTab.
|
||||
*
|
||||
* @param state org.intellij.sdk.facet.DemoFacetState object persisting org.intellij.sdk.facet.DemoFacet state.
|
||||
* @param state {@link DemoFacetState} object persisting {@link DemoFacet} state.
|
||||
* @param context Facet editor context, can be used to get e.g. the current project module.
|
||||
* @param validator Facet validator manager, can be used to get and apply a custom validator for
|
||||
* this facet.
|
||||
* @param validator Facet validator manager, can be used to get and apply a custom validator for this facet.
|
||||
*/
|
||||
public DemoFacetEditorTab(@NotNull DemoFacetState state, @NotNull FacetEditorContext context,
|
||||
@NotNull FacetValidatorsManager validator) {
|
||||
@ -39,9 +37,9 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the JPanel displayed in the Preferences | Facet UI
|
||||
* Provides the {@link JPanel} displayed in the Preferences | Facet UI
|
||||
*
|
||||
* @return JPanel to be displayed in the org.intellij.sdk.facet.DemoFacetEditorTab.
|
||||
* @return {@link JPanel} to be displayed in the {@link DemoFacetEditorTab}.
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
@ -54,7 +52,6 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
return facetPanel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the name of this facet for display in this editor tab.
|
||||
*/
|
||||
@ -65,12 +62,10 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the facet state entered in the UI differs
|
||||
* from the currently stored state.
|
||||
* Called when user changes text in myPath.
|
||||
* Determines if the facet state entered in the UI differs from the currently stored state.
|
||||
* Called when user changes text in {@link #myPath}.
|
||||
*
|
||||
* @return {@code true} if the state returned from the panel's UI
|
||||
* differs from the stored facet state.
|
||||
* @return {@code true} if the state returned from the panel's UI differs from the stored facet state.
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
@ -80,6 +75,7 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
/**
|
||||
* Stores new facet state (text) entered by the user.
|
||||
* Called when {@link #isModified()} returns true.
|
||||
*
|
||||
* @throws ConfigurationException if anything generates an exception.
|
||||
*/
|
||||
@Override
|
||||
@ -94,7 +90,7 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies current org.intellij.sdk.facet.DemoFacetState into the myPath UI element.
|
||||
* Copies current {@link DemoFacetState} into the {@link #myPath} UI element.
|
||||
* This method is called each time this editor tab is needed for display.
|
||||
*/
|
||||
@Override
|
||||
|
@ -27,5 +27,4 @@ public class DemoFacetState {
|
||||
myPathToSdk = newPath;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Defines the type, id, and name of the {@link DemoFacet}. Provides creation of DemoFacet
|
||||
* and associated Configuration.
|
||||
* Allows application of this facet to all ModuleTypes.
|
||||
* Defines the type, id, and name of the {@link DemoFacet}.
|
||||
* Provides creation of {@link DemoFacet} and associated Configuration.
|
||||
* Allows application of this facet to all {@link ModuleType} instances.
|
||||
*/
|
||||
public class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {
|
||||
|
||||
|
@ -9,12 +9,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class DemoCodeInspection extends LocalInspectionTool {
|
||||
|
||||
/**
|
||||
* This method is overridden to provide a custom visitor
|
||||
* This method is overridden to provide a custom visitor.
|
||||
* The visitor must not be recursive and must be thread-safe.
|
||||
*
|
||||
* @param holder object for visitor to register problems found.
|
||||
* @param isOnTheFly true if inspection was run in non-batch mode
|
||||
* @return DemoInspectionVisitor.
|
||||
* @return {@link DemoInspectionVisitor} instance
|
||||
*/
|
||||
@NotNull
|
||||
@Override
|
||||
|
@ -3,14 +3,18 @@
|
||||
package org.intellij.sdk.maxOpenProjects;
|
||||
|
||||
/**
|
||||
* Application service implementation to keep a running count of
|
||||
* how many projects are open at a given time.
|
||||
* Application service implementation to keep a running count of how many projects are open at a given time.
|
||||
*/
|
||||
public class ProjectCountingService {
|
||||
|
||||
// Sets the maximum allowed number of opened projects.
|
||||
/**
|
||||
* Sets the maximum allowed number of opened projects.
|
||||
*/
|
||||
private final static int MAX_OPEN_PRJ_LIMIT = 3;
|
||||
// The count of open projects must always be >= 0
|
||||
|
||||
/**
|
||||
* The count of open projects must always be >= 0.
|
||||
*/
|
||||
private int myOpenProjectCount = 0;
|
||||
|
||||
public void incrProjectCount() {
|
||||
|
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Listener to detect project open and close.
|
||||
* Depends on org.intellij.sdk.maxOpenProjects.ProjectCountingService
|
||||
* Depends on {@link ProjectCountingService}
|
||||
*/
|
||||
public class ProjectOpenCloseListener implements ProjectManagerListener {
|
||||
|
||||
|
@ -18,8 +18,7 @@ public class PopupDialogAction extends AnAction {
|
||||
|
||||
/**
|
||||
* Gives the user feedback when the dynamic action menu is chosen.
|
||||
* Pops a simple message dialog. See the psi_demo plugin for an
|
||||
* example of how to use AnActionEvent to access data.
|
||||
* Pops a simple message dialog. See the psi_demo plugin for an example of how to use AnActionEvent to access data.
|
||||
*
|
||||
* @param event Event received when the associated menu item is chosen.
|
||||
*/
|
||||
|
@ -120,7 +120,6 @@ public class ImagesProjectNode extends AbstractTreeNode<VirtualFile> {
|
||||
data.setPresentableText(getValue().getName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canNavigate() {
|
||||
return !getValue().isDirectory();
|
||||
|
@ -9,6 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DemoConfigurationFactory extends ConfigurationFactory {
|
||||
|
||||
private static final String FACTORY_NAME = "Demo configuration factory";
|
||||
|
||||
protected DemoConfigurationFactory(ConfigurationType type) {
|
||||
@ -32,4 +33,5 @@ public class DemoConfigurationFactory extends ConfigurationFactory {
|
||||
public Class<? extends BaseState> getOptionsClass() {
|
||||
return DemoRunConfigurationOptions.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DemoRunConfiguration extends RunConfigurationBase<DemoRunConfigurationOptions> {
|
||||
|
||||
protected DemoRunConfiguration(Project project, ConfigurationFactory factory, String name) {
|
||||
super(project, factory, name);
|
||||
}
|
||||
@ -58,4 +59,5 @@ public class DemoRunConfiguration extends RunConfigurationBase<DemoRunConfigurat
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.intellij.execution.configurations.RunConfigurationOptions;
|
||||
import com.intellij.openapi.components.StoredProperty;
|
||||
|
||||
public class DemoRunConfigurationOptions extends RunConfigurationOptions {
|
||||
|
||||
private final StoredProperty<String> myScriptName = string("").provideDelegate(this, "scriptName");
|
||||
|
||||
public String getScriptName() {
|
||||
@ -15,4 +16,5 @@ public class DemoRunConfigurationOptions extends RunConfigurationOptions {
|
||||
public void setScriptName(String scriptName) {
|
||||
myScriptName.setValue(this, scriptName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
|
||||
public class DemoRunConfigurationType implements ConfigurationType {
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
@ -36,4 +37,5 @@ public class DemoRunConfigurationType implements ConfigurationType {
|
||||
public ConfigurationFactory[] getConfigurationFactories() {
|
||||
return new ConfigurationFactory[]{new DemoConfigurationFactory(this)};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
|
||||
public class DemoSettingsEditor extends SettingsEditor<DemoRunConfiguration> {
|
||||
|
||||
private JPanel myPanel;
|
||||
private LabeledComponent<TextFieldWithBrowseButton> myScriptName;
|
||||
|
||||
@ -33,4 +34,5 @@ public class DemoSettingsEditor extends SettingsEditor<DemoRunConfiguration> {
|
||||
myScriptName = new LabeledComponent<>();
|
||||
myScriptName.setComponent(new TextFieldWithBrowseButton());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Supports creating and managing a JPanel for the Settings Dialog.
|
||||
* Supports creating and managing a {@link JPanel} for the Settings Dialog.
|
||||
*/
|
||||
public class AppSettingsComponent {
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Supports storing the application settings in a persistent way.
|
||||
* The State and Storage annotations define the name of the data and the file name where
|
||||
* The {@link State} and {@link Storage} annotations define the name of the data and the file name where
|
||||
* these persistent application settings are stored.
|
||||
*/
|
||||
@State(
|
||||
|
@ -25,7 +25,6 @@ public class SimpleCodeStyleSettingsProvider extends CodeStyleSettingsProvider {
|
||||
return "Simple";
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public CodeStyleConfigurable createConfigurable(@NotNull CodeStyleSettings settings, @NotNull CodeStyleSettings modelSettings) {
|
||||
return new CodeStyleAbstractConfigurable(settings, modelSettings, this.getConfigurableDisplayName()) {
|
||||
|
@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Note: This class is only used with the fileTypeFactory extension point
|
||||
* for versions of the IntelliJ Platform prior to v2019.2
|
||||
* for versions of the IntelliJ Platform prior to v2019.2.
|
||||
*/
|
||||
public class SimpleFileTypeFactory extends FileTypeFactory {
|
||||
|
||||
|
@ -18,7 +18,13 @@ import java.util.List;
|
||||
|
||||
public class SimpleUtil {
|
||||
|
||||
// Searches the entire project for Simple language files with instances of the Simple property with the given key
|
||||
/**
|
||||
* Searches the entire project for Simple language files with instances of the Simple property with the given key.
|
||||
*
|
||||
* @param project current project
|
||||
* @param key to check
|
||||
* @return matching properties
|
||||
*/
|
||||
public static List<SimpleProperty> findProperties(Project project, String key) {
|
||||
List<SimpleProperty> result = new ArrayList<>();
|
||||
Collection<VirtualFile> virtualFiles =
|
||||
|
@ -20,7 +20,6 @@ import java.util.List;
|
||||
public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
/**
|
||||
*
|
||||
* @return path to test data file directory relative to working directory in the run configuration for this test.
|
||||
*/
|
||||
@Override
|
||||
@ -84,4 +83,5 @@ public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
PsiElement element = myFixture.getFile().findElementAt(myFixture.getCaretOffset()).getParent();
|
||||
assertEquals("https://en.wikipedia.org/", ((SimpleProperty) element.getReferences()[0].resolve()).getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ package org.intellij.sdk.language;
|
||||
import com.intellij.testFramework.ParsingTestCase;
|
||||
|
||||
public class SimpleParsingTest extends ParsingTestCase {
|
||||
|
||||
public SimpleParsingTest() {
|
||||
super("", "simple", new SimpleParserDefinition());
|
||||
}
|
||||
@ -14,7 +15,6 @@ public class SimpleParsingTest extends ParsingTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return path to test data file directory relative to root of this module.
|
||||
*/
|
||||
@Override
|
||||
@ -31,4 +31,5 @@ public class SimpleParsingTest extends ParsingTestCase {
|
||||
protected boolean includeRanges() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MyToolWindowFactory implements ToolWindowFactory {
|
||||
|
||||
// Create the tool window content.
|
||||
/**
|
||||
* Create the tool window content.
|
||||
*
|
||||
* @param project current project
|
||||
* @param toolWindow current tool window
|
||||
*/
|
||||
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
|
||||
MyToolWindow myToolWindow = new MyToolWindow(toolWindow);
|
||||
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
|
||||
|
Loading…
x
Reference in New Issue
Block a user