Search in sources :

Example 6 with AbstractTalendEditor

use of org.talend.designer.core.ui.editor.AbstractTalendEditor in project tdi-studio-se by Talend.

the class DesignerColorsPreferencePage method switchToCurrentColor.

/**
     * zli Comment method "switchToCurrentColor".
     */
private void switchToCurrentColor() {
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow != null) {
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage != null) {
            for (IEditorReference ref : activePage.getEditorReferences()) {
                IEditorPart editor = ref.getEditor(true);
                if (editor instanceof AbstractMultiPageTalendEditor) {
                    AbstractMultiPageTalendEditor pageEditor = (AbstractMultiPageTalendEditor) editor;
                    AbstractTalendEditor talendEditor = pageEditor.getTalendEditor();
                    ProcessPart processPart = talendEditor.getProcessPart();
                    processPart.ajustReadOnly();
                    changeMRGroupColor(processPart);
                }
            }
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart)

Example 7 with AbstractTalendEditor

use of org.talend.designer.core.ui.editor.AbstractTalendEditor in project tdi-studio-se by Talend.

the class StatsAndLogsView method createStatsAndLogsView.

/**
     * ftang Comment method "createStatsAndLogsView".
     * 
     */
public void createStatsAndLogsView() {
    IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
    createFullPartControl(this.parent, (Process) talendEditor.getProcess());
}
Also used : AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IEditorPart(org.eclipse.ui.IEditorPart)

Example 8 with AbstractTalendEditor

use of org.talend.designer.core.ui.editor.AbstractTalendEditor in project tdi-studio-se by Talend.

the class StatsAndLogsView method getCurrentJob.

/**
     * Gets current opened job.
     */
private void getCurrentJob() {
    final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
    if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
        Process process = (Process) talendEditor.getProcess();
        if (process != null) {
            this.process = process;
            this.title = talendEditor.getTitle();
        }
    }
}
Also used : AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart)

Example 9 with AbstractTalendEditor

use of org.talend.designer.core.ui.editor.AbstractTalendEditor in project tdi-studio-se by Talend.

the class DynamicTabbedPropertySection method getCommandStack.

/**
     * Get the command stack of the Gef editor.
     * 
     * @return
     */
protected CommandStack getCommandStack() {
    AbstractTalendEditor talendEditor = part.getTalendEditor();
    Object adapter = talendEditor.getAdapter(CommandStack.class);
    return (CommandStack) adapter;
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 10 with AbstractTalendEditor

use of org.talend.designer.core.ui.editor.AbstractTalendEditor in project tdi-studio-se by Talend.

the class ComponentListController method updateComponentList.

protected static void updateComponentList(Collection<INode> nodeList, INode currentNode, IElementParameter param, boolean isSelectDefaultItem) {
    final Collection<String> componentDisplayNames = new ArrayList<String>();
    final Collection<String> componentUniqueNames = new ArrayList<String>();
    for (INode node : nodeList) {
        if (node.getJobletNode() != null) {
            node = node.getJobletNode();
        }
        final String uniqueName = node.getUniqueName();
        if (uniqueName.equals(currentNode.getUniqueName())) {
            continue;
        }
        //$NON-NLS-1$
        String displayName = (String) node.getElementParameter("LABEL").getValue();
        if (displayName == null) {
            displayName = uniqueName;
        }
        if (displayName.indexOf("__UNIQUE_NAME__") != -1) {
            //$NON-NLS-1$
            //$NON-NLS-1$
            displayName = displayName.replaceAll("__UNIQUE_NAME__", uniqueName);
        }
        if (!displayName.equals(uniqueName)) {
            //$NON-NLS-1$
            displayName = uniqueName + " - " + displayName;
        }
        componentUniqueNames.add(uniqueName);
        componentDisplayNames.add(displayName);
    }
    param.setListItemsDisplayName(componentDisplayNames.toArray(new String[0]));
    final String[] componentValueList = componentUniqueNames.toArray(new String[0]);
    param.setListItemsValue(componentValueList);
    Object value = param.getValue();
    if (!componentUniqueNames.contains(value) && isSelectDefaultItem) {
        String newValue = null;
        if (!param.isDynamicSettings()) {
            if (!componentUniqueNames.isEmpty()) {
                if (value == null || value.equals("")) {
                    //$NON-NLS-1$
                    currentNode.setPropertyValue(getParameterName(param), componentValueList[0]);
                    if (currentNode instanceof IGraphicalNode) {
                        IGraphicalNode node = (IGraphicalNode) currentNode;
                        node.checkAndRefreshNode();
                        ((IProcess2) node.getProcess()).setProcessModified(true);
                    } else if (currentNode instanceof IConnection) {
                        ((IProcess2) ((IConnection) currentNode).getSource().getProcess()).setProcessModified(true);
                    }
                } else {
                    newValue = componentValueList[0];
                }
            } else {
                // removed the old value.
                //$NON-NLS-1$
                newValue = "";
            }
        }
        if (!("".equals(newValue)) && newValue != null) {
            //$NON-NLS-1$
            IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
            if (part instanceof AbstractMultiPageTalendEditor) {
                AbstractTalendEditor te = ((AbstractMultiPageTalendEditor) part).getTalendEditor();
                CommandStack cmdStack = (CommandStack) te.getAdapter(CommandStack.class);
                cmdStack.execute(new PropertyChangeCommand(currentNode, getParameterName(param), ""));
            }
        }
    }
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) INode(org.talend.core.model.process.INode) IGraphicalNode(org.talend.core.ui.process.IGraphicalNode) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) ArrayList(java.util.ArrayList) IConnection(org.talend.core.model.process.IConnection) IEditorPart(org.eclipse.ui.IEditorPart) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) IProcess2(org.talend.core.model.process.IProcess2)

Aggregations

AbstractTalendEditor (org.talend.designer.core.ui.editor.AbstractTalendEditor)18 IEditorPart (org.eclipse.ui.IEditorPart)14 AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)12 ArrayList (java.util.ArrayList)4 List (java.util.List)4 IEditorReference (org.eclipse.ui.IEditorReference)4 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)3 IProcess (org.talend.core.model.process.IProcess)3 IProcess2 (org.talend.core.model.process.IProcess2)3 ConnLabelEditPart (org.talend.designer.core.ui.editor.connections.ConnLabelEditPart)3 HashMap (java.util.HashMap)2 EditPart (org.eclipse.gef.EditPart)2 CommandStack (org.eclipse.gef.commands.CommandStack)2 Clipboard (org.eclipse.gef.ui.actions.Clipboard)2 Text (org.eclipse.swt.widgets.Text)2 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)2 INode (org.talend.core.model.process.INode)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 AbstractProcessProvider (org.talend.designer.core.model.process.AbstractProcessProvider)2 PartFactory (org.talend.designer.core.ui.editor.PartFactory)2