Java Code Examples for org.eclipse.swt.widgets.Shell

The following are top voted examples for showing how to use org.eclipse.swt.widgets.Shell. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Hydrograph   File: CustomAboutDialog.java   View source code 6 votes vote down vote up
/**
 * 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);
}
 
Example 2
Project: n4js   File: UIUtils.java   View source code 6 votes vote down vote up
/**
 * 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)));
}
 
Example 3
Project: JavaFX-FrameRateMeter   File: SWTTestUtil.java   View source code 6 votes vote down vote up
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();
  }
 
Example 4
Project: openaudible   File: ProgressDialog.java   View source code 6 votes vote down vote up
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();

        }
    });
}
 
Example 5
Project: gemoc-studio-modeldebugging   File: SelectAnyEObjectDialog.java   View source code 6 votes vote down vote up
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);
}
 
Example 6
Project: Hydrograph   File: ParameterGridDialog.java   View source code 6 votes vote down vote up
/**
 * 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();
		}
	};
	
}
 
Example 7
Project: Open_Source_ECOA_Toolset_AS5   File: ClearTargetAction.java   View source code 6 votes vote down vote up
@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) {
				}
			}
		}
	}
}
 
Example 8
Project: scanning   File: MultiStepCompositeTest.java   View source code 6 votes vote down vote up
@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;
}
 
Example 9
Project: scanning   File: ScannableViewerTest2.java   View source code 6 votes vote down vote up
@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;
}
 
Example 10
Project: iTrace-Archive   File: ControlView.java   View source code 6 votes vote down vote up
/**
 * 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);
    	}
    }
}
 
Example 11
Project: tap17-muggl-javaee   File: OptionsWindow.java   View source code 6 votes vote down vote up
/**
 * 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();
	}
}
 
Example 12
Project: pmTrans   File: FindReplaceDialog.java   View source code 6 votes vote down vote up
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);
		}
	});
}
 
Example 13
Project: neoscada   File: Activator.java   View source code 6 votes vote down vote up
/**
 * 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 );
                }
            }
        } );
    }
}
 
Example 14
Project: Hydrograph   File: UpdateByKeysWidget.java   View source code 6 votes vote down vote up
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);
		}
	});
	
}
 
Example 15
Project: neoscada   File: EntryEditDialog.java   View source code 6 votes vote down vote up
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;
    }
}
 
Example 16
Project: Hydrograph   File: WidgetUtility.java   View source code 5 votes vote down vote up
/**
 * Error message.
 * 
 * @param message
 *            the message
 */
public static void errorMessage(String message) {
	Shell shell = new Shell();
	MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
	messageBox.setText(ERROR);
	messageBox.setMessage(message);
	messageBox.open();
}
 
Example 17
Project: Hydrograph   File: ELTGraphicalEditor.java   View source code 5 votes vote down vote up
public void saveParameters() {

		//get map from file
		Map<String,String> currentParameterMap = getCurrentParameterMap();
		if(currentParameterMap == null){
			return;
		}
		List<String> letestParameterList = getLatestParameterList();

		Map<String,String> newParameterMap = new LinkedHashMap<>();

		for(int i=0;i<letestParameterList.size();i++){
			newParameterMap.put(letestParameterList.get(i), "");
		}

		for(String parameterName : currentParameterMap.keySet()){
			newParameterMap.put(parameterName, currentParameterMap.get(parameterName));
		}

		try {
			ParameterFileManager.getInstance().storeParameters(newParameterMap,null, getParameterFile());
		} catch (IOException e) {
			logger.error("Unable to store parameters to the file", e);

			MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK );
			messageBox.setText("Error");
			messageBox.setMessage("Unable to store parameters to the file - \n" + e.getMessage());
			messageBox.open();
		}	

		refreshParameterFileInProjectExplorer();
	}
 
Example 18
Project: Hydrograph   File: JoinMapDialog.java   View source code 5 votes vote down vote up
/**
 * Create the dialog.
 * 
 * @param parentShell
 * @wbp.parser.constructor
 */@Deprecated
public JoinMapDialog(Shell parentShell) {
	super(parentShell);

	setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL
			| SWT.RESIZE);
}
 
