Java Code Examples for org.eclipse.swt.SWT#TITLE

The following examples show how to use org.eclipse.swt.SWT#TITLE . 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: TipOfTheDay.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Build the shell
 *
 * @param parent parent shell
 */
private void buildShell(final Shell parent) {
	shell = new Shell(parent, SWT.SYSTEM_MODAL | SWT.TITLE | SWT.BORDER | SWT.CLOSE | SWT.RESIZE);
	shell.setText(ResourceManager.getLabel(ResourceManager.TIP_OF_THE_DAY));
	shell.setLayout(new GridLayout(style == TipStyle.HEADER ? 1 : 2, false));

	shell.addListener(SWT.Traverse, event -> {
		switch (event.detail) {
			case SWT.TRAVERSE_ESCAPE:
				shell.dispose();
				event.detail = SWT.TRAVERSE_NONE;
				event.doit = false;
				break;
		}
	});
}
 
Example 2
Source File: DeviceTemplateChooser.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
public void open(DeviceTemplateClosedListener l) {
	this.listener = l;
	skinnedDialog = new SkinnedDialog("skin3_dlg_deviceadd_mfchooser",
			"shell", SWT.TITLE | SWT.BORDER);

	skinnedDialog.addCloseListener(new SkinnedDialogClosedListener() {
		@Override
		public void skinDialogClosed(SkinnedDialog dialog) {
			if (listener != null) {
				listener.deviceTemplateChooserClosed(selectedDeviceTemplate);
			}
		}
	});

	SWTSkin skin = skinnedDialog.getSkin();
	SWTSkinObject so= skin.getSkinObject("list");
	if (so instanceof SWTSkinObjectContainer) {
		SWTSkinObjectContainer soList = (SWTSkinObjectContainer) so;

		createDeviceTemplateList2(soList);
	}

	skinnedDialog.open();
}
 
Example 3
Source File: BrowserEnvironmentWarningDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * showWarningDialog
 *
 * Shows a SWT dialog warning the user that something is wrong with the browser environment.
 *
 * @param title the title on the top of the window.
 * @param message the message at the center of the screen.
 * @param helpLink a string that contains a hyperlink to a help web page.
 * @param maxTextWidth the width for the text inside the dialog.
 */
private void showWarningDialog( String title, String message, String helpLink, EnvironmentCase environment,
                                int maxTextWidth )  {
  if ( this.getParent().isDisposed() ) {
    return;
  }

  this.props = PropsUI.getInstance();
  Display display = this.getParent().getDisplay();
  shell = new Shell( this.getParent(), SWT.TITLE | SWT.APPLICATION_MODAL );
  props.setLook( shell );

  FormLayout formLayout = new FormLayout();
  formLayout.marginWidth = margin;
  formLayout.marginHeight = margin;
  shell.setLayout( formLayout ); // setting layout

  shell.setText( title ); //setting title of the window
  setWarningIcon( display ); //adding icon
  setWarningText( message, maxTextWidth ); //adding text
  setHelpLink( display, helpLink, maxTextWidth, environment ); //adding link
  setCloseButton(); //adding button

  shell.setSize( shell.computeSize( SWT.DEFAULT, SWT.DEFAULT, true ) );
  Rectangle screenSize = display.getPrimaryMonitor().getBounds();
  shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 );
  closeButton.setFocus();
  shell.open();
  while ( !shell.isDisposed() ) {
    if ( !display.readAndDispatch() ) {
      display.sleep();
    }
  }
}
 
Example 4
Source File: DataQualityShell.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private DataQualityShell(Shell parent, DQSystem system, String dqEntry) {
	super(parent, SWT.TITLE | SWT.RESIZE | SWT.CLOSE | SWT.APPLICATION_MODAL);
	this.system = system;
	this.dqEntry = dqEntry;
	setLayout(new FillLayout(SWT.HORIZONTAL));
	setText(M.PedigreeMatrix);
	setSize(830, 750);
	UI.center(parent, this);
}
 
