use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class AllTypeDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite createDialogArea = (Composite) super.createDialogArea(parent);
createDialogArea.setLayout(new FillLayout());
SashForm baseCom = new SashForm(createDialogArea, SWT.VERTICAL | SWT.BORDER);
baseCom.setLayout(new GridLayout(1, true));
Group group1 = new Group(baseCom, SWT.None);
group1.setText(Messages.getString("AllTypeDialog.Group1Text"));
group1.setLayoutData(new GridData(GridData.FILL_BOTH));
group1.setLayout(new FillLayout());
Font font = new Font(Display.getCurrent(), "Arial", 43, 3);
group1.setFont(font);
font.dispose();
Group group2 = new Group(baseCom, SWT.None);
group2.setText(Messages.getString("AllTypeDialog.Group2Text"));
group2.setLayoutData(new GridData(GridData.FILL_BOTH));
font = new Font(Display.getCurrent(), "Arial", 43, 3);
group2.setFont(font);
group2.setLayout(new FillLayout());
font.dispose();
list = new List(group1, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
list.setItems(allXMLSchemaTypeName);
treeViewer = new TreeViewer(group2, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tree = treeViewer.getTree();
tree.setHeaderVisible(false);
tree.setLinesVisible(true);
treeViewer.setContentProvider(new WebServiceTreeContentProvider());
treeViewer.setLabelProvider(new AllTypeLabelProvider());
treeViewer.setInput(null);
treeViewer.refresh();
list.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String selection = list.getSelection()[0];
if (selection.contains(COMPLEXTYPE)) {
String[] split = selection.split(":");
String complexTypeName = split[1];
for (XmlSchemaType xmlSchemaType : allXmlSchemaType) {
if (xmlSchemaType.getName().equals(complexTypeName)) {
ParameterInfo parameterRoot = new ParameterInfo();
parameterRoot.setName("parameters");
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName(complexTypeName);
parameterSon.setParent(parameterRoot);
parameterRoot.getParameterInfos().add(parameterSon);
XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaType;
XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
XmlSchemaObjectCollection childCollection = xmlSchemaGroupBase.getItems();
if (childCollection != null) {
buildParameterFromCollection(childCollection, parameterSon);
}
}
treeViewer.setInput(parameterRoot);
treeViewer.refresh();
selectedParaInfo = parameterSon;
}
}
} else {
treeViewer.setInput(null);
treeViewer.refresh();
selectedParaInfo = null;
}
}
});
return baseCom;
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class ImportDemoProjectPage method createControl.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.internal.wizards.datatransfer.WizardFileSystemResourceExportPage1#createControl(org.eclipse.swt
* .widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.verticalSpacing = 10;
container.setLayout(layout);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
Label label = new Label(container, SWT.NONE);
//$NON-NLS-1$
label.setText(Messages.getString("ImportDemoProjectPage.availableProjectsPrompt"));
GridData gd = new GridData();
label.setLayoutData(gd);
SashForm sashForm = new SashForm(container, SWT.HORIZONTAL);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 300;
sashForm.setLayoutData(gd);
wizardSelectionViewer = new TableViewer(sashForm, SWT.BORDER);
createDescriptionIn(sashForm);
initializeViewer();
wizardSelectionViewer.addSelectionChangedListener(this);
Dialog.applyDialogFont(container);
setControl(container);
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class ExportTreeViewer method createContents.
public SashForm createContents(Composite parent) {
// Splitter
final GridData data = new GridData();
data.heightHint = 600;
data.widthHint = 600;
sash = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH);
sash.setLayoutData(data);
GridLayout layout = new GridLayout();
sash.setLayout(layout);
// create tree
createItemList(sash);
// create button
Composite buttonComposite = new Composite(sash, SWT.ERROR);
buttonComposite.setLayout(new GridLayout());
moveButton = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveButton.setText(">>");
//$NON-NLS-1$
moveButton.setToolTipText("Show job tree");
final GridData layoutData = new GridData();
layoutData.verticalAlignment = GridData.CENTER;
layoutData.horizontalAlignment = GridData.CENTER;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
layoutData.widthHint = 30;
moveButton.setLayoutData(layoutData);
// add listner
moveButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
if (moveButton.getText().equals("<<")) {
//$NON-NLS-1$
sash.setWeights(new int[] { 0, 1, 23 });
//$NON-NLS-1$
moveButton.setText(">>");
//$NON-NLS-1$
moveButton.setToolTipText(Messages.getString("ExportTreeViewer.showJobTree"));
} else if (moveButton.getText().equals(">>")) {
//$NON-NLS-1$
sash.setWeights(new int[] { 10, 1, 15 });
//$NON-NLS-1$
moveButton.setText("<<");
//$NON-NLS-1$
moveButton.setToolTipText(Messages.getString("ExportTreeViewer.hideJobTree"));
}
}
});
return sash;
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class JavaJobScriptsExportWSWizardPage method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
GridLayout layout = new GridLayout();
SashForm sash = createExportTree(parent);
// Added a scrolled composite by Marvin Wang on Feb. 27, 2012 for bug TDI-19198.
scrolledComposite = new ScrolledComposite(sash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
pageComposite = new Group(scrolledComposite, SWT.NONE);
pageComposite.setLayout(layout);
pageComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
pageComposite.setFont(parent.getFont());
setControl(sash);
sash.setWeights(new int[] { 0, 1, 23 });
layout = new GridLayout();
layout.marginHeight = 0;
layout.verticalSpacing = 0;
destinationNameFieldComposite = new Composite(pageComposite, SWT.NONE);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
destinationNameFieldComposite.setLayoutData(gridData);
destinationNameFieldComposite.setLayout(layout);
destinationNameFieldInnerComposite = new Composite(destinationNameFieldComposite, SWT.NONE);
gridData = new GridData(GridData.FILL_HORIZONTAL);
destinationNameFieldInnerComposite.setLayoutData(gridData);
destinationNameFieldInnerComposite.setLayout(layout);
createDestinationGroup(destinationNameFieldInnerComposite);
// createExportTree(pageComposite);
if (!isMultiNodes()) {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
if (allowVerchange) {
createJobVersionGroup(pageComposite);
} else {
selectedJobVersion = "0.1";
}
}
createExportTypeGroup(pageComposite);
createOptionsGroupButtons(pageComposite);
// ie.- local
restoreResourceSpecificationWidgetValues();
updateWidgetEnablements();
setPageComplete(determinePageCompletion());
giveFocusToDestination();
pageComposite.setSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
scrolledComposite.setMinSize(pageComposite.getSize());
scrolledComposite.setContent(pageComposite);
}
use of org.eclipse.swt.custom.SashForm in project ACS by ACS-Community.
the class AlarmsView method createViewWidgets.
private void createViewWidgets(Composite parent) {
Listener hoverTree = new Listener() {
public void handleEvent(Event event) {
Point coords = new Point(event.x, event.y);
TreeItem it = _tree.getItem(coords);
String tooltip = "";
if (it == null) {
_tree.setToolTipText(tooltip);
return;
}
NodeType type = (NodeType) it.getData();
switch(type) {
case FAULT_FAMILY:
{
tooltip = _alarmManager.getFaultFamily(it.getText()).getName();
break;
}
case FAULT_CODE_DATA:
{
tooltip = _alarmManager.getFaultCode(it.getParentItem().getParentItem().getText(), new Integer(it.getText())).getProblemDescription();
break;
}
case FAULT_MEMBER_DATA:
{
tooltip = _alarmManager.getFaultMember(it.getParentItem().getParentItem().getText(), it.getText()).getName();
break;
}
}
_tree.setToolTipText(tooltip);
}
};
_deleteElement = new Listener() {
public void handleEvent(Event event) {
boolean choice = MessageDialog.openQuestion(AlarmsView.this.getViewSite().getShell(), "Confirmation", "Are you sure you want to delete this element");
if (choice == true) {
TreeItem sel = null;
if (_tree.getSelection() == null || _tree.getSelection().length == 0)
return;
NodeType type = (NodeType) _tree.getSelection()[0].getData();
if (type == NodeType.FAULT_CODE_LIST || type == NodeType.FAULT_MEMBER_LIST)
return;
String alarm = _tree.getSelection()[0].getText();
try {
if (type == NodeType.FAULT_FAMILY)
_alarmManager.deleteFaultFamily(_alarmManager.getFaultFamily(alarm));
else if (type == NodeType.FAULT_CODE_DATA) {
String ff = _tree.getSelection()[0].getParentItem().getParentItem().getText();
_alarmManager.deleteFaultCode(_alarmManager.getFaultFamily(ff), _alarmManager.getFaultCode(ff, new Integer(alarm).intValue()));
} else if (type == NodeType.FAULT_MEMBER_DATA) {
String ff = _tree.getSelection()[0].getParentItem().getParentItem().getText();
_alarmManager.deleteFaultMember(_alarmManager.getFaultFamily(ff), _alarmManager.getFaultMember(ff, alarm));
} else if (type == NodeType.FAULT_MEMBER_DEFAULT) {
String ff = _tree.getSelection()[0].getParentItem().getParentItem().getText();
_alarmManager.setFaultMemberDefault(_alarmManager.getFaultFamily(ff), null);
}
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot delete the item", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
} catch (NullPointerException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot delete the item", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
}
if (type != NodeType.FAULT_FAMILY) {
sel = _tree.getSelection()[0].getParentItem();
TreeItem tff = sel.getParentItem();
FaultFamily fft = _alarmManager.getFaultFamily(tff.getText());
if (fft.getFaultCodeCount() == 0 || (fft.getFaultMemberCount() == 0 && fft.getFaultMemberDefault() == null)) {
sel.setForeground(new Color(sel.getDisplay(), 255, 0, 0));
tff.setForeground(new Color(tff.getDisplay(), 255, 0, 0));
} else {
sel.setForeground(new Color(sel.getDisplay(), 0, 0, 0));
tff.setForeground(new Color(tff.getDisplay(), 0, 0, 0));
}
_tree.getSelection()[0].dispose();
_tree.setSelection(sel);
Event e = new Event();
_tree.notifyListeners(SWT.Selection, e);
} else {
_tree.getSelection()[0].dispose();
if (_tree.getItemCount() > 0)
_tree.setSelection(_tree.getItems()[0]);
Event e = new Event();
_tree.notifyListeners(SWT.Selection, e);
}
}
}
};
_addFaultMember = new Listener() {
public void handleEvent(Event event) {
TreeItem tmp = _tree.getSelection()[0];
TreeItem tmp2 = null;
while (tmp != null) {
tmp2 = tmp;
tmp = tmp.getParentItem();
}
String ff = tmp2.getText();
InputDialog dialog = new InputDialog(AlarmsView.this.getViewSite().getShell(), "New Fault Member", "Enter the Fault Member name", null, new IInputValidator() {
public String isValid(String newText) {
if (newText.trim().compareTo("") == 0)
return "The name is empty";
return null;
}
});
dialog.setBlockOnOpen(true);
dialog.open();
int returnCode = dialog.getReturnCode();
if (returnCode == InputDialog.OK) {
FaultMember newFaultMember = new FaultMember();
newFaultMember.setName(dialog.getValue());
try {
_alarmManager.addFaultMember(_alarmManager.getFaultFamily(ff), newFaultMember);
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Fault Member", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
} catch (NullPointerException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Fault Member", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
}
sortFaultFamilyList();
selectElementFromTree(ff, dialog.getValue(), null);
}
}
};
_addFaultMemberDefault = new Listener() {
public void handleEvent(Event event) {
TreeItem tmp = _tree.getSelection()[0];
TreeItem tmp2 = null;
while (tmp != null) {
tmp2 = tmp;
tmp = tmp.getParentItem();
}
String ff = tmp2.getText();
FaultMemberDefault newFaultMemberDefault = new FaultMemberDefault();
try {
_alarmManager.setFaultMemberDefault(_alarmManager.getFaultFamily(ff), newFaultMemberDefault);
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Default Fault Member", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
} catch (NullPointerException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Default Fault Member", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
}
sortFaultFamilyList();
selectElementFromTree(ff, "Default Member", null);
}
};
_addFaultCode = new Listener() {
public void handleEvent(Event event) {
TreeItem tmp = _tree.getSelection()[0];
TreeItem tmp2 = null;
while (tmp != null) {
tmp2 = tmp;
tmp = tmp.getParentItem();
}
String ff = tmp2.getText();
InputDialog dialog = new InputDialog(AlarmsView.this.getViewSite().getShell(), "New Fault Code", "Enter the Fault Code Value", null, new IInputValidator() {
public String isValid(String newText) {
if (newText.trim().compareTo("") == 0)
return "The value is empty";
try {
new Integer(newText);
} catch (NumberFormatException e) {
return "The value is not a number";
}
return null;
}
});
dialog.setBlockOnOpen(true);
dialog.open();
int returnCode = dialog.getReturnCode();
if (returnCode == InputDialog.OK) {
FaultCode newFaultCode = new FaultCode();
newFaultCode.setValue(new Integer(dialog.getValue()).intValue());
try {
_alarmManager.addFaultCode(_alarmManager.getFaultFamily(ff), newFaultCode);
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Fault Code", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
} catch (NullPointerException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Fault Code", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
}
sortFaultFamilyList();
selectElementFromTree(ff, null, dialog.getValue());
}
}
};
_addFaultFamily = new Listener() {
public void handleEvent(Event event) {
InputDialog dialog = new InputDialog(AlarmsView.this.getViewSite().getShell(), "New Alarm", "Enter the Fault Family name", null, new IInputValidator() {
public String isValid(String newText) {
if (newText.trim().compareTo("") == 0)
return "The name is empty";
return null;
}
});
dialog.setBlockOnOpen(true);
dialog.open();
int returnCode = dialog.getReturnCode();
if (returnCode == InputDialog.OK) {
FaultFamily newAlarm = new FaultFamily();
newAlarm.setName(dialog.getValue());
try {
_alarmManager.addFaultFamily(newAlarm);
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Alarm", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
} catch (NullPointerException e) {
ErrorDialog error = new ErrorDialog(AlarmsView.this.getViewSite().getShell(), "Cannot add the new Alarm", e.getMessage(), new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
}
sortFaultFamilyList();
selectElementFromTree(dialog.getValue(), null, null);
}
}
};
_sash = new SashForm(parent, SWT.NONE);
_sash.setLayout(new FillLayout());
_alarmsComp = new Composite(_sash, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
_alarmsComp.setLayout(layout);
_treeGroup = new Group(_alarmsComp, SWT.SHADOW_ETCHED_IN);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
_treeGroup.setLayoutData(gd);
GridLayout gl = new GridLayout();
gl.numColumns = 1;
_treeGroup.setLayout(gl);
_treeGroup.setText("Fault Family List");
/* The tree used to list the FF, FM and FCs */
_tree = new Tree(_treeGroup, SWT.VIRTUAL | SWT.BORDER);
gd = new GridData();
gd.verticalAlignment = SWT.FILL;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.grabExcessHorizontalSpace = true;
_tree.setLayoutData(gd);
//Menu treePopUp = new Menu(parent, SWT.POP_UP);
Menu treePopUp = new Menu(parent);
_tree.setMenu(treePopUp);
treePopUp.addListener(SWT.Show, new Listener() {
public void handleEvent(Event e) {
//Point point = new Point(e.x, e.y);
//TreeItem sel = _tree.getItem(point);
TreeItem[] sel = _tree.getSelection();
Menu treePopUp = _tree.getMenu();
MenuItem[] items = treePopUp.getItems();
for (int i = 0; i < items.length; i++) items[i].dispose();
MenuItem mitem;
if (sel == null || sel.length == 0) {
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Fault Family");
mitem.addListener(SWT.Selection, _addFaultFamily);
return;
}
NodeType type = (NodeType) sel[0].getData();
switch(type) {
case FAULT_FAMILY:
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Fault Family");
mitem.addListener(SWT.Selection, _addFaultFamily);
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Delete Fault Family");
mitem.addListener(SWT.Selection, _deleteElement);
break;
case FAULT_CODE_LIST:
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Fault Code");
mitem.addListener(SWT.Selection, _addFaultCode);
break;
case FAULT_CODE_DATA:
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Fault Code");
mitem.addListener(SWT.Selection, _addFaultCode);
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Delete Fault Code");
mitem.addListener(SWT.Selection, _deleteElement);
break;
case FAULT_MEMBER_LIST:
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Fault Member");
mitem.addListener(SWT.Selection, _addFaultMember);
if (_alarmManager.getFaultFamily(sel[0].getParentItem().getText()).getFaultMemberDefault() == null) {
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Default Fault Member");
mitem.addListener(SWT.Selection, _addFaultMemberDefault);
}
break;
case FAULT_MEMBER_DATA:
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Add Fault Member");
mitem.addListener(SWT.Selection, _addFaultMember);
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Delete Fault Member");
mitem.addListener(SWT.Selection, _deleteElement);
break;
case FAULT_MEMBER_DEFAULT:
mitem = new MenuItem(treePopUp, SWT.PUSH);
mitem.setText("Delete Default Fault Member");
mitem.addListener(SWT.Selection, _deleteElement);
break;
default:
for (int i = 0; i < items.length; i++) items[i].dispose();
break;
}
}
});
_tree.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
TreeItem[] tmp = ((Tree) e.widget).getSelection();
if (tmp == null || tmp.length == 0) {
_FFgroup.setVisible(false);
((GridData) _FFgroup.getLayoutData()).exclude = true;
_FMgroup.setVisible(false);
((GridData) _FMgroup.getLayoutData()).exclude = true;
_FCgroup.setVisible(false);
((GridData) _FCgroup.getLayoutData()).exclude = true;
_FMDgroup.setVisible(false);
((GridData) _FMDgroup.getLayoutData()).exclude = true;
_FCFMgroup.setVisible(false);
((GridData) _FCFMgroup.getLayoutData()).exclude = true;
return;
}
TreeItem item = tmp[0];
NodeType type = (NodeType) item.getData();
/* Delete the label the first time we select something */
Control c = _compInitial.getChildren()[0];
if (c instanceof Label) {
c.dispose();
_compInitial.layout();
c = _compInitial.getChildren()[0];
}
if (type == NodeType.FAULT_FAMILY) {
_FFgroup.setVisible(true);
((GridData) _FFgroup.getLayoutData()).exclude = false;
_FMgroup.setVisible(false);
((GridData) _FMgroup.getLayoutData()).exclude = true;
_FCgroup.setVisible(false);
((GridData) _FCgroup.getLayoutData()).exclude = true;
_FMDgroup.setVisible(false);
((GridData) _FMDgroup.getLayoutData()).exclude = true;
_FCFMgroup.setVisible(false);
((GridData) _FCFMgroup.getLayoutData()).exclude = true;
//_FFgroup.moveAbove(c);
fillFFWidgets(item.getText());
} else if (type == NodeType.FAULT_CODE_LIST) {
_FFgroup.setVisible(false);
((GridData) _FFgroup.getLayoutData()).exclude = true;
_FMgroup.setVisible(false);
((GridData) _FMgroup.getLayoutData()).exclude = true;
_FCgroup.setVisible(false);
((GridData) _FCgroup.getLayoutData()).exclude = true;
_FMDgroup.setVisible(false);
((GridData) _FMDgroup.getLayoutData()).exclude = true;
_FCFMgroup.setVisible(true);
((GridData) _FCFMgroup.getLayoutData()).exclude = false;
fillFCFMWidgets();
} else if (type == NodeType.FAULT_CODE_DATA) {
_FFgroup.setVisible(false);
((GridData) _FFgroup.getLayoutData()).exclude = true;
_FMgroup.setVisible(false);
((GridData) _FMgroup.getLayoutData()).exclude = true;
_FCgroup.setVisible(true);
((GridData) _FCgroup.getLayoutData()).exclude = false;
_FMDgroup.setVisible(false);
((GridData) _FMDgroup.getLayoutData()).exclude = true;
_FCFMgroup.setVisible(false);
((GridData) _FCFMgroup.getLayoutData()).exclude = true;
//_FCgroup.moveAbove(c);
fillFCWidgets(Integer.parseInt(item.getText()), item.getParentItem().getParentItem().getText());
} else if (type == NodeType.FAULT_MEMBER_LIST) {
_FFgroup.setVisible(false);
((GridData) _FFgroup.getLayoutData()).exclude = true;
_FMgroup.setVisible(false);
((GridData) _FMgroup.getLayoutData()).exclude = true;
_FCgroup.setVisible(false);
((GridData) _FCgroup.getLayoutData()).exclude = true;
_FMDgroup.setVisible(false);
((GridData) _FMDgroup.getLayoutData()).exclude = true;
_FCFMgroup.setVisible(true);
((GridData) _FCFMgroup.getLayoutData()).exclude = false;
fillFCFMWidgets();
} else if (type == NodeType.FAULT_MEMBER_DATA) {
_FFgroup.setVisible(false);
((GridData) _FFgroup.getLayoutData()).exclude = true;
_FMgroup.setVisible(true);
((GridData) _FMgroup.getLayoutData()).exclude = false;
_FCgroup.setVisible(false);
((GridData) _FCgroup.getLayoutData()).exclude = true;
_FMDgroup.setVisible(false);
((GridData) _FMDgroup.getLayoutData()).exclude = true;
_FCFMgroup.setVisible(false);
((GridData) _FCFMgroup.getLayoutData()).exclude = true;
//_FMgroup.moveAbove(c);
fillFMWidgets(item.getText(), item.getParentItem().getParentItem().getText());
} else if (type == NodeType.FAULT_MEMBER_DEFAULT) {
_FFgroup.setVisible(false);
((GridData) _FFgroup.getLayoutData()).exclude = true;
_FMgroup.setVisible(false);
((GridData) _FMgroup.getLayoutData()).exclude = true;
_FCgroup.setVisible(false);
((GridData) _FCgroup.getLayoutData()).exclude = true;
_FMDgroup.setVisible(true);
((GridData) _FMDgroup.getLayoutData()).exclude = false;
_FCFMgroup.setVisible(false);
((GridData) _FCFMgroup.getLayoutData()).exclude = true;
fillFMDWidgets(item.getParentItem().getParentItem().getText());
}
_compInitial.layout();
}
});
_tree.addListener(SWT.MouseHover, hoverTree);
_alarmsButtonsComp = new Composite(_alarmsComp, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
_alarmsButtonsComp.setLayout(layout);
_addAlarmButton = new Button(_alarmsButtonsComp, SWT.None);
_addAlarmButton.setText("Add");
_addAlarmButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ADD));
_deleteAlarmButton = new Button(_alarmsButtonsComp, SWT.None);
_deleteAlarmButton.setText("Delete");
_deleteAlarmButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_DELETE));
_addAlarmButton.addListener(SWT.Selection, _addFaultFamily);
_deleteAlarmButton.addListener(SWT.Selection, _deleteElement);
/* Top widget of the right side */
_compInitial = new Composite(_sash, SWT.SHADOW_ETCHED_IN);
_compInitial.setLayout(new GridLayout());
new Label(_compInitial, SWT.NONE).setText("Select an element");
/* FF/FM/FC Details */
createFFWidgets();
createFCWidgets();
createFMWidgets();
createFMDWidgets();
createFCFMWidgets();
/* At the beginning we only show a label */
_FFgroup.setVisible(false);
_FCgroup.setVisible(false);
_FMgroup.setVisible(false);
_FMDgroup.setVisible(false);
_FCFMgroup.setVisible(false);
_sash.setWeights(new int[] { 3, 5 });
}
Aggregations