Unzipped MaxOpenedProjects and added Gradle module

This commit is contained in:
breandan 2015-12-03 17:21:16 -05:00
parent 5b163015cc
commit 8da6c43492
13 changed files with 158 additions and 23 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ _includes
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/libraries/Gradle__*.xml
# Sensitive or high-churn files:
.idea/dataSources.ids

23
.idea/gradle.xml generated Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$/code_samples/gradle_plugin_demo" />
<option name="gradleHome" value="C:/Program Files (x86)/Gradle/gradle-2.9" />
<option name="gradleJvm" value="#JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$/code_samples/gradle_plugin_demo" />
</set>
</option>
<option name="myModules">
<set>
<option value="$PROJECT_DIR$/code_samples/gradle_plugin_demo" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="gradle-wrapper">
<CLASSES>
<root url="jar://$PROJECT_DIR$/code_samples/gradle_plugin_demo/gradle/wrapper/gradle-wrapper.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -1,10 +0,0 @@
<component name="libraryTable">
<library name="tasks">
<CLASSES>
<root url="jar://$PROJECT_DIR$/code_samples/gradle_plugin_demo/build/idea-sandbox/config/tasks/untitled2.tasks.zip!/" />
<root url="jar://$PROJECT_DIR$/code_samples/gradle_plugin_demo/build/idea-sandbox/config/tasks/untitled2.contexts.zip!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

2
.idea/misc.xml generated
View File

@ -3,7 +3,7 @@
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="IntelliJ IDEA IU-143.381.42" project-jdk-type="IDEA JDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="IntelliJ IDEA IU-143.381.42" project-jdk-type="IDEA JDK">
<output url="file://$PROJECT_DIR$/build" />
</component>
</project>

1
.idea/modules.xml generated
View File

@ -2,6 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/code_samples/MaxOpenedProjects/MaxOpenedProjects.iml" filepath="$PROJECT_DIR$/code_samples/MaxOpenedProjects/MaxOpenedProjects.iml" />
<module fileurl="file://$PROJECT_DIR$/code_samples/editor_basics/editor_basics.iml" filepath="$PROJECT_DIR$/code_samples/editor_basics/editor_basics.iml" />
<module fileurl="file://$PROJECT_DIR$/code_samples/facet_basics/facet_basics.iml" filepath="$PROJECT_DIR$/code_samples/facet_basics/facet_basics.iml" />
<module fileurl="file://$PROJECT_DIR$/code_samples/framework/framework.iml" filepath="$PROJECT_DIR$/code_samples/framework/framework.iml" />

6
.idea/vcs.xml generated
View File

@ -12,6 +12,12 @@
</component>
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sdkdocs-template" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sdkdocs-template" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sdkdocs-template" vcs="Git" />
<mapping directory="$PROJECT_DIR$/sdkdocs-template" vcs="Git" />
</component>
</project>

Binary file not shown.

View File

@ -55,8 +55,7 @@ This section allows you to download and install a sample plugin illustrating how
**To install and run the sample plugin**
* Click [here](/attachments/MaxOpenedProjects.zip) to download the .Zip archive that contains the sample plugin project.
* Extract all files from the .Zip archive to a separate folder.
* Start *IntelliJ IDEA*, on the starting page, click *Open Project*, and then use the *Open Project* dialog box to open the downloaded project *MaxOpenedProjects*.
* Download the included sample plugin project located [here](https://github.com/JetBrains/intellij-sdk-docs/tree/master/code_samples/MaxOpenedProjects).
* Start *IntelliJ IDEA*, on the starting page, click *Open Project*, and then use the *Open Project* dialog box to open the project *MaxOpenedProjects*.
* On the main menu, choose *Run \| Run* or press <kbd>Shift</kbd>+<kbd>F10</kbd>.
* If necessary, change the [Run/Debug Configurations](http://www.jetbrains.com/idea/help/run-debug-configuration-plugin.html).

View File

@ -0,0 +1,12 @@
<?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">
<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" />
</component>
</module>

View File

@ -0,0 +1,29 @@
<idea-plugin version="2">
<name>Plugin name here</name>
<description>short description of the plugin</description>
<version>1.0</version>
<vendor>YourCompany</vendor>
<idea-version since-build="8000"/>
<application-components>
<!-- Add your application components here -->
</application-components>
<project-components>
<!-- Add your project components here -->
<component>
<implementation-class>MyPackage.MaxProject</implementation-class>
</component>
</project-components>
<actions>
<!-- Add your actions here -->
</actions>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
<applicationService serviceInterface="MyPackage.MyCounter" serviceImplementation="MyPackage.MyCounter">
</applicationService>
</extensions>
</idea-plugin>

View File

@ -0,0 +1,54 @@
package MyPackage;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
* User: Alexey.Chursin
* Date: Aug 13, 2010
* Time: 3:50:25 PM
* To change this template use File | Settings | File Templates.
*/
public class MaxProject implements ProjectComponent {
public MaxProject(Project project) {
}
public void initComponent() {
// TODO: insert component initialization logic here
}
public void disposeComponent() {
// TODO: insert component disposal logic here
}
@NotNull
public String getComponentName() {
return "MaxProject";
}
public void projectOpened() {
// called when project is opened
MyCounter CommandCounter = ServiceManager.getService(MyCounter.class);
if (CommandCounter.IncreaseCounter() == -1) {
Messages.showMessageDialog("The maximum number of opened projects exceeds " + String.valueOf(CommandCounter.MaxCount) +
" projects!", "Error", Messages.getErrorIcon());
ProjectManager PM=ProjectManager.getInstance();
Project[] AllProjects = PM.getOpenProjects();
Project project = AllProjects[AllProjects.length-1];
PM.closeProject(project);
}
}
public void projectClosed() {
// called when project is being closed
MyCounter CommandCounter = ServiceManager.getService(MyCounter.class);
CommandCounter.DecreaseCounter();
}
}

View File

@ -0,0 +1,29 @@
package MyPackage;
/**
* Created by IntelliJ IDEA.
* User: Alexey.Chursin
* Date: Aug 13, 2010
* Time: 3:49:33 PM
* To change this template use File | Settings | File Templates.
*/
public class MyCounter {
private int Count = 0;
// Sets the maximum allowed number of opened projects.
public final int MaxCount = 3;
public MyCounter(){
}
public int IncreaseCounter() {
Count++;
return (Count > MaxCount) ? -1:Count;
}
public int DecreaseCounter() {
Count--;
return (Count > MaxCount) ? -1:Count;
}
}