本文整理汇总了Java中org.eclipse.ui.IWorkingSet.setElements方法的典型用法代码示例。如果您正苦于以下问题:Java IWorkingSet.setElements方法的具体用法?Java IWorkingSet.setElements怎么用?Java IWorkingSet.setElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.IWorkingSet
的用法示例。
在下文中一共展示了IWorkingSet.setElements方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performElementRearrange
import org.eclipse.ui.IWorkingSet; //导入方法依赖的package包/类
private void performElementRearrange(int eventDetail) {
// only move if target isn't the other working set. If this is the case
// the move will happenn automatically by refreshing the other working set
if (!isOthersWorkingSet(fWorkingSet)) {
List<Object> elements= new ArrayList<Object>(Arrays.asList(fWorkingSet.getElements()));
elements.addAll(Arrays.asList(fElementsToAdds));
fWorkingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
}
if (eventDetail == DND.DROP_MOVE) {
ITreeSelection treeSelection= (ITreeSelection)fSelection;
Map<IWorkingSet, List<Object>> workingSets= groupByWorkingSets(treeSelection.getPaths());
for (Iterator<IWorkingSet> iter= workingSets.keySet().iterator(); iter.hasNext();) {
IWorkingSet ws= iter.next();
List<Object> toRemove= workingSets.get(ws);
List<IAdaptable> currentElements= new ArrayList<IAdaptable>(Arrays.asList(ws.getElements()));
currentElements.removeAll(toRemove);
ws.setElements(currentElements.toArray(new IAdaptable[currentElements.size()]));
}
}
}
示例2: restoreChangedWorkingSets
import org.eclipse.ui.IWorkingSet; //导入方法依赖的package包/类
/**
* Rolls back changes to working sets.
*/
private void restoreChangedWorkingSets() {
Iterator<IWorkingSet> iterator= fEditedWorkingSets.keySet().iterator();
while (iterator.hasNext()) {
IWorkingSet editedWorkingSet= iterator.next();
IWorkingSet originalWorkingSet= fEditedWorkingSets.get(editedWorkingSet);
if (editedWorkingSet.getName().equals(originalWorkingSet.getName()) == false) {
editedWorkingSet.setName(originalWorkingSet.getName());
}
if (editedWorkingSet.getElements().equals(originalWorkingSet.getElements()) == false) {
editedWorkingSet.setElements(originalWorkingSet.getElements());
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:WorkingSetConfigurationDialog.java
示例3: run
import org.eclipse.ui.IWorkingSet; //导入方法依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
IWorkingSet ws= getWorkingSet(selection);
if (ws == null)
return;
HashSet<IAdaptable> elements= new HashSet<IAdaptable>(Arrays.asList(ws.getElements()));
List<?> selectedElements= selection.toList();
for (Iterator<?> iter= selectedElements.iterator(); iter.hasNext();) {
Object object= iter.next();
if (object instanceof IAdaptable) {
IAdaptable[] adaptedElements= ws.adaptElements(new IAdaptable[] {(IAdaptable)object});
if (adaptedElements.length == 1) {
elements.remove(adaptedElements[0]);
}
}
}
ws.setElements(elements.toArray(new IAdaptable[elements.size()]));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:RemoveWorkingSetElementAction.java
示例4: add
import org.eclipse.ui.IWorkingSet; //导入方法依赖的package包/类
private static void add(IWorkingSet workingSet, IAdaptable adaptedElement) {
IAdaptable[] elements= workingSet.getElements();
IAdaptable[] newElements= new IAdaptable[elements.length + 1];
System.arraycopy(elements, 0, newElements, 0, elements.length);
newElements[elements.length]= adaptedElement;
workingSet.setElements(newElements);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:ConfigureWorkingSetAssignementAction.java
示例5: checkElementExistence
import org.eclipse.ui.IWorkingSet; //导入方法依赖的package包/类
private void checkElementExistence(IWorkingSet workingSet) {
List<IAdaptable> elements= new ArrayList<IAdaptable>(Arrays.asList(workingSet.getElements()));
boolean changed= false;
for (Iterator<IAdaptable> iter= elements.iterator(); iter.hasNext();) {
IAdaptable element= iter.next();
boolean remove= false;
if (element instanceof IJavaElement) {
IJavaElement jElement= (IJavaElement)element;
// If we have directly a project then remove it when it
// doesn't exist anymore. However if we have a sub element
// under a project only remove the element if the parent
// project is open. Otherwise we would remove all elements
// in closed projects.
if (jElement instanceof IJavaProject) {
remove= !jElement.exists();
} else {
final IJavaProject javaProject= jElement.getJavaProject();
final boolean isProjectOpen= javaProject != null ? javaProject.getProject().isOpen() : true;
remove= isProjectOpen && !jElement.exists();
}
} else if (element instanceof IResource) {
IResource resource= (IResource)element;
// See comments above
if (resource instanceof IProject) {
remove= !resource.exists();
} else {
IProject project= resource.getProject();
remove= (project != null ? project.isOpen() : true) && !resource.exists();
}
}
if (remove) {
iter.remove();
changed= true;
}
}
if (changed) {
workingSet.setElements(elements.toArray(new IAdaptable[elements.size()]));
}
}
示例6: organizeWorkingSetsFromExtensionDirectories
import org.eclipse.ui.IWorkingSet; //导入方法依赖的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: remove
import org.eclipse.ui.IWorkingSet; //导入方法依赖的package包/类
private static void remove(IWorkingSet workingSet, IAdaptable adaptedElement) {
HashSet<IAdaptable> set= new HashSet<IAdaptable>(Arrays.asList(workingSet.getElements()));
set.remove(adaptedElement);
workingSet.setElements(set.toArray(new IAdaptable[set.size()]));
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:6,代码来源:ConfigureWorkingSetAssignementAction.java