Example 5
Source File: GamaPreferencesView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
private GamaPreferencesView(final Shell parent) {
	parentShell = parent;
	shell = new Shell(parentShell, SWT.TITLE | SWT.RESIZE | SWT.APPLICATION_MODAL);
	final GridLayout gridLayout = new GridLayout(2, false);
	gridLayout.marginWidth = gridLayout.marginHeight = 5;
	gridLayout.horizontalSpacing = gridLayout.verticalSpacing = 5;
	shell.setLayout(gridLayout);
	buildContents();
}
 
Example 6
Source File: NewTmxFileDialog.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected int getShellStyle() {
	return super.getShellStyle() | SWT.TITLE | SWT.CLOSE;
}
 
Example 7
Source File: InspectTransactionDialog.java    From offspring with MIT License 4 votes vote down vote up
@Override
protected void setShellStyle(int newShellStyle) {
  super.setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE
      | SWT.RESIZE);
  setBlockOnOpen(false);
}
 
Example 8
Source File: InspectBlockDialog.java    From offspring with MIT License 4 votes vote down vote up
@Override
protected void setShellStyle(int newShellStyle) {
  super.setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE
      | SWT.RESIZE);
  setBlockOnOpen(false);
}
 
Example 9
Source File: CalcExpDialog.java    From logbook with MIT License 4 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 */
public CalcExpDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.setText("経験値計算機");
}
 
Example 10
Source File: CaptureDialog.java    From logbook with MIT License 4 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 */
public CaptureDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.setText("キャプチャ");
}
 
Example 11
Source File: ConfigDialog.java    From logbook with MIT License 4 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 */
public ConfigDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.setText("設定");
}
 
Example 12
Source File: FailedLogonShell.java    From RepDev with GNU General Public License v3.0 4 votes vote down vote up
private void create() {
	failShell = new Shell(SWT.APPLICATION_MODAL | SWT.TITLE | SWT.CLOSE);
	failShell.setText("Invalid Password");
	failShell.setImage(RepDevMain.smallSymAddImage);
	
	FormLayout layout = new FormLayout();
	layout.marginTop = 5;
	layout.marginBottom = 5;
	layout.marginLeft = 5;
	layout.marginRight = 5;
	layout.spacing = 5;
	failShell.setLayout(layout);
	
	FailText = new Label(failShell, SWT.NONE);
	FailText.setText("Please retype your userID:");
	
	pass = new Text(failShell, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);	
	
	Button ok = new Button(failShell, SWT.PUSH);
	ok.setText("Submit");
	ok.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent e) {	
			newPass = pass.getText();
			failShell.close();
		}
	});
	
	FormData data = new FormData();
	
	data = new FormData();
	data.left = new FormAttachment(0);
	//data.right = new FormAttachment(100);
	data.top = new FormAttachment(0);
	//data.bottom = new FormAttachment();
	FailText.setLayoutData(data);
	
	data = new FormData();
	data.left = new FormAttachment(0);
	data.right = new FormAttachment(100);
	data.top = new FormAttachment(FailText);
	//data.bottom = new FormAttachment(ok);
	pass.setLayoutData(data);
	
	data = new FormData();
	data.left = new FormAttachment(0);
	//data.right = new FormAttachment(100);
	data.top = new FormAttachment(pass);
	data.bottom = new FormAttachment(100);
	ok.setLayoutData(data);
	
	failShell.setDefaultButton(ok);
	
	failShell.pack();
	failShell.open();
	
	while (!failShell.isDisposed()) {
		if (!failShell.getDisplay().readAndDispatch())
			failShell.getDisplay().sleep();
	}
}
 
Example 13
Source File: VersionDialog.java    From logbook with MIT License 4 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 */
public VersionDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.setText("バージョン情報");
}
 
