本文整理汇总了Java中org.eclipse.ui.IWorkingSetManager.getWorkingSet方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkingSetManager.getWorkingSet方法的具体用法?Java IWorkingSetManager.getWorkingSet怎么用?Java IWorkingSetManager.getWorkingSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.IWorkingSetManager
的用法示例。
在下文中一共展示了IWorkingSetManager.getWorkingSet方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initWorkingSetFilter
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
/**
* Restores the working set filter from the persistence store.
*/
protected void initWorkingSetFilter(String workingSetName) {
IWorkingSet workingSet = null;
if (workingSetName != null && workingSetName.length() > 0) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
workingSet = workingSetManager.getWorkingSet(workingSetName);
} else if (PlatformUI.getPreferenceStore().getBoolean(
IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) {
// use the window set by default if the global preference is set
workingSet = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getAggregateWorkingSet();
}
if (workingSet != null) {
setWorkingSet(workingSet);
}
}
示例2: initWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
protected void initWorkingSet(String workingSetName) {
IWorkingSet workingSet = null;
if (workingSetName != null && workingSetName.length() > 0) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
workingSet = workingSetManager.getWorkingSet(workingSetName);
} /*
* else if (PlatformUI.getPreferenceStore().getBoolean(
* IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) {
* // use the window set by default if the global preference is set
* workingSet =
* PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage
* ().getAggregateWorkingSet(); }
*/
if (workingSet != null) {
setCurrentWorkingSet(workingSet);
}
}
示例3: createWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private void createWorkingSet(IWorkingSet[] workingSets, IProject[] projects) {
IWorkingSetManager manager = PsfImportPlugin.getDefault().getWorkbench().getWorkingSetManager();
String workingSetName;
for (int i = 0; i < workingSets.length; i++) {
workingSetName = workingSets[i].getName();
IWorkingSet oldSet = manager.getWorkingSet(workingSetName);
if (oldSet == null) {
IWorkingSet newSet = manager.createWorkingSet(workingSetName, projects);
manager.addWorkingSet(newSet);
} else {
// don't overwrite the old elements
IAdaptable[] tempElements = oldSet.getElements();
IAdaptable[] adaptedProjects = oldSet.adaptElements(projects);
IAdaptable[] finalElementList = new IAdaptable[tempElements.length + adaptedProjects.length];
System.arraycopy(tempElements, 0, finalElementList, 0, tempElements.length);
System.arraycopy(adaptedProjects, 0, finalElementList, tempElements.length, adaptedProjects.length);
oldSet.setElements(finalElementList);
}
}
}
示例4: initializeScopingHint
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private void initializeScopingHint() {
String working_sets = settings.get(STORE_WORKING_SETS);
if (working_sets == null) {
participantScope.setSelection(true);
updateParticipantScope();
} else {
StringTokenizer st = new StringTokenizer(working_sets, " ,"); //$NON-NLS-1$
ArrayList ws = new ArrayList();
while (st.hasMoreTokens()) {
String workingSetName = st.nextToken();
if (workingSetName != null && workingSetName.equals("") == false) { //$NON-NLS-1$
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
if (workingSet != null) {
ws.add(workingSet);
}
}
}
if(! ws.isEmpty()) {
this.workingSets = (IWorkingSet[]) ws.toArray(new IWorkingSet[ws.size()]);
updateWorkingSetScope();
updateWorkingSetLabel();
participantScope.setSelection(false);
selectedResourcesScope.setSelection(false);
workingSetScope.setSelection(true);
}
}
}
示例5: createWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private IWorkingSet createWorkingSet(String name){
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet ws = workingSetManager.getWorkingSet(name);
if(ws == null){
ws = workingSetManager.createWorkingSet(name, new IAdaptable[0]);
ws.setId("org.eclipse.jdt.ui.JavaWorkingSetPage");
workingSetManager.addWorkingSet(ws);
}
return ws;
}
示例6: create
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
public static SearchPatternData create(IDialogSettings settings) {
String textPattern = settings.get("textPattern"); //$NON-NLS-1$
String[] wsIds = settings.getArray("workingSets"); //$NON-NLS-1$
IWorkingSet[] workingSets = null;
if (wsIds != null && wsIds.length > 0) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
workingSets = new IWorkingSet[wsIds.length];
for (int i = 0; workingSets != null && i < wsIds.length; i++) {
workingSets[i] = workingSetManager.getWorkingSet(wsIds[i]);
if (workingSets[i] == null) {
workingSets = null;
}
}
}
String[] fileNamePatterns = settings.getArray("fileNamePatterns"); //$NON-NLS-1$
if (fileNamePatterns == null) {
fileNamePatterns = new String[0];
}
try {
int scope = settings.getInt("scope"); //$NON-NLS-1$
boolean isRegExSearch = settings.getBoolean("isRegExSearch"); //$NON-NLS-1$
boolean ignoreCase = settings.getBoolean("ignoreCase"); //$NON-NLS-1$
return new SearchPatternData(textPattern, !ignoreCase, isRegExSearch, fileNamePatterns, scope, workingSets);
} catch (NumberFormatException e) {
return null;
}
}
示例7: create
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
public static SearchPatternData create(IDialogSettings settings) {
String textPattern = settings.get("textPattern"); //$NON-NLS-1$
String[] wsIds = settings.getArray("workingSets"); //$NON-NLS-1$
IWorkingSet[] workingSets = null;
if (wsIds != null && wsIds.length > 0) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
workingSets = new IWorkingSet[wsIds.length];
for (int i = 0; workingSets != null && i < wsIds.length; i++) {
workingSets[i] = workingSetManager.getWorkingSet(wsIds[i]);
if (workingSets[i] == null) {
workingSets = null;
}
}
}
String[] fileNamePatterns = settings.getArray("fileNamePatterns"); //$NON-NLS-1$
if (fileNamePatterns == null) {
fileNamePatterns = new String[0];
}
try {
int scope = settings.getInt("scope"); //$NON-NLS-1$
boolean isRegExSearch = settings.getBoolean("isRegExSearch"); //$NON-NLS-1$
boolean ignoreCase = settings.getBoolean("ignoreCase"); //$NON-NLS-1$
return new SearchPatternData(textPattern, !ignoreCase, isRegExSearch, fileNamePatterns,
scope, workingSets);
} catch (NumberFormatException e) {
return null;
}
}
示例8: updateSelectedWorkingSets
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private void updateSelectedWorkingSets() {
String item = workingSetCombo.getItem(workingSetCombo
.getSelectionIndex());
String[] workingSetNames = split(item, ", "); //$NON-NLS-1$
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
.getWorkingSetManager();
selectedWorkingSets = new IWorkingSet[workingSetNames.length];
for (int i = 0; i < workingSetNames.length; i++) {
IWorkingSet set = workingSetManager
.getWorkingSet(workingSetNames[i]);
Assert.isNotNull(set);
selectedWorkingSets[i] = set;
}
}
示例9: loadSelectionHistory
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private ArrayList<String> loadSelectionHistory(String[] workingSetIds) {
String[] strings = PsfImportPlugin.getDefault().getDialogSettings()
.getArray(WORKINGSET_SELECTION_HISTORY);
if (strings == null || strings.length == 0)
return new ArrayList<String>();
ArrayList<String> result = new ArrayList<String>();
HashSet<String> workingSetIdsSet = new HashSet<String>(
Arrays.asList(workingSetIds));
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench()
.getWorkingSetManager();
for (int i = 0; i < strings.length; i++) {
String[] workingSetNames = split(strings[i], ", "); //$NON-NLS-1$
boolean valid = true;
for (int j = 0; j < workingSetNames.length && valid; j++) {
IWorkingSet workingSet = workingSetManager
.getWorkingSet(workingSetNames[j]);
if (workingSet == null) {
valid = false;
} else {
if (!workingSetIdsSet.contains(workingSet.getId()))
valid = false;
}
}
if (valid) {
result.add(strings[i]);
}
}
return result;
}
示例10: organizeWorkingSetsFromExtensionDirectories
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
public static void organizeWorkingSetsFromExtensionDirectories(IProgressMonitor monitor) {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkingSetManager manager = workbench.getWorkingSetManager();
Map<String, Set<IProject>> extToProjectMap = new HashMap<String, Set<IProject>>();
IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
monitor.beginTask("Creating Working Sets", allProjects.length);
int projectsProcessed = 0;
for (IProject project : allProjects) {
// projects to ignore
if (project.getName().equals("RemoteSystemsTempFiles") || project.getName().equals("platform") || project.getName().equals("config"))
{
continue;
}
File directory = project.getLocation().toFile().getParentFile();
String directoryName = directory.getName();
if (!extToProjectMap.containsKey(directoryName)) {
extToProjectMap.put(directoryName, new HashSet<IProject>());
extToProjectMap.get(directoryName).add(ResourcesPlugin.getWorkspace().getRoot().getProject("platform"));
extToProjectMap.get(directoryName).add(ResourcesPlugin.getWorkspace().getRoot().getProject("config"));
}
extToProjectMap.get(directoryName).add(project);
projectsProcessed++;
monitor.worked(projectsProcessed);
}
monitor.done();
// now create the working sets
for (Entry<String, Set<IProject>> entry : extToProjectMap.entrySet()) {
IWorkingSet existingWorkingSet = manager.getWorkingSet(entry.getKey());
IProject[] projectsArray = entry.getValue().toArray(new IProject[entry.getValue().size()]);
if (existingWorkingSet == null) {
IWorkingSet workingSet = manager.createWorkingSet(entry.getKey(), projectsArray);
manager.addWorkingSet(workingSet);
} else {
// Already got a Working Set with this name
existingWorkingSet.setElements(projectsArray);
}
}
}
示例11: create
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
public static SearchPatternData create(IDialogSettings settings) {
String pattern= settings.get("pattern"); //$NON-NLS-1$
if (pattern.length() == 0) {
return null;
}
IJavaElement elem= null;
String handleId= settings.get("javaElement"); //$NON-NLS-1$
if (handleId != null && handleId.length() > 0) {
IJavaElement restored= JavaCore.create(handleId);
if (restored != null && isSearchableType(restored) && restored.exists()) {
elem= restored;
}
}
String[] wsIds= settings.getArray("workingSets"); //$NON-NLS-1$
IWorkingSet[] workingSets= null;
if (wsIds != null && wsIds.length > 0) {
IWorkingSetManager workingSetManager= PlatformUI.getWorkbench().getWorkingSetManager();
workingSets= new IWorkingSet[wsIds.length];
for (int i= 0; workingSets != null && i < wsIds.length; i++) {
workingSets[i]= workingSetManager.getWorkingSet(wsIds[i]);
if (workingSets[i] == null) {
workingSets= null;
}
}
}
try {
int searchFor= settings.getInt("searchFor"); //$NON-NLS-1$
int scope= settings.getInt("scope"); //$NON-NLS-1$
int limitTo= settings.getInt("limitTo"); //$NON-NLS-1$
int matchLocations= 0;
if (settings.get("matchLocations") != null) { //$NON-NLS-1$
matchLocations= settings.getInt("matchLocations"); //$NON-NLS-1$
}
boolean isCaseSensitive= settings.getBoolean("isCaseSensitive"); //$NON-NLS-1$
int includeMask;
if (settings.get("includeMask") != null) { //$NON-NLS-1$
includeMask= settings.getInt("includeMask"); //$NON-NLS-1$
} else {
includeMask= JavaSearchScopeFactory.NO_JRE;
if (settings.get("includeJRE") == null ? forceIncludeAll(limitTo, elem) : settings.getBoolean("includeJRE")) { //$NON-NLS-1$ //$NON-NLS-2$
includeMask= JavaSearchScopeFactory.ALL;
}
}
return new SearchPatternData(searchFor, limitTo, matchLocations, pattern, isCaseSensitive, elem, scope, workingSets, includeMask);
} catch (NumberFormatException e) {
return null;
}
}