org.eclipse.swt.widgets.ProgressBar Java Examples

The following examples show how to use org.eclipse.swt.widgets.ProgressBar. 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: ProgressDialogEx.java    From SWET with MIT License 6 votes vote down vote up
public ProgressController(Composite parent, int style) {
	this.parent = parent;
	display = Display.getCurrent();

	progressTitle = new Label(parent, SWT.NONE);
	progressTitle.setText("Progress");
	GridData titleData = new GridData();
	titleData.horizontalAlignment = GridData.BEGINNING;
	titleData.grabExcessHorizontalSpace = true;
	progressTitle.setLayoutData(titleData);

	progressValue = new Label(parent, SWT.NONE);
	progressValue.setText("0%");
	GridData valueData = new GridData();
	valueData.horizontalAlignment = GridData.END;
	progressValue.setLayoutData(valueData);

	progressBar = new ProgressBar(parent, style);
	GridData progressData = new GridData();
	progressData.horizontalAlignment = GridData.FILL;
	progressData.horizontalSpan = 2;
	progressData.grabExcessHorizontalSpace = true;
	progressBar.setLayoutData(progressData);

}
 
Example #2
Source File: AZProgressBar.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 * @param parent
 * @param isIndeterminate
 * @param useInputButton determines whether the <code>inputButton</code> is available or not
 * @param image an <code>Image</code> to display; may be null
 */
public AZProgressBar(Composite parent, boolean isIndeterminate) {
	super(parent, SWT.NULL);

	incrementalProgressBar = new ProgressBar(this, SWT.HORIZONTAL);
	indeterminateProgressBar = new ProgressBar(this, SWT.HORIZONTAL
			| SWT.INDETERMINATE);

	stack = new StackLayout();
	setLayout(stack);
	pack();

	visible = super.isVisible();
	
	setIndeterminate(isIndeterminate);
}
 
Example #3
Source File: LicenseManageDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
private void createBarComp(Composite parent) {
	Composite barComp = new Composite(parent, SWT.NONE);
	GridLayout barLayout = new GridLayout();
	barLayout.marginTop = 10;
	barComp.setLayout(barLayout);
	barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	label4 = new Label(barComp, SWT.NONE);
	label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	bar = new ProgressBar(barComp, SWT.NONE);
	bar.setMaximum(10);
	bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	setVisible(false);
}
 
Example #4
Source File: XLIFFEditorStatusLineItemWithProgressBar.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
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 #5
Source File: LicenseManageDialog.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private void createBarComp(Composite parent) {
	Composite barComp = new Composite(parent, SWT.NONE);
	GridLayout barLayout = new GridLayout();
	barLayout.marginTop = 10;
	barComp.setLayout(barLayout);
	barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	label4 = new Label(barComp, SWT.NONE);
	label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	bar = new ProgressBar(barComp, SWT.NONE);
	bar.setMaximum(10);
	bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	setVisible(false);
}
 
Example #6
Source File: ProgressBarDemo.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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 #7
Source File: MessageArea.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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 #8
Source File: SimulationPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createProgressSection(FormToolkit toolkit, Composite body) {
	progressSection = UI.section(body, toolkit, M.Progress);
	Composite composite = UI.sectionClient(progressSection, toolkit);
	progressBar = new ProgressBar(composite, SWT.SMOOTH);
	progressBar.setMaximum(editor.setup.numberOfRuns);
	UI.gridData(progressBar, false, false).widthHint = 470;
	Button progressButton = toolkit.createButton(composite,
			M.Start, SWT.NONE);
	UI.gridData(progressButton, false, false).widthHint = 70;
	new SimulationControl(progressButton, editor, this);
}
 
Example #9
Source File: TestingSymitarSession.java    From RepDev with GNU General Public License v3.0 5 votes vote down vote up
@Override
public RunRepgenResult runRepGen(String name, int queue, ProgressBar progress, Text text, PromptListener prompter) {
	setProgress(progress, 50, text, "Answer Prompts");
	prompter.getPrompt("Test");
	setProgress(progress, 100, text, "Error");
	return new RunRepgenResult(-1,0);
}
 
