Search in sources :

Example 6 with IBrandingService

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

the class MapperUI method createWindow.

/**
     * DOC amaumont Comment method "createUI".
     * 
     * @param display
     */
public Shell createWindow(final Display display, MapperModel model) {
    Shell activeShell = display.getActiveShell();
    Shell mapperShell = null;
    int style = SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL | SWT.RESIZE;
    if (activeShell == null) {
        mapperShell = new Shell(mapperShell, style);
    } else {
        mapperShell = new Shell(activeShell, style);
    }
    this.mapperUIParent = mapperShell;
    final Shell mapperShellFinal = mapperShell;
    mapperShell.addShellListener(new ShellListener() {

        public void shellActivated(ShellEvent e) {
        }

        public void shellClosed(ShellEvent e) {
            UIManager uiManager = mapperManager.getUiManager();
            if (uiManager.getMapperResponse() == SWT.NONE) {
                for (DataMapTableView dataMapTableView : uiManager.getInputsTablesView()) {
                    dataMapTableView.notifyFocusLost();
                }
                for (DataMapTableView dataMapTableView : uiManager.getOutputsTablesView()) {
                    dataMapTableView.notifyFocusLost();
                }
                for (DataMapTableView dataMapTableView : uiManager.getVarsTablesView()) {
                    dataMapTableView.notifyFocusLost();
                }
                uiManager.setMapperResponse(SWT.CANCEL);
                uiManager.prepareClosing(uiManager.getMapperResponse());
            }
            if (!mapperManager.componentIsReadOnly() && mapperManager.isDataChanged() && !mapperManager.getUiManager().isCloseWithoutPrompt()) {
                boolean closeWindow = MessageDialog.openConfirm(mapperShellFinal, //$NON-NLS-1$
                Messages.getString("MapperUI.CancelWithoutSaveModifications.Title"), //$NON-NLS-1$
                Messages.getString("MapperUI.CancelWithoutSaveModifications.Message"));
                if (!closeWindow) {
                    e.doit = false;
                } else {
                    mapperManager.getAbstractMapComponent().setExternalData(mapperManager.getOriginalExternalData());
                    mapperManager.getUiManager().prepareClosing(SWT.CANCEL);
                }
            }
        }

        public void shellDeactivated(ShellEvent e) {
        }

        public void shellDeiconified(ShellEvent e) {
        }

        public void shellIconified(ShellEvent e) {
        }
    });
    MapperComponent component = (MapperComponent) mapperManager.getAbstractMapComponent();
    ExternalMapperUiProperties uiProperties = mapperManager.getUiManager().getUiProperties();
    mapperShell.setImage(CoreImageProvider.getComponentIcon(component.getComponent(), ICON_SIZE.ICON_32));
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    String productName = brandingService.getFullProductName();
    mapperShell.setText(Messages.getString("MapperMain.ShellTitle", productName, component.getComponent().getName(), //$NON-NLS-1$
    component.getUniqueName()));
    Rectangle boundsMapper = uiProperties.getBoundsMapper();
    if (uiProperties.isShellMaximized()) {
        mapperShell.setMaximized(uiProperties.isShellMaximized());
    } else {
        if (uiProperties.getBoundsMapper().equals(ExternalMapperUiProperties.DEFAULT_BOUNDS_MAPPER)) {
            mapperShell.setMaximized(true);
        // boundsMapper = display.getBounds(); //no need this, will cause the full problems.
        } else {
            // // move shell at outer of display zone to avoid visual effect on loading
            // Rectangle tmpBoundsMapper = new Rectangle(-boundsMapper.width, boundsMapper.y, boundsMapper.width,
            // boundsMapper.height);
            // shell.setBounds(tmpBoundsMapper);
            boundsMapper = uiProperties.getBoundsMapper();
            if (boundsMapper.x < 0) {
                boundsMapper.x = 0;
            }
            if (boundsMapper.y < 0) {
                boundsMapper.y = 0;
            }
            mapperShell.setBounds(boundsMapper);
        }
    }
    createCompositeContent(model);
    mapperShell.open();
    return mapperShell;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ExternalMapperUiProperties(org.talend.designer.mapper.external.data.ExternalMapperUiProperties) ShellListener(org.eclipse.swt.events.ShellListener) Rectangle(org.eclipse.swt.graphics.Rectangle) ShellEvent(org.eclipse.swt.events.ShellEvent) UIManager(org.talend.designer.mapper.managers.UIManager) OutputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.OutputDataMapTableView) InputDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.InputDataMapTableView) VarsDataMapTableView(org.talend.designer.mapper.ui.visualmap.table.VarsDataMapTableView) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) IBrandingService(org.talend.core.ui.branding.IBrandingService) MapperComponent(org.talend.designer.mapper.MapperComponent)

