Search in sources :

Example 1 with RemoteImportProfileElement

use of org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement in project tracecompass by tracecompass.

the class ImportHandler method execute.

// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return false;
    }
    CommandParameter param;
    fLock.lock();
    try {
        param = fParam;
        if (param == null) {
            return null;
        }
        param = param.clone();
    } finally {
        fLock.unlock();
    }
    // create default project
    IProject project = TmfProjectRegistry.createProject(RemoteFetchLogWizardRemotePage.DEFAULT_REMOTE_PROJECT_NAME, null, null);
    if (param.getSession().isLiveTrace()) {
        importLiveTrace(new LttngRelaydConnectionInfo(param.getSession().getLiveUrl(), param.getSession().getLivePort(), param.getSession().getName()), project);
        return null;
    } else if (param.getSession().isStreamedTrace()) {
        IPreferenceStore store = Activator.getDefault().getPreferenceStore();
        String notify = store.getString(NOTIFY_IMPORT_STREAMED_PREF_KEY);
        if (!MessageDialogWithToggle.ALWAYS.equals(notify)) {
            MessageDialogWithToggle.openInformation(window.getShell(), null, Messages.TraceControl_ImportDialogStreamedTraceNotification, Messages.TraceControl_ImportDialogStreamedTraceNotificationToggle, false, store, NOTIFY_IMPORT_STREAMED_PREF_KEY);
        }
        // Streamed trace
        TmfProjectElement projectElement = TmfProjectRegistry.getProject(project, true);
        TmfTraceFolder traceFolder = projectElement.getTracesFolder();
        ImportTraceWizard wizard = new ImportTraceWizard();
        wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(traceFolder));
        WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
        dialog.open();
        return null;
    }
    // Generate the profile
    TraceSessionComponent session = param.getSession();
    // $NON-NLS-1$
    RemoteImportProfileElement profile = new RemoteImportProfileElement(null, "LTTng Remote Traces");
    RemoteSystemProxy proxy = session.getTargetNode().getRemoteSystemProxy();
    IRemoteConnection rc = proxy.getRemoteConnection();
    String name = rc.getName();
    if (!rc.hasService(IRemoteConnectionHostService.class)) {
        return null;
    }
    String scheme = rc.getConnectionType().getScheme();
    IRemoteConnectionHostService hostService = checkNotNull(rc.getService(IRemoteConnectionHostService.class));
    String address = hostService.getHostname();
    String user = hostService.getUsername();
    int port = hostService.getPort();
    URI remoteUri;
    try {
        remoteUri = new URI(scheme, user, address, port, null, null, null);
    } catch (URISyntaxException e) {
        return false;
    }
    RemoteImportConnectionNodeElement connection = new RemoteImportConnectionNodeElement(profile, name, remoteUri.toString());
    String pathString = session.isSnapshotSession() ? session.getSnapshotInfo().getSnapshotPath() : session.getSessionPath();
    IPath path = new Path(pathString);
    RemoteImportTraceGroupElement group = new RemoteImportTraceGroupElement(connection, path.toString());
    group.setRecursive(true);
    // $NON-NLS-1$//$NON-NLS-2$
    TracePackageElement element = new TracePackageTraceElement(group, "", "");
    // $NON-NLS-1$
    new TracePackageFilesElement(element, ".*");
    String experimentName = path.lastSegment();
    if (!experimentName.startsWith(session.getName())) {
        experimentName = session.getName();
    }
    RemoteFetchLogWizard wizard = new RemoteFetchLogWizard(profile, experimentName);
    wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
    WizardDialog dialog = new WizardDialog(window.getShell(), wizard);
    dialog.open();
    return null;
}
Also used : RemoteImportConnectionNodeElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportConnectionNodeElement) IRemoteConnectionHostService(org.eclipse.remote.core.IRemoteConnectionHostService) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) TmfProjectElement(org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectElement) URISyntaxException(java.net.URISyntaxException) RemoteImportProfileElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement) URI(java.net.URI) ImportTraceWizard(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.importtrace.ImportTraceWizard) TmfTraceFolder(org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceFolder) TracePackageElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageElement) TracePackageTraceElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageTraceElement) RemoteFetchLogWizard(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.RemoteFetchLogWizard) IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) TraceSessionComponent(org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl.TraceSessionComponent) IPath(org.eclipse.core.runtime.IPath) IRemoteConnection(org.eclipse.remote.core.IRemoteConnection) TracePackageFilesElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageFilesElement) RemoteImportTraceGroupElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportTraceGroupElement) IProject(org.eclipse.core.resources.IProject) RemoteSystemProxy(org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy) LttngRelaydConnectionInfo(org.eclipse.tracecompass.internal.lttng2.control.ui.relayd.LttngRelaydConnectionInfo) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with RemoteImportProfileElement