Example 19
Project: BiglyBT   File: ManagerUtils.java   View source code 5 votes vote down vote up
public static void pause(DownloadManager dm, Shell shell) {
if (dm == null) {
	return;
}

int state = dm.getState();

if (state == DownloadManager.STATE_STOPPED
		|| state == DownloadManager.STATE_STOPPING ){
	return;
}

asyncPause(dm);
}
 
Example 20
Project: convertigo-eclipse   File: ExecuteMobileBuilderClassAction.java   View source code 5 votes vote down vote up
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
   			if (treeObject instanceof MobileComponentTreeObject) {
   				if (treeObject instanceof MobileApplicationComponentTreeObject) {
   					MobileApplicationComponentTreeObject mpcto = (MobileApplicationComponentTreeObject) treeObject;
   					ApplicationComponentEditor editor = mpcto.activeEditor(false);
   					editor.launchBuilder(forceInstall, forceClean);
   				}
   			}
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to open the mobile builder!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
Example 21
Project: BiglyBT   File: ShellDocker.java   View source code 5 votes vote down vote up
public ShellDocker(Control anchorControl, Shell dockedShell) {
	if (null == anchorControl || anchorControl.isDisposed()) {
		throw new NullPointerException("anchorControl cannot be null or disposed");
	}
	if (null == dockedShell || dockedShell.isDisposed()) {
		throw new NullPointerException("dockedShell cannot be null or disposed");
	}

	this.anchorControl = anchorControl;
	this.dockedShell = dockedShell;
	mainShell = anchorControl.getShell();
}
 
Example 22
Project: Hydrograph   File: ConfirmCancelMessageBox.java   View source code 5 votes vote down vote up
private void createMessageBox(){
	Shell shell=container.getShell();
	int style = SWT.APPLICATION_MODAL | SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION;
	messageBox = new MessageBox(shell,style);
	messageBox.setText("Confirm"); //$NON-NLS-1$
	messageBox.setMessage(Messages.MessageBeforeClosingWindow);
}
 
Example 23
Project: AppleCommander   File: SwtUtil.java   View source code 5 votes vote down vote up
/**
 * Display a dialog box with the error icon and only the ok button.
 */
public static void showErrorDialog(Shell shell, String title, String message) {
	MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
	messageBox.setText(title);
	messageBox.setMessage(message);
	messageBox.open();
}
 
Example 24
Project: BiglyBT   File: DownloadBar.java   View source code 5 votes vote down vote up
public static DownloadBar open(DownloadManager download, Shell main) {
	DownloadBar result = (DownloadBar)manager.getMiniBarForObject(download);
	if (result == null) {
		result = new DownloadBar(download, main);
	}
	return result;
}
 
Example 25
Project: ide-plugins   File: PluginDialog.java   View source code 5 votes vote down vote up
public PluginDialog(Shell shell) {
    super(shell);
    this.display = Display.getDefault();
    
    fontName = display.getSystemFont().getFontData()[0].getName();
    backColor = new Color(display, 244, 244, 244);
    rowColorSelection = display.getSystemColor(SWT.COLOR_WHITE);
    titleFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
    topFont = new Font(display, fontName, getTopFontSize(), SWT.NORMAL);
}
 
Example 26
Project: eclipse-jenkins-editor   File: JenkinsEditorMessageDialogSupport.java   View source code 5 votes vote down vote up
public void showWarning(String message) {
	EclipseUtil.safeAsyncExec(new Runnable() {

		@Override
		public void run() {
			Shell shell = getActiveWorkbenchShell();
			MessageDialog.openWarning(shell, JENKINS_EDITOR, message);
		}

	});

}
 
Example 27
Project: Hydrograph   File: LookupMapDialog.java   View source code 5 votes vote down vote up
/**
 * Create the Lookup mapping dialog.
 * 
 * @param parentShell
 * @wbp.parser.constructor
 */@Deprecated
public LookupMapDialog(Shell parentShell) {
	super(parentShell);
	
	setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.WRAP | SWT.APPLICATION_MODAL
			| SWT.RESIZE);
}
 