Example 7 with IBrandingService

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

the class RunProcessPreferencePage method createFieldEditors.

/**
     * DOC chuang Comment method "addConsoleFont".
     */
// private void addConsoleFont() {
// Group group = new Group(parent, SWT.NONE);
// group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// group.setLayout(new GridLayout(1, false));
//        group.setText(Messages.getString("RunProcessPreferencePage.outputConsole")); //$NON-NLS-1$
//
// Composite composite = new Composite(group, SWT.NONE);
// composite.setLayout(new GridLayout(3, false));
// GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
// gridData.grabExcessHorizontalSpace = true;
// gridData.horizontalSpan = 3;
// composite.setLayoutData(gridData);
// consoleFontField = new FontFieldEditor(RunProcessPrefsConstants.CONSOLE_FONT, Messages
//                .getString("RunProcessPreferencePage.consoleFont"), composite); //$NON-NLS-1$
//
// }
/**
     * Create all field editors for this page.
     */
@Override
public void createFieldEditors() {
    parent = new Composite(getFieldEditorParent(), SWT.NONE);
    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.marginBottom = 0;
    gridLayout.marginWidth = 0;
    gridLayout.marginTop = 0;
    gridLayout.marginRight = 0;
    gridLayout.marginLeft = 0;
    gridLayout.marginHeight = 0;
    parent.setLayout(gridLayout);
    GridData gridData = new GridData(GridData.FILL_BOTH);
    parent.setLayoutData(gridData);
    clientGroup = new Group(parent, SWT.NONE);
    //$NON-NLS-1$
    clientGroup.setText(Messages.getString("prefs.clientConfiguration"));
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    clientGroup.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    clientGroup.setLayoutData(gd);
    // /////////////////////////////////////////////////////////////////////////////
    // CLIENT_STATS_PORTS
    Composite compositeStatsPorts = new Composite(clientGroup, SWT.NONE);
    compositeStatsPorts.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridLayout = new GridLayout(2, true);
    compositeStatsPorts.setLayout(gridLayout);
    Composite compositeStatsPort1 = new Composite(compositeStatsPorts, SWT.NONE);
    compositeStatsPort1.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridLayout = new GridLayout(2, true);
    compositeStatsPort1.setLayout(gridLayout);
    fClientStatPortEditor = new IntegerFieldEditor(RunProcessPrefsConstants.CLIENT_STATS_PORT_BOUND1, Messages.getString("prefs.clientStatsPortBound1"), //$NON-NLS-1$
    compositeStatsPort1);
    addField(fClientStatPortEditor);
    fClientStatPortEditor.setValidRange(1024, 65535);
    //$NON-NLS-1$
    fClientStatPortEditor.setErrorMessage(Messages.getString("runProcessRemote.clientStatInvalidRange"));
    Composite compositeStatsPort2 = new Composite(compositeStatsPorts, SWT.NONE);
    compositeStatsPort2.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridLayout = new GridLayout(2, true);
    compositeStatsPort2.setLayout(gridLayout);
    fClientStatPortEditor = new IntegerFieldEditor(RunProcessPrefsConstants.CLIENT_STATS_PORT_BOUND2, Messages.getString("prefs.clientStatsPortBound2"), //$NON-NLS-1$
    compositeStatsPort2);
    addField(fClientStatPortEditor);
    fClientStatPortEditor.setValidRange(1024, 65535);
    //$NON-NLS-1$
    fClientStatPortEditor.setErrorMessage(Messages.getString("prefs.clientStatInvalidRange"));
    // /////////////////////////////////////////////////////////////////////////////
    // /////////////////////////////////////////////////////////////////////////////
    // CLIENT_TRACE_PORTS
    Composite compositeTracePorts = new Composite(clientGroup, SWT.NONE);
    compositeTracePorts.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridLayout = new GridLayout(2, true);
    compositeTracePorts.setLayout(gridLayout);
    Composite compositeTracePorts1 = new Composite(compositeTracePorts, SWT.NONE);
    compositeTracePorts1.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridLayout = new GridLayout(2, true);
    compositeTracePorts1.setLayout(gridLayout);
    fClientStatPortEditor = new IntegerFieldEditor(RunProcessPrefsConstants.CLIENT_TRACE_PORT_BOUND1, Messages.getString("prefs.clientTracePortBound1"), //$NON-NLS-1$
    compositeTracePorts1);
    addField(fClientStatPortEditor);
    fClientStatPortEditor.setValidRange(1024, 65535);
    //$NON-NLS-1$
    fClientStatPortEditor.setErrorMessage(Messages.getString("prefs.clientStatInvalidRange"));
    Composite compositeTracePort2 = new Composite(compositeTracePorts, SWT.NONE);
    compositeTracePort2.setLayoutData(new GridData(GridData.FILL_BOTH));
    gridLayout = new GridLayout(2, true);
    compositeTracePort2.setLayout(gridLayout);
    fClientStatPortEditor = new IntegerFieldEditor(RunProcessPrefsConstants.CLIENT_TRACE_PORT_BOUND2, Messages.getString("prefs.clientTracePortBound2"), //$NON-NLS-1$
    compositeTracePort2);
    addField(fClientStatPortEditor);
    fClientStatPortEditor.setValidRange(1024, 65535);
    //$NON-NLS-1$
    fClientStatPortEditor.setErrorMessage(Messages.getString("prefs.clientStatInvalidRange"));
    // /////////////////////////////////////////////////////////////////////////////
    Composite compositeStateTraceRun = new Composite(clientGroup, SWT.NONE);
    compositeStateTraceRun.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutStateTraceRun = new GridLayout(3, true);
    compositeStateTraceRun.setLayout(gridLayoutStateTraceRun);
    Composite compositeSaveBeforeRun = new Composite(compositeStateTraceRun, SWT.NONE);
    compositeSaveBeforeRun.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutSaveBeforeRun = new GridLayout(1, true);
    compositeSaveBeforeRun.setLayout(gridLayoutSaveBeforeRun);
    onSavebeforeField = new BooleanFieldEditor(RunProcessPrefsConstants.ISSAVEBEFORERUN, //$NON-NLS-1$
    Messages.getString("RunProcessPreferencePage.save"), //$NON-NLS-1$
    SWT.NONE, compositeSaveBeforeRun);
    addField(onSavebeforeField);
    Composite compositeClearBeforeRun = new Composite(compositeStateTraceRun, SWT.NONE);
    compositeClearBeforeRun.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutClearBeforeRun = new GridLayout(1, true);
    compositeClearBeforeRun.setLayout(gridLayoutClearBeforeRun);
    onClearbeforeField = new BooleanFieldEditor(RunProcessPrefsConstants.ISCLEARBEFORERUN, //$NON-NLS-1$
    Messages.getString("RunProcessPreferencePage.clear"), //$NON-NLS-1$
    SWT.NONE, compositeClearBeforeRun);
    addField(onClearbeforeField);
    Composite compositeExecTimeRun = new Composite(compositeStateTraceRun, SWT.NONE);
    compositeExecTimeRun.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutExecTimeRun = new GridLayout(1, true);
    compositeExecTimeRun.setLayout(gridLayoutExecTimeRun);
    onExecTimeField = new BooleanFieldEditor(RunProcessPrefsConstants.ISEXECTIMERUN, //$NON-NLS-1$
    Messages.getString("RunProcessPreferencePage.execTime"), //$NON-NLS-1$
    SWT.NONE, compositeExecTimeRun);
    addField(onExecTimeField);
    Composite compositeStatisticsRun = new Composite(compositeStateTraceRun, SWT.NONE);
    compositeStatisticsRun.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutStatisticsRun = new GridLayout(1, true);
    compositeStatisticsRun.setLayout(gridLayoutStatisticsRun);
    onStatisticsField = new BooleanFieldEditor(RunProcessPrefsConstants.ISSTATISTICSRUN, //$NON-NLS-1$
    Messages.getString("RunProcessPreferencePage.statistics"), //$NON-NLS-1$
    SWT.NONE, compositeStatisticsRun);
    addField(onStatisticsField);
    Composite compositeTracesRun = new Composite(compositeStateTraceRun, SWT.NONE);
    compositeTracesRun.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutTracesRun = new GridLayout(1, false);
    compositeTracesRun.setLayout(gridLayoutTracesRun);
    onTracesField = new BooleanFieldEditor(RunProcessPrefsConstants.ISTRACESRUN, Messages.getString("RunProcessPreferencePage.traces"), SWT.NONE, //$NON-NLS-1$
    compositeTracesRun);
    addField(onTracesField);
    Composite compositeTracesTime = new Composite(compositeStateTraceRun, SWT.NONE);
    compositeTracesTime.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutTracesTime = new GridLayout(1, false);
    compositeTracesTime.setLayout(gridLayoutTracesTime);
    tracesTime = new IntegerFieldEditor(RunProcessPrefsConstants.STRACESTIME, Messages.getString("RunProcessPreferencePage.pauseTime"), //$NON-NLS-1$
    compositeTracesTime);
    addField(tracesTime);
    // 0004895: Font size of the output console are very small
    // addConsoleFont();
    Composite argumentsComposite = new Composite(parent, SWT.NONE);
    argumentsComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout gridLayoutArguments = new GridLayout(1, false);
    argumentsComposite.setLayout(gridLayoutArguments);
    String text = "RunProcessPreferencePage.vmArgument";
    IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (breaningService.isPoweredOnlyCamel()) {
        text = "RunProcessPreferencePage.RouteVmArgument";
    }
    VMArgumentsViewer argumentsViewer = new //$NON-NLS-1$
    VMArgumentsViewer(//$NON-NLS-1$
    RunProcessPrefsConstants.VMARGUMENTS, //$NON-NLS-1$
    Messages.getString(text), argumentsComposite);
    addField(argumentsViewer);
    manager = ProcessManager.getInstance();
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) IntegerFieldEditor(org.eclipse.jface.preference.IntegerFieldEditor) BooleanFieldEditor(org.eclipse.jface.preference.BooleanFieldEditor) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 8 with IBrandingService

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

