List of usage examples for org.eclipse.jface.viewers StructuredSelection StructuredSelection
public StructuredSelection(List elements)
List
. From source file:com.aptana.ide.syncing.ui.handlers.UncloakHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { UncloakAction action = new UncloakAction(); action.setActivePart(null, HandlerUtil.getActivePart(event)); action.setSelection(new StructuredSelection(getSelectedFiles())); action.run(null);// w w w . j a va2 s . c o m return null; }
From source file:com.aptana.ide.syncing.ui.handlers.UploadHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { UploadAction action = new UploadAction(); action.setActivePart(null, HandlerUtil.getActivePart(event)); action.setSelection(new StructuredSelection(getSelectedResources()), isSelectionFromSource()); action.run(null);//from ww w. j av a 2 s . com return null; }
From source file:com.aptana.ide.syncing.ui.views.FTPManagerComposite.java
License:Open Source License
public void setSelectedSite(ISiteConnection siteConnection) { if (siteConnection == fSelectedSite) { return;//from w ww . j a v a 2 s. c om } fSelectedSite = siteConnection; if (siteConnection == null) { fSitesViewer.setSelection(StructuredSelection.EMPTY); fSource.setConnectionPoint(null); fTarget.setConnectionPoint(null); } else { if (siteConnection == DefaultSiteConnection.getInstance()) { fSitesViewer.setInput(new ISiteConnection[] { siteConnection }); } else { fSitesViewer.setInput(SyncingPlugin.getSiteConnectionManager().getSiteConnections()); } fSitesViewer.setSelection(new StructuredSelection(siteConnection)); fSource.setConnectionPoint(siteConnection.getSource()); fTarget.setConnectionPoint(siteConnection.getDestination()); } fireSiteConnectionChanged(fSelectedSite); }
From source file:com.aptana.ide.syncing.ui.views.FTPManagerComposite.java
License:Open Source License
private void transferSourceToDestination() { UploadAction action = new UploadAction(); action.setActivePart(null, UIUtils.getActivePart()); action.setSelectedSite(fSelectedSite); action.setSelection(new StructuredSelection(fSource.getSelectedElements())); action.setSourceRoot(Utils.getFileStore(fSource.getCurrentInput())); action.setDestinationRoot(Utils.getFileStore(fTarget.getCurrentInput())); action.addJobListener(new JobChangeAdapter() { @Override//from w ww. j a va 2 s.co m public void done(IJobChangeEvent event) { if (event.getResult() == Status.CANCEL_STATUS) { return; } UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { fTarget.refresh(); } }); } }); action.run(null); }
From source file:com.aptana.ide.syncing.ui.views.FTPManagerComposite.java
License:Open Source License
private void transferDestinationToSource() { DownloadAction action = new DownloadAction(); action.setActivePart(null, UIUtils.getActivePart()); action.setSelectedSite(fSelectedSite); action.setSelection(new StructuredSelection(fTarget.getSelectedElements()), false); action.setSourceRoot(Utils.getFileStore(fSource.getCurrentInput())); action.setDestinationRoot(Utils.getFileStore(fTarget.getCurrentInput())); action.addJobListener(new JobChangeAdapter() { @Override//from w w w . ja v a 2 s . co m public void done(IJobChangeEvent event) { if (event.getResult() == Status.CANCEL_STATUS) { return; } UIUtils.getDisplay().asyncExec(new Runnable() { public void run() { fSource.refresh(); } }); } }); action.run(null); }
From source file:com.aptana.ide.syncing.ui.wizards.RemoteProjectWizard.java
License:Open Source License
/** * Creates a project resource given the project handle and description. * /*www. j av a 2 s .co m*/ * @param description * the project description to create a project resource for * @param projectHandle * the project handle to create a project resource for * @param monitor * the progress monitor to show visual progress with * @exception CoreException * if the operation fails * @exception OperationCanceledException * if the operation is canceled */ private void createProject(IProjectDescription description, final IProject projectHandle, IProgressMonitor monitor) throws CoreException, OperationCanceledException { try { monitor.beginTask("", 2000);//$NON-NLS-1$ projectHandle.create(description, new SubProgressMonitor(monitor, 1000)); if (monitor.isCanceled()) { throw new OperationCanceledException(); } projectHandle.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 1000)); IConnectionPoint site = connectionPage.getSite(); if (site == null) { return; } IConnectionPoint source = ConnectionPointUtils.findOrCreateWorkspaceConnectionPoint(projectHandle); CoreIOPlugin.getConnectionPointManager().addConnectionPoint(source); ISiteConnection connection = SiteConnectionUtils.createSite(projectHandle.getName(), source, site); SyncingPlugin.getSiteConnectionManager().addSiteConnection(connection); if (connectionPage.isSynchronize()) { UIJob syncJob = new UIJob(Messages.RemoteProjectWizard_UIJOB_Synchronizing) { public IStatus runInUIThread(IProgressMonitor monitor) { DownloadAction action = new DownloadAction(); action.setActivePart(null, PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().getActivePart()); action.setSelection(new StructuredSelection(projectHandle)); action.run(null); return Status.OK_STATUS; } }; syncJob.schedule(); } } finally { monitor.done(); } }
From source file:com.aptana.ide.ui.io.IOUIPlugin.java
License:Open Source License
private static void refreshNavigatorInternal(IViewPart viewPart, Object element, Object selection) { if (viewPart == null) { return;//from w w w .ja va 2 s .c o m } if (viewPart instanceof CommonNavigator) { CommonViewer viewer = ((CommonNavigator) viewPart).getCommonViewer(); if (element == null) { // full refresh System.err.println("FIXME: full refresh for " + viewer.getClass().getSimpleName()); //$NON-NLS-1$ // $codepro.audit.disable debuggingCode viewer.refresh(); } else { Widget widget = viewer.testFindItem(element); if (widget != null) { Object data = widget.getData(); if (data != null) { viewer.refresh(data); } } } } if (selection != null && viewPart instanceof CommonNavigator) { // ensures the category's new content are loaded CommonViewer viewer = ((CommonNavigator) viewPart).getCommonViewer(); viewer.expandToLevel(element, 1); viewer.setSelection(new StructuredSelection(selection)); } }
From source file:com.aptana.ide.ui.io.navigator.actions.FileSystemCopyAction.java
License:Open Source License
private void setClipboard(IFileStore[] fileStores, String[] fileNames, String names) { try {//w w w .j av a 2 s . co m // set the clipboard contents LocalSelectionTransfer selectionTransfer = LocalSelectionTransfer.getTransfer(); selectionTransfer.setSelection(new StructuredSelection(fileStores)); if (fileNames.length > 0) { fClipboard.setContents(new Object[] { fileStores, fileNames, names }, new Transfer[] { LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(), TextTransfer.getInstance() }); } else { fClipboard.setContents(new Object[] { fileStores, names }, new Transfer[] { LocalSelectionTransfer.getTransfer(), TextTransfer.getInstance() }); } } catch (SWTError e) { if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { throw e; // $codepro.audit.disable thrownExceptions } if (MessageDialog.openQuestion(fShell, "Problem with copy title", //$NON-NLS-1$ "Problem with copy.")) { //$NON-NLS-1$ setClipboard(fileStores, fileNames, names); } } }
From source file:com.aptana.ide.ui.io.navigator.FilesystemLinkHelper.java
License:Open Source License
public IStructuredSelection findSelection(IEditorInput anInput) { IFileStore fileStore = (IFileStore) anInput.getAdapter(IFileStore.class); IFileInfo fileInfo = (IFileInfo) anInput.getAdapter(IFileInfo.class); if (fileStore == null || fileInfo == null) { return StructuredSelection.EMPTY; }/*from ww w . ja v a2 s .c o m*/ return new StructuredSelection(new FileSystemObject(fileStore, fileInfo)); }
From source file:com.aptana.ide.update.internal.manager.P2Eclipse35PluginManager.java
License:Open Source License
/** * @see com.aptana.ide.update.manager.IPluginManager#uninstall(IPlugin, IProgressMonitor) *//* w w w . j a v a 2 s . co m*/ public IStatus uninstall(IPlugin plugin, IProgressMonitor monitor) throws PluginManagerException { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } String profileId = IProfileRegistry.SELF; Collector roots = new Collector(); try { InstallableUnitQuery query = new InstallableUnitQuery(getFeatureGroupName(plugin), Version.parseVersion(plugin.getVersion())); ProfileElement element = new ProfileElement(null, profileId); roots = element.getQueryable().query(query, roots, monitor); } catch (CoreException e) { IdeLog.logError(P2Eclipse35Activator.getDefault(), e.getMessage(), e); } if (roots == null || roots.size() <= 0) { throw new PluginManagerException( P2Eclipse35Messages.P2PluginManager_ERR_MSG_No_installable_units_found); } final IInstallableUnit[] ius = (IInstallableUnit[]) roots.toArray(IInstallableUnit.class); if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } UninstallAction action = new UninstallAction(Policy.getDefault(), new ISelectionProvider() { public void addSelectionChangedListener(ISelectionChangedListener listener) { } public ISelection getSelection() { return new StructuredSelection(ius); } public void removeSelectionChangedListener(ISelectionChangedListener listener) { } public void setSelection(ISelection selection) { } }, profileId); action.run(); return Status.OK_STATUS; }