mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-27 08:47:50 +08:00
Code samples: Change the CONTINUATION_INDENT_SIZE from 8 to 4 and reformat code.
We use INDENT_SIZE = 2 and continuation size should be at most 4 in this case.
This commit is contained in:
parent
9519c2e9e3
commit
e87f195b80
@ -58,8 +58,8 @@ public class ComparingStringReferencesInspection extends AbstractBaseJavaLocalIn
|
||||
if (isStringType(lOperand) || isStringType(rOperand)) {
|
||||
// Identified an expression with potential problems, register problem with the quick fix object
|
||||
holder.registerProblem(expression,
|
||||
InspectionBundle.message("inspection.comparing.string.references.problem.descriptor"),
|
||||
myQuickFix);
|
||||
InspectionBundle.message("inspection.comparing.string.references.problem.descriptor"),
|
||||
myQuickFix);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,7 +75,7 @@ public class ComparingStringReferencesInspection extends AbstractBaseJavaLocalIn
|
||||
|
||||
private static boolean isNullLiteral(PsiExpression expression) {
|
||||
return expression instanceof PsiLiteralExpression &&
|
||||
((PsiLiteralExpression) expression).getValue() == null;
|
||||
((PsiLiteralExpression) expression).getValue() == null;
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -115,7 +115,7 @@ public class ComparingStringReferencesInspection extends AbstractBaseJavaLocalIn
|
||||
|
||||
PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory();
|
||||
PsiMethodCallExpression equalsCall =
|
||||
(PsiMethodCallExpression) factory.createExpressionFromText("a.equals(b)", null);
|
||||
(PsiMethodCallExpression) factory.createExpressionFromText("a.equals(b)", null);
|
||||
|
||||
PsiExpression qualifierExpression = equalsCall.getMethodExpression().getQualifierExpression();
|
||||
assert qualifierExpression != null;
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
public class ComparingStringReferencesInspectionTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
private static final String QUICK_FIX_NAME =
|
||||
InspectionBundle.message("inspection.comparing.string.references.use.quickfix");
|
||||
InspectionBundle.message("inspection.comparing.string.references.use.quickfix");
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
|
@ -41,7 +41,7 @@ public class EditorAreaIllustration extends AnAction {
|
||||
int caretOffset = primaryCaret.getOffset();
|
||||
// Build and display the caret report.
|
||||
String report = logicalPos + "\n" + visualPos + "\n" +
|
||||
"Offset: " + caretOffset;
|
||||
"Offset: " + caretOffset;
|
||||
Messages.showInfoMessage(report, "Caret Parameters Inside The Editor");
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class EditorHandlerIllustration extends AnAction {
|
||||
final EditorActionManager actionManager = EditorActionManager.getInstance();
|
||||
// Get the action handler registered to clone carets
|
||||
final EditorActionHandler actionHandler =
|
||||
actionManager.getActionHandler(IdeActions.ACTION_EDITOR_CLONE_CARET_BELOW);
|
||||
actionManager.getActionHandler(IdeActions.ACTION_EDITOR_CLONE_CARET_BELOW);
|
||||
// Clone one caret below the active caret
|
||||
actionHandler.execute(editor, editor.getCaretModel().getPrimaryCaret(), e.getDataContext());
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class EditorIllustrationAction extends AnAction {
|
||||
// Replace the selection with a fixed string.
|
||||
// Must do this document change in a write action context.
|
||||
WriteCommandAction.runWriteCommandAction(project, () ->
|
||||
document.replaceString(start, end, "Replacement")
|
||||
document.replaceString(start, end, "Replacement")
|
||||
);
|
||||
// De-select the text range that was just replaced
|
||||
primaryCaret.removeSelection();
|
||||
@ -67,7 +67,7 @@ public class EditorIllustrationAction extends AnAction {
|
||||
final Editor editor = e.getData(CommonDataKeys.EDITOR);
|
||||
// Set visibility and enable only in case of existing project and editor and if a selection exists
|
||||
e.getPresentation().setEnabledAndVisible(
|
||||
project != null && editor != null && editor.getSelectionModel().hasSelection()
|
||||
project != null && editor != null && editor.getSelectionModel().hasSelection()
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class DemoFacetConfiguration implements FacetConfiguration, PersistentSta
|
||||
@Override
|
||||
public FacetEditorTab[] createEditorTabs(FacetEditorContext context, FacetValidatorsManager manager) {
|
||||
return new FacetEditorTab[]{
|
||||
new DemoFacetEditorTab(myFacetState, context, manager)
|
||||
new DemoFacetEditorTab(myFacetState, context, manager)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ import java.awt.*;
|
||||
* Manages validation and modification of the {@link DemoFacet} state.
|
||||
*/
|
||||
public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
|
||||
private static final String FACET_PANEL_PROMPT = "Path To SDK: ";
|
||||
|
||||
private final DemoFacetState mySettings;
|
||||
@ -84,7 +85,7 @@ public class DemoFacetEditorTab extends FacetEditorTab {
|
||||
try {
|
||||
String newTextContent = myPath.getText();
|
||||
mySettings.setDemoFacetState(newTextContent);
|
||||
} catch(Exception e) {
|
||||
} catch (Exception e) {
|
||||
throw new ConfigurationException(e.toString());
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class ProjectCloseListener implements ProjectManagerListener {
|
||||
|
||||
// Get the counting service
|
||||
ProjectCountingService projectCountingService =
|
||||
ApplicationManager.getApplication().getService(ProjectCountingService.class);
|
||||
ApplicationManager.getApplication().getService(ProjectCountingService.class);
|
||||
// Decrement the count because a project just closed
|
||||
projectCountingService.decreaseOpenProjectCount();
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class ProjectOpenStartupActivity implements StartupActivity.DumbAware {
|
||||
|
||||
// Get the counting service
|
||||
ProjectCountingService projectCountingService =
|
||||
ApplicationManager.getApplication().getService(ProjectCountingService.class);
|
||||
ApplicationManager.getApplication().getService(ProjectCountingService.class);
|
||||
// Increment the project count
|
||||
projectCountingService.increaseOpenProjectCount();
|
||||
|
||||
@ -33,7 +33,7 @@ public class ProjectOpenStartupActivity implements StartupActivity.DumbAware {
|
||||
String message = "<br>The number of open projects exceeds the SDK plugin max_opened_projects limit.<br><br>";
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
Messages.showMessageDialog(project, message, title, Messages.getInformationIcon())
|
||||
Messages.showMessageDialog(project, message, title, Messages.getInformationIcon())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ public class PopupDialogAction extends AnAction {
|
||||
public void actionPerformed(@NotNull AnActionEvent event) {
|
||||
Project project = event.getProject();
|
||||
Messages.showMessageDialog(project,
|
||||
"Popup dialog action",
|
||||
"Greetings from PyCharm Basics Plugin",
|
||||
Messages.getInformationIcon());
|
||||
"Popup dialog action",
|
||||
"Greetings from PyCharm Basics Plugin",
|
||||
Messages.getInformationIcon());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,7 +84,7 @@ public class LibrariesAction extends AnAction {
|
||||
fileAndLibs = "None";
|
||||
}
|
||||
Messages.showInfoMessage("Libraries for file: " + fileAndLibs,
|
||||
"Libraries Info");
|
||||
"Libraries Info");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,11 +54,11 @@ public class ProjectFileIndexSampleAction extends AnAction {
|
||||
boolean isInLibraryClasses = projectFileIndex.isInLibraryClasses(virtualFile);
|
||||
boolean isInLibrarySource = projectFileIndex.isInLibrarySource(virtualFile);
|
||||
Messages.showInfoMessage("Module: " + moduleName + "\n" +
|
||||
"Module content root: " + moduleContentRoot + "\n" +
|
||||
"Is library file: " + isLibraryFile + "\n" +
|
||||
"Is in library classes: " + isInLibraryClasses +
|
||||
", Is in library source: " + isInLibrarySource,
|
||||
"Main File Info for" + virtualFile.getName());
|
||||
"Module content root: " + moduleContentRoot + "\n" +
|
||||
"Is library file: " + isLibraryFile + "\n" +
|
||||
"Is in library classes: " + isInLibraryClasses +
|
||||
", Is in library source: " + isInLibrarySource,
|
||||
"Main File Info for" + virtualFile.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,8 @@ public class ShowSourceRootsActions extends AnAction {
|
||||
sourceRootsList.append(file.getUrl()).append("\n");
|
||||
}
|
||||
Messages.showInfoMessage(
|
||||
"Source roots for the " + projectName + " plugin:\n" + sourceRootsList.toString(),
|
||||
"Project Properties"
|
||||
"Source roots for the " + projectName + " plugin:\n" + sourceRootsList.toString(),
|
||||
"Project Properties"
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -113,9 +113,9 @@ public class ImagesProjectNode extends ProjectViewNode<VirtualFile> {
|
||||
getImagesFiles(project).clear();
|
||||
scanImages(project);
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
ProjectView.getInstance(project)
|
||||
.getProjectViewPaneById(ImagesProjectViewPane.ID)
|
||||
.updateFromRoot(true),
|
||||
ProjectView.getInstance(project)
|
||||
.getProjectViewPaneById(ImagesProjectViewPane.ID)
|
||||
.updateFromRoot(true),
|
||||
project.getDisposed()
|
||||
);
|
||||
}
|
||||
|
@ -34,15 +34,15 @@ public class PsiNavigationDemoAction extends AnAction {
|
||||
if (element != null) {
|
||||
PsiMethod containingMethod = PsiTreeUtil.getParentOfType(element, PsiMethod.class);
|
||||
infoBuilder
|
||||
.append("Containing method: ")
|
||||
.append(containingMethod != null ? containingMethod.getName() : "none")
|
||||
.append("\n");
|
||||
.append("Containing method: ")
|
||||
.append(containingMethod != null ? containingMethod.getName() : "none")
|
||||
.append("\n");
|
||||
if (containingMethod != null) {
|
||||
PsiClass containingClass = containingMethod.getContainingClass();
|
||||
infoBuilder
|
||||
.append("Containing class: ")
|
||||
.append(containingClass != null ? containingClass.getName() : "none")
|
||||
.append("\n");
|
||||
.append("Containing class: ")
|
||||
.append(containingClass != null ? containingClass.getName() : "none")
|
||||
.append("\n");
|
||||
|
||||
infoBuilder.append("Local variables:\n");
|
||||
containingMethod.accept(new JavaRecursiveElementVisitor() {
|
||||
|
@ -24,7 +24,7 @@ public class DemoConfigurationFactory extends ConfigurationFactory {
|
||||
@NotNull
|
||||
@Override
|
||||
public RunConfiguration createTemplateConfiguration(
|
||||
@NotNull Project project) {
|
||||
@NotNull Project project) {
|
||||
return new DemoRunConfiguration(project, this, "Demo");
|
||||
}
|
||||
|
||||
|
@ -51,9 +51,9 @@ public class DemoRunConfiguration extends RunConfigurationBase<DemoRunConfigurat
|
||||
@Override
|
||||
protected ProcessHandler startProcess() throws ExecutionException {
|
||||
GeneralCommandLine commandLine =
|
||||
new GeneralCommandLine(getOptions().getScriptName());
|
||||
new GeneralCommandLine(getOptions().getScriptName());
|
||||
OSProcessHandler processHandler = ProcessHandlerFactory.getInstance()
|
||||
.createColoredProcessHandler(commandLine);
|
||||
.createColoredProcessHandler(commandLine);
|
||||
ProcessTerminatedListener.attach(processHandler);
|
||||
return processHandler;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import com.intellij.openapi.components.StoredProperty;
|
||||
public class DemoRunConfigurationOptions extends RunConfigurationOptions {
|
||||
|
||||
private final StoredProperty<String> myScriptName =
|
||||
string("").provideDelegate(this, "scriptName");
|
||||
string("").provideDelegate(this, "scriptName");
|
||||
|
||||
public String getScriptName() {
|
||||
return myScriptName.getValue(this);
|
||||
|
@ -11,7 +11,7 @@ public class DemoRunConfigurationType extends ConfigurationTypeBase {
|
||||
|
||||
protected DemoRunConfigurationType() {
|
||||
super(ID, "Demo", "Demo run configuration type",
|
||||
NotNullLazyValue.createValue(() -> AllIcons.Nodes.Console));
|
||||
NotNullLazyValue.createValue(() -> AllIcons.Nodes.Console));
|
||||
addFactory(new DemoConfigurationFactory(this));
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,10 @@ public class DemoSettingsEditor extends SettingsEditor<DemoRunConfiguration> {
|
||||
public DemoSettingsEditor() {
|
||||
scriptPathField = new TextFieldWithBrowseButton();
|
||||
scriptPathField.addBrowseFolderListener("Select Script File", null, null,
|
||||
FileChooserDescriptorFactory.createSingleFileDescriptor());
|
||||
FileChooserDescriptorFactory.createSingleFileDescriptor());
|
||||
myPanel = FormBuilder.createFormBuilder()
|
||||
.addLabeledComponent("Script file", scriptPathField)
|
||||
.getPanel();
|
||||
.addLabeledComponent("Script file", scriptPathField)
|
||||
.getPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,10 +21,10 @@ public class AppSettingsComponent {
|
||||
|
||||
public AppSettingsComponent() {
|
||||
myMainPanel = FormBuilder.createFormBuilder()
|
||||
.addLabeledComponent(new JBLabel("Enter user name: "), myUserNameText, 1, false)
|
||||
.addComponent(myIdeaUserStatus, 1)
|
||||
.addComponentFillVertically(new JPanel(), 0)
|
||||
.getPanel();
|
||||
.addLabeledComponent(new JBLabel("Enter user name: "), myUserNameText, 1, false)
|
||||
.addComponent(myIdeaUserStatus, 1)
|
||||
.addComponentFillVertically(new JPanel(), 0)
|
||||
.getPanel();
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
|
@ -16,8 +16,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
* these persistent application settings are stored.
|
||||
*/
|
||||
@State(
|
||||
name = "org.intellij.sdk.settings.AppSettingsState",
|
||||
storages = @Storage("SdkSettingsPlugin.xml")
|
||||
name = "org.intellij.sdk.settings.AppSettingsState",
|
||||
storages = @Storage("SdkSettingsPlugin.xml")
|
||||
)
|
||||
public class AppSettingsState implements PersistentStateComponent<AppSettingsState> {
|
||||
|
||||
|
@ -43,9 +43,9 @@ public class SimpleAnnotator implements Annotator {
|
||||
|
||||
// highlight "simple" prefix and ":" separator
|
||||
holder.newSilentAnnotation(HighlightSeverity.INFORMATION)
|
||||
.range(prefixRange).textAttributes(DefaultLanguageHighlighterColors.KEYWORD).create();
|
||||
.range(prefixRange).textAttributes(DefaultLanguageHighlighterColors.KEYWORD).create();
|
||||
holder.newSilentAnnotation(HighlightSeverity.INFORMATION)
|
||||
.range(separatorRange).textAttributes(SimpleSyntaxHighlighter.SEPARATOR).create();
|
||||
.range(separatorRange).textAttributes(SimpleSyntaxHighlighter.SEPARATOR).create();
|
||||
|
||||
|
||||
// Get the list of properties for given key
|
||||
@ -53,15 +53,15 @@ public class SimpleAnnotator implements Annotator {
|
||||
List<SimpleProperty> properties = SimpleUtil.findProperties(element.getProject(), key);
|
||||
if (properties.isEmpty()) {
|
||||
holder.newAnnotation(HighlightSeverity.ERROR, "Unresolved property")
|
||||
.range(keyRange)
|
||||
.highlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL)
|
||||
// ** Tutorial step 19. - Add a quick fix for the string containing possible properties
|
||||
.withFix(new SimpleCreatePropertyQuickFix(key))
|
||||
.create();
|
||||
.range(keyRange)
|
||||
.highlightType(ProblemHighlightType.LIKE_UNKNOWN_SYMBOL)
|
||||
// ** Tutorial step 19. - Add a quick fix for the string containing possible properties
|
||||
.withFix(new SimpleCreatePropertyQuickFix(key))
|
||||
.create();
|
||||
} else {
|
||||
// Found at least one property, force the text attributes to Simple syntax value character
|
||||
holder.newSilentAnnotation(HighlightSeverity.INFORMATION)
|
||||
.range(keyRange).textAttributes(SimpleSyntaxHighlighter.VALUE).create();
|
||||
.range(keyRange).textAttributes(SimpleSyntaxHighlighter.VALUE).create();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class SimpleBlock extends AbstractBlock {
|
||||
while (child != null) {
|
||||
if (child.getElementType() != TokenType.WHITE_SPACE) {
|
||||
Block block = new SimpleBlock(child, Wrap.createWrap(WrapType.NONE, false), Alignment.createAlignment(),
|
||||
spacingBuilder);
|
||||
spacingBuilder);
|
||||
blocks.add(block);
|
||||
}
|
||||
child = child.getTreeNext();
|
||||
|
@ -25,7 +25,7 @@ public class SimpleChooseByNameContributor implements ChooseByNameContributorEx
|
||||
@Nullable IdFilter filter) {
|
||||
Project project = Objects.requireNonNull(scope.getProject());
|
||||
List<String> propertyKeys = ContainerUtil.map(
|
||||
SimpleUtil.findProperties(project), SimpleProperty::getKey);
|
||||
SimpleUtil.findProperties(project), SimpleProperty::getKey);
|
||||
ContainerUtil.process(propertyKeys, processor);
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ public class SimpleChooseByNameContributor implements ChooseByNameContributorEx
|
||||
@NotNull Processor<? super NavigationItem> processor,
|
||||
@NotNull FindSymbolParameters parameters) {
|
||||
List<NavigationItem> properties = ContainerUtil.map(
|
||||
SimpleUtil.findProperties(parameters.getProject(), name),
|
||||
property -> (NavigationItem) property);
|
||||
SimpleUtil.findProperties(parameters.getProject(), name),
|
||||
property -> (NavigationItem) property);
|
||||
ContainerUtil.process(properties, processor);
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,10 @@ import java.util.Map;
|
||||
public class SimpleColorSettingsPage implements ColorSettingsPage {
|
||||
|
||||
private static final AttributesDescriptor[] DESCRIPTORS = new AttributesDescriptor[]{
|
||||
new AttributesDescriptor("Key", SimpleSyntaxHighlighter.KEY),
|
||||
new AttributesDescriptor("Separator", SimpleSyntaxHighlighter.SEPARATOR),
|
||||
new AttributesDescriptor("Value", SimpleSyntaxHighlighter.VALUE),
|
||||
new AttributesDescriptor("Bad value", SimpleSyntaxHighlighter.BAD_CHARACTER)
|
||||
new AttributesDescriptor("Key", SimpleSyntaxHighlighter.KEY),
|
||||
new AttributesDescriptor("Separator", SimpleSyntaxHighlighter.SEPARATOR),
|
||||
new AttributesDescriptor("Value", SimpleSyntaxHighlighter.VALUE),
|
||||
new AttributesDescriptor("Bad value", SimpleSyntaxHighlighter.BAD_CHARACTER)
|
||||
};
|
||||
|
||||
@Nullable
|
||||
@ -38,17 +38,17 @@ public class SimpleColorSettingsPage implements ColorSettingsPage {
|
||||
@Override
|
||||
public String getDemoText() {
|
||||
return "# You are reading the \".properties\" entry.\n" +
|
||||
"! The exclamation mark can also mark text as comments.\n" +
|
||||
"website = https://en.wikipedia.org/\n" +
|
||||
"language = English\n" +
|
||||
"# The backslash below tells the application to continue reading\n" +
|
||||
"# the value onto the next line.\n" +
|
||||
"message = Welcome to \\\n" +
|
||||
" Wikipedia!\n" +
|
||||
"# Add spaces to the key\n" +
|
||||
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
|
||||
"# Unicode\n" +
|
||||
"tab : \\u0009";
|
||||
"! The exclamation mark can also mark text as comments.\n" +
|
||||
"website = https://en.wikipedia.org/\n" +
|
||||
"language = English\n" +
|
||||
"# The backslash below tells the application to continue reading\n" +
|
||||
"# the value onto the next line.\n" +
|
||||
"message = Welcome to \\\n" +
|
||||
" Wikipedia!\n" +
|
||||
"# Add spaces to the key\n" +
|
||||
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
|
||||
"# Unicode\n" +
|
||||
"tab : \\u0009";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -13,13 +13,13 @@ public class SimpleCompletionContributor extends CompletionContributor {
|
||||
|
||||
public SimpleCompletionContributor() {
|
||||
extend(CompletionType.BASIC, PlatformPatterns.psiElement(SimpleTypes.VALUE),
|
||||
new CompletionProvider<>() {
|
||||
public void addCompletions(@NotNull CompletionParameters parameters,
|
||||
@NotNull ProcessingContext context,
|
||||
@NotNull CompletionResultSet resultSet) {
|
||||
resultSet.addElement(LookupElementBuilder.create("Hello"));
|
||||
}
|
||||
}
|
||||
new CompletionProvider<>() {
|
||||
public void addCompletions(@NotNull CompletionParameters parameters,
|
||||
@NotNull ProcessingContext context,
|
||||
@NotNull CompletionResultSet resultSet) {
|
||||
resultSet.addElement(LookupElementBuilder.create("Hello"));
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -54,15 +54,15 @@ class SimpleCreatePropertyQuickFix extends BaseIntentionAction {
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws
|
||||
IncorrectOperationException {
|
||||
IncorrectOperationException {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
Collection<VirtualFile> virtualFiles =
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
if (virtualFiles.size() == 1) {
|
||||
createProperty(project, virtualFiles.iterator().next());
|
||||
} else {
|
||||
final FileChooserDescriptor descriptor =
|
||||
FileChooserDescriptorFactory.createSingleFileDescriptor(SimpleFileType.INSTANCE);
|
||||
FileChooserDescriptorFactory.createSingleFileDescriptor(SimpleFileType.INSTANCE);
|
||||
descriptor.setRoots(ProjectUtil.guessProjectDir(project));
|
||||
final VirtualFile file1 = FileChooser.chooseFile(descriptor, project, null);
|
||||
if (file1 != null) {
|
||||
|
@ -19,9 +19,9 @@ public class SimpleFindUsagesProvider implements FindUsagesProvider {
|
||||
@Override
|
||||
public WordsScanner getWordsScanner() {
|
||||
return new DefaultWordsScanner(new SimpleLexerAdapter(),
|
||||
SimpleTokenSets.IDENTIFIERS,
|
||||
SimpleTokenSets.COMMENTS,
|
||||
TokenSet.EMPTY);
|
||||
SimpleTokenSets.IDENTIFIERS,
|
||||
SimpleTokenSets.COMMENTS,
|
||||
TokenSet.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,8 +58,8 @@ public class SimpleFindUsagesProvider implements FindUsagesProvider {
|
||||
public String getNodeText(@NotNull PsiElement element, boolean useFullName) {
|
||||
if (element instanceof SimpleProperty) {
|
||||
return ((SimpleProperty) element).getKey() +
|
||||
SimpleAnnotator.SIMPLE_SEPARATOR_STR +
|
||||
((SimpleProperty) element).getValue();
|
||||
SimpleAnnotator.SIMPLE_SEPARATOR_STR +
|
||||
((SimpleProperty) element).getValue();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -43,16 +43,16 @@ public class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware
|
||||
if (value != null && value.startsWith(SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR)) {
|
||||
Project project = literalExpression.getProject();
|
||||
String key = value.substring(
|
||||
SimpleAnnotator.SIMPLE_PREFIX_STR.length() + SimpleAnnotator.SIMPLE_SEPARATOR_STR.length()
|
||||
SimpleAnnotator.SIMPLE_PREFIX_STR.length() + SimpleAnnotator.SIMPLE_SEPARATOR_STR.length()
|
||||
);
|
||||
// find SimpleProperty for the given key in the project
|
||||
SimpleProperty simpleProperty = ContainerUtil.getOnlyItem(SimpleUtil.findProperties(project, key));
|
||||
if (simpleProperty != null) {
|
||||
// Add a folding descriptor for the literal expression at this node.
|
||||
descriptors.add(new FoldingDescriptor(literalExpression.getNode(),
|
||||
new TextRange(literalExpression.getTextRange().getStartOffset() + 1,
|
||||
literalExpression.getTextRange().getEndOffset() - 1),
|
||||
group, Collections.singleton(simpleProperty)));
|
||||
new TextRange(literalExpression.getTextRange().getStartOffset() + 1,
|
||||
literalExpression.getTextRange().getEndOffset() - 1),
|
||||
group, Collections.singleton(simpleProperty)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,10 +78,10 @@ public class SimpleFoldingBuilder extends FoldingBuilderEx implements DumbAware
|
||||
}
|
||||
|
||||
String key = text.substring(SimpleAnnotator.SIMPLE_PREFIX_STR.length() +
|
||||
SimpleAnnotator.SIMPLE_SEPARATOR_STR.length());
|
||||
SimpleAnnotator.SIMPLE_SEPARATOR_STR.length());
|
||||
|
||||
SimpleProperty simpleProperty = ContainerUtil.getOnlyItem(
|
||||
SimpleUtil.findProperties(psiLiteralExpression.getProject(), key)
|
||||
SimpleUtil.findProperties(psiLiteralExpression.getProject(), key)
|
||||
);
|
||||
if (simpleProperty == null) {
|
||||
return StringUtil.THREE_DOTS;
|
||||
|
@ -11,22 +11,22 @@ public class SimpleFormattingModelBuilder implements FormattingModelBuilder {
|
||||
|
||||
private static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
|
||||
return new SpacingBuilder(settings, SimpleLanguage.INSTANCE)
|
||||
.around(SimpleTypes.SEPARATOR)
|
||||
.spaceIf(settings.getCommonSettings(SimpleLanguage.INSTANCE.getID()).SPACE_AROUND_ASSIGNMENT_OPERATORS)
|
||||
.before(SimpleTypes.PROPERTY)
|
||||
.none();
|
||||
.around(SimpleTypes.SEPARATOR)
|
||||
.spaceIf(settings.getCommonSettings(SimpleLanguage.INSTANCE.getID()).SPACE_AROUND_ASSIGNMENT_OPERATORS)
|
||||
.before(SimpleTypes.PROPERTY)
|
||||
.none();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull FormattingModel createModel(@NotNull FormattingContext formattingContext) {
|
||||
final CodeStyleSettings codeStyleSettings = formattingContext.getCodeStyleSettings();
|
||||
return FormattingModelProvider
|
||||
.createFormattingModelForPsiFile(formattingContext.getContainingFile(),
|
||||
new SimpleBlock(formattingContext.getNode(),
|
||||
Wrap.createWrap(WrapType.NONE, false),
|
||||
Alignment.createAlignment(),
|
||||
createSpaceBuilder(codeStyleSettings)),
|
||||
codeStyleSettings);
|
||||
.createFormattingModelForPsiFile(formattingContext.getContainingFile(),
|
||||
new SimpleBlock(formattingContext.getNode(),
|
||||
Wrap.createWrap(WrapType.NONE, false),
|
||||
Alignment.createAlignment(),
|
||||
createSpaceBuilder(codeStyleSettings)),
|
||||
codeStyleSettings);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,18 +28,18 @@ public class SimpleLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSe
|
||||
@Override
|
||||
public String getCodeSample(@NotNull SettingsType settingsType) {
|
||||
return "# You are reading the \".properties\" entry.\n" +
|
||||
"! The exclamation mark can also mark text as comments.\n" +
|
||||
"website = https://en.wikipedia.org/\n" +
|
||||
"\n" +
|
||||
"language = English\n" +
|
||||
"# The backslash below tells the application to continue reading\n" +
|
||||
"# the value onto the next line.\n" +
|
||||
"message = Welcome to \\\n" +
|
||||
" Wikipedia!\n" +
|
||||
"# Add spaces to the key\n" +
|
||||
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
|
||||
"# Unicode\n" +
|
||||
"tab : \\u0009";
|
||||
"! The exclamation mark can also mark text as comments.\n" +
|
||||
"website = https://en.wikipedia.org/\n" +
|
||||
"\n" +
|
||||
"language = English\n" +
|
||||
"# The backslash below tells the application to continue reading\n" +
|
||||
"# the value onto the next line.\n" +
|
||||
"message = Welcome to \\\n" +
|
||||
" Wikipedia!\n" +
|
||||
"# Add spaces to the key\n" +
|
||||
"key\\ with\\ spaces = This is the value that could be looked up with the key \"key with spaces\".\n" +
|
||||
"# Unicode\n" +
|
||||
"tab : \\u0009";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,22 +29,22 @@ public class SimpleLineMarkerProvider extends RelatedItemLineMarkerProvider {
|
||||
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element.getParent();
|
||||
String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null;
|
||||
if ((value == null) ||
|
||||
!value.startsWith(SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR)) {
|
||||
!value.startsWith(SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the Simple language property usage
|
||||
Project project = element.getProject();
|
||||
String possibleProperties = value.substring(
|
||||
SimpleAnnotator.SIMPLE_PREFIX_STR.length() + SimpleAnnotator.SIMPLE_SEPARATOR_STR.length()
|
||||
SimpleAnnotator.SIMPLE_PREFIX_STR.length() + SimpleAnnotator.SIMPLE_SEPARATOR_STR.length()
|
||||
);
|
||||
final List<SimpleProperty> properties = SimpleUtil.findProperties(project, possibleProperties);
|
||||
if (properties.size() > 0) {
|
||||
// Add the property to a collection of line marker info
|
||||
NavigationGutterIconBuilder<PsiElement> builder =
|
||||
NavigationGutterIconBuilder.create(SimpleIcons.FILE)
|
||||
.setTargets(properties)
|
||||
.setTooltipText("Navigate to Simple language property");
|
||||
NavigationGutterIconBuilder.create(SimpleIcons.FILE)
|
||||
.setTargets(properties)
|
||||
.setTooltipText("Navigate to Simple language property");
|
||||
result.add(builder.createLineMarkerInfo(element));
|
||||
}
|
||||
}
|
||||
|
@ -49,8 +49,8 @@ public class SimpleReference extends PsiReferenceBase<PsiElement> implements Psi
|
||||
for (final SimpleProperty property : properties) {
|
||||
if (property.getKey() != null && property.getKey().length() > 0) {
|
||||
variants.add(LookupElementBuilder
|
||||
.create(property).withIcon(SimpleIcons.FILE)
|
||||
.withTypeText(property.getContainingFile().getName())
|
||||
.create(property).withIcon(SimpleIcons.FILE)
|
||||
.withTypeText(property.getContainingFile().getName())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -16,21 +16,21 @@ public class SimpleReferenceContributor extends PsiReferenceContributor {
|
||||
@Override
|
||||
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
|
||||
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class),
|
||||
new PsiReferenceProvider() {
|
||||
@Override
|
||||
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element,
|
||||
@NotNull ProcessingContext context) {
|
||||
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
|
||||
String value = literalExpression.getValue() instanceof String ?
|
||||
(String) literalExpression.getValue() : null;
|
||||
if ((value != null && value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR))) {
|
||||
TextRange property = new TextRange(SIMPLE_PREFIX_STR.length() + SIMPLE_SEPARATOR_STR.length() + 1,
|
||||
value.length() + 1);
|
||||
return new PsiReference[]{new SimpleReference(element, property)};
|
||||
}
|
||||
return PsiReference.EMPTY_ARRAY;
|
||||
}
|
||||
});
|
||||
new PsiReferenceProvider() {
|
||||
@Override
|
||||
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element,
|
||||
@NotNull ProcessingContext context) {
|
||||
PsiLiteralExpression literalExpression = (PsiLiteralExpression) element;
|
||||
String value = literalExpression.getValue() instanceof String ?
|
||||
(String) literalExpression.getValue() : null;
|
||||
if ((value != null && value.startsWith(SIMPLE_PREFIX_STR + SIMPLE_SEPARATOR_STR))) {
|
||||
TextRange property = new TextRange(SIMPLE_PREFIX_STR.length() + SIMPLE_SEPARATOR_STR.length() + 1,
|
||||
value.length() + 1);
|
||||
return new PsiReference[]{new SimpleReference(element, property)};
|
||||
}
|
||||
return PsiReference.EMPTY_ARRAY;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -18,63 +18,63 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SimpleSpellcheckingStrategy extends SpellcheckingStrategy {
|
||||
|
||||
@Override
|
||||
public @NotNull Tokenizer<?> getTokenizer(PsiElement element) {
|
||||
if (element instanceof PsiComment) {
|
||||
return new SimpleCommentTokenizer();
|
||||
}
|
||||
|
||||
if (element instanceof SimpleProperty) {
|
||||
return new SimplePropertyTokenizer();
|
||||
}
|
||||
|
||||
return EMPTY_TOKENIZER;
|
||||
}
|
||||
|
||||
private static class SimpleCommentTokenizer extends Tokenizer<PsiComment> {
|
||||
|
||||
@Override
|
||||
public @NotNull Tokenizer<?> getTokenizer(PsiElement element) {
|
||||
if (element instanceof PsiComment) {
|
||||
return new SimpleCommentTokenizer();
|
||||
public void tokenize(@NotNull PsiComment element, TokenConsumer consumer) {
|
||||
// Exclude the start of the comment with its # characters from spell checking
|
||||
int startIndex = 0;
|
||||
for (char c : element.textToCharArray()) {
|
||||
if (c == '#' || Character.isWhitespace(c)) {
|
||||
startIndex++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
if (element instanceof SimpleProperty) {
|
||||
return new SimplePropertyTokenizer();
|
||||
}
|
||||
|
||||
return EMPTY_TOKENIZER;
|
||||
}
|
||||
consumer.consumeToken(element, element.getText(), false, 0,
|
||||
TextRange.create(startIndex, element.getTextLength()),
|
||||
CommentSplitter.getInstance());
|
||||
}
|
||||
|
||||
private static class SimpleCommentTokenizer extends Tokenizer<PsiComment> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tokenize(@NotNull PsiComment element, TokenConsumer consumer) {
|
||||
// Exclude the start of the comment with its # characters from spell checking
|
||||
int startIndex = 0;
|
||||
for (char c : element.textToCharArray()) {
|
||||
if (c == '#' || Character.isWhitespace(c)) {
|
||||
startIndex++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
consumer.consumeToken(element, element.getText(), false, 0,
|
||||
TextRange.create(startIndex, element.getTextLength()),
|
||||
CommentSplitter.getInstance());
|
||||
}
|
||||
private static class SimplePropertyTokenizer extends Tokenizer<SimpleProperty> {
|
||||
|
||||
public void tokenize(@NotNull SimpleProperty element, TokenConsumer consumer) {
|
||||
//Spell check the keys and values of properties with different splitters
|
||||
final ASTNode key = element.getNode().findChildByType(SimpleTypes.KEY);
|
||||
if (key != null && key.getTextLength() > 0) {
|
||||
final PsiElement keyPsi = key.getPsi();
|
||||
final String text = key.getText();
|
||||
//For keys, use a splitter for identifiers
|
||||
//Note we set "useRename" to true so that keys will be properly refactored (renamed)
|
||||
consumer.consumeToken(keyPsi, text, true, 0,
|
||||
TextRange.allOf(text), IdentifierSplitter.getInstance());
|
||||
}
|
||||
|
||||
final ASTNode value = element.getNode().findChildByType(SimpleTypes.VALUE);
|
||||
if (value != null && value.getTextLength() > 0) {
|
||||
final PsiElement valuePsi = value.getPsi();
|
||||
final String text = valuePsi.getText();
|
||||
//For values, use a splitter for plain text
|
||||
consumer.consumeToken(valuePsi, text, false, 0,
|
||||
TextRange.allOf(text), PlainTextSplitter.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
private static class SimplePropertyTokenizer extends Tokenizer<SimpleProperty> {
|
||||
|
||||
public void tokenize(@NotNull SimpleProperty element, TokenConsumer consumer) {
|
||||
//Spell check the keys and values of properties with different splitters
|
||||
final ASTNode key = element.getNode().findChildByType(SimpleTypes.KEY);
|
||||
if (key != null && key.getTextLength() > 0) {
|
||||
final PsiElement keyPsi = key.getPsi();
|
||||
final String text = key.getText();
|
||||
//For keys, use a splitter for identifiers
|
||||
//Note we set "useRename" to true so that keys will be properly refactored (renamed)
|
||||
consumer.consumeToken(keyPsi, text, true, 0,
|
||||
TextRange.allOf(text), IdentifierSplitter.getInstance());
|
||||
}
|
||||
|
||||
final ASTNode value = element.getNode().findChildByType(SimpleTypes.VALUE);
|
||||
if (value != null && value.getTextLength() > 0) {
|
||||
final PsiElement valuePsi = value.getPsi();
|
||||
final String text = valuePsi.getText();
|
||||
//For values, use a splitter for plain text
|
||||
consumer.consumeToken(valuePsi, text, false, 0,
|
||||
TextRange.allOf(text), PlainTextSplitter.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,32 +13,33 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.Icon;
|
||||
|
||||
public class SimpleStructureAwareNavbar extends StructureAwareNavBarModelExtension {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Language getLanguage() {
|
||||
return SimpleLanguage.INSTANCE;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected Language getLanguage() {
|
||||
return SimpleLanguage.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getPresentableText(Object object) {
|
||||
if (object instanceof SimpleFile) {
|
||||
return ((SimpleFile) object).getName();
|
||||
}
|
||||
if (object instanceof SimpleProperty) {
|
||||
return ((SimpleProperty) object).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable String getPresentableText(Object object) {
|
||||
if (object instanceof SimpleFile) {
|
||||
return ((SimpleFile) object).getName();
|
||||
}
|
||||
if (object instanceof SimpleProperty) {
|
||||
return ((SimpleProperty) object).getName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon(Object object) {
|
||||
if (object instanceof SimpleProperty) {
|
||||
return AllIcons.Nodes.Property;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon(Object object) {
|
||||
if (object instanceof SimpleProperty) {
|
||||
return AllIcons.Nodes.Property;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class SimpleStructureViewModel extends StructureViewModelBase implements
|
||||
StructureViewModel.ElementInfoProvider {
|
||||
StructureViewModel.ElementInfoProvider {
|
||||
|
||||
public SimpleStructureViewModel(@Nullable Editor editor, PsiFile psiFile) {
|
||||
super(psiFile, editor, new SimpleStructureViewElement(psiFile));
|
||||
@ -39,4 +39,5 @@ public class SimpleStructureViewModel extends StructureViewModelBase implements
|
||||
protected Class<?> @NotNull [] getSuitableClasses() {
|
||||
return new Class[]{SimpleProperty.class};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,15 +17,15 @@ import static com.intellij.openapi.editor.colors.TextAttributesKey.createTextAtt
|
||||
public class SimpleSyntaxHighlighter extends SyntaxHighlighterBase {
|
||||
|
||||
public static final TextAttributesKey SEPARATOR =
|
||||
createTextAttributesKey("SIMPLE_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN);
|
||||
createTextAttributesKey("SIMPLE_SEPARATOR", DefaultLanguageHighlighterColors.OPERATION_SIGN);
|
||||
public static final TextAttributesKey KEY =
|
||||
createTextAttributesKey("SIMPLE_KEY", DefaultLanguageHighlighterColors.KEYWORD);
|
||||
createTextAttributesKey("SIMPLE_KEY", DefaultLanguageHighlighterColors.KEYWORD);
|
||||
public static final TextAttributesKey VALUE =
|
||||
createTextAttributesKey("SIMPLE_VALUE", DefaultLanguageHighlighterColors.STRING);
|
||||
createTextAttributesKey("SIMPLE_VALUE", DefaultLanguageHighlighterColors.STRING);
|
||||
public static final TextAttributesKey COMMENT =
|
||||
createTextAttributesKey("SIMPLE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
|
||||
createTextAttributesKey("SIMPLE_COMMENT", DefaultLanguageHighlighterColors.LINE_COMMENT);
|
||||
public static final TextAttributesKey BAD_CHARACTER =
|
||||
createTextAttributesKey("SIMPLE_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
|
||||
createTextAttributesKey("SIMPLE_BAD_CHARACTER", HighlighterColors.BAD_CHARACTER);
|
||||
|
||||
|
||||
private static final TextAttributesKey[] BAD_CHAR_KEYS = new TextAttributesKey[]{BAD_CHARACTER};
|
||||
|
@ -31,7 +31,7 @@ public class SimpleUtil {
|
||||
public static List<SimpleProperty> findProperties(Project project, String key) {
|
||||
List<SimpleProperty> result = new ArrayList<>();
|
||||
Collection<VirtualFile> virtualFiles =
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
for (VirtualFile virtualFile : virtualFiles) {
|
||||
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
|
||||
if (simpleFile != null) {
|
||||
@ -51,7 +51,7 @@ public class SimpleUtil {
|
||||
public static List<SimpleProperty> findProperties(Project project) {
|
||||
List<SimpleProperty> result = new ArrayList<>();
|
||||
Collection<VirtualFile> virtualFiles =
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
FileTypeIndex.getFiles(SimpleFileType.INSTANCE, GlobalSearchScope.allScope(project));
|
||||
for (VirtualFile virtualFile : virtualFiles) {
|
||||
SimpleFile simpleFile = (SimpleFile) PsiManager.getInstance(project).findFile(virtualFile);
|
||||
if (simpleFile != null) {
|
||||
@ -77,7 +77,7 @@ public class SimpleUtil {
|
||||
}
|
||||
element = element.getPrevSibling();
|
||||
}
|
||||
return StringUtil.join(Lists.reverse(result),"\n ");
|
||||
return StringUtil.join(Lists.reverse(result), "\n ");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
CodeStyle.getLanguageSettings(myFixture.getFile()).SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
|
||||
CodeStyle.getLanguageSettings(myFixture.getFile()).KEEP_BLANK_LINES_IN_CODE = 2;
|
||||
WriteCommandAction.writeCommandAction(getProject()).run(() ->
|
||||
CodeStyleManager.getInstance(getProject()).reformatText(
|
||||
myFixture.getFile(),
|
||||
ContainerUtil.newArrayList(myFixture.getFile().getTextRange())
|
||||
)
|
||||
CodeStyleManager.getInstance(getProject()).reformatText(
|
||||
myFixture.getFile(),
|
||||
ContainerUtil.newArrayList(myFixture.getFile().getTextRange())
|
||||
)
|
||||
);
|
||||
myFixture.checkResultByFile("DefaultTestData.simple");
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class SimpleCodeInsightTest extends LightJavaCodeInsightFixtureTestCase {
|
||||
|
||||
public void testReference() {
|
||||
PsiReference referenceAtCaret =
|
||||
myFixture.getReferenceAtCaretPositionWithAssertion("ReferenceTestData.java", "DefaultTestData.simple");
|
||||
myFixture.getReferenceAtCaretPositionWithAssertion("ReferenceTestData.java", "DefaultTestData.simple");
|
||||
final SimpleProperty resolvedSimpleProperty = assertInstanceOf(referenceAtCaret.resolve(), SimpleProperty.class);
|
||||
assertEquals("https://en.wikipedia.org/", resolvedSimpleProperty.getValue());
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class SimpleParsingTest extends ParsingTestCase {
|
||||
public void testParsingTestData() {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return path to test data file directory relative to root of this module.
|
||||
*/
|
||||
|
@ -80,8 +80,8 @@ public class CalendarToolWindowFactory implements ToolWindowFactory, DumbAware {
|
||||
|
||||
private String getCurrentDate(Calendar calendar) {
|
||||
return calendar.get(Calendar.DAY_OF_MONTH) + "/"
|
||||
+ (calendar.get(Calendar.MONTH) + 1) + "/"
|
||||
+ calendar.get(Calendar.YEAR);
|
||||
+ (calendar.get(Calendar.MONTH) + 1) + "/"
|
||||
+ calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
private String getTimeZone(Calendar calendar) {
|
||||
@ -102,5 +102,7 @@ public class CalendarToolWindowFactory implements ToolWindowFactory, DumbAware {
|
||||
public JPanel getContentPanel() {
|
||||
return contentPanel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user