Example 28
Project: gw4e.project   File: FilterTests.java   View source code 5 votes vote down vote up
private void resetWorkbench() {
	try {
		IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
		for (IViewReference iViewReference : views) {
			 if ( iViewReference.getTitle().equals( "Welcome" ) ) {
				 	iViewReference.getPage().hideView(iViewReference);
					break;
			}
		}
		
		IWorkbench workbench = PlatformUI.getWorkbench();
		IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
		IWorkbenchPage page = workbenchWindow.getActivePage();
		Shell activeShell = Display.getCurrent().getActiveShell();
		if ( activeShell != null && activeShell != workbenchWindow.getShell() ) {
			activeShell.close();
		}
		page.closeAllEditors( false );
		page.resetPerspective();
		String defaultPerspectiveId = workbench.getPerspectiveRegistry().getDefaultPerspective();
		workbench.showPerspective( defaultPerspectiveId, workbenchWindow );
		page.resetPerspective();
	}
	catch ( WorkbenchException e ) {
		throw new RuntimeException( e );
	}

}
 
Example 29
Project: neoscada   File: ConfirmationDialogFuture.java   View source code 5 votes vote down vote up
protected void openDialog ( final Display display, final Shell parentShell, final Callback[] callbacks, final String dialogTitle )
{
    try
    {
        for ( final Callback cb : callbacks )
        {
            if ( cb instanceof ConfirmationCallback )
            {
                final Boolean result = showDialog ( (ConfirmationCallback)cb, display, parentShell, dialogTitle );
                if ( result == null )
                {
                    setError ( new CancellationException ( "Cancelled by user request" ) );
                }
                else
                {
                    ( (ConfirmationCallback)cb ).setValue ( result );
                }
            }
            else
            {
                cb.cancel ();
            }
        }

        setResult ( callbacks );
    }
    catch ( final Exception e )
    {
        setError ( e );
    }
}
 
Example 30
Project: convertigo-eclipse   File: MyAbstractAction.java   View source code 5 votes vote down vote up
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
	MessageDialog.openInformation(
		shell,
		"Convertigo Plug-in",
		"The choosen operation is not yet implemented : '"+ action.getId() + "'.");
	
	shell.setCursor(null);
	waitCursor.dispose();
}
 
Example 31
Project: SWET   File: TipDayEx.java   View source code 5 votes vote down vote up
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	Locale.setDefault(Locale.ENGLISH);
	final TipDayEx tipDayEx = new TipDayEx();

	String yamlFile = String.format("%s/src/main/resources/%s",
			System.getProperty("user.dir"), "help.yaml");
	help = YamlHelper.loadHelp(yamlFile);
	for (Entry<String, String> helpdata : help.entrySet()) {
		String title = helpdata.getKey();
		String description = helpdata.getValue();
		tipDayEx.addTip(String.format("<h4>%s</h4>%s", title, description));
	}
	if (tipDayEx.getTips().size() == 0) {
		for (String tipMessage : new String[] { "This is the first tip",
				"This is the second tip", "This is the third tip",
				"This is the forth tip", "This is the fifth tip" }) {
			tipDayEx.addTip(String.format(
					"<h4>%s</h4>" + "<b>%s</b> " + "<u>%s</u> " + "<i>%s</i> " + "%s "
							+ "%s<br/>" + "<p color=\"#A00000\">%s</p>",
					tipMessage, tipMessage, tipMessage, tipMessage, tipMessage,
					tipMessage, tipMessage));

		}
	}

	tipDayEx.open(shell, display);
	display.dispose();
}
 
Example 32
Project: convertigo-eclipse   File: DisableStatementAction.java   View source code 5 votes vote down vote up
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			DatabaseObjectTreeObject treeObject = null;
   			Statement statement = null;
   			
   			TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
			for (int i = treeObjects.length-1 ; i>=0  ; i--) {
				treeObject = (DatabaseObjectTreeObject) treeObjects[i];
				if (treeObject instanceof StatementTreeObject) {
					StatementTreeObject statementTreeObject = (StatementTreeObject)treeObject;
					statement = (Statement)statementTreeObject.getObject();
					statement.setEnabled(false);
					
					statementTreeObject.setEnabled(false);
					statementTreeObject.hasBeenModified(true);				
				}
			}
			
			explorerView.refreshSelectedTreeObjects();
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to disable statement!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
Example 33
Project: BiglyBT   File: ManagerUtils.java   View source code 5 votes vote down vote up
public static void
locateFiles(
	final DownloadManager[]		dms,
	Shell						shell )
{
	locateFiles( dms, null, shell );
}
 
