Java Code Examples for org.eclipse.ui.PartInitException#printStackTrace()
The following examples show how to use
org.eclipse.ui.PartInitException#printStackTrace() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SCTPerspectiveManager.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected void schedulePerspectiveSwitchJob(final String perspectiveID) { Job switchJob = new UIJob(DebugUIPlugin.getStandardDisplay(), "Perspective Switch Job") { //$NON-NLS-1$ public IStatus runInUIThread(IProgressMonitor monitor) { IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); if (window != null && !(isCurrentPerspective(window, perspectiveID))) { switchToPerspective(window, perspectiveID); } // Force the debug view to open if (window != null) { try { window.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(SIMULATION_VIEW_ID); } catch (PartInitException e) { e.printStackTrace(); } } return Status.OK_STATUS; } }; switchJob.setSystem(true); switchJob.setPriority(Job.INTERACTIVE); switchJob.setRule(AsynchronousSchedulingRuleFactory.getDefault().newSerialPerObjectRule(this)); switchJob.schedule(); }
Example 2
Source File: ReViewerAction.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
@Override public void run(IAction action) { IFile file = null; IEditorInput input = targetEditor.getEditorInput(); if(input instanceof IFileEditorInput) { file = ((IFileEditorInput) input).getFile(); } String url = file.getLocation().toOSString(); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if(window == null) return; IWorkbenchPage page = window.getActivePage(); if(page == null) return; WebBrowserView part = (WebBrowserView)page.findView("com.aptana.browser.views.webbrowser"); if(part != null) { page.bringToTop(part); part.setURL(url); return; } try { WebBrowserView view = (WebBrowserView)page.showView("com.aptana.browser.views.webbrowser"); view.setURL(url); } catch (PartInitException e) { e.printStackTrace(); } }
Example 3
Source File: ReViewAction.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
@Override public void run(IAction action) { IResource resource = (IResource)select.getFirstElement(); String url = resource.getLocation().toOSString(); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if(window == null) return; IWorkbenchPage page = window.getActivePage(); if(page == null) return; WebBrowserView part = (WebBrowserView)page.findView("com.aptana.browser.views.webbrowser"); if(part != null) { page.bringToTop(part); part.setURL(url); return; } try { WebBrowserView view = (WebBrowserView)page.showView("com.aptana.browser.views.webbrowser"); view.setURL(url); } catch (PartInitException e) { e.printStackTrace(); } }
Example 4
Source File: ChartWizard.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
@Override public boolean performFinish() { // here the chart is passed to the view. // create the diagram ICommunicationView view = null; try { view = (ICommunicationView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView(chartViewId); view.setAndRenderChart(myChart); } catch (PartInitException e1) { e1.printStackTrace(); } try { PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(chartViewId); } catch (PartInitException e) { e.printStackTrace(); } return true; }
Example 5
Source File: YangSyntax.java From yang-design-studio with Eclipse Public License 1.0 | 6 votes |
public MessageConsoleStream getMessageStream() { MessageConsole myConsole = findConsole("Yang Console"); //calls function to find/create the Yang console if (myConsole != null) { IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); IWorkbenchPage page = win.getActivePage(); String id = IConsoleConstants.ID_CONSOLE_VIEW; IConsoleView view; try { view = (IConsoleView) page.showView(id); view.display(myConsole); return myConsole.newMessageStream(); } catch (PartInitException e) { e.printStackTrace(); } } return null; }
Example 6
Source File: NewXtxtUMLFileCreationWizard.java From txtUML with Eclipse Public License 1.0 | 6 votes |
@Override public boolean performFinish() { if (!page.isPageComplete()) { return false; } IFile file = page.createNewFile(); boolean result = file != null; if (result) { try { IDE.openEditor(workbench.getActiveWorkbenchWindow().getActivePage(), file); } catch (PartInitException e) { e.printStackTrace(); } } return result; }
Example 7
Source File: BibtexEditor.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
/** * open the file document which is refered to in the bibtex entry. The path * has to start from the root of the project where the bibtex entry is * included. */ private void openPdf() { IFile res = Utils.getIFilefromDocument(document); if (res == null || res.getProject() == null) { MessageDialog.openInformation(this.getSite().getShell(), "Bibtex" + document.getKey(), "Root or Resource not found"); return; } IFile file = res.getProject().getFile(document.getFile()); if (file.exists()) { IFileStore fileStore = EFS.getLocalFileSystem().getStore(file.getLocation()); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditorOnFileStore(page, fileStore); } catch (PartInitException e) { e.printStackTrace(); } } else { MessageDialog.openInformation(this.getSite().getShell(), "Bibtex" + document.getKey(), "Document not found"); } }
Example 8
Source File: DiagramPartitioningUtil.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public static IEditorPart openSubmachineEditor(Diagram diagram, String context) { try { IFile file = WorkspaceSynchronizer.getFile(diagram.eResource()); IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName()); final IWorkbenchPage wbPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); return wbPage.openEditor(new SubmachineEditorInput(diagram, context), desc.getId()); } catch (PartInitException e) { e.printStackTrace(); } return null; }
Example 9
Source File: CodeRecommendationResultsController.java From scava with Eclipse Public License 2.0 | 5 votes |
@Override public void onTargetDoubleClicked(CodeRecommendationTarget target) { IPath location = target.getFile().getLocation(); try { IDE.openEditorOnFileStore(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), EFS.getLocalFileSystem().getStore(location)); } catch (PartInitException e) { e.printStackTrace(); MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Unexpected error during opening file \n" + location + "\n" + e); } }
Example 10
Source File: AbstractFormEditor.java From typescript.java with MIT License | 5 votes |
@Override protected void addPages() { this.jsonEditor = new StructuredTextEditor(); jsonEditor.setEditorPart(this); try { // Add pages like overview, etc doAddPages(); // Add source page jsonEditorIndex = addPage(jsonEditor, getEditorInput()); setPageText(jsonEditorIndex, "Source"); } catch (PartInitException e) { e.printStackTrace(); } }
Example 11
Source File: OpenAPICloudWizardActionDelegate.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static void open(IWorkbenchPage page) { try { IDE.openEditor(page , input, "com.apicloud.navigator.APICloudWizard"); } catch (PartInitException e) { e.printStackTrace(); } }
Example 12
Source File: ConsoleOpenAction.java From LogViewer with Eclipse Public License 2.0 | 5 votes |
/** * @see IActionDelegate#run(IAction) */ public void run(IAction action) { if (!isEnabled()) { MessageDialog.openInformation( new Shell(), "Logfile Viewer", "Wrong Selection"); return; } for (int i=0;i<resource.length;i++) { if (resource[i] == null) continue; String full_path = resource[i].getClass().toString().replaceFirst("class ", "") + System.getProperty("file.separator") + resource[i].getName(); LogViewer view = null; try { view = (LogViewer) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("de.anbos.eclipse.logviewer.plugin.LogViewer"); } catch (PartInitException e) { e.printStackTrace(); } view.checkAndOpenFile(LogFileType.LOGFILE_ECLIPSE_CONSOLE, full_path, null, false); } }
Example 13
Source File: CheckLoaderDialog.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void openEditor() { IWorkbenchPage workbenchPage = Activator.getDefault().getWorkbench() .getActiveWorkbenchWindow().getActivePage(); try { IDE.openEditor(workbenchPage, getInput(), "com.apicloud.customapploader"); } catch (PartInitException e1) { e1.printStackTrace(); } }
Example 14
Source File: WebHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public static void openPage(final String string) { try { final IGamaView.Html view = (Html) WorkbenchHelper.getPage().openEditor(new NullEditorInput(), "msi.gama.application.browser"); view.setUrl(string); } catch (final PartInitException e) { e.printStackTrace(); } }
Example 15
Source File: SettingsHandler.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { SettingsDialog settingsDialog = new SettingsDialog(HandlerUtil.getActiveShell(event), SWT.DIALOG_TRIM); try { IViewPart part = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().showView("chart.view.chartview"); settingsDialog.setViewPart(part); } catch (PartInitException e) { e.printStackTrace(); } settingsDialog.open(); return null; }
Example 16
Source File: TLAEditorAndPDFViewer.java From tlaplus with MIT License | 5 votes |
@Override protected void addPages() { try { // This code moves the tabs to the top of the page. // This makes them more obvious to the user. if (getContainer() instanceof CTabFolder) { final CTabFolder cTabFolder = (CTabFolder) getContainer(); cTabFolder.setTabPosition(SWT.TOP); // If there is only the editor but no PDF shown next to it, the tab bar of the // ctabfolder just wastes screen estate. if (cTabFolder.getItemCount() <= 1) { cTabFolder.setTabHeight(0); } else { cTabFolder.setTabHeight(-1); } } tlaEditor = new TLAEditor(); addPage(tlaEditorIndex, tlaEditor, tlaEditorInput); setPageText(tlaEditorIndex, "TLA Module"); } catch (PartInitException e) { // I hope you don't choke swallowing all those exceptions... e.printStackTrace(); } }
Example 17
Source File: ExampleController.java From scava with Eclipse Public License 2.0 | 5 votes |
@Override public void onNewViewPartView() { try { ExampleModel model = new ExampleModel(); IExampleView view = ExampleViewPartView.open(ExampleViewPartView.ID, "Part_" + (new Random().nextLong())); ExampleController controller = new ExampleController(this, model, view); controller.init(); } catch (PartInitException e) { e.printStackTrace(); } }
Example 18
Source File: CreateCiteHandler.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // TODO: seems to be there is some refactoring needed in here ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection == null || !(selection instanceof IStructuredSelection)) { return null; } IStructuredSelection currentSelection = (IStructuredSelection) selection; IViewPart part = null; try { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { part = page.showView(chartViewId); } } } catch (PartInitException e) { e.printStackTrace(); return null; } if (part instanceof ICommunicationView) { view = (ICommunicationView) part; } else { return null; } view.getPreview().setTextToShow(noDataToDisplay); if (currentSelection.size() == 1) { view.getPreview().setDataPresent(true); ChartDataProvider provider = new ChartDataProvider(); Term input = (Term) currentSelection.getFirstElement(); Map<String, Integer> citeChartData = provider.calculateNumberOfPapersPerClass(input); BarChartConfiguration.get().getGeneralSettings().setChartTitle("Number of cites per subclass of " + input.getName()); BarChartConfiguration.get().setTermSort(TermSort.SUBCLASS); Chart citeChart = ChartGenerator.createCiteBar(citeChartData); view.setAndRenderChart(citeChart); } else { view.setAndRenderChart(null); } return null; }
Example 19
Source File: CreateBubbleChartHandler.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // TODO: seems to be there is some refactoring needed in here ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection == null || !(selection instanceof IStructuredSelection)) { return null; } IStructuredSelection currentSelection = (IStructuredSelection) selection; IViewPart part = null; try { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { part = page.showView(chartViewId); } } } catch (PartInitException e) { e.printStackTrace(); return null; } if (part instanceof ICommunicationView) { view = (ICommunicationView) part; } else { return null; } view.getPreview().setTextToShow(noDataToDisplay); if (currentSelection.size() == 2) { view.getPreview().setDataPresent(true); ChartDataProvider provider = new ChartDataProvider(); @SuppressWarnings("unchecked") Iterator<Term> selectionIterator = currentSelection.iterator(); Term first = selectionIterator.next(); Term second = selectionIterator.next(); List<BubbleDataContainer> bubbleChartData = provider.calculateBubbleChartData(first, second); BubbleChartConfiguration.get().getGeneralSettings().setChartTitle("Intersection of " + first.getName() + " and " + second.getName()); Chart bubbleChart = ChartGenerator.createBubble(bubbleChartData,first,second); view.setAndRenderChart(bubbleChart); } else { view.setAndRenderChart(null); } return null; }
Example 20
Source File: CreatePieChartHandler.java From slr-toolkit with Eclipse Public License 1.0 | 4 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // TODO: seems to be there is some refactoring needed in here ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection == null || !(selection instanceof IStructuredSelection)) { return null; } IStructuredSelection currentSelection = (IStructuredSelection) selection; IViewPart part = null; try { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { part = page.showView(chartViewId); } } } catch (PartInitException e) { e.printStackTrace(); return null; } if (part instanceof ICommunicationView) { view = (ICommunicationView) part; } else { return null; } view.getPreview().setTextToShow(noDataToDisplay); if (currentSelection.size() == 1) { view.getPreview().setDataPresent(true); ChartDataProvider provider = new ChartDataProvider(); Term input = (Term) currentSelection.getFirstElement(); Map<String, Integer> citeChartData = provider.calculateNumberOfPapersPerClass(input); PieChartConfiguration.get().getGeneralSettings().setChartTitle("Number of cites per subclass of " + input.getName()); PieChartConfiguration.get().setPieTermSort(TermSort.SUBCLASS); Chart citeChart = ChartGenerator.createPie(citeChartData); view.setAndRenderChart(citeChart); } else { view.setAndRenderChart(null); } return null; }