本文整理汇总了Java中org.eclipse.ui.IWorkingSetManager.addWorkingSet方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkingSetManager.addWorkingSet方法的具体用法?Java IWorkingSetManager.addWorkingSet怎么用?Java IWorkingSetManager.addWorkingSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.IWorkingSetManager
的用法示例。
在下文中一共展示了IWorkingSetManager.addWorkingSet方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private void createWorkingSet() {
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetNewWizard wizard= manager.createWorkingSetNewWizard(new String[] {IWorkingSetIDs.JAVA});
// the wizard can't be null since we have at least the Java working set.
WizardDialog dialog= new WizardDialog(getShell(), wizard);
dialog.create();
if (dialog.open() == Window.OK) {
IWorkingSet workingSet= wizard.getSelection();
if (WorkingSetModel.isSupportedAsTopLevelElement(workingSet)) {
fAllWorkingSets.add(workingSet);
fTableViewer.add(workingSet);
fTableViewer.setSelection(new StructuredSelection(workingSet), true);
fTableViewer.setChecked(workingSet, true);
manager.addWorkingSet(workingSet);
fAddedWorkingSets.add(workingSet);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:WorkingSetConfigurationDialog.java
示例2: 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);
}
}
}
示例3: resetEclipseWorkingSetsBaseOnCurrentState
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
/**
* Resets the state of all Eclipse based working sets that belong to the 'Resources' type.
*/
private void resetEclipseWorkingSetsBaseOnCurrentState() {
try {
if (getWorkbench() == null || getWorkbench().getWorkingSetManager() == null) {
return; // happens during shutdown
}
// Removed listener otherwise due to the Eclipse based working set deletion
// we would delete our content.
getWorkbench().getWorkingSetManager().removePropertyChangeListener(this);
deleteEclipseResourcesWorkingSets();
final IWorkingSetManager manager = getWorkbench().getWorkingSetManager();
for (final WorkingSet workingSet : getAllWorkingSets()) {
if (!OTHERS_WORKING_SET_ID.equals(workingSet.getId())) {
org.eclipse.ui.internal.WorkingSet eclipseWorkingSet = createEclipseWorkingSet(workingSet);
eclipseWorkingSet.setId(WorkingSetManagerModificationStrategy.RESOURCE_WORKING_SET_ID);
manager.addWorkingSet(eclipseWorkingSet);
}
}
} finally {
IWorkbench wb = getWorkbench();
if (wb != null) {
IWorkingSetManager wsm = wb.getWorkingSetManager();
if (wsm != null) { // null-safe re-adding (can be null during shutdown)
wsm.addPropertyChangeListener(this);
}
}
}
}
示例4: restoreRemovedWorkingSets
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
/**
* Adds back removed working sets to the working set manager.
*/
private void restoreRemovedWorkingSets() {
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
Iterator<IWorkingSet> iterator= fRemovedWorkingSets.iterator();
while (iterator.hasNext()) {
manager.addWorkingSet(iterator.next());
}
iterator= fRemovedMRUWorkingSets.iterator();
while (iterator.hasNext()) {
manager.addRecentWorkingSet(iterator.next());
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:WorkingSetConfigurationDialog.java
示例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: 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);
}
}
}
示例7: replaceWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入方法依赖的package包/类
private static void replaceWorkingSet(IWorkingSetManager wsManager, IWorkingSet newWs, IWorkingSet oldWs) {
if (oldWs != null)
wsManager.removeWorkingSet(oldWs);
wsManager.addWorkingSet(newWs);
}