List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation
public static void openInformation(Shell parent, String title, String message)
From source file:clustere.dialogs.ChangeNetworkDialog.java
License:Open Source License
/** * /*from w ww .j a v a 2s . co m*/ */ public void getDecresedNetwork() { float a = 0; try { a = Float.parseFloat(text2.getText()); } catch (Exception e) { MessageDialog.openInformation(null, "error", "Number format exception!"); return; } Paramater.NETWORK_EXPAND_PERCENT = a; if (GraphInfo.tempEdges.size() == 0) { GraphInfo.tempEdges.addAll(GraphInfo.edgelist); } int size = GraphInfo.tempEdges.size(); size = (int) ((a / (float) 100) * size); Vector<Edge> edges = new Vector<Edge>(); Random random = new Random(); edges.addAll(GraphInfo.tempEdges); for (int i = 0; i < size; i++) { int index = random.nextInt(edges.size()); edges.remove(index); } GraphInfo.edgelist.clear(); GraphInfo.edgelist.addAll(edges); MessageDialog.openInformation(null, "success", "successfully get a decreased network!"); Paramater.NETWORK_STYLE = 4; update(); System.out.println("decreased******************" + GraphInfo.edgelist.size()); }
From source file:clustere.dialogs.ProteinFunctionDialog.java
License:Open Source License
/** * excel/* www . j ava 2 s . com*/ */ public void SaveXls() { FileDialog fd = new FileDialog(dialogShell, SWT.SAVE); fd.setFilterExtensions(new String[] { "*.xls" }); fd.setFilterNames(new String[] { "Excel.xls" }); String filename = fd.open(); if (filename == null || filename.equals("")) return; TableItem[] ti = table1.getItems(); try { WritableWorkbook book = Workbook.createWorkbook(new File(filename)); WritableSheet sheet = book.createSheet("", 0); // jxl.write.Label label=new jxl.write.Label(0,0,"test"); // sheet.addCell(label); // for(int i=0;i<10;i++){ // sheet.addCell(new jxl.write.Label(0,i+1,""+i+"")); // } WritableFont font3 = new WritableFont(WritableFont.createFont(" _GB2312"), 17, WritableFont.NO_BOLD); WritableCellFormat format1 = new WritableCellFormat(font3); // sheet.setRowView(0, 20); sheet.setColumnView(0, 20); sheet.setColumnView(1, 100); jxl.write.Label label1 = new jxl.write.Label(0, 0, "Pritein"); jxl.write.Label label2 = new jxl.write.Label(1, 0, "Functions"); label1.setCellFormat(format1); label2.setCellFormat(format1); sheet.addCell(label1); sheet.addCell(label2); for (int i = 0; i < ti.length; i++) { sheet.addCell(new jxl.write.Label(0, i + 1, ti[i].getText(0))); sheet.addCell(new jxl.write.Label(1, i + 1, ti[i].getText(1))); } // jxl.write.Number number = new jxl.write.Number(1,0,789.123); // sheet.addCell(number); book.write(); book.close(); } catch (Exception e) { MessageDialog.openError(dialogShell, "Error", e.toString()); return; } MessageDialog.openInformation(dialogShell, "Success", "File Saved Successfully"); }
From source file:clustere.dialogs.ProteinFunctionDialog.java
License:Open Source License
/** * /*w ww . j a va2 s .co m*/ */ public void loadProteins(HashMap<String, Set<String>> result) { FileDialog fd = new FileDialog(dialogShell, SWT.OPEN); fd.setText("Load Proteins"); fd.setFilterExtensions(new String[] { "*.txt", "*" }); fd.setFilterNames(new String[] { "(*.txt)", "()" }); String filename = fd.open(); if (filename == null || filename.equals("")) return; Set<String> proteins = new HashSet<String>(); try { BufferedReader br = new BufferedReader(new FileReader(new File(filename))); Scanner s; String str = br.readLine(); while (str != null) { s = new Scanner(str); while (s.hasNext()) { proteins.add(s.next().toUpperCase()); } str = br.readLine(); } br.close(); } catch (Exception e1) { MessageDialog.openError(dialogShell, "Error", ""); return; } Iterator it = proteins.iterator(); table1.removeAll(); while (it.hasNext()) { String s = (String) it.next(); Set<String> v = null; v = result.get(s); new TableItem(table1, SWT.LEFT).setText(new String[] { s, getString(v) }); } label3.setText("Total Item: " + table1.getItemCount()); MessageDialog.openInformation(dialogShell, "Success", "File read Successfully!"); }
From source file:clustere.dialogs.SaveOptionDialog.java
License:Open Source License
/** * /*from ww w.j a v a2 s . com*/ */ public void saveCluster() { String str = list1.getSelection()[0]; TreeElement treeElement = null; for (int i = 0; i < ViewPart1.list.size(); i++) { TreeElement te = ViewPart1.list.get(i); String testr = te.getName(); int index = testr.indexOf('('); testr = testr.substring(0, index); if (te.hasChildren() && testr.equals(str)) { treeElement = te; break; } } if (treeElement == null) { MessageDialog.openError(dialogShell, "Error", "No result found"); return; } FileDialog fd = new FileDialog(dialogShell, SWT.SAVE); if (button3.getSelection()) { fd.setFilterExtensions(new String[] { "*.ey", "*.txt" }); fd.setFilterNames(new String[] { "*.ey", "*.txt" }); } else if (button4.getSelection()) { fd.setFilterExtensions(new String[] { "*.cx", "*.txt" }); fd.setFilterNames(new String[] { "*.cx", "*.txt" }); } String filename = fd.open(); if (filename == null || filename.equals("")) return; try { BufferedWriter bw = new BufferedWriter(new FileWriter(new File(filename))); bw.write(str + ":Total Clusters:" + treeElement.getChildren().size()); bw.newLine(); bw.write("Node ID\t\tNode Neighbours"); bw.newLine(); for (int i = 0; i < treeElement.getChildren().size(); i++) { TreeElement te = treeElement.getChildren().get(i); Node n = te.getNode(); bw.write("Cluster:" + i + "\t" + n.getScope()); bw.newLine(); for (int j = 0; j < te.getNodes().size(); j++) { Node node = te.getNodes().get(j); bw.write(node.getNodeID()); // bw.write("\t"+getString(node.getNeighbours())); bw.newLine(); } } if (button4.getSelection()) { bw.write("***********************************Original Network*****************************"); bw.newLine(); for (int i = 0; i < GraphInfo.edgelist.size(); i++) { Edge edge = GraphInfo.edgelist.get(i); bw.write(edge.getNode1().getNodeID() + " "); bw.write(edge.getNode2().getNodeID() + " "); bw.write(String.valueOf((int) edge.getWeight())); bw.newLine(); } } // Vector<Node> clusterNode = treeElement.getNodes(); // bw.write("Overlap of clusters****************"); // bw.newLine(); // for(int i=0;i<clusterNode.size();i++){ // Node node = clusterNode.get(i); // bw.write(node.getNodeID()+"\t"+node.getScope()); // for(int j=0;j<node.getNeighbour_NUM();j++){ // Node node2 = node.getNeighbours().get(j); // bw.write("\t"+node2.getNodeID()); // } // bw.newLine(); // } bw.flush(); bw.close(); } catch (Exception e) { MessageDialog.openError(dialogShell, "Error", "File read exception:" + e.toString()); } MessageDialog.openInformation(dialogShell, "Success", "File saved successfully"); }
From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.views.DockerContainersView.java
License:Open Source License
private void showMessage(String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "Docker Images", message); }
From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.views.DockerExplorerView.java
License:Open Source License
private void showMessage(String message) { MessageDialog.openInformation(viewer.getControl().getShell(), "Docker Explorer", message); }
From source file:cn.dockerfoundry.ide.eclipse.explorer.ui.wizards.DockerConnectionWizardPage.java
License:Open Source License
@Override public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridData fileSelectionData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); composite.setLayoutData(fileSelectionData); GridLayout fileSelectionLayout = new GridLayout(); fileSelectionLayout.numColumns = 3;/* w w w. j av a2s . c om*/ fileSelectionLayout.makeColumnsEqualWidth = false; fileSelectionLayout.marginWidth = 0; fileSelectionLayout.marginHeight = 0; composite.setLayout(fileSelectionLayout); setControl(composite); editor = new StringFieldEditor("connName", "Docker Connection Name: ", composite); //NON-NLS-1 //NON-NLS-2 editor.getTextControl(composite).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String connName = DockerConnectionWizardPage.this.editor.getStringValue(); System.out.println("connName:" + connName); } }); // Group group0 = new Group(composite, SWT.NULL); // GridLayout layout = new GridLayout(); // layout.numColumns = 1; // group0.setLayout(layout); connSetting = new Button(composite, SWT.CHECK); connSetting.setSelection(true); connSetting.setText("Use default connection settings"); GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; connSetting.setLayoutData(gridData); group1 = new Group(composite, SWT.NULL); group1.setText("Connection Setting"); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; group1.setLayoutData(gridData); optionsButton = new Button[2]; optionsButton[0] = new Button(group1, SWT.RADIO); optionsButton[0].setText("Unix Socket"); optionsButton[0].setSelection(true); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; optionsButton[0].setLayoutData(gridData); unixSocketFileFieldEditor = new FileFieldEditor("Location", " Location: ", group1); //NON-NLS-1 //NON-NLS-2 unixSocketFileFieldEditor.getTextControl(group1).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String location = DockerConnectionWizardPage.this.unixSocketFileFieldEditor.getStringValue(); System.out.println("Location:" + location); } }); optionsButton[1] = new Button(group1, SWT.RADIO); optionsButton[1].setText("HTTPS Connection"); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; optionsButton[1].setLayoutData(gridData); hostEditor = new StringFieldEditor("host", " Host: ", group1); //NON-NLS-1 //NON-NLS-2 hostEditor.getTextControl(group1).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String host = DockerConnectionWizardPage.this.hostEditor.getStringValue(); System.out.println("host:" + host); } }); authenticationButton = new Button(group1, SWT.CHECK); authenticationButton.setSelection(true); authenticationButton.setText("Enable authentication"); gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 3; authenticationButton.setLayoutData(gridData); authenticationFileFieldEditor = new FileFieldEditor("Path", " Path: ", group1); //NON-NLS-1 //NON-NLS-2 authenticationFileFieldEditor.getTextControl(group1).addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { String path = DockerConnectionWizardPage.this.authenticationFileFieldEditor.getStringValue(); System.out.println("Path:" + path); } }); testConnection = new Button(composite, SWT.PUSH); testConnection.setText("Test Connection"); testConnection.setAlignment(SWT.RIGHT); testConnection.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { try { String conn = testConnection(); StringBuilder sb = new StringBuilder( "Successfully connect to Docker with the following info:\n"); sb.append(conn); MessageDialog.openInformation(getShell(), "Docker Connection", sb.toString()); } catch (Exception e) { e.printStackTrace(); StringBuilder sb = new StringBuilder( "Failed to connect to Docker with the following reason:\n"); sb.append(e.getLocalizedMessage()); MessageDialog.openError(getShell(), "Docker Connection", sb.toString()); } } @Override public void keyReleased(KeyEvent arg0) { keyPressed(arg0); } }); composite.moveAbove(null); checkUseUnixSocket(); checkUseDefaultConnSetting(); addListener(); }
From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.CloudUiUtil.java
License:Open Source License
public static void openUrl(String location, int browserChoice) { try {//w w w .j a va 2s . c om URL url = null; if (location != null) { url = new URL(location); } if (browserChoice == WebBrowserPreference.EXTERNAL) { try { IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport(); support.getExternalBrowser().openURL(url); } catch (Exception e) { } } else { IWebBrowser browser; int flags; if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) { flags = IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR; } else { flags = IWorkbenchBrowserSupport.AS_EXTERNAL | IWorkbenchBrowserSupport.LOCATION_BAR | IWorkbenchBrowserSupport.NAVIGATION_BAR; } String generatedId = "org.eclipse.mylyn.web.browser-" + Calendar.getInstance().getTimeInMillis(); //$NON-NLS-1$ browser = WorkbenchBrowserSupport.getInstance().createBrowser(flags, generatedId, null, null); browser.openURL(url); } } catch (PartInitException e) { MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.CloudUiUtil_ERROR_OPEN_BROWSER_FAIL_TITLE, Messages.CloudUiUtil_ERROR_OPEN_BROWSER_BODY); } catch (MalformedURLException e) { if (location == null || location.trim().equals("")) { //$NON-NLS-1$ MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.CloudUiUtil_ERROR_OPEN_BROWSER_FAIL_TITLE, NLS.bind(Messages.CloudUiUtil_ERROR_EMPTY_URL_BODY, location)); } else { MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.CloudUiUtil_ERROR_OPEN_BROWSER_FAIL_TITLE, NLS.bind(Messages.CloudUiUtil_ERROR_MALFORM_URL_BODY, location)); } } }
From source file:cn.ieclipse.pde.signer.wizard.SignPluginWizard.java
License:Apache License
@Override protected void sign(IProgressMonitor monitor) { String input = null;//from w w w .j a v a2 s. co 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.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; }// w w w . j a v a2 s . com 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; }