Skip to content

Commit

Permalink
#106 | Deprecated API - Live Templates for Impex
Browse files Browse the repository at this point in the history
  • Loading branch information
mlytvyn authored Dec 22, 2022
1 parent a31c69e commit 9ecbb5e
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 63 deletions.
6 changes: 2 additions & 4 deletions resources/META-INF/lang-optional-dependencies.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,8 @@
<applicationService serviceInterface="com.intellij.idea.plugin.hybris.impex.highlighting.ImpexSyntaxHighlighter"
serviceImplementation="com.intellij.idea.plugin.hybris.impex.highlighting.DefaultImpexSyntaxHighlighter"/>

<defaultLiveTemplatesProvider
implementation="com.intellij.idea.plugin.hybris.impex.liveTemplates.ImpexTemplateProvider"/>
<liveTemplateContext implementation="com.intellij.idea.plugin.hybris.impex.liveTemplates.ImpexContextType"/>

<defaultLiveTemplates file="liveTemplates/Impex.xml"/>
<liveTemplateContext contextId="IMPEX" implementation="com.intellij.idea.plugin.hybris.impex.liveTemplates.ImpexContextType"/>

<renameHandler implementation="com.intellij.idea.plugin.hybris.impex.rename.ImpexMacrosRenameHandler"/>
<renamePsiElementProcessor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ object HybrisConstants {
const val IMPEX_CATALOG_VERSION_STAGED = "Staged"
const val IMPEX_CONSOLE_TITLE = "[y] Impex Console"
const val IMPEX_MONITOR_CONSOLE_TITLE = "[y] Monitor Console"
const val IMPEX = "Impex"
const val IMPEX_FILE_EXTENSION = "impex"

const val GROOVY_CONSOLE_TITLE = "[y] Groovy Console"
Expand Down
4 changes: 3 additions & 1 deletion src/com/intellij/idea/plugin/hybris/impex/ImpexLanguage.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@

package com.intellij.idea.plugin.hybris.impex;

import com.intellij.idea.plugin.hybris.common.HybrisConstants;
import com.intellij.lang.Language;

public class ImpexLanguage extends Language {

private static final ImpexLanguage INSTANCE = new ImpexLanguage();
private static final long serialVersionUID = -6312784074276675105L;

public static ImpexLanguage getInstance() {
return INSTANCE;
}

protected ImpexLanguage() {
super("Impex");
super(HybrisConstants.IMPEX);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.intellij.idea.plugin.hybris.impex.file;

import com.intellij.idea.plugin.hybris.common.HybrisConstants;
import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons;
import com.intellij.idea.plugin.hybris.impex.ImpexLanguage;
import com.intellij.lang.Language;
Expand Down Expand Up @@ -50,7 +51,7 @@ public ImpexFileType(@NotNull Language language, boolean secondary) {
@NotNull
@Override
public String getName() {
return "Impex";
return HybrisConstants.IMPEX;
}

@NotNull
Expand All @@ -62,7 +63,7 @@ public String getDescription() {
@NotNull
@Override
public String getDefaultExtension() {
return "impex";
return HybrisConstants.IMPEX_FILE_EXTENSION;
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import com.intellij.application.options.CodeStyleAbstractConfigurable;
import com.intellij.application.options.CodeStyleAbstractPanel;
import com.intellij.application.options.TabbedLanguageCodeStylePanel;
import com.intellij.idea.plugin.hybris.common.HybrisConstants;
import com.intellij.idea.plugin.hybris.impex.ImpexLanguage;
import com.intellij.openapi.options.Configurable;
import com.intellij.psi.codeStyle.CodeStyleConfigurable;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
Expand All @@ -45,14 +45,14 @@ public CustomCodeStyleSettings createCustomSettings(final CodeStyleSettings sett
@Nullable
@Override
public String getConfigurableDisplayName() {
return "Impex";
return HybrisConstants.IMPEX;
}

@NotNull
@Override
public CodeStyleConfigurable createConfigurable(@NotNull final CodeStyleSettings settings, @NotNull final CodeStyleSettings originalSettings) {

return new CodeStyleAbstractConfigurable(settings, originalSettings, "Impex") {
return new CodeStyleAbstractConfigurable(settings, originalSettings, HybrisConstants.IMPEX) {

@Override
protected CodeStyleAbstractPanel createPanel(final CodeStyleSettings settings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.intellij.idea.plugin.hybris.impex.highlighting;

import com.intellij.idea.plugin.hybris.common.HybrisConstants;
import com.intellij.idea.plugin.hybris.common.utils.HybrisIcons;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.HighlighterColors;
Expand Down Expand Up @@ -177,6 +178,6 @@ public ColorDescriptor[] getColorDescriptors() {
@NotNull
@Override
public String getDisplayName() {
return "Impex";
return HybrisConstants.IMPEX;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Copyright (C) 2014-2016 Alexander Bartash <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
Expand All @@ -19,8 +19,6 @@
package com.intellij.idea.plugin.hybris.impex.liveTemplates;

import com.intellij.codeInsight.template.FileTypeBasedContextType;
import com.intellij.codeInsight.template.TemplateContextType;
import com.intellij.idea.plugin.hybris.impex.ImpexLanguage;
import com.intellij.idea.plugin.hybris.impex.file.ImpexFileType;
import com.intellij.idea.plugin.hybris.impex.psi.ImpexFile;
import com.intellij.psi.PsiFile;
Expand All @@ -32,7 +30,7 @@
public class ImpexContextType extends FileTypeBasedContextType {

protected ImpexContextType() {
super("IMPEX", "Impex", ImpexFileType.getInstance());
super("Impex", ImpexFileType.getInstance());
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class HybrisImpexConsole(project: Project) : HybrisConsole(project, HybrisConsta
return HybrisHacHttpClient.getInstance(project).importImpex(project, settings)
}

override fun title(): String = "Impex"
override fun title(): String = HybrisConstants.IMPEX

override fun tip(): String = "Impex Console"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

public class DefaultJsonRegionPersistenceService implements RegionPersistenceService {

private Project project;
private RegionService regionService;
private final Project project;
private final RegionService regionService;

public DefaultJsonRegionPersistenceService(final RegionService regionService, final Project project) {
public DefaultJsonRegionPersistenceService(final Project project) {
this.project = project;
this.regionService = regionService;
this.regionService = RegionService.getInstance(project);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,18 @@
import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.cache.HybrisConsoleRegionsCache;
import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.pojo.Region;
import com.intellij.idea.plugin.hybris.tools.remote.console.persistence.services.RegionService;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import java.util.Map;
import java.util.function.BiFunction;

public class DefaultRegionService implements RegionService {

private HybrisConsoleRegionsCache cache;
private final HybrisConsoleRegionsCache cache;

public DefaultRegionService(HybrisConsoleRegionsCache cache) {
this.cache = cache;
public DefaultRegionService(final Project project) {
this.cache = HybrisConsoleRegionsCache.getInstance(project);
}

@Override
Expand Down

0 comments on commit 9ecbb5e

Please sign in to comment.