use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.
the class TabFolderEditors method addListenersToInputButtons.
/**
* DOC amaumont Comment method "addListenersToInputButtons".
*/
private void addListenersToInputButtons() {
MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar();
inputToolBarButtons = toolBar.getButtons();
beforeCommandListenerForInputButtons = new IExtendedButtonListener() {
public void handleEvent(ExtendedButtonEvent event) {
TableViewerCreator tableViewerCreator = mapperManager.getUiManager().getCurrentSelectedInputTableView().getTableViewerCreatorForColumns();
if (tableViewerCreator != null) {
tableViewerCreator.applyActivatedCellEditor();
}
}
};
for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
extendedPushButton.addListener(beforeCommandListenerForInputButtons, true);
}
this.addDisposeListener(new DisposeListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
*/
public void widgetDisposed(DisposeEvent e) {
for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true);
}
}
});
}
use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.
the class RadioFieldEditor method getChangeControl.
@Override
protected Button getChangeControl(Composite parent) {
if (radio == null) {
radio = new Button(parent, SWT.RADIO | SWT.LEFT);
radio.setFont(parent.getFont());
radio.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean isSelected = radio.getSelection();
valueChanged(wasSelected, isSelected);
wasSelected = isSelected;
}
});
radio.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
radio = null;
}
});
} else {
checkParent(radio, parent);
}
return radio;
}
use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.
the class HL7Tree2SchemaLinker method initColors.
private void initColors(Display display) {
// selectedLoopLinkColor = new Color(display, 255, 131, 0);
selectedRelativeLinkColor = new Color(display, 110, 168, 255);
getTree().addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
// selectedLoopLinkColor.dispose();
selectedRelativeLinkColor.dispose();
getTree().removeDisposeListener(this);
}
});
}
use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.
the class UIManager method modifySelectionChangedListener.
private void modifySelectionChangedListener(final Zone currentZone, final MetadataTableEditorView metadataTableEditorViewFinal, final TableViewerCreator metadataTVCreator, final MetadataTableEditor metadataTableEditor, final DataMapTableView dataMapTableView, DataMapTableView previousSelectedTableView) {
final TableViewer tableViewer = dataMapTableView.getTableViewerCreatorForColumns().getTableViewer();
IModifiedBeanListener<IMetadataColumn> modifiedBeanListener = new IModifiedBeanListener<IMetadataColumn>() {
public void handleEvent(ModifiedBeanEvent<IMetadataColumn> event) {
if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId()) && !event.previousValue.equals(event.newValue)) {
IMetadataColumn modifiedObject = event.bean;
if (modifiedObject != null) {
TableEntryLocation tableEntryLocation = new TableEntryLocation(dataMapTableView.getDataMapTable().getName(), (String) event.previousValue);
final ITableEntry dataMapTableEntry = mapperManager.retrieveTableEntry(tableEntryLocation);
// see bug 7471,record the modification about the column value
String curConnName = null;
if (dataMapTableEntry != null) {
curConnName = dataMapTableEntry.getParentName();
}
List<? extends IConnection> curInConns = mapperManager.getAbstractMapComponent().getIncomingConnections();
List<? extends IConnection> curOutConns = mapperManager.getAbstractMapComponent().getOutgoingConnections();
for (IConnection curInConn : curInConns) {
if (curConnName.equals(curInConn.getUniqueName())) {
Map<String, String> changedNameInColumns = new HashMap<String, String>();
changedNameInColumns.put((String) event.newValue, (String) event.previousValue);
changedNameColumns.put(curInConn, changedNameInColumns);
}
}
for (IConnection curOutConn : curOutConns) {
if (curConnName.equals(curOutConn.getUniqueName())) {
Map<String, String> changedNameOutColumns = new HashMap<String, String>();
changedNameOutColumns.put((String) event.newValue, (String) event.previousValue);
changedNameColumns.put(curOutConn, changedNameOutColumns);
}
}
processColumnNameChanged((String) event.previousValue, (String) event.newValue, dataMapTableView, dataMapTableEntry);
// related tables
List<DataMapTableView> relatedOutputsTableView = getRelatedOutputsTableView(dataMapTableView);
for (DataMapTableView relatedView : relatedOutputsTableView) {
TableEntryLocation relatedEntryLocation = new TableEntryLocation(relatedView.getDataMapTable().getName(), (String) event.previousValue);
ITableEntry relatedTableEntry = mapperManager.retrieveTableEntry(relatedEntryLocation);
processColumnNameChanged((String) event.previousValue, (String) event.newValue, relatedView, relatedTableEntry);
}
}
// dataMapTableViewer.refresh(event.bean, true);
tableViewer.refresh(true);
} else if (AbstractMetadataTableEditorView.ID_COLUMN_KEY.equals(event.column.getId())) {
tableViewer.refresh(true);
IColumnEntry entry = dataMapTableView.getDataMapTable().getColumnEntries().get(event.index);
parseExpression(entry.getExpression(), entry, false, false, false);
} else if (AbstractMetadataTableEditorView.ID_COLUMN_TYPE.equals(event.column.getId()) || AbstractMetadataTableEditorView.ID_COLUMN_NULLABLE.equals(event.column.getId())) {
mapperManager.getProblemsManager().checkProblemsForAllEntriesOfAllTables(true);
}
}
};
ILineSelectionListener metadataEditorViewerSelectionChangedListener = new ILineSelectionListener() {
public void handle(LineSelectionEvent e) {
if (metadataTableEditorViewFinal.getTableViewerCreator() == e.source) {
if (metadataTableEditorViewFinal.getExtendedTableViewer().isExecuteSelectionEvent()) {
mapperManager.getUiManager().selectLinkedTableEntries(metadataTableEditor.getMetadataTable(), metadataTVCreator.getTable().getSelectionIndices());
}
} else {
// if (dataMapTableView.getExtendedTableViewerForColumns().isExecuteSelectionEvent()) {
// int[] selectionIndices =
// dataMapTableView.getTableViewerCreatorForColumns().getTable().getSelectionIndices();
// mapperManager.getUiManager().selectLinkedMetadataEditorEntries(dataMapTableView,
// selectionIndices);
// }
}
}
};
// ISelectionChangedListener previousSelectionChangedListener = null;
ILineSelectionListener previousSelectionChangedListener = null;
IModifiedBeanListener<IMetadataColumn> previousModifiedBeanListener = null;
if (currentZone == Zone.INPUTS) {
previousSelectionChangedListener = inputsSelectionChangedListener;
previousModifiedBeanListener = inputModifiedBeanListener;
} else if (currentZone == Zone.OUTPUTS) {
previousSelectionChangedListener = outputsSelectionChangedListener;
previousModifiedBeanListener = outputModifiedBeanListener;
}
if (previousSelectionChangedListener != null) {
// metadataTVCreator.removeSelectionChangedListener(previousSelectionChangedListener);
metadataTVCreator.getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
if (previousSelectedTableView != null) {
previousSelectedTableView.getTableViewerCreatorForColumns().getSelectionHelper().removeAfterSelectionListener(previousSelectionChangedListener);
}
}
if (previousModifiedBeanListener != null) {
metadataTableEditor.removeModifiedBeanListener(previousModifiedBeanListener);
}
if (currentZone == Zone.INPUTS) {
inputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
inputModifiedBeanListener = modifiedBeanListener;
} else if (currentZone == Zone.OUTPUTS) {
outputsSelectionChangedListener = metadataEditorViewerSelectionChangedListener;
outputModifiedBeanListener = modifiedBeanListener;
}
// metadataTVCreator.addSelectionChangedListener(metadataEditorViewerSelectionChangedListener);
metadataTVCreator.getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
dataMapTableView.getTableViewerCreatorForColumns().getSelectionHelper().addAfterSelectionListener(metadataEditorViewerSelectionChangedListener);
metadataTableEditor.addModifiedBeanListener(modifiedBeanListener);
if (this.commonMetadataDisposeListener == null) {
this.commonMetadataDisposeListener = new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
if (inputsSelectionChangedListener != null) {
getMetadataEditorView(Zone.INPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(inputsSelectionChangedListener);
}
if (outputsSelectionChangedListener != null) {
getMetadataEditorView(Zone.OUTPUTS).getTableViewerCreator().getSelectionHelper().removeAfterSelectionListener(outputsSelectionChangedListener);
}
if (inputModifiedBeanListener != null) {
MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.INPUTS).getMetadataTableEditor();
if (metadataTableEditor != null) {
metadataTableEditor.removeModifiedBeanListener(inputModifiedBeanListener);
}
}
if (outputModifiedBeanListener != null) {
MetadataTableEditor metadataTableEditor = getMetadataEditorView(Zone.OUTPUTS).getMetadataTableEditor();
if (metadataTableEditor != null) {
metadataTableEditor.removeModifiedBeanListener(outputModifiedBeanListener);
}
}
}
};
metadataTVCreator.getTable().addDisposeListener(this.commonMetadataDisposeListener);
}
}
use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.
the class SQLEditorProposalAdapter method openProposalPopup.
/**
* Open the proposal popup and display the proposals provided by the proposal provider. This method returns
* immediately. That is, it does not wait for a proposal to be selected.
*/
protected void openProposalPopup() {
if (isValid()) {
if (popup == null) {
recordCursorPosition();
popup = new ContentProposalPopup(null);
popup.open();
popup.getShell().addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent event) {
popup = null;
}
});
}
}
}
Aggregations