Commit 205f4e1b authored by helene ortiz's avatar helene ortiz
Browse files

Reduce number of casts

parent 2479f6cf
......@@ -45,12 +45,15 @@ import fr.ill.ics.client.view.widget.PContainer;
public class SWTCommandsSelectionPluginPeer extends SWTSelectionPluginPeer {
private SWTCommandsSelectionTree commandsSelectionTree;
public void init() {
super.init();
// Init specific selection tree
selectionTree = new SWTCommandsSelectionTree();
commandsSelectionTree = (SWTCommandsSelectionTree)selectionTree;
PContainer pContainer = ((SWTPWidgetFactory)SWTPWidgetFactory.getSWTInstance()).convertToPContainer(mainComposite);
selectionTree.init(pContainer, (SelectionPlugin)this.getPlugin());
......@@ -87,7 +90,7 @@ public class SWTCommandsSelectionPluginPeer extends SWTSelectionPluginPeer {
}
public void loadScans() {
((SWTCommandsSelectionTree)selectionTree).createScansRoot();
commandsSelectionTree.createScansRoot();
LinkedHashMap<String, List<ScanSelectionTreeData>> scansTree = ((CommandsSelectionPlugin)getPlugin()).getScanFiles();
......@@ -101,10 +104,10 @@ public class SWTCommandsSelectionPluginPeer extends SWTSelectionPluginPeer {
// Scans in main directory will be created after
} else {
// Create a tree item for parent node
TreeItem treeItem = ((SWTCommandsSelectionTree)selectionTree).createSubScan(parent);
TreeItem treeItem = commandsSelectionTree.createSubScan(parent);
Iterator<ScanSelectionTreeData> itScans = children.iterator();
while (itScans.hasNext()) {
((SWTCommandsSelectionTree)selectionTree).addScan(itScans.next(), treeItem);
commandsSelectionTree.addScan(itScans.next(), treeItem);
}
}
}
......@@ -112,57 +115,57 @@ public class SWTCommandsSelectionPluginPeer extends SWTSelectionPluginPeer {
if (scansTree.get(CommandsSelectionPlugin.USERSCANS_PARENT_TEXT) != null) {
Iterator<ScanSelectionTreeData> itScans = scansTree.get(CommandsSelectionPlugin.USERSCANS_PARENT_TEXT).iterator();
while (itScans.hasNext()) {
((SWTCommandsSelectionTree)selectionTree).addScan(itScans.next(), null);
commandsSelectionTree.addScan(itScans.next(), null);
}
}
}
}
public void selectNode(String nodeName) {
((SWTCommandsSelectionTree)selectionTree).selectNode(nodeName);
commandsSelectionTree.selectNode(nodeName);
}
public void createForLoopNode() {
((SWTCommandsSelectionTree)selectionTree).createForLoopNode();
commandsSelectionTree.createForLoopNode();
}
public void createIfNode() {
((SWTCommandsSelectionTree)selectionTree).createIfNode();
commandsSelectionTree.createIfNode();
}
public void createClipboardNode() {
((SWTCommandsSelectionTree)selectionTree).createClipboardNode();
commandsSelectionTree.createClipboardNode();
}
public void createBreakIfNode() {
((SWTCommandsSelectionTree)selectionTree).createBreakIfNode();
commandsSelectionTree.createBreakIfNode();
}
public void createFixNode() {
((SWTCommandsSelectionTree)selectionTree).createFixNode();
commandsSelectionTree.createFixNode();
}
public void createClearNode() {
((SWTCommandsSelectionTree)selectionTree).createClearNode();
commandsSelectionTree.createClearNode();
}
public void createSetZeroNode() {
((SWTCommandsSelectionTree)selectionTree).createSetZeroNode();
commandsSelectionTree.createSetZeroNode();
}
public void createSetNode() {
((SWTCommandsSelectionTree)selectionTree).createSetNode();
commandsSelectionTree.createSetNode();
}
public void createFavouritesNode() {
((SWTCommandsSelectionTree)selectionTree).initFavouritesNode();
commandsSelectionTree.initFavouritesNode();
}
public void forLoopNodeVisible(boolean visible) {
if (visible) {
((SWTCommandsSelectionTree)selectionTree).createForLoopNode();
commandsSelectionTree.createForLoopNode();
} else {
((SWTCommandsSelectionTree)selectionTree).deleteForLoopNode();
commandsSelectionTree.deleteForLoopNode();
}
}
......@@ -186,7 +189,7 @@ public class SWTCommandsSelectionPluginPeer extends SWTSelectionPluginPeer {
} else {
draggedData = new DraggedData(new SourceCommandBoxInfo(commandBox));
}
((SWTCommandsSelectionTree)selectionTree).addToClipboard(draggedData);
commandsSelectionTree.addToClipboard(draggedData);
}
......@@ -202,24 +205,24 @@ public class SWTCommandsSelectionPluginPeer extends SWTSelectionPluginPeer {
}
public void showXBUFiles() {
((SWTCommandsSelectionTree)selectionTree).showXBUFiles();
commandsSelectionTree.showXBUFiles();
}
public void hideXBUFiles() {
((SWTCommandsSelectionTree)selectionTree).hideXBUFiles();
commandsSelectionTree.hideXBUFiles();
}
public void showPALFiles() {
((SWTCommandsSelectionTree)selectionTree).showPALFiles();
commandsSelectionTree.showPALFiles();
}
public void hidePALFiles() {
((SWTCommandsSelectionTree)selectionTree).hidePALFiles();
commandsSelectionTree.hidePALFiles();
}
public void hideUserScans() {
((SWTCommandsSelectionTree)selectionTree).hideUserScans();
commandsSelectionTree.hideUserScans();
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment