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

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

Introduction

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

Prototype

int INFORMATION

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

Click Source Link

Document

Constant for the info image, or a simple dialog with the info image and a single OK button (value 2).

Usage

From source file:com.aptana.portal.ui.dispatch.configurationProcessors.PythonInstallProcessor.java

License:Open Source License

/**
 * Install Python on the machine.<br>
 * The configuration will grab the installer from the given attributes.<br>
 * We expect an array of attributes with the same structure described at {@link #loadAttributes(Object)}.
 * /*from w w w.  j  a v a2 s . c o m*/
 * @param attributes
 *            First - A string array of size 1, which contains the URL for the Python installer (.exe). Second -
 *            (optional) map of additional attributes.
 * @see com.aptana.configurations.processor.AbstractConfigurationProcessor#configure(org.eclipse.core.runtime.IProgressMonitor,
 *      java.lang.Object)
 * @see #loadAttributes(Object)
 */
@Override
public ConfigurationStatus configure(IProgressMonitor progressMonitor, Object attributes) {
    // Get a Class lock to avoid multiple installations at the same time even with multiple instances of this
    // processor
    synchronized (this.getClass()) {
        if (installationInProgress) {
            return configurationStatus;
        }
        installationInProgress = true;
    }
    if (!Platform.OS_WIN32.equals(Platform.getOS())) {
        String err = "The Python installer processor is designed to work on Windows."; //$NON-NLS-1$
        IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
        applyErrorAttributes(err);
        installationInProgress = false;
        return configurationStatus;
    }
    try {
        configurationStatus.removeAttribute(CONFIG_ATTR);
        clearErrorAttributes();

        // Load the installer's attributes
        IStatus loadingStatus = loadAttributes(attributes);
        if (!loadingStatus.isOK()) {
            String message = loadingStatus.getMessage();
            applyErrorAttributes(message);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(message));
            return configurationStatus;
        }

        // Check that we got the expected single install URL
        if (urls.length != 1) {
            // structure error
            String err = NLS.bind(Messages.InstallProcessor_wrongNumberOfInstallLinks,
                    new Object[] { PYTHON, 1, urls.length });
            applyErrorAttributes(err);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
            return configurationStatus;
        }
        // Try to get the default install directory from the optional attributes
        installDir = attributesMap.get(INSTALL_DIR_ATTRIBUTE);
        if (installDir == null) {
            installDir = PYTHON_DEFAULT_INSTALL_DIR;
        }
        // Start the installation...
        configurationStatus.setStatus(ConfigurationStatus.PROCESSING);
        IStatus status = download(urls, progressMonitor);
        if (status.isOK()) {
            status = install(progressMonitor);
        }
        switch (status.getSeverity()) {
        case IStatus.OK:
        case IStatus.INFO:
        case IStatus.WARNING:
            displayMessageInUIThread(MessageDialog.INFORMATION,
                    NLS.bind(Messages.InstallProcessor_installerTitle, PYTHON),
                    NLS.bind(Messages.InstallProcessor_installationSuccessful, PYTHON));
            configurationStatus.setStatus(ConfigurationStatus.OK);
            break;
        case IStatus.ERROR:
            configurationStatus.setStatus(ConfigurationStatus.ERROR);
            break;
        case IStatus.CANCEL:
            configurationStatus.setStatus(ConfigurationStatus.INCOMPLETE);
            break;
        default:
            configurationStatus.setStatus(ConfigurationStatus.UNKNOWN);
        }
        return configurationStatus;
    } finally {
        synchronized (this.getClass()) {
            installationInProgress = false;
        }
    }
}

From source file:com.aptana.portal.ui.dispatch.configurationProcessors.RubyInstallProcessor.java

License:Open Source License

/**
 * Install Ruby on the machine.<br>
 * The configuration will grab the installer and the DevKit from the given attributes.<br>
 * We expect an array of attributes with the same structure described at {@link #loadAttributes(Object)}.
 * /*from ww  w.  j  av  a2  s  .  c o m*/
 * @param attributes
 *            An array of strings holding an optional attributes map and an array of rubyinstaller and the devkit
 *            URLs.
 * @see com.aptana.configurations.processor.AbstractConfigurationProcessor#configure(org.eclipse.core.runtime.IProgressMonitor,
 *      java.lang.Object)
 * @see #loadAttributes(Object)
 */