Example #10
Source File: SymitarSession.java    From RepDev with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 #11
Source File: ExcelExportProgessBar.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void open(int minValue, int maxValue) {
	childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	childShell.setText("Exporting to Excel.. please wait");

	progressBar = new ProgressBar(childShell, SWT.SMOOTH);
	progressBar.setMinimum(minValue);
	progressBar.setMaximum(maxValue);
	progressBar.setBounds(0, 0, 400, 25);
	progressBar.setFocus();

	childShell.pack();
	childShell.open();
}
 
Example #12
Source File: ProgressIndicator.java    From offspring with MIT License 5 votes vote down vote up
/**
 * Create a ProgressIndicator as a child under the given parent.
 * 
 * @param parent
 *          The widgets parent
 * @param style
 *          the SWT style constants for progress monitors created by the
 *          receiver.
 * @since 3.4
 */
public ProgressIndicator(Composite parent, int style) {
  super(parent, SWT.NULL);

  // Enforce horizontal only if vertical isn't set
  if ((style & SWT.VERTICAL) == 0)
    style |= SWT.HORIZONTAL;

  determinateProgressBar = new ProgressBar(this, style);
  indeterminateProgressBar = new ProgressBar(this, style | SWT.INDETERMINATE);
  layout = new StackLayout();
  setLayout(layout);
}
 
Example #13
Source File: ExcelExportProgessBar.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void open(int minValue, int maxValue) {
	childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
	childShell.setText("Exporting to Excel.. please wait");

	progressBar = new ProgressBar(childShell, SWT.SMOOTH);
	progressBar.setMinimum(minValue);
	progressBar.setMaximum(maxValue);
	progressBar.setBounds(0, 0, 400, 25);
	progressBar.setFocus();

	childShell.pack();
	childShell.open();
}
 
Example #14
Source File: ProgressBarDialog.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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.SMOOTH);
       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);
       
       taskLabel = new Label(container, SWT.NONE);
       taskLabel.setAlignment(SWT.CENTER);
       GridData gd_taskLabel = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
       gd_taskLabel.heightHint = 15;
       gd_taskLabel.minimumWidth = 250;
       taskLabel.setLayoutData(gd_taskLabel);
       taskLabel.setSize(250, 40);
       
	return container;
}
 
Example #15
Source File: MainView.java    From mappwidget with Apache License 2.0 5 votes vote down vote up
private void setCompliete(Composite top, final Button runButton, final ProgressBar progressBar)
{
	top.getDisplay().asyncExec(new Runnable()
	{
		@Override
		public void run()
		{
			runButton.setEnabled(true);
		}
	});
}
 
Example #16
Source File: MainView.java    From mappwidget with Apache License 2.0 5 votes vote down vote up
private void setValue(Composite top, final ProgressBar progressBar, final int value)
{
	top.getDisplay().asyncExec(new Runnable()
	{
		@Override
		public void run()
		{
			progressBar.setSelection(value);
		}
	});
}
 
Example #17
Source File: MetricDisplay.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {

	setTitleImage(null);
	setTitle("Metric informations");
	Composite area = (Composite) super.createDialogArea(parent);
	area.setLayout(new GridLayout(1, false));

	Composite textContainer = new Composite(area, SWT.NONE);
	textContainer.setLayout(new FillLayout(SWT.HORIZONTAL));
	textContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));

	table = new Table(textContainer, SWT.BORDER | SWT.FULL_SELECTION);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);

	TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn.setWidth(300);
	tblclmnNewColumn.setText("ID");

	TableColumn tblclmnNewColumn_1 = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn_1.setWidth(100);
	tblclmnNewColumn_1.setText("Value");
	
	TableColumn tblclmnNewColumn_2 = new TableColumn(table, SWT.NONE);
	tblclmnNewColumn_2.setWidth(300);
	tblclmnNewColumn_2.setText("Description");
	

	progressBar = new ProgressBar(area, SWT.SMOOTH);
	progressBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

	refreshMetrics();

	return area;
}
 
