FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
processing/java/src/processing/mode/java/pdex/JavaProblem.java at master · dimr/processing · GitHub
dimr
processing
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
processing
/
java
/
src
/
processing
/
mode
/
java
/
pdex
/
JavaProblem.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
142 lines (113 loc) · 3.38 KB
Breadcrumbs
processing
/
java
/
src
/
processing
/
mode
/
java
/
pdex
/
JavaProblem.java
Copy path
File metadata and controls
142 lines (113 loc) · 3.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-15 The Processing Foundation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package
processing
.
mode
.
java
.
pdex
;
import
org
.
eclipse
.
jdt
.
core
.
compiler
.
IProblem
;
import
processing
.
app
.
Problem
;
/**
* Wrapper class for IProblem that stores the tabIndex and line number
* according to its tab, including the original IProblem object
*/
public
class
JavaProblem
implements
Problem
{
/**
* The tab number to which the error belongs to
*/
private
int
tabIndex
;
/**
* Line number(pde code) of the error
*/
private
int
lineNumber
;
private
int
startOffset
;
private
int
stopOffset
;
/**
* Error Message. Processed form of IProblem.getMessage()
*/
private
String
message
;
/**
* The type of error - WARNING or ERROR.
*/
private
int
type
;
/**
* If the error is a 'cannot find type' contains the list of suggested imports
*/
private
String
[]
importSuggestions
;
public
static
final
int
ERROR
=
1
,
WARNING
=
2
;
public
JavaProblem
(
String
message
,
int
type
,
int
tabIndex
,
int
lineNumber
) {
this
.
message
=
message
;
this
.
type
=
type
;
this
.
tabIndex
=
tabIndex
;
this
.
lineNumber
=
lineNumber
;
}
/**
*
* @param iProblem - The IProblem which is being wrapped
* @param tabIndex - The tab number to which the error belongs to
* @param lineNumber - Line number(pde code) of the error
*/
public
static
JavaProblem
fromIProblem
(
IProblem
iProblem
,
int
tabIndex
,
int
lineNumber
) {
int
type
=
0
;
if
(
iProblem
.
isError
()) {
type
=
ERROR
;
}
else
if
(
iProblem
.
isWarning
()) {
type
=
WARNING
;
}
String
message
=
ErrorMessageSimplifier
.
getSimplifiedErrorMessage
(
iProblem
);
return
new
JavaProblem
(
message
,
type
,
tabIndex
,
lineNumber
);
}
public
void
setPDEOffsets
(
int
startOffset
,
int
stopOffset
){
this
.
startOffset
=
startOffset
;
this
.
stopOffset
=
stopOffset
;
}
@
Override
public
int
getStartOffset
() {
return
startOffset
;
}
@
Override
public
int
getStopOffset
() {
return
stopOffset
;
}
@
Override
public
boolean
isError
() {
return
type
==
ERROR
;
}
@
Override
public
boolean
isWarning
() {
return
type
==
WARNING
;
}
@
Override
public
String
getMessage
() {
return
message
;
}
@
Override
public
int
getTabIndex
() {
return
tabIndex
;
}
@
Override
public
int
getLineNumber
() {
return
lineNumber
;
}
public
String
[]
getImportSuggestions
() {
return
importSuggestions
;
}
public
void
setImportSuggestions
(
String
[]
a
) {
importSuggestions
=
a
;
}
@
Override
public
String
toString
() {
return
"TAB "
+
tabIndex
+
",LN "
+
lineNumber
+
"LN START OFF: "
+
startOffset
+
",LN STOP OFF: "
+
stopOffset
+
",PROB: "
+
message
;
}
}
Back
|
FazBrowse Home
|
New Git URL