List of usage examples for org.eclipse.jface.window SameShellProvider SameShellProvider
public SameShellProvider(Control targetControl)
From source file:ch.elexis.core.ui.contacts.views.PatientenListeView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { GridLayout layout = new GridLayout(); layout.marginHeight = 0;//from w w w .j a v a 2 s .c o m layout.marginWidth = 0; layout.verticalSpacing = 0; this.parent = parent; this.parent.setLayout(layout); cv = new CommonViewer(); collectUserFields(); plcp = new PatListeContentProvider(cv, currentUserFields, this); makeActions(); plfb = new PatListFilterBox(parent); plfb.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); ((GridData) plfb.getLayoutData()).heightHint = 0; dcfp = new DefaultControlFieldProvider(cv, currentUserFields); updateFocusField(); vc = new ViewerConfigurer( // new LazyContentProvider(cv,loader, // AccessControlDefaults.PATIENT_DISPLAY), plcp, new PatLabelProvider(), dcfp, new ViewerConfigurer.DefaultButtonProvider(), // cv,Patient.class), new SimpleWidgetProvider(SimpleWidgetProvider.TYPE_LAZYLIST, SWT.SINGLE, cv)); cv.create(vc, parent, SWT.NONE, getViewSite()); // let user select patient by pressing ENTER in the control fields cv.getConfigurer().getControlFieldProvider().addChangeListener(new ControlFieldSelectionListener()); cv.getViewerWidget().getControl().setFont(UiDesk.getFont(Preferences.USR_DEFAULTFONT)); plcp.startListening(); ElexisEventDispatcher.getInstance().addListeners(eeli_user); GlobalEventDispatcher.addActivationListener(this, this); populateViewMenu(); StructuredViewer viewer = cv.getViewerWidget(); viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { PropertyDialogAction pdAction = new PropertyDialogAction(new SameShellProvider(parent), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart() .getSite().getSelectionProvider()); if (pdAction.isApplicableForSelection()) pdAction.run(); } }); getSite().registerContextMenu(menus.getContextMenu(), viewer); getSite().setSelectionProvider(viewer); // // ****DoubleClick Version Marlovits -> ffnet bei DoubleClick die // Patienten-Detail-Ansicht // cv.addDoubleClickListener(new DoubleClickListener() { // @Override // public void doubleClicked(PersistentObject obj, CommonViewer cv){ // try { // PatientDetailView2 pdv = // (PatientDetailView2) // getSite().getPage().showView(PatientDetailView2.ID); // } catch (PartInitException e) { // ExHandler.handle(e); // } // } // }); }
From source file:ch.elexis.views.PatientenListeView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { GridLayout layout = new GridLayout(); layout.marginHeight = 0;/*from ww w . j ava2 s . c om*/ layout.marginWidth = 0; layout.verticalSpacing = 0; this.parent = parent; this.parent.setLayout(layout); cv = new CommonViewer(); ArrayList<String> fields = new ArrayList<String>(); initiated = !("".equals(Hub.userCfg.get(PreferenceConstants.USR_PATLIST_SHOWPATNR, ""))); if (Hub.userCfg.get(PreferenceConstants.USR_PATLIST_SHOWPATNR, false)) { fields.add(Patient.FLD_PATID + Query.EQUALS + Messages.getString("PatientenListeView.PatientNr")); //$NON-NLS-1$ } if (Hub.userCfg.get(PreferenceConstants.USR_PATLIST_SHOWNAME, true)) { fields.add(Patient.FLD_NAME + Query.EQUALS + Messages.getString("PatientenListeView.PatientName")); //$NON-NLS-1$ } if (Hub.userCfg.get(PreferenceConstants.USR_PATLIST_SHOWFIRSTNAME, true)) { fields.add(Patient.FLD_FIRSTNAME + Query.EQUALS + Messages.getString("PatientenListeView.PantientFirstName")); //$NON-NLS-1$ } if (Hub.userCfg.get(PreferenceConstants.USR_PATLIST_SHOWDOB, true)) { fields.add( Patient.BIRTHDATE + Query.EQUALS + Messages.getString("PatientenListeView.PatientBirthdate")); //$NON-NLS-1$ } plcp = new PatListeContentProvider(cv, fields.toArray(new String[0]), this); makeActions(); plfb = new PatListFilterBox(parent); plfb.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); ((GridData) plfb.getLayoutData()).heightHint = 0; vc = new ViewerConfigurer( // new LazyContentProvider(cv,loader, // AccessControlDefaults.PATIENT_DISPLAY), plcp, new PatLabelProvider(), new DefaultControlFieldProvider(cv, fields.toArray(new String[0])), new ViewerConfigurer.DefaultButtonProvider(), // cv,Patient.class), new SimpleWidgetProvider(SimpleWidgetProvider.TYPE_LAZYLIST, SWT.SINGLE, cv)); cv.create(vc, parent, SWT.NONE, getViewSite()); // let user select patient by pressing ENTER in the control fields cv.getConfigurer().getControlFieldProvider().addChangeListener(new ControlFieldSelectionListener()); cv.getViewerWidget().getControl().setFont(Desk.getFont(PreferenceConstants.USR_DEFAULTFONT)); menus = new ViewMenus(getViewSite()); menus.createToolbar(newPatAction, filterAction); menus.createControlContextMenu(cv.getViewerWidget().getControl(), new PatientMenuPopulator(this)); plcp.startListening(); ElexisEventDispatcher.getInstance().addListeners(eeli_user); GlobalEventDispatcher.addActivationListener(this, this); StructuredViewer viewer = cv.getViewerWidget(); viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { PropertyDialogAction pdAction = new PropertyDialogAction(new SameShellProvider(parent), PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart() .getSite().getSelectionProvider()); if (pdAction.isApplicableForSelection()) pdAction.run(); } }); getSite().registerContextMenu(menus.getContextMenu(), viewer); getSite().setSelectionProvider(viewer); // // ****DoubleClick Version Marlovits -> ffnet bei DoubleClick die // Patienten-Detail-Ansicht // cv.addDoubleClickListener(new DoubleClickListener() { // @Override // public void doubleClicked(PersistentObject obj, CommonViewer cv){ // try { // PatientDetailView2 pdv = // (PatientDetailView2) getSite().getPage().showView(PatientDetailView2.ID); // } catch (PartInitException e) { // ExHandler.handle(e); // } // } // }); }
From source file:com.aptana.ide.debug.internal.ui.actions.BreakpointPropertiesAction.java
License:Open Source License
/** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) *//*from w ww . java 2 s .c o m*/ public void run(IAction action) { PropertyDialogAction propertyAction = new PropertyDialogAction( new SameShellProvider(DebugUiPlugin.getActiveWorkbenchShell()), new ISelectionProvider() { public void addSelectionChangedListener(ISelectionChangedListener listener) { } public ISelection getSelection() { return new StructuredSelection(breakpoint); } public void removeSelectionChangedListener(ISelectionChangedListener listener) { } public void setSelection(ISelection selection) { } }); propertyAction.run(); }
From source file:com.aptana.ide.debug.internal.ui.actions.BreakpointPropertiesRulerAction.java
License:Open Source License
/** * @see org.eclipse.jface.action.IAction#run() */// w w w. j a va 2s . co m public void run() { if (getBreakpoint() != null) { PropertyDialogAction action = new PropertyDialogAction( new SameShellProvider(getTextEditor().getEditorSite().getShell()), new ISelectionProvider() { public void addSelectionChangedListener(ISelectionChangedListener listener) { } public ISelection getSelection() { return new StructuredSelection(getBreakpoint()); } public void removeSelectionChangedListener(ISelectionChangedListener listener) { } public void setSelection(ISelection selection) { } }); action.run(); } }
From source file:com.aptana.js.debug.ui.internal.actions.BreakpointPropertiesAction.java
License:Open Source License
/** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) *//* w w w.j a v a 2 s. c om*/ public void run(IAction action) { PropertyDialogAction propertyAction = new PropertyDialogAction( new SameShellProvider(UIUtils.getActiveShell()), new ISelectionProvider() { public void addSelectionChangedListener(ISelectionChangedListener listener) { } public ISelection getSelection() { return new StructuredSelection(breakpoint); } public void removeSelectionChangedListener(ISelectionChangedListener listener) { } public void setSelection(ISelection selection) { } }); propertyAction.run(); }
From source file:com.aptana.preview.ui.properties.PreviewSettingComposite.java
License:Open Source License
private boolean editServerConfiguration(IServer serverConfiguration) { try {//from w ww . j av a 2 s. co m Dialog dialog = PropertyDialogsRegistry.getInstance().createPropertyDialog(serverConfiguration, new SameShellProvider(getShell())); if (dialog != null) { if (dialog instanceof IPropertyDialog) { ((IPropertyDialog) dialog).setPropertySource(serverConfiguration); } return dialog.open() == Window.OK; } } catch (CoreException e) { UIUtils.showErrorMessage(Messages.ProjectPreviewPropertyPage_ERR_FailToOpenServerDialog, e); } return false; }
From source file:com.aptana.terminal.widget.TerminalComposite.java
License:Open Source License
public boolean canCloseTerminal() { LocalTerminalConnector localTerminalConnector = (LocalTerminalConnector) fCtlTerminal.getTerminalConnector() .getAdapter(LocalTerminalConnector.class); if (localTerminalConnector != null) { return TerminalCloseHelper.canCloseTerminal(new SameShellProvider(this), localTerminalConnector); }/*from ww w . j av a 2 s . co m*/ return true; }
From source file:com.aptana.webserver.ui.internal.actions.EditServerHandler.java
License:Open Source License
static boolean editServerConfiguration(IServer server) { try {/*from ww w . ja v a 2s.c o m*/ Dialog dlg = PropertyDialogsRegistry.getInstance().createPropertyDialog(server, new SameShellProvider(UIUtils.getActiveShell())); if (dlg != null) { if (dlg instanceof IPropertyDialog) { ((IPropertyDialog) dlg).setPropertySource(server); } return dlg.open() == Window.OK; } } catch (CoreException e) { UIUtils.showErrorMessage("Failed to open server preferences dialog", e); //$NON-NLS-1$ } return false; }
From source file:com.aptana.webserver.ui.preferences.ServersPreferencePage.java
License:Open Source License
private boolean editServerConfiguration(IServer serverConfiguration) { try {/*from www. j a v a 2s. co m*/ Dialog dlg = PropertyDialogsRegistry.getInstance().createPropertyDialog(serverConfiguration, new SameShellProvider(getShell())); if (dlg != null) { if (dlg instanceof IPropertyDialog) { ((IPropertyDialog) dlg).setPropertySource(serverConfiguration); } return dlg.open() == Window.OK; } } catch (CoreException e) { UIUtils.showErrorMessage("Failed to open server preferences dialog", e); //$NON-NLS-1$ } return false; }
From source file:com.google.cloud.tools.eclipse.sdk.ui.preferences.CloudSdkPrompter.java
License:Apache License
/** * Return the Cloud SDK. If it cannot be found, prompt the user to specify its location. Like * {@linkplain CloudSdk.Builder#build()} the caller is responsible for validating the SDK location * (if desired)./*from w w w . ja va 2 s .co m*/ * <p> * <b>Must be called from the SWT UI Thread.</b> * </p> * * @param shell the parent shell for any dialogs; may be {@code null} * @return the Cloud SDK, or {@code null} if unspecified */ public static CloudSdk getCloudSdk(Shell shell) { return getCloudSdk(new SameShellProvider(shell)); }