mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 09:17:50 +08:00
Tidy up code samples and wrap at 80 chars #IJSDK-24
This commit is contained in:
parent
8aaf13b046
commit
f416f02ce2
@ -3,7 +3,6 @@ package com.intellij.codeInspection;
|
|||||||
import com.intellij.codeInsight.daemon.GroupNames;
|
import com.intellij.codeInsight.daemon.GroupNames;
|
||||||
import com.intellij.openapi.diagnostic.Logger;
|
import com.intellij.openapi.diagnostic.Logger;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.util.Ref;
|
|
||||||
import com.intellij.psi.*;
|
import com.intellij.psi.*;
|
||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import com.intellij.ui.DocumentAdapter;
|
import com.intellij.ui.DocumentAdapter;
|
||||||
@ -14,8 +13,6 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,8 +23,12 @@ public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool {
|
|||||||
|
|
||||||
private final LocalQuickFix myQuickFix = new MyQuickFix();
|
private final LocalQuickFix myQuickFix = new MyQuickFix();
|
||||||
|
|
||||||
@SuppressWarnings({"WeakerAccess"}) @NonNls public String CHECKED_CLASSES = "java.lang.String;java.util.Date";
|
@SuppressWarnings({"WeakerAccess"})
|
||||||
@NonNls private static final String DESCRIPTION_TEMPLATE = InspectionsBundle.message("inspection.comparing.references.problem.descriptor");
|
@NonNls
|
||||||
|
public String CHECKED_CLASSES = "java.lang.String;java.util.Date";
|
||||||
|
@NonNls
|
||||||
|
private static final String DESCRIPTION_TEMPLATE =
|
||||||
|
InspectionsBundle.message("inspection.comparing.references.problem.descriptor");
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
@ -67,7 +68,8 @@ public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override public void visitBinaryExpression(PsiBinaryExpression expression) {
|
@Override
|
||||||
|
public void visitBinaryExpression(PsiBinaryExpression expression) {
|
||||||
super.visitBinaryExpression(expression);
|
super.visitBinaryExpression(expression);
|
||||||
IElementType opSign = expression.getOperationTokenType();
|
IElementType opSign = expression.getOperationTokenType();
|
||||||
if (opSign == JavaTokenType.EQEQ || opSign == JavaTokenType.NE) {
|
if (opSign == JavaTokenType.EQEQ || opSign == JavaTokenType.NE) {
|
||||||
@ -109,7 +111,8 @@ public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
|
PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
|
||||||
PsiMethodCallExpression equalsCall = (PsiMethodCallExpression)factory.createExpressionFromText("a.equals(b)", null);
|
PsiMethodCallExpression equalsCall =
|
||||||
|
(PsiMethodCallExpression) factory.createExpressionFromText("a.equals(b)", null);
|
||||||
|
|
||||||
equalsCall.getMethodExpression().getQualifierExpression().replace(lExpr);
|
equalsCall.getMethodExpression().getQualifierExpression().replace(lExpr);
|
||||||
equalsCall.getArgumentList().getExpressions()[0].replace(rExpr);
|
equalsCall.getArgumentList().getExpressions()[0].replace(rExpr);
|
||||||
@ -121,8 +124,7 @@ public class ComparingReferencesInspection extends BaseJavaLocalInspectionTool {
|
|||||||
negation.getOperand().replace(result);
|
negation.getOperand().replace(result);
|
||||||
result.replace(negation);
|
result.replace(negation);
|
||||||
}
|
}
|
||||||
}
|
} catch (IncorrectOperationException e) {
|
||||||
catch (IncorrectOperationException e) {
|
|
||||||
LOG.error(e);
|
LOG.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@ public class TestThisPlugin extends UsefulTestCase {
|
|||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
|
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
|
||||||
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getName());
|
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder =
|
||||||
|
fixtureFactory.createFixtureBuilder(getName());
|
||||||
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
|
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
|
||||||
myFixture.setTestDataPath(dataPath);
|
myFixture.setTestDataPath(dataPath);
|
||||||
final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
|
final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
|
||||||
|
@ -13,7 +13,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
/**
|
/**
|
||||||
* @author dsl
|
* @author dsl
|
||||||
*/
|
*/
|
||||||
@NonNls public class ConditionalOperatorConvertor extends PsiElementBaseIntentionAction implements IntentionAction {
|
@NonNls
|
||||||
|
public class ConditionalOperatorConvertor extends PsiElementBaseIntentionAction implements IntentionAction {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public String getText() {
|
public String getText() {
|
||||||
@ -67,7 +68,8 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
final PsiElement[] declaredElements = declaration.getDeclaredElements();
|
final PsiElement[] declaredElements = declaration.getDeclaredElements();
|
||||||
PsiLocalVariable variable = null;
|
PsiLocalVariable variable = null;
|
||||||
for (PsiElement declaredElement : declaredElements) {
|
for (PsiElement declaredElement : declaredElements) {
|
||||||
if (declaredElement instanceof PsiLocalVariable && PsiTreeUtil.isAncestor(declaredElement, conditionalExpression, true)) {
|
if (declaredElement instanceof PsiLocalVariable &&
|
||||||
|
PsiTreeUtil.isAncestor(declaredElement, conditionalExpression, true)) {
|
||||||
variable = (PsiLocalVariable) declaredElement;
|
variable = (PsiLocalVariable) declaredElement;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package testPlugin;
|
package testPlugin;
|
||||||
|
|
||||||
import com.intellij.codeInsight.intention.IntentionAction;
|
import com.intellij.codeInsight.intention.IntentionAction;
|
||||||
|
|
||||||
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
|
||||||
import com.intellij.testFramework.fixtures.*;
|
import com.intellij.testFramework.fixtures.*;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
@ -20,7 +19,8 @@ import org.junit.Test;
|
|||||||
public class YourTest {
|
public class YourTest {
|
||||||
protected CodeInsightTestFixture myFixture;
|
protected CodeInsightTestFixture myFixture;
|
||||||
// Specify path to your test data
|
// Specify path to your test data
|
||||||
// e.g. final String dataPath = "c:\\users\\john.doe\\idea\\community\\samples\\conditionalOperatorConvertor/testData";
|
// e.g. final String dataPath = "c:\\users\\john
|
||||||
|
// .doe\\idea\\community\\samples\\conditionalOperatorConvertor/testData";
|
||||||
final String dataPath = "c:\\users\\John.Doe\\idea\\community\\samples\\conditionalOperatorConvertor/testData";
|
final String dataPath = "c:\\users\\John.Doe\\idea\\community\\samples\\conditionalOperatorConvertor/testData";
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
|
@ -25,15 +25,21 @@
|
|||||||
</project-components>
|
</project-components>
|
||||||
|
|
||||||
<actions>
|
<actions>
|
||||||
<action id="EditorBasics.EditorIllustration" class="org.jetbrains.tutorials.editor.basics.EditorIllustration" text="Editor Basics"
|
<action id="EditorBasics.EditorIllustration"
|
||||||
|
class="org.jetbrains.tutorials.editor.basics.EditorIllustration"
|
||||||
|
text="Editor Basics"
|
||||||
description="Illustrates how to plug an action in">
|
description="Illustrates how to plug an action in">
|
||||||
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
||||||
</action>
|
</action>
|
||||||
<action id="EditorBasics.EditorHandlerIllustration" class="org.jetbrains.tutorials.editor.basics.EditorHandlerIllustration" text="Editor Handler"
|
<action id="EditorBasics.EditorHandlerIllustration"
|
||||||
|
class="org.jetbrains.tutorials.editor.basics.EditorHandlerIllustration"
|
||||||
|
text="Editor Handler"
|
||||||
description="Illustrates how to plug an action in">
|
description="Illustrates how to plug an action in">
|
||||||
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
||||||
</action>
|
</action>
|
||||||
<action id="EditorBasics.LogicalPositionIllustration" class="org.jetbrains.tutorials.editor.basics.EditorAreaIllustration" text="Caret Position"
|
<action id="EditorBasics.LogicalPositionIllustration"
|
||||||
|
class="org.jetbrains.tutorials.editor.basics.EditorAreaIllustration"
|
||||||
|
text="Caret Position"
|
||||||
description="Illustrates how editor area is organized">
|
description="Illustrates how editor area is organized">
|
||||||
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
|
||||||
</action>
|
</action>
|
||||||
|
@ -3,7 +3,10 @@ package org.jetbrains.tutorials.editor.basics;
|
|||||||
import com.intellij.openapi.actionSystem.AnAction;
|
import com.intellij.openapi.actionSystem.AnAction;
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||||
import com.intellij.openapi.editor.*;
|
import com.intellij.openapi.editor.CaretModel;
|
||||||
|
import com.intellij.openapi.editor.Editor;
|
||||||
|
import com.intellij.openapi.editor.LogicalPosition;
|
||||||
|
import com.intellij.openapi.editor.VisualPosition;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.ui.Messages;
|
import com.intellij.openapi.ui.Messages;
|
||||||
|
|
||||||
|
@ -22,11 +22,13 @@ public class EditorHandlerIllustration extends AnAction {
|
|||||||
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_CLONE_CARET_BELOW);
|
EditorActionHandler actionHandler = actionManager.getActionHandler(IdeActions.ACTION_EDITOR_CLONE_CARET_BELOW);
|
||||||
actionHandler.execute(editor, editor.getCaretModel().getCurrentCaret(), anActionEvent.getDataContext());
|
actionHandler.execute(editor, editor.getCaretModel().getCurrentCaret(), anActionEvent.getDataContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(@NotNull final AnActionEvent anActionEvent) {
|
public void update(@NotNull final AnActionEvent anActionEvent) {
|
||||||
//Set visible if at least one caret is available
|
//Set visible if at least one caret is available
|
||||||
final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
|
final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
|
||||||
final Editor editor = anActionEvent.getData(CommonDataKeys.EDITOR);
|
final Editor editor = anActionEvent.getData(CommonDataKeys.EDITOR);
|
||||||
anActionEvent.getPresentation().setVisible((project != null && editor != null && !editor.getCaretModel().getAllCarets().isEmpty()));
|
anActionEvent.getPresentation()
|
||||||
|
.setVisible((project != null && editor != null && !editor.getCaretModel().getAllCarets().isEmpty()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ public class EditorIllustration extends AnAction {
|
|||||||
WriteCommandAction.runWriteCommandAction(project, runnable);
|
WriteCommandAction.runWriteCommandAction(project, runnable);
|
||||||
selectionModel.removeSelection();
|
selectionModel.removeSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(final AnActionEvent e) {
|
public void update(final AnActionEvent e) {
|
||||||
//Get required data keys
|
//Get required data keys
|
||||||
|
@ -10,7 +10,11 @@ import com.intellij.openapi.module.Module;
|
|||||||
public class DemoFacet extends Facet<DemoFacetConfiguration> {
|
public class DemoFacet extends Facet<DemoFacetConfiguration> {
|
||||||
public static final String ID = "DEMO_FACET_ID";
|
public static final String ID = "DEMO_FACET_ID";
|
||||||
|
|
||||||
public DemoFacet(FacetType facetType, Module module, String name, DemoFacetConfiguration configuration, Facet underlyingFacet) {
|
public DemoFacet(FacetType facetType,
|
||||||
|
Module module,
|
||||||
|
String name,
|
||||||
|
DemoFacetConfiguration configuration,
|
||||||
|
Facet underlyingFacet) {
|
||||||
super(facetType, module, name, configuration, underlyingFacet);
|
super(facetType, module, name, configuration, underlyingFacet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class DemoFacetConfiguration implements FacetConfiguration {
|
|||||||
public static final String PATH_TO_SDK_ATTR_NAME = "pathToSdk";
|
public static final String PATH_TO_SDK_ATTR_NAME = "pathToSdk";
|
||||||
private String myPathToSdk = "";
|
private String myPathToSdk = "";
|
||||||
JTextField myPath = new JTextField(myPathToSdk);
|
JTextField myPath = new JTextField(myPathToSdk);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FacetEditorTab[] createEditorTabs(FacetEditorContext context, FacetValidatorsManager manager) {
|
public FacetEditorTab[] createEditorTabs(FacetEditorContext context, FacetValidatorsManager manager) {
|
||||||
return new FacetEditorTab[]{
|
return new FacetEditorTab[]{
|
||||||
|
@ -16,6 +16,7 @@ import javax.swing.*;
|
|||||||
*/
|
*/
|
||||||
public class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {
|
public class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration> {
|
||||||
private static final FacetTypeId<DemoFacet> TYPE_ID = new FacetTypeId<DemoFacet>(DemoFacet.ID);
|
private static final FacetTypeId<DemoFacet> TYPE_ID = new FacetTypeId<DemoFacet>(DemoFacet.ID);
|
||||||
|
|
||||||
public DemoFacetType() {
|
public DemoFacetType() {
|
||||||
super(TYPE_ID, DemoFacet.ID, "Demo Facet");
|
super(TYPE_ID, DemoFacet.ID, "Demo Facet");
|
||||||
}
|
}
|
||||||
@ -26,7 +27,10 @@ public class DemoFacetType extends FacetType<DemoFacet, DemoFacetConfiguration>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DemoFacet createFacet(@NotNull Module module, String s, @NotNull DemoFacetConfiguration configuration, Facet facet) {
|
public DemoFacet createFacet(@NotNull Module module,
|
||||||
|
String s,
|
||||||
|
@NotNull DemoFacetConfiguration configuration,
|
||||||
|
Facet facet) {
|
||||||
return new DemoFacet(this, module, s, configuration, facet);
|
return new DemoFacet(this, module, s, configuration, facet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ import javax.swing.*;
|
|||||||
*/
|
*/
|
||||||
public class DemoFramework extends FrameworkTypeEx {
|
public class DemoFramework extends FrameworkTypeEx {
|
||||||
public static final String FRAMEWORK_ID = "Demo";
|
public static final String FRAMEWORK_ID = "Demo";
|
||||||
|
|
||||||
protected DemoFramework() {
|
protected DemoFramework() {
|
||||||
super(FRAMEWORK_ID);
|
super(FRAMEWORK_ID);
|
||||||
}
|
}
|
||||||
@ -44,7 +45,9 @@ public class DemoFramework extends FrameworkTypeEx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addSupport(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ModifiableModelsProvider provider) {
|
public void addSupport(@NotNull Module module,
|
||||||
|
@NotNull ModifiableRootModel model,
|
||||||
|
@NotNull ModifiableModelsProvider provider) {
|
||||||
//do what you want here: setup a library, generate a specific file, etc
|
//do what you want here: setup a library, generate a specific file, etc
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<templateSet group="Markdown">
|
<templateSet group="Markdown">
|
||||||
<template name="[" value="[$TEXT$]($LINK$)$END$" description="New link reference." toReformat="false" toShortenFQNames="false">
|
<template name="["
|
||||||
|
value="[$TEXT$]($LINK$)$END$"
|
||||||
|
description="New link reference."
|
||||||
|
toReformat="false"
|
||||||
|
toShortenFQNames="false">
|
||||||
<variable name="TEXT" expression="" defaultValue="" alwaysStopAt="true"/>
|
<variable name="TEXT" expression="" defaultValue="" alwaysStopAt="true"/>
|
||||||
<variable name="LINK" expression="complete()" defaultValue="" alwaysStopAt="true"/>
|
<variable name="LINK" expression="complete()" defaultValue="" alwaysStopAt="true"/>
|
||||||
<context>
|
<context>
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import com.intellij.codeInsight.template.EverywhereContextType;
|
|
||||||
import com.intellij.codeInsight.template.TemplateContextType;
|
import com.intellij.codeInsight.template.TemplateContextType;
|
||||||
import com.intellij.psi.PsiFile;
|
import com.intellij.psi.PsiFile;
|
||||||
import org.jetbrains.annotations.NonNls;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public class MarkdownContext extends TemplateContextType {
|
public class MarkdownContext extends TemplateContextType {
|
||||||
protected MarkdownContext() {
|
protected MarkdownContext() {
|
||||||
|
@ -3,8 +3,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
public class MarkdownTemplateProvider implements DefaultLiveTemplatesProvider {
|
public class MarkdownTemplateProvider implements DefaultLiveTemplatesProvider {
|
||||||
@Override
|
@Override
|
||||||
public String[] getDefaultLiveTemplateFiles()
|
public String[] getDefaultLiveTemplateFiles() {
|
||||||
{
|
|
||||||
return new String[]{"liveTemplates/Markdown"};
|
return new String[]{"liveTemplates/Markdown"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,8 @@ public class MaxProject implements ProjectComponent {
|
|||||||
MyCounter CommandCounter = ServiceManager.getService(MyCounter.class);
|
MyCounter CommandCounter = ServiceManager.getService(MyCounter.class);
|
||||||
|
|
||||||
if (CommandCounter.IncreaseCounter() == -1) {
|
if (CommandCounter.IncreaseCounter() == -1) {
|
||||||
Messages.showMessageDialog("The maximum number of opened projects exceeds " + String.valueOf(CommandCounter.MaxCount) +
|
Messages.showMessageDialog(
|
||||||
|
"The maximum number of opened projects exceeds " + String.valueOf(CommandCounter.MaxCount) +
|
||||||
" projects!", "Error", Messages.getErrorIcon());
|
" projects!", "Error", Messages.getErrorIcon());
|
||||||
ProjectManager PM = ProjectManager.getInstance();
|
ProjectManager PM = ProjectManager.getInstance();
|
||||||
Project[] AllProjects = PM.getOpenProjects();
|
Project[] AllProjects = PM.getOpenProjects();
|
||||||
|
@ -11,6 +11,7 @@ public class MyCounter {
|
|||||||
private int Count = 0;
|
private int Count = 0;
|
||||||
// Sets the maximum allowed number of opened projects.
|
// Sets the maximum allowed number of opened projects.
|
||||||
public final int MaxCount = 3;
|
public final int MaxCount = 3;
|
||||||
|
|
||||||
public MyCounter() {
|
public MyCounter() {
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,7 +54,9 @@ public class DemoModuleType extends ModuleType<DemoModuleBuilder> {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull DemoModuleBuilder moduleBuilder, @NotNull ModulesProvider modulesProvider) {
|
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext,
|
||||||
|
@NotNull DemoModuleBuilder moduleBuilder,
|
||||||
|
@NotNull ModulesProvider modulesProvider) {
|
||||||
return super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider);
|
return super.createWizardSteps(wizardContext, moduleBuilder, modulesProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,9 @@
|
|||||||
The optional "use-shortcut-of" attribute specifies the ID of the action whose keyboard shortcut this action will use.
|
The optional "use-shortcut-of" attribute specifies the ID of the action whose keyboard shortcut this action will use.
|
||||||
The optional "description" attribute specifies the text which is displayed in the status bar when the action is focused.
|
The optional "description" attribute specifies the text which is displayed in the status bar when the action is focused.
|
||||||
The optional "icon" attribute specifies the icon which is displayed on the toolbar button or next to the menu item. -->
|
The optional "icon" attribute specifies the icon which is displayed on the toolbar button or next to the menu item. -->
|
||||||
<action id="PluginSample.DummyAction" class="org.jetbrains.tutorials.sample.actions.SimpleAction" text="Dummy Action"
|
<action id="PluginSample.DummyAction"
|
||||||
|
class="org.jetbrains.tutorials.sample.actions.SimpleAction"
|
||||||
|
text="Dummy Action"
|
||||||
description="Illustrates how to plug an action in">
|
description="Illustrates how to plug an action in">
|
||||||
<!-- The <keyboard-shortcut> node specifies the keyboard shortcut for the action. An action can have several keyboard shortcuts.
|
<!-- The <keyboard-shortcut> node specifies the keyboard shortcut for the action. An action can have several keyboard shortcuts.
|
||||||
The mandatory "first-keystroke" attribute specifies the first keystroke of the action. The key strokes are specified according to the regular Swing rules.
|
The mandatory "first-keystroke" attribute specifies the first keystroke of the action. The key strokes are specified according to the regular Swing rules.
|
||||||
@ -107,7 +109,8 @@
|
|||||||
The optional "popup" attribute specifies how the group is presented in the menu. If a group has popup="true", actions in it
|
The optional "popup" attribute specifies how the group is presented in the menu. If a group has popup="true", actions in it
|
||||||
are placed in a submenu; for popup="false", actions are displayed as a section of the same menu delimited by separators. -->
|
are placed in a submenu; for popup="false", actions are displayed as a section of the same menu delimited by separators. -->
|
||||||
<group id="DummyDefaultActionGroup" text="Default action group">
|
<group id="DummyDefaultActionGroup" text="Default action group">
|
||||||
<action class="org.jetbrains.tutorials.sample.actions.GroupedToDefaultAction" id="PluginSample.GroupedToDefaultAction"/>
|
<action class="org.jetbrains.tutorials.sample.actions.GroupedToDefaultAction"
|
||||||
|
id="PluginSample.GroupedToDefaultAction"/>
|
||||||
</group>
|
</group>
|
||||||
<group class="org.jetbrains.tutorials.sample.actions.DummyActionGroup" id="DummyActionGroup" text="Action Group"
|
<group class="org.jetbrains.tutorials.sample.actions.DummyActionGroup" id="DummyActionGroup" text="Action Group"
|
||||||
description="Illustration of an action group"
|
description="Illustration of an action group"
|
||||||
|
@ -56,7 +56,8 @@ public class LibrariesAction extends AnAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (jars.length() > 0) {
|
if (jars.length() > 0) {
|
||||||
Messages.showInfoMessage("Libraries for file " + virtualFile.getName() + ": " + jars.toString(), "Libraries Info");
|
Messages.showInfoMessage("Libraries for file " + virtualFile.getName() + ": " + jars.toString(),
|
||||||
|
"Libraries Info");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ public class ShowSourceRootsActions extends AnAction {
|
|||||||
for (VirtualFile file : vFiles) {
|
for (VirtualFile file : vFiles) {
|
||||||
sourceRootsList.append(file.getUrl()).append("\n");
|
sourceRootsList.append(file.getUrl()).append("\n");
|
||||||
}
|
}
|
||||||
Messages.showInfoMessage("Source roots for the " + projectName + " plugin:\n" + sourceRootsList, "Project Properties");
|
Messages.showInfoMessage("Source roots for the " + projectName + " plugin:\n" + sourceRootsList,
|
||||||
|
"Project Properties");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -158,7 +158,9 @@ public class ImagesProjectNode extends AbstractTreeNode<VirtualFile> {
|
|||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ProjectView.getInstance(myProject).getProjectViewPaneById(ImagesProjectViewPane.ID).updateFromRoot(true);
|
ProjectView.getInstance(myProject)
|
||||||
|
.getProjectViewPaneById(ImagesProjectViewPane.ID)
|
||||||
|
.updateFromRoot(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<!-- Add your extensions here -->
|
<!-- Add your extensions here -->
|
||||||
<moduleBuilder builderClass="org.jetbrains.tutorials.project.wizard.DemoModuleWizardStep" id="DEMO_STEP" order="first"/>
|
<moduleBuilder builderClass="org.jetbrains.tutorials.project.wizard.DemoModuleWizardStep"
|
||||||
|
id="DEMO_STEP"
|
||||||
|
order="first"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|
||||||
<application-components>
|
<application-components>
|
||||||
|
@ -24,7 +24,8 @@ public class DemoModuleWizardStep extends ModuleBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext, @NotNull ModulesProvider modulesProvider) {
|
public ModuleWizardStep[] createWizardSteps(@NotNull WizardContext wizardContext,
|
||||||
|
@NotNull ModulesProvider modulesProvider) {
|
||||||
return new ModuleWizardStep[]{new ModuleWizardStep() {
|
return new ModuleWizardStep[]{new ModuleWizardStep() {
|
||||||
@Override
|
@Override
|
||||||
public JComponent getComponent() {
|
public JComponent getComponent() {
|
||||||
|
@ -14,10 +14,12 @@ public class BaseActionGroup extends ActionGroup {
|
|||||||
public AnAction[] getChildren(AnActionEvent anActionEvent) {
|
public AnAction[] getChildren(AnActionEvent anActionEvent) {
|
||||||
return new AnAction[]{new MyAction()};
|
return new AnAction[]{new MyAction()};
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyAction extends AnAction {
|
class MyAction extends AnAction {
|
||||||
public MyAction() {
|
public MyAction() {
|
||||||
super("Dynamically Added Action");
|
super("Dynamically Added Action");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
|
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
|
||||||
//does nothing
|
//does nothing
|
||||||
|
@ -30,7 +30,8 @@ public class DemoRunConfiguration extends RunConfigurationBase {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws ExecutionException {
|
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment) throws
|
||||||
|
ExecutionException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.parser;
|
package com.simpleplugin.parser;
|
||||||
|
|
||||||
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.lang.LightPsiParser;
|
||||||
import com.intellij.lang.PsiBuilder;
|
import com.intellij.lang.PsiBuilder;
|
||||||
import com.intellij.lang.PsiBuilder.Marker;
|
import com.intellij.lang.PsiBuilder.Marker;
|
||||||
import static com.simpleplugin.psi.SimpleTypes.*;
|
|
||||||
import static com.intellij.lang.parser.GeneratedParserUtilBase.*;
|
|
||||||
import com.intellij.psi.tree.IElementType;
|
|
||||||
import com.intellij.lang.ASTNode;
|
|
||||||
import com.intellij.psi.tree.TokenSet;
|
|
||||||
import com.intellij.lang.PsiParser;
|
import com.intellij.lang.PsiParser;
|
||||||
import com.intellij.lang.LightPsiParser;
|
import com.intellij.psi.tree.IElementType;
|
||||||
|
|
||||||
|
import static com.intellij.lang.parser.GeneratedParserUtilBase.*;
|
||||||
|
import static com.simpleplugin.psi.SimpleTypes.*;
|
||||||
|
|
||||||
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
|
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
|
||||||
public class SimpleParser implements PsiParser, LightPsiParser {
|
public class SimpleParser implements PsiParser, LightPsiParser {
|
||||||
@ -25,8 +25,7 @@ public class SimpleParser implements PsiParser, LightPsiParser {
|
|||||||
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
|
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
|
||||||
if (t == PROPERTY) {
|
if (t == PROPERTY) {
|
||||||
r = property(b, 0);
|
r = property(b, 0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
r = parse_root_(t, b, 0);
|
r = parse_root_(t, b, 0);
|
||||||
}
|
}
|
||||||
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
|
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi;
|
package com.simpleplugin.psi;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.jetbrains.annotations.*;
|
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import com.intellij.navigation.ItemPresentation;
|
import com.intellij.navigation.ItemPresentation;
|
||||||
|
import com.intellij.psi.PsiElement;
|
||||||
|
|
||||||
public interface SimpleProperty extends SimpleNamedElement {
|
public interface SimpleProperty extends SimpleNamedElement {
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi;
|
package com.simpleplugin.psi;
|
||||||
|
|
||||||
import com.intellij.psi.tree.IElementType;
|
|
||||||
import com.intellij.psi.PsiElement;
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import com.simpleplugin.psi.impl.*;
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.tree.IElementType;
|
||||||
|
import com.simpleplugin.psi.impl.SimplePropertyImpl;
|
||||||
|
|
||||||
public interface SimpleTypes {
|
public interface SimpleTypes {
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi;
|
package com.simpleplugin.psi;
|
||||||
|
|
||||||
import org.jetbrains.annotations.*;
|
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
|
import com.intellij.psi.PsiElementVisitor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SimpleVisitor extends PsiElementVisitor {
|
public class SimpleVisitor extends PsiElementVisitor {
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
// This is a generated file. Not intended for manual editing.
|
// This is a generated file. Not intended for manual editing.
|
||||||
package com.simpleplugin.psi.impl;
|
package com.simpleplugin.psi.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.jetbrains.annotations.*;
|
|
||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
|
import com.intellij.navigation.ItemPresentation;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.PsiElementVisitor;
|
import com.intellij.psi.PsiElementVisitor;
|
||||||
import com.intellij.psi.util.PsiTreeUtil;
|
import com.simpleplugin.psi.SimpleProperty;
|
||||||
import static com.simpleplugin.psi.SimpleTypes.*;
|
import com.simpleplugin.psi.SimpleVisitor;
|
||||||
import com.simpleplugin.psi.*;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import com.intellij.navigation.ItemPresentation;
|
|
||||||
|
|
||||||
public class SimplePropertyImpl extends SimpleNamedElementImpl implements SimpleProperty {
|
public class SimplePropertyImpl extends SimpleNamedElementImpl implements SimpleProperty {
|
||||||
|
|
||||||
|
@ -40,7 +40,9 @@
|
|||||||
<!-- Add your extensions here -->
|
<!-- Add your extensions here -->
|
||||||
<fileTypeFactory implementation="com.simpleplugin.SimpleFileTypeFactory"/>
|
<fileTypeFactory implementation="com.simpleplugin.SimpleFileTypeFactory"/>
|
||||||
<lang.parserDefinition language="Simple" implementationClass="com.simpleplugin.SimpleParserDefinition"/>
|
<lang.parserDefinition language="Simple" implementationClass="com.simpleplugin.SimpleParserDefinition"/>
|
||||||
<lang.syntaxHighlighterFactory key="Simple" language="Simple" implementationClass="com.simpleplugin.SimpleSyntaxHighlighterFactory"/>
|
<lang.syntaxHighlighterFactory key="Simple"
|
||||||
|
language="Simple"
|
||||||
|
implementationClass="com.simpleplugin.SimpleSyntaxHighlighterFactory"/>
|
||||||
<colorSettingsPage implementation="com.simpleplugin.SimpleColorSettingsPage"/>
|
<colorSettingsPage implementation="com.simpleplugin.SimpleColorSettingsPage"/>
|
||||||
<annotator language="JAVA" implementationClass="com.simpleplugin.SimpleAnnotator"/>
|
<annotator language="JAVA" implementationClass="com.simpleplugin.SimpleAnnotator"/>
|
||||||
<codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.simpleplugin.SimpleLineMarkerProvider"/>
|
<codeInsight.lineMarkerProvider language="JAVA" implementationClass="com.simpleplugin.SimpleLineMarkerProvider"/>
|
||||||
|
@ -4,7 +4,7 @@ import com.intellij.codeInsight.intention.impl.BaseIntentionAction;
|
|||||||
import com.intellij.lang.ASTNode;
|
import com.intellij.lang.ASTNode;
|
||||||
import com.intellij.openapi.application.ApplicationManager;
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.command.WriteCommandAction;
|
import com.intellij.openapi.command.WriteCommandAction;
|
||||||
import com.intellij.openapi.editor.*;
|
import com.intellij.openapi.editor.Editor;
|
||||||
import com.intellij.openapi.fileChooser.FileChooser;
|
import com.intellij.openapi.fileChooser.FileChooser;
|
||||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||||
@ -51,16 +51,19 @@ class CreatePropertyQuickFix extends BaseIntentionAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws IncorrectOperationException {
|
public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws
|
||||||
|
IncorrectOperationException {
|
||||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Collection<VirtualFile> virtualFiles = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, SimpleFileType.INSTANCE,
|
Collection<VirtualFile> virtualFiles =
|
||||||
|
FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, SimpleFileType.INSTANCE,
|
||||||
GlobalSearchScope.allScope(project));
|
GlobalSearchScope.allScope(project));
|
||||||
if (virtualFiles.size() == 1) {
|
if (virtualFiles.size() == 1) {
|
||||||
createProperty(project, virtualFiles.iterator().next());
|
createProperty(project, virtualFiles.iterator().next());
|
||||||
} else {
|
} else {
|
||||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileDescriptor(SimpleFileType.INSTANCE);
|
final FileChooserDescriptor descriptor =
|
||||||
|
FileChooserDescriptorFactory.createSingleFileDescriptor(SimpleFileType.INSTANCE);
|
||||||
descriptor.setRoots(project.getBaseDir());
|
descriptor.setRoots(project.getBaseDir());
|
||||||
final VirtualFile file = FileChooser.chooseFile(descriptor, project, null);
|
final VirtualFile file = FileChooser.chooseFile(descriptor, project, null);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
|
@ -16,7 +16,9 @@ public class SimpleFindUsagesProvider implements FindUsagesProvider {
|
|||||||
@Override
|
@Override
|
||||||
public WordsScanner getWordsScanner() {
|
public WordsScanner getWordsScanner() {
|
||||||
return new DefaultWordsScanner(new SimpleLexerAdapter(),
|
return new DefaultWordsScanner(new SimpleLexerAdapter(),
|
||||||
TokenSet.create(SimpleTypes.KEY), TokenSet.create(SimpleTypes.COMMENT), TokenSet.EMPTY);
|
TokenSet.create(SimpleTypes.KEY),
|
||||||
|
TokenSet.create(SimpleTypes.COMMENT),
|
||||||
|
TokenSet.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +25,8 @@ public class SimpleFoldingBuilder extends FoldingBuilderEx {
|
|||||||
FoldingGroup group = FoldingGroup.newGroup("simple");
|
FoldingGroup group = FoldingGroup.newGroup("simple");
|
||||||
|
|
||||||
List<FoldingDescriptor> descriptors = new ArrayList<FoldingDescriptor>();
|
List<FoldingDescriptor> descriptors = new ArrayList<FoldingDescriptor>();
|
||||||
Collection<PsiLiteralExpression> literalExpressions = PsiTreeUtil.findChildrenOfType(root, PsiLiteralExpression.class);
|
Collection<PsiLiteralExpression> literalExpressions =
|
||||||
|
PsiTreeUtil.findChildrenOfType(root, PsiLiteralExpression.class);
|
||||||
for (final PsiLiteralExpression literalExpression : literalExpressions) {
|
for (final PsiLiteralExpression literalExpression : literalExpressions) {
|
||||||
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
||||||
|
|
||||||
@ -36,12 +37,14 @@ public class SimpleFoldingBuilder extends FoldingBuilderEx {
|
|||||||
if (properties.size() == 1) {
|
if (properties.size() == 1) {
|
||||||
descriptors.add(new FoldingDescriptor(literalExpression.getNode(),
|
descriptors.add(new FoldingDescriptor(literalExpression.getNode(),
|
||||||
new TextRange(literalExpression.getTextRange().getStartOffset() + 1,
|
new TextRange(literalExpression.getTextRange().getStartOffset() + 1,
|
||||||
literalExpression.getTextRange().getEndOffset() - 1), group) {
|
literalExpression.getTextRange().getEndOffset() - 1),
|
||||||
|
group) {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getPlaceholderText() {
|
public String getPlaceholderText() {
|
||||||
// IMPORTANT: keys can come with no values, so a test for null is needed
|
// IMPORTANT: keys can come with no values, so a test for null is needed
|
||||||
// IMPORTANT: Convert embedded \n to backslash n, so that the string will look like it has LF embedded in it and embedded " to escaped "
|
// IMPORTANT: Convert embedded \n to backslash n, so that the string will look like it has LF embedded
|
||||||
|
// in it and embedded " to escaped "
|
||||||
String valueOf = properties.get(0).getValue();
|
String valueOf = properties.get(0).getValue();
|
||||||
return valueOf == null ? "" : valueOf.replaceAll("\n", "\\n").replaceAll("\"", "\\\\\"");
|
return valueOf == null ? "" : valueOf.replaceAll("\n", "\\n").replaceAll("\"", "\\\\\"");
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,21 @@ public class SimpleFormattingModelBuilder implements FormattingModelBuilder {
|
|||||||
@Override
|
@Override
|
||||||
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
|
public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {
|
||||||
return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(),
|
return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(),
|
||||||
new SimpleBlock(element.getNode(), Wrap.createWrap(WrapType.NONE, false),
|
new SimpleBlock(element.getNode(),
|
||||||
Alignment.createAlignment(), createSpaceBuilder(settings)), settings);
|
Wrap.createWrap(WrapType.NONE,
|
||||||
|
false),
|
||||||
|
Alignment.createAlignment(),
|
||||||
|
createSpaceBuilder(settings)),
|
||||||
|
settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
|
private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
|
||||||
return new SpacingBuilder(settings, SimpleLanguage.INSTANCE).
|
return new SpacingBuilder(settings, SimpleLanguage.INSTANCE).
|
||||||
around(SimpleTypes.SEPARATOR).spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS).
|
around(SimpleTypes.SEPARATOR)
|
||||||
before(SimpleTypes.PROPERTY).none();
|
.spaceIf(settings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
|
||||||
|
.
|
||||||
|
before(SimpleTypes.PROPERTY)
|
||||||
|
.none();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
package com.simpleplugin;
|
package com.simpleplugin;
|
||||||
|
|
||||||
import com.intellij.lexer.FlexLexer;
|
import com.intellij.lexer.FlexLexer;
|
||||||
|
import com.intellij.psi.TokenType;
|
||||||
import com.intellij.psi.tree.IElementType;
|
import com.intellij.psi.tree.IElementType;
|
||||||
import com.simpleplugin.psi.SimpleTypes;
|
import com.simpleplugin.psi.SimpleTypes;
|
||||||
import com.intellij.psi.TokenType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -15,10 +15,14 @@ import com.intellij.psi.TokenType;
|
|||||||
* <tt>/Users/vlad/src/SimplePlugin/src/com/simpleplugin/Simple.flex</tt>
|
* <tt>/Users/vlad/src/SimplePlugin/src/com/simpleplugin/Simple.flex</tt>
|
||||||
*/
|
*/
|
||||||
class SimpleLexer implements FlexLexer {
|
class SimpleLexer implements FlexLexer {
|
||||||
/** initial size of the lookahead buffer */
|
/**
|
||||||
|
* initial size of the lookahead buffer
|
||||||
|
*/
|
||||||
private static final int ZZ_BUFFERSIZE = 16384;
|
private static final int ZZ_BUFFERSIZE = 16384;
|
||||||
|
|
||||||
/** lexical states */
|
/**
|
||||||
|
* lexical states
|
||||||
|
*/
|
||||||
public static final int WAITING_VALUE = 2;
|
public static final int WAITING_VALUE = 2;
|
||||||
public static final int YYINITIAL = 0;
|
public static final int YYINITIAL = 0;
|
||||||
|
|
||||||
@ -177,33 +181,51 @@ class SimpleLexer implements FlexLexer {
|
|||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** the current state of the DFA */
|
/**
|
||||||
|
* the current state of the DFA
|
||||||
|
*/
|
||||||
private int zzState;
|
private int zzState;
|
||||||
|
|
||||||
/** the current lexical state */
|
/**
|
||||||
|
* the current lexical state
|
||||||
|
*/
|
||||||
private int zzLexicalState = YYINITIAL;
|
private int zzLexicalState = YYINITIAL;
|
||||||
|
|
||||||
/** this buffer contains the current text to be matched and is
|
/**
|
||||||
the source of the yytext() string */
|
* this buffer contains the current text to be matched and is
|
||||||
|
* the source of the yytext() string
|
||||||
|
*/
|
||||||
private CharSequence zzBuffer = "";
|
private CharSequence zzBuffer = "";
|
||||||
|
|
||||||
/** this buffer may contains the current text array to be matched when it is cheap to acquire it */
|
/**
|
||||||
|
* this buffer may contains the current text array to be matched when it is cheap to acquire it
|
||||||
|
*/
|
||||||
private char[] zzBufferArray;
|
private char[] zzBufferArray;
|
||||||
|
|
||||||
/** the textposition at the last accepting state */
|
/**
|
||||||
|
* the textposition at the last accepting state
|
||||||
|
*/
|
||||||
private int zzMarkedPos;
|
private int zzMarkedPos;
|
||||||
|
|
||||||
/** the textposition at the last state to be included in yytext */
|
/**
|
||||||
|
* the textposition at the last state to be included in yytext
|
||||||
|
*/
|
||||||
private int zzPushbackPos;
|
private int zzPushbackPos;
|
||||||
|
|
||||||
/** the current text position in the buffer */
|
/**
|
||||||
|
* the current text position in the buffer
|
||||||
|
*/
|
||||||
private int zzCurrentPos;
|
private int zzCurrentPos;
|
||||||
|
|
||||||
/** startRead marks the beginning of the yytext() string in the buffer */
|
/**
|
||||||
|
* startRead marks the beginning of the yytext() string in the buffer
|
||||||
|
*/
|
||||||
private int zzStartRead;
|
private int zzStartRead;
|
||||||
|
|
||||||
/** endRead marks the last character in the buffer, that has been read
|
/**
|
||||||
from input */
|
* endRead marks the last character in the buffer, that has been read
|
||||||
|
* from input
|
||||||
|
*/
|
||||||
private int zzEndRead;
|
private int zzEndRead;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -211,10 +233,14 @@ class SimpleLexer implements FlexLexer {
|
|||||||
*/
|
*/
|
||||||
private boolean zzAtBOL = true;
|
private boolean zzAtBOL = true;
|
||||||
|
|
||||||
/** zzAtEOF == true <=> the scanner is at the EOF */
|
/**
|
||||||
|
* zzAtEOF == true <=> the scanner is at the EOF
|
||||||
|
*/
|
||||||
private boolean zzAtEOF;
|
private boolean zzAtEOF;
|
||||||
|
|
||||||
/** denotes if the user-EOF-code has already been executed */
|
/**
|
||||||
|
* denotes if the user-EOF-code has already been executed
|
||||||
|
*/
|
||||||
private boolean zzEOFDone;
|
private boolean zzEOFDone;
|
||||||
|
|
||||||
|
|
||||||
@ -273,8 +299,7 @@ class SimpleLexer implements FlexLexer {
|
|||||||
* Refills the input buffer.
|
* Refills the input buffer.
|
||||||
*
|
*
|
||||||
* @return <code>false</code>, iff there was new input.
|
* @return <code>false</code>, iff there was new input.
|
||||||
*
|
* @throws java.io.IOException if any I/O-Error occurs
|
||||||
* @exception java.io.IOException if any I/O-Error occurs
|
|
||||||
*/
|
*/
|
||||||
private boolean zzRefill() throws java.io.IOException {
|
private boolean zzRefill() throws java.io.IOException {
|
||||||
return true;
|
return true;
|
||||||
@ -310,12 +335,11 @@ class SimpleLexer implements FlexLexer {
|
|||||||
/**
|
/**
|
||||||
* Returns the character at position <tt>pos</tt> from the
|
* Returns the character at position <tt>pos</tt> from the
|
||||||
* matched text.
|
* matched text.
|
||||||
*
|
* <p>
|
||||||
* It is equivalent to yytext().charAt(pos), but faster
|
* It is equivalent to yytext().charAt(pos), but faster
|
||||||
*
|
*
|
||||||
* @param pos the position of the character to fetch.
|
* @param pos the position of the character to fetch.
|
||||||
* A value from 0 to yylength()-1.
|
* A value from 0 to yylength()-1.
|
||||||
*
|
|
||||||
* @return the character at position pos
|
* @return the character at position pos
|
||||||
*/
|
*/
|
||||||
public final char yycharat(int pos) {
|
public final char yycharat(int pos) {
|
||||||
@ -333,13 +357,13 @@ class SimpleLexer implements FlexLexer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports an error that occured while scanning.
|
* Reports an error that occured while scanning.
|
||||||
*
|
* <p>
|
||||||
* In a wellformed scanner (no or only correct usage of
|
* In a wellformed scanner (no or only correct usage of
|
||||||
* yypushback(int) and a match-all fallback rule) this method
|
* yypushback(int) and a match-all fallback rule) this method
|
||||||
* will only be called with things that "Can't Possibly Happen".
|
* will only be called with things that "Can't Possibly Happen".
|
||||||
* If this method is called, something is seriously wrong
|
* If this method is called, something is seriously wrong
|
||||||
* (e.g. a JFlex bug producing a faulty scanner etc.).
|
* (e.g. a JFlex bug producing a faulty scanner etc.).
|
||||||
*
|
* <p>
|
||||||
* Usual syntax/scanner level error handling should be done
|
* Usual syntax/scanner level error handling should be done
|
||||||
* in error fallback rules.
|
* in error fallback rules.
|
||||||
*
|
*
|
||||||
@ -349,8 +373,7 @@ class SimpleLexer implements FlexLexer {
|
|||||||
String message;
|
String message;
|
||||||
try {
|
try {
|
||||||
message = ZZ_ERROR_MSG[errorCode];
|
message = ZZ_ERROR_MSG[errorCode];
|
||||||
}
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
catch (ArrayIndexOutOfBoundsException e) {
|
|
||||||
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +383,7 @@ class SimpleLexer implements FlexLexer {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Pushes the specified amount of characters back into the input stream.
|
* Pushes the specified amount of characters back into the input stream.
|
||||||
*
|
* <p>
|
||||||
* They will be read again by then next call of the scanning method
|
* They will be read again by then next call of the scanning method
|
||||||
*
|
*
|
||||||
* @param number the number of characters to be read again.
|
* @param number the number of characters to be read again.
|
||||||
@ -391,7 +414,7 @@ class SimpleLexer implements FlexLexer {
|
|||||||
* the end of input is encountered or an I/O-Error occurs.
|
* the end of input is encountered or an I/O-Error occurs.
|
||||||
*
|
*
|
||||||
* @return the next token
|
* @return the next token
|
||||||
* @exception java.io.IOException if any I/O-Error occurs
|
* @throws java.io.IOException if any I/O-Error occurs
|
||||||
*/
|
*/
|
||||||
public IElementType advance() throws java.io.IOException {
|
public IElementType advance() throws java.io.IOException {
|
||||||
int zzInput;
|
int zzInput;
|
||||||
@ -419,7 +442,8 @@ class SimpleLexer implements FlexLexer {
|
|||||||
zzState = ZZ_LEXSTATE[zzLexicalState];
|
zzState = ZZ_LEXSTATE[zzLexicalState];
|
||||||
|
|
||||||
|
|
||||||
zzForAction: {
|
zzForAction:
|
||||||
|
{
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
if (zzCurrentPosL < zzEndReadL)
|
if (zzCurrentPosL < zzEndReadL)
|
||||||
@ -427,8 +451,7 @@ class SimpleLexer implements FlexLexer {
|
|||||||
else if (zzAtEOF) {
|
else if (zzAtEOF) {
|
||||||
zzInput = YYEOF;
|
zzInput = YYEOF;
|
||||||
break zzForAction;
|
break zzForAction;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
// store back cached positions
|
// store back cached positions
|
||||||
zzCurrentPos = zzCurrentPosL;
|
zzCurrentPos = zzCurrentPosL;
|
||||||
zzMarkedPos = zzMarkedPosL;
|
zzMarkedPos = zzMarkedPosL;
|
||||||
@ -441,8 +464,7 @@ class SimpleLexer implements FlexLexer {
|
|||||||
if (eof) {
|
if (eof) {
|
||||||
zzInput = YYEOF;
|
zzInput = YYEOF;
|
||||||
break zzForAction;
|
break zzForAction;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
|
zzInput = (zzBufferArrayL != null ? zzBufferArrayL[zzCurrentPosL++] : zzBufferL.charAt(zzCurrentPosL++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,41 +486,53 @@ class SimpleLexer implements FlexLexer {
|
|||||||
zzMarkedPos = zzMarkedPosL;
|
zzMarkedPos = zzMarkedPosL;
|
||||||
|
|
||||||
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
|
||||||
case 6:
|
case 6: {
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.VALUE;
|
yybegin(YYINITIAL);
|
||||||
|
return SimpleTypes.VALUE;
|
||||||
}
|
}
|
||||||
case 8: break;
|
case 8:
|
||||||
case 5:
|
break;
|
||||||
{ yybegin(WAITING_VALUE); return SimpleTypes.SEPARATOR;
|
case 5: {
|
||||||
|
yybegin(WAITING_VALUE);
|
||||||
|
return SimpleTypes.SEPARATOR;
|
||||||
}
|
}
|
||||||
case 9: break;
|
case 9:
|
||||||
case 4:
|
break;
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.COMMENT;
|
case 4: {
|
||||||
|
yybegin(YYINITIAL);
|
||||||
|
return SimpleTypes.COMMENT;
|
||||||
}
|
}
|
||||||
case 10: break;
|
case 10:
|
||||||
case 3:
|
break;
|
||||||
{ return TokenType.BAD_CHARACTER;
|
case 3: {
|
||||||
|
return TokenType.BAD_CHARACTER;
|
||||||
}
|
}
|
||||||
case 11: break;
|
case 11:
|
||||||
case 2:
|
break;
|
||||||
{ yybegin(YYINITIAL); return TokenType.WHITE_SPACE;
|
case 2: {
|
||||||
|
yybegin(YYINITIAL);
|
||||||
|
return TokenType.WHITE_SPACE;
|
||||||
}
|
}
|
||||||
case 12: break;
|
case 12:
|
||||||
case 7:
|
break;
|
||||||
{ yybegin(WAITING_VALUE); return TokenType.WHITE_SPACE;
|
case 7: {
|
||||||
|
yybegin(WAITING_VALUE);
|
||||||
|
return TokenType.WHITE_SPACE;
|
||||||
}
|
}
|
||||||
case 13: break;
|
case 13:
|
||||||
case 1:
|
break;
|
||||||
{ yybegin(YYINITIAL); return SimpleTypes.KEY;
|
case 1: {
|
||||||
|
yybegin(YYINITIAL);
|
||||||
|
return SimpleTypes.KEY;
|
||||||
}
|
}
|
||||||
case 14: break;
|
case 14:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
||||||
zzAtEOF = true;
|
zzAtEOF = true;
|
||||||
zzDoEOF();
|
zzDoEOF();
|
||||||
return null;
|
return null;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
zzScanError(ZZ_NO_MATCH);
|
zzScanError(ZZ_NO_MATCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
||||||
@Override
|
@Override
|
||||||
protected void collectNavigationMarkers(@NotNull PsiElement element, Collection<? super RelatedItemLineMarkerInfo> result) {
|
protected void collectNavigationMarkers(@NotNull PsiElement element,
|
||||||
|
Collection<? super RelatedItemLineMarkerInfo> result) {
|
||||||
if (element instanceof PsiLiteralExpression) {
|
if (element instanceof PsiLiteralExpression) {
|
||||||
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
|
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
|
||||||
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
||||||
|
@ -21,7 +21,8 @@ public class SimpleParserDefinition implements ParserDefinition{
|
|||||||
public static final TokenSet WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE);
|
public static final TokenSet WHITE_SPACES = TokenSet.create(TokenType.WHITE_SPACE);
|
||||||
public static final TokenSet COMMENTS = TokenSet.create(SimpleTypes.COMMENT);
|
public static final TokenSet COMMENTS = TokenSet.create(SimpleTypes.COMMENT);
|
||||||
|
|
||||||
public static final IFileElementType FILE = new IFileElementType(Language.<SimpleLanguage>findInstance(SimpleLanguage.class));
|
public static final IFileElementType FILE =
|
||||||
|
new IFileElementType(Language.<SimpleLanguage>findInstance(SimpleLanguage.class));
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,11 +13,15 @@ public class SimpleReferenceContributor extends PsiReferenceContributor {
|
|||||||
new PsiReferenceProvider() {
|
new PsiReferenceProvider() {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
|
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
|
||||||
|
@NotNull ProcessingContext
|
||||||
|
context) {
|
||||||
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
|
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
|
||||||
String value = literalExpression.getValue() instanceof String ? (String)literalExpression.getValue() : null;
|
String value = literalExpression.getValue() instanceof String ?
|
||||||
|
(String) literalExpression.getValue() : null;
|
||||||
if (value != null && value.startsWith("simple" + ":")) {
|
if (value != null && value.startsWith("simple" + ":")) {
|
||||||
return new PsiReference[]{new SimpleReference(element, new TextRange(8, value.length() + 1))};
|
return new PsiReference[]{
|
||||||
|
new SimpleReference(element, new TextRange(8, value.length() + 1))};
|
||||||
}
|
}
|
||||||
return PsiReference.EMPTY_ARRAY;
|
return PsiReference.EMPTY_ARRAY;
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,16 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
|
import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAttributesKey;
|
||||||
|
|
||||||
public class SimpleSyntaxHighlighter extends SyntaxHighlighterBase {
|
public class SimpleSyntaxHighlighter extends SyntaxHighlighterBase {
|
||||||
public static final TextAttributesKey SEPARATOR = createTextAttributesKey("SIMPLE_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN);
|
public static final TextAttributesKey SEPARATOR =
|
||||||
public static final TextAttributesKey KEY = createTextAttributesKey("SIMPLE_KEY", DefaultLanguageHighlighterColors.KEYWORD);
|
createTextAttributesKey("SIMPLE_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN);
|
||||||
public static final TextAttributesKey VALUE = createTextAttributesKey("SIMPLE_VALUE", DefaultLanguageHighlighterColors.STRING);
|
public static final TextAttributesKey KEY =
|
||||||
public static final TextAttributesKey COMMENT = createTextAttributesKey("SIMPLE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
|
createTextAttributesKey("SIMPLE_KEY", DefaultLanguageHighlighterColors.KEYWORD);
|
||||||
public static final TextAttributesKey BAD_CHARACTER = createTextAttributesKey("SIMPLE_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
|
public static final TextAttributesKey VALUE =
|
||||||
|
createTextAttributesKey("SIMPLE_VALUE", DefaultLanguageHighlighterColors.STRING);
|
||||||
|
public static final TextAttributesKey COMMENT =
|
||||||
|
createTextAttributesKey("SIMPLE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
|
||||||
|
public static final TextAttributesKey BAD_CHARACTER =
|
||||||
|
createTextAttributesKey("SIMPLE_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
|
||||||
|
|
||||||
private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER};
|
private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER};
|
||||||
private static final TextAttributesKey[] SEPARATOR_KEYS = new TextAttributesKey[]{SEPARATOR};
|
private static final TextAttributesKey[] SEPARATOR_KEYS = new TextAttributesKey[]{SEPARATOR};
|
||||||
|
@ -18,7 +18,8 @@ import java.util.List;
|
|||||||
public class SimpleUtil {
|
public class SimpleUtil {
|
||||||
public static List<SimpleProperty> findProperties(Project project, String key) {
|
public static List<SimpleProperty> findProperties(Project project, String key) {
|
||||||
List<SimpleProperty> result = null;
|
List<SimpleProperty> result = null;
|
||||||
Collection<VirtualFile> virtualFiles = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, SimpleFileType.INSTANCE,
|
Collection<VirtualFile> virtualFiles =
|
||||||
|
FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, SimpleFileType.INSTANCE,
|
||||||
GlobalSearchScope.allScope(project));
|
GlobalSearchScope.allScope(project));
|
||||||
for (VirtualFile virtualFile : virtualFiles) {
|
for (VirtualFile virtualFile : virtualFiles) {
|
||||||
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
|
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
|
||||||
@ -41,7 +42,8 @@ public class SimpleUtil {
|
|||||||
|
|
||||||
public static List<SimpleProperty> findProperties(Project project) {
|
public static List<SimpleProperty> findProperties(Project project) {
|
||||||
List<SimpleProperty> result = new ArrayList<SimpleProperty>();
|
List<SimpleProperty> result = new ArrayList<SimpleProperty>();
|
||||||
Collection<VirtualFile> virtualFiles = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, SimpleFileType.INSTANCE,
|
Collection<VirtualFile> virtualFiles =
|
||||||
|
FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, SimpleFileType.INSTANCE,
|
||||||
GlobalSearchScope.allScope(project));
|
GlobalSearchScope.allScope(project));
|
||||||
for (VirtualFile virtualFile : virtualFiles) {
|
for (VirtualFile virtualFile : virtualFiles) {
|
||||||
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
|
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
|
||||||
|
@ -9,7 +9,6 @@ import com.simpleplugin.psi.SimpleElementFactory;
|
|||||||
import com.simpleplugin.psi.SimpleProperty;
|
import com.simpleplugin.psi.SimpleProperty;
|
||||||
import com.simpleplugin.psi.SimpleTypes;
|
import com.simpleplugin.psi.SimpleTypes;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import java.lang.String;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
public class Test {
|
public class Test {
|
||||||
public static void main(String[] args)<fold text=' { '> {
|
public static void main(String[] args)
|
||||||
|
|
||||||
|
<fold text=' { '>
|
||||||
|
|
||||||
|
{
|
||||||
</fold > System.out.println("<fold text='http://en.wikipedia.org/'>simple:website</fold>");<fold text = ' }' >
|
</fold > System.out.println("<fold text='http://en.wikipedia.org/'>simple:website</fold>");<fold text = ' }' >
|
||||||
}</fold>
|
}
|
||||||
public static void main1(String[] args)<fold text=' { '> {
|
|
||||||
</fold>System.out.println("<fold text='This is the value that could be looked up with the key \"key with spaces\".'>simple:key with spaces</fold>");<fold text=' }'>
|
</fold>
|
||||||
}</fold>
|
|
||||||
public static void main2(String[] args)<fold text=' { '> {
|
public static void main1(String[] args)
|
||||||
</fold>System.out.println("<fold text='Welcome to \n Wikipedia!'>simple:message</fold>");<fold text=' }'>
|
|
||||||
}</fold>
|
<fold text=' { '>
|
||||||
|
|
||||||
|
{
|
||||||
|
</fold > System.out.println(
|
||||||
|
"<fold text='This is the value that could be looked up with the key \"key with spaces\".'>simple:key with " +
|
||||||
|
"spaces</fold>");<
|
||||||
|
fold text = ' }' >
|
||||||
|
}
|
||||||
|
|
||||||
|
</fold>
|
||||||
|
|
||||||
|
public static void main2(String[] args)
|
||||||
|
|
||||||
|
<fold text=' { '>
|
||||||
|
|
||||||
|
{
|
||||||
|
</fold > System.out.println("<fold text='Welcome to \n Wikipedia!'>simple:message</fold>");<
|
||||||
|
fold text = ' }' >
|
||||||
|
}
|
||||||
|
|
||||||
|
</fold>
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,8 @@ public class MyToolWindowFactory implements ToolWindowFactory {
|
|||||||
// Get current date and time
|
// Get current date and time
|
||||||
Calendar instance = Calendar.getInstance();
|
Calendar instance = Calendar.getInstance();
|
||||||
currentDate.setText(String.valueOf(instance.get(Calendar.DAY_OF_MONTH)) + "/"
|
currentDate.setText(String.valueOf(instance.get(Calendar.DAY_OF_MONTH)) + "/"
|
||||||
+ String.valueOf(instance.get(Calendar.MONTH) + 1) + "/" + String.valueOf(instance.get(Calendar.YEAR)));
|
+ String.valueOf(instance.get(Calendar.MONTH) + 1) + "/" +
|
||||||
|
String.valueOf(instance.get(Calendar.YEAR)));
|
||||||
currentDate.setIcon(new ImageIcon(getClass().getResource("/myToolWindow/Calendar-icon.png")));
|
currentDate.setIcon(new ImageIcon(getClass().getResource("/myToolWindow/Calendar-icon.png")));
|
||||||
int min = instance.get(Calendar.MINUTE);
|
int min = instance.get(Calendar.MINUTE);
|
||||||
String strMin;
|
String strMin;
|
||||||
|
@ -18,7 +18,9 @@ import java.util.Collection;
|
|||||||
public class TextOnlyTreeStructureProvider implements TreeStructureProvider {
|
public class TextOnlyTreeStructureProvider implements TreeStructureProvider {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
|
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent,
|
||||||
|
@NotNull Collection<AbstractTreeNode> children,
|
||||||
|
ViewSettings settings) {
|
||||||
ArrayList<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
|
ArrayList<AbstractTreeNode> nodes = new ArrayList<AbstractTreeNode>();
|
||||||
for (AbstractTreeNode child : children) {
|
for (AbstractTreeNode child : children) {
|
||||||
if (child instanceof PsiFileNode) {
|
if (child instanceof PsiFileNode) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user