1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.core.runtime.IAdaptable; 14 import org.eclipse.ui.IElementFactory; 15 import org.eclipse.ui.IMemento; 16 17 21 public class WorkingSetFactory implements IElementFactory { 22 23 26 public IAdaptable createElement(IMemento memento) { 27 String workingSetName = memento.getString(IWorkbenchConstants.TAG_NAME); 28 String label = memento.getString(IWorkbenchConstants.TAG_LABEL); 29 if (label == null) { 30 label = workingSetName; 31 } 32 String workingSetEditPageId = memento 33 .getString(IWorkbenchConstants.TAG_EDIT_PAGE_ID); 34 String aggregateString = memento 35 .getString(AbstractWorkingSet.TAG_AGGREGATE); 36 boolean isAggregate = aggregateString != null 37 && Boolean.valueOf(aggregateString).booleanValue(); 38 39 if (workingSetName == null) { 40 return null; 41 } 42 43 AbstractWorkingSet workingSet = null; 44 45 if (isAggregate) { 46 workingSet = new AggregateWorkingSet(workingSetName, label, memento); 47 } else { 48 workingSet = new WorkingSet(workingSetName, label, memento); 49 } 50 51 if (workingSetEditPageId != null) { 52 workingSet.setId(workingSetEditPageId); 53 } else if (!isAggregate) { 54 workingSet.setId("org.eclipse.ui.resourceWorkingSetPage"); } 58 return workingSet; 59 } 60 } 61 | Popular Tags |