use of org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement in project tracecompass by tracecompass.

the class RemoteProfilesPreferencePage method newProfile.

private RemoteImportProfileElement newProfile(TracePackageElement previous) {
    RemoteImportProfileElement profile = new RemoteImportProfileElement(null, RemoteMessages.RemoteProfilesPreferencePage_DefaultProfileName);
    RemoteImportConnectionNodeElement node = new RemoteImportConnectionNodeElement(profile, RemoteMessages.RemoteProfilesPreferencePage_DefaultConnectionNodeName, RemoteMessages.RemoteProfilesPreferencePage_DefaultConnectionNodeURI);
    RemoteImportTraceGroupElement traceGroup = new RemoteImportTraceGroupElement(node, DEFAULT_ROOT_IMPORT_PATH);
    TracePackageTraceElement trace = new TracePackageTraceElement(traceGroup, DEFAULT_IMPORT_NAME, null);
    new TracePackageFilesElement(trace, DEFAULT_FILE_PATTERN);
    int index = previous == null ? fProfiles.size() : fProfiles.indexOf(previous) + 1;
    fProfiles.add(index, profile);
    newElementAdded(profile);
    return profile;
}
Also used : RemoteImportConnectionNodeElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportConnectionNodeElement) TracePackageFilesElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageFilesElement) TracePackageTraceElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageTraceElement) RemoteImportTraceGroupElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportTraceGroupElement) RemoteImportProfileElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement)

Example 3 with RemoteImportProfileElement

use of org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement in project tracecompass by tracecompass.

the class RemoteProfilesPreferencePage method createGlobalActions.