Example #18
Source File: ProgressModal.java    From Universal-FE-Randomizer with MIT License 4 votes vote down vote up
public ProgressModal(Shell parent, String title) {
	display = Display.getDefault();
	yuneImage = new Image(display, Main.class.getClassLoader().getResourceAsStream("YuneIcon_100x100.png"));
	
	dialogShell = new Shell(parent, SWT.PRIMARY_MODAL | SWT.DIALOG_TRIM);
	dialogShell.setText(title);
	dialogShell.setImage(yuneImage);
	
	progressBar = new ProgressBar(dialogShell, SWT.SMOOTH);
	
	FormLayout mainLayout = new FormLayout();
	mainLayout.marginWidth = 5;
	mainLayout.marginHeight = 5;
	dialogShell.setLayout(mainLayout);
	
	imageLabel = new Label(dialogShell, SWT.NONE);
	imageLabel.setImage(yuneImage);
	
	FormData imageData = new FormData(100, 100);
	imageData.left = new FormAttachment(0, 10);
	imageData.top = new FormAttachment(0, 10);
	imageData.bottom = new FormAttachment(100, -10);
	imageLabel.setLayoutData(imageData);
	
	FormData progressData = new FormData(300, 20);
	progressData.left = new FormAttachment(imageLabel, 10);
	progressData.bottom = new FormAttachment(imageLabel, -50, SWT.CENTER);
	progressData.right = new FormAttachment(100, -10);
	progressBar.setLayoutData(progressData);
	
	statusLabel = new Label(dialogShell, SWT.NONE);
	
	FormData statusData = new FormData();
	statusData.left = new FormAttachment(progressBar, 0, SWT.LEFT);
	statusData.top = new FormAttachment(progressBar, 5);
	statusData.right = new FormAttachment(100, -10);
	statusLabel.setLayoutData(statusData);
	
	dialogShell.layout();
	final Point newSize = dialogShell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	dialogShell.setSize(newSize);
	
	Rectangle parentBounds = parent.getBounds();
	Rectangle dialogBounds = dialogShell.getBounds();
	
	dialogShell.setLocation(parentBounds.x + (parentBounds.width - dialogBounds.width) / 2, parentBounds.y + (parentBounds.height - dialogBounds.height) / 2);
}
 
