Search in sources :

Example 11 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class RowGenMain method createRowGeneratorDialog.

/**
     * yzhang Comment method "createRowGeneratorDialog".
     * 
     * @param parentShell
     * @return
     */
public Dialog createRowGeneratorDialog(Shell parentShell) {
    RowGeneratorDialog dialog = new RowGeneratorDialog(parentShell, this);
    IComponent component = connector.getComponent();
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    String productName = brandingService.getFullProductName();
    Rectangle boundsRG = ExternalRowGeneratorUiProperties.getBoundsRowGen();
    if (ExternalRowGeneratorUiProperties.isShellMaximized()) {
        dialog.setMaximized(ExternalRowGeneratorUiProperties.isShellMaximized());
    } else {
        boundsRG = ExternalRowGeneratorUiProperties.getBoundsRowGen();
        if (boundsRG.x < 0) {
            boundsRG.x = 0;
        }
        if (boundsRG.y < 0) {
            boundsRG.y = 0;
        }
        dialog.setSize(boundsRG);
    }
    dialog.setIcon(CoreImageProvider.getComponentIcon(component, ICON_SIZE.ICON_32));
    //$NON-NLS-1$
    dialog.setTitle(Messages.getString("RowGenMain.ShellTitle", productName, connector.getUniqueName()));
    return dialog;
}
Also used : RowGeneratorDialog(org.talend.designer.rowgenerator.ui.dialogs.RowGeneratorDialog) IComponent(org.talend.core.model.components.IComponent) Rectangle(org.eclipse.swt.graphics.Rectangle) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 12 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class ItemRecord method getLabel.

public String getLabel() {
    if (label == null) {
        IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
        if (allowVerchange) {
            //$NON-NLS-1$
            label = property.getLabel() + " " + property.getVersion();
        } else {
            label = property.getLabel();
        }
    }
    return label;
}
Also used : IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 13 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class ItemRecord method getItemName.

public String getItemName() {
    if (itemName == null) {
        IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
        boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
        ERepositoryObjectType itemType = ERepositoryObjectType.getItemType(property.getItem());
        StringBuffer sb = new StringBuffer();
        if (itemType != null) {
            sb.append(itemType.toString());
            sb.append(' ');
        }
        sb.append(property.getLabel());
        if (allowVerchange) {
            sb.append(' ');
            sb.append(property.getVersion());
        }
        itemName = sb.toString();
    }
    return itemName;
}
Also used : IBrandingService(org.talend.core.ui.branding.IBrandingService) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 14 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class NodeBreakpointAction method canPerformAction.

/**
     * Test if the selected item is a node.
     * 
     * @return true / false
     */
private boolean canPerformAction() {
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (!brandingService.getBrandingConfiguration().isAllowDebugMode()) {
        return false;
    }
    if (getSelectedObjects().isEmpty()) {
        return false;
    }
    if (PluginUtil.isMediation()) {
        return false;
    }
    List parts = getSelectedObjects();
    if (parts.size() == 1) {
        Object o = parts.get(0);
        if (!(o instanceof NodePart)) {
            return false;
        }
        NodePart part = (NodePart) o;
        if (!(part.getModel() instanceof INode)) {
            return false;
        }
        node = (Node) part.getModel();
        if (node.getJobletNode() != null) {
            return false;
        }
        EditPart parentPart = part.getParent();
        while (!(parentPart instanceof ProcessPart)) {
            parentPart = parentPart.getParent();
        }
        if (!(parentPart instanceof ProcessPart)) {
            return false;
        }
        process = (IProcess) ((ProcessPart) parentPart).getModel();
        if (CorePlugin.getContext().getBreakpointNodes(process).contains(node)) {
            //$NON-NLS-1$
            setText(Messages.getString("NodeBreakpointAction.removeBreakpoint"));
        } else {
            //$NON-NLS-1$
            setText(Messages.getString("NodeBreakpointAction.addBreakPoint"));
        }
        return true;
    }
    return false;
}
Also used : INode(org.talend.core.model.process.INode) EditPart(org.eclipse.gef.EditPart) List(java.util.List) IBrandingService(org.talend.core.ui.branding.IBrandingService) ProcessPart(org.talend.designer.core.ui.editor.process.ProcessPart) NodePart(org.talend.designer.core.ui.editor.nodes.NodePart)