private void createGlobalActions() {
    fDeleteAction = new Action(RemoteMessages.RemoteProfilesPreferencePage_DeleteAction) {

        @Override
        public void run() {
            final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            if (selection.size() == 0) {
                return;
            }
            for (Object item : selection.toList()) {
                removeElement(item);
            }
        }
    };
    fDeleteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
    fDeleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
    fDeleteAction.setAccelerator(SWT.DEL);
    fCutAction = new Action(RemoteMessages.RemoteProfilesPreferencePage_CutAction) {

        @Override
        public void run() {
            final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            if (selection.size() != 1) {
                return;
            }
            setClipboardContents(selection);
            Object item = selection.getFirstElement();
            removeElement(item);
        }
    };
    fCutAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
    fCutAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_CUT);
    fCutAction.setAccelerator(SWT.CTRL | 'X');
    fCopyAction = new Action(RemoteMessages.RemoteProfilesPreferencePage_CopyAction) {

        @Override
        public void run() {
            final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            if (selection.size() != 1) {
                return;
            }
            setClipboardContents(new StructuredSelection(copyElement(null, (TracePackageElement) selection.getFirstElement())));
        }
    };
    fCopyAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
    fCopyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);
    fCopyAction.setAccelerator(SWT.CTRL | 'C');
    fPasteAction = new Action(RemoteMessages.RemoteProfilesPreferencePage_PasteAction) {

        @Override
        public void run() {
            final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            if (selection.size() > 1) {
                return;
            }
            if (!validatePaste(selection.getFirstElement())) {
                return;
            }
            IStructuredSelection data = getClipboardContents();
            data = getClipboardContents();
            if (data == null) {
                return;
            }
            for (Object object : data.toArray()) {
                if (object instanceof RemoteImportProfileElement) {
                    TracePackageElement element = copyElement(null, (TracePackageElement) object);
                    TracePackageElement target = (TracePackageElement) selection.getFirstElement();
                    if (target == null) {
                        fProfiles.add((RemoteImportProfileElement) element);
                    } else {
                        int index = fProfiles.indexOf(target);
                        fProfiles.add(index + 1, (RemoteImportProfileElement) element);
                    }
                    Object[] expanded = fTreeViewer.getExpandedElements();
                    fTreeViewer.refresh();
                    fTreeViewer.setExpandedElements(expanded);
                    fTreeViewer.expandToLevel(element, AbstractTreeViewer.ALL_LEVELS);
                    fTreeViewer.setSelection(new StructuredSelection(element));
                    validate();
                } else if (object instanceof TracePackageElement && selection.getFirstElement() instanceof TracePackageElement) {
                    TracePackageElement element = copyElement(null, (TracePackageElement) object);
                    TracePackageElement target = (TracePackageElement) selection.getFirstElement();
                    if (target.getClass().equals(element.getClass())) {
                        int index = target.getParent().indexOf(target);
                        target.getParent().addChild(index + 1, element);
                        fTreeViewer.refresh(target.getParent());
                    } else {
                        target.addChild(0, element);
                        fTreeViewer.refresh(target);
                    }
                    fTreeViewer.expandToLevel(element, AbstractTreeViewer.ALL_LEVELS);
                    fTreeViewer.setSelection(new StructuredSelection(element));
                    validate();
                }
            }
        }
    };
    fPasteAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
    fPasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);
    fPasteAction.setAccelerator(SWT.CTRL | 'V');
    fTreeViewer.getTree().addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.stateMask == 0 && e.keyCode == SWT.DEL) {
                fDeleteAction.run();
            }
            if ((e.stateMask & SWT.CTRL) == SWT.CTRL) {
                if (e.keyCode == 'x') {
                    fCutAction.run();
                } else if (e.keyCode == 'c') {
                    fCopyAction.run();
                } else if (e.keyCode == 'v') {
                    fPasteAction.run();
                }
            }
        }
    });
}
Also used : KeyEvent(org.eclipse.swt.events.KeyEvent) Action(org.eclipse.jface.action.Action) KeyAdapter(org.eclipse.swt.events.KeyAdapter) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) TracePackageElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageElement) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RemoteImportProfileElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement)

Example 4 with RemoteImportProfileElement

use of org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement in project tracecompass by tracecompass.

the class RemoteProfilesPreferencePage method createVerticalButtonBar.

