Search in sources :

Example 1 with IComponentSettingsView

use of org.talend.core.views.IComponentSettingsView in project tdi-studio-se by Talend.

the class AbstractMultiPageTalendEditor method turnToCodePage.

protected void turnToCodePage(int newPageIndex) {
    // TDI-25866:In case select a component and switch to the code page,need clean its componentSetting view
    IComponentSettingsView viewer = (IComponentSettingsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IComponentSettingsView.ID);
    if (viewer != null) {
        viewer.cleanDisplay();
    }
    if (codeEditor instanceof ISyntaxCheckableEditor) {
        moveCursorToSelectedComponent();
    /*
             * Belowing method had been called at line 331 within the generateCode method, as soon as code generated.
             */
    // ((ISyntaxCheckableEditor) codeEditor).validateSyntax();
    }
    codeSync();
    // updateCodeEditorContent();
    changeContextsViewStatus(true);
}
Also used : IComponentSettingsView(org.talend.core.views.IComponentSettingsView) ISyntaxCheckableEditor(org.talend.designer.core.ISyntaxCheckableEditor)

Example 2 with IComponentSettingsView

use of org.talend.core.views.IComponentSettingsView in project tdi-studio-se by Talend.

the class AbstractTalendEditor method setFocus.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.ui.parts.GraphicalEditor#setFocus()
     */
@Override
public void setFocus() {
    IComponentSettingsView viewer = (IComponentSettingsView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IComponentSettingsView.ID);
    if (viewer != null) {
        IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
        if (selection.size() == 1 && (selection.getFirstElement() instanceof NodePart || selection.getFirstElement() instanceof ConnectionPart || selection.getFirstElement() instanceof SubjobContainerPart || selection.getFirstElement() instanceof ConnLabelEditPart)) {
            viewer.setElement((Element) ((AbstractEditPart) selection.getFirstElement()).getModel());
        } else {
            viewer.cleanDisplay();
        }
    }
    JobSettings.switchToCurJobSettingsView();
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
        ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
        if (testContainerService != null) {
            testContainerService.switchToCurTestContainerView();
        }
    }
    super.setFocus();
    if (!readOnly) {
        // When gain focus, check read-only to disable read-only mode if process has been restore while opened :
        // 1. Enabled/disabled components :
        // process.checkReadOnly();
        // 2. Set backgroung color :
        List children = getViewer().getRootEditPart().getChildren();
        if (!children.isEmpty()) {
            ProcessPart rep = (ProcessPart) children.get(0);
            rep.ajustReadOnly();
        }
    }
}
Also used : IComponentSettingsView(org.talend.core.views.IComponentSettingsView) AbstractEditPart(org.eclipse.gef.editparts.AbstractEditPart) ArrayList(java.util.ArrayList) List(java.util.List) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ConnectionPart(org.talend.designer.core.ui.editor.connections.ConnectionPart) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart) SubjobContainerPart(org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart) ConnLabelEditPart(org.talend.designer.core.ui.editor.connections.ConnLabelEditPart) ITestContainerProviderService(org.talend.core.ui.ITestContainerProviderService)

Example 3 with IComponentSettingsView

use of org.talend.core.views.IComponentSettingsView in project tdi-studio-se by Talend.

the class CodeGeneratorService method refreshTemplates.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.codegen.ICodeGeneratorService#refreshTemplates()
     */
@Override
public Job refreshTemplates() {
    Element oldComponent = null;
    IComponentSettingsView viewer = null;
    if (!CommonUIPlugin.isFullyHeadless()) {
        // TDI-25866:In case select a component and sctrl+shift+f3,need clean its componentSetting view
        IWorkbenchWindow wwindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        if (wwindow != null && wwindow.getActivePage() != null) {
            viewer = (IComponentSettingsView) wwindow.getActivePage().findView(IComponentSettingsView.ID);
            if (viewer != null) {
                oldComponent = viewer.getElement();
                viewer.cleanDisplay();
            }
        }
    }
    ComponentCompilations.deleteMarkers();
    ComponentsFactoryProvider.getInstance().resetCache();
    ILibraryManagerService librairesManagerService = (ILibraryManagerService) GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
    librairesManagerService.clearCache();
    CorePlugin.getDefault().getLibrariesService().syncLibraries();
    Job job = CodeGeneratorEmittersPoolFactory.initialize();
    // achen modify to record ctrl+shift+f3 is pressed to fix bug 0006107
    IDesignerCoreService designerCoreService = (IDesignerCoreService) GlobalServiceRegister.getDefault().getService(IDesignerCoreService.class);
    designerCoreService.getLastGeneratedJobsDateMap().clear();
    if (oldComponent != null && viewer != null) {
        viewer.setElement(oldComponent);
    }
    if (!CommonUIPlugin.isFullyHeadless()) {
        CorePlugin.getDefault().getDesignerCoreService().synchronizeDesignerUI(new PropertyChangeEvent(this, IComponentConstants.NORMAL, null, null));
    }
    return job;
}
Also used : IComponentSettingsView(org.talend.core.views.IComponentSettingsView) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) PropertyChangeEvent(java.beans.PropertyChangeEvent) ILibraryManagerService(org.talend.core.ILibraryManagerService) Element(org.talend.core.model.process.Element) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) Job(org.eclipse.core.runtime.jobs.Job)

Aggregations

IComponentSettingsView (org.talend.core.views.IComponentSettingsView)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Job (org.eclipse.core.runtime.jobs.Job)1 AbstractEditPart (org.eclipse.gef.editparts.AbstractEditPart)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 ILibraryManagerService (org.talend.core.ILibraryManagerService)1 Element (org.talend.core.model.process.Element)1 ITestContainerProviderService (org.talend.core.ui.ITestContainerProviderService)1 IDesignerCoreService (org.talend.designer.core.IDesignerCoreService)1 ISyntaxCheckableEditor (org.talend.designer.core.ISyntaxCheckableEditor)1 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)1 ConnectionPart (org.talend.designer.core.ui.editor.connections.ConnectionPart)1 NodePart (org.talend.designer.core.ui.editor.nodes.NodePart)1 ProcessPart (org.talend.designer.core.ui.editor.process.ProcessPart)1 SubjobContainerPart (org.talend.designer.core.ui.editor.subjobcontainer.SubjobContainerPart)1