use of org.talend.designer.core.ui.views.properties.ComponentSettingsView in project tdi-studio-se by Talend.
the class AbstractTalendEditor method dispose.
@Override
public void dispose() {
ProcessorUtilities.editorClosed(this);
talendPaletteViewerProvider = null;
// achen modify to fix bug 0006107
// if (!getParent().isKeepPropertyLocked()) {
// JobResourceManager manager = JobResourceManager.getInstance();
// manager.removeProtection(this);
// for (JobResource r : protectedJobs.values()) {
// manager.deleteResource(r);
// }
// }
ComponentSettingsView viewer = (ComponentSettingsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ComponentSettingsView.ID);
if (viewer != null) {
viewer.cleanDisplay();
}
for (Iterator iterator = getSelectionActions().iterator(); iterator.hasNext(); ) {
String actionID = (String) iterator.next();
IAction action = getActionRegistry().getAction(actionID);
if (action != null) {
fActivationCodeTrigger.unregisterActionFromKeyActivation(action);
getActionRegistry().removeAction(action);
if (action instanceof Disposable) {
((Disposable) action).dispose();
}
}
}
fActivationCodeTrigger.uninstall();
fActivationCodeTrigger = null;
getSelectionActions().clear();
getGraphicalViewer().removeDropTargetListener(talendEditorDropTargetListener);
if (getGraphicalViewer().getContents() != null) {
getGraphicalViewer().getContents().deactivate();
getGraphicalViewer().getContents().removeNotify();
getGraphicalViewer().getRootEditPart().deactivate();
getGraphicalViewer().getRootEditPart().removeNotify();
}
getGraphicalViewer().setEditPartFactory(null);
getGraphicalViewer().setContextMenu(null);
getGraphicalViewer().setContents(null);
if (sharedKeyHandler != null) {
sharedKeyHandler.remove(KeyStroke.getPressed(SWT.F1, 0));
sharedKeyHandler.remove(KeyStroke.getPressed(SWT.DEL, 0));
}
// super.setInput(null);
// getGraphicalViewer().setContents(null);
// if (getGraphicalViewer().getControl() != null && !getGraphicalViewer().getControl().isDisposed()) {
// getGraphicalViewer().getControl().dispose();
// }
talendEditorDropTargetListener.setEditor(null);
talendEditorDropTargetListener = null;
// TalendScalableFreeformRootEditPart rootEditPart = (TalendScalableFreeformRootEditPart) getGraphicalViewer()
// .getRootEditPart();
// rootEditPart.setEditorInput(null);
// rootEditPart.deactivate();
super.dispose();
if (!getParent().isKeepPropertyLocked()) {
((Process) getProcess()).dispose();
}
// process = null;
parent = null;
getEditDomain().getCommandStack().dispose();
getEditDomain().setActiveTool(null);
getEditDomain().setPaletteRoot(null);
getEditDomain().setPaletteViewer(null);
getEditDomain().setCommandStack(null);
getEditDomain().setDefaultTool(null);
getSelectionSynchronizer().removeViewer(getGraphicalViewer());
getSite().setSelectionProvider(null);
}
use of org.talend.designer.core.ui.views.properties.ComponentSettingsView in project tdi-studio-se by Talend.
the class NodePart method setSelected.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#setSelected(int)
*/
@Override
@SuppressWarnings("unchecked")
public void setSelected(final int value) {
if (value == SELECTED) {
super.setSelected(SELECTED_PRIMARY);
} else {
super.setSelected(value);
}
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (value == SELECTED_NONE) {
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
ComponentSettingsView compSettings = viewer;
compSettings.cleanDisplay();
return;
}
IEditorPart activeEditor = page.getActiveEditor();
if (activeEditor instanceof AbstractMultiPageTalendEditor) {
GraphicalViewer designerViewer = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor().getViewer();
Control ctrl = designerViewer.getControl();
String helpLink = (String) ((Node) getModel()).getPropertyValue(EParameterName.HELP.getName());
String requiredHelpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
if (helpLink == null || "".equals(helpLink) || !requiredHelpLink.equals(helpLink)) {
//$NON-NLS-1$
helpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
}
if (ctrl != null) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl, helpLink);
}
// This code was to update automatically the help view, to set the documentation of the selected component
// remove for TDI-24396
// IViewPart view = page.findView("org.eclipse.help.ui.HelpView"); //$NON-NLS-1$
// if (view != null) {
// PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpLink);
// }
TalendSelectionManager selectionManager = (TalendSelectionManager) designerViewer.getSelectionManager();
if (value == SELECTED || value == SELECTED_PRIMARY) {
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
if (selectionManager.getSelectionType() == ETalendSelectionType.SINGLE) {
ComponentSettingsView compSettings = viewer;
compSettings.setElement((Node) getModel());
if (((Node) getModel()).getComponent() instanceof DummyComponent) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
Messages.getString("NodePart_warning"), //$NON-NLS-1$
Messages.getString("NodePart_componentNotLoaded"));
return;
}
CodeView.refreshCodeView((Node) getModel());
} else if (!viewer.isCleaned() && selectionManager.getSelectionType() == ETalendSelectionType.MULTIPLE) {
ComponentSettingsView compSettings = viewer;
compSettings.cleanDisplay();
} else if (isDrop()) {
if (value == SELECTED || value == SELECTED_PRIMARY) {
ComponentSettingsView compSettings = viewer;
compSettings.setElement((Node) getModel());
if (((Node) getModel()).getComponent() instanceof DummyComponent) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
Messages.getString("NodePart_warning"), //$NON-NLS-1$
Messages.getString("NodePart_componentNotLoaded"));
return;
}
CodeView.refreshCodeView((Node) getModel());
}
}
}
}
}
use of org.talend.designer.core.ui.views.properties.ComponentSettingsView in project tdi-studio-se by Talend.
the class RepositoryChangeMetadataCommand method updateColumnList.
@Override
protected void updateColumnList(IMetadataTable oldTable, IMetadataTable newTable) {
IWorkbenchWindow ww = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (ww == null) {
return;
}
IWorkbenchPage page = ww.getActivePage();
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
if (viewer.getElement() != null && viewer.getElement().equals(node)) {
List<ColumnNameChanged> columnNameChanged = new ArrayList<ColumnNameChanged>();
for (int j = 0; j < oldTable.getListColumns().size(); j++) {
if (newTable.getListColumns().size() > j) {
String oldName = oldTable.getListColumns().get(j).getLabel();
String newName = newTable.getListColumns().get(j).getLabel();
if (!oldName.equals(newName)) {
columnNameChanged.add(new ColumnNameChanged(oldName, newName));
}
}
}
ColumnListController.updateColumnList(node, null);
}
}
Aggregations