Search in sources :

Example 21 with IWizardPage

use of org.eclipse.jface.wizard.IWizardPage in project translationstudio8 by heartsome.

the class NewTmDbBaseInfoPage method getNextPage.

public IWizardPage getNextPage() {
    WizardPage nextPage = (WizardPage) super.getNextPage();
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            if (canCreateDb(monitor) != null) {
                throw new InterruptedException();
            }
        }
    };
    try {
        getContainer().run(true, true, runnable);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
        return null;
    } catch (InterruptedException e) {
        e.printStackTrace();
        return null;
    }
    nextPage.setErrorMessage(null);
    return nextPage;
}
Also used : IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IWizardPage(org.eclipse.jface.wizard.IWizardPage) WizardPage(org.eclipse.jface.wizard.WizardPage) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 22 with IWizardPage

use of org.eclipse.jface.wizard.IWizardPage in project cubrid-manager by CUBRID.

the class ImportDataWizardDialog method createContents.

/**
	 * Overwrite the method. Auto add IPageChangingListener(s);
	 * 
	 * @param parent of the control.
	 * @return Control
	 */
protected Control createContents(Composite parent) {
    Control result = super.createContents(parent);
    IWizardPage[] pages = this.getWizard().getPages();
    for (IWizardPage page : pages) {
        if (page instanceof IPageChangingListener) {
            this.addPageChangingListener((IPageChangingListener) page);
        }
        if (page instanceof IPageChangedListener) {
            this.addPageChangedListener((IPageChangedListener) page);
        }
    }
    return result;
}
Also used : IPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) Control(org.eclipse.swt.widgets.Control) IWizardPage(org.eclipse.jface.wizard.IWizardPage) IPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener)

Example 23 with IWizardPage

use of org.eclipse.jface.wizard.IWizardPage in project dbeaver by serge-rider.

the class MultiPageWizardDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    wizard.addPages();
    wizardSash = new SashForm(composite, SWT.HORIZONTAL);
    wizardSash.setLayoutData(new GridData(GridData.FILL_BOTH));
    pagesTree = new Tree(wizardSash, SWT.SINGLE);
    pagesTree.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite pageContainer = UIUtils.createPlaceholder(wizardSash, 2);
    // Vertical separator
    new Label(pageContainer, SWT.SEPARATOR | SWT.VERTICAL).setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));
    pageArea = UIUtils.createPlaceholder(pageContainer, 1);
    GridData gd = new GridData(GridData.FILL_BOTH);
    pageArea.setLayoutData(gd);
    pageArea.setLayout(new GridLayout(1, true));
    wizardSash.setWeights(new int[] { 300, 700 });
    Point maxSize = new Point(0, 0);
    IWizardPage[] pages = wizard.getPages();
    for (IWizardPage page : pages) {
        addPage(null, page, maxSize);
    }
    gd = (GridData) pageArea.getLayoutData();
    gd.widthHint = 500;
    gd.heightHint = 400;
    pagesTree.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            changePage();
        }
    });
    // Select first page
    pagesTree.select(pagesTree.getItem(0));
    changePage();
    // Set title and image from first page
    IDialogPage firstPage = (IDialogPage) pagesTree.getItem(0).getData();
    setTitle(firstPage.getTitle());
    setTitleImage(firstPage.getImage());
    setMessage(firstPage.getMessage());
    // Horizontal separator
    new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    // Progress monitor
    monitorPart = new ProgressMonitorPart(composite, null, true) {

        @Override
        public void setCanceled(boolean b) {
            super.setCanceled(b);
            if (b) {
                cancelCurrentOperation();
            }
        }
    };
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalIndent = 20;
    gd.verticalIndent = 0;
    monitorPart.setLayoutData(gd);
    monitorPart.setVisible(false);
    return composite;
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Point(org.eclipse.swt.graphics.Point) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ProgressMonitorPart(org.eclipse.jface.wizard.ProgressMonitorPart) IWizardPage(org.eclipse.jface.wizard.IWizardPage)

Example 24 with IWizardPage

use of org.eclipse.jface.wizard.IWizardPage in project cubrid-manager by CUBRID.

the class SelectBrokerPage method pageChanged.

/**
	 * @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
	 * @param event PageChangedEvent
	 */
/**
	 * @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
	 * @param event PageChangedEvent
	 */
