Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
a3e66763
Commit
a3e66763
authored
9 years ago
by
irengrig
Browse files
Options
Download
Email Patches
Plain Diff
WEB-19198 JSCS: Import Code Style: IllegalStateException for empty input file
parent
bb84169b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java
+8
-7
...ation/options/codeStyle/ManageCodeStyleSchemesDialog.java
platform/platform-api/src/com/intellij/openapi/options/SchemeImportException.java
+10
-0
...c/com/intellij/openapi/options/SchemeImportException.java
with
18 additions
and
7 deletions
+18
-7
platform/lang-impl/src/com/intellij/application/options/codeStyle/ManageCodeStyleSchemesDialog.java
+
8
-
7
View file @
a3e66763
...
...
@@ -35,7 +35,6 @@ import com.intellij.openapi.util.text.StringUtil;
import
com.intellij.openapi.vfs.VirtualFile
;
import
com.intellij.psi.codeStyle.CodeStyleScheme
;
import
com.intellij.psi.codeStyle.CodeStyleSchemes
;
import
com.intellij.ui.awt.RelativePoint
;
import
com.intellij.ui.table.JBTable
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -170,16 +169,19 @@ public class ManageCodeStyleSchemesDialog extends DialogWrapper {
}
}
catch
(
SchemeImportException
e
)
{
showStatus
(
myImportButton
,
ApplicationBundle
.
message
(
"message.code.style.scheme.import.failure"
,
selectedImporterName
,
e
.
getMessage
()),
MessageType
.
ERROR
);
if
(
e
.
isWarning
())
{
showStatus
(
myImportButton
,
e
.
getMessage
(),
MessageType
.
WARNING
);
return
;
}
final
String
message
=
ApplicationBundle
.
message
(
"message.code.style.scheme.import.failure"
,
selectedImporterName
,
e
.
getMessage
());
showStatus
(
myImportButton
,
message
,
MessageType
.
ERROR
);
}
}
}
}
}
private
static
void
showStatus
(
final
Component
component
,
final
String
message
,
MessageType
messageType
)
{
private
static
void
showStatus
(
final
J
Component
component
,
final
String
message
,
MessageType
messageType
)
{
BalloonBuilder
balloonBuilder
=
JBPopupFactory
.
getInstance
()
.
createHtmlTextBalloonBuilder
(
message
,
messageType
.
getDefaultIcon
(),
messageType
.
getPopupBackground
(),
null
);
...
...
@@ -187,8 +189,7 @@ public class ManageCodeStyleSchemesDialog extends DialogWrapper {
final
Balloon
balloon
=
balloonBuilder
.
createBalloon
();
final
Rectangle
rect
=
component
.
getBounds
();
final
Point
p
=
new
Point
(
rect
.
x
,
rect
.
y
+
rect
.
height
);
final
RelativePoint
point
=
new
RelativePoint
(
component
,
p
);
balloon
.
show
(
point
,
Balloon
.
Position
.
below
);
balloon
.
showInCenterOf
(
component
);
Disposer
.
register
(
ProjectManager
.
getInstance
().
getDefaultProject
(),
balloon
);
}
...
...
This diff is collapsed.
Click to expand it.
platform/platform-api/src/com/intellij/openapi/options/SchemeImportException.java
+
10
-
0
View file @
a3e66763
...
...
@@ -22,6 +22,7 @@ package com.intellij.openapi.options;
* @author Rustam Vishnyakov
*/
public
class
SchemeImportException
extends
Exception
{
boolean
myIsWarning
;
public
SchemeImportException
(
String
message
)
{
super
(
message
);
}
...
...
@@ -29,4 +30,13 @@ public class SchemeImportException extends Exception {
public
SchemeImportException
(
Throwable
cause
)
{
super
(
cause
);
}
public
SchemeImportException
setWarning
()
{
myIsWarning
=
true
;
return
this
;
}
public
boolean
isWarning
()
{
return
myIsWarning
;
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help