Skip to content

Commit aeeb6f3

Browse files
authored
Merge pull request #322 from cedricziel/cleanups
2 parents b549550 + 0f50b62 commit aeeb6f3

File tree

44 files changed

+108
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+108
-160
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.cedricziel.idea.typo3;
2+
3+
import com.intellij.spellchecker.BundledDictionaryProvider;
4+
5+
public class TYPO3DictionaryProvider implements BundledDictionaryProvider {
6+
@Override
7+
public String[] getBundledDictionaries() {
8+
return new String[]{"typo3.dic"};
9+
}
10+
}

typo3-cms/src/main/java/com/cedricziel/idea/typo3/action/ExtbaseControllerActionAction.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void update(AnActionEvent event) {
7070
* @param event Carries information on the invocation place
7171
*/
7272
@Override
73-
public void actionPerformed(AnActionEvent event) {
73+
public void actionPerformed(@NotNull AnActionEvent event) {
7474
final Project project = getEventProject(event);
7575
if (project == null) {
7676
this.setStatus(event, false);
@@ -113,11 +113,10 @@ private void write(@NotNull Project project, PhpClass phpClass, String actionNam
113113

114114
@Override
115115
protected void run(@NotNull Result result) {
116-
final String methodName = actionName;
117116

118117
Method actionMethod = PhpPsiElementFactory.createMethod(
119118
project,
120-
"public function " + methodName + " () { \n" +
119+
"public function " + actionName + " () { \n" +
121120
"}\n"
122121

123122
);
@@ -130,7 +129,7 @@ protected void run(@NotNull Result result) {
130129
PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(editor.getDocument());
131130
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
132131

133-
final int insertPos = CodeUtil.getMethodInsertPosition(phpClass, methodName);
132+
final int insertPos = CodeUtil.getMethodInsertPosition(phpClass, actionName);
134133
if (insertPos == -1) {
135134
return;
136135
}
@@ -145,7 +144,7 @@ protected void run(@NotNull Result result) {
145144
CodeStyleManager.getInstance(project).reformatText(phpClass.getContainingFile(), insertPos, endPos);
146145
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
147146

148-
Method insertedMethod = phpClass.findMethodByName(methodName);
147+
Method insertedMethod = phpClass.findMethodByName(actionName);
149148
if (insertedMethod != null) {
150149
editor.getCaretModel().moveToOffset(insertedMethod.getTextRange().getStartOffset());
151150
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);

typo3-cms/src/main/java/com/cedricziel/idea/typo3/codeInsight/navigation/PathResourceGotoDeclarationHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private PsiElement[] emptyPsiElementArray() {
3939

4040
@Nullable
4141
@Override
42-
public String getActionText(DataContext context) {
42+
public String getActionText(@NotNull DataContext context) {
4343
return null;
4444
}
4545
}

typo3-cms/src/main/java/com/cedricziel/idea/typo3/codeInspection/quickfix/CreateInjectorQuickFix.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
public class CreateInjectorQuickFix implements LocalQuickFix {
3232

33-
private SmartPsiElementPointer element;
33+
private final SmartPsiElementPointer<PhpDocTag> element;
3434

3535
public CreateInjectorQuickFix(@NotNull PhpDocTag element) {
3636
this.element = SmartPointerManager.getInstance(element.getProject()).createSmartPsiElementPointer(element);

typo3-cms/src/main/java/com/cedricziel/idea/typo3/container/CoreServiceParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
public class CoreServiceParser {
2121

22-
private HashMap<String, ArrayList<TYPO3ServiceDefinition>> serviceMap;
22+
private final HashMap<String, ArrayList<TYPO3ServiceDefinition>> serviceMap;
2323

2424
public CoreServiceParser() {
2525
this.serviceMap = new HashMap<>();

typo3-cms/src/main/java/com/cedricziel/idea/typo3/contextApi/ContextReferenceContributor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar)
2222
);
2323
}
2424

25-
private class ContextReferenceProvider extends PsiReferenceProvider {
25+
private static class ContextReferenceProvider extends PsiReferenceProvider {
2626
@NotNull
2727
@Override
2828
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {

typo3-cms/src/main/java/com/cedricziel/idea/typo3/domain/TYPO3ServiceDefinition.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.jetbrains.annotations.NotNull;
44

55
import java.io.Serializable;
6+
import java.util.Objects;
67

78
public class TYPO3ServiceDefinition implements Serializable {
89

@@ -129,18 +130,18 @@ public boolean equals(Object o) {
129130
TYPO3ServiceDefinition that = (TYPO3ServiceDefinition) o;
130131

131132
if (!id.equals(that.id)) return false;
132-
if (extensionName != null ? !extensionName.equals(that.extensionName) : that.extensionName != null)
133+
if (!Objects.equals(extensionName, that.extensionName))
133134
return false;
134-
if (className != null ? !className.equals(that.className) : that.className != null) return false;
135-
if (title != null ? !title.equals(that.title) : that.title != null) return false;
136-
if (description != null ? !description.equals(that.description) : that.description != null) return false;
137-
if (subType != null ? !subType.equals(that.subType) : that.subType != null) return false;
138-
if (available != null ? !available.equals(that.available) : that.available != null) return false;
139-
if (priority != null ? !priority.equals(that.priority) : that.priority != null) return false;
140-
if (quality != null ? !quality.equals(that.quality) : that.quality != null) return false;
141-
if (os != null ? !os.equals(that.os) : that.os != null) return false;
142-
if (exec != null ? !exec.equals(that.exec) : that.exec != null) return false;
143-
return signature != null ? signature.equals(that.signature) : that.signature == null;
135+
if (!Objects.equals(className, that.className)) return false;
136+
if (!Objects.equals(title, that.title)) return false;
137+
if (!Objects.equals(description, that.description)) return false;
138+
if (!Objects.equals(subType, that.subType)) return false;
139+
if (!Objects.equals(available, that.available)) return false;
140+
if (!Objects.equals(priority, that.priority)) return false;
141+
if (!Objects.equals(quality, that.quality)) return false;
142+
if (!Objects.equals(os, that.os)) return false;
143+
if (!Objects.equals(exec, that.exec)) return false;
144+
return Objects.equals(signature, that.signature);
144145
}
145146

146147
@Override

typo3-cms/src/main/java/com/cedricziel/idea/typo3/domain/factory/ExtensionDefinitionFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private static boolean isValidPackageType(String composerPackageType) {
134134
* Guesses an extension key from the composer package name.
135135
*
136136
* @param packageName The package name to analyze
137-
* @return
137+
* @return The extension key
138138
*/
139139
private static String extensionKeyFromPackageName(String packageName) {
140140

typo3-cms/src/main/java/com/cedricziel/idea/typo3/extbase/ExtbaseUtils.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
public class ExtbaseUtils {
1919
public static final String EXTBASE_ABSTRACT_ENTITY_FQN = "TYPO3\\CMS\\Extbase\\DomainObject\\AbstractEntity";
2020

21-
public static String EXTBASE_QUERY_INTERFACE_FQN = "TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface";
21+
public static final String EXTBASE_QUERY_INTERFACE_FQN = "TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface";
2222

23-
public static String[] EXTBASE_QUERY_BUILDER_METHODS = {
23+
public static final String[] EXTBASE_QUERY_BUILDER_METHODS = {
2424
"equals",
2525
"like",
2626
"contains",
@@ -50,9 +50,7 @@ public static PhpClass getBaseRepositoryClass(@NotNull Project project) {
5050
return null;
5151
}
5252

53-
PhpClass repositoryClass = iterator.next();
54-
55-
return repositoryClass;
53+
return iterator.next();
5654
}
5755

5856
public static boolean isRepositoryClass(@NotNull PhpClass phpClass) {

typo3-cms/src/main/java/com/cedricziel/idea/typo3/extbase/persistence/ExtbaseModelCollectionReturnTypeProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.jetbrains.php.lang.psi.resolve.types.PhpType;
1414
import com.jetbrains.php.lang.psi.resolve.types.PhpTypeProvider4;
1515
import org.apache.commons.lang.StringUtils;
16+
import org.jetbrains.annotations.NotNull;
1617
import org.jetbrains.annotations.Nullable;
1718

1819
import java.util.ArrayList;
@@ -180,7 +181,7 @@ public MethodReturnTypeVisitor() {
180181
}
181182

182183
@Override
183-
public void visitElement(PsiElement element) {
184+
public void visitElement(@NotNull PsiElement element) {
184185
super.visitElement(element);
185186

186187
if (PlatformPatterns.psiElement(FieldReference.class).withParent(PhpReturn.class).accepts(element)) {

0 commit comments

Comments
 (0)