Search in sources :

Example 1 with Disposable

use of org.eclipse.gef.Disposable 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);
}
Also used : Disposable(org.eclipse.gef.Disposable) IAction(org.eclipse.jface.action.IAction) Iterator(java.util.Iterator) IProcess(org.talend.core.model.process.IProcess) Process(org.talend.designer.core.ui.editor.process.Process) IComponentSettingsView(org.talend.core.views.IComponentSettingsView) ComponentSettingsView(org.talend.designer.core.ui.views.properties.ComponentSettingsView)

Aggregations

Iterator (java.util.Iterator)1 Disposable (org.eclipse.gef.Disposable)1 IAction (org.eclipse.jface.action.IAction)1 IProcess (org.talend.core.model.process.IProcess)1 IComponentSettingsView (org.talend.core.views.IComponentSettingsView)1 Process (org.talend.designer.core.ui.editor.process.Process)1 ComponentSettingsView (org.talend.designer.core.ui.views.properties.ComponentSettingsView)1