Example 14
Source File: ManufacturerChooser.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
public void open(ClosedListener l) {
	this.listener = l;
	skinnedDialog = new SkinnedDialog("skin3_dlg_deviceadd_mfchooser",
			"shell", SWT.TITLE | SWT.BORDER);

	skinnedDialog.addCloseListener(new SkinnedDialogClosedListener() {
		@Override
		public void skinDialogClosed(SkinnedDialog dialog) {
			if (listener != null) {
				listener.MfChooserClosed(chosenMF);
			}
		}
	});

	SWTSkin skin = skinnedDialog.getSkin();
	SWTSkinObject so= skin.getSkinObject("list");
	if (so instanceof SWTSkinObjectContainer) {
		SWTSkinObjectContainer soList = (SWTSkinObjectContainer) so;

		Composite parent = soList.getComposite();

		Canvas centerCanvas = new Canvas(parent, SWT.NONE);
		FormData fd = Utils.getFilledFormData();
		fd.bottom = null;
		fd.height = 0;
		centerCanvas.setLayoutData(fd);


		Composite area = new Composite(parent, SWT.NONE);
		RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
		rowLayout.fill = true;
		area.setLayout(rowLayout);
		fd = Utils.getFilledFormData();
		fd.left = new FormAttachment(centerCanvas, 50, SWT.CENTER);
		fd.right = null;
		area.setLayoutData(fd);

		Listener btnListener = new Listener() {
			@Override
			public void handleEvent(Event event) {
				chosenMF = (DeviceManufacturer) event.widget.getData("mf");
				skinnedDialog.close();
			}
		};

		DeviceManager deviceManager = DeviceManagerFactory.getSingleton();
		DeviceManufacturer[] mfs = deviceManager.getDeviceManufacturers(Device.DT_MEDIA_RENDERER);
		for (DeviceManufacturer mf : mfs) {
			DeviceTemplate[] deviceTemplates = mf.getDeviceTemplates();
			boolean hasNonAuto = false;
			for (DeviceTemplate deviceTemplate : deviceTemplates) {
				if (!deviceTemplate.isAuto()) {
					hasNonAuto = true;
					break;
				}
			}
			if (!hasNonAuto) {
				continue;
			}
			Button button = new Button(area, SWT.PUSH);
			button.setText(mf.getName());
			button.setData("mf", mf);
			button.addListener(SWT.MouseUp, btnListener);
		}
	}

	skinnedDialog.getShell().pack();
	skinnedDialog.open();
}
 
Example 15
Source File: UIFunctionsImpl.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Shell showCoreWaitDlg() {
	final SkinnedDialog closeDialog = new SkinnedDialog(
			"skin3_dlg_coreloading", "coreloading.body", SWT.TITLE | SWT.BORDER
			| SWT.APPLICATION_MODAL);

	closeDialog.setTitle(MessageText.getString("dlg.corewait.title"));
	SWTSkin skin = closeDialog.getSkin();
	SWTSkinObjectButton soButton = (SWTSkinObjectButton) skin.getSkinObject("close");

	final SWTSkinObjectText soWaitTask = (SWTSkinObjectText) skin.getSkinObject("task");

	final SWTSkinObject soWaitProgress = skin.getSkinObject("progress");
	if (soWaitProgress != null) {
		soWaitProgress.getControl().addPaintListener(new PaintListener() {
			@Override
			public void paintControl(PaintEvent e) {
				Control c = (Control) e.widget;
				Point size = c.getSize();
				e.gc.setBackground(ColorCache.getColor(e.display, "#23a7df"));
				Object data = soWaitProgress.getData("progress");
				if (data instanceof Long) {
					int waitProgress = ((Long) data).intValue();
					int breakX = size.x * waitProgress / 100;
					e.gc.fillRectangle(0, 0, breakX, size.y);
					e.gc.setBackground(ColorCache.getColor(e.display, "#cccccc"));
					e.gc.fillRectangle(breakX, 0, size.x - breakX, size.y);
				}
			}
		});
	}

	if (!CoreFactory.isCoreRunning()) {
		final Initializer initializer = Initializer.getLastInitializer();
		if (initializer != null) {
			initializer.addListener(new InitializerListener() {
				@Override
				public void reportPercent(final int percent) {
					Utils.execSWTThread(new AERunnable() {
						@Override
						public void runSupport() {
							if (soWaitProgress != null && !soWaitProgress.isDisposed()) {
								soWaitProgress.setData("progress", new Long(percent));
								soWaitProgress.getControl().redraw();
								soWaitProgress.getControl().update();
							}
						}
					});
					if (percent > 100) {
						initializer.removeListener(this);
					}
				}

				@Override
				public void reportCurrentTask(String currentTask) {
					if (soWaitTask != null && !soWaitTask.isDisposed()) {
						soWaitTask.setText(currentTask);
					}
				}
			});
		}
	}

	if (soButton != null) {
		soButton.addSelectionListener(new ButtonListenerAdapter() {
			@Override
			public void pressed(SWTSkinButtonUtility buttonUtility,
			                    SWTSkinObject skinObject, int stateMask) {
				closeDialog.close();
			}
		});
	}

	closeDialog.addCloseListener(new SkinnedDialogClosedListener() {
		@Override
		public void skinDialogClosed(SkinnedDialog dialog) {
		}
	});

	closeDialog.open();
	return closeDialog.getShell();
}
 