Example 34
Project: avro-schema-editor   File: OpenPreferencesShellAction.java   View source code 5 votes vote down vote up
@Override
public void run() {		
	
	Point location = MouseInfo.getPointerInfo().getLocation();
	Rectangle bounds = new Rectangle(location.x, location.y, 250, 250);
	
	Shell shell = Display.getDefault().getActiveShell();
	SchemaViewerPreferencesDialog dialog = new SchemaViewerPreferencesDialog(shell, bounds, serviceProvider);		
	dialog.open();				
}
 
Example 35
Project: convertigo-eclipse   File: ClipboardCopyAction.java   View source code 5 votes vote down vote up
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
       
	try {
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			String sXml;
   			if (explorerView.isEditing()) {
   				sXml = explorerView.getEditingText();
   			}
   			else {
    			// copy to clipboard manager
   				sXml = copy(explorerView);
   			}
   			
  				// copy to system clipboard
   			if (sXml != null) {
      				Clipboard clipboard = new Clipboard(display);
      				TextTransfer textTransfer = TextTransfer.getInstance();
      				clipboard.setContents(new String[]{sXml}, new Transfer[]{textTransfer});
      				clipboard.dispose();
   			}
   		}
	}
	catch (Throwable e) {
		ConvertigoPlugin.logException(e, "Unable to copy!");
	}
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}
 
Example 36
Project: network-device-panel   File: DevicePanel.java   View source code 5 votes vote down vote up
/**
 * Create the dialog.
 *
 * @param parentShell
 */
public DevicePanel(Shell parentShell, String nodeid, String lab) {
	super(parentShell);
	this.nodeid = nodeid;
	setShellStyle(SWT.MAX | SWT.RESIZE);

}
 
Example 37
Project: Hydrograph   File: DisposeSchemaGridListener.java   View source code 5 votes vote down vote up
@Override
public void mouseAction(PropertyDialogButtonBar propertyDialogButtonBar,
		ListenerHelper helpers, Event event, Widget... widgets) {
	   Table table=(Table)event.widget;
	   Shell tip=(Shell) table.getData("tip");
	   Label label=(Label) table.getData("label");
	if(tip!=null) 
	{
	 tip.dispose();
        tip = null;
        label = null;
	}
}
 
Example 38
Project: BiglyBT   File: ConfigShell.java   View source code 5 votes vote down vote up
private Shell getMainShell() {
	UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
	if (null != uiFunctions) {
		return uiFunctions.getMainShell();
	}

	throw new IllegalStateException(
			"No instance of UIFunctionsSWT found; the UIFunctionsManager might not have been initialized properly");

}
 
Example 39
Project: Hydrograph   File: CommentBoxEditor.java   View source code 5 votes vote down vote up
private void createCommentBoxShell(org.eclipse.swt.graphics.Rectangle commentBoxEditorBounds) {
	shell = new Shell(getParent(), SWT.NONE);
	shell.setBounds(commentBoxEditorBounds);
	GridLayout gl_shell = new GridLayout(1, false);
	gl_shell.verticalSpacing = 0;
	gl_shell.marginWidth = 0;
	gl_shell.marginHeight = 0;
	gl_shell.horizontalSpacing = 0;
	shell.setLayout(gl_shell);
}
 
Example 40
Project: convertigo-eclipse   File: TestCaseImportRequestableVariablesAction.java   View source code 5 votes vote down vote up
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
       try {
   		ProjectExplorerView explorerView = getProjectExplorerView();
   		if (explorerView != null) {
   			TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
   			Object databaseObject = treeObject.getObject();
   			if ((databaseObject != null) && (databaseObject instanceof TestCase)) {
   				TestCase testCase = (TestCase)databaseObject;
   				testCase.importRequestableVariables((RequestableObject)testCase.getParent());
   				if (testCase.hasChanged) {
   					explorerView.reloadTreeObject(treeObject);
					StructuredSelection structuredSelection = new StructuredSelection(treeObject);
					ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged((IWorkbenchPart)explorerView, structuredSelection);
   				}
   			}
   		}
       }
       catch (Throwable e) {
       	ConvertigoPlugin.logException(e, "Unable to add requestable variables to test case!");
       }
       finally {
		shell.setCursor(null);
		waitCursor.dispose();
       }
}