本文整理匯總了Java中org.eclipse.ui.IWorkingSet.isAggregateWorkingSet方法的典型用法代碼示例。如果您正苦於以下問題:Java IWorkingSet.isAggregateWorkingSet方法的具體用法?Java IWorkingSet.isAggregateWorkingSet怎麽用?Java IWorkingSet.isAggregateWorkingSet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.ui.IWorkingSet
的用法示例。
在下文中一共展示了IWorkingSet.isAggregateWorkingSet方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFromSelection
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
private String getFromSelection(ParameterDescriptor descriptor) {
if (selection == null) {
return null;
}
if (descriptor.getType() == ParameterType.WORKINGSET) {
for (Object selected : selection.toArray()) {
if (selected instanceof IWorkingSet) {
IWorkingSet workingSet = (IWorkingSet) selected;
if (!workingSet.isAggregateWorkingSet() && IWorkingSetIDs.JAVA.equals(workingSet.getId())) {
ParameterMapping mapping = descriptor.getDisplayMapping();
Pattern labelPattern = Pattern.compile(mapping.getPattern());
Matcher matcher = labelPattern.matcher(workingSet.getName());
return matcher.replaceAll(mapping.getReplacement());
}
}
}
}
return null;
}
示例2: run
import org.eclipse.ui.IWorkingSet; //導入方法依賴的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);
}
示例3: isValidWorkingSet
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
private static boolean isValidWorkingSet(IWorkingSet set) {
if (set.isAggregateWorkingSet() || !set.isSelfUpdating())
return false;
if (!set.isVisible())
return false;
if (!set.isEditable())
return false;
for (int i= 0; i < VALID_WORKING_SET_IDS.length; i++) {
if (VALID_WORKING_SET_IDS[i].equals(set.getId()))
return true;
}
return false;
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:18,代碼來源:ConfigureWorkingSetAssignementAction.java
示例4: isSupportedAsTopLevelElement
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
/**
* Tells whether the given working set is supported as top-level element
*
* @param workingSet the working set to test
* @return <code>true</code> if the given working set is supported as top-level element
* @since 3.6
*/
public static boolean isSupportedAsTopLevelElement(IWorkingSet workingSet) {
Object id= workingSet.getId();
if (IWorkingSetIDs.OTHERS.equals(id) || IWorkingSetIDs.JAVA.equals(id) || IWorkingSetIDs.RESOURCE.equals(id))
return true;
if (!workingSet.isSelfUpdating() || workingSet.isAggregateWorkingSet())
return false;
IAdaptable[] elements= workingSet.getElements();
for (int i= 0; i < elements.length; i++) {
IAdaptable element= elements[i];
IProject p= (IProject)element.getAdapter(IProject.class);
if (p != null && p.exists())
return true;
}
return false;
}
示例5: getResources
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
/**
* @param wset
* non null working set
* @return non null set with work items, which may be empty
*/
public static Set<WorkItem> getResources(IWorkingSet wset) {
Set<WorkItem> set = new HashSet<WorkItem>();
boolean aggregateWorkingSet = wset.isAggregateWorkingSet();
//TODO: Understand whats happening...
// IAggregateWorkingSet was introduced in Eclipse 3.5
//if (aggregateWorkingSet && wset instanceof IAggregateWorkingSet) {
// IAggregateWorkingSet aggr = (IAggregateWorkingSet) wset;
// IWorkingSet[] sets = aggr.getComponents();
// for (IWorkingSet iWorkingSet : sets) {
// set.addAll(getResources(iWorkingSet));
// }
//} else {
IAdaptable[] elements = wset.getElements();
for (IAdaptable iAdaptable : elements) {
WorkItem item = getWorkItem(iAdaptable);
if (item != null) {
set.add(item);
}
}
//}
return set;
}
示例6: createJavaSearchScope
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
public IJavaSearchScope createJavaSearchScope(IWorkingSet[] workingSets, int includeMask) {
if (workingSets == null || workingSets.length < 1) return EMPTY_SCOPE;
Set<IJavaElement> javaElements = new HashSet<IJavaElement>(workingSets.length * 10);
for (int i = 0; i < workingSets.length; i++) {
IWorkingSet workingSet = workingSets[i];
if (workingSet.isEmpty() && workingSet.isAggregateWorkingSet()) {
return createWorkspaceScope(includeMask);
}
addJavaElements(javaElements, workingSet);
}
return createJavaSearchScope(javaElements, includeMask);
}
示例7: addJavaElements
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
private void addJavaElements(Set<IJavaElement> javaElements, IWorkingSet workingSet) {
if (workingSet == null) return;
if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) {
try {
IJavaProject[] projects =
JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
javaElements.addAll(Arrays.asList(projects));
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
return;
}
IAdaptable[] elements = workingSet.getElements();
for (int i = 0; i < elements.length; i++) {
IJavaElement javaElement = (IJavaElement) elements[i].getAdapter(IJavaElement.class);
if (javaElement != null) {
addJavaElements(javaElements, javaElement);
continue;
}
IResource resource = (IResource) elements[i].getAdapter(IResource.class);
if (resource != null) {
addJavaElements(javaElements, resource);
}
// else we don't know what to do with it, ignore.
}
}
示例8: isValidWorkingSet
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
private static boolean isValidWorkingSet(IWorkingSet workingSet) {
String id= workingSet.getId();
if (!IWorkingSetIDs.JAVA.equals(id) && !IWorkingSetIDs.RESOURCE.equals(id))
return false;
if (workingSet.isAggregateWorkingSet())
return false;
return true;
}
示例9: createJavaSearchScope
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
public IJavaSearchScope createJavaSearchScope(IWorkingSet[] workingSets, int includeMask) {
if (workingSets == null || workingSets.length < 1)
return EMPTY_SCOPE;
Set<IJavaElement> javaElements= new HashSet<IJavaElement>(workingSets.length * 10);
for (int i= 0; i < workingSets.length; i++) {
IWorkingSet workingSet= workingSets[i];
if (workingSet.isEmpty() && workingSet.isAggregateWorkingSet()) {
return createWorkspaceScope(includeMask);
}
addJavaElements(javaElements, workingSet);
}
return createJavaSearchScope(javaElements, includeMask);
}
示例10: addJavaElements
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
private void addJavaElements(Set<IJavaElement> javaElements, IWorkingSet workingSet) {
if (workingSet == null)
return;
if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) {
try {
IJavaProject[] projects= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
javaElements.addAll(Arrays.asList(projects));
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
return;
}
IAdaptable[] elements= workingSet.getElements();
for (int i= 0; i < elements.length; i++) {
IJavaElement javaElement=(IJavaElement) elements[i].getAdapter(IJavaElement.class);
if (javaElement != null) {
addJavaElements(javaElements, javaElement);
continue;
}
IResource resource= (IResource)elements[i].getAdapter(IResource.class);
if (resource != null) {
addJavaElements(javaElements, resource);
}
// else we don't know what to do with it, ignore.
}
}
示例11: restoreDialog
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
@Override
protected void restoreDialog(IDialogSettings settings) {
super.restoreDialog(settings);
if (! BUG_184693) {
boolean showContainer= settings.getBoolean(SHOW_CONTAINER_FOR_DUPLICATES);
fShowContainerForDuplicatesAction.setChecked(showContainer);
fTypeInfoLabelProvider.setContainerInfo(showContainer);
} else {
fTypeInfoLabelProvider.setContainerInfo(true);
}
if (fAllowScopeSwitching) {
String setting= settings.get(WORKINGS_SET_SETTINGS);
if (setting != null) {
try {
IMemento memento= XMLMemento.createReadRoot(new StringReader(setting));
fFilterActionGroup.restoreState(memento);
} catch (WorkbenchException e) {
// don't do anything. Simply don't restore the settings
JavaPlugin.log(e);
}
}
IWorkingSet ws= fFilterActionGroup.getWorkingSet();
if (ws == null || (ws.isAggregateWorkingSet() && ws.isEmpty())) {
setSearchScope(SearchEngine.createWorkspaceScope());
setSubtitle(null);
} else {
setSearchScope(JavaSearchScopeFactory.getInstance().createJavaSearchScope(ws, true));
setSubtitle(ws.getLabel());
}
}
// TypeNameMatch[] types = OpenTypeHistory.getInstance().getTypeInfos();
//
// for (int i = 0; i < types.length; i++) {
// TypeNameMatch type = types[i];
// accessedHistoryItem(type);
// }
}
示例12: propertyChange
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
public void propertyChange(PropertyChangeEvent event) {
if (ignoreFilterChangeEvents)
return;
IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue();
setWorkingSet(newWorkingSet);
if (newWorkingSet != null) {
if (!contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) {
contentService.getActivationService().activateExtensions(
new String[] { WorkingSetsContentProvider.EXTENSION_ID }, false);
contentService.getActivationService().persistExtensionActivations();
}
if (newWorkingSet.isAggregateWorkingSet()) {
IAggregateWorkingSet agWs = (IAggregateWorkingSet) newWorkingSet;
IWorkingSet[] comps = agWs.getComponents();
if (comps.length > 1) {
viewer.getCommonNavigator().setWorkingSetLabel(
WorkbenchNavigatorMessages.actions_WorkingSetActionProvider_multipleWorkingSets);
} else if (comps.length > 0) {
viewer.getCommonNavigator().setWorkingSetLabel(comps[0].getLabel());
} else {
viewer.getCommonNavigator().setWorkingSetLabel(null);
}
} else
viewer.getCommonNavigator().setWorkingSetLabel(workingSet.getLabel());
} else {
viewer.getCommonNavigator().setWorkingSetLabel(null);
}
viewer.getFrameList().reset();
}
示例13: setWorkingSet
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
/**
* Set current active working set.
*
* @param workingSet
* working set to be activated, may be <code>null</code>
*/
protected void setWorkingSet(IWorkingSet workingSet) {
this.workingSet = workingSet;
emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet() && workingSet.isEmpty();
ignoreFilterChangeEvents = true;
try {
workingSetActionGroup.setWorkingSet(workingSet);
} finally {
ignoreFilterChangeEvents = false;
}
if (viewer != null) {
setWorkingSetFilter(workingSet);
if (workingSet == null || emptyWorkingSet
|| !extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS)) {
if (viewer.getInput() != originalViewerInput) {
viewer.setInput(originalViewerInput);
} else {
viewer.refresh();
}
} else {
if (!workingSet.isAggregateWorkingSet()) {
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager();
viewer.setInput(workingSetManager.createAggregateWorkingSet(
"", "", new IWorkingSet[] { workingSet })); //$NON-NLS-1$ //$NON-NLS-2$
} else {
viewer.setInput(workingSet);
}
}
}
}
示例14: getChildren
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof IWorkingSet) {
IWorkingSet workingSet = (IWorkingSet) parentElement;
if (workingSet.isAggregateWorkingSet() && projectExplorer != null) {
switch (projectExplorer.getRootMode()) {
case ProjectExplorer.WORKING_SETS :
return ((IAggregateWorkingSet) workingSet).getComponents();
case ProjectExplorer.PROJECTS :
return getWorkingSetElements(workingSet);
}
}
return getWorkingSetElements(workingSet);
}
return NO_CHILDREN;
}
示例15: createJavaSearchScope
import org.eclipse.ui.IWorkingSet; //導入方法依賴的package包/類
public IJavaSearchScope createJavaSearchScope(IWorkingSet workingSet, int includeMask) {
Set<IJavaElement> javaElements= new HashSet<IJavaElement>(10);
if (workingSet.isEmpty() && workingSet.isAggregateWorkingSet()) {
return createWorkspaceScope(includeMask);
}
addJavaElements(javaElements, workingSet);
return createJavaSearchScope(javaElements, includeMask);
}