本文整理汇总了Java中org.eclipse.ui.IWorkingSetManager类的典型用法代码示例。如果您正苦于以下问题:Java IWorkingSetManager类的具体用法?Java IWorkingSetManager怎么用?Java IWorkingSetManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IWorkingSetManager类属于org.eclipse.ui包,在下文中一共展示了IWorkingSetManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreWorkingSetsForProjects
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
void restoreWorkingSetsForProjects(List<WorkingSetData> workingSetDataList, List<IProject> projects,
IWorkingSetManager mockedManager) {
if (workingSetDataList == null || workingSetDataList.isEmpty()) {
return;
}
if (projects == null || projects.isEmpty()) {
return;
}
for (WorkingSetData data : workingSetDataList) {
if (data.projectNamesContainedBefore.isEmpty()) {
continue;
}
updateWorkingSet(data, projects);
}
}
示例2: addProjectToSelectedWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
/**
* <p>
* Adds the newly created project to the currently selected working set.
* </p>
*
* @param project the project to be added to the selected working set
*/
private void addProjectToSelectedWorkingSet(IProject project) {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
if (workbenchWindow == null) {
return;
}
ISelectionService selectionService = workbenchWindow.getSelectionService();
ISelection selection = selectionService.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
Object firstElement = structuredSelection.getFirstElement();
if (firstElement instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) firstElement;
IWorkingSet workingSet = (IWorkingSet) adaptable.getAdapter(IWorkingSet.class);
if (workingSet != null) {
// new project wizard was invoked by right-clicking a working set
IWorkingSetManager workingSetManager = workbench.getWorkingSetManager();
workingSetManager.addToWorkingSets(project, new IWorkingSet[]{workingSet});
}
}
}
}
示例3: selectWorkingSetAction
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
private void selectWorkingSetAction() {
IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), true);
dialog.open();
IWorkingSet[] sets = dialog.getSelection();
if(sets != null) {
workingSets = sets;
} else {
// dialog cancelled
return;
}
updateWorkingSetScope();
updateWorkingSetLabel();
participantScope.setSelection(false);
selectedResourcesScope.setSelection(false);
workingSetScope.setSelection(true);
}
示例4: 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
示例5: removeSelectedWorkingSets
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
/**
* Removes the selected working sets from the workbench.
*/
private void removeSelectedWorkingSets() {
ISelection selection= fTableViewer.getSelection();
if (selection instanceof IStructuredSelection) {
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
Iterator<?> iter= ((IStructuredSelection)selection).iterator();
while (iter.hasNext()) {
IWorkingSet workingSet= (IWorkingSet)iter.next();
if (fAddedWorkingSets.contains(workingSet)) {
fAddedWorkingSets.remove(workingSet);
} else {
IWorkingSet[] recentWorkingSets= manager.getRecentWorkingSets();
for (int i= 0; i < recentWorkingSets.length; i++) {
if (workingSet.equals(recentWorkingSets[i])) {
fRemovedMRUWorkingSets.add(workingSet);
break;
}
}
fRemovedWorkingSets.add(workingSet);
}
fAllWorkingSets.remove(workingSet);
manager.removeWorkingSet(workingSet);
}
fTableViewer.remove(((IStructuredSelection)selection).toArray());
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:WorkingSetConfigurationDialog.java
示例6: fill
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
@Override
public void fill(Menu menu, int index) {
MenuItem mi= new MenuItem(menu, SWT.RADIO, index);
String name= fWorkingSet.getLabel();
mi.setText("&" + fId + " " + name); //$NON-NLS-1$ //$NON-NLS-2$
if (fImage == null) {
ImageDescriptor imageDescriptor= fWorkingSet.getImageDescriptor();
if (imageDescriptor != null)
fImage= imageDescriptor.createImage();
}
mi.setImage(fImage);
mi.setSelection(fWorkingSet.equals(fActionGroup.getWorkingSet()));
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
fActionGroup.setWorkingSet(fWorkingSet, true);
manager.addRecentWorkingSet(fWorkingSet);
}
});
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:WorkingSetMenuContributionItem.java
示例7: run
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
@Override
public void run() {
Shell shell= getShell();
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSetSelectionDialog dialog= manager.createWorkingSetSelectionDialog(shell, false);
IWorkingSet workingSet= fActionGroup.getWorkingSet();
if (workingSet != null)
dialog.setSelection(new IWorkingSet[]{workingSet});
if (dialog.open() == Window.OK) {
IWorkingSet[] result= dialog.getSelection();
if (result != null && result.length > 0) {
fActionGroup.setWorkingSet(result[0], true);
manager.addRecentWorkingSet(result[0]);
}
else
fActionGroup.setWorkingSet(null, true);
}
}
示例8: WorkingSetFilterActionGroup
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
public WorkingSetFilterActionGroup(IWorkbenchPartSite site, IPropertyChangeListener changeListener) {
Assert.isNotNull(site);
Assert.isNotNull(changeListener);
fChangeListener= changeListener;
fWorkbenchPage= site.getPage();
fAllowWindowWorkingSetByDefault= true;
fClearWorkingSetAction= new ClearWorkingSetAction(this);
fSelectWorkingSetAction= new SelectWorkingSetAction(this, site);
fEditWorkingSetAction= new EditWorkingSetAction(this, site);
fWorkingSetListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
doPropertyChange(event);
}
};
fWorkingSetFilter= new WorkingSetFilter();
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
manager.addPropertyChangeListener(fWorkingSetListener);
if (useWindowWorkingSetByDefault()) {
setWorkingSet(site.getPage().getAggregateWorkingSet(), false);
}
}
示例9: run
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
@Override
public void run() {
Shell shell= getShell();
IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
IWorkingSet workingSet= fActionGroup.getWorkingSet();
if (workingSet == null || workingSet.isAggregateWorkingSet()) {
setEnabled(false);
return;
}
IWorkingSetEditWizard wizard= manager.createWorkingSetEditWizard(workingSet);
if (wizard == null) {
String title= WorkingSetMessages.EditWorkingSetAction_error_nowizard_title;
String message= WorkingSetMessages.EditWorkingSetAction_error_nowizard_message;
MessageDialog.openError(shell, title, message);
return;
}
WizardDialog dialog= new WizardDialog(shell, wizard);
dialog.create();
if (dialog.open() == Window.OK)
fActionGroup.setWorkingSet(wizard.getSelection(), true);
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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);
}
}
}
示例13: 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);
}
}
}
}
示例14: deleteEclipseResourcesWorkingSets
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
/**
* Deletes all Eclipse based working sets that belong to the 'Resources' working set type.
*/
private void deleteEclipseResourcesWorkingSets() {
// Discard the Eclipse based working set manager state by deleting all 'Resources' working sets.
final Iterator<IWorkingSet> itr = getAllEclipseResourceWorkingSetsIterator();
final IWorkingSetManager manager = getWorkbench().getWorkingSetManager();
while (itr.hasNext()) {
final IWorkingSet next = itr.next();
manager.removeWorkingSet(next);
}
}
示例15: addToWorkingSet
import org.eclipse.ui.IWorkingSetManager; //导入依赖的package包/类
private void addToWorkingSet(IProject project) {
IWorkingSet[] selectedWorkingSets = workingSetGroup.getSelectedWorkingSets();
if (selectedWorkingSets.length != 0) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
workingSetManager.addToWorkingSets(project, selectedWorkingSets);
}
}