本文整理匯總了Java中org.eclipse.ui.IWorkingSet類的典型用法代碼示例。如果您正苦於以下問題:Java IWorkingSet類的具體用法?Java IWorkingSet怎麽用?Java IWorkingSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IWorkingSet類屬於org.eclipse.ui包,在下文中一共展示了IWorkingSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getStrategy
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
/**
* Returns with the strategy for the given property change even argument,
*
* @param event
* a property change argument.
* @return a strategy encapsulating an actual working set manager modification.
*/
public WorkingSetManagerModificationStrategy getStrategy(final PropertyChangeEvent event) {
if (event == null) {
return NOOP;
}
final String property = event.getProperty();
switch (property) {
case CHANGE_WORKING_SET_ADD:
return new AddWorkingSetModificationStrategy((IWorkingSet) event.getNewValue());
case CHANGE_WORKING_SET_REMOVE:
return new RemoveWorkingSetModificationStrategy((IWorkingSet) event.getOldValue());
case CHANGE_WORKING_SET_LABEL_CHANGE: //$FALL-THROUGH$
case CHANGE_WORKING_SET_NAME_CHANGE: //$FALL-THROUGH$
case CHANGE_WORKING_SET_CONTENT_CHANGE:
return new UpdateWorkingSetModificationStraregy(
(IWorkingSet) event.getOldValue(),
(IWorkingSet) event.getNewValue());
default:
return NOOP;
}
}
示例2: performFinish
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
@Override
public boolean performFinish()
{
boolean res = super.performFinish();
if( res )
{
final IJavaElement newElement = getCreatedElement();
IWorkingSet[] workingSets = fFirstPage.getWorkingSets();
if( workingSets.length > 0 )
{
PlatformUI.getWorkbench().getWorkingSetManager().addToWorkingSets(newElement, workingSets);
}
BasicNewResourceWizard.selectAndReveal(fSecondPage.getJavaProject().getProject(), getWorkbench()
.getActiveWorkbenchWindow());
}
return res;
}
示例3: resolve__workingset_1_contains_project1__so_one_entry_for_workingset_is_returned
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
@Test
public void resolve__workingset_1_contains_project1__so_one_entry_for_workingset_is_returned() {
/* prepare */
ArrayList<IProject> projects = new ArrayList<>();
projects.add(mockedProject1);
projects.add(mockedProject2);
when(mockedManager.getAllWorkingSets()).thenReturn(new IWorkingSet[]{mockedWorkingSet1});
when(mockedWorkingSet1.getElements()).thenReturn(new IAdaptable[]{mockedProject1Adaptable});
/* execute */
List<WorkingSetData> workingSetDataList = supportToTest.resolveWorkingSetsForProjects(projects,
mockedManager);
/* test */
assertNotNull(workingSetDataList);
assertEquals(1,workingSetDataList.size());
WorkingSetData data = workingSetDataList.iterator().next();
assertEquals(mockedWorkingSet1, data.workingSet);
assertTrue(data.projectNamesContainedBefore.contains("project1"));
assertFalse(data.projectNamesContainedBefore.contains("project2"));
}
示例4: addProjectToSelectedWorkingSet
import org.eclipse.ui.IWorkingSet; //導入依賴的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});
}
}
}
}
示例5: getLabel
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
public static String getLabel(final IWorkingSet workingSet) {
Check.notNull(workingSet, "workingSet"); //$NON-NLS-1$
try {
final Method getLabelMethod = workingSet.getClass().getMethod("getLabel", new Class[0]); //$NON-NLS-1$
final Object labelResult = getLabelMethod.invoke(workingSet, new Object[0]);
if (labelResult != null && labelResult instanceof String) {
return (String) labelResult;
}
} catch (final Exception e) {
/* Suppress, Eclipse < 3.1 */
}
return workingSet.getName();
}
示例6: isAggregateWorkingSet
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
public static boolean isAggregateWorkingSet(final IWorkingSet workingSet) {
Check.notNull(workingSet, "workingSet"); //$NON-NLS-1$
try {
final Method isAggregateMethod = workingSet.getClass().getMethod("isAggregateWorkingSet", new Class[0]); //$NON-NLS-1$
final Object aggregateResult = isAggregateMethod.invoke(workingSet, new Object[0]);
if (aggregateResult != null && aggregateResult instanceof Boolean) {
return ((Boolean) aggregateResult).booleanValue();
}
} catch (final Exception e) {
/* Suppress, Eclipse < 3.1 */
}
return false;
}
示例7: selectWorkingSet
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
private void selectWorkingSet() {
final IWorkingSetSelectionDialog workingSetDialog =
PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSetSelectionDialog(getShell(), false);
if (workingSetDialog.open() != IDialogConstants.OK_ID) {
return;
}
final IWorkingSet[] selection = workingSetDialog.getSelection();
final IWorkingSet set = selection.length == 0 ? null : selection[0];
computeWorkingSets(set);
if (selection.length > 0) {
selectWorkingSet(set);
}
}
示例8: selectWorkingSetAction
import org.eclipse.ui.IWorkingSet; //導入依賴的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);
}
示例9: updateWorkingSetScope
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
private void updateWorkingSetScope() {
if(workingSets != null) {
List allWorkingSetResources = new ArrayList();
for (int i = 0; i < workingSets.length; i++) {
IWorkingSet set = workingSets[i];
allWorkingSetResources.addAll(IDE.computeSelectedResources(new StructuredSelection(set.getElements())));
}
scopeCheckingElement = true;
fViewer.setCheckedElements(allWorkingSetResources.toArray(new IResource[allWorkingSetResources.size()]));
scopeCheckingElement = false;
setPageComplete(true);
} else {
scopeCheckingElement = true;
fViewer.setCheckedElements(new Object[0]);
scopeCheckingElement = false;
setPageComplete(false);
}
}
示例10: initialize
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
/**
* Initializes GUI elements of {@link NewExtensionWizardPage}
*/
private void initialize() {
ExtensionUtils.getTemplates().stream().forEach(template -> extensionTemplateCombo.add(template));
extensionTemplateCombo.setText("yempty");
IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets();
if (workingSets != null)
{
for (IWorkingSet workingSet: workingSets)
{
if (!workingSet.getName().startsWith("Aggregate"))
{
workingSetCombo.add(workingSet.getName());
}
}
}
extensionDirectoryField.setStringValue(getDefaultExtensionLocation());
}
示例11: addExtensionToWorkingSet
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
private void addExtensionToWorkingSet(IProgressMonitor monitor) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
if (workingSet != null && !workingSet.equals(""))
{
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(extension.getName());
IWorkingSet ws = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSet(workingSet);
if (ws == null)
{
ws = PlatformUI.getWorkbench().getWorkingSetManager().createWorkingSet(workingSet, new IProject[]{proj});
}
else
{ Set<IProject> projs = new HashSet(Arrays.asList(ws.getElements()));
projs.add(proj);
ws.setElements(projs.toArray(new IProject[projs.size()]));
}
}
}
});
}
示例12: performFinish
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
@Override
public boolean performFinish() {
createNewProject();
if (newProject == null) {
return false;
}
IWorkingSet[] workingSets = mainPage.getSelectedWorkingSets();
getWorkbench().getWorkingSetManager().addToWorkingSets(newProject, workingSets);
updatePerspective();
selectAndReveal(newProject);
return true;
}
示例13: WorkbenchTreeViewer
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
/**
* Instantiates a new workbench tree viewer.
*
* @param parent the parent
* @param selectionStyle the selection style
* @param rootElement the root element
* @param expand the expand
* @param extensions the extensions
* @param workingSet the working set
*/
public WorkbenchTreeViewer(Composite parent, int selectionStyle, IResource rootElement, boolean expand, String[] extensions, IWorkingSet workingSet) {
super(parent, selectionStyle | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
this.extensions = extensions;
this.workingSet = workingSet;
setUseHashlookup(true);
initContentProvider(this);
initLabelProvider(this);
initFilters(this);
this.setInput(rootElement);
if (expand) {
this.expandToLevel(2);
}
}
開發者ID:germanattanasio,項目名稱:traceability-assistant-eclipse-plugins,代碼行數:27,代碼來源:WorkbenchTreeViewer.java
示例14: getJavaElements
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
private IJavaElement[] getJavaElements(Object[] elements) {
if (elements.length == 0) return new IJavaElement[0];
Set<IJavaElement> result = new HashSet<IJavaElement>(elements.length);
for (int i = 0; i < elements.length; i++) {
Object selectedElement = elements[i];
if (selectedElement instanceof IJavaElement) {
addJavaElements(result, (IJavaElement) selectedElement);
} else if (selectedElement instanceof IResource) {
addJavaElements(result, (IResource) selectedElement);
} else if (selectedElement instanceof LogicalPackage) {
addJavaElements(result, (LogicalPackage) selectedElement);
} else if (selectedElement instanceof IWorkingSet) {
IWorkingSet ws = (IWorkingSet) selectedElement;
addJavaElements(result, ws);
} else if (selectedElement instanceof IAdaptable) {
IResource resource = (IResource) ((IAdaptable) selectedElement).getAdapter(IResource.class);
if (resource != null) addJavaElements(result, resource);
}
}
return result.toArray(new IJavaElement[result.size()]);
}
示例15: GpsProject
import org.eclipse.ui.IWorkingSet; //導入依賴的package包/類
private GpsProject(IProject project) throws GpsFileException {
name = project.getName();
for (IWorkingSet ws: PlatformUI.getWorkbench().getWorkingSetManager().getAllWorkingSets()) {
if (ws.getId() != null && ws.getId().equals("org.eclipse.jdt.ui.JavaWorkingSetPage")) { //$NON-NLS-1$
for (IAdaptable element: ws.getElements()) {
if (project.equals(element.getAdapter(IProject.class))) {
workingSets.add(ws.getName());
break;
}
}
}
}
try {
repositoryHandler = GpsRepositoryFactory.createHandler(project, this);
} catch (Throwable t) {
throw new GpsFileException("Cannot serialize project {0}", t, project.getName());
}
}