Example 15 with IBrandingService

use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.

the class ProcessView method createPartControl.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
     */
@Override
public void createPartControl(Composite parent) {
    this.parent = parent;
    parent.setLayout(new FillLayout());
    sash = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH);
    sash.setLayoutData(new GridData(GridData.FILL_BOTH));
    sash.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    GridLayout layout = new GridLayout();
    sash.setLayout(layout);
    Composite left = new Composite(sash, SWT.NONE);
    left.setLayout(new FillLayout());
    Composite right = new Composite(sash, SWT.NONE);
    right.setLayout(new FormLayout());
    FormData layouDatag = new FormData();
    layouDatag.left = new FormAttachment(0, 0);
    layouDatag.width = 32;
    layouDatag.top = new FormAttachment(0, 0);
    layouDatag.bottom = new FormAttachment(100, 0);
    final Composite buttonComposite = new Composite(right, SWT.ERROR);
    buttonComposite.setLayoutData(layouDatag);
    buttonComposite.setLayout(new GridLayout());
    Composite cotextCom = new Composite(right, SWT.NONE);
    layouDatag = new FormData();
    layouDatag.left = new FormAttachment(0, 32);
    layouDatag.right = new FormAttachment(100, 0);
    layouDatag.top = new FormAttachment(0, 0);
    layouDatag.bottom = new FormAttachment(100, 0);
    cotextCom.setLayoutData(layouDatag);
    cotextCom.setLayout(new GridLayout());
    tabFactory.initComposite(left, false);
    moveButton = new Button(buttonComposite, SWT.PUSH);
    //$NON-NLS-1$
    moveButton.setText(">>");
    moveButton.setToolTipText(Messages.getString("ProcessComposite.hideContext"));
    final GridData layoutData = new GridData();
    layoutData.verticalAlignment = GridData.CENTER;
    layoutData.horizontalAlignment = GridData.CENTER;
    layoutData.grabExcessHorizontalSpace = true;
    layoutData.grabExcessVerticalSpace = true;
    moveButton.setLayoutData(layoutData);
    addListeners();
    sash.setSashWidth(5);
    sash.setWeights(new int[] { 18, 5 });
    contextComposite = new ProcessContextComposite(cotextCom, SWT.NONE);
    contextComposite.setBackground(right.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    // processComposite = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL |
    // SWT.NO_FOCUS);
    // dc = processComposite;
    // createBasicComposite(tabFactory.getTabComposite(), element, null);
    tabFactory.getTabComposite().layout();
    tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {

        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
            if (descriptor == null) {
                return;
            }
            if (currentSelectedTab != null && (currentSelectedTab.getCategory() != descriptor.getCategory())) {
                for (Control curControl : tabFactory.getTabComposite().getChildren()) {
                    curControl.dispose();
                }
            }
            if (currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
                currentSelectedTab = descriptor;
                selectedPrimary = false;
                createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
            }
        }
    });
    setElement();
    IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
    IHandler handler1;
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (brandingService.getBrandingConfiguration().isAllowDebugMode()) {
        Action debugAction = new DebugAction();
        handler1 = new ActionHandler(debugAction);
        handlerService.activateHandler(debugAction.getActionDefinitionId(), handler1);
    }
    Action killAction = new KillAction();
    handler1 = new ActionHandler(killAction);
    handlerService.activateHandler(killAction.getActionDefinitionId(), handler1);
    FocusListener fl = new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            //$NON-NLS-1$
            log.trace(Messages.getString("ProcessView.gainFocusLog"));
            IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
            //$NON-NLS-1$
            ca = contextService.activateContext("talend.runProcess");
        }

        @Override
        public void focusLost(FocusEvent e) {
            //$NON-NLS-1$
            log.trace(Messages.getString("ProcessView.lostFocusLog"));
            if (ca != null) {
                IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
                contextService.deactivateContext(ca);
            }
        }
    };
    addListenerOnChildren(parent, fl);
    rubjobManager.setProcessShell(getSite().getShell());
    contextManagerListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (RunProcessContextManager.PROP_ACTIVE.equals(evt.getPropertyName())) {
                // rubjobManager.setBooleanTrace(false);
                runningProcessChanged();
            }
        }
    };
    RunProcessPlugin.getDefault().getRunProcessContextManager().addPropertyChangeListener(contextManagerListener);
    runAction = new RunAction();
}
Also used : Action(org.eclipse.jface.action.Action) ClearPerformanceAction(org.talend.designer.runprocess.ui.actions.ClearPerformanceAction) PropertyChangeListener(java.beans.PropertyChangeListener) Element(org.talend.core.model.process.Element) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) ProcessContextComposite(org.talend.designer.runprocess.ui.ProcessContextComposite) Control(org.eclipse.swt.widgets.Control) Button(org.eclipse.swt.widgets.Button) IContextService(org.eclipse.ui.contexts.IContextService) FormAttachment(org.eclipse.swt.layout.FormAttachment) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) PropertyChangeEvent(java.beans.PropertyChangeEvent) TraceDebugProcessComposite(org.talend.designer.runprocess.ui.TraceDebugProcessComposite) Composite(org.eclipse.swt.widgets.Composite) TargetExecComposite(org.talend.designer.runprocess.ui.TargetExecComposite) MemoryRuntimeComposite(org.talend.designer.runprocess.ui.MemoryRuntimeComposite) AdvanceSettingComposite(org.talend.designer.runprocess.ui.AdvanceSettingComposite) MultipleThreadDynamicComposite(org.talend.designer.core.ui.views.properties.MultipleThreadDynamicComposite) ProcessComposite(org.talend.designer.runprocess.ui.ProcessComposite) ProcessContextComposite(org.talend.designer.runprocess.ui.ProcessContextComposite) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) FillLayout(org.eclipse.swt.layout.FillLayout) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor) IBrandingService(org.talend.core.ui.branding.IBrandingService) SashForm(org.eclipse.swt.custom.SashForm) IHandlerService(org.eclipse.ui.handlers.IHandlerService) GridData(org.eclipse.swt.layout.GridData) IHandler(org.eclipse.core.commands.IHandler) ActionHandler(org.eclipse.ui.commands.ActionHandler) FocusListener(org.eclipse.swt.events.FocusListener)

Aggregations

IBrandingService (org.talend.core.ui.branding.IBrandingService)49 GridData (org.eclipse.swt.layout.GridData)11 GridLayout (org.eclipse.swt.layout.GridLayout)10 Composite (org.eclipse.swt.widgets.Composite)9 File (java.io.File)8 Button (org.eclipse.swt.widgets.Button)7 Shell (org.eclipse.swt.widgets.Shell)7 Path (org.eclipse.core.runtime.Path)6 URL (java.net.URL)5 Point (org.eclipse.swt.graphics.Point)5 Rectangle (org.eclipse.swt.graphics.Rectangle)5 Bundle (org.osgi.framework.Bundle)5 Project (org.talend.core.model.general.Project)5 CoreException (org.eclipse.core.runtime.CoreException)4 Text (org.eclipse.swt.widgets.Text)4 BusinessException (org.talend.commons.exception.BusinessException)4 IComponent (org.talend.core.model.components.IComponent)4 ConnectionBean (org.talend.core.model.general.ConnectionBean)4 IOException (java.io.IOException)3 ResourceBundle (java.util.ResourceBundle)3