Example usage for org.eclipse.jface.dialogs IMessageProvider ERROR

List of usage examples for org.eclipse.jface.dialogs IMessageProvider ERROR

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider ERROR.

Prototype

int ERROR

To view the source code for org.eclipse.jface.dialogs IMessageProvider ERROR.

Click Source Link

Document

Constant for an error message (value 3).

Usage

From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java

License:Open Source License

/**
 * Display the given error message. The currently displayed message is saved
 * and will be redisplayed when the error message is set to
 * <code>null</code>.//from  w ww  . j av  a 2  s . c  o  m
 * 
 * @param newErrorMessage
 *            the errorMessage to display or <code>null</code>
 */
public void setErrorMessage(String newErrorMessage) {
    if (newErrorMessage == null)
        messageArea.clearErrorMessage();
    else
        messageArea.updateText(newErrorMessage, IMessageProvider.ERROR);
}

From source file:net.refractions.udig.style.sld.editor.internal.EditorDialog.java

License:Open Source License

public void updateMessage() {
    String message = null;//from www . ja  va2s  .  c  o m
    String errorMessage = null;
    if (currentPage != null) {
        message = currentPage.getMessage();
        errorMessage = currentPage.getErrorMessage();
    }
    int messageType = IMessageProvider.NONE;
    if (message != null && currentPage instanceof IMessageProvider)
        messageType = ((IMessageProvider) currentPage).getMessageType();

    if (errorMessage == null) {
        if (showingError) {
            // we were previously showing an error
            showingError = false;
        }
    } else {
        message = errorMessage;
        messageType = IMessageProvider.ERROR;
        if (!showingError) {
            // we were not previously showing an error
            showingError = true;
        }
    }
    messageArea.updateText(message, messageType);
}

From source file:net.rim.ejde.internal.ui.editors.model.BlackBerryProjectPropertiesPage.java

License:Open Source License

/**
 * Creates an error marker in the editor with the given key
 *
 * @param key/*from  w  ww .  java 2 s.  c om*/
 * @param message
 * @param control
 */
public void createEditorErrorMarker(Object key, String message, Control control) {
    getManagedForm().getMessageManager().addMessage(key, message, null, IMessageProvider.ERROR, control);

}

From source file:net.rim.ejde.internal.ui.wizards.imports.BasicGenericSelectionPage.java

License:Open Source License

@Override
public boolean isPageComplete() {
    if (VMUtils.getDefaultBBVM() == null) {
        setMessage(//from w  ww  .  j a  v  a 2 s .  c o  m
                net.rim.ejde.internal.util.Messages.NewBlackBerryProjectWizardPageOne_Message_noBBJREInstalled,
                IMessageProvider.ERROR);
        return false;
    }
    if (!isBBVMSelected(_jreSelectionUI)) {
        setMessage(net.rim.ejde.internal.util.Messages.NewBlackBerryProjectWizardPageOne_Message_noJRESelected,
                IMessageProvider.ERROR);
        return false;
    }
    IPath currentWorkspace = _projectSelectionTableGroup.getCurrentWorkspace();
    if (currentWorkspace == null || currentWorkspace.isEmpty()) {
        setMessage(Messages.GenericSelectionPage_NO_WORKSPACE_SELECTED_MSG, IMessageProvider.INFORMATION);
        return false;
    }
    if (!_projectSelectionTableGroup.isValidWorkspaceFile()) {
        setMessage(NLS.bind(Messages.GenericSelectionPage_FILE_NOT_EXIST_MSG, currentWorkspace.toOSString()),
                IMessageProvider.INFORMATION);
        return false;
    }
    if (_projectSelectionTableGroup.getAllProjectNumber() == 0) {
        setMessage(Messages.GenericSelectionPage_NO_WORKSPACE_LOADED_MSG, IMessageProvider.INFORMATION);
        return false;
    }
    if ((_projectSelectionTableGroup.getSelectedProjectsNumber()
            - _projectSelectionTableGroup.getExistingProjectsNumber()) == 0) {
        setMessage(Messages.GenericSelectionPage_NO_PROJECT_SELECTED_ERROR_MSG, IMessageProvider.INFORMATION);
        return false;
    }
    String message = _projectSelectionTableGroup.hasDependencyProblem();
    if (!StringUtils.isBlank(message)) {
        setMessage(message, IMessageProvider.WARNING);
        return true;
    }
    if (_projectSelectionTableGroup.getExistingProjectsNumber() > 0) {
        setMessage(Messages.GenericSelectionPage_SOME_PROJECTS_EXIST_MSG, IMessageProvider.WARNING);
        return true;
    }
    setMessage(IConstants.EMPTY_STRING);
    return true;
}

From source file:net.rim.ejde.internal.ui.wizards.imports.ProjectImportSelectionUI.java

License:Open Source License

