1 11 package org.eclipse.team.internal.ui.synchronize; 12 13 import java.util.ArrayList ; 14 import java.util.Iterator ; 15 import java.util.List ; 16 17 import org.eclipse.jface.action.*; 18 import org.eclipse.jface.dialogs.IDialogSettings; 19 import org.eclipse.jface.viewers.ISelectionProvider; 20 import org.eclipse.swt.widgets.Shell; 21 import org.eclipse.team.ui.synchronize.ISynchronizePageSite; 22 import org.eclipse.ui.*; 23 import org.eclipse.ui.commands.*; 24 import org.eclipse.ui.services.IServiceLocator; 25 26 29 public class DialogSynchronizePageSite implements ISynchronizePageSite { 30 31 private final Shell shell; 32 private ISelectionProvider selectionProvider; 33 private IActionBars actionBars; 34 private final boolean isModal; 35 private List actionHandlers = new ArrayList (2); 38 39 44 public DialogSynchronizePageSite(Shell shell, boolean isModal) { 45 this.shell = shell; 46 this.isModal = isModal; 47 } 48 51 public ISelectionProvider getSelectionProvider() { 52 return selectionProvider; 53 } 54 57 public Shell getShell() { 58 return shell; 59 } 60 63 public void setSelectionProvider(ISelectionProvider provider) { 64 selectionProvider = provider; 65 } 66 69 public IWorkbenchSite getWorkbenchSite() { 70 return null; 71 } 72 75 public IWorkbenchPart getPart() { 76 return null; 77 } 78 81 public IKeyBindingService getKeyBindingService() { 82 return null; 83 } 84 87 public void setFocus() { 88 } 89 92 public IDialogSettings getPageSettings() { 93 return null; 94 } 95 98 public IActionBars getActionBars() { 99 return actionBars; 100 } 101 104 public boolean isModal() { 105 return isModal; 106 } 107 108 112 public void createActionBars(final IToolBarManager toolbar) { 113 if (actionBars == null) { 114 actionBars = new IActionBars() { 115 public void clearGlobalActionHandlers() { 116 } 117 public IAction getGlobalActionHandler(String actionId) { 118 return null; 119 } 120 public IMenuManager getMenuManager() { 121 return null; 122 } 123 public IStatusLineManager getStatusLineManager() { 124 return null; 125 } 126 public IToolBarManager getToolBarManager() { 127 return toolbar; 128 } 129 public void setGlobalActionHandler(String actionId, IAction action) { 130 if (actionId != null && !"".equals(actionId)) { IHandler handler = new ActionHandler(action); 132 HandlerSubmission handlerSubmission = new HandlerSubmission(null, shell, null, actionId, handler, Priority.MEDIUM); 133 PlatformUI.getWorkbench().getCommandSupport().addHandlerSubmission(handlerSubmission); 134 actionHandlers.add(handlerSubmission); 135 } 136 } 137 138 public void updateActionBars() { 139 } 140 public IServiceLocator getServiceLocator() { 141 return null; 142 } 143 }; 144 } 145 } 146 147 150 public void dispose() { 151 IWorkbenchCommandSupport cm = PlatformUI.getWorkbench().getCommandSupport(); 152 for (Iterator it = actionHandlers.iterator(); it.hasNext();) { 153 HandlerSubmission handler = (HandlerSubmission) it.next(); 154 cm.removeHandlerSubmission(handler); 155 } 156 } 157 } | Popular Tags |