当前位置: 首页>>代码示例>>Java>>正文


Java Shell类代码示例

本文整理汇总了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);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:22,代码来源:CustomAboutDialog.java

示例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)));
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:UIUtils.java

示例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();
  }
 
开发者ID:TRUEJASONFANS,项目名称:JavaFX-FrameRateMeter,代码行数:21,代码来源:SWTTestUtil.java

示例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();

        }
    });
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:18,代码来源:ProgressDialog.java

示例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);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:17,代码来源:SelectAnyEObjectDialog.java

示例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();
		}
	};
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:21,代码来源:ParameterGridDialog.java

示例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) {
				}
			}
		}
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:25,代码来源:ClearTargetAction.java

示例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;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:26,代码来源:MultiStepCompositeTest.java

示例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;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:17,代码来源:ScannableViewerTest2.java

示例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);
    	}
    }
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:23,代码来源:ControlView.java

示例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();
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:23,代码来源:OptionsWindow.java

示例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);
		}
	});
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:20,代码来源:FindReplaceDialog.java

示例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 );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:Activator.java

示例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);
		}
	});
	
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:24,代码来源:UpdateByKeysWidget.java

示例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;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:EntryEditDialog.java


注:本文中的org.eclipse.swt.widgets.Shell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。