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

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

Introduction

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

Prototype

int INFORMATION

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

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:ext.org.eclipse.jdt.internal.ui.jarpackagerfat.FatJarPackageWizardPage.java

License:Open Source License

/**
 * set message to newMessage with severity WARNING.
 * overwrite existing message only if it is beyond severity WARNING
 * @param newMessage the warning to be set
 *///from   www. j a  v  a2s .  c o m
private void setInfoMessage(String newMessage) {
    if (getMessage() == null || getMessageType() < IMessageProvider.INFORMATION)
        setMessage(newMessage, IMessageProvider.INFORMATION);
}

From source file:ext.org.eclipse.jdt.internal.ui.refactoring.ExtractConstantWizard.java

License:Open Source License

@Override
protected void addUserInputPages() {

    String message = null;/*from  w w w.j av a 2 s  . c  om*/
    int messageType = IMessageProvider.NONE;
    if (!getExtractConstantRefactoring().selectionAllStaticFinal()) {
        message = RefactoringMessages.ExtractConstantInputPage_selection_refers_to_nonfinal_fields;
        messageType = IMessageProvider.INFORMATION;
    } else {
        message = MESSAGE;
        messageType = IMessageProvider.NONE;
    }

    String[] guessedNames = getExtractConstantRefactoring().guessConstantNames();
    String initialValue = guessedNames.length == 0 ? "" : guessedNames[0]; //$NON-NLS-1$
    addPage(new ExtractConstantInputPage(message, messageType, initialValue, guessedNames));
}

From source file:fr.imag.adele.cadse.cadseg.teamwork.commit.CommitStatusDialog.java

License:Apache License

/**
 * Open Commit Definition dialog./* w w  w .  ja  v a2  s.com*/
 * 
 * @param commitState
 *            status and definition of commit operation
 */
static public void openDialog(final CommitState commitState) {

    /**
     * Create a new display wen call getDefault(). Workbench is not
     * started. This method is called by federation in start level.
     * 
     */
    Display d = PlatformUI.getWorkbench().getDisplay();

    d.syncExec(new Runnable() {
        public void run() {
            try {
                // create a new transaction for commit
                final LogicalWorkspaceTransaction transaction = commitState.getTransaction();

                final CommitStatusDialog p = new CommitStatusDialog(commitState);
                p._swtuiPlatforms.setAction(p.getFinishAction());
                final Pages f = p._swtuiPlatforms.getPages();
                final WizardController wc = new WizardController(p._swtuiPlatforms) {

                    @Override
                    public boolean canFinish() {
                        if (!super.canFinish()) {
                            return false;
                        }

                        return !commitState.isPerformingCommit() && commitState.isCommitPerformed();
                    }

                    @Override
                    public boolean performCancel() {
                        return !commitState.isPerformingCommit() && commitState.isFailed();
                    }

                    @Override
                    public boolean performFinish() {
                        return doFinish(p, f);
                    }

                    private boolean doFinish(final CommitStatusDialog p, final Pages f) {
                        IRunnableWithProgress op = new IRunnableWithProgress() {
                            public void run(IProgressMonitor monitor)
                                    throws InvocationTargetException, InterruptedException {
                                try {
                                    f.getAction().doFinish(p.getSWTUIPlatform(), monitor);
                                } catch (CoreException e) {
                                    throw new InvocationTargetException(e);
                                } catch (Throwable e) {
                                    throw new InvocationTargetException(e);
                                } finally {
                                    monitor.done();
                                }
                            }
                        };
                        return executeRunnable(op, this);
                    }
                };

                // begin effective commit operation
                commitState.addListener(new CommitListener() {

                    @Override
                    public void beginCommit() {
                        // do nothing
                    }

                    @Override
                    public void beginCommitItem(UUID itemId) {
                        // do nothing
                    }

                    @Override
                    public void commitFail() {
                        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                            public void run() {
                                refreshListOfCommitedItems();
                                p.refreshTree(true);
                                p.refreshSelectDependentFields();
                                p._swtuiPlatforms.setMessageError("Commit failed !");
                            }
                        });
                    }

                    @Override
                    public void endCommit() {

                        // if commit is OK, commit workspace logical copy
                        if (commitState.isCommitPerformed()) {
                            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                                public void run() {
                                    p._swtuiPlatforms.setMessage("Commit succeed !",
                                            IMessageProvider.INFORMATION);
                                }
                            });
                        } else {
                            PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                                public void run() {
                                    p._swtuiPlatforms.setMessageError("Commit failed !");
                                }
                            });
                        }
                    }

                    @Override
                    public void endCommitItem(UUID itemId) {
                        refreshListOfCommitedItems();
                    }

                    @Override
                    public void endCommitItemContent(UUID itemId) {
                        refreshListOfCommitedItems();
                    }

                    @Override
                    public void endCommitItemLinks(UUID itemId) {
                        refreshListOfCommitedItems();
                    }

                    @Override
                    public void endCommitItemState(UUID itemId) {
                        refreshListOfCommitedItems();
                    }

                    private void refreshListOfCommitedItems() {
                        p.refreshListOfCommitedItems(true);
                    }

                });
                CommitThread commitThread = new CommitThread(commitState, transaction);
                commitThread.start();

                p.setPageSize(800, 500);
                p.open(null, wc);

            } catch (Throwable e) {
                e.printStackTrace();
            }
        }
    });
}

