Search in sources :

Example 6 with ComponentSettingsView

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);
}
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)

Example 7 with ComponentSettingsView

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());
                }
            }
        }
    }
}
Also used : Control(org.eclipse.swt.widgets.Control) GraphicalViewer(org.eclipse.gef.GraphicalViewer) DummyComponent(org.talend.designer.core.model.components.DummyComponent) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart) ComponentSettingsView(org.talend.designer.core.ui.views.properties.ComponentSettingsView) TalendSelectionManager(org.talend.designer.core.ui.editor.TalendSelectionManager)

Example 8 with ComponentSettingsView

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);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ColumnNameChanged(org.talend.core.model.metadata.ColumnNameChanged) ArrayList(java.util.ArrayList) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) ComponentSettingsView(org.talend.designer.core.ui.views.properties.ComponentSettingsView)

Aggregations

ComponentSettingsView (org.talend.designer.core.ui.views.properties.ComponentSettingsView)8 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)6 ArrayList (java.util.ArrayList)2 EditPart (org.eclipse.gef.EditPart)2 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)2 IViewPart (org.eclipse.ui.IViewPart)2 Process (org.talend.designer.core.ui.editor.process.Process)2 Iterator (java.util.Iterator)1 List (java.util.List)1 Disposable (org.eclipse.gef.Disposable)1 GraphicalViewer (org.eclipse.gef.GraphicalViewer)1 AbstractConnectionEditPart (org.eclipse.gef.editparts.AbstractConnectionEditPart)1 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)1 IAction (org.eclipse.jface.action.IAction)1 Control (org.eclipse.swt.widgets.Control)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbench (org.eclipse.ui.IWorkbench)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1