Example #19
Source File: SplashScreen.java    From ldparteditor with MIT License 4 votes vote down vote up
@Override
protected Control createContents(final Composite parent) {

    final Color bgColor = SWTResourceManager.getColor(SWT.COLOR_WHITE);
    final Composite frame = new Composite(parent, SWT.NONE);
    final FormData titleData = new FormData();
    final FormData statusData = new FormData();
    final FormLayout layout = new FormLayout();
    final Label titleLabel = new Label(frame, SWT.NONE);
    final Label statusLabel = new Label(frame, SWT.NONE);
    final ProgressBar bar = new ProgressBar(frame, SWT.NONE);
    final FormData barData = new FormData();

    bar.setMaximum(100);

    titleLabel.setText(Version.getApplicationName() + " " + Version.getVersion() + "\n" + Version.getStage() + "\n(C) " + Version.getDevelopmentLead()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

    titleLabel.setBackground(bgColor);
    bar.setBackground(bgColor);
    statusLabel.setBackground(bgColor);

    frame.setLayout(layout);
    frame.setBackgroundImage(ResourceManager.getImage("imgSplash.png")); //$NON-NLS-1$

    barData.left = new FormAttachment(15, 5);
    barData.right = new FormAttachment(100, -5);
    barData.bottom = new FormAttachment(100, -5);
    bar.setLayoutData(barData);

    titleData.left = new FormAttachment(45, 5);
    titleData.right = new FormAttachment(100, 0);
    titleData.top = new FormAttachment(50, 0);
    titleLabel.setLayoutData(titleData);

    statusData.left = new FormAttachment(15, 5);
    statusData.right = new FormAttachment(100, 0);
    statusData.top = new FormAttachment(80, 0);
    statusLabel.setLayoutData(statusData);

    this.bar = bar;
    this.label = statusLabel;

    return frame;
}
 
Example #20
Source File: ProgressComposite.java    From neoscada with Eclipse Public License 1.0 4 votes vote down vote up
public ProgressComposite ( final Composite parent, final int style, final DataItemDescriptor descriptor, final String format, final String decimal, final String attribute, final double max, final double min, final double factor, final int width, final String hdConnectionId, final String hdItemId, final String queryString )
{
    super ( parent, style, format, decimal, false, attribute );

    if ( max != 0 )
    {
        this.max = max;
    }

    if ( min != 0 )
    {
        this.min = min;
    }

    if ( factor != 0 )
    {
        this.factor = factor;
    }

    if ( width > 0 )
    {
        this.width = width;
    }

    addDisposeListener ( new DisposeListener () {

        @Override
        public void widgetDisposed ( final DisposeEvent e )
        {
            ProgressComposite.this.handleDispose ();
        }
    } );

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.progressWidth = this.width - this.textWidth - layout.spacing;
    if ( this.progressWidth < 1 )
    {
        this.progressWidth = 1;
    }

    this.controlImage = new ControlImage ( this, this.registrationManager );
    Helper.createTrendButton ( this.controlImage, hdConnectionId, hdItemId, queryString );

    this.progressBar = new ProgressBar ( this, SWT.NONE );
    //        this.progressBar.setSize ( this.progressWidth, this.textHeight );
    final RowData progressData = new RowData ( this.progressWidth, SWT.DEFAULT );
    this.progressBar.setLayoutData ( progressData );
    final int minimum = (int)Math.round ( this.min );
    final int maximum = (int)Math.round ( this.max );
    this.progressBar.setMinimum ( minimum );
    this.progressBar.setMaximum ( maximum );

    this.text = new Text ( this, SWT.MULTI | SWT.WRAP | SWT.RIGHT );
    //        final RowData rowData = new RowData ( 60, SWT.DEFAULT );
    //        this.font = new Font ( getDisplay (), new FontData ( "Arial", 10, 0 ) ); //$NON-NLS-1$
    //        this.text.setFont ( this.font );
    final RowData rowData = new RowData ( this.textWidth, this.textHeight );
    //        this.dataText.setAlignment ( SWT.RIGHT );
    this.text.setLayoutData ( rowData );
    this.text.setEnabled ( true );
    this.text.setEditable ( false );

    this.text.setText ( "" ); //$NON-NLS-1$
    new DescriptorLabel ( this, SWT.NONE, format, descriptor );

    if ( descriptor != null )
    {
        this.controlImage.setDetailItem ( descriptor.asItem () );
        this.registrationManager.registerItem ( "value", descriptor.getItemId (), descriptor.getConnectionInformation (), false, false ); //$NON-NLS-1$
    }
}
 
Example #21
Source File: PlayerInstallWindow.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public void open() {

		box = new VuzeMessageBox("","", null, 0);
		box.setSubTitle(MessageText.getString("dlg.player.install.subtitle"));
		box.addResourceBundle(PlayerInstallWindow.class,
				SkinPropertiesImpl.PATH_SKIN_DEFS, "skin3_dlg_register");
		box.setIconResource("image.player.dlg.header");

		this.progressText = MessageText.getString("dlg.player.install.description");

		box.setListener(new VuzeMessageBoxListener() {

			@Override
			public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
				SWTSkin skin = soExtra.getSkin();
				skin.createSkinObject("dlg.register.install", "dlg.register.install",
						soExtra);

				SWTSkinObjectContainer soProgressBar = (SWTSkinObjectContainer) skin.getSkinObject("progress-bar");
				if (soProgressBar != null) {
					progressBar = new ProgressBar(soProgressBar.getComposite(),
							SWT.HORIZONTAL);
					progressBar.setMinimum(0);
					progressBar.setMaximum(100);
					progressBar.setLayoutData(Utils.getFilledFormData());
				}

				soInstallPct = (SWTSkinObjectText) skin.getSkinObject("install-pct");

				soProgressText = (SWTSkinObjectText) skin.getSkinObject("progress-text");
				if (soProgressText != null && progressText != null) {
					soProgressText.setText(progressText);
				}
			}
		});

		box.open(new UserPrompterResultListener() {
			@Override
			public void prompterClosed(int result) {
				installer.setListener(null);
				installer.cancel();
			}
		});
	}
 