From source file:fr.imag.adele.cadse.cadseg.teamwork.update.UpdateDialogPage.java

License:Apache License

private void refreshWizardButtons() {
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        public void run() {
            if (!_updateState.getDefinition().getErrors().hasNotResolvedError()
                    && !_updateState.hasNoOperationToPerform())
                _swtuiPlatforms.setMessage("", IMessageProvider.INFORMATION);
            else/*from  w  w w  . ja v a  2s . com*/
                _swtuiPlatforms.setMessageError("Cannot perform update");
        }
    });
}

From source file:fr.imag.adele.cadse.cadseg.teamwork.update.UpdateStatusDialog.java

License:Apache License

private void refreshWizardButtons() {
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        public void run() {
            if (_updateState.isFailed())
                _swtuiPlatforms.setMessageError("Cannot perform update");
            else//from   www . j  a  v  a2  s.  co  m
                _swtuiPlatforms.setMessage("", IMessageProvider.INFORMATION);
        }
    });
}

From source file:fr.imag.adele.cadse.cadseg.teamwork.update.UpdateStatusDialog.java

License:Apache License

/**
 * Open Update Definition dialog.// www  . j  av a 2s .  co m
 * 
 * @param updateState
 *            status and definition of update operation
 * @throws CadseException
 */
static public void openDialog(final UpdateState updateState) {

    /**
     * Create a new display when call getDefault(). Workbench is not
     * started. This method is called by federation in start level.
     * 
    */
    try {
        final UpdateStatusDialog p = new UpdateStatusDialog(updateState);
        p._swtuiPlatforms.setAction(p.getFinishAction());
        final Pages f = p._swtuiPlatforms.getPages();

        WizardController wc = new WizardController(p._swtuiPlatforms) {

            @Override
            public boolean canFinish() {
                if (!super.canFinish()) {
                    return false;
                }

                UpdateState updateState = p.getUpdateState();
                return !updateState.isPerformingUpdate();
            }

            @Override
            public boolean performFinish() {

                IRunnableWithProgress op = new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor)
                            throws InvocationTargetException, InterruptedException {
                        try {
                            f.getAction().doFinish(p._swtuiPlatforms, monitor);
                        } catch (CoreException e) {
                            throw new InvocationTargetException(e);
                        } catch (Throwable e) {
                            throw new InvocationTargetException(e);
                        } finally {
                            monitor.done();
                        }
                    }
                };
                try {
                    getContainer().run(false, false, op);
                } catch (InterruptedException e) {
                    return false;
                } catch (InvocationTargetException e) {
                    Throwable realException = e.getTargetException();
                    if (realException instanceof NullPointerException) {
                        MessageDialog.openError(getShell(), "Error", "Null pointeur exception");
                        realException.printStackTrace();
                        return false;
                    }
                    MessageDialog.openError(getShell(), "Error", realException.getMessage());
                    return false;
                }

                return true;
            }

            @Override
            public boolean performCancel() {
                super.performCancel();

                p._updateState.abortUpdate();

                return true;
            }
        };

        // begin effective commit operation
        updateState.addListener(new UpdateListener() {

            @Override
            public void updateFail() {
                PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                    public void run() {
                        p._swtuiPlatforms.setMessageError("Update failed !");
                    }
                });
            }

            @Override
            public void endUpdate() {

                // if update is OK, commit workspace logical copy
                LogicalWorkspaceTransaction transaction = updateState.getTransaction();
                if (updateState.isUpdatePerformed()) {
                    try {
                        transaction.commit();
                    } catch (CadseException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                        public void run() {
                            p._swtuiPlatforms.setMessage("Update succeed !", IMessageProvider.INFORMATION);
                        }
                    });
                } else {
                    transaction.rollback();
                    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
                        public void run() {
                            p._swtuiPlatforms.setMessageError("Update failed !");
                        }
                    });
                }
            }

            @Override
            public void endUpdateItem(UUID itemId) {
                refreshListOfCommitedItems();
            }

            @Override
            public void endUpdateItemContent(UUID itemId) {
                refreshListOfCommitedItems();
            }

            @Override
            public void endUpdateItemLinks(UUID itemId) {
                refreshListOfCommitedItems();
            }

            @Override
            public void endUpdateItemState(UUID itemId) {
                refreshListOfCommitedItems();
            }

            private void refreshListOfCommitedItems() {
                p.refreshListOfUpdatedItems(true);
            }

            @Override
            public void beginUpdate() {
                // do nothing
            }

            @Override
            public void beginUpdatingItem(UUID itemId) {
                // do nothing
            }

        });
        UpdateThread updateThread = new UpdateThread(updateState);
        updateThread.start();

        p.open(null, wc);
    } catch (Throwable e) {
        e.printStackTrace();
    }
}