private Composite createVerticalButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    fAddButton = createVerticalButton(composite, RemoteMessages.RemoteProfilesPreferencePage_AddButton);
    fAddButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            if (selection.isEmpty()) {
                newProfile(null);
            } else if (selection.getFirstElement() instanceof TracePackageElement) {
                TracePackageElement previous = (TracePackageElement) selection.getFirstElement();
                if (previous instanceof RemoteImportProfileElement) {
                    newProfile(previous);
                } else if (previous instanceof RemoteImportConnectionNodeElement) {
                    newConnectionNode(previous.getParent(), previous);
                } else if (previous instanceof RemoteImportTraceGroupElement) {
                    newTraceGroup(previous.getParent(), previous);
                } else if (previous instanceof TracePackageTraceElement) {
                    newTrace(previous.getParent(), previous);
                }
            }
        }
    });
    fRemoveButton = createVerticalButton(composite, RemoteMessages.RemoteProfilesPreferencePage_RemoveButton);
    fRemoveButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            for (Object item : selection.toList()) {
                if (item instanceof RemoteImportProfileElement) {
                    fProfiles.remove(item);
                } else if (item instanceof TracePackageElement) {
                    TracePackageElement element = (TracePackageElement) item;
                    element.getParent().removeChild(element);
                }
            }
            fTreeViewer.refresh();
            validate();
        }
    });
    new Label(composite, SWT.NONE);
    fImportButton = createVerticalButton(composite, RemoteMessages.RemoteProfilesPreferencePage_ImportButton);
    fImportButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.OPEN);
            dialog.setText(RemoteMessages.RemoteProfilesPreferencePage_ImportFileDialogTitle);
            // $NON-NLS-1$ //$NON-NLS-2$
            dialog.setFilterExtensions(new String[] { "*.xml", "*" });
            String path = dialog.open();
            if (path != null) {
                List<RemoteImportProfileElement> profiles = readProfiles(path, new NullProgressMonitor());
                fProfiles.addAll(profiles);
                fTreeViewer.refresh();
                for (RemoteImportProfileElement profile : profiles) {
                    fTreeViewer.expandToLevel(profile, AbstractTreeViewer.ALL_LEVELS);
                }
                fTreeViewer.setSelection(new StructuredSelection(profiles));
                validate();
            }
        }
    });
    fExportButton = createVerticalButton(composite, RemoteMessages.RemoteProfilesPreferencePage_ExportButton);
    fExportButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.SAVE);
            dialog.setText(RemoteMessages.RemoteProfilesPreferencePage_ExportFileDialogTitle);
            // $NON-NLS-1$ //$NON-NLS-2$
            dialog.setFilterExtensions(new String[] { "*.xml", "*" });
            String path = dialog.open();
            if (path != null) {
                IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
                List<RemoteImportProfileElement> profiles = new ArrayList<>();
                for (Object element : selection.toList()) {
                    if (element instanceof RemoteImportProfileElement) {
                        profiles.add((RemoteImportProfileElement) element);
                    }
                }
                writeProfiles(profiles, path);
            }
        }
    });
    new Label(composite, SWT.NONE);
    fMoveUpButton = createVerticalButton(composite, RemoteMessages.RemoteProfilesPreferencePage_MoveUpButton);
    fMoveUpButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            Object element = selection.getFirstElement();
            if (element instanceof RemoteImportProfileElement) {
                int index = fProfiles.indexOf(element);
                if (index > 0) {
                    RemoteImportProfileElement profile = fProfiles.remove(index);
                    fProfiles.add(index - 1, profile);
                    Object[] expanded = fTreeViewer.getExpandedElements();
                    fTreeViewer.refresh();
                    fTreeViewer.setExpandedElements(expanded);
                    enableButtons(selection);
                }
            } else if (element instanceof TracePackageElement) {
                TracePackageElement child = (TracePackageElement) element;
                TracePackageElement parentElement = child.getParent();
                int index = parentElement.indexOf(child);
                if (index > 0) {
                    parentElement.removeChild(child);
                    parentElement.addChild(index - 1, child);
                    Object[] expanded = fTreeViewer.getExpandedElements();
                    fTreeViewer.refresh(parentElement);
                    fTreeViewer.setExpandedElements(expanded);
                    enableButtons(selection);
                }
            }
        }
    });
    fMoveDownButton = createVerticalButton(composite, RemoteMessages.RemoteProfilesPreferencePage_MoveDownButton);
    fMoveDownButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
            Object element = selection.getFirstElement();
            if (element instanceof RemoteImportProfileElement) {
                int index = fProfiles.indexOf(selection.getFirstElement());
                if (index >= 0 && index < fProfiles.size() - 1) {
                    RemoteImportProfileElement profile = fProfiles.remove(index);
                    fProfiles.add(index + 1, profile);
                    Object[] expanded = fTreeViewer.getExpandedElements();
                    fTreeViewer.refresh();
                    fTreeViewer.setExpandedElements(expanded);
                    enableButtons(selection);
                }
            } else if (element instanceof TracePackageElement) {
                TracePackageElement child = (TracePackageElement) element;
                TracePackageElement parentElement = child.getParent();
                int index = parentElement.indexOf(child);
                if (index >= 0 && index < parentElement.getChildren().length - 1) {
                    parentElement.removeChild(child);
                    parentElement.addChild(index + 1, child);
                    Object[] expanded = fTreeViewer.getExpandedElements();
                    fTreeViewer.refresh(parentElement);
                    fTreeViewer.setExpandedElements(expanded);
                    enableButtons(selection);
                }
            }
        }
    });
    return composite;
}
Also used : RemoteImportConnectionNodeElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportConnectionNodeElement) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RemoteImportTraceGroupElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportTraceGroupElement) RemoteImportProfileElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TracePackageElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageElement) List(java.util.List) ArrayList(java.util.ArrayList) TracePackageTraceElement(org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageTraceElement) FileDialog(org.eclipse.swt.widgets.FileDialog)

