From: Francois Chouinard Date: Thu, 23 Feb 2012 19:04:17 +0000 (-0500) Subject: Remove the obsolete LTTng Project View X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=d95da94049f45f764f33f73996284ce5dd523294;p=deliverable%2Ftracecompass.git Remove the obsolete LTTng Project View --- diff --git a/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF index 78c44cbfbe..262dff5e7b 100644 --- a/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF @@ -45,10 +45,6 @@ Export-Package: org.eclipse.linuxtools.lttng.ui;x-friends:="org.eclipse.linuxtoo org.eclipse.linuxtools.lttng.ui.views.latency.dialogs;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", org.eclipse.linuxtools.lttng.ui.views.latency.listeners;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", org.eclipse.linuxtools.lttng.ui.views.latency.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", - org.eclipse.linuxtools.lttng.ui.views.project;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", - org.eclipse.linuxtools.lttng.ui.views.project.dialogs;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", - org.eclipse.linuxtools.lttng.ui.views.project.handlers;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", - org.eclipse.linuxtools.lttng.ui.views.project.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", org.eclipse.linuxtools.lttng.ui.views.resources;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", org.eclipse.linuxtools.lttng.ui.views.resources.evProcessor;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", org.eclipse.linuxtools.lttng.ui.views.resources.model;x-friends:="org.eclipse.linuxtools.lttng.ui.tests", diff --git a/org.eclipse.linuxtools.lttng.ui/icons/eview16/project_view.gif b/org.eclipse.linuxtools.lttng.ui/icons/eview16/project_view.gif deleted file mode 100644 index 4b98a62c6e..0000000000 Binary files a/org.eclipse.linuxtools.lttng.ui/icons/eview16/project_view.gif and /dev/null differ diff --git a/org.eclipse.linuxtools.lttng.ui/plugin.properties b/org.eclipse.linuxtools.lttng.ui/plugin.properties index 2211985c6d..d7b5eefcf8 100644 --- a/org.eclipse.linuxtools.lttng.ui/plugin.properties +++ b/org.eclipse.linuxtools.lttng.ui/plugin.properties @@ -6,7 +6,6 @@ Bundle-Vendor = Eclipse Linux Tools perspective.category.name = LTTng views.category.name = LTTng -project.view.name = Projects control.view.name = Control events.view.name = Events timeframe.view.name = Time Frame @@ -28,22 +27,6 @@ tracetype.category.lttng= LTTng tracetype.type.kernel = Kernel Trace #Commands and Menus -commands.project.category.name = LTTng Project Commands -commands.project.category.description = LTTng Project Commands -commands.project.new = New Project -commands.project.new.description = Create a new LTTng Project -commands.project.open = Open Project -commands.project.open.description = Open an LTTng Project -commands.project.close = Close Project -commands.project.close.description = Close an LTTng Project -commands.project.rename = Rename Project -commands.project.rename.description = Rename an LTTng Project -commands.project.delete = Delete Project -commands.project.delete.description = Delete an LTTng Project -commands.project.refresh = Refresh View -commands.project.refresh.description = Refresh the Project list -commands.project.property = P&roperties -commands.project.property.description = Manage project properties commands.trace.category.name = LTTng Trace Commands commands.trace.category.description = LTTng Trace Commands commands.trace.import = Import Trace diff --git a/org.eclipse.linuxtools.lttng.ui/plugin.xml b/org.eclipse.linuxtools.lttng.ui/plugin.xml index d30b38ee42..8a2dff022e 100644 --- a/org.eclipse.linuxtools.lttng.ui/plugin.xml +++ b/org.eclipse.linuxtools.lttng.ui/plugin.xml @@ -18,15 +18,6 @@ id="org.eclipse.linuxtools.lttng.ui.views.category" name="%views.category.name"> - - ProjectView - *