public void creatContent() {
    // workspace location entry field
    Composite pathComp = new Composite(_parent, SWT.NONE);
    pathComp.setLayout(new GridLayout(3, false));
    pathComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (_allowBrowseJDW) {
        String importLocationLabel = Messages.GenericSelectionPage_WORKSPACE_LABEL;
        Label projectContentsLabel = new Label(pathComp, SWT.NONE);
        projectContentsLabel.setText(importLocationLabel); //$NON-NLS-1$*/
        projectContentsLabel.setLayoutData(new GridData(SWT.BEGINNING));
        // jdw path text
        _importPathField = new Text(pathComp, SWT.BORDER);
        _importPathField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        _importPathField.setText(""); //$NON-NLS-1$
        _importPathField.addKeyListener(new KeyAdapter() {
            @Override// w  w w .  j  a va 2  s . com
            public void keyPressed(KeyEvent e) {
                if ((e.keyCode == SWT.CR) || (e.keyCode == SWT.KEYPAD_CR)) {
                    _log.debug("\"Entry\" was pressed");
                    String workspaceFileToImport = _importPathField.getText();
                    loadWorkspace(new Path(workspaceFileToImport));
                }
            }
        });
        _importPathField.addFocusListener(new FocusAdapter() {
            @Override
            public void focusLost(FocusEvent e) {
                String workspaceFilePath = _importPathField.getText();
                loadWorkspace(new Path(workspaceFilePath));
            }
        });
        // browse button
        _browseButton = new Button(pathComp, SWT.PUSH);
        GridData data = new GridData(GridData.END);
        data.widthHint = BUTTON_DEFAULT_WIDTH;
        _browseButton.setLayoutData(data);
        _browseButton.setText(Messages.IConstants_BROWSE_BUTTON_TITLE); //$NON-NLS-1$
        _browseButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                FileDialog dialog = new FileDialog(_importPathField.getShell());
                String[] filters = new String[] { "*.jdw" };
                String[] filterNames = new String[] { Messages.BLACKBERRY_WORKSPACE_FILTER_NAME };
                dialog.setFilterExtensions(filters);
                dialog.setFilterNames(filterNames);
                String workspaceFileToImport = dialog.open();
                if (null != workspaceFileToImport) {
                    _importPathField.setText(workspaceFileToImport);
                    loadWorkspace(new Path(workspaceFileToImport));
                }
            }
        });
    }
    Composite comp = new Composite(_parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(3, false);
    comp.setLayout(gridLayout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 250;
    comp.setLayoutData(gd);
    // projects label
    Label projectsLabel = new Label(comp, SWT.NONE);
    projectsLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 3, 1));
    projectsLabel.setText(Messages.GenericSelectionPage_PROJECT_TABLE_TITLE);
    // projects table
    _tableViewer = CheckboxTableViewer.newCheckList(comp,
            SWT.SINGLE | SWT.FULL_SELECTION | SWT.CHECK | SWT.BORDER);
    _tableViewer.setContentProvider(new ArrayContentProvider());
    _tableViewer.setLabelProvider(new ProjectTableLabelProvider());
    _tableViewer.addCheckStateListener(new CheckStateListenerImpl());
    Table table = _tableViewer.getTable();
    table.addKeyListener(new KeyListenerImpl());
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 2));
    TableColumn projectIconColumn, projectNameColumn;
    projectIconColumn = new TableColumn(table, SWT.NONE);
    projectIconColumn.setText("Project Icon"); //$NON-NLS-1$
    projectIconColumn.setWidth(80);
    projectNameColumn = new TableColumn(table, SWT.NONE);
    projectNameColumn.setText("Project Name"); //$NON-NLS-1$
    projectNameColumn.setWidth(450);
    // select / de-select project buttons
    _selectAllButton = new Button(comp, SWT.PUSH);
    _selectAllButton.setText("Select All"); //$NON-NLS-1$
    GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.widthHint = BUTTON_DEFAULT_WIDTH;
    _selectAllButton.setLayoutData(gridData);
    _deselectAllButton = new Button(comp, SWT.PUSH);
    //_deselectAllButton.setText( _resources.getString( "Wizard.GenericSelectionPage.DeselectAll" ) ); //$NON-NLS-1$
    _deselectAllButton.setText("Deselect All"); //$NON-NLS-1$
    GridData gridData2 = new GridData(SWT.FILL, SWT.TOP, false, false);
    gridData2.widthHint = BUTTON_DEFAULT_WIDTH;
    _deselectAllButton.setLayoutData(gridData2);
    _selectAllButton.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org .eclipse .swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            Table table = _tableViewer.getTable();
            for (TableItem item : table.getItems()) {
                if (!item.getGrayed()) {
                    item.setChecked(true);
                }
            }
            table.redraw();
            _callback.setMessage(IConstants.EMPTY_STRING, IMessageProvider.NONE);
            _callback.setComplete(table.getItems().length > 0); // donot
        }
    });
    _deselectAllButton.addSelectionListener(new SelectionAdapter() {
        /*
         * (non-Javadoc)
         *
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org .eclipse .swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(SelectionEvent e) {
            Table table = _tableViewer.getTable();
            for (TableItem item : table.getItems()) {
                if (!item.getGrayed()) {
                    item.setChecked(false);
                }
            }
            _callback.setMessage(Messages.GenericSelectionPage_NO_PROJECT_SELECTED_ERROR_MSG,
                    IMessageProvider.ERROR);
            _callback.setComplete(false);
        }
    });
    // the copy project checkbox
    _copyButton = new Button(comp, SWT.CHECK);
    _copyButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false, 3, 1));
    _copyButton.setText(Messages.GenericSelectionPage_COPY_MODEL_LABEL);
    // by default we suggest users to use copy model
    _copyButton.setSelection(true);
    // if it is sample import wizard, we only allow copy import
    _copyButton.setEnabled(_allowBrowseJDW);
    _copyButton.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            fireImportTypeChangeEvent(e);

        }

    });
    // the select dependency project checkbox
    _selectDependencyButton = new Button(comp, SWT.CHECK);
    _selectDependencyButton.setText("Automatically select dependent projects");
    // by default we suggest users to use copy model
    _selectDependencyButton.setSelection(true);
}

From source file:net.rim.ejde.internal.ui.wizards.templates.AbstractBBTemplateSection.java

License:Open Source License

/**
 * Update the wizard page error message.
 *
 * @param page//from w  w w  .  ja  va 2s.co  m
 *            The wizard page
 * @param names
 *            The component name with error
 * @param status
 *            The error status
 */
protected void updateStatus(WizardPage page, List<String> names, IStatus status) {
    if (status.getSeverity() == IStatus.ERROR) {
        page.setPageComplete(false);
        IStatus[] children = status.getChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i].getSeverity() == IStatus.ERROR) {
                if (names.get(i).length() > 0) {
                    page.setMessage(names.get(i) + ": " + children[i].getMessage(), IMessageProvider.ERROR);
                } else {
                    page.setMessage(children[i].getMessage(), IMessageProvider.ERROR);
                }
                break;
            }
        }
    } else if (status.getSeverity() == IStatus.WARNING) {
        page.setPageComplete(true);
        IStatus[] children = status.getChildren();
        for (int i = 0; i < children.length; i++) {
            if (children[i].getSeverity() == IStatus.WARNING) {
                if (names.get(i).length() > 0) {
                    page.setMessage(names.get(i) + ": " + children[i].getMessage(), IMessageProvider.WARNING);
                } else {
                    page.setMessage(children[i].getMessage(), IMessageProvider.ERROR);
                }
                break;
            }
        }
    } else {
        page.setPageComplete(true);
        page.setMessage(null);
    }
}