@Override
public ConfigurationStatus configure(IProgressMonitor progressMonitor, Object attributes) {
    // Get a Class lock to avoid multiple installations at the same time even with multiple instances of this
    // RubyInstallProcessor
    synchronized (this.getClass()) {
        if (installationInProgress) {
            return configurationStatus;
        }
        installationInProgress = true;
    }
    if (!Platform.OS_WIN32.equals(Platform.getOS())) {
        String err = "The Ruby installer processor is designed to work on Windows."; //$NON-NLS-1$
        IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
        applyErrorAttributes(err);
        installationInProgress = false;
        return configurationStatus;
    }
    try {
        configurationStatus.removeAttribute(CONFIG_ATTR);
        clearErrorAttributes();

        // Load the installer's attributes
        IStatus loadingStatus = loadAttributes(attributes);
        if (!loadingStatus.isOK()) {
            String message = loadingStatus.getMessage();
            applyErrorAttributes(message);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(message));
            return configurationStatus;
        }

        // Check that we got the expected two install URLs
        // TODO - Once we place DevKit back again, this should hold a value of 2 URLs.
        if (urls.length != 1) {
            // structure error
            String err = NLS.bind(Messages.InstallProcessor_wrongNumberOfInstallLinks,
                    new Object[] { RUBY, 1, urls.length });
            applyErrorAttributes(err);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
            return configurationStatus;
        }
        // Try to get the default install directory from the optional attributes
        installDir = attributesMap.get(INSTALL_DIR_ATTRIBUTE);
        if (installDir == null) {
            installDir = RUBY_DEFAULT_INSTALL_DIR;
        }
        // Start the installation...
        configurationStatus.setStatus(ConfigurationStatus.PROCESSING);
        IStatus status = download(urls, progressMonitor);
        if (status.isOK()) {
            status = install(progressMonitor);
        }
        switch (status.getSeverity()) {
        case IStatus.OK:
        case IStatus.INFO:
        case IStatus.WARNING:
            displayMessageInUIThread(MessageDialog.INFORMATION,
                    NLS.bind(Messages.InstallProcessor_installerTitle, RUBY),
                    NLS.bind(Messages.InstallProcessor_installationSuccessful, RUBY));
            configurationStatus.setStatus(ConfigurationStatus.OK);
            break;
        case IStatus.ERROR:
            configurationStatus.setStatus(ConfigurationStatus.ERROR);
            break;
        case IStatus.CANCEL:
            configurationStatus.setStatus(ConfigurationStatus.INCOMPLETE);
            break;
        default:
            configurationStatus.setStatus(ConfigurationStatus.UNKNOWN);
        }
        return configurationStatus;
    } finally {
        synchronized (this.getClass()) {
            installationInProgress = false;
        }
    }
}

From source file:com.aptana.portal.ui.dispatch.configurationProcessors.XAMPPInstallProcessor.java

License:Open Source License

/**
 * Install XAMPP on the machine.<br>
 * The configuration will grab the installer from the given attributes.<br>
 * We expect an array of attributes with the same structure described at {@link #loadAttributes(Object)}.
 * /*from w  w  w .  java2  s. com*/
 * @param attributes
 *            First - A string array of size 1, which contains the URL for the XAMPP installer (.exe). Second -
 *            (optional) map of additional attributes.
 * @see com.aptana.configurations.processor.AbstractConfigurationProcessor#configure(org.eclipse.core.runtime.IProgressMonitor,
 *      java.lang.Object)
 * @see #loadAttributes(Object)
 */