Example #22
Source File: StaticHTMLController.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void setViewer( IViewer viewer )
{
	this.viewer = viewer;

	if ( !( viewer instanceof AbstractViewer ) )
	{
		return;
	}

	Composite viewerUI = (Composite) ( (SWTAbstractViewer) viewer ).getUI( );

	if ( viewerUI == null )
	{
		return;
	}
	pane = new Composite( viewerUI, SWT.NONE );
	pane.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_FILL ) );

	RowLayout rowLayout = new RowLayout( );
	rowLayout.type = SWT.HORIZONTAL;
	rowLayout.spacing = 5;
	pane.setLayout( rowLayout );

	for ( Iterator iter = buttons.iterator( ); iter.hasNext( ); )
	{
		ButtonInfo buttonInfo = (ButtonInfo) iter.next( );
		Button button = new Button( pane, SWT.PUSH );

		button.setText( buttonInfo.text );
		button.setToolTipText( buttonInfo.toolTip );
		if ( buttonInfo.selectionListener != null )
		{
			button.addSelectionListener( buttonInfo.selectionListener );
		}
	}

	GridData gd = new GridData( GridData.END, GridData.CENTER, false, false );
	gd.heightHint = 10;
	gd.widthHint = 100;
	progressBar = new ProgressBar( viewerUI, SWT.INDETERMINATE );
	progressBar.setLayoutData( gd );
	setBusy( true );
}
 
Example #23
Source File: SimplePluginInstallWindow.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public void open() {

		box = new VuzeMessageBox("","", null, 0);
		box.setSubTitle(MessageText.getString( resource_prefix + ".subtitle" ));
		box.addResourceBundle(SimplePluginInstallWindow.class,
				SkinPropertiesImpl.PATH_SKIN_DEFS, "skin3_dlg_register");
		box.setIconResource( resource_prefix + ".image" );

		this.progressText = MessageText.getString( resource_prefix + ".description" );

		box.setListener(new VuzeMessageBoxListener() {

			@Override
			public void shellReady(Shell shell, SWTSkinObjectContainer soExtra) {
				SWTSkin skin = soExtra.getSkin();
				skin.createSkinObject("dlg.register.install", "dlg.register.install",
						soExtra);

				SWTSkinObjectContainer soProgressBar = (SWTSkinObjectContainer) skin.getSkinObject("progress-bar");
				if (soProgressBar != null) {
					progressBar = new ProgressBar(soProgressBar.getComposite(),
							SWT.HORIZONTAL);
					progressBar.setMinimum(0);
					progressBar.setMaximum(100);
					progressBar.setLayoutData(Utils.getFilledFormData());
				}

				soInstallPct = (SWTSkinObjectText) skin.getSkinObject("install-pct");

				soProgressText = (SWTSkinObjectText) skin.getSkinObject("progress-text");
				if (soProgressText != null && progressText != null) {
					soProgressText.setText(progressText);
				}
			}
		});

		box.open(new UserPrompterResultListener() {
			@Override
			public void prompterClosed(int result) {
				installer.setListener(null);
				try {
					installer.cancel();
				} catch (Exception e) {
					Debug.out(e);
				}
			}
		});
	}
 
Example #24
Source File: ServiceUtil.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
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 #25
Source File: SWTIndeterminateProgressBar.java    From tuxguitar with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SWTIndeterminateProgressBar(SWTContainer<? extends Composite> parent) {
	super(new ProgressBar(parent.getControl(), SWT.BORDER | SWT.HORIZONTAL | SWT.SMOOTH | SWT.INDETERMINATE), parent);
}
 
Example #26
Source File: TmxFileValidator.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void setProgressBar(ProgressBar progressBar) {
	this.progressBar = progressBar;
}
 
Example #27
Source File: TmxFileValidator.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public ProgressBar getProgressBar() {
	return progressBar;
}
 
Example #28
Source File: TmxScanner.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void setProgressBar(ProgressBar progressBar) {
	this.progressBar = progressBar;
}
 
Example #29
Source File: LogProgress.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
public static ProgressBar getProgressBar() {
	return _bar;
}
 
Example #30
Source File: LogProgress.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
public static void registerProgressBar(ProgressBar bar) {
	_bar = bar;
}