From source file:net.sf.eclipsefp.haskell.ui.dialog.Validator.java

License:Open Source License

public void setErrorMessage(final String message) {
    if (message != null) {
        fMessage = message;
        status = IMessageProvider.ERROR;
    }
}

From source file:net.sf.eclipsefp.haskell.ui.dialog.Validator.java

License:Open Source License

public void setIncomplete(final String message) {
    setIncomplete(message, IMessageProvider.ERROR);
}

From source file:net.sf.eclipsensis.config.NSISConfigWizard.java

License:Open Source License

@Override
public final boolean performFinish() {
    if (doPerformFinish()) {
        if (isValidateNSISConfig()) {
            if (!EclipseNSISPlugin.getDefault().isConfigured()) {
                ((WizardPage) getContainer().getCurrentPage()).setMessage(
                        EclipseNSISPlugin.getResourceString("config.failure.message"), IMessageProvider.ERROR); //$NON-NLS-1$
                return false;
            }// w w w  .j a  va 2s.c  om
        }
        return true;
    }
    return false;
}

From source file:net.sf.eclipsensis.config.NSISConfigWizardNode.java

License:Open Source License

public IWizard getWizard() {
    if (mWizard != null) {
        return mWizard; // we've already created it
    }//  ww  w .  ja  v  a  2 s .  c  om

    final NSISConfigWizard[] wizard = new NSISConfigWizard[1];
    final IStatus statuses[] = new IStatus[1];

    Shell shell = mParentPage.getShell();
    BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
        public void run() {
            SafeRunner.run(new SafeRunnable() {
                @Override
                public void handleException(Throwable e) {
                    statuses[0] = new Status(IStatus.ERROR, getPluginId(), IStatus.OK,
                            e.getMessage() == null ? "" : e.getMessage(), e); //$NON-NLS-1$,
                }

                public void run() {
                    try {
                        wizard[0] = mDescriptor.createWizard();
                    } catch (CoreException e) {
                        statuses[0] = e.getStatus();
                    }
                }
            });
        }
    });

    if (statuses[0] != null) {
        mParentPage.setMessage(statuses[0].getMessage(), IMessageProvider.ERROR);
        Common.openError(shell, statuses[0].getMessage(), EclipseNSISPlugin.getShellImage());
        return null;
    }

    mWizard = wizard[0];
    return mWizard;
}