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
48cf5c46
Commit
48cf5c46
authored
Apr 08, 2019
by
Kristof Szabados
Browse files
removed line ending whitespaces.
Signed-off-by:
Kristof Szabados
<
Kristof.Szabados@ericsson.com
>
parent
6b206fce
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/Activator.java
View file @
48cf5c46
...
...
@@ -13,7 +13,7 @@ import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*
*
* @author Kristof Szabados
*/
public
class
Activator
extends
AbstractUIPlugin
{
...
...
@@ -41,7 +41,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Sets the default singleton instance of this plug-in,
* that later can be used to access plug-in specific preference settings.
*
*
* @param activator the single instance of this plug-in class.
* */
private
static
void
setDefault
(
final
Activator
activator
)
{
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/Utils.java
View file @
48cf5c46
...
...
@@ -52,7 +52,7 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
/**
* A class for utilities used by the refactoring classes.
* TODO needed? used consistently?
*
*
* @author Viktor Varga
*/
public
class
Utils
{
...
...
@@ -86,7 +86,7 @@ public class Utils {
final
IEditorInput
input
=
editor
.
getEditorInput
();
if
(!(
input
instanceof
IFileEditorInput
))
{
TITANDebugConsole
.
getConsole
().
newMessageStream
()
.
println
(
"Utils.extractFile() during refactoring "
+
.
println
(
"Utils.extractFile() during refactoring "
+
refactoringName
+
": IEditorInput is not an IFileEditorInput. "
);
return
null
;
}
...
...
@@ -102,7 +102,7 @@ public class Utils {
TTCN3Editor
editor
;
if
(
editorPart
==
null
||
!(
editorPart
instanceof
TTCN3Editor
))
{
TITANDebugConsole
.
getConsole
().
newMessageStream
()
.
println
(
"Utils.updateASTForProjectActiveInEditor() during refactoring "
+
.
println
(
"Utils.updateASTForProjectActiveInEditor() during refactoring "
+
refactoringName
+
": Only for TTCN3 editors!"
);
return
;
}
else
{
// TODO not needed else
...
...
@@ -120,7 +120,7 @@ public class Utils {
if
(
job
==
null
)
{
TITANDebugConsole
.
getConsole
().
newMessageStream
()
.
println
(
"Utils.updateASTForProjectActiveInEditor() during refactoring "
+
refactoringName
+
": WorkspaceJob to report outdating could not be created for project: "
+
selProject
);
refactoringName
+
": WorkspaceJob to report outdating could not be created for project: "
+
selProject
);
return
;
}
try
{
...
...
@@ -134,7 +134,7 @@ public class Utils {
if
(
job
==
null
)
{
TITANDebugConsole
.
getConsole
().
newMessageStream
()
.
println
(
"Utils.updateASTForProjectActiveInEditor() during refactoring "
+
refactoringName
+
": WorkspaceJob to reanalyze project could not be created for project: "
+
selProject
);
refactoringName
+
": WorkspaceJob to reanalyze project could not be created for project: "
+
selProject
);
return
;
}
try
{
...
...
@@ -171,7 +171,7 @@ public class Utils {
* This needs to be saved before {@link Refactoring#createChange(org.eclipse.core.runtime.IProgressMonitor)} returns,
* because a successful refactoring operation clears the affected objects' list in the Change object.
* @param refactoringName The name of the operation
*
*
* */
public
static
void
updateASTAfterRefactoring
(
final
RefactoringWizard
wiz
,
final
Object
[]
affectedObjects
,
final
String
refactoringName
)
{
if
(
wiz
.
getChange
()
==
null
||
wiz
.
getChange
().
getAffectedObjects
()
==
null
)
{
...
...
@@ -246,7 +246,7 @@ public class Utils {
* <p>
* Use an instance of this class as a parameter of the
* {@link ProgressMonitorDialog#run(boolean, boolean, IRunnableWithProgress)} method.
*
*
* */
private
static
class
UpdateASTOp
implements
IRunnableWithProgress
{
...
...
@@ -276,16 +276,16 @@ public class Utils {
final
WorkspaceJob
job
=
projectSourceParser
.
analyzeAll
();
if
(
job
==
null
)
{
TITANDebugConsole
.
getConsole
().
newMessageStream
()
.
println
(
"Utils.updateASTOp: WorkspaceJob to analyze project could not be created for project "
+
proj
.
getName
()
+
", during the refactoring: "
+
name
);
.
println
(
"Utils.updateASTOp: WorkspaceJob to analyze project could not be created for project "
+
proj
.
getName
()
+
", during the refactoring: "
+
name
);
return
;
}
try
{
job
.
join
();
}
catch
(
InterruptedException
e
)
{
TITANDebugConsole
.
getConsole
().
newMessageStream
()
.
println
(
"Utils.updateASTOp: Error during semantic analysis of the project: "
+
proj
.
getName
()
+
", during the refactoring: "
+
name
);
.
println
(
"Utils.updateASTOp: Error during semantic analysis of the project: "
+
proj
.
getName
()
+
", during the refactoring: "
+
name
);
return
;
}
if
(
monitor
.
isCanceled
())
{
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/insertfield/ChangeCreator.java
View file @
48cf5c46
...
...
@@ -206,7 +206,7 @@ class ChangeCreator {
job
.
schedule
();
return
job
;
}
public
int
insertField
(
final
TTCN3_Set_Seq_Choice_BaseType
ss
,
final
ILocateableNode
node
,
final
MultiTextEdit
rootEdit
,
int
vmLen
)
{
final
Location
nodeLocation
=
node
.
getLocation
();
...
...
@@ -238,7 +238,7 @@ class ChangeCreator {
private
final
NavigableSet
<
ILocateableNode
>
locations
;
private
final
Type
type
;
DefinitionVisitor
(
final
Type
type
)
{
locations
=
new
TreeSet
<
ILocateableNode
>(
new
LocationComparator
());
this
.
type
=
type
;
...
...
@@ -250,7 +250,6 @@ class ChangeCreator {
@Override
public
int
visit
(
final
IVisitableNode
node
)
{
if
(
node
instanceof
Def_Type
&&
((
Def_Type
)
node
).
getType
(
CompilationTimeStamp
.
getBaseTimestamp
()).
equals
(
type
))
{
final
Definition
d
=
(
Definition
)
node
;
locations
.
add
(
d
);
...
...
@@ -271,7 +270,6 @@ class ChangeCreator {
return
V_CONTINUE
;
}
}
/**
* Compares {@link ILocateableNode}s by comparing the file paths as strings.
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/insertfield/InsertFieldActionFromEditor.java
View file @
48cf5c46
...
...
@@ -49,8 +49,8 @@ public class InsertFieldActionFromEditor extends AbstractHandler {
return
null
;
}
final
IStructuredSelection
structSelection
=
new
StructuredSelection
(
selectedFile
);
final
InsertFieldRefactoring
refactoring
=
new
InsertFieldRefactoring
(
structSelection
,
null
);
final
InsertFieldRefactoring
refactoring
=
new
InsertFieldRefactoring
(
structSelection
,
null
);
//open wizard
final
InsertFieldWizard
wiz
=
new
InsertFieldWizard
(
refactoring
,
refactoring
.
getSelection
());
final
RefactoringWizardOpenOperation
operation
=
new
RefactoringWizardOpenOperation
(
wiz
);
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/insertfield/InsertFieldRefactoring.java
View file @
48cf5c46
...
...
@@ -50,9 +50,7 @@ public class InsertFieldRefactoring extends Refactoring {
private
final
Definition
selection
;
private
final
Set
<
IProject
>
projects
=
new
HashSet
<
IProject
>();
private
final
IStructuredSelection
iselection
;
private
final
Settings
settings
;
private
Object
[]
affectedObjects
;
//the list of objects affected by the change
...
...
@@ -76,7 +74,7 @@ public class InsertFieldRefactoring extends Refactoring {
public
Definition
getSelection
()
{
return
selection
;
}
public
Object
[]
getAffectedObjects
()
{
return
affectedObjects
;
}
...
...
@@ -135,12 +133,11 @@ public class InsertFieldRefactoring extends Refactoring {
throws
CoreException
,
OperationCanceledException
{
return
new
RefactoringStatus
();
}
public
Settings
getSettings
()
{
return
settings
;
}
@Override
public
Change
createChange
(
final
IProgressMonitor
pm
)
throws
CoreException
,
OperationCanceledException
{
if
(
iselection
==
null
)
{
...
...
@@ -216,7 +213,7 @@ public class InsertFieldRefactoring extends Refactoring {
}
}
public
static
class
Settings
{
private
String
type
;
private
Identifier
id
;
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/movefunction/ChangeCreator.java
View file @
48cf5c46
...
...
@@ -53,7 +53,7 @@ class ChangeCreator {
private
static
Map
<
Module
,
List
<
Module
>>
moduleImports
=
new
HashMap
<
Module
,
List
<
Module
>>();
// out
private
Change
change
;
ChangeCreator
(
final
IFile
selectedFile
,
final
MoveFunctionSettings
settings
,
final
List
<
FunctionData
>
functions
,
final
IProject
project
)
{
this
.
selectedFile
=
selectedFile
;
...
...
@@ -61,7 +61,7 @@ class ChangeCreator {
this
.
functions
=
functions
;
this
.
project
=
project
;
}
ChangeCreator
(
final
IFile
selectedFile
,
final
MoveFunctionSettings
settings
,
final
List
<
FunctionData
>
functions
,
final
IProject
project
,
final
Map
<
Module
,
List
<
Module
>>
mi
)
{
this
.
selectedFile
=
selectedFile
;
this
.
settings
=
settings
;
...
...
@@ -82,7 +82,7 @@ class ChangeCreator {
if
(
selectedFile
==
null
)
{
return
;
}
change
=
createFileChange
(
selectedFile
);
}
...
...
@@ -100,7 +100,7 @@ class ChangeCreator {
if
(
functions
.
isEmpty
())
{
return
null
;
}
if
(
settings
.
getExcludedModuleNames
()
!=
null
&&
settings
.
getExcludedModuleNames
().
matcher
(
module
.
getIdentifier
().
getTtcnName
()).
matches
())
{
return
null
;
}
...
...
@@ -113,7 +113,7 @@ class ChangeCreator {
if
(
noDestination
)
{
return
null
;
}
CompositeChange
cc
=
null
;
if
(
module
instanceof
TTCN3Module
)
{
cc
=
new
CompositeChange
(
"Moving functions from: "
+
module
.
getFullName
());
...
...
@@ -121,7 +121,7 @@ class ChangeCreator {
else
{
return
null
;
}
final
TextFileChange
tfc
=
new
TextFileChange
(
toVisit
.
getName
(),
toVisit
);
cc
.
add
(
tfc
);
final
MultiTextEdit
rootEdit
=
new
MultiTextEdit
();
...
...
@@ -130,15 +130,15 @@ class ChangeCreator {
if
(
function
.
getFinalDestination
()
==
null
||
!
function
.
isToBeMoved
())
{
continue
;
}
final
TextFileChange
tfcDestination
=
new
TextFileChange
(
function
.
getFinalDestination
().
getModule
().
getName
(),
(
IFile
)
function
.
getFinalDestination
().
getModule
().
getLocation
().
getFile
());
final
MultiTextEdit
rootEdit2
=
new
MultiTextEdit
();
tfcDestination
.
setEdit
(
rootEdit2
);
cc
.
add
(
tfcDestination
);
final
int
length
=
function
.
getDefiniton
().
getLocation
().
getEndOffset
()
-
function
.
getDefiniton
().
getLocation
().
getOffset
();
final
DeleteEdit
deleteEdit
=
new
DeleteEdit
(
function
.
getDefiniton
().
getLocation
().
getOffset
(),
length
);
rootEdit
.
addChild
(
deleteEdit
);
if
(!
moduleImports
.
containsKey
(
function
.
getFinalDestination
().
getModule
()))
{
rootEdit
.
addChild
(
deleteEdit
);
if
(!
moduleImports
.
containsKey
(
function
.
getFinalDestination
().
getModule
()))
{
moduleImports
.
put
(
function
.
getFinalDestination
().
getModule
(),
new
ArrayList
<
Module
>());
}
final
InsertEdit
importEdit
=
insertMissingImports
(
function
.
getFinalDestination
().
getModule
(),
function
.
getUsedModules
());
...
...
@@ -169,22 +169,22 @@ class ChangeCreator {
}
return
cc
;
}
private
InsertEdit
insertMissingImports
(
final
Module
destinationModule
,
final
List
<
Module
>
usedModules
)
{
final
List
<
Module
>
importedModules
=
destinationModule
.
getImportedModules
();
String
importText
=
""
;
for
(
final
Module
m
:
usedModules
)
{
if
(!
importedModules
.
contains
(
m
)
&&
!
m
.
equals
(
destinationModule
)
if
(!
importedModules
.
contains
(
m
)
&&
!
m
.
equals
(
destinationModule
)
&&
!
moduleImports
.
get
(
destinationModule
).
contains
(
m
))
{
importText
+=
"import from "
+
m
.
getIdentifier
().
getTtcnName
()+
" all;\n "
;
moduleImports
.
get
(
destinationModule
).
add
(
m
);
}
}
final
TextFileChange
insertImports
=
new
TextFileChange
(
destinationModule
.
getName
(),
(
IFile
)
destinationModule
.
getLocation
().
getFile
());
final
TextFileChange
insertImports
=
new
TextFileChange
(
destinationModule
.
getName
(),
(
IFile
)
destinationModule
.
getLocation
().
getFile
());
final
MultiTextEdit
rootEdit
=
new
MultiTextEdit
();
insertImports
.
setEdit
(
rootEdit
);
int
offset
=
destinationModule
.
getLocation
().
getEndOffset
();
...
...
@@ -202,27 +202,27 @@ class ChangeCreator {
}
return
new
InsertEdit
(
offset
,
importText
);
}
private
void
findFunctionUses
(
final
FunctionData
function
)
{
final
ProjectSourceParser
projectSourceParser
=
GlobalParser
.
getProjectSourceParser
(
project
);
for
(
final
Module
m
:
projectSourceParser
.
getModules
())
{
if
(!
m
.
equals
(
function
.
getFinalDestination
().
getModule
()))
{
final
ModuleVisitor
vis
=
new
ModuleVisitor
(
function
.
getDefiniton
());
m
.
accept
(
vis
);
if
(
vis
.
getIsUsed
()
&
!
m
.
getImportedModules
().
contains
(
function
.
getFinalDestination
().
getModule
())
if
(
vis
.
getIsUsed
()
&
!
m
.
getImportedModules
().
contains
(
function
.
getFinalDestination
().
getModule
())
&
!
m
.
equals
(
function
.
getFinalDestination
().
getModule
()))
{
function
.
addUsedBy
(
m
);
}
}
}
}
private
static
class
ModuleVisitor
extends
ASTVisitor
{
private
final
Def_Function
function
;
private
final
Def_Function
function
;
private
boolean
isUsed
;
public
ModuleVisitor
(
final
Def_Function
function
)
{
this
.
function
=
function
;
this
.
isUsed
=
false
;
...
...
@@ -238,7 +238,7 @@ class ChangeCreator {
}
return
V_CONTINUE
;
}
public
boolean
getIsUsed
()
{
return
isUsed
;
}
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/movefunction/FunctionData.java
View file @
48cf5c46
...
...
@@ -26,7 +26,7 @@ public class FunctionData implements Comparable<FunctionData> {
private
Destination
finalDestination
;
private
MoveFunctionMethod
method
;
private
final
List
<
Module
>
usedBy
;
public
FunctionData
(
final
Def_Function
definiton
,
final
String
functionBody
)
{
this
.
definiton
=
definiton
;
this
.
functionBody
=
functionBody
;
...
...
@@ -35,78 +35,78 @@ public class FunctionData implements Comparable<FunctionData> {
usedModules
=
new
ArrayList
<
Module
>();
usedBy
=
new
ArrayList
<
Module
>();
}
public
void
setToBeMoved
(
final
boolean
toBeMoved
)
{
this
.
toBeMoved
=
toBeMoved
;
}
public
void
setModule
(
final
Module
module
)
{
this
.
module
=
module
;
}
public
void
addDestination
(
final
Module
destination
,
final
Integer
rating
,
final
int
newImports
)
{
destinations
.
add
(
new
Destination
(
destination
,
rating
,
this
,
newImports
));
}
public
void
addUsedModule
(
final
Module
module
)
{
usedModules
.
add
(
module
);
}
public
void
addUsedModules
(
final
List
<
Module
>
modules
)
{
usedModules
.
addAll
(
modules
);
}
public
void
addUsedBy
(
final
Module
m
)
{
usedBy
.
add
(
m
);
}
public
void
setUsedModules
(
final
List
<
Module
>
modules
)
{
usedModules
=
modules
;
}
public
void
setFinalDestination
(
final
Destination
destination
)
{
this
.
finalDestination
=
destination
;
if
(
destination
!=
null
)
{
destination
.
setFunctionData
(
this
);
}
}
public
void
setRefactoringMethod
(
final
MoveFunctionMethod
rMethod
)
{
this
.
method
=
rMethod
;
}
public
Def_Function
getDefiniton
()
{
return
definiton
;
}
public
String
getFunctionBody
()
{
return
functionBody
;
}
public
boolean
isToBeMoved
()
{
return
toBeMoved
;
}
public
List
<
Destination
>
getDestinations
()
{
return
destinations
;
}
public
Module
getModule
()
{
return
module
;
}
public
List
<
Module
>
getUsedModules
()
{
return
usedModules
;
}
public
List
<
Module
>
getUsedBy
()
{
return
usedBy
;
}
public
Destination
getFinalDestination
()
{
return
finalDestination
;
}
public
MoveFunctionMethod
getRefactoringMethod
()
{
return
method
;
}
...
...
@@ -115,11 +115,11 @@ public class FunctionData implements Comparable<FunctionData> {
public
int
compareTo
(
final
FunctionData
arg0
)
{
return
this
.
getDefiniton
().
getIdentifier
().
getDisplayName
().
compareToIgnoreCase
(
arg0
.
getDefiniton
().
getIdentifier
().
getDisplayName
());
}
public
void
clearDestinations
()
{
destinations
.
clear
();
}
}
class
Destination
implements
Comparable
<
Destination
>
{
...
...
@@ -127,47 +127,47 @@ class Destination implements Comparable<Destination> {
private
int
rating
;
private
FunctionData
functionData
;
private
int
newImports
;
public
Destination
()
{
}
public
Destination
(
final
Module
module
,
final
int
rating
,
final
FunctionData
functionData
,
final
int
newImports
)
{
this
.
module
=
module
;
this
.
rating
=
rating
;
this
.
functionData
=
functionData
;
this
.
newImports
=
newImports
;
}
public
Module
getModule
()
{
return
module
;
}
public
int
getRating
()
{
return
rating
;
}
public
FunctionData
getFunctionData
()
{
return
functionData
;
}
public
int
getNewImports
()
{
return
newImports
;
}
public
void
setModule
(
final
Module
module
)
{
this
.
module
=
module
;
}
public
void
setRating
(
final
int
rating
)
{
this
.
rating
=
rating
;
}
public
void
setFunctionData
(
final
FunctionData
functionData
)
{
this
.
functionData
=
functionData
;
}
public
void
setNewImports
(
final
int
newImports
)
{
this
.
newImports
=
newImports
;
}
...
...
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/movefunction/MoveFunctionRefactoring.java
View file @
48cf5c46
This diff is collapsed.
Click to expand it.
org.eclipse.titanium.refactoring/src/org/eclipse/titanium/refactoring/movefunction/MoveFunctionWizardDestinationsPage.java
View file @
48cf5c46
...
...
@@ -45,7 +45,7 @@ public class MoveFunctionWizardDestinationsPage extends UserInputWizardPage {
private
CheckboxTreeViewer
tree
;
protected
static
boolean
displayZeros
;
private
Button
displayZerosCheckBox
;
MoveFunctionWizardDestinationsPage
(
final
String
name
,
final
MoveFunctionRefactoring
refactoring
)
{
super
(
name
);
this
.
refactoring
=
refactoring
;
...
...
@@ -53,7 +53,7 @@ public class MoveFunctionWizardDestinationsPage extends UserInputWizardPage {
refactoring
.
getSettings
().
setMethod
(
MoveFunctionMethod
.
LENGTH
);
refactoring
.
getSettings
().
setExcludedModuleNames
(
Pattern
.
compile
(
".*_types"
));
}
@Override
public
void
createControl
(
final
Composite
parent
)
{
final
Composite
top
=
new
Composite
(
parent
,
SWT
.
NONE
);
...
...
@@ -64,7 +64,7 @@ public class MoveFunctionWizardDestinationsPage extends UserInputWizardPage {
final
Composite
comp
=
new
Composite
(
top
,
SWT
.
NONE
);
initializeDialogUnits
(
comp
);
comp
.
setLayout
(
new
GridLayout
(
1
,
false
));
final
Label
label
=
new
Label
(
comp
,
SWT
.
NONE
);
label
.
setText
(
"Choose method: "
);
final
Button
shortestModule
=
new
Button
(
comp
,
SWT
.
RADIO
);
...
...
@@ -79,12 +79,12 @@ public class MoveFunctionWizardDestinationsPage extends UserInputWizardPage {
refactoring
.
getSettings
().
setMethod
(
MoveFunctionMethod
.
LENGTH
);
refactoring
.
getSettings
().
setChanged
(
true
);
}
refreshTree
();
};
};
});
final
Button
leastImports
=
new
Button
(
comp
,
SWT
.
RADIO
);
leastImports
.
setText
(
"insert the least new imports"
);
leastImports
.
addSelectionListener
(
new
SelectionAdapter
()
{
...
...
@@ -97,8 +97,8 @@ public class MoveFunctionWizardDestinationsPage extends UserInputWizardPage {
refactoring
.
getSettings
().
setChanged
(
true
);
}
refreshTree
();
};
});
};
});
/*
Button lengthAndImports = new Button(comp, SWT.RADIO);
lengthAndImports.setText("both");
...
...
@@ -107,8 +107,8 @@ public class MoveFunctionWizardDestinationsPage extends UserInputWizardPage {
refactoring.getSettings().setMethod(SlicingMethod.LENGTHANDIMPORTS);
refreshTree();
};
});
*/
});
*/