1 11 package org.eclipse.jdt.internal.ui.workingsets; 12 13 import java.util.ArrayList ; 14 import java.util.Arrays ; 15 import java.util.List ; 16 17 import org.eclipse.jface.action.Action; 18 import org.eclipse.jface.dialogs.IDialogConstants; 19 20 import org.eclipse.ui.IWorkbenchPartSite; 21 import org.eclipse.ui.IWorkingSet; 22 23 public class ConfigureWorkingSetAction extends Action { 24 25 private final IWorkbenchPartSite fSite; 26 private WorkingSetModel fWorkingSetModel; 27 28 public ConfigureWorkingSetAction(IWorkbenchPartSite site) { 29 super(WorkingSetMessages.ConfigureWorkingSetAction_label); 30 fSite= site; 31 } 32 33 public void setWorkingSetModel(WorkingSetModel model) { 34 fWorkingSetModel= model; 35 } 36 37 40 public void run() { 41 List workingSets= new ArrayList (Arrays.asList(fWorkingSetModel.getAllWorkingSets())); 42 IWorkingSet[] activeWorkingSets= fWorkingSetModel.getActiveWorkingSets(); 43 WorkingSetConfigurationDialog dialog= new WorkingSetConfigurationDialog( 44 fSite.getShell(), 45 (IWorkingSet[])workingSets.toArray(new IWorkingSet[workingSets.size()]), 46 activeWorkingSets); 47 dialog.setSelection(activeWorkingSets); 48 if (dialog.open() == IDialogConstants.OK_ID) { 49 IWorkingSet[] selection= dialog.getSelection(); 50 fWorkingSetModel.setActiveWorkingSets(selection); 51 } 52 } 53 } 54 | Popular Tags |