本文整理汇总了Java中org.eclipse.swt.widgets.Shell类的典型用法代码示例。如果您正苦于以下问题:Java Shell类的具体用法?Java Shell怎么用?Java Shell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Shell类属于org.eclipse.swt.widgets包,在下文中一共展示了Shell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CustomAboutDialog
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
/**
* Create an instance of the AboutDialog for the given window.
*
* @param parentShell
* The parent of the dialog.
*/
public CustomAboutDialog(Shell parentShell) {
super(parentShell);
this.parentShell = parentShell;
setShellStyle(SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.WRAP);
product = Platform.getProduct();
if (product != null) {
productName = product.getName();
}
if (productName == null) {
productName = WorkbenchMessages.AboutDialog_defaultProductName;
}
// setDialogHelpAvailable(true);
}
示例2: getInitialLocation
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
/**
* Returns the initial location to use for the shell. The default implementation centers the shell horizontally (1/2
* of the difference to the left and 1/2 to the right) and vertically (1/3 above and 2/3 below) relative to the
* active workbench windows shell, or display bounds if there is no parent shell.
*
* @param shell
* the shell which initial location has to be calculated.
* @param initialSize
* the initial size of the shell, as returned by <code>getInitialSize</code>.
* @return the initial location of the shell
*/
public static Point getInitialLocation(final Shell shell, final Point initialSize) {
final Composite parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if (parent != null) {
monitor = parent.getMonitor();
}
final Rectangle monitorBounds = monitor.getClientArea();
Point centerPoint;
if (parent != null) {
centerPoint = Geometry.centerPoint(parent.getBounds());
} else {
centerPoint = Geometry.centerPoint(monitorBounds);
}
return new Point(centerPoint.x - (initialSize.x / 2), Math.max(
monitorBounds.y, Math.min(centerPoint.y
- (initialSize.y * 2 / 3), monitorBounds.y
+ monitorBounds.height - initialSize.y)));
}
示例3: openShell
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
public static void openShell(String format, int weight, int height, Function<Shell, Control> function) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setSize(weight, height);
shell.setLayout(new FillLayout());
function.apply(shell);
shell.open();
while(!shell.isDisposed()) {
if(!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
示例4: doProgressTask
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
public static void doProgressTask(final Shell s, final ProgressTask t) {
SWTAsync.slow(new SWTAsync("doProgressTask") {
public void task() {
ProgressDialog p = new ProgressDialog(s, t);
t.setProgress(p);
p.open();
p.getShell().setText(t.getName()); //$NON-NLS-1$
// pd.taskLabel.setText("taskLabel");
// pd.messageLabel.setText("messageLabel");
p.runTask();
}
});
}
示例5: SelectAnyEObjectDialog
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
public SelectAnyEObjectDialog(Shell parent, ResourceSet resourceSet, ILabelProvider renderer) {
super(parent, renderer);
_searchedResourceSet = resourceSet;
ArrayList<EObject> all = new ArrayList<EObject>();
EcoreUtil.resolveAll(resourceSet);
for (Resource r : _searchedResourceSet.getResources())
{
for (TreeIterator<EObject> iterator = r.getAllContents(); iterator.hasNext();) {
EObject o = iterator.next();
if(select(o)) all.add(o);
}
}
Object[] elements = all.toArray();
this.setElements(elements);
}
示例6: ParameterGridDialog
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
/**
* Create the dialog.
* @param parentShell
*/
public ParameterGridDialog(Shell parentShell) {
super(parentShell);
setShellStyle(SWT.CLOSE | SWT.RESIZE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL);
runGraph=false;
lastRowLastColumnTraverseListener=new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if(e.detail == SWT.TRAVERSE_TAB_NEXT)
addRowToTextGrid();
}
};
}
示例7: run
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
@Override
public void run() {
if (GenerationUtils.validate(containerName)) {
Shell shell = Display.getDefault().getActiveShell();
boolean confirm = MessageDialog.openQuestion(shell, "Confirm Create", "Existing Files will be cleared. Do you wish to continue?");
if (confirm) {
wsRoot = ResourcesPlugin.getWorkspace().getRoot();
names = StringUtils.split(containerName, "/");
wsRootRes = wsRoot.findMember(new Path("/" + names[0]));
prj = wsRootRes.getProject();
steps = prj.getFolder("target/Steps");
File root = new File(steps.getLocation().toOSString());
if (root.exists()) {
GenerationUtils.clearCreatedFolders(root);
}
for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
} catch (CoreException e) {
}
}
}
}
}
示例8: createShell
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
@Override
protected Shell createShell(Display display) throws Exception {
this.model = new MultiStepModel();
Shell shell = new Shell(display);
shell.setText("Multi-Step");
shell.setLayout(new GridLayout(1, false));
this.ui = new MultiStepComposite(shell, SWT.NONE);
this.controller = BeanService.getInstance().createController(ui, model);
controller.beanToUI();
controller.switchState(true);
this.service = new MockScannableConnector(null);
AnnotationManager manager = new AnnotationManager(Inject.class);
manager.addDevices(ui);
manager.invoke(Inject.class, service, model);
shell.pack();
shell.setSize(500, 500);
shell.open();
return shell;
}
示例9: createShell
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
@Override
protected Shell createShell(Display display) throws Exception {
this.viewer = new ScannableViewer();
Shell shell = new Shell(display);
shell.setText("Monitors");
shell.setLayout(new GridLayout(1, false));
viewer.createPartControl(shell);
shell.pack();
shell.setSize(500, 500);
shell.open();
return shell;
}
示例10: setupControls
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
/**
* Find controls within a part, set it up to be used by iTrace,
* and extract meta-data from it.
*
* @param partRef partRef that just became visible.
*/
private void setupControls(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(true);
Control control = part.getAdapter(Control.class);
//set up manager for control and managers for each child control if necessary
if (control != null) {
setupControls(part, control);
} else {
//Browser - always set up browser managers, no matter the partRef that
//has become visible
//not possible to get Browser control from a partRef
Shell workbenchShell = partRef.getPage().getWorkbenchWindow().getShell();
for (Control ctrl: workbenchShell.getChildren()) {
setupBrowsers(ctrl);
}
}
}
示例11: show
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
/**
* Build and show the Windows, dispose it after is is not longer needed.
* @param parentShell The parent windows' Shell.
* @param classLoader The system MugglClassLoader.
*/
public void show(Shell parentShell, MugglClassLoader classLoader) {
try {
this.display = Display.getDefault();
createShell(parentShell, classLoader);
this.shell.open();
while (!this.shell.isDisposed()) {
if (!this.display.readAndDispatch())
this.display.sleep();
}
} catch (Throwable t) {
t.printStackTrace();
StaticGuiSupport.processGuiError(t, "options", parentShell);
} finally {
doExit();
}
}
示例12: renderTransparency
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
private void renderTransparency(final Shell shell) {
Group group = new Group(shell, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 6, 1));
group.setLayout(new GridLayout(1, false));
group.setText("Transparency");
final Scale transparencySlider = new Scale(group, SWT.HORIZONTAL);
transparencySlider.setMinimum(20);
transparencySlider.setMaximum(100);
transparencySlider.setPageIncrement(90);
transparencySlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
transparencySlider.setSelection(100);
transparencySlider.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
shell.setAlpha(255 * transparencySlider.getSelection() / 100);
}
});
}
示例13: notifyError
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
/**
* Notify error using message box (thread safe).
* @param message The message to display
* @param error The error that occurred
*/
public void notifyError ( final String message, final Throwable error )
{
final Display display = getWorkbench ().getDisplay ();
if ( !display.isDisposed () )
{
display.asyncExec ( new Runnable () {
@Override
public void run ()
{
final Shell shell = getWorkbench ().getActiveWorkbenchWindow ().getShell ();
logger.debug ( "Shell disposed: {}", shell.isDisposed () );
if ( !shell.isDisposed () )
{
final IStatus status = new OperationStatus ( IStatus.ERROR, PLUGIN_ID, 0, message + ":" + error.getMessage (), error );
ErrorDialog.openError ( shell, null, message, status );
}
}
} );
}
}
示例14: attachButtonListner
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
private void attachButtonListner(Button selectKeysButton) {
selectKeysButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String buttonText = Messages.UPDATE_KEYS_WINDOW_LABEL;
FieldDialog fieldDialog = new FieldDialog(new Shell(), propertyDialogButtonBar);
fieldDialog.setComponentName(buttonText);
fieldDialog.setSourceFieldsFromPropagatedSchema(getPropagatedSchema());
if(StringUtils.isNotBlank(updateByKeysTextBox.getText())){
fieldDialog.setPropertyFromCommaSepratedString(updateByKeysTextBox.getText());
}
fieldDialog.open();
String valueForNewTableTextBox = fieldDialog.getResultAsCommaSeprated();
if(valueForNewTableTextBox !=null){
updateByKeysTextBox.setText(valueForNewTableTextBox);
}
showHideErrorSymbol(widgets);
}
});
}
示例15: EntryEditDialog
import org.eclipse.swt.widgets.Shell; //导入依赖的package包/类
public EntryEditDialog ( final Shell shell, final Map.Entry<?, ?> entry )
{
super ( shell );
this.entry = new ConfigurationEntry ();
if ( entry == null )
{
this.createMode = true;
this.entry.setKey ( "" );
this.entry.setValue ( "" );
}
else
{
this.entry.setKey ( "" + entry.getKey () );
this.entry.setValue ( "" + entry.getValue () );
this.createMode = false;
}
}