| /********************************************************************* |
| * Copyright (c) 2017 Red Hat Inc. and others. |
| * |
| * This program and the accompanying materials are made |
| * available under the terms of the Eclipse Public License 2.0 |
| * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Mickael Istria (Red Hat Inc.) - Source Reference |
| * Lucas Bullen (Red Hat Inc.) - Initial implementation |
| *******************************************************************************/ |
| package org.eclipse.corrosion.tests; |
| |
| import java.io.IOException; |
| |
| import org.eclipse.core.runtime.CoreException; |
| import org.eclipse.ui.IEditorPart; |
| import org.eclipse.ui.IWorkbenchPage; |
| import org.eclipse.ui.PlatformUI; |
| import org.eclipse.ui.ide.IDE; |
| import org.eclipse.ui.internal.genericeditor.ExtensionBasedTextEditor; |
| import org.junit.Assert; |
| import org.junit.Test; |
| |
| public class TestIDEIntegration extends AbstractCorrosionTest { |
| |
| @Test |
| public void testRustEditorAssociation() throws IOException, CoreException { |
| IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); |
| IEditorPart editor = null; |
| editor = IDE.openEditor(activePage, getProject("basic").getFolder("src").getFile("main.rs")); |
| Assert.assertTrue(editor instanceof ExtensionBasedTextEditor); |
| } |
| |
| @Test |
| public void testManifestEditorAssociation() throws IOException, CoreException { |
| IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); |
| IEditorPart editor = null; |
| editor = IDE.openEditor(activePage, getProject("basic").getFile("Cargo.toml")); |
| Assert.assertTrue(editor instanceof ExtensionBasedTextEditor); |
| } |
| |
| } |