the class LoginDialogV2 method getFirstTimeStartupPageIfNeeded.

protected AbstractLoginActionPage getFirstTimeStartupPageIfNeeded() {
    AbstractLoginActionPage loginPage = null;
    IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    if (service != null) {
        IBrandingConfiguration brandingConfiguration = service.getBrandingConfiguration();
        if (brandingConfiguration != null && brandingConfiguration.isOnlyRemoteConnection()) {
            return null;
        }
    }
    // try to find if there are projects in workspace
    Project[] projects = LoginHelper.getInstance().getProjects(LoginHelper.createDefaultLocalConnection());
    if (projects == null || projects.length == 0) {
        List<ConnectionBean> storedConnections = LoginHelper.getInstance().getStoredConnections();
        if (storedConnections == null || storedConnections.isEmpty() || (storedConnections.size() == 1 && !LoginHelper.isRemoteConnection(storedConnections.get(0)) && LoginHelper.isWorkspaceSame(storedConnections.get(0)))) {
            // for local license case
            loginPage = new LoginFirstTimeStartupActionPage(base, this, SWT.NONE);
        }
    }
    return loginPage;
}
Also used : Project(org.talend.core.model.general.Project) IBrandingConfiguration(org.talend.core.ui.branding.IBrandingConfiguration) ConnectionBean(org.talend.core.model.general.ConnectionBean) IBrandingService(org.talend.core.ui.branding.IBrandingService)

