private void createActions() { // For the following commands we use actions, as they are already available final IActionBars ab = getViewSite().getActionBars(); openAction = new OpenAction(getSite()); openAction .setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR); ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction); openAction.setEnabled(false); viewer.addSelectionChangedListener(openAction); PropertyDialogAction propertiesAction = new PropertyDialogAction(getSite(), viewer); propertiesAction .setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); ab.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction); propertiesAction.setEnabled(false); viewer.addSelectionChangedListener(propertiesAction); }
public NewTextSearchActionGroup(IViewPart part) { Assert.isNotNull(part); IWorkbenchPartSite site = part.getSite(); fSelectionProvider = site.getSelectionProvider(); fPage = site.getPage(); fOpenPropertiesDialog = new PropertyDialogAction(site, fSelectionProvider); fOpenAction = new OpenFileAction(fPage); ISelection selection = fSelectionProvider.getSelection(); if (selection instanceof IStructuredSelection) { fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection); } else { fOpenPropertiesDialog.selectionChanged(selection); } }
public void fillActions(IMenuManager manager) { manager.add(new Separator(IWorkbenchActionConstants.NEW_EXT)); if (newElement != null) manager.add(newElement); if (newGroup != null) manager.add(newGroup); manager.add(new Separator(IWorkbenchActionConstants.EDIT_START)); if (openEditorAction != null) manager.add(openEditorAction); if (changeKeyAction != null) manager.add(changeKeyAction); manager.add(new Separator(IWorkbenchActionConstants.M_EDIT)); // if (cutAction != null) manager.add(cutAction); if (copyAction != null) manager.add(copyAction); if (pasteAction != null) manager.add(pasteAction); if (deleteAction != null) manager.add(deleteAction); manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); manager.add(new PropertyDialogAction(new SameShellProvider(viewer.getControl()), viewer)); }
public Object execute(ExecutionEvent event) throws ExecutionException { // FIXME Fix the selection of specs only IAction action = new PropertyDialogAction(UIHelper.getShellProvider(), Activator.getSpecManager()); // IAction action = new PropertyDialogAction(UIHelper.getShellProvider(), HandlerUtil.getActivePart(event)); action.run(); return null; }
public Object execute(ExecutionEvent event) throws ExecutionException { IAction action = new PropertyDialogAction(UIHelper.getShellProvider(), UIHelper .getActiveEditorFileSelectionProvider()); action.run(); return null; }
private void createSiteActions(IWorkbenchSite site, ISelectionProvider specialProvider) { ISelectionProvider provider = specialProvider != null ? specialProvider : site.getSelectionProvider(); fOpenPropertiesDialog = new PropertyDialogAction(site, provider); fOpenPropertiesDialog.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); initialize(provider); }
@SuppressWarnings ("deprecation") @Override public void createPartControl(final Composite compo) { this.parent = GamaToolbarFactory.createToolbars(this, compo); super.createPartControl(parent); final IToolBarManager toolbar = getViewSite().getActionBars().getToolBarManager(); for (final IContributionItem item : toolbar.getItems()) { if (item instanceof ActionContributionItem) { final ActionContributionItem aci = (ActionContributionItem) item; final IAction action = aci.getAction(); if (action instanceof LinkEditorAction) { link = action; toolbar.remove(aci); } else if (action instanceof org.eclipse.ui.internal.navigator.actions.CollapseAllAction) { toolbar.remove(aci); } } } linkItem.setSelection(link.isChecked()); toolbar.update(true); // linkItem.setSelection(link.isChecked()); // final Action a = linkCommand.toCheckAction(); // a.setChecked(link.isChecked()); // toolbar.insertBefore("toolbar.toggle", a); toolbar.insertBefore("toolbar.toggle", byDate.toCheckAction()); toolbar.insertBefore("toolbar.toggle", expandAll.toAction()); toolbar.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(); }
private void createSiteActions(IWorkbenchSite site, ISelectionProvider specialProvider) { fOpenImplementation= new OpenImplementationAction(site); fOpenImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_IMPLEMENTATION); fOpenImplementation.setSpecialSelectionProvider(specialProvider); fOpenSuperImplementation= new OpenSuperImplementationAction(site); fOpenSuperImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION); fOpenSuperImplementation.setSpecialSelectionProvider(specialProvider); fOpenAttachedJavadoc= new OpenAttachedJavadocAction(site); fOpenAttachedJavadoc.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC); fOpenAttachedJavadoc.setSpecialSelectionProvider(specialProvider); fOpenTypeHierarchy= new OpenTypeHierarchyAction(site); fOpenTypeHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY); fOpenTypeHierarchy.setSpecialSelectionProvider(specialProvider); fOpenCallHierarchy= new OpenCallHierarchyAction(site); fOpenCallHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY); fOpenCallHierarchy.setSpecialSelectionProvider(specialProvider); ISelectionProvider provider= specialProvider != null ? specialProvider : site.getSelectionProvider(); fOpenPropertiesDialog= new PropertyDialogAction(site, provider); fOpenPropertiesDialog.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); initialize(provider); }
public void init(final ICommonActionExtensionSite aSite) { delegateSelectionProvider = new DelegateSelectionProvider( aSite.getViewSite().getSelectionProvider()); propertiesAction = new PropertyDialogAction(new IShellProvider() { public Shell getShell() { return aSite.getViewSite().getShell(); } },delegateSelectionProvider); propertiesAction.setText("属性"); propertiesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); }
private void createActions() { selectAllAction = new Action() { @Override public void run() { changesTable.selectAll(); changesTable.setFocus(); } }; copyAction = new Action() { @Override public void run() { changesTable.copySelectionToClipboard(); } }; showHideCommentAction = new Action() { @Override public void run() { if (sashForm.getMaximizedControl() == null) { sashForm.setMaximizedControl(changesTable); setChecked(false); } else { sashForm.setMaximizedControl(null); setChecked(true); } } }; showHideCommentAction.setToolTipText(Messages.getString("SourceFilesCheckinControl.ShowHideActionTooltip")); //$NON-NLS-1$ showHideCommentAction.setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( TFSCommonUIClientPlugin.PLUGIN_ID, "images/vc/sourcefiles_showhidecomment.gif")); //$NON-NLS-1$ showHideCommentAction.setChecked(true); /* * must use the deprecated constructor of PropertyDialogAction for 3.0 * compatibility */ propertiesAction = new PropertyDialogAction(getShell(), changesTable); propertiesAction.setEnabled(false); registerGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAllAction); registerGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); registerGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction); }
@Override public void init(final IActionBars bars) { super.init(bars); editorInputSelectionProvider = new ISelectionProvider() { private final ListenerList listeners = new ListenerList(ListenerList.IDENTITY); ISelection selection = StructuredSelection.EMPTY; @Override public void addSelectionChangedListener(final ISelectionChangedListener listener) { if ( listener != null ) { this.listeners.add(listener); } } @Override public ISelection getSelection() { return this.selection; } @Override public void removeSelectionChangedListener(final ISelectionChangedListener listener) { if ( listener != null ) { this.listeners.remove(listener); } } @Override public void setSelection(ISelection selection) { if ( selection == null ) { selection = StructuredSelection.EMPTY; } if ( !selection.equals(this.selection) ) { this.selection = selection; final SelectionChangedEvent event = new SelectionChangedEvent(this, selection); Object[] listeners = this.listeners.getListeners(); for ( int i = 0; i < listeners.length; ++i ) { final ISelectionChangedListener l = (ISelectionChangedListener) listeners[i]; SafeRunner.run(new SafeRunnable() { @Override public void run() { l.selectionChanged(event); } }); } } } }; updateEditorInputSelectionProvider(currentEditor); IShellProvider shellProvider = new IShellProvider() { @Override public Shell getShell() { return currentEditor.getSite().getShell(); } }; propertiesAction = new PropertyDialogAction(shellProvider, editorInputSelectionProvider) { @Override public void selectionChanged(final IStructuredSelection selection) { setEnabled(isApplicableForSelection(selection)); } }; bars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction); }
@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); 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); // } // } // }); }