From source file:fr.imag.adele.cadse.si.workspace.uiplatform.swt.SWTUIPlatform.java

License:Apache License

public void setMessage(String newMessage, int newType) {
    if (_pageSite != null) {
        IStatusLineManager statusLine = _pageSite.getActionBars().getStatusLineManager();
        if (statusLine != null) {
            Image newImage = null;
            if (newMessage != null) {
                switch (newType) {
                case IMessageProvider.NONE:
                    break;
                case IMessageProvider.INFORMATION:
                    newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
                    break;
                case IMessageProvider.WARNING:
                    newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
                    break;
                case IMessageProvider.ERROR:
                    newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
                    break;
                }/*from   www.j a v a 2s  .c  om*/
                if (newType == UIPlatform.ERROR) {
                    statusLine.setErrorMessage(newImage, newMessage);

                } else {
                    statusLine.setMessage(newImage, newMessage);
                }
            } else {
                statusLine.setErrorMessage(null);
                statusLine.setMessage(null);
            }
        }
    } else if (dialog != null) {
        if (newMessage != null) {
            if (newType == UIPlatform.ERROR) {
                dialog.setErrorMessage(newMessage);
                IWizardPage page = dialog.getCurrentPage();
                if (page instanceof WizardPage)
                    ((WizardPage) page).setPageComplete(false);
            } else {
                dialog.setMessage(newMessage, newType);
                IWizardPage page = dialog.getCurrentPage();
                if (page instanceof WizardPage)
                    ((WizardPage) page).setPageComplete(true);
            }
        } else {
            dialog.setErrorMessage(null);
            dialog.setMessage(null);

            IWizardPage page = dialog.getCurrentPage();
            if (page instanceof WizardPage)
                ((WizardPage) page).setPageComplete(true);

        }
    }
}

From source file:fr.inria.atlanmod.emfviews.ui.linkingview.view.ModelSelectionDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle("Create a link");
    setMessage("You can select several elements", IMessageProvider.INFORMATION);
}

From source file:fr.inria.atlanmod.emfviews.ui.linkingview.view.ModelToLinkDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle("Select the model you want to link");
    setMessage("Select the model you want to link", IMessageProvider.INFORMATION);
}

From source file:fr.ocelet.platform.dialogs.AboutOmpDialog.java

License:CeCILL license

@Override
public void create() {
    super.create();
    setTitle("Ocelet Modelling Platform");
    StringBuffer aboutmsg = new StringBuffer("");
    aboutmsg.append("Version : " + PlatformSettings.version + ", licence : CeCILL 2.1");
    aboutmsg.append("\nMore information on http://www.ocelet.org");
    setMessage(aboutmsg.toString(), IMessageProvider.INFORMATION);
}