Example 9 with IBrandingService

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

the class MapperUI method createWindow.

public Shell createWindow(final Display display) {
    Shell activeShell = display.getActiveShell();
    int style = SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL | SWT.RESIZE;
    if (activeShell == null) {
        mapperShell = new Shell(mapperShell, style);
    } else {
        mapperShell = new Shell(activeShell, style);
    }
    mapperShell.addShellListener(new ShellListener() {

        @Override
        public void shellActivated(ShellEvent e) {
        }

        @Override
        public void shellClosed(ShellEvent e) {
            if (editor != null && editor.isDirty() && !closeWithoutPrompt) {
                boolean closeWindow = MessageDialog.openConfirm(mapperShell, "Close without save", Messages.getString("MapperUI.CloseWindow.Message"));
                if (!closeWindow) {
                    e.doit = false;
                } else {
                    prepareClosing(SWT.CANCEL);
                }
            }
        }

        @Override
        public void shellDeactivated(ShellEvent e) {
        }

        @Override
        public void shellDeiconified(ShellEvent e) {
        }

        @Override
        public void shellIconified(ShellEvent e) {
        }
    });
    mapperShell.setMaximized(true);
    mapperShell.setImage(CoreImageProvider.getComponentIcon(mapperComponent.getComponent(), ICON_SIZE.ICON_32));
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    String productName = brandingService.getFullProductName();
    mapperShell.setText(productName + " - " + mapperComponent.getComponent().getName() + " - " + //$NON-NLS-1$
    mapperComponent.getUniqueName());
    GridLayout parentLayout = new GridLayout(1, true);
    mapperShell.setLayout(parentLayout);
    // Composite composite = new Composite(mapperShell, SWT.NONE);
    // composite.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
    mainSashForm = new SashForm(mapperShell, SWT.SMOOTH | SWT.VERTICAL);
    GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
    mainSashForm.setLayoutData(mainSashFormGridData);
    datasViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
    editor = new XmlMapEditor(mapperManager);
    editor.createPartControl(datasViewSashForm);
    if (copyOfMapData.getVarTables().isEmpty()) {
        VarTable varTable1 = XmlmapFactory.eINSTANCE.createVarTable();
        varTable1.setName("Var");
        varTable1.setMinimized(true);
        copyOfMapData.getVarTables().add(varTable1);
    }
    editor.setContent(copyOfMapData);
    tabFolderEditors = new TabFolderEditors(mainSashForm, mapperManager, SWT.BORDER);
    // selectFirstInOutTree();
    mainSashForm.setWeights(new int[] { 70, 30 });
    footerComposite = new FooterComposite(mapperShell, this);
    footerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    mapperShell.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            ColorProviderMapper.releaseColors();
            FontProviderMapper.releaseFonts();
            ImageProviderMapper.releaseImages();
        }
    });
    editor.makeDefaultSelection();
    mapperShell.open();
    return mapperShell;
}
Also used : TabFolderEditors(org.talend.designer.xmlmap.ui.tabs.TabFolderEditors) DisposeListener(org.eclipse.swt.events.DisposeListener) FooterComposite(org.talend.designer.xmlmap.ui.footer.FooterComposite) ShellEvent(org.eclipse.swt.events.ShellEvent) IBrandingService(org.talend.core.ui.branding.IBrandingService) DisposeEvent(org.eclipse.swt.events.DisposeEvent) XmlMapEditor(org.talend.designer.xmlmap.editor.XmlMapEditor) VarTable(org.talend.designer.xmlmap.model.emf.xmlmap.VarTable) SashForm(org.eclipse.swt.custom.SashForm) Shell(org.eclipse.swt.widgets.Shell) GridLayout(org.eclipse.swt.layout.GridLayout) ShellListener(org.eclipse.swt.events.ShellListener) GridData(org.eclipse.swt.layout.GridData)

