Java Code Examples for org.eclipse.swt.widgets.ProgressBar#setSelection()
The following examples show how to use
org.eclipse.swt.widgets.ProgressBar#setSelection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgressBarDemo.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
/** * Create contents of the dialog. * @param parent */ @Override protected Control createDialogArea(Composite parent) { Composite container = (Composite) super.createDialogArea(parent); container.setLayout(new GridLayout(1, false)); completedInfo = new Label(container, SWT.NONE); completedInfo.setAlignment(SWT.CENTER); GridData gd_completedInfo = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_completedInfo.minimumWidth = 250; completedInfo.setLayoutData(gd_completedInfo); completedInfo.setSize(250, 40); completedInfo.setText("Processing Data ..."); new Label(container, SWT.NONE); progressBar = new ProgressBar(container, SWT.INDETERMINATE); GridData gd_progressBar = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1); gd_progressBar.minimumWidth = 250; progressBar.setLayoutData(gd_progressBar); progressBar.setBounds(10, 23, 400, 17); progressBar.setSelection(100); return container; }
Example 2
Source File: XLIFFEditorStatusLineItemWithProgressBar.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
public void fill(Composite parent) { super.fill(parent); Composite container = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(2, false); gl.marginWidth = 5; gl.marginHeight = 3; container.setLayout(gl); progressBar = new ProgressBar(container, SWT.SMOOTH); GridData gdPprogressBar = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gdPprogressBar.heightHint = 16; gdPprogressBar.widthHint = 130; progressBar.setLayoutData(gdPprogressBar); progressBar.setMinimum(0); // 最小值 progressBar.setMaximum(100);// 最大值 progressBar.setSelection(progressValue); progressBar.setToolTipText(defaultMessage); label = new Label(container, SWT.None); label.setText(progressValue + "%"); StatusLineLayoutData data = new StatusLineLayoutData(); container.setLayoutData(data); }
Example 3
Source File: MessageArea.java From nebula with Eclipse Public License 2.0 | 5 votes |
/** * Create a progress bar */ private void createProgressBar() { progressBar = new ProgressBar(composite, SWT.SMOOTH | SWT.HORIZONTAL); progressBar.setMinimum(progressBarMinimumValue); progressBar.setMaximum(progressBarMaximumValue); progressBar.setSelection(progressBarValue); final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1); progressBar.setLayoutData(gd); }
Example 4
Source File: SymitarSession.java From RepDev with GNU General Public License v3.0 | 5 votes |
/** * Helper method for runRepGen stuff * @param progress * @param value * @param text * @param str */ protected void setProgress(ProgressBar progress, int value, Text text, String str){ if( progress != null && !progress.isDisposed() ) progress.setSelection(value); if( text != null && str != null && !text.isDisposed()) text.setText(str.replace("\r", "\n")); }
Example 5
Source File: ServiceUtil.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public static int active(String licenseId, ProgressBar bar) throws Exception { boolean result = FileUtils.writeFile(new byte[] {'1','1'}, ProtectionFactory.getFileName(0, Constants.PRODUCTID)); if (!result) { return Constants.EXCEPTION_INT8; } else { FileUtils.removeFile(ProtectionFactory.getFileName(0, Constants.PRODUCTID)); } IService srvc = ServiceUtil.getService(); bar.setSelection(1); String series = ProtectionFactory.getSeries(); if (series == null || "".equals(series)) { return Constants.EXCEPTION_INT5; } byte[] serverPublicKey = srvc.getServerPublicKey(); bar.setSelection(2); IKeyGenerator gen = new KeyGeneratorImpl(); byte[] k = gen.generateKey(licenseId, series, serverPublicKey); if (k == null) { return Constants.EXCEPTION_INT9; } bar.setSelection(3); Encrypt en = ProtectionFactory.getEncrypt(); bar.setSelection(4); String str = srvc.activeLicense(StringUtils.toHexString(k), en.getPublicKey(), ProtectionFactory.getPlatform()); bar.setSelection(5); bar.setSelection(6); byte[] b = StringUtils.toBytes(str); bar.setSelection(7); b = en.decrypt(en.getPrivateKey(), b); if (b == null) { return Constants.EXCEPTION_INT7; } bar.setSelection(8); String info = new String(b); if (Constants.RETURN_INVALIDLICENSE.equals(info)) { return Constants.RETURN_INVALIDLICENSE_INT; } else if (Constants.RETURN_INVALIDBUNDLE.equals(info)) { return Constants.RETURN_INVALIDBUNDLE_INT; } else if (Constants.RETURN_DBEXCEPTION.equals(info)) { return Constants.EXCEPTION_INT13; } else if (Constants.RETURN_MUTILTEMPBUNDLE.equals(info)) { return Constants.RETURN_MUTILTEMPBUNDLE_INT; } else if (Constants.RETURN_EXPIREDLICENSE.equals(info)) { return Constants.RETURN_EXPIREDLICENSE_INT; } else if (Constants.RETURN_STOPLICENSE.equals(info)) { return Constants.RETURN_STOPLICENSE_INT; } else { result = FileUtils.writeFile(b, ProtectionFactory.getFileName(1, Constants.PRODUCTID)); if (!result) { return Constants.EXCEPTION_INT12; } bar.setSelection(9); b = InstallKeyEncrypt.encrypt(StringUtils.handle(gen.getInstallKey(), 1, 3, 2).getBytes()); if (b == null) { return Constants.EXCEPTION_INT10; } result = FileUtils.writeFile(b, ProtectionFactory.getFileName(2, Constants.PRODUCTID)); if (!result) { return Constants.EXCEPTION_INT11; } bar.setSelection(10); System.getProperties().setProperty("TSState", "true"); return Constants.ACTIVE_OK_INT; } }
Example 6
Source File: ServiceUtil.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
public static int active(String licenseId, ProgressBar bar) throws Exception { boolean result = FileUtils.writeFile(new byte[] {'1','1'}, ProtectionFactory.getFileName(0, Constants.PRODUCTID)); if (!result) { return Constants.EXCEPTION_INT8; } else { FileUtils.removeFile(ProtectionFactory.getFileName(0, Constants.PRODUCTID)); } IService srvc = ServiceUtil.getService(); bar.setSelection(1); String series = ProtectionFactory.getSeries(); if (series == null || "".equals(series)) { return Constants.EXCEPTION_INT5; } byte[] serverPublicKey = srvc.getServerPublicKey(); bar.setSelection(2); IKeyGenerator gen = new KeyGeneratorImpl(); byte[] k = gen.generateKey(licenseId, series, serverPublicKey); if (k == null) { return Constants.EXCEPTION_INT9; } bar.setSelection(3); Encrypt en = ProtectionFactory.getEncrypt(); bar.setSelection(4); String str = srvc.activeLicense(StringUtils.toHexString(k), en.getPublicKey(), ProtectionFactory.getPlatform()); bar.setSelection(5); bar.setSelection(6); byte[] b = StringUtils.toBytes(str); bar.setSelection(7); b = en.decrypt(en.getPrivateKey(), b); if (b == null) { return Constants.EXCEPTION_INT7; } bar.setSelection(8); String info = new String(b); if (Constants.RETURN_INVALIDLICENSE.equals(info)) { return Constants.RETURN_INVALIDLICENSE_INT; } else if (Constants.RETURN_INVALIDBUNDLE.equals(info)) { return Constants.RETURN_INVALIDBUNDLE_INT; } else if (Constants.RETURN_DBEXCEPTION.equals(info)) { return Constants.EXCEPTION_INT13; } else if (Constants.RETURN_MUTILTEMPBUNDLE.equals(info)) { return Constants.RETURN_MUTILTEMPBUNDLE_INT; } else if (Constants.RETURN_EXPIREDLICENSE.equals(info)) { return Constants.RETURN_EXPIREDLICENSE_INT; } else if (Constants.RETURN_STOPLICENSE.equals(info)) { return Constants.RETURN_STOPLICENSE_INT; } else { result = FileUtils.writeFile(b, ProtectionFactory.getFileName(1, Constants.PRODUCTID)); if (!result) { return Constants.EXCEPTION_INT12; } bar.setSelection(9); b = InstallKeyEncrypt.encrypt(StringUtils.handle(gen.getInstallKey(), 1, 3, 2).getBytes()); if (b == null) { return Constants.EXCEPTION_INT10; } result = FileUtils.writeFile(b, ProtectionFactory.getFileName(2, Constants.PRODUCTID)); if (!result) { return Constants.EXCEPTION_INT11; } bar.setSelection(10); System.getProperties().setProperty("TSState", "true"); return Constants.ACTIVE_OK_INT; } }