List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation
public static void openInformation(Shell parent, String title, String message)
From source file:at.rc.tacos.client.wizard.ConnectionWizard.java
License:Open Source License
@Override public boolean performFinish() { // skip and exit, if we are authenticated if (NetWrapper.getDefault().isAuthenticated()) return true; // reset the login status loginResponse = false;// w ww. j a va 2 s. c o m // start a thread try { getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) { monitor.beginTask( "Verbindung zum Server " + selectedServer.getDescription() + " wird hergestellt", IProgressMonitor.UNKNOWN); // connect to the new server and login NetSource.getInstance().openConnection(selectedServer); monitor.done(); } }); // if we have a connection try to login if (NetSource.getInstance().getConnection() == null) { Display.getCurrent().beep(); loginPage.setErrorMessage("Verbindung zum Server kann nicht hergestellt werden"); MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Serverfehler", "Verbindung zum Server kann nicht hergestellt werden.\n" + "Bitte versuchen sie es erneut oder whlen einen anderen Server."); // exit, we have no connection return false; } // start the monitor jobs and try to login NetWrapper.getDefault().init(); NetWrapper.getDefault().sendLoginMessage(new Login(username, password, false)); getContainer().run(true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InterruptedException { monitor.beginTask("Sende Anmeldeinformationen zum Server", IProgressMonitor.UNKNOWN); // sleep for some time, until we got the response from the // server while (!loginResponse) Thread.sleep(100); monitor.done(); } }); } catch (InvocationTargetException ite) { ite.printStackTrace(); return false; } catch (InterruptedException e) { return false; } // check the login status if (!NetWrapper.getDefault().isAuthenticated()) { loginPage.setErrorMessage("Anmeldung fehlgeschlagen.\n" + "Bitte berprfen Sie den angegebenen Benutzernamen und das Passwort"); Display.getCurrent().beep(); MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Anmeldung fehlgeschlagen", "Bitte berprfen Sie den angegebenen Benutzernamen und das Passwort"); return false; } else { // request data from server ModelFactory.getInstance().initalizeModel(); Display.getCurrent().beep(); MessageDialog.openInformation(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Login Erfolgreich", "Sie haben erfolgreich eine Verbindung zum Server hergestellt"); return true; } }
From source file:at.spardat.xma.gui.mapper.WidgetCreationWiz.java
License:Open Source License
/** * Creates widgets and inserts them into the XMA model *//*from w ww . j a va2 s . c om*/ private void finishWithWidgets() { AttachHelper attacher = new AttachHelper(); XMAComposite comp = (XMAComposite) insPoint_.parent_; /** * first calculate seperators to use if we have new widget to attach */ if (hasNewAttachableWidgets()) { boolean isNewSeperator = attacher.calculateSeperator(insPoint_); if (isNewSeperator) { /** * inform user, that a separator has been created */ MessageDialog.openInformation(getShell(), "Separator created", "An artificial, invisible vertical separator named '" + attacher.getSeparatorName() + "' that separates labels from widgets has been created and added to your composite."); } } /** * create all widgets */ XMAWidget[] newWidgets = new XMAWidget[attributes_.length]; for (int i = 0; i < attributes_.length; i++) { newWidgets[i] = attributes_[i].getWidgetInitData(false).createWidget(); } /** * calculate the index where these widgets must be inserted in the parent composite */ int insertionIndex = 0; if (insPoint_.child_ != null) { // must be inserted relative to a child insertionIndex = getChildIndex(insPoint_.child_); if (insertionIndex == -1) insertionIndex = 0; else { if (!insPoint_.before_) insertionIndex++; /** * Labels usually appear one slot next to the widget. If this is the case, we increase * insertionIndex to jump over the label. */ if (insertionIndex < comp.getControls().size()) { if (insPoint_.child_ instanceof IWidgetWithLabel) { if (((IWidgetWithLabel) insPoint_.child_).getLabel() == comp.getControls() .get(insertionIndex)) { insertionIndex++; } } } } } /** * insert the widgets in the parent composite */ for (int i = newWidgets.length - 1; i >= 0; i--) { if (newWidgets[i] instanceof IWidgetWithLabel) { XMALabel label = ((IWidgetWithLabel) newWidgets[i]).getLabel(); if (label != null) { comp.getControls().add(insertionIndex, label); // must call init on newly created widget label.init(); } } comp.getControls().add(insertionIndex, newWidgets[i]); newWidgets[i].init(); // must call init on newly created widget } /** * attach the widgets correctly */ for (int i = 0; i < newWidgets.length; i++) { if (attributes_[i].getWidgetInitData(false).getWType() != MdlAttribute.WIDG_HIDDEN) { //only attach non hidden widgets attacher.attachFirstStage(newWidgets[i]); } } XMAWidget lastInserted = null; for (int i = 0; i < newWidgets.length; i++) { if (attributes_[i].getWidgetInitData(false).getWType() != MdlAttribute.WIDG_HIDDEN) { //only attach non hidden widgets if (lastInserted == null) { // the first widget must be attached depending on the insertion position if (insPoint_.child_ == null || insPoint_.child_ instanceof HiddenWidget) { // widgets should be vertically attached starting at the top edge attacher.attachAtTop(newWidgets[i]); } else if (insPoint_.before_) { // widgets should be vertically attached before an other one attacher.attachVerticallyBefore(newWidgets[i], insPoint_.child_); } else { // widgets should be attached after a specified one attacher.attachVerticallyAfter(newWidgets[i], insPoint_.child_); } } else { // all other widgets get attached below the last one attached attacher.attachVerticallyAfter(newWidgets[i], lastInserted); } lastInserted = newWidgets[i]; } } /** * finally, create relationships between widgets and attributes */ for (int i = 0; i < newWidgets.length; i++) { // create relationship mdlRels_.add(mdlRels_.new Relationship((IBDAttachable) newWidgets[i], attributes_[i])); } }
From source file:at.spardat.xma.gui.projectw.refactoring.RenameSupport.java
License:Open Source License
private void showInformation(Shell parent, RefactoringStatus status) { String message = status.getMessageMatchingSeverity(RefactoringStatus.FATAL); MessageDialog.openInformation(parent, JavaUIMessages.RenameSupport_dialog_title, message); }
From source file:au.com.cybersearch2.dialogs.SyncInfoDialog.java
License:Open Source License
/** * Show information message in system dialog * @param title The dialog's title/*from ww w. ja va 2 s. co m*/ * @param message The message */ public void showInfo(final String title, final String message) { sync.syncExec(new Runnable() { @Override public void run() { MessageDialog.openInformation(shell, title, message); } }); }
From source file:au.com.cybersearch2.statusbar.example.handlers.AboutHandler.java
License:Open Source License
@Execute public void execute(Shell shell) { MessageDialog.openInformation(shell, "About", "Eclipse 4 RCP Status Bar"); }
From source file:au.gov.ansto.bragg.kakadu.ui.views.AlgorithmListView.java
License:Open Source License
private void showMessage(String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "Algorithm List", message); }
From source file:au.gov.ga.earthsci.eclipse.extras.browser.WebBrowserUtil.java
License:Open Source License
/** * Open a dialog window./*from w ww . j a v a 2s .c om*/ * * @param message * java.lang.String */ public static void openMessage(String message) { Display d = Display.getCurrent(); if (d == null) d = Display.getDefault(); Shell shell = d.getActiveShell(); MessageDialog.openInformation(shell, Messages.searchingTaskName, message); }
From source file:backup.gui.BackupTool.java
License:Open Source License
public BackupTool(Display display) { Launcher.configWindowOpen = true;// w w w. j a va 2 s . c o m shell_ = new Shell(display); shell_.setLayout(new GridLayout(5, false)); shell_.setText("Backup Configuration - " + Utility.getVersionNumber()); shell_.setImage(new Image(display, this.getClass().getResourceAsStream("/icons/icon.gif"))); shell_.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent arg0) { Launcher.configWindowOpen = false; } }); makeLabel(shell_, "Choose the location to create the backup:", GridData.BEGINNING, 4); Link l = makeLink(shell_, "<a>about</a>", GridData.END, 1); l.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { MessageBox mb = new MessageBox(shell_, SWT.OK); mb.setText("About Backup Tool - " + Utility.getVersionNumber()); mb.setMessage("Backup Tool Version " + Utility.getVersionNumber() + "\n" + "Copyright 2010, Daniel Armbrust All Rights Reserved\n" + "This code is licensed under the Apache License - v 2.0. \n" + "A full copy of the license has been included with the distribution.\n" + "E-Mail me at daniel.armbrust@gmail.com.\n" + "or visit http://armbrust.webhop.net/"); mb.open(); } public void widgetDefaultSelected(SelectionEvent arg0) { // noop } }); backupLocation_ = new Combo(shell_, SWT.READ_ONLY); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 5; backupLocation_.setLayoutData(gd); backupLocation_.setToolTipText("The folder where the backup should be created"); backupLocation_.setItems(new String[] { "", "Browse..." }); backupLocation_.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { if (backupLocation_.getSelectionIndex() == backupLocation_.getItemCount() - 1) { DirectoryDialog dd = new DirectoryDialog(shell_); String result = dd.open(); if (result != null && result.length() > 0) { backupLocation_.setItem(0, result); getCurrentBackupConfig().setTargetFile(new File(result)); } backupLocation_.select(0); } } public void widgetDefaultSelected(SelectionEvent arg0) { // noop } }); makeLabel(shell_, "Optionally choose a virtual drive root to use when writing to the backup location:", GridData.BEGINNING, 5); topWrittenFolder_ = new Combo(shell_, SWT.READ_ONLY); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 5; topWrittenFolder_.setLayoutData(gd); topWrittenFolder_.setToolTipText( "Optional - By default, all folders to the drive root are written to the backup folder. When selected, only folders below this folder are created in the backup location."); topWrittenFolder_.setItems(new String[] { "<Default>", "Browse..." }); topWrittenFolder_.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { if (topWrittenFolder_.getSelectionIndex() == topWrittenFolder_.getItemCount() - 1) { DirectoryDialog dd = new DirectoryDialog(shell_); String result = dd.open(); if (result != null && result.length() > 0) { if (topWrittenFolder_.getItemCount() == 3) { topWrittenFolder_.setItem(1, result); } else //must be two { topWrittenFolder_.add(result, 1); } topWrittenFolder_.select(1); } else { topWrittenFolder_.select(0); } } if (topWrittenFolder_.getItemCount() == 2 || topWrittenFolder_.getSelectionIndex() == 0) { getCurrentBackupConfig().setParentOfTopWrittenFolder(null); } else { getCurrentBackupConfig().setParentOfTopWrittenFolder(new File(topWrittenFolder_.getItem(1))); } } public void widgetDefaultSelected(SelectionEvent arg0) { // noop } }); removeObsolete_ = new Button(shell_, SWT.CHECK); removeObsolete_.setText("Remove Obsolete Files"); removeObsolete_.setToolTipText( "If you select this option - any file that exists in the backup location but does not exist in the source selection will be removed from the backup location"); removeObsolete_.setSelection(true); removeObsolete_.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); removeObsolete_.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { getCurrentBackupConfig().setRemoveObsoleteFiles(removeObsolete_.getSelection()); } public void widgetDefaultSelected(SelectionEvent arg0) { // noop } }); Label tsl = makeLabel(shell_, "Time Stamp Leniancy", SWT.NONE, 1); tsl.setToolTipText( "The time difference that is allowed between when comparing files before deciding that they are different"); timeStampLeniancy_ = new Combo(shell_, SWT.READ_ONLY); timeStampLeniancy_.setToolTipText( "The time difference that is allowed between when comparing files before deciding that they are different"); timeStampLeniancy_.setItems(new String[] { "0", "5", "10", "100", "1000" }); timeStampLeniancy_.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL)); timeStampLeniancy_.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { getCurrentBackupConfig().setTimeStampLeniancy(Integer.parseInt(timeStampLeniancy_.getText())); } public void widgetDefaultSelected(SelectionEvent arg0) { // noop } }); Label tc = makeLabel(shell_, "Simultaneous copy operations", SWT.NONE, 1); tc.setToolTipText( "The number of files to copy at a time. \nIf you are backing up to a local disk, 1 is recommended. \nIf you are backing up to a remote location, a higher number is recommended.\nThis only affect the speed of the copy."); tc.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END)); copyThreads_ = new Combo(shell_, SWT.READ_ONLY); copyThreads_.setToolTipText( "The number of files to copy at a time. \nIf you are backing up to a local disk, 1 is recommended. \nIf you are backing up to a remote location, a higher number is recommended.\nThis only affect the speed of the copy."); copyThreads_.setItems(new String[] { "1", "2", "3", "5", "10" }); copyThreads_.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent arg0) { getCurrentBackupConfig().setCopyThreads(Integer.parseInt(copyThreads_.getText())); } public void widgetDefaultSelected(SelectionEvent arg0) { // noop } }); makeLabel(shell_, "Choose the files to backup and the files to skip:", GridData.BEGINNING, 4); tv_ = new CheckboxTreeViewer(shell_); gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = 5; gd.heightHint = 250; tv_.getTree().setLayoutData(gd); tv_.setContentProvider(new FileTreeContentProvider()); tv_.setLabelProvider(new FileTreeLabelProvider(shell_.getDisplay())); tv_.setInput("root"); // pass a non-null that will be ignored tv_.getTree().setToolTipText( "Check the files and folders that you would like to backup. \nChecking a folder will cause the folder and all of its contents to be backed up. \nIf you check a file or folder under a folder which is already checked - then this file or folder (and all subfolders) will be ignored."); csl_ = new CheckStateListener(this, tv_); tv_.addCheckStateListener(csl_); Composite lower = makeLowerSection(shell_); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 5; lower.setLayoutData(gd); shell_.pack(); shell_.open(); try { File configFile = BackupConfigStore.locateConfig(); if (configFile == null) { MessageDialog.openError(shell_, "Configuration read error", "Could not create the necessary folder structure to store your configuration. This is bad!"); } else { if (configFile.exists()) { backupConfigs = BackupConfigStore.readConfigs(configFile); } else { MessageDialog.openInformation(shell_, "No configuration file found", "No configuration file was found. This is expected if this is the first time you have run the program."); } } } catch (Exception e) { MessageDialog.openError(shell_, "Configuration read error", "An unexpected error happened while reading the configuration file. It is corrupt or unreadable."); } tv_.getTree().forceFocus(); if (backupConfigs.size() == 0) { populateBackupConfigList(1, 0); backupConfigs.add(new BackupConfig()); } else { populateBackupConfigList(backupConfigs.size(), 0); } updateForBackupSelection(); }
From source file:bilab.EnvNavigatorView.java
License:Open Source License
private void showMessage(final String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "Environment Navigator", message); }
From source file:bilab.UnimplementedAction.java
License:Open Source License
@Override public void run(final IAction action) { MessageDialog.openInformation(window.getShell(), "BiLab Plug-in", "No action has been implemented"); }