Example 10 with IBrandingService

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

the class VersionManagementPage method addItemsOption.

protected void addItemsOption(Composite parent) {
    Group option = new Group(parent, SWT.NONE);
    option.setLayout(new GridLayout());
    //$NON-NLS-1$
    option.setText(Messages.getString("VersionManagementDialog.Options"));
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).applyTo(option);
    fixedVersionButton = new Button(option, SWT.RADIO);
    //$NON-NLS-1$
    fixedVersionButton.setText(Messages.getString("VersionManagementDialog.FixedVersion"));
    // default
    fixedVersionButton.setSelection(true);
    IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
    Composite versionComposit = new Composite(option, SWT.NONE);
    GridLayout layout = new GridLayout(8, false);
    layout.horizontalSpacing = 1;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    versionComposit.setLayout(layout);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(versionComposit);
    fixedVersionText = new Text(versionComposit, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData();
    data.widthHint = 50;
    data.minimumWidth = 50;
    fixedVersionText.setLayoutData(data);
    fixedVersionText.setEnabled(false);
    fixedVersionText.setText(VersionUtils.DEFAULT_VERSION);
    majorBtn = new Button(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    majorBtn.setText("M");
    //$NON-NLS-1$
    majorBtn.setToolTipText(Messages.getString("VersionManagementDialog.MajorVersionTip"));
    majorBtn.setEnabled(allowVerchange);
    minorBtn = new Button(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    minorBtn.setText("m");
    //$NON-NLS-1$
    minorBtn.setToolTipText(Messages.getString("VersionManagementDialog.MinorVersionTip"));
    minorBtn.setEnabled(allowVerchange);
    Label label = new Label(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    label.setText("");
    data = new GridData();
    data.minimumWidth = 20;
    data.widthHint = 20;
    label.setLayoutData(data);
    label.setVisible(false);
    revertBtn = new Button(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    revertBtn.setText(Messages.getString("VersionManagementDialog.Revert"));
    //$NON-NLS-1$
    revertBtn.setToolTipText(Messages.getString("VersionManagementDialog.RevertTip"));
    Label bLabel = new Label(versionComposit, SWT.NONE);
    //$NON-NLS-1$
    bLabel.setText("");
    data = new GridData();
    data.minimumWidth = 20;
    data.widthHint = 20;
    bLabel.setLayoutData(data);
    bLabel.setVisible(false);
    alldependcies = new Button(versionComposit, SWT.NONE);
    alldependcies.setText(Messages.getString("VersionManagementDialog.allDependencies"));
    alldependcies.setEnabled(false);
    subjobs = new Button(versionComposit, SWT.NONE);
    subjobs.setText(Messages.getString("VersionManagementDialog.subjob"));
    subjobs.setEnabled(false);
    eachVersionButton = new Button(option, SWT.RADIO);
    //$NON-NLS-1$
    eachVersionButton.setText(Messages.getString("VersionManagementDialog.EachVersion"));
    eachVersionButton.setEnabled(allowVerchange);
    versionLatest = new Button(option, SWT.CHECK);
    versionLatest.setText(Messages.getString("VersionManagementDialog.FixVersion"));
    versionLatest.setToolTipText(Messages.getString("VersionManagementDialog.FixLastVersion"));
    // event
    fixedVersionButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkFixedButtons();
            researchMaxVersion();
            refreshTableItems();
        }
    });
    alldependcies.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectAllDependencies();
        }
    });
    subjobs.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            selectSubjob();
        }
    });
    versionLatest.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            versionLatest();
        }
    });
    majorBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String version = fixedVersionText.getText();
            version = VersionUtils.upMajor(version);
            fixedVersionText.setText(version);
            refreshTableItems();
        }
    });
    minorBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String version = fixedVersionText.getText();
            version = VersionUtils.upMinor(version);
            fixedVersionText.setText(version);
            refreshTableItems();
        }
    });
    revertBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            // set min version
            fixedVersionText.setText(VersionUtils.DEFAULT_VERSION);
            researchMaxVersion();
            refreshTableItems();
        }
    });
    eachVersionButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            checkFixedButtons();
            refreshTableItems();
        }
    });
    checkFixedButtons();
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) IBrandingService(org.talend.core.ui.branding.IBrandingService)

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