Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse Titan
titan.EclipsePlug-ins
Commits
c32205d8
Commit
c32205d8
authored
Apr 18, 2016
by
Kristof Szabados
Browse files
Code style improvements
parent
fa8db7b5
Changes
15
Hide whitespace changes
Inline
Side-by-side
org.eclipse.titanium/src/org/eclipse/titanium/actions/CheckCodeSmells.java
View file @
c32205d8
...
...
@@ -90,29 +90,29 @@ public class CheckCodeSmells extends AbstractHandler {
*/
private
void
collectResourcesToBeAnalyzed
(
final
Deque
<
IResource
>
res
,
final
Map
<
IProject
,
List
<
IFile
>>
files
,
final
List
<
IProject
>
projects
)
{
while
(!
res
.
isEmpty
())
{
final
IResource
r
=
res
.
pollFirst
();
if
(
r
instanceof
IProject
)
{
final
IProject
proj
=
(
IProject
)
r
;
projects
.
add
(
proj
);
}
else
if
(
r
instanceof
IFolder
)
{
final
IResource
r
esource
=
res
.
pollFirst
();
if
(
r
esource
instanceof
IProject
)
{
final
IProject
proj
ect
=
(
IProject
)
r
esource
;
projects
.
add
(
proj
ect
);
}
else
if
(
r
esource
instanceof
IFolder
)
{
try
{
for
(
IResource
r2
:
((
IFolder
)
r
).
members
())
{
for
(
IResource
r2
:
((
IFolder
)
r
esource
).
members
())
{
res
.
addLast
(
r2
);
}
}
catch
(
CoreException
e
)
{
ErrorReporter
.
logExceptionStackTrace
(
"Error while collecting resources"
,
e
);
}
}
else
if
(
r
instanceof
IFile
)
{
final
IFile
file
=
(
IFile
)
r
;
}
else
if
(
r
esource
instanceof
IFile
)
{
final
IFile
file
=
(
IFile
)
r
esource
;
final
String
extension
=
file
.
getFileExtension
();
if
(
"ttcn"
.
equals
(
extension
)
||
"ttcn3"
.
equals
(
extension
))
{
final
IProject
project
=
file
.
getProject
();
List
<
IFile
>
ls
=
files
.
get
(
project
);
if
(
ls
==
null
)
{
ls
=
new
ArrayList
<
IFile
>();
files
.
put
(
project
,
ls
);
List
<
IFile
>
filesInProject
=
files
.
get
(
project
);
if
(
filesInProject
==
null
)
{
filesInProject
=
new
ArrayList
<
IFile
>();
files
.
put
(
project
,
filesInProject
);
}
ls
.
add
(
file
);
filesInProject
.
add
(
file
);
}
}
}
...
...
@@ -131,11 +131,11 @@ public class CheckCodeSmells extends AbstractHandler {
public
IStatus
doPostWork
(
final
IProgressMonitor
monitor
)
{
final
SubMonitor
progress
=
SubMonitor
.
convert
(
monitor
,
100
);
if
(!
onTheFlyEnabled
)
{
MarkerHandler
m
h
;
MarkerHandler
h
andler
;
synchronized
(
project
)
{
m
h
=
analyzer
.
analyzeProject
(
progress
.
newChild
(
100
),
project
);
h
andler
=
analyzer
.
analyzeProject
(
progress
.
newChild
(
100
),
project
);
}
m
h
.
showAll
();
h
andler
.
showAll
();
}
return
Status
.
OK_STATUS
;
}
...
...
@@ -160,12 +160,12 @@ public class CheckCodeSmells extends AbstractHandler {
final
String
actualModuleName
=
projectSourceParser
.
containedModule
(
file
);
final
Module
module
=
projectSourceParser
.
getModuleByName
(
actualModuleName
);
if
(
module
!=
null
)
{
MarkerHandler
mh
;
progress
.
subTask
(
"Analyzing module "
+
module
.
getName
());
MarkerHandler
handler
;
synchronized
(
project
)
{
m
h
=
analyzer
.
analyzeModule
(
progress
.
newChild
(
1
),
module
);
h
andler
=
analyzer
.
analyzeModule
(
progress
.
newChild
(
1
),
module
);
}
m
h
.
showAll
();
h
andler
.
showAll
();
}
}
}
...
...
org.eclipse.titanium/src/org/eclipse/titanium/actions/ComponentGraphAction.java
View file @
c32205d8
...
...
@@ -87,7 +87,7 @@ public class ComponentGraphAction extends AbstractHandler implements IObjectActi
final
Job
generator
=
new
Job
(
"Generator"
)
{
@Override
protected
IStatus
run
(
IProgressMonitor
monitor
)
{
protected
IStatus
run
(
final
IProgressMonitor
monitor
)
{
monitor
.
beginTask
(
"Parsing project"
,
30
);
Display
.
getDefault
().
asyncExec
(
new
Runnable
()
{
@Override
...
...
org.eclipse.titanium/src/org/eclipse/titanium/actions/ExportProblems.java
View file @
c32205d8
...
...
@@ -99,40 +99,40 @@ public final class ExportProblems extends AbstractHandler implements IObjectActi
return
;
}
final
Object
o
=
structSelection
.
getFirstElement
();
if
(!(
o
instanceof
IProject
))
{
final
Object
firstElement
=
structSelection
.
getFirstElement
();
if
(!(
firstElement
instanceof
IProject
))
{
ErrorReporter
.
logError
(
"The export problems command needs to be called on a project "
);
return
;
}
final
IProject
p
=
(
IProject
)
o
;
final
IProject
p
roject
=
(
IProject
)
firstElement
;
final
IPreferencesService
preferencesService
=
Platform
.
getPreferencesService
();
final
boolean
reportDebugInformation
=
preferencesService
.
getBoolean
(
ProductConstants
.
PRODUCT_ID_DESIGNER
,
PreferenceConstants
.
DISPLAYDEBUGINFORMATION
,
true
,
null
);
if
(
reportDebugInformation
)
{
TITANDebugConsole
.
println
(
"Problem markers are to export from "
+
p
.
getName
());
TITANDebugConsole
.
println
(
"Problem markers are to export from "
+
p
roject
.
getName
());
}
boolean
write
=
false
;
String
f
n
;
String
f
ileName
;
final
Shell
shell
=
Display
.
getCurrent
().
getActiveShell
();
do
{
final
FileDialog
d
=
new
FileDialog
(
shell
,
SWT
.
SAVE
);
d
.
setText
(
"Export problem markers to xls"
);
d
.
setFilterExtensions
(
new
String
[]
{
"*.xls"
});
final
FileDialog
d
ialog
=
new
FileDialog
(
shell
,
SWT
.
SAVE
);
d
ialog
.
setText
(
"Export problem markers to xls"
);
d
ialog
.
setFilterExtensions
(
new
String
[]
{
"*.xls"
});
final
IPath
path
=
p
.
getLocation
();
final
IPath
path
=
p
roject
.
getLocation
();
if
(
path
!=
null
)
{
d
.
setFilterPath
(
path
.
toPortableString
());
d
ialog
.
setFilterPath
(
path
.
toPortableString
());
}
final
Calendar
now
=
Calendar
.
getInstance
();
d
.
setFileName
(
"Problems--"
+
p
.
getName
()
+
"--"
+
now
.
get
(
Calendar
.
YEAR
)
+
"-"
+
(
1
+
now
.
get
(
Calendar
.
MONTH
))
+
"-"
d
ialog
.
setFileName
(
"Problems--"
+
p
roject
.
getName
()
+
"--"
+
now
.
get
(
Calendar
.
YEAR
)
+
"-"
+
(
1
+
now
.
get
(
Calendar
.
MONTH
))
+
"-"
+
now
.
get
(
Calendar
.
DAY_OF_MONTH
));
f
n
=
d
.
open
();
if
(
f
n
!=
null
)
{
if
(
new
File
(
f
n
).
exists
())
{
f
ileName
=
dialog
.
open
();
if
(
f
ileName
!=
null
)
{
if
(
new
File
(
f
ileName
).
exists
())
{
write
=
MessageDialog
.
openConfirm
(
Display
.
getCurrent
().
getActiveShell
(),
"File exist"
,
"This file already exists. Please confirm overwrite."
);
}
else
{
...
...
@@ -144,14 +144,14 @@ public final class ExportProblems extends AbstractHandler implements IObjectActi
}
}
while
(!
write
);
final
String
fileName
=
f
n
;
final
String
fileName
2
=
f
ileName
;
new
ProjectAnalyzerJob
(
"Exporting reported code smells"
)
{
@Override
public
IStatus
doPostWork
(
final
IProgressMonitor
monitor
)
{
final
BaseProblemExporter
exporter
=
new
XlsProblemExporter
(
getProject
());
try
{
exporter
.
exportMarkers
(
monitor
,
fileName
,
Calendar
.
getInstance
().
getTime
());
exporter
.
exportMarkers
(
monitor
,
fileName
2
,
Calendar
.
getInstance
().
getTime
());
if
(
reportDebugInformation
)
{
TITANDebugConsole
.
println
(
"Successfully exported markers to xls"
);
}
...
...
@@ -163,6 +163,6 @@ public final class ExportProblems extends AbstractHandler implements IObjectActi
}
return
Status
.
OK_STATUS
;
}
}.
quickSchedule
(
p
);
}.
quickSchedule
(
p
roject
);
}
}
org.eclipse.titanium/src/org/eclipse/titanium/actions/MetricsViewOpener.java
View file @
c32205d8
...
...
@@ -63,19 +63,19 @@ public class MetricsViewOpener extends AbstractHandler implements IObjectActionD
return
;
}
final
Object
o
=
structSelection
.
getFirstElement
();
if
(!(
o
instanceof
IProject
))
{
final
Object
firstElement
=
structSelection
.
getFirstElement
();
if
(!(
firstElement
instanceof
IProject
))
{
ErrorReporter
.
logError
(
"The open metrics view command needs to be called on a project "
);
return
;
}
final
IProject
p
=
(
IProject
)
o
;
final
IProject
p
roject
=
(
IProject
)
firstElement
;
try
{
final
IViewPart
mv
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
()
final
IViewPart
activeView
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
()
.
showView
(
"org.eclipse.titanium.metrics.view"
);
if
(
mv
instanceof
MetricsView
)
{
final
MetricsView
metricsView
=
(
MetricsView
)
mv
;
metricsView
.
setSelectedProject
(
p
);
if
(
activeView
instanceof
MetricsView
)
{
final
MetricsView
metricsView
=
(
MetricsView
)
activeView
;
metricsView
.
setSelectedProject
(
p
roject
);
metricsView
.
startMeasuring
();
}
...
...
org.eclipse.titanium/src/org/eclipse/titanium/actions/ModuleGraphAction.java
View file @
c32205d8
...
...
@@ -45,6 +45,7 @@ public class ModuleGraphAction extends AbstractHandler implements IObjectActionD
private
ISelection
selection
;
public
ModuleGraphAction
()
{
// Do nothing
}
/**
...
...
org.eclipse.titanium/src/org/eclipse/titanium/actions/OrganizeFromBrowser.java
View file @
c32205d8
...
...
@@ -116,31 +116,31 @@ public final class OrganizeFromBrowser extends AbstractHandler implements IObjec
}
while
(!
res
.
isEmpty
())
{
final
IResource
r
=
res
.
pollFirst
();
if
(
r
instanceof
IProject
)
{
final
IProject
proj
=
(
IProject
)
r
;
final
IResource
r
esource
=
res
.
pollFirst
();
if
(
r
esource
instanceof
IProject
)
{
final
IProject
proj
ect
=
(
IProject
)
r
esource
;
try
{
for
(
IResource
r2
:
proj
.
members
())
{
for
(
IResource
r2
:
proj
ect
.
members
())
{
res
.
addLast
(
r2
);
}
}
catch
(
CoreException
e
)
{
ErrorReporter
.
logExceptionStackTrace
(
"Error while collecting members of project "
+
proj
.
getName
(),
e
);
ErrorReporter
.
logExceptionStackTrace
(
"Error while collecting members of project "
+
proj
ect
.
getName
(),
e
);
}
}
if
(
r
instanceof
IFolder
)
{
if
(
r
esource
instanceof
IFolder
)
{
try
{
final
IResource
[]
resInF
older
=
((
IFolder
)
r
).
members
();
for
(
IResource
r2
:
resInF
older
)
{
final
IResource
[]
f
older
=
((
IFolder
)
r
esource
).
members
();
for
(
IResource
r2
:
f
older
)
{
res
.
addLast
(
r2
);
}
}
catch
(
CoreException
e
)
{
ErrorReporter
.
logExceptionStackTrace
(
"Error while collecting members of folder "
+
r
.
getName
(),
e
);
ErrorReporter
.
logExceptionStackTrace
(
"Error while collecting members of folder "
+
r
esource
.
getName
(),
e
);
}
}
else
if
(
r
instanceof
IFile
)
{
final
IFile
file
=
(
IFile
)
r
;
}
else
if
(
r
esource
instanceof
IFile
)
{
final
IFile
file
=
(
IFile
)
r
esource
;
final
String
extension
=
file
.
getFileExtension
();
if
(
"ttcn"
.
equals
(
extension
)
||
"ttcn3"
.
equals
(
extension
))
{
files
.
add
((
IFile
)
r
);
files
.
add
((
IFile
)
r
esource
);
}
}
}
...
...
@@ -151,11 +151,11 @@ public final class OrganizeFromBrowser extends AbstractHandler implements IObjec
TITANDebugConsole
.
println
(
"These files will be organized: "
+
files
.
toString
());
}
final
OrganizeImportsOp
op
=
new
OrganizeImportsOp
(
files
);
final
ProgressMonitorDialog
p
md
=
new
ProgressMonitorDialog
(
null
);
final
OrganizeImportsOp
op
eration
=
new
OrganizeImportsOp
(
files
);
final
ProgressMonitorDialog
p
rogressMonitorDialog
=
new
ProgressMonitorDialog
(
null
);
try
{
p
md
.
run
(
true
,
true
,
op
);
p
rogressMonitorDialog
.
run
(
true
,
true
,
op
eration
);
}
catch
(
InvocationTargetException
e
)
{
ErrorReporter
.
logExceptionStackTrace
(
"Error while organizing imports"
,
e
);
}
catch
(
InterruptedException
e
)
{
...
...
org.eclipse.titanium/src/org/eclipse/titanium/actions/OrganizeFromEditor.java
View file @
c32205d8
...
...
@@ -14,7 +14,6 @@ import org.eclipse.core.resources.IFile;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.NullProgressMonitor
;
import
org.eclipse.jface.action.IAction
;
import
org.eclipse.ltk.core.refactoring.TextFileChange
;
import
org.eclipse.titan.common.logging.ErrorReporter
;
import
org.eclipse.titan.designer.editors.ttcn3editor.TTCN3Editor
;
...
...
@@ -32,19 +31,16 @@ import org.eclipse.ui.PlatformUI;
*/
public
final
class
OrganizeFromEditor
extends
AbstractHandler
{
public
void
setActiveEditor
(
final
IAction
action
,
final
IEditorPart
targetEditor
)
{
}
@Override
public
Object
execute
(
final
ExecutionEvent
event
)
throws
ExecutionException
{
IEditorPart
editor
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
().
getActiveEditor
();
final
IEditorPart
editor
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
().
getActiveEditor
();
if
(
editor
==
null
||
!(
editor
instanceof
TTCN3Editor
||
(
editor
instanceof
TTCNPPEditor
))
)
{
if
(
editor
==
null
||
!(
editor
instanceof
TTCN3Editor
||
editor
instanceof
TTCNPPEditor
))
{
ErrorReporter
.
logError
(
"The editor is not found or not a Titan TTCN-3 editor"
);
return
null
;
}
IFile
file
=
(
IFile
)
editor
.
getEditorInput
().
getAdapter
(
IFile
.
class
);
final
IFile
file
=
(
IFile
)
editor
.
getEditorInput
().
getAdapter
(
IFile
.
class
);
TextFileChange
change
=
null
;
try
{
change
=
OrganizeImports
.
organizeImportsChange
(
file
);
...
...
@@ -52,13 +48,14 @@ public final class OrganizeFromEditor extends AbstractHandler {
ErrorReporter
.
logExceptionStackTrace
(
"Error while creating the needed import changes"
,
e
);
return
null
;
}
try
{
change
.
perform
(
new
NullProgressMonitor
());
}
catch
(
CoreException
e
)
{
ErrorReporter
.
logExceptionStackTrace
(
"Error while performing the needed import changes"
,
e
);
}
IProject
project
=
file
.
getProject
();
final
IProject
project
=
file
.
getProject
();
GlobalParser
.
getProjectSourceParser
(
project
).
reportOutdating
(
file
);
GlobalParser
.
getProjectSourceParser
(
project
).
analyzeAll
();
...
...
org.eclipse.titanium/src/org/eclipse/titanium/actions/TopViewOpener.java
View file @
c32205d8
...
...
@@ -63,19 +63,19 @@ public class TopViewOpener extends AbstractHandler implements IObjectActionDeleg
return
;
}
final
Object
o
=
structSelection
.
getFirstElement
();
if
(!(
o
instanceof
IProject
))
{
final
Object
firstElement
=
structSelection
.
getFirstElement
();
if
(!(
firstElement
instanceof
IProject
))
{
ErrorReporter
.
logError
(
"The open top risk view command needs to be called on a project "
);
return
;
}
final
IProject
p
=
(
IProject
)
o
;
final
IProject
p
roject
=
(
IProject
)
firstElement
;
try
{
final
IViewPart
tv
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
()
final
IViewPart
activeView
=
PlatformUI
.
getWorkbench
().
getActiveWorkbenchWindow
().
getActivePage
()
.
showView
(
"org.eclipse.titanium.metrics.topview"
);
if
(
tv
instanceof
TopView
)
{
final
TopView
topView
=
(
TopView
)
tv
;
topView
.
setSelectedProject
(
p
);
if
(
activeView
instanceof
TopView
)
{
final
TopView
topView
=
(
TopView
)
activeView
;
topView
.
setSelectedProject
(
p
roject
);
topView
.
startMeasuring
();
}
...
...
org.eclipse.titanium/src/org/eclipse/titanium/applications/ClearAllProjects.java
View file @
c32205d8
...
...
@@ -19,7 +19,7 @@ import org.eclipse.titan.designer.Activator;
public
class
ClearAllProjects
implements
IApplication
{
@Override
public
Object
start
(
IApplicationContext
context
)
throws
Exception
{
public
Object
start
(
final
IApplicationContext
context
)
throws
Exception
{
Platform
.
getBundle
(
"org.eclipse.titan.designer"
).
start
();
final
String
[]
projectFiles
=
(
String
[])
context
.
getArguments
().
get
(
IApplicationContext
.
APPLICATION_ARGS
);
...
...
org.eclipse.titanium/src/org/eclipse/titanium/applications/ExportDataForSonar.java
View file @
c32205d8
...
...
@@ -24,7 +24,7 @@ public class ExportDataForSonar extends InformationExporter {
private
List
<
IProject
>
projectsToExport
=
new
ArrayList
<
IProject
>();
@Override
protected
boolean
checkParameters
(
String
[]
args
)
{
protected
boolean
checkParameters
(
final
String
[]
args
)
{
// Use Apache CLI if more functionality is needed
if
(
args
.
length
==
0
)
{
projectsToExport
=
getAllAccessibleProjects
();
...
...
@@ -41,10 +41,10 @@ public class ExportDataForSonar extends InformationExporter {
return
false
;
}
List
<
String
>
projectNames
=
Arrays
.
asList
(
args
[
1
].
split
(
","
));
IWorkspaceRoot
wsRoot
=
ResourcesPlugin
.
getWorkspace
().
getRoot
();
final
List
<
String
>
projectNames
=
Arrays
.
asList
(
args
[
1
].
split
(
","
));
final
IWorkspaceRoot
wsRoot
=
ResourcesPlugin
.
getWorkspace
().
getRoot
();
for
(
String
name
:
projectNames
)
{
IProject
project
=
wsRoot
.
getProject
(
name
);
final
IProject
project
=
wsRoot
.
getProject
(
name
);
if
(!
project
.
isAccessible
())
{
System
.
out
.
println
(
"Project '"
+
name
+
"' is not accessible."
);
return
false
;
...
...
@@ -55,13 +55,13 @@ public class ExportDataForSonar extends InformationExporter {
}
private
void
printUsage
()
{
String
applicationName
=
ExportDataForSonar
.
class
.
getCanonicalName
();
final
String
applicationName
=
ExportDataForSonar
.
class
.
getCanonicalName
();
System
.
out
.
println
(
"Usage: ./eclipse "
+
applicationName
+
" [-p project1,project2,...,projectN]"
);
}
@Override
protected
void
exportInformationForProject
(
String
[]
args
,
IProject
project
,
IProgressMonitor
monitor
)
{
SonarDataExporter
exporter
=
new
SonarDataExporter
(
project
);
protected
void
exportInformationForProject
(
final
String
[]
args
,
final
IProject
project
,
final
IProgressMonitor
monitor
)
{
final
SonarDataExporter
exporter
=
new
SonarDataExporter
(
project
);
try
{
exporter
.
exportDataForProject
();
}
catch
(
IOException
e
)
{
...
...
org.eclipse.titanium/src/org/eclipse/titanium/applications/ImportProjectsFromPrj.java
View file @
c32205d8
...
...
@@ -19,7 +19,7 @@ import org.eclipse.titan.designer.wizards.GUIProjectImporter;
public
class
ImportProjectsFromPrj
implements
IApplication
{
@Override
public
Object
start
(
IApplicationContext
context
)
throws
Exception
{
public
Object
start
(
final
IApplicationContext
context
)
throws
Exception
{
if
(!
GeneralConstants
.
DEBUG
)
{
ErrorReporter
.
INTERNAL_ERROR
(
"Loading prj files in headless mode is in prototype mode "
+
"and so should not be available in released versions yet"
);
...
...
org.eclipse.titanium/src/org/eclipse/titanium/applications/InformationExporter.java
View file @
c32205d8
...
...
@@ -51,7 +51,7 @@ public abstract class InformationExporter implements IApplication {
protected
abstract
void
exportInformationForProject
(
final
String
[]
args
,
final
IProject
project
,
IProgressMonitor
monitor
);
@Override
public
Object
start
(
IApplicationContext
context
)
throws
Exception
{
public
Object
start
(
final
IApplicationContext
context
)
throws
Exception
{
if
(!
GeneralConstants
.
DEBUG
)
{
ErrorReporter
.
INTERNAL_ERROR
(
"Experimental functionaility for the Titanium project"
);
}
...
...
@@ -63,20 +63,20 @@ public abstract class InformationExporter implements IApplication {
}
if
(
args
.
length
>=
1
){
File
path
=
new
File
(
args
[
0
].
substring
(
0
,
args
[
0
].
lastIndexOf
(
File
.
separator
)));
final
File
path
=
new
File
(
args
[
0
].
substring
(
0
,
args
[
0
].
lastIndexOf
(
File
.
separator
)));
if
(!
path
.
exists
()
&&
!
path
.
mkdirs
())
{
System
.
err
.
println
(
"Couldn't create output directory!"
);
return
Integer
.
valueOf
(-
1
);
}
}
List
<
IProject
>
existingProjects
=
getProjectsToHandle
();
final
List
<
IProject
>
existingProjects
=
getProjectsToHandle
();
List
<
Job
>
jobs
=
new
ArrayList
<
Job
>();
final
List
<
Job
>
jobs
=
new
ArrayList
<
Job
>();
for
(
IProject
project
:
existingProjects
)
{
jobs
.
add
(
new
ProjectAnalyzerJob
(
"Exporting information for project "
+
project
.
getName
())
{
@Override
public
IStatus
doPostWork
(
IProgressMonitor
monitor
)
{
public
IStatus
doPostWork
(
final
IProgressMonitor
monitor
)
{
System
.
out
.
println
(
"Exporting information for "
+
getProject
().
getName
());
exportInformationForProject
(
args
,
getProject
(),
monitor
);
return
Status
.
OK_STATUS
;
...
...
@@ -116,7 +116,7 @@ public abstract class InformationExporter implements IApplication {
protected
List
<
IProject
>
getAllAccessibleProjects
()
{
final
IProject
[]
projects
=
ResourcesPlugin
.
getWorkspace
().
getRoot
().
getProjects
();
List
<
IProject
>
existingProjects
=
new
ArrayList
<
IProject
>();
final
List
<
IProject
>
existingProjects
=
new
ArrayList
<
IProject
>();
for
(
IProject
project
:
projects
)
{
if
(
project
.
isAccessible
())
{
existingProjects
.
add
(
project
);
...
...
org.eclipse.titanium/src/org/eclipse/titanium/applications/MergeExportedMarkerTables.java
View file @
c32205d8
...
...
@@ -26,7 +26,7 @@ import org.eclipse.titanium.markers.export.ExportedProblemMerger;
public
class
MergeExportedMarkerTables
implements
IApplication
{
@Override
public
Object
start
(
IApplicationContext
context
)
throws
Exception
{
public
Object
start
(
final
IApplicationContext
context
)
throws
Exception
{
final
String
[]
args
=
(
String
[])
context
.
getArguments
().
get
(
IApplicationContext
.
APPLICATION_ARGS
);
...
...
@@ -35,7 +35,7 @@ public class MergeExportedMarkerTables implements IApplication {
return
Integer
.
valueOf
(-
1
);
}
List
<
File
>
files
=
new
LinkedList
<
File
>();
final
List
<
File
>
files
=
new
LinkedList
<
File
>();
File
file
;
String
name
=
null
;
...
...
@@ -80,24 +80,24 @@ public class MergeExportedMarkerTables implements IApplication {
* The name of the output file, if null "Summary" will be the
* filename
*/
private
boolean
merge
(
List
<
File
>
files
,
String
outfileName
)
{
private
boolean
merge
(
final
List
<
File
>
files
,
final
String
outfileName
)
{
File
outfile
=
null
;
if
(
outfileName
!=
null
)
{
outfile
=
new
File
(
outfileName
+
".xls"
);
}
else
{
outfile
=
new
File
(
"Summary.xls"
);
}
int
i
=
1
;
int
counter
=
1
;
while
(
outfile
.
exists
())
{
if
(
outfileName
!=
null
)
{
outfile
=
new
File
(
outfileName
+
i
+
".xls"
);
outfile
=
new
File
(
outfileName
+
counter
+
".xls"
);
}
else
{
outfile
=
new
File
(
"Summary"
+
i
+
".xls"
);
outfile
=
new
File
(
"Summary"
+
counter
+
".xls"
);
}
i
+=
1
;
counter
+=
1
;
}
ExportedProblemMerger
epm
=
new
ExportedProblemMerger
(
files
,
outfile
);
final
ExportedProblemMerger
epm
=
new
ExportedProblemMerger
(
files
,
outfile
);
return
epm
.
run
();
}
}
org.eclipse.titanium/src/org/eclipse/titanium/applications/SaveModuleDot.java
View file @
c32205d8
...
...
@@ -31,10 +31,10 @@ import edu.uci.ics.jung.graph.DirectedSparseGraph;
* @author Gabor Jenei
*/
public
class
SaveModuleDot
extends
InformationExporter
{
private
DirectedSparseGraph
<
NodeDescriptor
,
EdgeDescriptor
>
g
=
null
;
private
DirectedSparseGraph
<
NodeDescriptor
,
EdgeDescriptor
>
g
raph
=
null
;
@Override
protected
boolean
checkParameters
(
String
[]
args
)
{
protected
boolean
checkParameters
(
final
String
[]
args
)
{
if
(
args
.
length
<
1
)
{
System
.
out
.
println
(
"Usage: <output path> [-c<clustering algorithm name>]"
);
System
.
out
.
println
(
"The possible clustering algorithms are: "
);
...
...
@@ -46,9 +46,9 @@ public class SaveModuleDot extends InformationExporter {
}
@Override
protected
void
exportInformationForProject
(
final
String
[]
args
,
final
IProject
project
,
IProgressMonitor
monitor
)
{
protected
void
exportInformationForProject
(
final
String
[]
args
,
final
IProject
project
,
final
IProgressMonitor
monitor
)
{
final
ErrorHandler
errorHandler
=
new
ConsoleErrorHandler
();
GraphGenerator
generator
=
new
ModuleGraphGenerator
(
project
,
errorHandler
);
final
GraphGenerator
generator
=
new
ModuleGraphGenerator
(
project
,
errorHandler
);
try
{
generator
.
generateGraph
();
...
...
@@ -60,16 +60,16 @@ public class SaveModuleDot extends InformationExporter {
}
if
(
clusterName
.
isEmpty
()){
g
=
generator
.
getGraph
();
g
raph
=
generator
.
getGraph
();
}
else
{
BaseCluster
clusterer
=
new
ClustererBuilder
().
final
BaseCluster
clusterer
=
new
ClustererBuilder
().
setAlgorithm
(
clusterName
).
setGraph
(
generator
.
getGraph
()).
setProject
(
project
).
build
();
clusterer
.
run
(
monitor
,
false
);
g
=
clusterer
.
getGraph
();
g
raph
=
clusterer
.
getGraph
();
}
String
fileName
=
args
[
0
]
+
project
.
getName
()
+
".dot"
;
GraphHandler
.
saveGraphToDot
(
g
,
fileName
,
project
.
getName
());
final
String
fileName
=
args
[
0
]
+
project
.
getName
()
+
".dot"
;
GraphHandler
.
saveGraphToDot
(
g
raph
,
fileName
,
project
.
getName
());
errorHandler
.
reportInformation
(
"The graphs have been successfully saved. See results at "
+
new
File
(
fileName
).
getAbsolutePath
());
}
catch
(
Exception
e
)
{
...
...
org.eclipse.titanium/src/org/eclipse/titanium/applications/SaveModuleNet.java
View file @
c32205d8
...
...
@@ -31,10 +31,10 @@ import edu.uci.ics.jung.graph.DirectedSparseGraph;
* @author Gabor Jenei
*/
public
class
SaveModuleNet
extends
InformationExporter
{
private
DirectedSparseGraph
<
NodeDescriptor
,
EdgeDescriptor
>
g
=
null
;
private
DirectedSparseGraph
<
NodeDescriptor
,
EdgeDescriptor
>
g
raph
=
null
;
@Override
protected
boolean
checkParameters
(
String
[]
args
)
{
protected
boolean
checkParameters
(
final
String
[]
args
)
{
if
(
args
.
length
<
1
)
{
System
.
out
.
println
(
"Usage: <output path> [-c<clustering algorithm name>]"
);
System
.
out
.
println
(
"The possible clustering algorithms are: "
);
...
...
@@ -46,9 +46,9 @@ public class SaveModuleNet extends InformationExporter {
}
@Override
protected
void
exportInformationForProject
(
final
String
[]
args
,
final
IProject
project
,
IProgressMonitor
monitor
)
{
protected
void
exportInformationForProject
(
final
String
[]
args
,
final
IProject
project
,
final
IProgressMonitor
monitor
)
{
final
ErrorHandler
errorHandler
=
new
ConsoleErrorHandler
();
GraphGenerator
generator
=
new
ModuleGraphGenerator
(
project
,
errorHandler
);
final
GraphGenerator
generator
=
new
ModuleGraphGenerator
(
project
,
errorHandler
);
try
{