- * The ProjectView keeps track of the LTTng projects in the workspace. - */ -public class ProjectView extends TmfView { - - public static final String ID = "org.eclipse.linuxtools.lttng.ui.views.project"; //$NON-NLS-1$ - - // ------------------------------------------------------------------------ - // Main data structures - // ------------------------------------------------------------------------ - - private TreeViewer fViewer; - private LTTngProjectRoot fProjectRoot; - private LTTngExperiment fSelectedExperiment = null; - - private IWorkspace fWorkspace; - private IResourceChangeListener fResourceChangeListener; - - // ------------------------------------------------------------------------ - // View refresher - // ------------------------------------------------------------------------ - - // Perform updates on the UI thread - private Runnable fViewRefresher = new Runnable() { - @Override - public void run() { - if ((fViewer != null) && (!fViewer.getTree().isDisposed())) { - Object[] elements = fViewer.getExpandedElements(); - fViewer.refresh(); - fViewer.setExpandedElements(elements); - } - } - }; - - public LTTngProjectRoot getRoot() { - return fProjectRoot; - } - - // ------------------------------------------------------------------------ - // Constructor - // ------------------------------------------------------------------------ - - public ProjectView() { - - super("ProjectView"); //$NON-NLS-1$ - fProjectRoot = new LTTngProjectRoot(this); - - fWorkspace = ResourcesPlugin.getWorkspace(); - fResourceChangeListener = new IResourceChangeListener() { - @Override - public void resourceChanged(IResourceChangeEvent event) { - if (event.getType() == IResourceChangeEvent.POST_CHANGE) { - fProjectRoot.refreshChildren(); - refresh(); - } - } - }; - fWorkspace.addResourceChangeListener(fResourceChangeListener); - } - - public void refresh() { - Tree tree = fViewer.getTree(); - if (tree != null && !tree.isDisposed()) - tree.getDisplay().asyncExec(fViewRefresher); - } - - public void setSelection(ILTTngProjectTreeNode node) { - fViewer.setSelection(new StructuredSelection(node), true); - } - - @Override - public void dispose() { - fWorkspace.removeResourceChangeListener(fResourceChangeListener); - } - - @Override - public void createPartControl(Composite parent) { - - fViewer = new TreeViewer(parent, SWT.SINGLE); - fViewer.setContentProvider(new LTTngProjectContentProvider()); - fViewer.setSorter(new ViewerSorter()); - fViewer.setLabelProvider(new LTTngProjectLabelProvider()); - fViewer.setInput(fProjectRoot); - - getSite().setSelectionProvider(fViewer); - hookMouse(); - - createContextMenu(); - } - - // ------------------------------------------------------------------------ - // ViewPart - // ------------------------------------------------------------------------ - - @Override - @SuppressWarnings("nls") - public String toString() { - return "[ProjectView]"; - } - - // ------------------------------------------------------------------------ - // hookMouse - // ------------------------------------------------------------------------ - - private void hookMouse() { - fViewer.getTree().addMouseListener(new MouseAdapter() { - @Override - public void mouseDoubleClick(MouseEvent event) { - TreeSelection selection = (TreeSelection) fViewer.getSelection(); - Object element = selection.getFirstElement(); - if (element instanceof LTTngExperimentNode) { - LTTngExperimentNode experiment = (LTTngExperimentNode) element; - selectExperiment(experiment); - } else { - if (element instanceof LTTngTraceNode) { - LTTngTraceNode trace = (LTTngTraceNode) element; - selectTrace(trace); - } - } - } - }); - } - - private void selectTrace(LTTngTraceNode traceNode) { - if (fSelectedExperiment != null) { - fSelectedExperiment.dispose(); - } - - try { - ITmfTrace[] traces = new ITmfTrace[1]; - IResource res = traceNode.getFolder(); - String location = res.getLocation().toOSString(); - LTTngProjectNode projectNode = traceNode.getProject(); - IProject project = projectNode.getProject(); - String traceLibPath = TraceHelper.getTraceLibDirFromProject(project); - ITmfTrace trace = new LTTngTrace(location, traceLibPath, waitForCompletion, false); - traces[0] = trace; - fSelectedExperiment = new LTTngExperiment(LttngEvent.class, traceNode.getName(), traces); - TmfExperiment.setCurrentExperiment(fSelectedExperiment); - - // Make sure the lttng-core, experiment selection context is ready - // for an event request from any view -// StateManagerFactory.getExperimentManager().experimentSelected_prep( -// (TmfExperiment) fSelectedExperiment); - - broadcast(new TmfExperimentSelectedSignal(this, fSelectedExperiment)); - } catch (FileNotFoundException e) { - return; - } catch (Exception e) { - MessageDialog.openError(getViewSite().getShell(), Messages.SelectTrace_ErrorTitle, e.getMessage()); - } - } - - private boolean waitForCompletion = true; - - /** - * @param experiment - */ - public void selectExperiment(LTTngExperimentNode experiment) { - String expId = experiment.getName(); - if (fSelectedExperiment != null) { -// System.out.println(fSelectedExperiment.getName() + ": nbEvents=" + fSelectedExperiment.getNbEvents() + -// ", nbReads=" + ((LTTngTrace) fSelectedExperiment.getTraces()[0]).nbEventsRead); - fSelectedExperiment.dispose(); - } - try { - LTTngTraceNode[] traceEntries = experiment.getTraces(); - int nbTraces = traceEntries.length; - ITmfTrace[] traces = new ITmfTrace[nbTraces]; - for (int i = 0; i < nbTraces; i++) { - IResource res = traceEntries[i].getFolder(); - String location = res.getLocation().toOSString(); - IProject project = res.getProject().getProject(); - String traceLibPath = TraceHelper.getTraceLibDirFromProject(project); - ITmfTrace trace = new LTTngTrace(location, traceLibPath, waitForCompletion, false); - traces[i] = trace; - } - fSelectedExperiment = new LTTngExperiment(LttngEvent.class, expId, traces); - TmfExperiment.setCurrentExperiment(fSelectedExperiment); - - // Make sure the lttng-core, experiment selection context is ready - // for an event request from any view -// StateManagerFactory.getExperimentManager().experimentSelected_prep( -// (TmfExperiment) fSelectedExperiment); - -// System.out.println(System.currentTimeMillis() + ": Experiment selected"); - broadcast(new TmfExperimentSelectedSignal(this, fSelectedExperiment)); - } catch (FileNotFoundException e) { - return; - } catch (Exception e) { - e.printStackTrace(); - } - } - - // ------------------------------------------------------------------------ - // createContextMenu - // ------------------------------------------------------------------------ - - // Populated from the plug-in - private void createContextMenu() { - MenuManager menuManager = new MenuManager("#PopupMenu"); //$NON-NLS-1$ - menuManager.setRemoveAllWhenShown(true); - Menu menu = menuManager.createContextMenu(fViewer.getControl()); - fViewer.getControl().setMenu(menu); - getSite().registerContextMenu(menuManager, fViewer); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/AddTraceWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/AddTraceWizard.java deleted file mode 100644 index c179455c0e..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/AddTraceWizard.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceNode; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; - -/** - * AddTraceWizard - *

- * TODO: Implement me. Please. - */ -@Deprecated -public class AddTraceWizard extends Wizard implements IImportWizard { - - private LTTngProjectNode fProject; - private LTTngExperimentNode fExperiment; - private AddTraceWizardPage fMainPage; - - /** - * @param project - */ - public AddTraceWizard(LTTngProjectNode project, LTTngExperimentNode experiment) { - fProject = project; - fExperiment = experiment; - } - - /* (non-Javadoc) - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection) - */ - @Override - public void init(IWorkbench workbench, IStructuredSelection selection) { - setWindowTitle(Messages.AddTraceWizard_windowTitle); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ - @Override - public void addPages() { - super.addPages(); - fMainPage = new AddTraceWizardPage(fProject, "Some string"); //$NON-NLS-1$ - addPage(fMainPage); - } - - /* (non-Javadoc) - * @see org.eclipse.jface.wizard.Wizard#performFinish() - */ - @Override - public boolean performFinish() { - - IWorkspace workspace = ResourcesPlugin.getWorkspace(); - IFolder experimentFolder = fExperiment.getFolder(); - - LTTngTraceNode[] traces = fMainPage.getSelection(); - for (LTTngTraceNode trace : traces) { - try { - IFolder folder = experimentFolder.getFolder(trace.getName()); - IPath location = trace.getFolder().getLocation(); - if (workspace.validateLinkLocation(folder, location).isOK()) { - folder.createLink(location, IResource.REPLACE, null); - fExperiment.addTrace(folder); - } - else { - System.out.println(Messages.AddTraceWizard_invalidTraceLocation); - } - } catch (CoreException e) { - e.printStackTrace(); - } - } - - return true; - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/AddTraceWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/AddTraceWizardPage.java deleted file mode 100644 index f3c5fffe9b..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/AddTraceWizardPage.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import java.util.Vector; - -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceNode; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** - * AddTraceWizardPage - *

- * TODO: Implement me. Please. - */ -@Deprecated -public class AddTraceWizardPage extends WizardPage { - - private LTTngProjectNode fProject; - private CheckboxTableViewer fCheckboxTableViewer; - - protected AddTraceWizardPage(LTTngProjectNode project, String pageName) { - super(pageName); - setTitle(Messages.AddTraceWizardPage_windowTitle); - setDescription(Messages.AddTraceWizardPage_description); - fProject = project; - } - - @Override - public void createControl(Composite parent) { - Composite container = new Composite(parent, SWT.NULL); - container.setLayout(new FormLayout()); - setControl(container); - - fCheckboxTableViewer = CheckboxTableViewer.newCheckList(container, SWT.BORDER); - fCheckboxTableViewer.setContentProvider(new DialogTraceContentProvider()); - fCheckboxTableViewer.setLabelProvider(new DialogTraceLabelProvider()); - - final Table table = fCheckboxTableViewer.getTable(); - final FormData formData = new FormData(); - formData.bottom = new FormAttachment(100, 0); - formData.right = new FormAttachment(100, 0); - formData.top = new FormAttachment(0, 0); - formData.left = new FormAttachment(0, 0); - table.setLayoutData(formData); - table.setHeaderVisible(true); - - final TableColumn tableColumn = new TableColumn(table, SWT.NONE); - tableColumn.setWidth(200); - tableColumn.setText(Messages.AddTraceWizardPage_columnHeader); - - fCheckboxTableViewer.setInput(fProject.getTracesFolder()); - } - - public LTTngTraceNode[] getSelection() { - Vector traces = new Vector(); - Object[] selection = fCheckboxTableViewer.getCheckedElements(); - for (Object sel : selection) { - if (sel instanceof LTTngTraceNode) - traces.add((LTTngTraceNode) sel); - } - LTTngTraceNode[] result = new LTTngTraceNode[traces.size()]; - traces.toArray(result); - return result; - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DataTransferMessages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DataTransferMessages.java deleted file mode 100644 index e09ef87497..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DataTransferMessages.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.osgi.util.NLS; - -public class DataTransferMessages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.linuxtools.lttng.ui.views.project.dialogs.messages"; //$NON-NLS-1$ - public static String ImportTraceWizard_LocationError; - public static String ImportTraceWizard_LocationErrorMsg1; - public static String ImportTraceWizard_LocationErrorMsg2; - public static String ImportTraceWizard_LocationErrorMsg3; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, DataTransferMessages.class); - } - - private DataTransferMessages() { - } -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DialogTraceContentProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DialogTraceContentProvider.java deleted file mode 100644 index cfa252c09f..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DialogTraceContentProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceFolderNode; - -/** - * LTTngTracesContentProvider - *

- * TODO: Implement me. Please. - */ -@Deprecated -public class DialogTraceContentProvider implements IStructuredContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) - */ - @Override - public Object[] getElements(Object inputElement) { - if (inputElement instanceof LTTngTraceFolderNode) { - LTTngTraceFolderNode folder = (LTTngTraceFolderNode) inputElement; - return folder.getTraces(); - } - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#dispose() - */ - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DialogTraceLabelProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DialogTraceLabelProvider.java deleted file mode 100644 index b016b9b3b0..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/DialogTraceLabelProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceNode; -import org.eclipse.swt.graphics.Image; - -/** - * LTTngTracesLabelProvider - *

- * TODO: Implement me. Please. - */ -@Deprecated -public class DialogTraceLabelProvider extends LabelProvider implements ITableLabelProvider { - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) - */ - @Override - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) - */ - @Override - public String getColumnText(Object element, int columnIndex) { - if (element instanceof LTTngTraceNode) { - LTTngTraceNode entry = (LTTngTraceNode) element; - switch (columnIndex) { - case 0: - return entry.getName(); - default: - return null; - } - } - return null; - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizard.java deleted file mode 100644 index ae48bca21d..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizard.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.internal.WorkbenchPlugin; -import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; - -/** - * ImportTraceWizard - *

- * - * TODO: Implement me. Please. - */ -@Deprecated -@SuppressWarnings("restriction") -public class ImportTraceWizard extends Wizard implements IImportWizard { - - private IWorkbench fWorkbench; - private IStructuredSelection fSelection; - private ImportTraceWizardPage fMainPage; - - /** - * - */ - private final String IMPORT_WIZARD = "LTTngTraceImportWizard"; //$NON-NLS-1$ - - public ImportTraceWizard() { - IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings(); - IDialogSettings section = workbenchSettings.getSection(IMPORT_WIZARD); - if (section == null) { - section = workbenchSettings.addNewSection(IMPORT_WIZARD); - } - - setDialogSettings(section); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.wizard.Wizard#addPages() - */ - @Override - public void addPages() { - super.addPages(); - fMainPage = new ImportTraceWizardPage(fWorkbench, fSelection); - addPage(fMainPage); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, - * org.eclipse.jface.viewers.IStructuredSelection) - */ - @Override - @SuppressWarnings("rawtypes") - public void init(IWorkbench workbench, IStructuredSelection selection) { - fWorkbench = workbench; - fSelection = selection; - - List selectedResources = IDE.computeSelectedResources(selection); - if (!selectedResources.isEmpty()) { - fSelection = new StructuredSelection(selectedResources); - } - - setWindowTitle(""); //$NON-NLS-1$ - setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png")); //$NON-NLS-1$ - setNeedsProgressMonitor(true); - } - - public ImportTraceWizardPage getMainPage() { - return fMainPage; - } - - /** - * performFinish is called after the "finish" button is pressed in the - * import wizard If we return "false", the wizard will not close. - * - * We perform here version check on the imported LTTng trace - * - */ - @Override - public boolean performFinish() { - if (fMainPage.getDestination().equals(fMainPage.getInitialContainerString())) { - String errMessage[] = { org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationError }; - errMessage = fMainPage.extendErrorMessage(errMessage, ""); //$NON-NLS-1$ - errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg1 + fMainPage.getInitialContainerString() + "\""); //$NON-NLS-1$ - errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg2 + fMainPage.getInitialContainerString() + "/MyTrace\""); //$NON-NLS-1$ - errMessage = fMainPage.extendErrorMessage(errMessage, ""); //$NON-NLS-1$ - errMessage = fMainPage.extendErrorMessage(errMessage, org.eclipse.linuxtools.lttng.ui.views.project.dialogs.DataTransferMessages.ImportTraceWizard_LocationErrorMsg3); - fMainPage.showVersionErrorPopup(errMessage); - return false; - } - return fMainPage.finish(); - } - - @Override - public boolean canFinish() { - return fMainPage.isSelectedElementsValidLttngTraces(); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java deleted file mode 100644 index b16c168a99..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/ImportTraceWizardPage.java +++ /dev/null @@ -1,368 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Ericsson, MontaVista Software - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.linuxtools.lttng.core.TraceHelper; -import org.eclipse.linuxtools.lttng.core.exceptions.LttngException; -import org.eclipse.linuxtools.lttng.core.trace.LTTngTraceVersion; -import org.eclipse.linuxtools.lttng.ui.views.project.handlers.TraceErrorHandler; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.internal.wizards.datatransfer.WizardFileSystemResourceImportPage1; - -/** - * ImportTraceWizardPage - *

- * TODO: Implement me. Please. - */ -@Deprecated -@SuppressWarnings("restriction") -public class ImportTraceWizardPage extends WizardFileSystemResourceImportPage1 { - - private boolean isContainerSet = false; - private String initialContainerString = ""; //$NON-NLS-1$ - private String selectedSourceDirectory = ""; //$NON-NLS-1$ - private IProject project; - - public ImportTraceWizardPage(IWorkbench workbench, IStructuredSelection selection) { - super(workbench, selection); - - project = (IProject) selection.getFirstElement(); - IFolder folder = project.getFolder(LTTngProjectNode.TRACE_FOLDER_NAME); - if (folder == null) { - MessageDialog.openError(getShell(), Messages.ImportTrace_ErrorTitle, Messages.ImportTrace_InvalidProject); - } - String path = folder.getFullPath().toOSString(); - - initialContainerString = path; - setContainerFieldValue(path); - } - - public String getTraceDirectory() { - String tmpPath = ""; //$NON-NLS-1$ - if ((getSourceDirectory() != null) && (getSourceDirectory().getName() != null)) { - tmpPath = this.getSourceDirectory().getName().toString(); - } - - return tmpPath; - } - - public String getInitialContainerString() { - return initialContainerString; - } - - public String getTracepath() { - String tmpPath = ""; //$NON-NLS-1$ - if ((getSourceDirectory() != null) && (getSourceDirectory().getPath() != null)) { - tmpPath = this.getSourceDirectory().getPath().toString(); - } - - return tmpPath; - } - - public String getDestination() { - String returnPath = null; - - if (getContainerFullPath() != null) { - returnPath = getContainerFullPath().toString(); - } - return returnPath; - } - - public boolean isSelectedElementsValidLttngTraces() { - boolean returnedValue = true; - - // We don't want to test until something is selected - if (selectionGroup.getCheckedElementCount() > 0) { - - // We don't want to revalidate each time, only want a new directory - // is selected - if (!selectedSourceDirectory.equals(getSourceDirectory().getAbsolutePath().toString())) { - try { - if (isPathLttngTrace(getSourceDirectory().getAbsolutePath()) == false) { - returnedValue = false; - selectedSourceDirectory = ""; //$NON-NLS-1$ - - String errMessage[] = { Messages.ImportTraceWizardPage_BadTraceVersion + getSourceDirectory().getAbsolutePath() }; - errMessage = extendErrorMessage(errMessage, ""); //$NON-NLS-1$ - errMessage = extendErrorMessage(errMessage, Messages.ImportTraceWizardPage_BadTraceVersionMsg1); - errMessage = extendErrorMessage(errMessage, Messages.ImportTraceWizardPage_BadTraceVersionMsg2); - showVersionErrorPopup(errMessage); - selectionGroup.setAllSelections(false); - } else { - selectedSourceDirectory = getSourceDirectory().getAbsolutePath(); - - if (isContainerSet == false) { - isContainerSet = true; - - if (!getDestination().toString().equals(getInitialContainerString() + "/" + getTraceDirectory())) { //$NON-NLS-1$ - // *** HACK *** - // Force a sane destination to avoid imported - // files to end up in the root of the "Traces/" - // directory - setContainerFieldValue(getInitialContainerString() + "/" + getTraceDirectory()); //$NON-NLS-1$ - } - } - } - } catch (LttngException e) { - String[] errorMessages = e.toString().split("\n"); //$NON-NLS-1$ - String exceptionMessage[] = { "Version check failed for the path : ", this.getTracepath(), "", "Returned error was :" }; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - - for (int pos = 0; pos < errorMessages.length; pos++) { - exceptionMessage = extendErrorMessage(exceptionMessage, errorMessages[pos]); - } - - showVersionErrorPopup(exceptionMessage); - selectionGroup.setAllSelections(false); - returnedValue = false; - } - } - } - isContainerSet = false; - - return returnedValue; - } - - public boolean isPathLttngTrace(String path) throws LttngException { - - boolean returnedValue = true; - String traceLibPath = TraceHelper.getTraceLibDirFromProject(project); - // Ask for a LttngTraceVersion for the given path - LTTngTraceVersion traceVersion = new LTTngTraceVersion(path, traceLibPath); - - // If this is not a valid LTTng trace - if (traceVersion.isValidLttngTrace() == false) { - returnedValue = false; - } - - return returnedValue; - } - - public String[] extendErrorMessage(String[] oldErrorMessage, String lineToAdd) { - String tmSwapMessage[] = new String[oldErrorMessage.length + 1]; - for (int pos = 0; pos < oldErrorMessage.length; pos++) { - tmSwapMessage[pos] = oldErrorMessage[pos]; - } - tmSwapMessage[oldErrorMessage.length] = lineToAdd; - - return tmSwapMessage; - } - - /** - * This function will show a version error popup that contain the given - * message. - * - */ - public void showVersionErrorPopup(String[] errMessages) { - TraceErrorHandler errorDialog = new TraceErrorHandler(errMessages); - try { - errorDialog.execute(null); - } catch (Exception e) { - e.printStackTrace(); - } - } - - // // *** HACK HACK AND HACK *** - // // Everything below is a proof of concept on how we could tweak the - // import wizard to act according to our plan - // // Uncomment everything below if you want to test it, but please, does - // not put any of this into production - // @SuppressWarnings({ "unchecked", "rawtypes" }) - // @Override - // public boolean finish() { - // if (!ensureSourceIsValid()) { - // return false; - // } - // saveWidgetValues(); - // - // Iterator resourcesEnum = getSelectedResources().iterator(); - // List listRealFiles = new ArrayList(); - // - // // **** - // // HACK #1 : - // // We need to convert everything into java.io.File because - // ImportOperation does NOT support FileSystemElement - // while (resourcesEnum.hasNext()) { - // FileSystemElement tmpFileElement = - // ((FileSystemElement)resourcesEnum.next()); - // java.io.File tmpRealFile = new - // java.io.File(tmpFileElement.getFileSystemObject().toString()); - // - // listRealFiles.add(tmpRealFile); - // } - // - // if (listRealFiles.size() > 0) { - // // Call import ressources (code is below) - // return importResources(listRealFiles); - // } - // - // MessageDialog.openInformation(getContainer().getShell(), - // DataTransferMessages.DataTransfer_information, - // DataTransferMessages.FileImport_noneSelected); - // return false; - // } - // - // @Override - // protected boolean importResources(List fileSystemObjects) { - // // *** Explanation of the hackssss - // // We want the import wizard to import everything in the form of : - // // trace1/ -> tracefiles* - // // - // // However, the wizard is too dumb to do the following and will recreate - // the full architecture the user selected. - // // So, depending what the user select, we could end up with something - // like : - // // home/user/somewhere/trace1/ -> tracefiles* - // // - // // Since there is nothing to do with that, we need to change the "source" - // and the "to-import files" to reflect this. - // // Basically, from the case above, the "source" should be changed to - // "trace1/" and "to-import files" - // // should have the correct parent so the wizard can still find them - // // - // // Let's see how fun it is to do with mr. import wizard. - // - // - // List listRealFilesShortPath = new ArrayList(); - // java.io.File newFullSource = getSourceDirectory(); - // - // // We will loop for every "to-import full path files" we have and - // recreate "short path" files - // // Mean, the current path of the file is currently something like : - // // Path : /home/billybob/mytraces/trace1/metadata_0 Parent : null - // // And we want something less dumb like : - // // Path : metadata_0 Parent : /home/billybob/mytraces/trace1/ - // for (int pos=0; pos /home/billybob/mytraces/trace1/ - // String newParent = oldFile.getAbsolutePath().substring(0, - // oldFile.getAbsolutePath().lastIndexOf("/") ); - // - // // Create a "short path file" with the good parent from it. This give : - // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/ - // newShortPathFile = new java.io.File(newParent, oldFile.getName() ); - // - // // Create a new "full source" directory -> - // /home/billybob/mytraces/trace1/ - // newFullSource = new java.io.File( newParent ); - // - // // Add our pretty file to the new List - // listRealFilesShortPath.add(newShortPathFile); - // } - // - // // *** - // // HACK #3 - // // Now that we have everything, we need to AJUST THE DESTINATION - // // To do so, we ajust the "ContainerValue" text field. - // // - // // Right now we have something like : - // // Path -> /where/to/import/ - // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/ - // // We want something like : - // // Path -> /where/to/import/trace1/ - // // (Files) Path : metadata_0 Parent : /home/billybob/mytraces/trace1/ - // // - // - // // We take the current text field and we add the "full source" name - // // Note : the "name" is the last directory name so "trace1" is returned - // for a path like "/home/billybob/mytraces/trace1/" - // setContainerFieldValue(getContainerFullPath() + "/" + - // newFullSource.getName()); - // - // /* - // System.out.println("\n\n" + getContainerFullPath()); - // System.out.println(newFullSource); - // System.out.println(FileSystemStructureProvider.INSTANCE); - // System.out.println(this.getContainer()); - // System.out.println(fileSystemObjects); - // */ - // - // // Finally import !! - // ImportOperation operation = new ImportOperation(getContainerFullPath(), - // newFullSource, FileSystemStructureProvider.INSTANCE, this, - // listRealFilesShortPath); - // - // operation.setContext(getShell()); - // return executeImportOperation(operation); - // } - // - // // This function test if the selected directory are LTTng traces - // // This one is made to work with the madness above. - // public boolean isSelectedElementsValidLttngTraces() { - // boolean returnedValue = true; - // - // String errMessage[] = { - // "Couldn't get LTTng version number for the path : " }; - // - // // We don't want to test until something is selected - // if ( selectionGroup.getCheckedElementCount() > 0 ) { - // try { - // List selectionList = - // selectionGroup.getAllWhiteCheckedItems(); - // MinimizedFileSystemElement tmpSelectedElement = null; - // - // for ( int x=0; xNewProjectMainWizardPage - *

- * - * TODO: Implement me. Please. - */ -public class NewLTTngProjectMainWizardPage extends WizardNewProjectCreationPage { - - /** - * @param pageName - */ - public NewLTTngProjectMainWizardPage(String pageName) { - super(pageName); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java deleted file mode 100644 index ed0a21f155..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Ericsson, MontaVista Software - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path - * Francois Chouinard - Rebase on TMF NewProjectWizard - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.linuxtools.lttng.core.LTTngProjectNature; -import org.eclipse.linuxtools.lttng.core.TraceHelper; -import org.eclipse.linuxtools.tmf.core.TmfProjectNature; -import org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard; - -/** - * NewLTTngProjectWizard - *

- */ -public class NewLTTngProjectWizard extends NewTmfProjectWizard { - - // ------------------------------------------------------------------------ - // Constants - // ------------------------------------------------------------------------ - - private static final String TRACE_LIBRARY_PATH = "traceLibraryPath"; //$NON-NLS-1$ - - // ------------------------------------------------------------------------ - // Variables - // ------------------------------------------------------------------------ - - private TraceLibraryPathWizardPage traceLibraryPathPage; - - // ------------------------------------------------------------------------ - // Construction - // ------------------------------------------------------------------------ - - public NewLTTngProjectWizard() { - this(Messages.NewProjectWizard_Title, Messages.NewProjectWizard_Description); - } - - public NewLTTngProjectWizard(String title, String desc) { - super(title, desc); - } - - // ------------------------------------------------------------------------ - // NewProjectWizard - // ------------------------------------------------------------------------ - - @Override - public void addPages() { - super.addPages(); - traceLibraryPathPage = new TraceLibraryPathWizardPage(Messages.NewProjectWizard_Title); - traceLibraryPathPage.setTitle(Messages.TraceLibraryPathWizardPage_Title); - traceLibraryPathPage.setDescription(Messages.TraceLibraryPathWizardPage_Description); - addPage(traceLibraryPathPage); - } - - @Override - public boolean performFinish() { - // Create the tracing project - super.performFinish(); - - // Add the LTTng nature - try { - IProjectDescription description = fProject.getDescription(); - description.setNatureIds(new String[] { TmfProjectNature.ID, LTTngProjectNature.ID }); - fProject.setDescription(description, null); - } catch (CoreException e) { - } - - // Set the library path - String traceLibraryPath = traceLibraryPathPage.getPath(); - if (traceLibraryPath != null) { - return TraceHelper.setProjectPreference(fProject, TRACE_LIBRARY_PATH, traceLibraryPath); - } - - return true; - } - - // ------------------------------------------------------------------------ - // Operations - // ------------------------------------------------------------------------ - - public IProject getProject() { - return fProject; - } - -} \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceErrorDialog.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceErrorDialog.java deleted file mode 100644 index 7ed347913b..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceErrorDialog.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * William Bourque - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.dialogs.SelectionStatusDialog; - -public class TraceErrorDialog extends SelectionStatusDialog { - - private String[] messages = null; - - public TraceErrorDialog(Shell parentShell, String[] newMessages) { - super(parentShell); - messages = newMessages; - setTitle(Messages.TraceErrorDialog_DalogTitle); - setStatusLineAboveButtons(true); - } - - @Override - protected void computeResult() { - } - - @Override - public void create() { - super.create(); - getButton(IDialogConstants.OK_ID).setEnabled(true); - getButton(IDialogConstants.OK_ID).setAlignment(GridData.CENTER); - getButton(IDialogConstants.CANCEL_ID).setVisible(false); - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - createFolderNameGroup(composite); - return composite; - } - - private void createFolderNameGroup(Composite parent) { - Font font = parent.getFont(); - Composite folderGroup = new Composite(parent, SWT.NONE); - - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 3; - folderGroup.setLayout(layout); - folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Position grid for the messages - GridData positionningData = new GridData(GridData.FILL_VERTICAL); - - // New message label - Label lblMessage = new Label(folderGroup, SWT.NONE); - lblMessage.setFont(font); - lblMessage.setText(Messages.TraceErrorDialog_DialogMsgLabel); - lblMessage.setLayoutData(positionningData); - - // The actual messages - GC graphicContext = new GC(parent); - String longuestLine = ""; //$NON-NLS-1$ - int msgSize = 0; - - // *** Font and FontData are nowhere near elegant to use. - Font errorFont = new Font(graphicContext.getDevice(), font.getFontData()[0].getName(), font.getFontData()[0].getHeight(), SWT.ITALIC); - - Label[] lblErrorMessages = new Label[messages.length]; - for (int x = 0; x < messages.length; x++) { - lblErrorMessages[x] = new Label(folderGroup, SWT.NONE); - lblErrorMessages[x].setFont(errorFont); - - lblErrorMessages[x].setForeground(new Color(lblErrorMessages[x].getForeground().getDevice(), 255, 0, 0)); - lblErrorMessages[x].setText(messages[x]); - lblErrorMessages[x].setLayoutData(positionningData); - - if (messages[x].length() > longuestLine.length()) { - longuestLine = messages[x]; - } - } - - for (int pos = 0; pos < longuestLine.length(); pos++) { - msgSize += graphicContext.getAdvanceWidth(longuestLine.charAt(pos)); - } - // Seems we need to count the final \n of the line otherwise we miss - // some space - msgSize += graphicContext.getAdvanceWidth('\n'); - - positionningData.widthHint = msgSize; - positionningData.grabExcessHorizontalSpace = true; - - graphicContext.dispose(); - - } - - @Override - protected void updateStatus(IStatus status) { - if (status != null) { - Status newStatus = new Status(IStatus.OK, status.getPlugin(), status.getCode(), status.getMessage(), status.getException()); - super.updateStatus(newStatus); - } else { - super.updateStatus(status); - } - } - - @Override - protected void okPressed() { - super.okPressed(); - } -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java deleted file mode 100644 index bd99112350..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathPropertyPage.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 MontaVista Software - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yufen Kuo (ykuo@mvista.com) - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import java.io.File; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.linuxtools.lttng.core.TraceHelper; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.PropertyPage; - -public class TraceLibraryPathPropertyPage extends PropertyPage { - - private static final String LTTVTRACEREAD_LOADER_LIBNAME = "lttvtraceread_loader"; - private Button browsePathButton; - private Text traceLibraryPath; - - @Override - protected Control createContents(Composite parent) { - Composite client = new Composite(parent, SWT.NONE); - client.setLayoutData(new GridData(GridData.FILL_BOTH)); - - GridLayout layout = new GridLayout(3, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - client.setLayout(layout); - - Label label = new Label(client, SWT.NONE); - label.setText(Messages.TraceLibraryPath_label); - traceLibraryPath = new Text(client, SWT.BORDER); - traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, - false)); - traceLibraryPath.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - setValid(validateInputs()); - } - - }); - browsePathButton = new Button(client, SWT.PUSH); - browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, - false)); - browsePathButton.setText(Messages.TraceLibraryPath_browseBtn); - browsePathButton.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - String dir = new DirectoryDialog(Display.getDefault() - .getActiveShell()).open(); - if (dir != null) { - traceLibraryPath.setText(dir); - } - - } - - }); - - Label noLabel = new Label(client, SWT.NONE); - noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); - - Label descTextLabel = new Label(client, SWT.WRAP); - descTextLabel.setText(Messages.TraceLibraryPathProperty_Message); - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); - gd.widthHint = 400; - gd.horizontalSpan = 2; - descTextLabel.setLayoutData(gd); - - Label noteBoldLabel = new Label(client, SWT.BOLD); - noteBoldLabel.setText(Messages.TraceLibraryPath_Note); - noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, - false)); - Font font = noteBoldLabel.getFont(); - if (font.getFontData().length > 0) - noteBoldLabel.setFont(new Font(client.getDisplay(), font - .getFontData()[0].getName(), font.getFontData()[0] - .getHeight(), SWT.BOLD)); - - Label noteTextLabel = new Label(client, SWT.WRAP); - noteTextLabel.setText(Messages.TraceLibraryPath_Message); - gd = new GridData(SWT.FILL, SWT.CENTER, true, false); - gd.widthHint = 400; - gd.horizontalSpan = 2; - noteTextLabel.setLayoutData(gd); - - performDefaults(); - return client; - } - - public boolean validateInputs() { - String path = traceLibraryPath.getText(); - if (path != null && !path.trim().isEmpty()) { - File file = new File(path); - if (file.exists() && file.isDirectory()) { - File loaderLib = new File(path, - System.mapLibraryName(LTTVTRACEREAD_LOADER_LIBNAME)); - if (!loaderLib.exists()) { - setErrorMessage(Messages.TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists); - return false; - } - } else { - setErrorMessage(Messages.TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists); - return false; - } - } - setErrorMessage(null); - return true; - } - - @Override - protected void performDefaults() { - IResource resource = (IResource) getElement().getAdapter( - IResource.class); - IProject project = resource.getProject(); - if (project != null) { - String traceLibDir = TraceHelper.getTraceLibDirFromProject(project); - if (traceLibDir != null) { - traceLibraryPath.setText(traceLibDir); - } - } - super.performDefaults(); - } - - @Override - public boolean performOk() { - IResource resource = (IResource) getElement().getAdapter( - IResource.class); - IProject project = resource.getProject(); - boolean ok = false; - if (project != null) { - String libPath = traceLibraryPath.getText(); - if (libPath == null || libPath.trim().isEmpty()) - ok = TraceHelper.removeProjectPreference(project, - "traceLibraryPath"); - else - ok = TraceHelper.setProjectPreference(project, - "traceLibraryPath", traceLibraryPath.getText()); - } - return ok && super.performOk(); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java deleted file mode 100644 index c1ec75708d..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/TraceLibraryPathWizardPage.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 MontaVista Software - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yufen Kuo (ykuo@mvista.com) - Initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.lttng.ui.views.project.dialogs; - -import java.io.File; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class TraceLibraryPathWizardPage extends WizardPage { - private static final String LTTVTRACEREAD_LOADER_LIBNAME = "lttvtraceread_loader"; - private Button browsePathButton; - private Text traceLibraryPath; - - protected TraceLibraryPathWizardPage(String pageName) { - super(pageName); - } - - public void createControl(Composite parent) { - Composite client = new Composite(parent, SWT.NONE); - client.setLayoutData(new GridData(GridData.FILL_BOTH)); - - GridLayout layout = new GridLayout(3, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - client.setLayout(layout); - - Label label = new Label(client, SWT.NONE); - label.setText(Messages.TraceLibraryPath_label); - traceLibraryPath = new Text(client, SWT.BORDER); - traceLibraryPath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - traceLibraryPath.addModifyListener(new ModifyListener() { - - @Override - public void modifyText(ModifyEvent e) { - boolean valid = validatePage(); - setPageComplete(valid); - } - - }); - browsePathButton = new Button(client, SWT.PUSH); - browsePathButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false)); - browsePathButton.setText(Messages.TraceLibraryPath_browseBtn); - browsePathButton.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - String dir = new DirectoryDialog(Display.getDefault() - .getActiveShell()).open(); - if (dir != null) { - traceLibraryPath.setText(dir); - } - - } - - }); - - Label noLabel = new Label(client, SWT.NONE); - noLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); - - Label descTextLabel = new Label(client, SWT.WRAP); - descTextLabel.setText(Messages.TraceLibraryPathWizard_Message); - GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); - gd.widthHint = 400; - gd.horizontalSpan = 2; - descTextLabel.setLayoutData(gd); - - Label noteBoldLabel = new Label(client, SWT.BOLD); - noteBoldLabel.setText(Messages.TraceLibraryPath_Note); - noteBoldLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false)); - Font font = noteBoldLabel.getFont(); - if (font.getFontData().length > 0) - noteBoldLabel.setFont(new Font(client.getDisplay(), font - .getFontData()[0].getName(), font.getFontData()[0] - .getHeight(), SWT.BOLD)); - - Label noteTextLabel = new Label(client, SWT.WRAP); - noteTextLabel.setText(Messages.TraceLibraryPath_Message); - gd = new GridData(SWT.FILL, SWT.CENTER, true, false); - gd.widthHint = 400; - gd.horizontalSpan = 2; - noteTextLabel.setLayoutData(gd); - setControl(client); - - } - - public String getPath() { - if (traceLibraryPath != null && !traceLibraryPath.isDisposed()) { - String path = traceLibraryPath.getText(); - if (path != null && !path.trim().isEmpty()) - return path; - } - return null; - } - - private boolean validatePage() { - String path = getPath(); - if (path != null) { - File file = new File(path); - if (file.exists() && file.isDirectory()) { - File loaderLib = new File(path, - System.mapLibraryName(LTTVTRACEREAD_LOADER_LIBNAME)); - if (!loaderLib.exists()) { - setErrorMessage(Messages.TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists); - return false; - } - } else { - setErrorMessage(Messages.TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists); - return false; - } - } - setErrorMessage(null); - return true; - - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties deleted file mode 100644 index 2df604740c..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/messages.properties +++ /dev/null @@ -1,40 +0,0 @@ -AddTraceWizard_invalidTraceLocation=Problem -AddTraceWizard_windowTitle=Adding traces to experiment -AddTraceWizardPage_columnHeader=Trace -AddTraceWizardPage_description=Select the traces to add to the experiment -AddTraceWizardPage_windowTitle=Select traces - -ImportTrace_ErrorTitle=Import Trace -ImportTrace_InvalidProject=Invalid project type - -ImportTraceWizardPage_BadTraceVersion=Error: Unrecognized trace version for -ImportTraceWizardPage_BadTraceVersionMsg1=Verify that the directory is a valid LTTng trace directory. -ImportTraceWizardPage_BadTraceVersionMsg2=Make sure the top directory is the trace itself and not any of its parent. - -NewProjectWizard_Description=Create an LTTng Project -NewProjectWizard_Title=LTTng Project - -NewExperimentDialog_DialogTitle=New Experiment -NewExperimentDialog_ExperimentLabel= Experiment name: - -TraceErrorDialog_DalogTitle=Trace Selection -TraceErrorDialog_DialogMsgLabel=Error while opening the trace\! Error message: - -TraceLibraryPath_label = Trace Library Path: -TraceLibraryPath_browseBtn = Browse... - -TraceLibraryPathWizardPage_SpecifiedTraceLibraryLocation_notExists = Specified trace library directory does not exist! -TraceLibraryPathWizardPage_TraceLoaderLibrary_notExists = Trace loader library not found at the specified path! -TraceLibraryPathWizardPage_Title = LTTng Parsing Library -TraceLibraryPathWizardPage_Description = Specify the directory which contains the LTTng parsing libraries -TraceLibraryPathWizard_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\n\ - The field is project specific and can be modified at any time from the LTTng project Properties page.\n\ - -TraceLibraryPathProperty_Message = Set this field if you want to dynamically change the parsing libraries your LTTng projects use or if you do not want to set LD_LIBRARY_PATH.\n\ - -TraceLibraryPath_Note = Note: -TraceLibraryPath_Message = If you set this field, the parser library 'liblttvtraceread_loader.so' must be accessible from the path provided.\n\n\ - In addition, the library 'liblttvtraceread_loader.so' must have 'RUNPATH' set with ${ORIGIN} so it can find the dependent libraries. \ - 'RUNPATH' can be set in the makefile or by using the patchelf utility. - -SelectTrace_ErrorTitle = Select Trace diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/CloseProjectHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/CloseProjectHandler.java deleted file mode 100644 index 827a15dc94..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/CloseProjectHandler.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * CloseProjectHandler - *

- * TODO: Implement me. Please. - */ -public class CloseProjectHandler implements IHandler { - - private LTTngProjectNode fProject = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a project is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fProject = (element instanceof LTTngProjectNode) ? (LTTngProjectNode) element : null; - } - return (fProject != null && fProject.isOpen()); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - if (fProject != null) { - fProject.closeProject(); - fProject.refresh(); - } - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteExperimentHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteExperimentHandler.java deleted file mode 100644 index a89af48e3d..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteExperimentHandler.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * DeleteExperimentHandler - *

- * TODO: Implement me. Please. - */ -public class DeleteExperimentHandler implements IHandler { - - private LTTngExperimentNode fExperiment = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if a trace is selected - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a trace is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fExperiment = (element instanceof LTTngExperimentNode) ? (LTTngExperimentNode) element : null; - } - - return (fExperiment != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - IFolder folder = fExperiment.getFolder(); - ILTTngProjectTreeNode parent = fExperiment.getParent(); - try { - parent.removeChild(fExperiment); - parent.refresh(); - folder.delete(true, true, null); - } catch (CoreException e) { - e.printStackTrace(); - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteProjectHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteProjectHandler.java deleted file mode 100644 index ff5379d5a4..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteProjectHandler.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * DeleteProjectHandler - *

- * TODO: Implement me. Please. - */ -public class DeleteProjectHandler implements IHandler { - - private LTTngProjectNode fProject = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a project is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fProject = (element instanceof LTTngProjectNode) ? (LTTngProjectNode) element : null; - } - return (fProject != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - IProject project = fProject.getProject(); - ILTTngProjectTreeNode parent = fProject.getParent(); - try { - parent.removeChild(fProject); - parent.refresh(); - project.delete(true, true, null); - } catch (CoreException e) { - e.printStackTrace(); - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteTraceHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteTraceHandler.java deleted file mode 100644 index 7404f0d6e7..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/DeleteTraceHandler.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceNode; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * DeleteTraceHandler - *

- * TODO: Implement me. Please. - */ -public class DeleteTraceHandler implements IHandler { - - private LTTngTraceNode fTrace = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if a trace is selected - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a trace is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fTrace = (element instanceof LTTngTraceNode) ? (LTTngTraceNode) element : null; - } - - return (fTrace != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - IFolder folder = fTrace.getFolder(); - ILTTngProjectTreeNode parent = fTrace.getParent(); - try { - parent.removeChild(fTrace); - parent.refresh(); - folder.delete(true, true, null); - } catch (CoreException e) { - e.printStackTrace(); - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/ImportTraceHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/ImportTraceHandler.java deleted file mode 100644 index 265c537f80..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/ImportTraceHandler.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.ImportTraceWizard; -import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * ImportTraceHandler - *

- * TODO: Implement me. Please. - */ -public class ImportTraceHandler implements IHandler { - - private LTTngProjectNode fProject = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a project is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element instanceof ILTTngProjectTreeNode) { - ILTTngProjectTreeNode node = (ILTTngProjectTreeNode) element; - while (node != null && !(node instanceof LTTngProjectNode)) { - node = node.getParent(); - } - fProject = (node instanceof LTTngProjectNode) ? (LTTngProjectNode) node : null; - } - } - - return (fProject != null && fProject.isOpen() && fProject.isLTTngProject()); - } - - // Always handled - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - // Set the selection to the project - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - ProjectView view = (ProjectView) page.getActivePart(); - view.setSelection(fProject); - - // Fire the Import Trace Wizard - IWorkbench workbench = PlatformUI.getWorkbench(); - Shell shell = workbench.getActiveWorkbenchWindow().getShell(); - - ImportTraceWizard wizard = new ImportTraceWizard(); - wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(fProject)); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.open(); - - if (dialog.getReturnCode() == Window.OK && fProject != null) { - fProject.refreshChildren(); - fProject.refresh(); - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewExperimentHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewExperimentHandler.java deleted file mode 100644 index c7293b8cb2..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewExperimentHandler.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.resources.IFolder; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.NewExperimentDialog; -import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentFolderNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * NewExperimentHandler - *

- * TODO: Implement me. Please. - */ -public class NewExperimentHandler implements IHandler { - - private LTTngProjectNode fProject = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a project is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element instanceof ILTTngProjectTreeNode) { - ILTTngProjectTreeNode node = (ILTTngProjectTreeNode) element; - while (node != null && !(node instanceof LTTngProjectNode)) { - node = node.getParent(); - } - fProject = (node instanceof LTTngProjectNode) ? (LTTngProjectNode) node : null; - } - } - - return (fProject != null && fProject.isOpen() && fProject.isLTTngProject()); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - // Open the experiment creation dialog - LTTngExperimentFolderNode experimentFolder = fProject.getExperimentsFolder(); - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - NewExperimentDialog dialog = new NewExperimentDialog(shell, experimentFolder); - dialog.open(); - - if (dialog.getReturnCode() == Window.OK) { - Object[] experiments = dialog.getResult(); - if (experiments[0] instanceof IFolder) { - experimentFolder.addExperiment((IFolder) experiments[0]); - } - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java deleted file mode 100644 index 85ce652cfe..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.NewLTTngProjectWizard; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectRoot; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * NewProjectHandler - *

- * TODO: Implement me. Please. - */ -public class NewProjectHandler implements IHandler { - - private LTTngProjectRoot fProjectRoot = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPart part = window.getActivePage().getActivePart(); - if (!(part instanceof ProjectView)) - return false; - - fProjectRoot = ((ProjectView) part).getRoot(); - - return (fProjectRoot != null); - } - - // Always handled - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - // Fire the New Project Wizard - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - NewLTTngProjectWizard wizard = new NewLTTngProjectWizard(); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.open(); - - // Update the project model - if (dialog.getReturnCode() == Window.OK) { - IProject project = wizard.getProject(); - if (project != null && fProjectRoot != null) { - fProjectRoot.refreshChildren(); - fProjectRoot.refresh(); - } - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenExperimentHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenExperimentHandler.java deleted file mode 100644 index a21c7a7dd7..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenExperimentHandler.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * OpenExperimentHandler - *

- * TODO: Implement me. Please. - */ -public class OpenExperimentHandler implements IHandler { - - private LTTngExperimentNode fExperiment = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if a trace is selected - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a trace is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fExperiment = (element instanceof LTTngExperimentNode) ? (LTTngExperimentNode) element : null; - } - - return (fExperiment != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - // Set the selection to the project - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - ProjectView projectView = (ProjectView) page.getActivePart(); - - if (projectView != null) { - projectView.selectExperiment(fExperiment); - } - - return null; - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenProjectHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenProjectHandler.java deleted file mode 100644 index 5e32f77f8e..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenProjectHandler.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * OpenProjectHandler - *

- * TODO: Implement me. Please. - */ -public class OpenProjectHandler implements IHandler { - - private LTTngProjectNode fProject = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check if a project is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fProject = (element instanceof LTTngProjectNode) ? (LTTngProjectNode) element : null; - } - return (fProject != null && !fProject.isOpen()); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - if (fProject != null) { - fProject.openProject(); - fProject.refresh(); - } - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenTraceHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenTraceHandler.java deleted file mode 100644 index 69318753b9..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/OpenTraceHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceNode; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.ui.PlatformUI; - -/** - * OpenTraceHandler - *

- * TODO: Implement me. Please. - */ -public class OpenTraceHandler implements IHandler { - - private LTTngTraceNode fTrace = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - return (fTrace != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - mb.setText("Open Trace"); //$NON-NLS-1$ - mb.setMessage("Not implemented yet"); //$NON-NLS-1$ - mb.open(); - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/ProjectPropertyHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/ProjectPropertyHandler.java deleted file mode 100644 index 24b289ab89..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/ProjectPropertyHandler.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 MontaVista Software - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Yufen Kuo (ykuo@mvista.com) - Initial API and implementation - *******************************************************************************/ -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.IShellProvider; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchCommandConstants; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.PropertyDialogAction; - -/** - * ProjectPropertyHandler - *

- * - */ -public class ProjectPropertyHandler implements IHandler { - - private IProject project = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow(); - if (window == null) - return false; - project = null; - // Check if we can find the project model root node - ISelection selection = window.getActivePage().getSelection( - ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection) - .getFirstElement(); - if (element instanceof LTTngProjectNode) { - LTTngProjectNode node = (LTTngProjectNode) element; - if (node != null) { - project = node.getProject(); - } - - } - } - - return (project != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - if (project != null) { - PropertyDialogAction propertyAction = new PropertyDialogAction( - new IShellProvider() { - public Shell getShell() { - return PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell(); - } - }, new ISelectionProvider() { - public void addSelectionChangedListener( - ISelectionChangedListener listener) { - } - - public ISelection getSelection() { - return new StructuredSelection(project); - } - - public void removeSelectionChangedListener( - ISelectionChangedListener listener) { - } - - public void setSelection(ISelection selection) { - } - }); - propertyAction - .setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); - propertyAction.run(); - } - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RefreshHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RefreshHandler.java deleted file mode 100644 index 3f94dddfd3..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RefreshHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.model.ILTTngProjectTreeNode; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectRoot; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * RefreshHandler - *

- * TODO: Implement me. Please. - */ -public class RefreshHandler implements IHandler { - - private LTTngProjectRoot fProjectRoot = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we can find the project model root node - ISelection selection = window.getActivePage().getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - if (element instanceof ILTTngProjectTreeNode) { - ILTTngProjectTreeNode node = (ILTTngProjectTreeNode) element; - while (node != null && !(node instanceof LTTngProjectRoot)) { - node = node.getParent(); - } - fProjectRoot = (node instanceof LTTngProjectRoot) ? (LTTngProjectRoot) node : null; - } - } - - return (fProjectRoot != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - if (fProjectRoot != null) { - fProjectRoot.refreshChildren(); - fProjectRoot.refresh(); - } - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameExperimentHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameExperimentHandler.java deleted file mode 100644 index 1f74ec67a2..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameExperimentHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.ui.PlatformUI; - -/** - * RenameExperimentHandler - *

- * TODO: Implement me. Please. - */ -public class RenameExperimentHandler implements IHandler { - - private LTTngExperimentNode fExperiment = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - return (fExperiment != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - mb.setText("Rename Experiment"); //$NON-NLS-1$ - mb.setMessage("Not implemented yet"); //$NON-NLS-1$ - mb.open(); - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameProjectHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameProjectHandler.java deleted file mode 100644 index 8ef9c06400..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameProjectHandler.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.ui.PlatformUI; - -/** - * RenameProjectHandler - *

- * TODO: Implement me. Please. - */ -public class RenameProjectHandler implements IHandler { - - private LTTngProjectNode fProject = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - -// // Check if we are closing down -// IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); -// if (window == null) -// return false; -// -// // Check if we are in the Project View -// IWorkbenchPage page = window.getActivePage(); -// if (!(page.getActivePart() instanceof ProjectView)) -// return false; -// -// // Check if a project is selected -// ISelection selection = page.getSelection(ProjectView.ID); -// if (selection instanceof StructuredSelection) { -// Object element = ((StructuredSelection) selection).getFirstElement(); -// fProjectNode = (element instanceof LTTngProjectNode) ? (LTTngProjectNode) element : null; -// } - - return (fProject != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return false; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - mb.setText("Rename Project"); //$NON-NLS-1$ - mb.setMessage("Not implemented yet"); //$NON-NLS-1$ - mb.open(); - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameTraceHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameTraceHandler.java deleted file mode 100644 index 4cc81f1b09..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/RenameTraceHandler.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngTraceNode; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.ui.PlatformUI; - -/** - * RenameTraceHandler - *

- * TODO: Implement me. Please. - */ -public class RenameTraceHandler implements IHandler { - - private LTTngTraceNode fTrace = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - return (fTrace != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - MessageBox mb = new MessageBox(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); - mb.setText("Rename Trace"); //$NON-NLS-1$ - mb.setMessage("Not implemented yet"); //$NON-NLS-1$ - mb.open(); - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/SelectTracesHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/SelectTracesHandler.java deleted file mode 100644 index d1fe7613bf..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/SelectTracesHandler.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; -import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.AddTraceWizard; -import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngExperimentNode; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; - -/** - * SelectTracesHandler - *

- * TODO: Implement me. Please. - */ -public class SelectTracesHandler implements IHandler { - - private LTTngExperimentNode fExperiment = null; - - // ------------------------------------------------------------------------ - // Validation - // ------------------------------------------------------------------------ - - @Override - public boolean isEnabled() { - - // Check if we are closing down - IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - if (window == null) - return false; - - // Check if we are in the Project View - IWorkbenchPage page = window.getActivePage(); - if (!(page.getActivePart() instanceof ProjectView)) - return false; - - // Check that an experiment is selected - ISelection selection = page.getSelection(ProjectView.ID); - if (selection instanceof StructuredSelection) { - Object element = ((StructuredSelection) selection).getFirstElement(); - fExperiment = (element instanceof LTTngExperimentNode) ? (LTTngExperimentNode) element : null; - } - - return (fExperiment != null); - } - - // Handled if we are in the ProjectView - @Override - public boolean isHandled() { - return true; - } - - // ------------------------------------------------------------------------ - // Execution - // ------------------------------------------------------------------------ - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - - // Open the trace addition wizard - IWorkbench workbench = PlatformUI.getWorkbench(); - Shell shell = workbench.getActiveWorkbenchWindow().getShell(); - - AddTraceWizard wizard = new AddTraceWizard(fExperiment.getProject(), fExperiment); - wizard.init(PlatformUI.getWorkbench(), null); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.open(); - - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - // ------------------------------------------------------------------------ - // IHandlerListener - // ------------------------------------------------------------------------ - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/TraceErrorHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/TraceErrorHandler.java deleted file mode 100644 index 13d756e5f4..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/TraceErrorHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * William Bourque - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.handlers; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.IHandler; -import org.eclipse.core.commands.IHandlerListener; -import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.TraceErrorDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; - - -public class TraceErrorHandler implements IHandler { - - private String[] messages; - - public TraceErrorHandler(String[] newMessages) { - messages = newMessages; - } - - @Override - public boolean isEnabled() { - return true; - } - - @Override - public boolean isHandled() { - return true; - } - - @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - IWorkbench workbench = PlatformUI.getWorkbench(); - Shell shell = workbench.getActiveWorkbenchWindow().getShell(); - - TraceErrorDialog dialog = new TraceErrorDialog(shell, messages); - dialog.open(); - - return null; - } - - @Override - public void dispose() { - } - - @Override - public void addHandlerListener(IHandlerListener handlerListener) { - } - - @Override - public void removeHandlerListener(IHandlerListener handlerListener) { - } - -} - diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/ILTTngProjectTreeNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/ILTTngProjectTreeNode.java deleted file mode 100644 index dea2e32dec..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/ILTTngProjectTreeNode.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.util.List; - -/** - * ILTTngProjectTreeNode - *

- * TODO: Implement me. Please. - * TODO: Make ILTTngProjectTreeNode extends IAdaptable - */ -public interface ILTTngProjectTreeNode { - - public String getName(); - - public ILTTngProjectTreeNode getParent(); - - public boolean hasChildren(); - - public List getChildren(); - - public void removeChild(ILTTngProjectTreeNode child); - - public void removeChildren(); - - public void refreshChildren(); - - public void refresh(); - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngExperimentFolderNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngExperimentFolderNode.java deleted file mode 100644 index f1032fb668..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngExperimentFolderNode.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.lang.reflect.Array; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; - -/** - * LTTngExperimentFolderNode - *

- * TODO: Implement me. Please. - */ -public class LTTngExperimentFolderNode extends LTTngProjectTreeNode { - - private final IFolder fExperimentFolder; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - public LTTngExperimentFolderNode(IFolder folder) { - this(null, folder); - } - - public LTTngExperimentFolderNode(ILTTngProjectTreeNode parent, IFolder folder) { - super(parent); - fExperimentFolder = folder; - } - - // ------------------------------------------------------------------------ - // LTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public String getName() { - return fExperimentFolder.getName(); - } - - @Override - public void refreshChildren() { - try { - IResource[] resources = fExperimentFolder.members(); - for (IResource resource : resources) { - if (resource instanceof IFolder) { - LTTngExperimentNode node = find(resource.getName()); - if (node == null) { - node = new LTTngExperimentNode(this, (IFolder) resource); - fChildren.add(node); - } - } - } - for (ILTTngProjectTreeNode node : fChildren) { - if (exists(node.getName(), resources)) { - node.refreshChildren(); - } - else { - fChildren.remove(node); - } - } - } catch (CoreException e) { - } - } - - private LTTngExperimentNode find(String name) { - for (ILTTngProjectTreeNode node : fChildren) { - if (node instanceof LTTngExperimentNode && node.getName().equals(name)) { - return (LTTngExperimentNode) node; - } - } - return null; - } - - private boolean exists(String name, IResource[] resources) { - for (IResource resource : resources) { - if (resource.getName().equals(name)) - return true; - } - return false; - } - - // ------------------------------------------------------------------------ - // Accessors - // ------------------------------------------------------------------------ - - /** - * @return - */ - public LTTngProjectNode getProject() { - return (LTTngProjectNode) getParent(); - } - - /** - * @return - */ - public IFolder getFolder() { - return fExperimentFolder; - } - - /** - * @return - */ - public LTTngExperimentNode[] getExperiments() { - LTTngExperimentNode[] result = (LTTngExperimentNode[]) Array.newInstance(LTTngExperimentNode.class, fChildren.size()); - return fChildren.toArray(result); - } - - // ------------------------------------------------------------------------ - // Modifiers - // ------------------------------------------------------------------------ - -// No longer needed: handled by the IResourceChangeListener in the View - public void addExperiment(IFolder experiment) { -// LTTngExperimentNode node = new LTTngExperimentNode(this, experiment); -// fChildren.add(node); -// refresh(); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngExperimentNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngExperimentNode.java deleted file mode 100644 index fc05ad8307..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngExperimentNode.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.lang.reflect.Array; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; - -/** - * LTTngExperimentNode - *

- * TODO: Implement me. Please. - */ -public class LTTngExperimentNode extends LTTngProjectTreeNode { - - private final IFolder fExperiment; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - public LTTngExperimentNode(IFolder resource) { - this(null, resource); - } - - public LTTngExperimentNode(ILTTngProjectTreeNode parent, IFolder folder) { - super(parent); - fExperiment = folder; - } - - // ------------------------------------------------------------------------ - // LTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public String getName() { - return fExperiment.getName(); - } - - @Override - public void refreshChildren() { - try { - IResource[] resources = fExperiment.members(0); - for (IResource resource : resources) { - LTTngTraceNode node = find(resource.getName()); - if (node == null) { - node = new LTTngTraceNode(this, (IFolder) resource); - fChildren.add(node); - } - } - for (ILTTngProjectTreeNode node : fChildren) { - if (!exists(node.getName(), resources)) { - fChildren.remove(node); - } - } - } catch (CoreException e) { - } - } - - private LTTngTraceNode find(String name) { - for (ILTTngProjectTreeNode node : fChildren) { - if (node instanceof LTTngTraceNode && node.getName().equals(name)) { - return (LTTngTraceNode) node; - } - } - return null; - } - - private boolean exists(String name, IResource[] resources) { - for (IResource resource : resources) { - if (resource.getName().equals(name)) - return true; - } - return false; - } - - // ------------------------------------------------------------------------ - // Modifiers - // ------------------------------------------------------------------------ - -// No longer needed: handled by the IResourceChangeListener in the View - public void addTrace(IFolder trace) { -// LTTngTraceNode node = new LTTngTraceNode(this, trace); -// fChildren.add(node); -// refresh(); - } - - // ------------------------------------------------------------------------ - // Accessors - // ------------------------------------------------------------------------ - - /** - * @return - */ - public IFolder getFolder() { - return fExperiment; - } - - /** - * @return - */ - public LTTngTraceNode[] getTraces() { - LTTngTraceNode[] result = (LTTngTraceNode[]) Array.newInstance(LTTngTraceNode.class, fChildren.size()); - return fChildren.toArray(result); - } - - /** - * @return - */ - public LTTngProjectNode getProject() { - return (LTTngProjectNode) getParent().getParent(); - } - -} \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectContentProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectContentProvider.java deleted file mode 100644 index 1a13286196..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectContentProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -/** - * LTTngProjectContentProvider - *

- * TODO: Implement me. Please. - */ - public class LTTngProjectContentProvider implements ITreeContentProvider { - - @Override - public Object[] getChildren(Object parentElement) { - return ((ILTTngProjectTreeNode) parentElement).getChildren().toArray(); - } - - @Override - public Object getParent(Object element) { - return ((ILTTngProjectTreeNode) element).getParent(); - } - - @Override - public boolean hasChildren(Object element) { - return ((ILTTngProjectTreeNode) element).hasChildren(); - } - - @Override - public Object[] getElements(Object inputElement) { - if (inputElement instanceof LTTngProjectRoot) { - return ((LTTngProjectRoot) inputElement).getChildren().toArray(); - } - return null; - } - - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - @Override - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectLabelProvider.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectLabelProvider.java deleted file mode 100644 index d251b10bd5..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectLabelProvider.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.net.URL; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; - -/** - * LTTngProjectLabelProvider - *

- * TODO: Implement me. Please. - * TODO: Find proper icons for traces and experiments - */ -public class LTTngProjectLabelProvider implements ILabelProvider { - - private final String fTraceIconFile = "icons/obj16/garland16.png"; //$NON-NLS-1$ -// private final String fExperimentIconFile = "icons/obj16/garland16.png"; //$NON-NLS-1$ - - private final Image fOpenedProjectIcon; - private final Image fClosedProjectIcon; - private final Image fFolderIcon; - private final Image fTraceIcon; - private final Image fExperimentIcon; - - /** - * - */ - public LTTngProjectLabelProvider() { - - fOpenedProjectIcon = PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT); - fClosedProjectIcon = PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED); - fFolderIcon = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER); - - fTraceIcon = loadIcon(fTraceIconFile); - fExperimentIcon = fFolderIcon; // loadIcon(fExperimentIconFile); - } - - private Image loadIcon(String url) { - LTTngUiPlugin plugin = LTTngUiPlugin.getDefault(); - Image icon = plugin.getImageRegistry().get(url); - if (icon == null) { - URL imageURL = plugin.getBundle().getEntry(url); - ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageURL); - icon = descriptor.createImage(); - plugin.getImageRegistry().put(url, icon); - } - return icon; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) - */ - @Override - public Image getImage(Object element) { - - if (element instanceof LTTngProjectNode) { - LTTngProjectNode project = (LTTngProjectNode) element; - return (project.isOpen()) ? fOpenedProjectIcon : fClosedProjectIcon; - } - - if (element instanceof LTTngTraceFolderNode) { - return fFolderIcon; - } - - if (element instanceof LTTngTraceNode) { - return fTraceIcon; - } - - if (element instanceof LTTngExperimentFolderNode) { - return fFolderIcon; - } - - if (element instanceof LTTngExperimentNode) { - return fExperimentIcon; - } - - return null; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) - */ - @Override - public String getText(Object element) { - ILTTngProjectTreeNode node = (ILTTngProjectTreeNode) element; - String label = node.getName(); - if (node instanceof LTTngTraceFolderNode || - node instanceof LTTngExperimentFolderNode || - node instanceof LTTngExperimentNode) - { - label += " [" + node.getChildren().size() + "]"; //$NON-NLS-1$//$NON-NLS-2$ - } - return label; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener) - */ - @Override - public void addListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose() - */ - @Override - public void dispose() { - // TODO Auto-generated method stub - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String) - */ - @Override - public boolean isLabelProperty(Object element, String property) { - // TODO Auto-generated method stub - return false; - } - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener) - */ - @Override - public void removeListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java deleted file mode 100644 index 07648dd878..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectNode.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010, 2011 Ericsson, MontaVista Software - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - * Yufen Kuo (ykuo@mvista.com) - bug 354541: implement IAdaptable Project->Properties action is enabled when project is selected. - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.Platform; -import org.eclipse.linuxtools.lttng.core.LTTngProjectNature; - -/** - * LTTngProjectNode - *

- * TODO: Implement me. Please. - */ -public class LTTngProjectNode extends LTTngProjectTreeNode implements IAdaptable { - - public static final String TRACE_FOLDER_NAME = "Traces"; //$NON-NLS-1$ - public static final String EXPER_FOLDER_NAME = "Experiments"; //$NON-NLS-1$ - - private final IProject fProject; - private boolean fIsLTTngProject; - private boolean fIsOpen; - private LTTngTraceFolderNode fTracesFolder; - private LTTngExperimentFolderNode fExperimentsFolder; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - public LTTngProjectNode(IProject project) { - this(null, project); - } - - public LTTngProjectNode(ILTTngProjectTreeNode parent, IProject project) { - super(parent); - fProject = project; - updateState(); - } - - // ------------------------------------------------------------------------ - // LTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public String getName() { - return fProject.getName(); - } - - @Override - public void refreshChildren() { - - if (!(fIsOpen && fIsLTTngProject)) - return; - - try { - IResource[] resources = fProject.members(); - for (IResource resource : resources) { - if (resource.getType() == IResource.FOLDER) { - String name = resource.getName(); - if (name.equals(TRACE_FOLDER_NAME) && !isIncluded(true, name, fChildren)) { - fTracesFolder = new LTTngTraceFolderNode(this, (IFolder) resource); - fChildren.add(fTracesFolder); - } else - if (name.equals(EXPER_FOLDER_NAME) && !isIncluded(false, name, fChildren)) { - fExperimentsFolder = new LTTngExperimentFolderNode(this, (IFolder) resource); - fChildren.add(fExperimentsFolder); - } - } - } - List toRemove = new ArrayList(); - for (ILTTngProjectTreeNode node : fChildren) { - if (exists(node.getName(), resources)) { - node.refreshChildren(); - } - else { - toRemove.add(node); - } - } - for (ILTTngProjectTreeNode node : toRemove) { - fChildren.remove(node); - } - - } catch (CoreException e) { - } - } - - private boolean isIncluded(boolean isTraces, String name, List list) { - boolean found = false; - for (ILTTngProjectTreeNode node : list) { - if (node instanceof LTTngTraceFolderNode && isTraces) { - found |= node.getName().equals(name); - } else - if (node instanceof LTTngExperimentFolderNode && !isTraces) { - found |= node.getName().equals(name); - } - } - return found; - } - - private boolean exists(String name, IResource[] resources) { - for (IResource resource : resources) { - if (resource.getName().equals(name)) - return true; - } - return false; - } - - // ------------------------------------------------------------------------ - // Modifiers - // ------------------------------------------------------------------------ - - public void openProject() { - try { - fProject.open(null); - updateState(); - refreshChildren(); - } catch (CoreException e) { - e.printStackTrace(); - } - } - - public void closeProject() { - try { - fProject.close(null); - updateState(); - removeChildren(); - } catch (CoreException e) { - e.printStackTrace(); - } - } - - private boolean isLTTngProject(IProject project) { - boolean result = false; - if (project != null && project.isAccessible()) { - try { - result = project.hasNature(LTTngProjectNature.ID); - } catch (CoreException e) { - } - } - return result; - } - - public void updateState() { - fIsOpen = (fProject != null) ? fProject.isAccessible() : false; - fIsLTTngProject = isLTTngProject(fProject); - } - - // ------------------------------------------------------------------------ - // Accessors - // ------------------------------------------------------------------------ - - /** - * @return - */ - public boolean isLTTngProject() { - return fIsLTTngProject; - } - - /** - * @return - */ - public boolean isOpen() { - return fIsOpen; - } - - /** - * @return - */ - public IProject getProject() { - return fProject; - } - - /** - * @return - */ - public LTTngTraceFolderNode getTracesFolder() { - return fTracesFolder; - } - - /** - * @return - */ - public LTTngExperimentFolderNode getExperimentsFolder() { - return fExperimentsFolder; - } - - /** - * Returns the adapter - */ - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - if (adapter == IResource.class) { - return getProject(); - } - // Defer to the platform - return Platform.getAdapterManager().getAdapter(this, adapter); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectRoot.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectRoot.java deleted file mode 100644 index 75afdc50bd..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectRoot.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView; - -/** - * LTTngProjectRoot - *

- * TODO: Implement me. Please. - */ -public class LTTngProjectRoot extends LTTngProjectTreeNode { - - private final ProjectView fView; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - public LTTngProjectRoot(ProjectView view) { - super(null); - fView = view; - refreshChildren(); - } - - @Override - public void refresh() { - fView.refresh(); - } - - // ------------------------------------------------------------------------ - // LTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public String getName() { - return null; - } - - @Override - public void refreshChildren() { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IProject[] projects = root.getProjects(); - for (IProject project : projects) { - LTTngProjectNode node = find(project.getName()); - if (node == null) { - node = new LTTngProjectNode(this, project); - fChildren.add(node); - } else { - node.updateState(); - } - } - List toRemove = new ArrayList(); - for (ILTTngProjectTreeNode node : fChildren) { - if (exists(node.getName(), projects)) { - node.refreshChildren(); - } - else { - toRemove.add(node); - } - } - for (ILTTngProjectTreeNode node : toRemove) { - fChildren.remove(node); - } - } - - private LTTngProjectNode find(String name) { - for (ILTTngProjectTreeNode node : fChildren) { - if (node instanceof LTTngProjectNode && node.getName().equals(name)) { - return (LTTngProjectNode) node; - } - } - return null; - } - - private boolean exists(String name, IProject[] projects) { - for (IProject project : projects) { - if (project.getName().equals(name)) - return true; - } - return false; - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectTreeNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectTreeNode.java deleted file mode 100644 index f1e5b56c1f..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngProjectTreeNode.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.util.ArrayList; -import java.util.List; - -/** - * LTTngProjectTreeNode - *

- * TODO: Implement me. Please. - */ -public abstract class LTTngProjectTreeNode implements ILTTngProjectTreeNode { - - protected ILTTngProjectTreeNode fParent = null; - protected List fChildren = null; - - // ------------------------------------------------------------------------ - // Constructor - // ------------------------------------------------------------------------ - - public LTTngProjectTreeNode(ILTTngProjectTreeNode parent) { - fParent = parent; - fChildren = new ArrayList(); - } - - @Override - public String toString() { - return getName(); - } - - // ------------------------------------------------------------------------ - // ILTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public ILTTngProjectTreeNode getParent() { - return fParent; - } - - @Override - public boolean hasChildren() { - return fChildren.size() > 0; - } - - @Override - public List getChildren() { - return fChildren; - } - - @Override - public abstract void refreshChildren(); - - @Override - public void refresh() { - fParent.refresh(); - } - - @Override - public void removeChild(ILTTngProjectTreeNode child) { - for (ILTTngProjectTreeNode node : fChildren) { - if (node == child) { - node.removeChildren(); - // We can do it since we are returning right away - fChildren.remove(node); - return; - } - } - } - - @Override - public void removeChildren() { - for (ILTTngProjectTreeNode node : fChildren) { - node.removeChildren(); - } - fChildren.clear(); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngTraceFolderNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngTraceFolderNode.java deleted file mode 100644 index 96a76ea463..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngTraceFolderNode.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import java.lang.reflect.Array; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; - -/** - * LTTngTraceFolderNode - *

- * TODO: Implement me. Please. - */ -public class LTTngTraceFolderNode extends LTTngProjectTreeNode { - - private final IFolder fTraceFolder; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - public LTTngTraceFolderNode(IFolder folder) { - this(null, folder); - } - - public LTTngTraceFolderNode(ILTTngProjectTreeNode parent, IFolder folder) { - super(parent); - fTraceFolder = folder; - } - - // ------------------------------------------------------------------------ - // LTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public String getName() { - return fTraceFolder.getName(); - } - - @Override - public void refreshChildren() { - try { - IResource[] resources = fTraceFolder.members(); - for (IResource resource : resources) { - if (resource instanceof IFolder) { - LTTngTraceNode node = find(resource.getName()); - if (node == null) { - node = new LTTngTraceNode(this, (IFolder) resource); - fChildren.add(node); - } - } - } - for (ILTTngProjectTreeNode node : fChildren) { - if (!exists(node.getName(), resources)) { - fChildren.remove(node); - } - } - } catch (CoreException e) { - } - } - - private LTTngTraceNode find(String name) { - for (ILTTngProjectTreeNode node : fChildren) { - if (node instanceof LTTngTraceNode && node.getName().equals(name)) { - return (LTTngTraceNode) node; - } - } - return null; - } - - private boolean exists(String name, IResource[] resources) { - for (IResource resource : resources) { - if (resource.getName().equals(name)) - return true; - } - return false; - } - - // ------------------------------------------------------------------------ - // Accessors - // ------------------------------------------------------------------------ - - /** - * @return - */ - public LTTngProjectNode getProject() { - return (LTTngProjectNode) getParent(); - } - - /** - * @return - */ - public IFolder getFolder() { - return fTraceFolder; - } - - /** - * @return - */ - public LTTngTraceNode[] getTraces() { - LTTngTraceNode[] result = (LTTngTraceNode[]) Array.newInstance(LTTngTraceNode.class, fChildren.size()); - return fChildren.toArray(result); - } - - // ------------------------------------------------------------------------ - // Modifiers - // ------------------------------------------------------------------------ - -// No longer needed: handled by the IResourceChangeListener in the View - public void addTrace(IFolder trace) { -// LTTngTraceNode node = new LTTngTraceNode(this, trace); -// fChildren.add(node); -// refresh(); - } - -} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngTraceNode.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngTraceNode.java deleted file mode 100644 index d5f2be317a..0000000000 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/model/LTTngTraceNode.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Francois Chouinard - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.linuxtools.lttng.ui.views.project.model; - -import org.eclipse.core.resources.IFolder; - -/** - * LTTngTraceNode - *

- * TODO: Implement me. Please. - */ -public class LTTngTraceNode extends LTTngProjectTreeNode { - - private final IFolder fTrace; - - // ------------------------------------------------------------------------ - // Constructors - // ------------------------------------------------------------------------ - - public LTTngTraceNode(IFolder folder) { - this(null, folder); - } - - public LTTngTraceNode(ILTTngProjectTreeNode parent, IFolder trace) { - super(parent); - fTrace = trace; - } - - // ------------------------------------------------------------------------ - // LTTngProjectTreeNode - // ------------------------------------------------------------------------ - - @Override - public String getName() { - return fTrace.getName(); - } - - @Override - public void refreshChildren() { - } - - // ------------------------------------------------------------------------ - // Accessors - // ------------------------------------------------------------------------ - - /** - * @return - */ - public LTTngProjectNode getProject() { - ILTTngProjectTreeNode projectNode = null; - ILTTngProjectTreeNode parent = getParent(); - if (parent instanceof LTTngTraceFolderNode) { - projectNode = parent.getParent(); - } - else if (parent instanceof LTTngExperimentNode) { - projectNode = parent.getParent().getParent(); - } - - return (LTTngProjectNode) projectNode; - } - - /** - * @return - */ - public IFolder getFolder() { - return fTrace; - } - -}