@Override
public ConfigurationStatus configure(IProgressMonitor progressMonitor, Object attributes) {
    // Get a Class lock to avoid multiple installations at the same time even with multiple instances of this
    // RubyInstallProcessor
    synchronized (this.getClass()) {
        if (installationInProgress) {
            return configurationStatus;
        }
        installationInProgress = true;
    }
    if (!Platform.OS_WIN32.equals(Platform.getOS())) {
        String err = "The XAMPP installer processor is designed to work on Windows."; //$NON-NLS-1$
        IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
        applyErrorAttributes(err);
        installationInProgress = false;
        return configurationStatus;
    }
    try {
        configurationStatus.removeAttribute(CONFIG_ATTR);
        clearErrorAttributes();

        // Load the installer's attributes
        IStatus loadingStatus = loadAttributes(attributes);
        if (!loadingStatus.isOK()) {
            String message = loadingStatus.getMessage();
            applyErrorAttributes(message);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(message));
            return configurationStatus;
        }

        // Check that we got the expected single install URL
        if (urls.length != 1) {
            // structure error
            String err = NLS.bind(Messages.InstallProcessor_wrongNumberOfInstallLinks,
                    new Object[] { XAMPP, 1, urls.length });
            applyErrorAttributes(err);
            IdeLog.logError(PortalUIPlugin.getDefault(), new Exception(err));
            return configurationStatus;
        }
        // Try to get the default install directory from the optional attributes
        installDir = attributesMap.get(INSTALL_DIR_ATTRIBUTE);
        if (installDir == null) {
            installDir = XAMPP_DEFAULT_INSTALL_DIR;
        }
        // Start the installation...
        configurationStatus.setStatus(ConfigurationStatus.PROCESSING);
        IStatus status = download(urls, progressMonitor);
        if (status.isOK()) {
            status = install(progressMonitor);
        }
        switch (status.getSeverity()) {
        case IStatus.OK:
        case IStatus.INFO:
        case IStatus.WARNING:
            displayMessageInUIThread(MessageDialog.INFORMATION,
                    NLS.bind(Messages.InstallProcessor_installerTitle, XAMPP),
                    NLS.bind(Messages.InstallProcessor_installationSuccessful, XAMPP));
            configurationStatus.setStatus(ConfigurationStatus.OK);
            break;
        case IStatus.ERROR:
            configurationStatus.setStatus(ConfigurationStatus.ERROR);
            break;
        case IStatus.CANCEL:
            configurationStatus.setStatus(ConfigurationStatus.INCOMPLETE);
            break;
        default:
            configurationStatus.setStatus(ConfigurationStatus.UNKNOWN);
        }
        return configurationStatus;
    } finally {
        synchronized (this.getClass()) {
            installationInProgress = false;
        }
    }
}

From source file:com.aptana.ui.util.UIUtils.java

License:Open Source License

/**
 * Schedules a message dialog to be displayed safely in the UI thread
 * //w  w w .j a  v a 2s. c  o  m
 * @param kind
 *            MessageDialog constants indicating the kind
 * @param title
 *            MessageDialog title
 * @param message
 *            MessageDialog message
 * @param runnable
 *            Something that gets run if the message dialog return code is Window.OK
 */
public static void showMessageDialogFromBgThread(final int kind, final String title, final String message,
        final ISafeRunnable runnable) {
    showMessageDialogFromBgThread(new SafeMessageDialogRunnable() {

        public void run() throws Exception {
            if (runnable != null) {
                runnable.run();
            }
        }

        public int openMessageDialog() {
            if (kind == MessageDialog.INFORMATION) {
                // for info messages, we show the toast popup
                GenericInfoPopupDialog dialog = new GenericInfoPopupDialog(
                        UIUtils.getActiveWorkbenchWindow().getShell(), title, message);
                return dialog.open();
            }
            return MessageDialog.open(kind, UIUtils.getActiveWorkbenchWindow().getShell(), title, message,
                    SWT.NONE) ? Window.OK : Window.CANCEL;
        }
    }, Window.OK);
}

From source file:com.arc.cdt.debug.seecode.ui.UISeeCodePlugin.java

License:Open Source License

/**
 * Show an note box.//from  w ww. j  a va2s  . co  m
 * (We use JFace ErrorDialog instead of MessageBox. The latter is done outside
 * of Java and the WindowTester framework loses control).
 * @param title
 * @param message
 */
public static void showNote(String title, String message) {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    MessageDialog dialog = new MessageDialog(shell, title, null, // accept
            // the
            // default
            // window
            // icon
            message, MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
    dialog.setBlockOnOpen(false); // we want to be able to make box expire
    // ok is the default
    dialog.open();
    long expireTime = System.currentTimeMillis() + NOTE_TIME_OUT;
    Display display = shell.getDisplay();
    try {
        while (dialog.getShell() != null && !dialog.getShell().isDisposed()
                && System.currentTimeMillis() < expireTime) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } finally {
        if (dialog.getShell() != null && !dialog.getShell().isDisposed()) {
            dialog.close();
        }
    }
}

From source file:com.atlassian.connector.eclipse.team.ui.TeamUiUtils.java

License:Open Source License

public static void handleMissingTeamConnectors() {
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            new MessageDialog(WorkbenchUtil.getShell(), "No Atlassian SCM Integration installed", null,
                    "In order to access this functionality you need to install an Atlassian SCM Integration feature.\n\n"
                            + "You may install them by opening: Help | Install New Software, selecting 'Atlassian Connector for Eclipse' Update Site "
                            + "and chosing one or more integation features in 'Atlassian Integrations' category.",
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0).open();
        }/*www.ja va 2 s . c  o  m*/
    });
}