Example 5 with RemoteImportProfileElement

use of org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement in project tracecompass by tracecompass.

the class RemoteProfilesPreferencePage method fillContextMenu.

private void fillContextMenu(IMenuManager manager) {
    final IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
    final List<Object> items = selection.toList();
    if (items.size() == 1) {
        Object item = items.get(0);
        if (item instanceof RemoteImportProfileElement) {
            final RemoteImportProfileElement profile = (RemoteImportProfileElement) item;
            manager.add(new Action(RemoteMessages.RemoteProfilesPreferencePage_NewConnectionNode) {

                @Override
                public void run() {
                    newConnectionNode(profile, null);
                }
            });
        } else if (item instanceof RemoteImportConnectionNodeElement) {
            final RemoteImportConnectionNodeElement node = (RemoteImportConnectionNodeElement) item;
            manager.add(new Action(RemoteMessages.RemoteProfilesPreferencePage_NewTraceGroupAction) {

                @Override
                public void run() {
                    newTraceGroup(node, null);
                }
            });
        } else if (item instanceof RemoteImportTraceGroupElement) {
            final RemoteImportTraceGroupElement traceGroup = (RemoteImportTraceGroupElement) item;
            manager.add(new Action(RemoteMessages.RemoteProfilesPreferencePage_NewTraceAction) {

                @Override
                public void run() {
                    newTrace(traceGroup, null);
                }
            });
        }
    }
    manager.add(new Separator());
    manager.add(fDeleteAction);
    fDeleteAction.setEnabled(!items.isEmpty());
    manager.add(new Separator());
    manager.add(fCutAction);
    fCutAction.setEnabled(items.size() == 1);
    manager.add(fCopyAction);
    fCopyAction.setEnabled(items.size() == 1);
    manager.add(fPasteAction);
    fPasteAction.setEnabled(items.size() <= 1 && validatePaste(selection.getFirstElement()));
}
Also used : RemoteImportConnectionNodeElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportConnectionNodeElement) Action(org.eclipse.jface.action.Action) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RemoteImportTraceGroupElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportTraceGroupElement) RemoteImportProfileElement(org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement) Separator(org.eclipse.jface.action.Separator)

Aggregations

RemoteImportProfileElement (org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportProfileElement)12 RemoteImportConnectionNodeElement (org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportConnectionNodeElement)9 TracePackageElement (org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageElement)9 RemoteImportTraceGroupElement (org.eclipse.tracecompass.internal.tmf.remote.ui.wizards.fetch.model.RemoteImportTraceGroupElement)8 TracePackageTraceElement (org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageTraceElement)8 TracePackageFilesElement (org.eclipse.tracecompass.internal.tmf.ui.project.wizards.tracepkg.TracePackageFilesElement)7 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)4 ArrayList (java.util.ArrayList)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 URI (java.net.URI)2 URISyntaxException (java.net.URISyntaxException)2 Action (org.eclipse.jface.action.Action)2 Image (org.eclipse.swt.graphics.Image)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 HashSet (java.util.HashSet)1 List (java.util.List)1 PatternSyntaxException (java.util.regex.PatternSyntaxException)1