Example 16
Source File: TipDayEx.java    From SWET with MIT License 4 votes vote down vote up
public void open(final Shell parent, Display... parentDisplay) {
	if (TipDayEx.index == -1) {
		TipDayEx.index = new Random().nextInt(this.tips.size());
	}
	this.shell = new Shell(parent,
			SWT.SYSTEM_MODAL | SWT.TITLE | SWT.BORDER | SWT.CLOSE | SWT.RESIZE);
	this.shell.setText("Tip of the day");
	this.shell.setLayout(new GridLayout(2, false));

	this.shell.addListener(SWT.Traverse, new Listener() {
		@Override
		public void handleEvent(final Event event) {
			switch (event.detail) {
			case SWT.TRAVERSE_ESCAPE:
				TipDayEx.this.shell.dispose();
				event.detail = SWT.TRAVERSE_NONE;
				event.doit = false;
				break;
			}
		}
	});
	buildLeftColumn();
	buildTip();
	buildButtons();

	this.shell.setDefaultButton(this.buttonClose);
	this.shell.pack();
	this.shell.open();

	if (parentDisplay != null) {
		display = parentDisplay[0];
	} else {

		display = this.shell.getDisplay();
	}
	Monitor primary = display.getPrimaryMonitor();
	Rectangle bounds = primary.getBounds();
	Rectangle rect = shell.getBounds();

	int x = bounds.x + (bounds.width - rect.width) / 2;
	int y = bounds.y + (bounds.height - rect.height) / 2;

	shell.setLocation(x, y);

	while (!this.shell.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 17
Source File: LoginDialog.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Build the shell
 */
private void buildShell() {
	shell = new Shell(SWT.SYSTEM_MODAL | SWT.TITLE | SWT.BORDER);
	shell.setText(ResourceManager.getLabel(ResourceManager.LOGIN));
	shell.setLayout(new GridLayout(4, false));
}
 
Example 18
Source File: TimerSettingDialog.java    From logbook with MIT License 2 votes vote down vote up
/**
 * Create the dialog.
 *
 * @param parent
 */
public TimerSettingDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.setText("タイマー設定の追加");
}
 
Example 19
Source File: CreatePacFileDialog.java    From logbook with MIT License 2 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 */
public CreatePacFileDialog(Shell parent) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
}
 
Example 20
Source File: ShipFilterDialog.java    From logbook with MIT License 2 votes vote down vote up
/**
 * Create the dialog.
 *
 * @param parent シェル
 * @param updateFunction フィルター適用関数
 * @param supplier フィルター供給関数
 */
public ShipFilterDialog(Shell parent, Consumer<ShipFilterDto> updateFunction, Supplier<ShipFilterDto> supplier) {
    super(parent, SWT.CLOSE | SWT.TITLE | SWT.MIN | SWT.RESIZE);
    this.update = updateFunction;
    this.supplier = supplier;
}