From source file:com.bdaum.zoom.operations.internal.MigrateOperation.java

License:Open Source License

@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
    List<URI> failedWatchedFolders = new ArrayList<URI>();
    List<URI> watchedFoldersWithFilters = new ArrayList<URI>();
    init(monitor, 1337000);/*from w ww .  j a v a2  s  .c o  m*/
    monitor.subTask(Messages.getString("MigrateOperation.migrating")); //$NON-NLS-1$
    try {
        final Meta oldMeta = dbManager.getMeta(true);
        Meta newMeta = newDbManager.getMeta(true);
        newMeta.setPlatform("$migrated$"); //$NON-NLS-1$
        List<Object> toBeStored = cloneMeta(newDbManager, oldMeta, newMeta, oldMeta.getDescription());
        newMeta.setKeywords(oldMeta.getKeywords());
        Utilities.ensureCatConsistency(oldMeta.getCategory());
        newMeta.setCategory(oldMeta.getCategory());
        newMeta.setCleaned(false);
        newMeta.setCreationDate(oldMeta.getCreationDate());
        newMeta.setRelevantLireVersion(oldMeta.getRelevantLireVersion());
        newMeta.setBackupLocation(migrate(oldMeta.getBackupLocation()));
        if (oldMeta.getColorLabels() != null)
            newMeta.setColorLabels(oldMeta.getColorLabels());
        newMeta.setPersonsToKeywords(oldMeta.getPersonsToKeywords());
        newMeta.setThumbnailResolution(oldMeta.getThumbnailResolution());
        newMeta.setSharpen(oldMeta.getSharpen());
        newMeta.setWebpCompression(oldMeta.getWebpCompression());
        newMeta.setJpegQuality(oldMeta.getJpegQuality());
        newMeta.setThumbnailFromPreview(oldMeta.getThumbnailFromPreview());
        newMeta.setTimeline(oldMeta.getTimeline());
        newMeta.setLocationFolders(oldMeta.getLocationFolders());
        newMeta.setPauseFolderWatch(oldMeta.getPauseFolderWatch());
        newMeta.setReadonly(false);
        newMeta.setAutoWatch(oldMeta.getAutoWatch());
        newMeta.setFolderWatchLatency(oldMeta.getFolderWatchLatency());
        newMeta.setLocale(oldMeta.getLocale());
        newMeta.setCumulateImports(oldMeta.getCumulateImports());
        newMeta.setCbirAlgorithms(CoreActivator.getDefault().getCbirAlgorithms());
        newMeta.setIndexedTextFields(CoreActivator.getDefault().getIndexedTextFields(oldMeta));
        Map<String, LastDeviceImport> lastDeviceImports = oldMeta.getLastDeviceImport();
        if (lastDeviceImports != null)
            toBeStored.addAll(lastDeviceImports.values());
        List<String> watchedFolders = oldMeta.getWatchedFolder();
        if (watchedFolders != null)
            for (String id : watchedFolders) {
                WatchedFolder watchedFolder = dbManager.obtainById(WatchedFolder.class, id);
                String oldUri = watchedFolder.getUri();
                String oldVolume = watchedFolder.getVolume();
                String oldTarget = watchedFolder.getTargetDir();
                String source = migrateUri(oldUri, oldVolume);
                if (source.isEmpty()) {
                    failedWatchedFolders.add(volumeManager.findFile(oldUri, oldVolume));
                    continue;
                }
                if (watchedFolder.getTransfer()) {
                    String target = migrate(oldTarget);
                    if (target.isEmpty()) {
                        failedWatchedFolders.add(volumeManager.findFile(oldUri, oldVolume));
                        continue;
                    }
                    watchedFolder.setTargetDir(target);
                }
                watchedFolder.setUri(toUri(source));
                watchedFolder.setVolume(extractVolume(source));
                String oldFilters = watchedFolder.getFilters();
                if (oldFilters != null && !oldFilters.isEmpty())
                    watchedFoldersWithFilters.add(volumeManager.findFile(oldUri, oldVolume));
                newDbManager.storeAndCommit(watchedFolder);
                newMeta.addWatchedFolder(id);
                watchedFolder.setUri(oldUri);
                watchedFolder.setVolume(oldVolume);
                watchedFolder.setTargetDir(oldTarget);
                if (monitor.isCanceled())
                    return abort();
            }
        if (monitor.isCanceled())
            return abort();
        toBeStored.add(newMeta);
        newDbManager.safeTransaction(null, toBeStored);
        if (monitor.isCanceled())
            return abort();
        monitor.worked(1000);
        monitor.subTask(Messages.getString("MigrateOperation.migrate_groups")); //$NON-NLS-1$
        if (copyObjects(GroupImpl.class, 20000))
            return abort();
        GroupImpl folderGroup = newDbManager.obtainById(GroupImpl.class, Constants.GROUP_ID_FOLDERSTRUCTURE);
        List<Group> oldSubgroup = new ArrayList<Group>(folderGroup.getSubgroup());
        folderGroup.getSubgroup().clear();
        newDbManager.storeAndCommit(folderGroup);
        folderGroup.setSubgroup(oldSubgroup);
        if (copyObjects(ContactImpl.class, 1000))
            return abort();
        if (copyObjects(CreatorsContactImpl.class, 1000))
            return abort();
        if (copyObjects(LocationImpl.class, 1000))
            return abort();
        if (copyObjects(LocationShownImpl.class, 1000))
            return abort();
        if (copyObjects(LocationCreatedImpl.class, 1000))
            return abort();
        if (copyObjects(ArtworkOrObjectImpl.class, 1000))
            return abort();
        if (copyObjects(ArtworkOrObjectShownImpl.class, 1000))
            return abort();
        if (copyObjects(TrackRecordImpl.class, 1000))
            return abort();
        if (copyObjects(RegionImpl.class, 1000))
            return abort();
        if (copyObjects(ComposedToImpl.class, 1000))
            return abort();
        if (copyObjects(DerivedByImpl.class, 1000))
            return abort();
        int i = 0;
        List<Asset> assets = dbManager.obtainObjects(Asset.class);
        int na = assets.size();
        int work = 1000000;
        int incr = na == 0 ? work : work / na;
        for (Asset asset : assets) {
            monitor.subTask(NLS.bind(Messages.getString("MigrateOperation.migrating_image"), ++i, na)); //$NON-NLS-1$
            String oldUri = asset.getUri();
            String oldVolume = asset.getVolume();
            boolean remote = volumeManager.isRemote(asset);
            String migratedPath = migrateUri(oldUri, oldVolume);
            if (remote || !migratedPath.isEmpty()) {
                toBeStored.clear();
                toBeStored.add(asset);
                String assetId = asset.getStringId();
                String oldVoiceFileURI = asset.getVoiceFileURI();
                String oldVoiceVolume = asset.getVoiceVolume();
                String migratedUri = null;
                String migratedVolume = null;
                if (!remote) {
                    migratedUri = toUri(migratedPath);
                    asset.setUri(migratedUri);
                    migratedVolume = extractVolume(migratedPath);
                    asset.setVolume(migratedVolume);
                    String voiceUri = AssetEnsemble.extractVoiceNote(asset);
                    if (voiceUri != null) {
                        String migratedVoicePath = migrateUri(voiceUri, oldVoiceVolume);
                        AssetEnsemble.insertVoiceNote(asset, extractVolume(migratedVoicePath),
                                migratedVoicePath.isEmpty() ? null : toUri(migratedVoicePath));
                    }
                }
                visited.add(assetId);
                List<Ghost_typeImpl> ghosts = dbManager.obtainObjects(Ghost_typeImpl.class,
                        QueryField.NAME.getKey(), asset.getName(), QueryField.EQUALS);
                for (Ghost_typeImpl ghost : ghosts)
                    if (ghost.getUri() != null && ghost.getUri().equals(oldUri) && migratedUri != null) {
                        ghost.setUri(migratedUri);
                        ghost.setVolume(migratedVolume);
                        toBeStored.add(ghost);
                    }
                MediaExtension[] mediaExtensions = asset.getMediaExtension();
                if (mediaExtensions != null)
                    for (MediaExtension mediaExt : mediaExtensions)
                        toBeStored.add(mediaExt);
                newDbManager.safeTransaction(null, toBeStored);
                newDbManager.createFolderHierarchy(asset, winTarget);
                asset.setUri(oldUri);
                asset.setVolume(oldVolume);
                asset.setVoiceFileURI(oldVoiceFileURI);
                asset.setVoiceVolume(oldVoiceVolume);
                for (Object obj : toBeStored)
                    if (obj instanceof Ghost_typeImpl) {
                        ((Ghost_typeImpl) obj).setUri(oldUri);
                        ((Ghost_typeImpl) obj).setVolume(oldVolume);
                    }
            }
            if (monitor.isCanceled())
                return abort();
            monitor.worked(incr);
            work -= incr;
        }
        monitor.worked(work);
        List<SmartCollectionImpl> collections = dbManager.obtainObjects(SmartCollectionImpl.class);
        work = 100000;
        na = collections.size();
        incr = na == 0 ? work : work / na;
        String uriKey = QueryField.URI.getKey() + '=';
        String volumeKey = QueryField.VOLUME.getKey() + '=';
        for (SmartCollectionImpl coll : collections) {
            if (coll.getSmartCollection_subSelection_parent() == null) {
                String id = coll.getStringId();
                if (!id.startsWith(uriKey) && !id.startsWith(volumeKey)) {
                    toBeStored.clear();
                    monitor.subTask(NLS.bind(Messages.getString("MigrateOperation.migrating_collections"), //$NON-NLS-1$
                            coll.getName()));
                    transferSmartCollection(toBeStored, coll, null);
                    newDbManager.safeTransaction(null, toBeStored);
                    if (monitor.isCanceled())
                        return abort();
                }
            }
            monitor.worked(incr);
            work -= incr;
        }
        monitor.worked(work);
        monitor.subTask(Messages.getString("MigrateOperation.migrating_presentations")); //$NON-NLS-1$
        if (copyObjects(SlideShowImpl.class, 5000))
            return abort();
        if (copyObjects(SlideImpl.class, 50000))
            return abort();
        if (copyObjects(ExhibitImpl.class, 50000))
            return abort();
        if (copyObjects(WallImpl.class, 5000))
            return abort();
        List<ExhibitionImpl> exhibitions = dbManager.obtainObjects(ExhibitionImpl.class);
        work = 5000;
        na = exhibitions.size();
        incr = na == 0 ? work : work / na;
        for (ExhibitionImpl exhibition : exhibitions) {
            String oldFolder = exhibition.getOutputFolder();
            if (oldFolder != null) {
                exhibition.setOutputFolder(migrate(oldFolder));
                newDbManager.storeAndCommit(exhibition);
                exhibition.setOutputFolder(oldFolder);
            } else
                newDbManager.storeAndCommit(exhibition);
            if (monitor.isCanceled())
                return abort();
            monitor.worked(incr);
            work -= incr;
        }
        monitor.worked(work);
        if (copyObjects(WebExhibitImpl.class, 50000))
            return abort();
        if (copyObjects(WebParameterImpl.class, 5000))
            return abort();
        if (copyObjects(StoryboardImpl.class, 5000))
            return abort();
        List<WebGalleryImpl> galleries = dbManager.obtainObjects(WebGalleryImpl.class);
        work = 5000;
        na = galleries.size();
        incr = na == 0 ? work : work / na;
        for (WebGalleryImpl exhibition : galleries) {
            String oldFolder = exhibition.getOutputFolder();
            if (oldFolder != null) {
                exhibition.setOutputFolder(migrate(oldFolder));
                newDbManager.storeAndCommit(exhibition);
                exhibition.setOutputFolder(oldFolder);
            } else
                newDbManager.storeAndCommit(exhibition);
            if (monitor.isCanceled())
                return abort();
            monitor.worked(incr);
            work -= incr;
        }
        monitor.subTask(Messages.getString("MigrateOperation.migrating_other_entries")); //$NON-NLS-1$
        monitor.worked(work);
        if (copyObjects(PageLayoutImpl.class, 5000))
            return abort();
        List<BookmarkImpl> bookmarks = dbManager.obtainObjects(BookmarkImpl.class);
        work = 20000;
        na = galleries.size();
        incr = na == 0 ? work : work / na;
        for (BookmarkImpl bookmark : bookmarks) {
            String catFile = bookmark.getCatFile();
            if (catFile == null || new File(catFile).equals(dbManager.getFile())) {
                bookmark.setCatFile(null);
                newDbManager.storeAndCommit(bookmark);
            }
            if (monitor.isCanceled())
                return abort();
            monitor.worked(incr);
            work -= incr;
        }
        monitor.worked(work);
        newDbManager.safeTransaction(null, newMeta);
        if (!failedWatchedFolders.isEmpty() || watchedFoldersWithFilters.isEmpty() || oldMeta.getReadonly()) {
            StringBuilder sb = new StringBuilder();
            sb.append(Messages.getString("MigrateOperation.migration_completed")); //$NON-NLS-1$
            if (!failedWatchedFolders.isEmpty()) {
                sb.append(Messages.getString("MigrateOperation.failed_watched_folders")); //$NON-NLS-1$
                for (URI uri : failedWatchedFolders)
                    sb.append("\n\t").append(new File(uri).getPath()); //$NON-NLS-1$
            }
            if (!watchedFoldersWithFilters.isEmpty()) {
                sb.append(Messages.getString("MigrateOperation.watched_folders_with_filters")); //$NON-NLS-1$
                for (URI uri : watchedFoldersWithFilters)
                    sb.append("\n\t").append(new File(uri).getPath()); //$NON-NLS-1$
            }
            if (oldMeta.getReadonly())
                sb.append(Messages.getString("MigrateOperation.read_only")); //$NON-NLS-1$
            finalMessage = sb.toString();
            severity = MessageDialog.WARNING;
        } else {
            finalMessage = Messages.getString("MigrateOperation.migration_completed"); //$NON-NLS-1$
            severity = MessageDialog.INFORMATION;
        }
        return close(info);
    } finally {
        newDbManager.close(CatalogListener.NORMAL);
    }
}

