Skip to content

Commit

Permalink
Merge pull request #32 from nette-intellij/mn-fixed-deprecated-0-4-4
Browse files Browse the repository at this point in the history
Mn fixed deprecated 0 4 4
  • Loading branch information
mesour authored May 23, 2020
2 parents 2195fc2 + 0423d9c commit 9ba47ad
Show file tree
Hide file tree
Showing 10 changed files with 181 additions and 170 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
out/
*.jar
*.jar
.idea
101 changes: 0 additions & 101 deletions META-INF/plugin.xml

This file was deleted.

25 changes: 14 additions & 11 deletions intellij-nette.iml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PLUGIN_MODULE" version="4">
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/META-INF/plugin.xml" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/resources/META-INF/plugin.xml" />
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" scope="PROVIDED" name="php" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="php-openapi" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="php-openapi-src" level="project" />
</component>
</module>
107 changes: 107 additions & 0 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<idea-plugin>
<name>Nette framework helpers</name>
<description>Nette development with pleasure - (annotations, components...)</description>
<version>0.4.4</version>
<vendor>juzna.cz</vendor>
<change-notes><![CDATA[
<h2>0.4.4</h2>
<ul>
<li>ComponentTypeProvider: upgrade to PhpTypeProvider4</li>
<li>Fixed compatibility with new PhpStorm versions (more deprecated fixed)</li>
<li>Temporarily disabled one feature in "component tree popup" (will be fixed in next version)</li>
</ul>
<h2>0.4.3</h2>
<ul>
<li>ComponentTypeProvider: upgrade to PhpTypeProvider3</li>
<li>Remove Nette object support</li>
</ul>
<h2>0.4.2</h2>
<ul>
<li>ComponentTypeProvider: Fixed index access during indexing</li>
</ul>
<h2>0.4.1</h2>
<ul>
<li>Fixed RuntimeException Invalid Signature</li>
<li>Fixed StackOverflowException</li>
<li>Fixed: find magic methods only in the Nette Object</li>
</ul>
<h2>0.4.0</h2>
<ul>
<li>Fixed deadlocks</li>
<li>Added support for dash separated subcomponents in getComponent or array access + components refactoring</li>
</ul>
<h2>0.3.1</h2>
<ul>
<li>Fixed StringIndexOutOfBoundsException exception in ClassFinder</li>
</ul>
<h2>0.3.0</h2>
<ul>
<li>Added component tree popup</li>
<li>Added inspection that createComponent returns UI\Form</li>
<li>Added EventInvocationGoToDeclarationHandler [#15]</li>
<li>Added predefined Nette Code style [#20]</li>
<li>Added support for @persistent annotation (completion and inspection)</li>
<li>Fixed few issues in TypeProviders causing ide freeze</li>
</ul>
<h2>0.2.0</h2>
<ul>
<li>Components: created completion contributor for component access using ArrayAccess or getComponent method</li>
<li>Components: created reference contributor from ArrayAccess/getComponent access to createComponent* method</li>
<li>Components: added references search for "Find usages" action</li>
<li>Components: added TypeProvider for components access</li>
<li>Components: added refactoring support (rename component access when renaming createComponent* method)</li>
<li>@inject annotation completion provider</li>
<li>@inject annotation inspection: check if property is public</li>
<li>Added listener generator action for nette/object events (experimental)</li>
<li>Refactoring, removed deprecated stuffs..</li>
<li>Removed Pd\Entity support</li>
</ul>
<h2>0.1.0</h2>
<ul>
<li>Initial version</li>
</ul>
]]>
</change-notes>

<idea-version since-build="191.8026.42"/>
<depends>com.intellij.modules.lang</depends>
<depends>com.jetbrains.php</depends>

<extensions defaultExtensionNs="com.jetbrains.php">
<typeProvider4 implementation="cz.juzna.intellij.nette.typeProvider.ComponentTypeProvider"/>
</extensions>
<extensions defaultExtensionNs="com.intellij">
<!-- Nette -->
<completion.contributor language="PHP" implementationClass="cz.juzna.intellij.nette.completion.ComponentCompletionContributor"/>
<completion.contributor language="PHP" implementationClass="cz.juzna.intellij.nette.completion.CompilerExtensionCompletionContributor"/>
<completion.contributor language="PHP" implementationClass="cz.juzna.intellij.nette.completion.PhpDocCompletionContributor"/>
<psi.referenceContributor language="PHP" implementation="cz.juzna.intellij.nette.reference.ComponentReferenceContributor"/>
<referencesSearch implementation="cz.juzna.intellij.nette.reference.ComponentReferenceSearch"/>

<localInspection language="PHP" shortName="NonPublicInject" id="NonPublicInject" displayName="Non-public @inject property"
groupName="Nette"
implementationClass="cz.juzna.intellij.nette.inspections.NonPublicInjectInspection"
level="ERROR" enabledByDefault="true"/>
<localInspection language="PHP" shortName="NonPublicPersistent" id="NonPublicPersistent" displayName="Non-public @persistent property"
groupName="Nette"
implementationClass="cz.juzna.intellij.nette.inspections.NonPublicPersistentInspection"
level="ERROR" enabledByDefault="true"/>
<localInspection language="PHP" shortName="CreateComponentReturnFormType" id="CreateComponentReturnFormType" displayName="Form return type of createComponent*"
groupName="Nette"
implementationClass="cz.juzna.intellij.nette.inspections.CreateComponentReturnFormTypeInspection"
level="WARNING" enabledByDefault="true"/>
<predefinedCodeStyle implementation="cz.juzna.intellij.nette.codeStyle.NetteCodeStyle"/>
<gotoDeclarationHandler implementation="cz.juzna.intellij.nette.reference.EventInvocationGoToDeclarationHandler"/>
</extensions>

<actions>
<group id="ListenerGenerators">
<action class="cz.juzna.intellij.nette.actions.GenerateInlineListenerAction" id="GenerateInlineListenerAction2"
text="Event Listener"
description="Create inline listener."/>
<add-to-group group-id="GenerateGroup" anchor="last"/>
</group>
<action class="cz.juzna.intellij.nette.actions.ViewComponentTreeAction" id="ComponentTreePopup" text="Show Component Tree"
description="Shows component tree in presenter or component"/>
</actions>
</idea-plugin>
2 changes: 1 addition & 1 deletion src/cz/juzna/intellij/nette/codeStyle/NetteCodeStyle.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void apply(CodeStyleSettings settings) {
phpSettings.LOWER_CASE_NULL_CONST = false;
phpSettings.UPPER_CASE_NULL_CONST = true;
phpSettings.UPPER_CASE_BOOLEAN_CONST = true;
phpSettings.BLANK_LINE_BEFORE_RETURN_STATEMENT = false;
phpSettings.BLANK_LINES_BEFORE_RETURN_STATEMENT = 0;

}
}
9 changes: 4 additions & 5 deletions src/cz/juzna/intellij/nette/dialogs/ComponentTreePopup.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.psi.PsiElement;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.tree.TreeUtil;
import com.jetbrains.php.lang.psi.elements.Method;
import com.jetbrains.php.lang.psi.elements.PhpClass;
import cz.juzna.intellij.nette.utils.ComponentSearcher;
Expand Down Expand Up @@ -49,7 +47,7 @@ public void show() {
structureView.setAutoscrolls(false);

MnemonicHelper.init(structureView);
final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(structureView, (JComponent) null)
final JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(structureView, null)
.setTitle("Component tree")
.setResizable(true)
.setModalContext(false)
Expand All @@ -74,7 +72,8 @@ public void windowLostFocus(WindowEvent var1) {
public void run() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
structureView.getTreeBuilder().queueUpdate().doWhenDone(new Runnable() {
//todo :resolve next commented lines - need it?
/*structureView.getTreeBuilder().queueUpdate().doWhenDone(new Runnable() {
public void run() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Expand All @@ -88,7 +87,7 @@ public void run() {
}
});
}
});
});*/
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.*;
import com.intellij.util.ProcessingContext;
import com.jetbrains.php.lang.PhpLanguage;
import com.jetbrains.php.lang.parser.PhpElementTypes;
import cz.juzna.intellij.nette.utils.ComponentSearcher;
import org.jetbrains.annotations.NotNull;
Expand All @@ -12,29 +13,31 @@

public class ComponentReferenceContributor extends PsiReferenceContributor {

@Override
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {
psiReferenceRegistrar.registerReferenceProvider(PlatformPatterns.psiElement(PhpElementTypes.STRING), new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(PsiElement psiElement, ProcessingContext processingContext) {
if (psiElement.getParent() == null || psiElement.getParent().getParent() == null) {
return new PsiReference[0];
}
PsiElement el = psiElement.getParent().getParent();
ComponentSearcher.ComponentQuery query = ComponentSearcher.createQuery(el);
query.withPath();
Collection<ComponentSearcher.ComponentSearchResult> result = ComponentSearcher.find(query);
if (result.size() == 0) {
return new PsiReference[0];
}
Collection<PsiReference> refs = new ArrayList<PsiReference>(result.size());
for (ComponentSearcher.ComponentSearchResult searchResult : result) {
refs.add(new ComponentReference(psiElement, searchResult.getPath()));
}
@Override
public void registerReferenceProviders(PsiReferenceRegistrar psiReferenceRegistrar) {
psiReferenceRegistrar.registerReferenceProvider(
PlatformPatterns.psiElement(PhpElementTypes.STRING).withLanguage(PhpLanguage.INSTANCE),
new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
if (psiElement.getParent() == null || psiElement.getParent().getParent() == null) {
return new PsiReference[0];
}
PsiElement el = psiElement.getParent().getParent();
ComponentSearcher.ComponentQuery query = ComponentSearcher.createQuery(el);
query.withPath();
Collection<ComponentSearcher.ComponentSearchResult> result = ComponentSearcher.find(query);
if (result.size() == 0) {
return new PsiReference[0];
}
Collection<PsiReference> refs = new ArrayList<>(result.size());
for (ComponentSearcher.ComponentSearchResult searchResult : result) {
refs.add(new ComponentReference(psiElement, searchResult.getPath()));
}

return refs.toArray(new PsiReference[refs.size()]);
}
});
}
return refs.toArray(new PsiReference[0]);
}
});
}
}
Loading

0 comments on commit 9ba47ad

Please sign in to comment.