org.eclipse.jface.window.SameShellProvider Java Examples

The following examples show how to use org.eclipse.jface.window.SameShellProvider. 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: GamaNavigator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void createPartControl(final Composite compo) {
	this.parent = GamaToolbarFactory.createToolbars(this, compo);

	super.createPartControl(parent);
	restoreState();
	final IToolBarManager tb = getViewSite().getActionBars().getToolBarManager();
	for (final IContributionItem item : tb.getItems()) {
		if (item instanceof ActionContributionItem) {
			final ActionContributionItem aci = (ActionContributionItem) item;
			final IAction action = aci.getAction();
			if (action instanceof LinkEditorAction) {
				link = action;
				tb.remove(aci);
			} else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) {
				tb.remove(aci);
			}

		}
	}
	linkItem.setSelection(link.isChecked());
	tb.update(true);
	tb.insertBefore("toolbar.toggle", byDate.toCheckAction());
	tb.insertBefore("toolbar.toggle", expandAll.toAction());
	tb.insertBefore(expandAll.getId(), collapseAll.toAction());

	try {
		final IDecoratorManager mgr = PlatformUI.getWorkbench().getDecoratorManager();
		mgr.setEnabled("msi.gama.application.date.decorator", false);
	} catch (final CoreException e) {
		e.printStackTrace();
	}
	properties =
			new PropertyDialogAction(new SameShellProvider(getSite().getShell()), getSite().getSelectionProvider());
	findControl.initialize();

}
 
Example #2
Source File: AbstractDetailsDialog.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public AbstractDetailsDialog(final Shell parentShell, final String title, final Image image, final String message) {
	this(new SameShellProvider(parentShell), title, image, message);
}
 
Example #3
Source File: PatientenListeView.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createPartControl(final Composite parent) {
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	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) {
		@Override
		public void setQuery(IQuery<?> query){
			for (int i = 0; i < dbFields.length; i++) {
				if (!lastFiltered[i].equals(StringTool.leer)) {
					if ("dob".equals(dbFields[i])) {
						query.and(dbFields[i], COMPARATOR.LIKE,
							NoPoUtil.getElexisDateSearchString(lastFiltered[i]), true);
					} else {
						query.and(dbFields[i], COMPARATOR.LIKE, lastFiltered[i] + "%", true);
					}
				}
			}
		}
	};
	updateFocusField();

	vc = new ViewerConfigurer(plcp, new PatLabelProvider(), dcfp,
		new ViewerConfigurer.DefaultButtonProvider(),
			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();
	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);
	// }
	// }
	// });
	created = true;
}
 
Example #4
Source File: ExceptionDetailsDialog.java    From gama with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Construct a new instance with the specified elements. Note that the window will have no visual representation (no
 * widgets) until it is told to open. By default, <code>open</code> blocks for dialogs.
 * 
 * @param parentShell
 *            the parent shell, or <code>null</code> to create a top-level shell
 * @param title
 *            the title for the dialog or <code>null</code> for none
 * @param image
 *            the image to be displayed
 * @param message
 *            the message to be displayed
 * @param details
 *            an object whose content is to be displayed in the details area, or <code>null</code> for none
 * @param plugin
 *            The plugin triggering this deatils dialog and whose information is to be shown in the details area or
 *            <code>null</code> if no plugin details should be shown.
 */
public ExceptionDetailsDialog(final Shell parentShell, final String title, final Image image, final String message,
		final Object details) {
	this(new SameShellProvider(parentShell), title, image, message, details);
}