public void pageChanged(PageChangedEvent event) {
    IWizardPage page = (IWizardPage) event.getSelectedPage();
    if (page.getName().equals(PAGENAME)) {
        AddHostAndDbWizard wizard = ((AddHostAndDbWizard) getWizard());
        SetHostInfoPage setHostInfoPage = (SetHostInfoPage) getWizard().getPage(SetHostInfoPage.PAGENAME);
        if (setHostInfoPage == null) {
            hostNode = wizard.getSelectedHostNode();
        } else {
            hostNode = setHostInfoPage.getHostNode();
        }
        serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(hostNode.getIp(), Integer.parseInt(hostNode.getPort()), hostNode.getUserName());
        BrokerInfos brokerInfos = serverInfo.getBrokerInfos();
        brokerInfoList = (brokerInfos == null || brokerInfos.getBorkerInfoList() == null) ? null : brokerInfos.getBorkerInfoList().getBrokerInfoList();
        BrokerInfo brokerInfo = null;
        brokerNameCombo.removeAll();
        for (int i = 0; brokerInfos != null && i < brokerInfoList.size(); i++) {
            if (i == 0) {
                brokerInfo = brokerInfoList.get(i);
            }
            brokerNameCombo.add(brokerInfoList.get(i).getName());
        }
        if (brokerNameCombo.getItemCount() > 0) {
            brokerNameCombo.select(0);
            brokerStatusText.setText(brokerInfo.getState());
            nickNameText.setText(brokerInfo.getName());
            addButton.setEnabled(true);
        } else {
            addButton.setEnabled(false);
        }
        brokerNameCombo.setFocus();
    }
}
Also used : BrokerInfos(com.cubrid.cubridmanager.core.broker.model.BrokerInfos) IWizardPage(org.eclipse.jface.wizard.IWizardPage) BrokerInfo(com.cubrid.cubridmanager.core.broker.model.BrokerInfo)

Example 25 with IWizardPage

use of org.eclipse.jface.wizard.IWizardPage in project cubrid-manager by CUBRID.

the class SelectDbPage method pageChanged.

/**
	 * @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
	 * @param event PageChangedEvent
	 */
/**
	 * @see org.eclipse.jface.dialogs.IPageChangedListener#pageChanged(org.eclipse.jface.dialogs.PageChangedEvent)
	 * @param event PageChangedEvent
	 */
public void pageChanged(PageChangedEvent event) {
    IWizardPage page = (IWizardPage) event.getSelectedPage();
    if (page.getName().equals(PAGENAME)) {
        AddHostAndDbWizard wizard = ((AddHostAndDbWizard) getWizard());
        SetHostInfoPage setHostInfoPage = (SetHostInfoPage) getWizard().getPage(SetHostInfoPage.PAGENAME);
        if (setHostInfoPage == null) {
            hostNode = wizard.getSelectedHostNode();
        } else {
            hostNode = setHostInfoPage.getHostNode();
        }
        serverInfo = CMHostNodePersistManager.getInstance().getServerInfo(hostNode.getIp(), Integer.parseInt(hostNode.getPort()), hostNode.getUserName());
        List<DatabaseInfo> dbInfoList = serverInfo.getLoginedUserInfo().getDatabaseInfoList();
        dbNameCombo.removeAll();
        for (int i = 0; i < dbInfoList.size(); i++) {
            dbNameCombo.add(dbInfoList.get(i).getDbName());
        }
        if (dbNameCombo.getItemCount() > 0) {
            dbNameCombo.select(0);
            nickNameText.setText(dbNameCombo.getText());
            addButton.setEnabled(true);
        } else {
            addButton.setEnabled(false);
        }
        changeHAModeBtnStatus();
        dbNameCombo.setFocus();
    }
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) IWizardPage(org.eclipse.jface.wizard.IWizardPage)

Aggregations

IWizardPage (org.eclipse.jface.wizard.IWizardPage)36 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Control (org.eclipse.swt.widgets.Control)4 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)3 DBClasses (com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 IPageChangedListener (org.eclipse.jface.dialogs.IPageChangedListener)3 IPageChangingListener (org.eclipse.jface.dialogs.IPageChangingListener)3 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)3 IOpenListener (org.eclipse.jface.viewers.IOpenListener)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 OpenEvent (org.eclipse.jface.viewers.OpenEvent)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 WizardPage (org.eclipse.jface.wizard.WizardPage)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2