-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue when accessing plugin settings
- Loading branch information
abeade
committed
Mar 14, 2019
1 parent
9fe073a
commit 2f9a7fe
Showing
6 changed files
with
80 additions
and
91 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,43 @@ | ||
<idea-plugin> | ||
<id>com.abeade.plugin.figma.import</id> | ||
<name>Import figma resources</name> | ||
<version>1.0.5</version> | ||
<version>1.0.6</version> | ||
<vendor email="[email protected]" url="https://github.com/abeade">Albert Beade</vendor> | ||
|
||
<description><![CDATA[ | ||
Import figma resources to dpi resource folders.<br> | ||
]]></description> | ||
|
||
<change-notes><![CDATA[ | ||
Fix plugin settings.<br> | ||
<b>1.0.6</b> | ||
<ul> | ||
<li>Fix issue when accessing plugin settings</li> | ||
</ul> | ||
<b>1.0.5</b> | ||
<ul> | ||
<li>Use global settings for the plugin</li> | ||
</ul> | ||
<b>1.0.4</b> | ||
<ul> | ||
<li>New settings option to configure the prefix used for purposed resource name</li> | ||
<li>Show Icons at suffixes to show matched and not matched resources</li> | ||
</ul> | ||
<b>1.0.3</b> | ||
<ul> | ||
<li>Adds configurable override confirmation for existing resources</li> | ||
</ul> | ||
<b>1.0.2</b> | ||
<ul> | ||
<li>Allow mixed file types in same zip</li> | ||
</ul> | ||
<b>1.0.1</b> | ||
<ul> | ||
<li>Fixes issue with xxxhdpi resources</li> | ||
</ul> | ||
<b>1.0</b> | ||
<ul> | ||
<li>First version</li> | ||
</ul> | ||
]]> | ||
</change-notes> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.abeade.plugin.figma | ||
|
||
import com.intellij.ide.util.PropertiesComponent | ||
import com.intellij.openapi.ui.panel.ComponentPanelBuilder | ||
import com.intellij.ui.layout.LCFlags | ||
import com.intellij.ui.layout.panel | ||
import javax.swing.BoxLayout | ||
import javax.swing.JPanel | ||
import javax.swing.JTextField | ||
|
||
class ImportSettingsPanel(private val propertiesComponent: PropertiesComponent) : JPanel() { | ||
|
||
private val prefixField: JTextField = JTextField() | ||
|
||
init { | ||
createPanel() | ||
layout = BoxLayout(this, BoxLayout.Y_AXIS) | ||
} | ||
|
||
private fun createPanel() { | ||
add( | ||
panel(LCFlags.fillX) { | ||
row("Resource prefix") { prefixField() } | ||
row("") { ComponentPanelBuilder.createCommentComponent("Prefix used in purposed resource name. When empty no prefix will be added.", false)() } | ||
} | ||
) | ||
} | ||
|
||
val isModified: Boolean | ||
get() = prefixField.text != getCurrentPrefix() | ||
|
||
fun apply() { | ||
propertiesComponent.setValue(ImportDialogWrapper.PREFIX_KEY, prefixField.text) | ||
} | ||
|
||
fun reset() { | ||
prefixField.text = getCurrentPrefix() | ||
} | ||
|
||
private fun getCurrentPrefix(): String { | ||
var prefix = propertiesComponent.getValue(ImportDialogWrapper.PREFIX_KEY) | ||
if (prefix == null) { | ||
prefix = ImportDialogWrapper.RESOURCE_PREFIX | ||
} | ||
return prefix | ||
} | ||
} |