use of org.eclipse.ui.PartInitException in project linuxtools by eclipse.
the class PerfCore method refreshView.
public static void refreshView(final String title) {
Display.getDefault().syncExec(() -> {
try {
PerfProfileView view = (PerfProfileView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PerfPlugin.VIEW_ID);
view.setContentDescription(title);
view.refreshModel();
} catch (PartInitException e) {
logException(e);
}
});
}
use of org.eclipse.ui.PartInitException in project linuxtools by eclipse.
the class PerfSaveSessionHandler method saveData.
@Override
public IPath saveData(String filename) {
// get paths
IPath newDataLoc = getNewDataLocation(filename, DATA_EXT);
IPath defaultDataLoc = PerfPlugin.getDefault().getPerfProfileData();
URI newDataLocURI = null;
URI defaultDataLocURI = null;
// get files
IRemoteFileProxy proxy = null;
try {
newDataLocURI = new URI(newDataLoc.toPortableString());
defaultDataLocURI = new URI(defaultDataLoc.toPortableString());
proxy = RemoteProxyManager.getInstance().getFileProxy(newDataLocURI);
} catch (URISyntaxException e) {
openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment());
} catch (CoreException e) {
openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment());
}
IFileStore newDataFileStore = proxy.getResource(newDataLocURI.getPath());
IFileStore defaultDataFileStore = proxy.getResource(defaultDataLocURI.getPath());
if (canSave(newDataLoc)) {
// copy default data into new location
try {
defaultDataFileStore.copy(newDataFileStore, EFS.OVERWRITE, null);
PerfPlugin.getDefault().setPerfProfileData(newDataLoc);
try {
PerfProfileView view = (PerfProfileView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(PerfPlugin.VIEW_ID);
view.setContentDescription(newDataLoc.toOSString());
} catch (PartInitException e) {
// fail silently
}
IFileInfo info = newDataFileStore.fetchInfo();
info.setAttribute(EFS.ATTRIBUTE_READ_ONLY, true);
newDataFileStore.putInfo(info, EFS.SET_ATTRIBUTES, null);
return newDataLoc;
} catch (CoreException e) {
openErroDialog(Messages.PerfSaveSession_failure_title, Messages.PerfSaveSession_failure_msg, newDataLoc.lastSegment());
}
}
return null;
}
use of org.eclipse.ui.PartInitException in project linuxtools by eclipse.
the class STLink2SourceSupport method openFileImpl.
private static boolean openFileImpl(IProject project, IPath sourceLoc, int lineNumber) {
if (sourceLoc == null || "??".equals(sourceLoc.toString())) {
// $NON-NLS-1$
return false;
}
try {
IEditorInput editorInput = getEditorInput(sourceLoc, project);
IWorkbenchPage p = CUIPlugin.getActivePage();
if (p != null) {
if (editorInput == null) {
p.openEditor(new STCSourceNotFoundEditorInput(project, sourceLoc, lineNumber), STCSourceNotFoundEditor.ID, true);
} else {
IEditorPart editor = p.openEditor(editorInput, CUIPlugin.EDITOR_ID, true);
if (lineNumber > 0 && editor instanceof ITextEditor) {
IDocumentProvider provider = ((ITextEditor) editor).getDocumentProvider();
IDocument document = provider.getDocument(editor.getEditorInput());
try {
int start = document.getLineOffset(lineNumber - 1);
((ITextEditor) editor).selectAndReveal(start, 0);
IWorkbenchPage page = editor.getSite().getPage();
page.activate(editor);
return true;
} catch (BadLocationException x) {
// ignore
}
}
}
}
} catch (PartInitException e) {
}
return false;
}
use of org.eclipse.ui.PartInitException in project linuxtools by eclipse.
the class OprofileViewDoubleClickListener method doubleClick.
@Override
public void doubleClick(DoubleClickEvent event) {
TreeViewer tv = (TreeViewer) event.getSource();
TreeSelection tsl = (TreeSelection) tv.getSelection();
IUiModelElement element = (IUiModelElement) tsl.getFirstElement();
try {
if (element instanceof UiModelEvent) {
// UiModelEvent event = (UiModelEvent)element;
} else if (element instanceof UiModelSession) {
/* moved into an action menu */
} else if (element instanceof UiModelImage) {
// UiModelImage image = (UiModelImage)element;
} else if (element instanceof UiModelSymbol) {
final UiModelSymbol symbol = (UiModelSymbol) element;
final String fileName = symbol.getFileName();
int line = symbol.getLineNumber();
ProfileUIUtils.openEditorAndSelect(fileName, line);
} else if (element instanceof UiModelSample) {
// jump to line number in the appropriate file
UiModelSample sample = (UiModelSample) element;
int line = sample.getLine();
// get file name from the parent sample
final String fileName = sample.getFile();
ProfileUIUtils.openEditorAndSelect(fileName, line, getProject());
}
} catch (BadLocationException e1) {
e1.printStackTrace();
} catch (PartInitException e2) {
e2.printStackTrace();
} catch (CoreException e) {
e.printStackTrace();
}
}
use of org.eclipse.ui.PartInitException in project linuxtools by eclipse.
the class MassifViewPart method displayChart.
private void displayChart(final ChartEditorInput chartInput) {
Display.getDefault().syncExec(() -> {
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.openEditor(chartInput, MassifPlugin.EDITOR_ID);
} catch (PartInitException e) {
e.printStackTrace();
}
});
saveChartAction.setChart(chartInput.getChart().getChartControl(), chartInput.getName());
}
Aggregations