Skip to content

Commit 9ba47ad

Browse files
authored
Merge pull request #32 from nette-intellij/mn-fixed-deprecated-0-4-4
Mn fixed deprecated 0 4 4
2 parents 2195fc2 + 0423d9c commit 9ba47ad

File tree

10 files changed

+181
-170
lines changed

10 files changed

+181
-170
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
out/
2-
*.jar
2+
*.jar
3+
.idea

META-INF/plugin.xml

Lines changed: 0 additions & 101 deletions
This file was deleted.

intellij-nette.iml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module type="PLUGIN_MODULE" version="4">
3-
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/META-INF/plugin.xml" />
4-
<component name="NewModuleRootManager" inherit-compiler-output="true">
5-
<exclude-output />
6-
<content url="file://$MODULE_DIR$">
7-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
8-
</content>
9-
<orderEntry type="inheritedJdk" />
10-
<orderEntry type="sourceFolder" forTests="false" />
11-
</component>
12-
</module>
13-
3+
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
4+
<component name="NewModuleRootManager" inherit-compiler-output="true">
5+
<exclude-output />
6+
<content url="file://$MODULE_DIR$">
7+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
9+
</content>
10+
<orderEntry type="inheritedJdk" />
11+
<orderEntry type="sourceFolder" forTests="false" />
12+
<orderEntry type="library" exported="" scope="PROVIDED" name="php" level="project" />
13+
<orderEntry type="library" exported="" scope="PROVIDED" name="php-openapi" level="project" />
14+
<orderEntry type="library" exported="" scope="PROVIDED" name="php-openapi-src" level="project" />
15+
</component>
16+
</module>