From source file:com.ceteva.basicIO.AddLicenseKey.java

public AddLicenseKey(Shell parentShell) {
    super(parentShell, "Add license key", Display.getCurrent().getSystemImage(MessageDialog.INFORMATION),
            "Paste your license key into the area below and click store.\n"
                    + "Once a license key has been added you must restart the tool",
            MessageDialog.INFORMATION, new String[] { "Store key", "Cancel" }, 0);
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:com.drgarbage.utils.Messages.java

License:Apache License

public static int info(Shell shell, String title, String message) {
    MessageDialog dlg = new MessageDialog(shell, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(), message,
            MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
    return dlg.open();
}

From source file:com.generalrobotix.ui.item.GrxModelItem.java

License:Open Source License

public int checkModifiedModel(boolean reload) {
    if (bModified_) {
        String mes = MessageBundle.get("GrxProjectItem.dialog.message.changeModel.mes"); //$NON-NLS-1$
        mes = NLS.bind(mes, new String[] { getName() });

        MessageDialog msgDlg = new MessageDialog(GrxUIPerspectiveFactory.getCurrentShell(),
                MessageBundle.get("GrxProjectItem.dialog.message.changeModel.title"), null, mes,
                MessageDialog.INFORMATION,
                new String[] { MessageBundle.get("GrxProjectItem.dialog.message.changeModel.btn.save"),
                        MessageBundle.get("GrxProjectItem.dialog.message.changeModel.btn.reverse"),
                        MessageBundle.get("GrxProjectItem.dialog.message.changeModel.btn.cancel") },
                2);/*from  www .  j av a 2  s .co  m*/

        switch (msgDlg.open()) {
        case 0:
            if (reload) {
                if (!saveAndLoad())
                    return MODIFIED_NG;
                else
                    return MODIFIED_OK;
            } else {
                if (!_saveAs())
                    return MODIFIED_NG;
                cancelModified();
                return MODIFIED_OK;
            }
        case 1:
            if (reload) {
                if (!reload())
                    return MODIFIED_NG;
                else
                    return MODIFIED_OK;
            } else {
                cancelModified();
                return MODIFIED_OK;
            }
        case 2:
        default:
            return MODIFIED_NG;
        }
    }
    return MODIFIED_NOT;
}