List of usage examples for org.eclipse.jface.dialogs MessageDialog openError
public static void openError(Shell parent, String title, String message)
From source file:cn.edu.pku.ogeditor.commands.ConnectionCreateCommand.java
License:Open Source License
public void execute() { if (existSameConnection()) { MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "The \"" + name + "\" Relation has existed!"); return;//from ww w. j ava2 s . c om } boolean connectionExist = false; Connection parentConnection; parentConnection = getParent(); // Connectiontarget if (!parentConnection.isRoot() // && !target.getParent().containTargetConnectionName(parentConnection)) return; for (Iterator<Connection> iter = source.getSourceConnections().iterator(); iter.hasNext();) { Connection conn = (Connection) iter.next(); if (conn.getTarget().equals(target)) { connectionExist = true; } } for (Iterator<Connection> iter = target.getSourceConnections().iterator(); iter.hasNext();) { Connection conn = (Connection) iter.next(); if (conn.getTarget().equals(source)) { connectionExist = true; } } if (connectionExist) connection = new Connection(source, target, name, Math.PI * (Math.random() * 2 - 1), Math.PI * (Math.random() * 2 - 1)); else connection = new Connection(source, target, name); if (source == target) { // The start and end points of our connection are both at the center // of the rectangle, // so the two relative dimensions are equal. ConnectionBendpoint cbp = new ConnectionBendpoint(); cbp.setRelativeDimensions(new Dimension(0, -60), new Dimension(0, -60)); connection.addBendpoint(0, cbp); ConnectionBendpoint cbp2 = new ConnectionBendpoint(); cbp2.setRelativeDimensions(new Dimension(100, -60), new Dimension(100, -60)); connection.addBendpoint(1, cbp2); ConnectionBendpoint cbp3 = new ConnectionBendpoint(); cbp3.setRelativeDimensions(new Dimension(100, 0), new Dimension(100, 0)); connection.addBendpoint(2, cbp3); } connection.setName(name); connection.setParent(parentConnection); parentConnection.addChild(connection); source.getDiagram().addConnection(connection); }
From source file:cn.ieclipse.pde.signer.wizard.SignJarWizard.java
License:Apache License
@Override protected void sign(IProgressMonitor monitor) { String input = page0.getSourcePackage(); String output = page0.getDestPackage(); String msg = super.pcbSign(input, output, null); if (msg == null) { boolean confirm = MessageDialog.openConfirm(getShell(), "Sign Successfully!", String.format("Sign successfully! The output package save to %s, would you like to explorer?", page0.getDestPackage())); if (confirm) { Explorer e = new Explorer(page0.getDestPackage()); ExplorerPlugin.explorer(e.getFolder(), e.getFile()); }//from w w w. j a v a 2 s .com page1.saveConf(cfgFile); } else { MessageDialog.openError(getShell(), "Error", String.format("Error while sign %s, error : %s", input, msg)); } }
From source file:cn.ieclipse.pde.signer.wizard.SignPluginWizard.java
License:Apache License
@Override protected void sign(IProgressMonitor monitor) { String input = null;/* ww w . jav a 2s.c o m*/ String msg = null; File f = new File(page0.getSourcePackage()); File[] features = new File(f, "features").listFiles(jarFilter); File[] plugins = new File(f, "plugins").listFiles(jarFilter); if (features != null) { for (File file : features) { input = file.getAbsolutePath(); msg = pcbSign(input, null, "ECLIPSE_"); if (msg != null) { break; } } } if (plugins != null) { for (File file : plugins) { input = file.getAbsolutePath(); msg = pcbSign(input, null, "ECLIPSE_"); if (msg != null) { break; } } } if (msg == null) { MessageDialog.openInformation(getShell(), "Sign Successfully!", "Sign successfully! The output signed package(s) have been replace the unsigned package(s)"); page1.saveConf(cfgFile); } else { MessageDialog.openError(getShell(), "Error", String.format("Error while sign %s, error : %s", input, msg)); } }
From source file:codeOrchestra.lcs.ApplicationWorkbenchAdvisor.java
@Override public void initialize(IWorkbenchConfigurer configurer) { super.initialize(configurer); Throwable socketInitException = application.getServerSocketThread().getSocketInitException(); if (socketInitException != null) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", "Can't init tracing socket: " + socketInitException); }/*from w w w . ja v a2 s .co m*/ }
From source file:codeOrchestra.lcs.config.view.LiveCodingProjectViews.java
@SuppressWarnings("unchecked") private static boolean validateProjectViewsState(IWorkbenchWindow window, LCSProject project) { List<String> errors = new ArrayList<String>(); IViewReference[] viewReferences = window.getActivePage().getViewReferences(); for (String viewId : lcpViewIDs) { for (int i = 0; i < viewReferences.length; i++) { if (viewReferences[i].getId().equals(viewId)) { IViewPart view = viewReferences[i].getView(false); if (view != null && view instanceof LiveCodingProjectPartView) { @SuppressWarnings("rawtypes") LiveCodingProjectPartView liveCodingProjectPartView = (LiveCodingProjectPartView) view; errors.addAll(liveCodingProjectPartView.validate()); }// w ww .j a va 2s .c o m } } } if (!errors.isEmpty()) { StringBuilder sb = new StringBuilder(); for (String errorMessage : errors) { sb.append(errorMessage).append("\n"); } MessageDialog.openError(window.getShell(), "Invalid settings", "Can't save the project due to invalid settings:\n\n" + sb.toString()); return false; } return true; }
From source file:codeOrchestra.lcs.license.AbstractExpirationWithLocalSerialValidationStrategy.java
public boolean showSerialNumberDialog() { InputDialog inputDialog = new InputDialog(Display.getDefault().getActiveShell(), "Serial number", "Please type the serial number purchased", null, null); if (inputDialog.open() == Window.CANCEL) { return false; }/*from w ww .ja v a 2s .co m*/ String serialNumber = inputDialog.getValue(); if (serialNumber != null) { if (SystemCheck.getInstance().isValidMACAddress(serialNumber)) { MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Serial number", "Thank you for choosing the Code Orchestra Livecoding Tool!"); registerProduct(serialNumber, null); return true; } else { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered is invalid."); return showSerialNumberDialog(); } } return false; }
From source file:codeOrchestra.lcs.license.LicenseManager.java
public Object interceptStart() { final ExpirationStrategy expirationStrategy = ExpirationHelper.getExpirationStrategy(); // Report serial number every 10 seconds if (StringUtils.isNotEmpty(CodeOrchestraLicenseManager.getLegacySerialNumber())) { if (expirationStrategy.isTrialOnly() && !new ActivationReporter(CodeOrchestraLicenseManager.getLegacySerialNumber()).report()) { MessageDialog.openError(Display.getDefault().getActiveShell(), "COLT License", "COLT beta version requires an active internet connection to start."); return IApplication.EXIT_OK; }// w w w. j a v a 2 s. c o m new Thread() { public void run() { while (true) { try { Thread.sleep(10000); } catch (InterruptedException e) { // ignore } new ActivationReporter(CodeOrchestraLicenseManager.getLegacySerialNumber()).report(); } }; }.start(); } // Trial-only (beta versions) - no serial number is checked if (expirationStrategy.isTrialOnly()) { if (ExpirationHelper.getExpirationStrategy().hasExpired()) { expirationStrategy.showLicenseExpiredDialog(); return IApplication.EXIT_OK; } else { if (UsagePeriods.getInstance().isCurrentTimePresentInUsagePeriods()) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Evaluation License", "Something is wrong with the system clock\nCOLT was launched already on the currently set time."); return IApplication.EXIT_OK; } expirationStrategy.showLicenseExpirationInProgressDialog(); return null; } } // No-trial version (serial-number only) if (!expirationStrategy.allowTrial() && CodeOrchestraLicenseManager.noSerialNumberPresent() && !expirationStrategy.allowsDemo()) { if (!expirationStrategy.showLicenseExpiredDialog()) { return IApplication.EXIT_OK; } } // Trial version with no serial if ((expirationStrategy.allowTrial() && CodeOrchestraLicenseManager.noSerialNumberPresent()) || (!expirationStrategy.allowsDemo() && expirationStrategy.isSubscriptionBased() && !CodeOrchestraLicenseManager.noSerialNumberPresent())) { if (UsagePeriods.getInstance().isCurrentTimePresentInUsagePeriods()) { String title = expirationStrategy.isSubscriptionBased() ? "COLT Subscription" : "Evaluation License"; MessageDialog.openError(Display.getDefault().getActiveShell(), title, "Something is wrong with the system clock\nCOLT was launched already on the currently set time."); return IApplication.EXIT_OK; } boolean expired = false; if (ExpirationHelper.getExpirationStrategy().hasExpired()) { expired = !expirationStrategy.showLicenseExpiredDialog(); } else { expirationStrategy.showLicenseExpirationInProgressDialog(); expired = false; } if (expired) { expirationStrategy.handleExpiration(); if (expirationStrategy.exitIfExpired()) { return IApplication.EXIT_OK; } } } // Demo version with subscription if (expirationStrategy.allowsDemo() && expirationStrategy.isSubscriptionBased()) { if (UsagePeriods.getInstance().isCurrentTimePresentInUsagePeriods()) { String title = "COLT Subscription"; MessageDialog.openError(Display.getDefault().getActiveShell(), title, "Something is wrong with the system clock\nCOLT was launched already on the currently set time."); return IApplication.EXIT_OK; } boolean expired = false; if (ExpirationHelper.getExpirationStrategy().hasExpired()) { expired = !expirationStrategy.showLicenseExpiredDialog(); } else { expirationStrategy.showLicenseExpirationInProgressDialog(); expired = false; } if (expired) { expirationStrategy.handleExpiration(); } } return null; }
From source file:codeOrchestra.lcs.license.PlimusSubscriptionExpirationStrategy.java
public boolean showSerialNumberDialog() { InputDialog inputDialog = new InputDialog(Display.getDefault().getActiveShell(), "Serial number", "Please type the serial number purchased", null, null); if (inputDialog.open() == Window.CANCEL) { return false; }/*from w ww . j ava 2s. c o m*/ String serialNumber = inputDialog.getValue(); if (serialNumber != null) { PlimusResponse keyRegistrationResponse; try { keyRegistrationResponse = PlimusHelper.registerKey(serialNumber); } catch (IOException e) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "Can't reach the validation server. Make sure your internet connection is active."); ErrorHandler.handle(e); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_INVALIDKEY) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered is invalid."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_INVALIDPRODUCT) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered can't be validated."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_EXPIREDKEY) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered had expired " + Math.abs(keyRegistrationResponse.getDaysTillExpiration()) + " days ago."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.ERROR_MAXCOUNT) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The key entered has already been registered the maximum number of times."); return showSerialNumberDialog(); } if (keyRegistrationResponse.getStatus() == PlimusResponseStatus.SUCCESS) { MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Serial number", "Thank you for choosing the Code Orchestra Livecoding Tool!"); registerProduct(serialNumber, keyRegistrationResponse); return true; } else { MessageDialog.openError(Display.getDefault().getActiveShell(), "Serial number", "The serial number entered can't be validated (" + keyRegistrationResponse.getStatus() + ")."); return showSerialNumberDialog(); } } return false; }
From source file:com.AddressBookNew.java
License:Open Source License
public Shell open(Display display) throws Exception { prepareDataProvider();/*from w ww. j av a 2s .co m*/ Window.setExceptionHandler(new Window.IExceptionHandler() { public void handleException(Throwable error) { MessageDialog.openError(null, "Error", "Error: Global Error Handler " + error.getMessage()); LogClass.logger.error("error", error); } }); shell = new Shell(display); FillLayout layout = new FillLayout(); layout.type = SWT.VERTICAL; shell.setLayout(layout); if (checkLogin()) shell.setText(Util.getString("firm.name") + "-" + Util.getString("welcome.message", loginUser.getNameSurname())); else { shell.dispose(); return shell; } Composite cContent = new Composite(shell, SWT.NONE); cContent.setLayout(new GridLayout(1, false)); Composite cMenu = new Composite(cContent, SWT.NONE); cMenu.setLayout(new FillLayout()); cMenu.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createToolBar(cMenu); cMenu.pack(); this.getLoginUser(); createMenuBar(); cTabFolder = new BasicCTabFolder(cContent, SWT.BORDER); cTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); cTabFolder.setSimple(false); cTabFolder.setUnselectedImageVisible(false); cTabFolder.setUnselectedCloseVisible(false); tabItemSearch = new SearchTabItem(cTabFolder, Util.getString("general.search")); tabItemBus = new BusTabItem(cTabFolder, Util.getString("bus.list")); tabItemDriver = new DriverTabItem(cTabFolder, Util.getString("driver.list")); tabItemHost = new HostTabItem(cTabFolder, Util.getString("host.list")); tabItemBusOwner = new BusOwnerTabItem(cTabFolder, Util.getString("busOwner.list")); tabItemMuavin = new MuavinTabItem(cTabFolder, Util.getString("muavin.list")); tabItemOutOffice = new OutOfficeTabItem(cTabFolder, Util.getString("outOffice.list")); tabItemServiceArea = new ServiceAreaTabItem(cTabFolder, Util.getString("serviceArea.list")); if (Util.isAdmin()) tabItemUser = new UserTabItem(cTabFolder, Util.getString("user.list")); cTabFolder.forceFocus(); cTabFolder.refreshAllTabItems(); shell.open(); return shell; }
From source file:com.AddressBookNewClient.java
License:Open Source License
public static void main(String[] args) { System.out.println("basliyoruz2"); System.out.println("time =" + new Date()); try {//from w w w . j av a 2s .c o m display = new Display(); instance.userLocalDB = false; instance.isRunning = true; instance.loginDialogServerAddressEnabled = true; if (isSuha() && Util.isFromJNPL()) { MessageDialog.openError(null, "Error", "Error: Global Error Handler "); return; } System.out.println("time2 =" + new Date()); Shell shell = instance.open(display); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } catch (Exception e) { e.printStackTrace(); } }