resources/META-INF/plugin.xml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<idea-plugin>
2+
<name>Nette framework helpers</name>
3+
<description>Nette development with pleasure - (annotations, components...)</description>
4+
<version>0.4.4</version>
5+
<vendor>juzna.cz</vendor>
6+
<change-notes><![CDATA[
7+
<h2>0.4.4</h2>
8+
<ul>
9+
<li>ComponentTypeProvider: upgrade to PhpTypeProvider4</li>
10+
<li>Fixed compatibility with new PhpStorm versions (more deprecated fixed)</li>
11+
<li>Temporarily disabled one feature in "component tree popup" (will be fixed in next version)</li>
12+
</ul>
13+
<h2>0.4.3</h2>
14+
<ul>
15+
<li>ComponentTypeProvider: upgrade to PhpTypeProvider3</li>
16+
<li>Remove Nette object support</li>
17+
</ul>
18+
<h2>0.4.2</h2>
19+
<ul>
20+
<li>ComponentTypeProvider: Fixed index access during indexing</li>
21+
</ul>
22+
<h2>0.4.1</h2>
23+
<ul>
24+
<li>Fixed RuntimeException Invalid Signature</li>
25+
<li>Fixed StackOverflowException</li>
26+
<li>Fixed: find magic methods only in the Nette Object</li>
27+
</ul>
28+
<h2>0.4.0</h2>
29+
<ul>
30+
<li>Fixed deadlocks</li>
31+
<li>Added support for dash separated subcomponents in getComponent or array access + components refactoring</li>
32+
</ul>
33+
<h2>0.3.1</h2>
34+
<ul>
35+
<li>Fixed StringIndexOutOfBoundsException exception in ClassFinder</li>
36+
</ul>
37+
<h2>0.3.0</h2>
38+
<ul>
39+
<li>Added component tree popup</li>
40+
<li>Added inspection that createComponent returns UI\Form</li>
41+
<li>Added EventInvocationGoToDeclarationHandler [#15]</li>
42+
<li>Added predefined Nette Code style [#20]</li>
43+
<li>Added support for @persistent annotation (completion and inspection)</li>
44+
<li>Fixed few issues in TypeProviders causing ide freeze</li>
45+
</ul>
46+
<h2>0.2.0</h2>
47+
<ul>
48+
<li>Components: created completion contributor for component access using ArrayAccess or getComponent method</li>
49+
<li>Components: created reference contributor from ArrayAccess/getComponent access to createComponent* method</li>
50+
<li>Components: added references search for "Find usages" action</li>
51+
<li>Components: added TypeProvider for components access</li>
52+
<li>Components: added refactoring support (rename component access when renaming createComponent* method)</li>
53+
<li>@inject annotation completion provider</li>
54+
<li>@inject annotation inspection: check if property is public</li>
55+
<li>Added listener generator action for nette/object events (experimental)</li>
56+
<li>Refactoring, removed deprecated stuffs..</li>
57+
<li>Removed Pd\Entity support</li>
58+
</ul>
59+
<h2>0.1.0</h2>
60+
<ul>
61+
<li>Initial version</li>
62+
</ul>
63+
]]>
64+
</change-notes>
65+
66+
<idea-version since-build="191.8026.42"/>
67+
<depends>com.intellij.modules.lang</depends>
68+
<depends>com.jetbrains.php</depends>
69+
70+
<extensions defaultExtensionNs="com.jetbrains.php">
71+
<typeProvider4 implementation="cz.juzna.intellij.nette.typeProvider.ComponentTypeProvider"/>
72+
</extensions>
73+
<extensions defaultExtensionNs="com.intellij">
74+
<!-- Nette -->
75+
<completion.contributor language="PHP" implementationClass="cz.juzna.intellij.nette.completion.ComponentCompletionContributor"/>
76+
<completion.contributor language="PHP" implementationClass="cz.juzna.intellij.nette.completion.CompilerExtensionCompletionContributor"/>
77+
<completion.contributor language="PHP" implementationClass="cz.juzna.intellij.nette.completion.PhpDocCompletionContributor"/>
78+
<psi.referenceContributor language="PHP" implementation="cz.juzna.intellij.nette.reference.ComponentReferenceContributor"/>
79+
<referencesSearch implementation="cz.juzna.intellij.nette.reference.ComponentReferenceSearch"/>
80+
81+
<localInspection language="PHP" shortName="NonPublicInject" id="NonPublicInject" displayName="Non-public @inject property"
82+
groupName="Nette"
83+
implementationClass="cz.juzna.intellij.nette.inspections.NonPublicInjectInspection"
84+
level="ERROR" enabledByDefault="true"/>
85+
<localInspection language="PHP" shortName="NonPublicPersistent" id="NonPublicPersistent" displayName="Non-public @persistent property"
86+
groupName="Nette"
87+
implementationClass="cz.juzna.intellij.nette.inspections.NonPublicPersistentInspection"
88+
level="ERROR" enabledByDefault="true"/>
89+
<localInspection language="PHP" shortName="CreateComponentReturnFormType" id="CreateComponentReturnFormType" displayName="Form return type of createComponent*"
90+
groupName="Nette"
91+
implementationClass="cz.juzna.intellij.nette.inspections.CreateComponentReturnFormTypeInspection"
92+
level="WARNING" enabledByDefault="true"/>
93+
<predefinedCodeStyle implementation="cz.juzna.intellij.nette.codeStyle.NetteCodeStyle"/>
94+
<gotoDeclarationHandler implementation="cz.juzna.intellij.nette.reference.EventInvocationGoToDeclarationHandler"/>
95+
</extensions>
96+
97+
<actions>
98+
<group id="ListenerGenerators">
99+
<action class="cz.juzna.intellij.nette.actions.GenerateInlineListenerAction" id="GenerateInlineListenerAction2"
100+
text="Event Listener"
101+
description="Create inline listener."/>
102+
<add-to-group group-id="GenerateGroup" anchor="last"/>
103+
</group>
104+
<action class="cz.juzna.intellij.nette.actions.ViewComponentTreeAction" id="ComponentTreePopup" text="Show Component Tree"
105+
description="Shows component tree in presenter or component"/>
106+
</actions>
107+
</idea-plugin>

src/cz/juzna/intellij/nette/codeStyle/NetteCodeStyle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void apply(CodeStyleSettings settings) {
3333
phpSettings.LOWER_CASE_NULL_CONST = false;
3434
phpSettings.UPPER_CASE_NULL_CONST = true;
3535
phpSettings.UPPER_CASE_BOOLEAN_CONST = true;
36-
phpSettings.BLANK_LINE_BEFORE_RETURN_STATEMENT = false;
36+
phpSettings.BLANK_LINES_BEFORE_RETURN_STATEMENT = 0;
3737

3838
}
3939
}

src/cz/juzna/intellij/nette/dialogs/ComponentTreePopup.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
import com.intellij.openapi.fileEditor.FileEditor;
1212
import com.intellij.openapi.ui.popup.JBPopup;
1313
import com.intellij.openapi.ui.popup.JBPopupFactory;
14-
import com.intellij.openapi.wm.IdeFocusManager;
1514
import com.intellij.psi.PsiElement;
1615
import com.intellij.util.ui.JBUI;
17-
import com.intellij.util.ui.tree.TreeUtil;
1816
import com.jetbrains.php.lang.psi.elements.Method;
1917
import com.jetbrains.php.lang.psi.elements.PhpClass;
2018
import cz.juzna.intellij.nette.utils.ComponentSearcher;
@@ -49,7 +47,7 @@ public void show() {
4947
structureView.setAutoscrolls(false);
5048

5149
MnemonicHelper.init(structureView);
52-
final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(structureView, (JComponent) null)
50+
final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(structureView, null)
5351
.setTitle("Component tree")
5452
.setResizable(true)
5553
.setModalContext(false)
@@ -74,7 +72,8 @@ public void windowLostFocus(WindowEvent var1) {
7472
public void run() {
7573
SwingUtilities.invokeLater(new Runnable() {
7674
public void run() {
77-
structureView.getTreeBuilder().queueUpdate().doWhenDone(new Runnable() {
75+
//todo :resolve next commented lines - need it?
76+
/*structureView.getTreeBuilder().queueUpdate().doWhenDone(new Runnable() {
7877
public void run() {
7978
SwingUtilities.invokeLater(new Runnable() {
8079
public void run() {
@@ -88,7 +87,7 @@ public void run() {
8887
}
8988
});
9089
}
91-
});
90+
});*/
9291
}
9392
});
9493
}

src/cz/juzna/intellij/nette/reference/ComponentReferenceContributor.java

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.intellij.patterns.PlatformPatterns;
44
import com.intellij.psi.*;
55
import com.intellij.util.ProcessingContext;
6+
import com.jetbrains.php.lang.PhpLanguage;
67
import com.jetbrains.php.lang.parser.PhpElementTypes;
78
import cz.juzna.intellij.nette.utils.ComponentSearcher;
89
import org.jetbrains.annotations.NotNull;
@@ -12,29 +13,31 @@
1213

1314
public class ComponentReferenceContributor extends PsiReferenceContributor {
1415

15-
@Override
16-
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {
17-
psiReferenceRegistrar.registerReferenceProvider(PlatformPatterns.psiElement(PhpElementTypes.STRING), new PsiReferenceProvider() {
18-
@NotNull
19-
@Override
20-
public PsiReference[] getReferencesByElement(PsiElement psiElement, ProcessingContext processingContext) {
21-
if (psiElement.getParent() == null || psiElement.getParent().getParent() == null) {
22-
return new PsiReference[0];
23-
}
24-
PsiElement el = psiElement.getParent().getParent();
25-
ComponentSearcher.ComponentQuery query = ComponentSearcher.createQuery(el);
26-
query.withPath();
27-
Collection<ComponentSearcher.ComponentSearchResult> result = ComponentSearcher.find(query);
28-
if (result.size() == 0) {
29-
return new PsiReference[0];
30-
}
31-
Collection<PsiReference> refs = new ArrayList<PsiReference>(result.size());
32-
for (ComponentSearcher.ComponentSearchResult searchResult : result) {
33-
refs.add(new ComponentReference(psiElement, searchResult.getPath()));
34-
}
16+
@Override
17+
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {
18+
psiReferenceRegistrar.registerReferenceProvider(
19+
PlatformPatterns.psiElement(PhpElementTypes.STRING).withLanguage(PhpLanguage.INSTANCE),
20+
new PsiReferenceProvider() {
21+
@NotNull
22+
@Override
23+
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
24+
if (psiElement.getParent() == null || psiElement.getParent().getParent() == null) {
25+
return new PsiReference[0];
26+
}
27+
PsiElement el = psiElement.getParent().getParent();
28+
ComponentSearcher.ComponentQuery query = ComponentSearcher.createQuery(el);
29+
query.withPath();
30+
Collection<ComponentSearcher.ComponentSearchResult> result = ComponentSearcher.find(query);
31+
if (result.size() == 0) {
32+
return new PsiReference[0];
33+
}
34+
Collection<PsiReference> refs = new ArrayList<>(result.size());
35+
for (ComponentSearcher.ComponentSearchResult searchResult : result) {
36+
refs.add(new ComponentReference(psiElement, searchResult.getPath()));
37+
}
3538

36-
return refs.toArray(new PsiReference[refs.size()]);
37-
}
38-
});
39-
}
39+
return refs.toArray(new PsiReference[0]);
40+
}
41+
});
42+
}
4043
}

0 commit comments

Comments
 (0)