diff options
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt')
7 files changed, 677 insertions, 677 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java index b85184476c3..d903ce74653 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java @@ -1,47 +1,47 @@ -/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
- * 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:
- * IBM - Initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- * Markus Schorn (Wind River Systems)
- * Jonah Graham (Kichwa Coders) - converted to new style suite (Bug 515178)
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- * Test all areas of the UI.
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- org.eclipse.cdt.ui.tests.text.TextTestSuite.class,
- org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class,
- org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class,
- org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite.class,
- org.eclipse.cdt.ui.tests.callhierarchy.extension.CHExtensionTest.class,
- org.eclipse.cdt.ui.tests.typehierarchy.TypeHierarchyTestSuite.class,
- org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class,
- org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite.class,
- org.eclipse.cdt.ui.tests.text.contentassist2.ContentAssist2TestSuite.class,
- org.eclipse.cdt.ui.tests.text.selection.SelectionTestSuite.class,
- org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest.class,
- org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class,
- org.eclipse.cdt.ui.tests.search.SearchTestSuite.class,
- org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite.class,
- org.eclipse.cdt.ui.tests.chelp.CHelpTest.class,
- org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class,
- org.eclipse.cdt.ui.tests.wizards.settingswizards.SettingsWizardTestSuite.class,
- org.eclipse.cdt.ui.tests.misc.MiscTestSuite.class,
- org.eclipse.cdt.ui.tests.editor.EditorTestSuite.class,
- org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class,
-
-})
-public class AutomatedSuite {
-}
+/******************************************************************************* + * Copyright (c) 2000, 2017 IBM Corporation and others. + * 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: + * IBM - Initial API and implementation + * Anton Leherbauer (Wind River Systems) + * Markus Schorn (Wind River Systems) + * Jonah Graham (Kichwa Coders) - converted to new style suite (Bug 515178) + *******************************************************************************/ +package org.eclipse.cdt.ui.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Test all areas of the UI. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + org.eclipse.cdt.ui.tests.text.TextTestSuite.class, + org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class, + org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class, + org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite.class, + org.eclipse.cdt.ui.tests.callhierarchy.extension.CHExtensionTest.class, + org.eclipse.cdt.ui.tests.typehierarchy.TypeHierarchyTestSuite.class, + org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class, + org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite.class, + org.eclipse.cdt.ui.tests.text.contentassist2.ContentAssist2TestSuite.class, + org.eclipse.cdt.ui.tests.text.selection.SelectionTestSuite.class, + org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest.class, + org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class, + org.eclipse.cdt.ui.tests.search.SearchTestSuite.class, + org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite.class, + org.eclipse.cdt.ui.tests.chelp.CHelpTest.class, + org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class, + org.eclipse.cdt.ui.tests.wizards.settingswizards.SettingsWizardTestSuite.class, + org.eclipse.cdt.ui.tests.misc.MiscTestSuite.class, + org.eclipse.cdt.ui.tests.editor.EditorTestSuite.class, + org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class, + +}) +public class AutomatedSuite { +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java index f04412856ae..31dba4a22c2 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java @@ -1,61 +1,61 @@ -/*******************************************************************************
- * Copyright (c) 2018 Wind River Systems, Inc. and others.
- * 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:
- * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.callhierarchy.extension;
-
-import org.eclipse.jface.viewers.IOpenListener;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.ui.ICHEContentProvider;
-
-import org.eclipse.cdt.internal.core.model.ext.FunctionDeclarationHandle;
-
-/**
- * This class implements ICHEProvider and provides test information
- * */
-public class CHContentProvider implements ICHEContentProvider {
-
- @Override
- public Object[] asyncComputeExtendedRoot(Object parentElement) {
- Object[] object =null;
- if (parentElement instanceof ICElement) {
- ICElement element = (ICElement)parentElement;
- if ( isDslFunction(element)) {
- // check if this function declaration comes from a DSL file
- DslNode node = new DslNode(element);
- node.setProject(element.getCProject());
- return new Object[]{node};
- }
- }
- return object;
- }
-
- @Override
- public IOpenListener getCCallHierarchyOpenListener() {
- return new CHOpenListener();
- }
-
- /**
- * E.g. A custom implementation, suppose that functions that ends with
- * "_dsl" have been originally declared in a DSL file.
- * @param cElement
- * @return
- */
- private static boolean isDslFunction(ICElement cElement) {
- if (cElement instanceof FunctionDeclarationHandle) {
- FunctionDeclarationHandle f = (FunctionDeclarationHandle)cElement;
- if (f.getElementName() !=null & f.getElementName().endsWith("_dsl")) {
- return true;
- }
- }
- return false;
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. and others. + * 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.jface.viewers.IOpenListener; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.ui.ICHEContentProvider; + +import org.eclipse.cdt.internal.core.model.ext.FunctionDeclarationHandle; + +/** + * This class implements ICHEProvider and provides test information + * */ +public class CHContentProvider implements ICHEContentProvider { + + @Override + public Object[] asyncComputeExtendedRoot(Object parentElement) { + Object[] object =null; + if (parentElement instanceof ICElement) { + ICElement element = (ICElement)parentElement; + if ( isDslFunction(element)) { + // check if this function declaration comes from a DSL file + DslNode node = new DslNode(element); + node.setProject(element.getCProject()); + return new Object[]{node}; + } + } + return object; + } + + @Override + public IOpenListener getCCallHierarchyOpenListener() { + return new CHOpenListener(); + } + + /** + * E.g. A custom implementation, suppose that functions that ends with + * "_dsl" have been originally declared in a DSL file. + * @param cElement + * @return + */ + private static boolean isDslFunction(ICElement cElement) { + if (cElement instanceof FunctionDeclarationHandle) { + FunctionDeclarationHandle f = (FunctionDeclarationHandle)cElement; + if (f.getElementName() !=null & f.getElementName().endsWith("_dsl")) { + return true; + } + } + return false; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java index af8b5c0b3a8..35dd3c1e4bc 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java @@ -1,106 +1,106 @@ -/*******************************************************************************
- * Copyright (c) 2018 Wind River Systems, Inc. and others.
- * 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:
- * Lidia Popescu - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.callhierarchy.extension;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyBaseTest;
-
-import org.eclipse.cdt.internal.ui.editor.CEditor;
-
-import junit.framework.TestSuite;
-
-/**
- * @author Lidia Popescu
- *
- */
-public class CHExtensionTest extends CallHierarchyBaseTest {
-
- private static final String FILE_NAME_MAIN_C = "CallHierarchy_main.c";
- private static final String FILE_NAME_DSL = "CallHierarchy_test.java";
- private static final String FILE_NAME_C = "CallHierarchy_test.c";
-
- public CHExtensionTest(String name) {
- super(name);
- }
-
- public static TestSuite suite() {
- return new TestSuite(CHExtensionTest.class);
- }
-
-// {CallHierarchy_main.c}
-// extern void function_c(void);
-// extern void function_dsl(void);
-//
-// void main(void)
-// {
-// function_c();
-// function_dsl();
-// }
-
-// {CallHierarchy_test.c}
-// void function_c(void)
-// {
-// printf("Hello, world!\n");
-// }
-
-// {CallHierarchy_test.java}
-// /** Suppose this code is written in a different custom programming language, any DSL, e.g. Java*/
-// class CallHierarchy_test {
-// public static void function_dsl() {
-// System.out.println("Hello, world!");
-// }
-// }
- public void testCallHierarchy() throws Exception {
-
- assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.cdt.ui.CCallHierarchy"));
-
- ImageDescriptor imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(CUIPlugin.PLUGIN_ID, CHLabelProvider.ICON_PATH);
- assertNotNull(imageDesc);
- Image image = imageDesc.createImage(); //$NON-NLS-1$
- assertNotNull(image);
-
- String content = readTaggedComment(FILE_NAME_DSL);
- assertNotNull(content);
- IFile file= createFile(getProject(), FILE_NAME_DSL, content);
-
- content = readTaggedComment(FILE_NAME_C);
- assertNotNull(content);
- file= createFile(getProject(), FILE_NAME_C, content);
- waitUntilFileIsIndexed(fIndex, file);
-
- content = readTaggedComment(FILE_NAME_MAIN_C);
- assertNotNull(content);
- file= createFile(getProject(), FILE_NAME_MAIN_C, content);
- waitUntilFileIsIndexed(fIndex, file);
- CEditor editor = openEditor(file);
-
- String functionName ="function_c";
- editor.selectAndReveal(content.indexOf(functionName), functionName.length());
- openCallHierarchy(editor);
- Tree tree = getCHTreeViewer().getTree();
- checkTreeNode(tree, 0, "function_c() : void");
- checkTreeNode(tree, 0, 0 ,"main() : void");
-
- functionName ="function_dsl";
- editor.selectAndReveal(content.indexOf(functionName), functionName.length());
- openCallHierarchy(editor);
- tree = getCHTreeViewer().getTree();
- checkTreeNode(tree, 0, "JAVA function function_dsl()");
- checkTreeNode(tree, 0, 0, "function_dsl() : void");
- }
-}
+/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. and others. + * 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyBaseTest; + +import org.eclipse.cdt.internal.ui.editor.CEditor; + +import junit.framework.TestSuite; + +/** + * @author Lidia Popescu + * + */ +public class CHExtensionTest extends CallHierarchyBaseTest { + + private static final String FILE_NAME_MAIN_C = "CallHierarchy_main.c"; + private static final String FILE_NAME_DSL = "CallHierarchy_test.java"; + private static final String FILE_NAME_C = "CallHierarchy_test.c"; + + public CHExtensionTest(String name) { + super(name); + } + + public static TestSuite suite() { + return new TestSuite(CHExtensionTest.class); + } + +// {CallHierarchy_main.c} +// extern void function_c(void); +// extern void function_dsl(void); +// +// void main(void) +// { +// function_c(); +// function_dsl(); +// } + +// {CallHierarchy_test.c} +// void function_c(void) +// { +// printf("Hello, world!\n"); +// } + +// {CallHierarchy_test.java} +// /** Suppose this code is written in a different custom programming language, any DSL, e.g. Java*/ +// class CallHierarchy_test { +// public static void function_dsl() { +// System.out.println("Hello, world!"); +// } +// } + public void testCallHierarchy() throws Exception { + + assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.cdt.ui.CCallHierarchy")); + + ImageDescriptor imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(CUIPlugin.PLUGIN_ID, CHLabelProvider.ICON_PATH); + assertNotNull(imageDesc); + Image image = imageDesc.createImage(); //$NON-NLS-1$ + assertNotNull(image); + + String content = readTaggedComment(FILE_NAME_DSL); + assertNotNull(content); + IFile file= createFile(getProject(), FILE_NAME_DSL, content); + + content = readTaggedComment(FILE_NAME_C); + assertNotNull(content); + file= createFile(getProject(), FILE_NAME_C, content); + waitUntilFileIsIndexed(fIndex, file); + + content = readTaggedComment(FILE_NAME_MAIN_C); + assertNotNull(content); + file= createFile(getProject(), FILE_NAME_MAIN_C, content); + waitUntilFileIsIndexed(fIndex, file); + CEditor editor = openEditor(file); + + String functionName ="function_c"; + editor.selectAndReveal(content.indexOf(functionName), functionName.length()); + openCallHierarchy(editor); + Tree tree = getCHTreeViewer().getTree(); + checkTreeNode(tree, 0, "function_c() : void"); + checkTreeNode(tree, 0, 0 ,"main() : void"); + + functionName ="function_dsl"; + editor.selectAndReveal(content.indexOf(functionName), functionName.length()); + openCallHierarchy(editor); + tree = getCHTreeViewer().getTree(); + checkTreeNode(tree, 0, "JAVA function function_dsl()"); + checkTreeNode(tree, 0, 0, "function_dsl() : void"); + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java index 86ae3cfcd3f..a400878599b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java @@ -1,72 +1,72 @@ -/*******************************************************************************
- * Copyright (c) 2018 Wind River Systems, Inc. and others.
- * 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:
- * Lidia Popescu - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.callhierarchy.extension;
-
-import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.StyledCellLabelProvider;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.ui.CUIPlugin;
-
-public class CHLabelProvider implements IStyledLabelProvider {
-
- public static String ICON_PATH= "$nl$/icons/obj16/container_obj.gif";
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return true;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
-
- @Override
- public StyledString getStyledText(Object element) {
- if (element instanceof DslNode) {
- DslNode node = (DslNode)element;
- ICElement decl = node.getRepresentedDeclaration();
-
- if (decl !=null) {
- StyledString label = new StyledString();
- label.append(decl.getElementName());
- if (node.getDslNodeName() != null) {
- return StyledCellLabelProvider.styleDecoratedString(node.getDslNodeName(), StyledString.DECORATIONS_STYLER, label);
- }
- return label;
- }
- }
- return null;
- }
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof DslNode) {
- Image img = AbstractUIPlugin.imageDescriptorFromPlugin(
- CUIPlugin.PLUGIN_ID, ICON_PATH).createImage(); //$NON-NLS-1$
- return img;
- }
- return null;
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. and others. + * 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.ui.CUIPlugin; + +public class CHLabelProvider implements IStyledLabelProvider { + + public static String ICON_PATH= "$nl$/icons/obj16/container_obj.gif"; + + @Override + public void addListener(ILabelProviderListener listener) { + } + + @Override + public void dispose() { + } + + @Override + public boolean isLabelProperty(Object element, String property) { + return true; + } + + @Override + public void removeListener(ILabelProviderListener listener) { + } + + @Override + public StyledString getStyledText(Object element) { + if (element instanceof DslNode) { + DslNode node = (DslNode)element; + ICElement decl = node.getRepresentedDeclaration(); + + if (decl !=null) { + StyledString label = new StyledString(); + label.append(decl.getElementName()); + if (node.getDslNodeName() != null) { + return StyledCellLabelProvider.styleDecoratedString(node.getDslNodeName(), StyledString.DECORATIONS_STYLER, label); + } + return label; + } + } + return null; + } + + @Override + public Image getImage(Object element) { + if (element instanceof DslNode) { + Image img = AbstractUIPlugin.imageDescriptorFromPlugin( + CUIPlugin.PLUGIN_ID, ICON_PATH).createImage(); //$NON-NLS-1$ + return img; + } + return null; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java index 4023687829b..579879c8484 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java @@ -1,92 +1,92 @@ -/*******************************************************************************
- * Copyright (c) 2018 Wind River Systems, Inc. and others.
- * 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:
- * Lidia Popescu - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.callhierarchy.extension;
-
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.progress.UIJob;
-
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.ui.testplugin.CTestPlugin;
-
-
-public class CHOpenListener implements IOpenListener {
-
- /** On Node click open corresponding file */
- @Override
- public void open(OpenEvent event) {
- if (event !=null ) {
- ISelection selection = event.getSelection();
- if (selection instanceof TreeSelection ) {
- TreeSelection treeSelection = (TreeSelection)selection;
- Object element = treeSelection.getFirstElement();
- if (element instanceof DslNode) {
- DslNode node = (DslNode)element;
- ICProject project = node.getProject();
- /**
- * Based on a custom algorithm the corresponding file and line should be found and open. Suppose that the file
- * 'CallHierarchy_test.java' has been found, and the line number '3' where the function 'function_dsl' is defined.
- */
- IFile file = project.getProject().getFile("CallHierarchy_test.java");
- IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getPage();
- IEditorInput input = new FileEditorInput(file);
- IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName());
-
- UIJob ui = new UIJob("Open File") {
-
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- try {
- String editorId = null;
- if (desc == null || desc.isOpenExternal()) {
- editorId = "org.eclipse.ui.DefaultTextEditor";
- } else {
- editorId = desc.getId();
- }
- IEditorPart editor = page.openEditor(input, editorId);
- IMarker fMarker = file.createMarker(IMarker.TEXT);
- HashMap<String, Object> map = new HashMap<String, Object>();
- map.put(IMarker.LINE_NUMBER, 3);
- fMarker.setAttributes(map);
- IDE.gotoMarker(editor,fMarker);
-
- } catch (PartInitException e) {
- e.printStackTrace();
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return new Status(IStatus.OK, CTestPlugin.PLUGIN_ID, "");
- }
- };
- ui.schedule();
- }
- }
- }
- }
-}
+/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. and others. + * 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import java.util.HashMap; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.progress.UIJob; + +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.ui.testplugin.CTestPlugin; + + +public class CHOpenListener implements IOpenListener { + + /** On Node click open corresponding file */ + @Override + public void open(OpenEvent event) { + if (event !=null ) { + ISelection selection = event.getSelection(); + if (selection instanceof TreeSelection ) { + TreeSelection treeSelection = (TreeSelection)selection; + Object element = treeSelection.getFirstElement(); + if (element instanceof DslNode) { + DslNode node = (DslNode)element; + ICProject project = node.getProject(); + /** + * Based on a custom algorithm the corresponding file and line should be found and open. Suppose that the file + * 'CallHierarchy_test.java' has been found, and the line number '3' where the function 'function_dsl' is defined. + */ + IFile file = project.getProject().getFile("CallHierarchy_test.java"); + IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getPage(); + IEditorInput input = new FileEditorInput(file); + IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName()); + + UIJob ui = new UIJob("Open File") { + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + try { + String editorId = null; + if (desc == null || desc.isOpenExternal()) { + editorId = "org.eclipse.ui.DefaultTextEditor"; + } else { + editorId = desc.getId(); + } + IEditorPart editor = page.openEditor(input, editorId); + IMarker fMarker = file.createMarker(IMarker.TEXT); + HashMap<String, Object> map = new HashMap<String, Object>(); + map.put(IMarker.LINE_NUMBER, 3); + fMarker.setAttributes(map); + IDE.gotoMarker(editor,fMarker); + + } catch (PartInitException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } + return new Status(IStatus.OK, CTestPlugin.PLUGIN_ID, ""); + } + }; + ui.schedule(); + } + } + } + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java index 9da5175c153..7515fb44b35 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java @@ -1,76 +1,76 @@ -/*******************************************************************************
- * Copyright (c) 2018 Wind River Systems, Inc. and others.
- * 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:
- * Lidia Popescu - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.callhierarchy.extension;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.ui.ICHENode;
-
-
-/**
- * The dsl node sample
- * */
-public class DslNode implements IAdaptable, ICHENode {
-
- private ICElement fRepresentedDecl;
- private ICProject mProject;
- private String mDslNodeName;
-
- /**
- * Constructor used for Open Call Hierarchy command
- * */
- public DslNode(ICElement decl) {
- this.fRepresentedDecl = decl;
- }
-
- /**
- * Constructor used for Open Dsl declaration command
- * */
- public DslNode() {
-
- }
-
- public ICProject getProject() {
- return mProject;
- }
-
-
- public void setProject(ICProject mProject) {
- this.mProject = mProject;
- }
-
- @Override
- public ICElement getRepresentedDeclaration() {
- return fRepresentedDecl;
- }
-
-
- @Override
- public <T> T getAdapter(Class<T> adapterClass) {
- if (adapterClass == ICElement.class) {
- return (T)getRepresentedDeclaration();
- }
- return null;
- }
-
- /**
- * Should be displayed with an indication that this is the dsl,
- * e.g. "Java function <function_name>".
- * */
- public String getDslNodeName() {
- if ( mDslNodeName == null ) {
- mDslNodeName = "JAVA function " + fRepresentedDecl.getElementName()+"()";
- }
- return mDslNodeName;
- }
-}
+/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. and others. + * 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.core.runtime.IAdaptable; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.ui.ICHENode; + + +/** + * The dsl node sample + * */ +public class DslNode implements IAdaptable, ICHENode { + + private ICElement fRepresentedDecl; + private ICProject mProject; + private String mDslNodeName; + + /** + * Constructor used for Open Call Hierarchy command + * */ + public DslNode(ICElement decl) { + this.fRepresentedDecl = decl; + } + + /** + * Constructor used for Open Dsl declaration command + * */ + public DslNode() { + + } + + public ICProject getProject() { + return mProject; + } + + + public void setProject(ICProject mProject) { + this.mProject = mProject; + } + + @Override + public ICElement getRepresentedDeclaration() { + return fRepresentedDecl; + } + + + @Override + public <T> T getAdapter(Class<T> adapterClass) { + if (adapterClass == ICElement.class) { + return (T)getRepresentedDeclaration(); + } + return null; + } + + /** + * Should be displayed with an indication that this is the dsl, + * e.g. "Java function <function_name>". + * */ + public String getDslNodeName() { + if ( mDslNodeName == null ) { + mDslNodeName = "JAVA function " + fRepresentedDecl.getElementName()+"()"; + } + return mDslNodeName; + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java index 6edae0b2ce6..47545979aad 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java @@ -1,223 +1,223 @@ -/*******************************************************************************
- * Copyright (c) 2012, 2014 Marc-Andre Laperle and others. 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:
- * Marc-Andre Laperle - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.ui.tests.text.contentassist2;
-
-import junit.framework.Test;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
-
-import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
-import org.eclipse.cdt.ui.CUIPlugin;
-
-import org.eclipse.cdt.internal.corext.template.c.CContextType;
-
-
-public class TemplateProposalTest extends AbstractContentAssistTest {
-
- public TemplateProposalTest(String name) {
- super(name, true);
- }
-
- public TemplateProposalTest(String name, boolean isCpp) {
- super(name, isCpp);
- }
-
- public static Test suite() {
- return BaseTestCase.suite(TemplateProposalTest.class, "_");
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- // Remove all the default templates. Tests will add templates as necessary.
- TemplateStore templateStore = CUIPlugin.getDefault().getTemplateStore();
- TemplatePersistenceData[] templateData = templateStore.getTemplateData(false);
- for (TemplatePersistenceData templatePersistenceData : templateData) {
- templateStore.delete(templatePersistenceData);
- }
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
-
- // Restore the default templates
- CUIPlugin.getDefault().getTemplateStore().restoreDefaults();
- }
-
- private static final String HEADER_FILE_NAME = "CompletionTest.h";
- private static final String SOURCE_FILE_NAME = "CompletionTest.cpp";
- private static final String SELECTION_START_TAG = "/*sel-start*/";
- private static final String SELECTION_END_TAG = "/*sel-end*/";
-
- private static final String TEMPLATE_NAME_WORD_SELECTION = "word selection template";
- private static final String TEMPLATE_NAME_WORD_SELECTION_DISP = TEMPLATE_NAME_WORD_SELECTION + " - ";
- private static final String TEMPLATE_NAME_LINE_SELECTION = "line selection template";
- private static final String TEMPLATE_NAME_LINE_SELECTION_DISP = TEMPLATE_NAME_LINE_SELECTION + " - ";
-
- protected int fSelectionOffset;
- protected int fSelectionLength;
- private IProject fProject;
-
- @Override
- protected IFile setUpProjectContent(IProject project) throws Exception {
- fProject= project;
- StringBuilder sourceContent= getContentsForTest(1)[0];
- fSelectionOffset= sourceContent.indexOf(SELECTION_START_TAG);
- assertTrue("No selection start specified", fSelectionOffset >= 0);
- sourceContent.delete(fSelectionOffset, fSelectionOffset + SELECTION_START_TAG.length());
- int selEndOffset = sourceContent.indexOf(SELECTION_END_TAG);
-
- if (selEndOffset >= 0) {
- sourceContent.delete(selEndOffset, selEndOffset + SELECTION_END_TAG.length());
- fSelectionLength = selEndOffset - fSelectionOffset;
- } else {
- fSelectionLength = 0;
- }
-
- return createFile(project, SOURCE_FILE_NAME, sourceContent.toString());
- }
-
- private void addWordSelectionTemplate() {
- Template newTemplate = new Template(TEMPLATE_NAME_WORD_SELECTION, "", CContextType.ID, "cout << ${word_selection};", true);
- TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true);
- CUIPlugin.getDefault().getTemplateStore().add(data);
- }
-
- private void addLineSelectionTemplate() {
- Template newTemplate = new Template(TEMPLATE_NAME_LINE_SELECTION, "", CContextType.ID, "cout << ${line_selection};", true);
- TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true);
- CUIPlugin.getDefault().getTemplateStore().add(data);
- }
-
- protected static final int DEFAULT_FLAGS = AbstractContentAssistTest.DEFAULT_FLAGS | IS_COMPLETION | IS_TEMPLATE;
-
- protected void assertCompletionResults(String[] expected) throws Exception {
- assertContentAssistResults(fSelectionOffset, fSelectionLength, expected, DEFAULT_FLAGS, CompareType.ID);
- }
-
- //void func() {
- ///*sel-start*/test foo bar/*sel-end*/
- //}
- public void testFullLineSelection() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_LINE_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- ///*sel-start*/test foo bar
- //test foo bar/*sel-end*/
- //}
- public void testMultiLineSelection() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_LINE_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- //foo /*sel-start*/test/*sel-end*/
- //}
- public void testWordSelection() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_WORD_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- //foo/*sel-start*/test/*sel-end*/
- //}
- public void testPartialLineWordSelection() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_WORD_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- //test foo/*sel-start*/bar
- //test foo /*sel-end*/bar
- //}
- public void testWordSelectionOverMultiLine() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_WORD_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- // /*sel-start*/test/*sel-end*/
- //}
- public void testBug298554_lineSelectedWithoutWhitespaces() throws Exception {
- addLineSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_LINE_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- // /*sel-start*/test foo bar
- //test foo bar/*sel-end*/
- //}
- public void testBug298554_multiLineSelectedWithoutWhitespaces() throws Exception {
- addWordSelectionTemplate();
- addLineSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_LINE_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- // /*sel-start*/test/*sel-end*/
- //}
- public void testBug304482_onlyWordOnLine() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_LINE_SELECTION_DISP,
- TEMPLATE_NAME_WORD_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
- //void func() {
- ///*sel-start*/test/*sel-end*/
- //}
- public void testBug304482_onlyWordOnLineStartOfLine() throws Exception {
- addLineSelectionTemplate();
- addWordSelectionTemplate();
- final String[] expected= {
- TEMPLATE_NAME_LINE_SELECTION_DISP,
- TEMPLATE_NAME_WORD_SELECTION_DISP
- };
- assertCompletionResults(expected);
- }
-
-}
+/******************************************************************************* + * Copyright (c) 2012, 2014 Marc-Andre Laperle and others. 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: + * Marc-Andre Laperle - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + +import junit.framework.Test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.text.templates.Template; +import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; +import org.eclipse.jface.text.templates.persistence.TemplateStore; + +import org.eclipse.cdt.core.testplugin.util.BaseTestCase; +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.corext.template.c.CContextType; + + +public class TemplateProposalTest extends AbstractContentAssistTest { + + public TemplateProposalTest(String name) { + super(name, true); + } + + public TemplateProposalTest(String name, boolean isCpp) { + super(name, isCpp); + } + + public static Test suite() { + return BaseTestCase.suite(TemplateProposalTest.class, "_"); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + // Remove all the default templates. Tests will add templates as necessary. + TemplateStore templateStore = CUIPlugin.getDefault().getTemplateStore(); + TemplatePersistenceData[] templateData = templateStore.getTemplateData(false); + for (TemplatePersistenceData templatePersistenceData : templateData) { + templateStore.delete(templatePersistenceData); + } + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + + // Restore the default templates + CUIPlugin.getDefault().getTemplateStore().restoreDefaults(); + } + + private static final String HEADER_FILE_NAME = "CompletionTest.h"; + private static final String SOURCE_FILE_NAME = "CompletionTest.cpp"; + private static final String SELECTION_START_TAG = "/*sel-start*/"; + private static final String SELECTION_END_TAG = "/*sel-end*/"; + + private static final String TEMPLATE_NAME_WORD_SELECTION = "word selection template"; + private static final String TEMPLATE_NAME_WORD_SELECTION_DISP = TEMPLATE_NAME_WORD_SELECTION + " - "; + private static final String TEMPLATE_NAME_LINE_SELECTION = "line selection template"; + private static final String TEMPLATE_NAME_LINE_SELECTION_DISP = TEMPLATE_NAME_LINE_SELECTION + " - "; + + protected int fSelectionOffset; + protected int fSelectionLength; + private IProject fProject; + + @Override + protected IFile setUpProjectContent(IProject project) throws Exception { + fProject= project; + StringBuilder sourceContent= getContentsForTest(1)[0]; + fSelectionOffset= sourceContent.indexOf(SELECTION_START_TAG); + assertTrue("No selection start specified", fSelectionOffset >= 0); + sourceContent.delete(fSelectionOffset, fSelectionOffset + SELECTION_START_TAG.length()); + int selEndOffset = sourceContent.indexOf(SELECTION_END_TAG); + + if (selEndOffset >= 0) { + sourceContent.delete(selEndOffset, selEndOffset + SELECTION_END_TAG.length()); + fSelectionLength = selEndOffset - fSelectionOffset; + } else { + fSelectionLength = 0; + } + + return createFile(project, SOURCE_FILE_NAME, sourceContent.toString()); + } + + private void addWordSelectionTemplate() { + Template newTemplate = new Template(TEMPLATE_NAME_WORD_SELECTION, "", CContextType.ID, "cout << ${word_selection};", true); + TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true); + CUIPlugin.getDefault().getTemplateStore().add(data); + } + + private void addLineSelectionTemplate() { + Template newTemplate = new Template(TEMPLATE_NAME_LINE_SELECTION, "", CContextType.ID, "cout << ${line_selection};", true); + TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true); + CUIPlugin.getDefault().getTemplateStore().add(data); + } + + protected static final int DEFAULT_FLAGS = AbstractContentAssistTest.DEFAULT_FLAGS | IS_COMPLETION | IS_TEMPLATE; + + protected void assertCompletionResults(String[] expected) throws Exception { + assertContentAssistResults(fSelectionOffset, fSelectionLength, expected, DEFAULT_FLAGS, CompareType.ID); + } + + //void func() { + ///*sel-start*/test foo bar/*sel-end*/ + //} + public void testFullLineSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + ///*sel-start*/test foo bar + //test foo bar/*sel-end*/ + //} + public void testMultiLineSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + //foo /*sel-start*/test/*sel-end*/ + //} + public void testWordSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + //foo/*sel-start*/test/*sel-end*/ + //} + public void testPartialLineWordSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + //test foo/*sel-start*/bar + //test foo /*sel-end*/bar + //} + public void testWordSelectionOverMultiLine() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + // /*sel-start*/test/*sel-end*/ + //} + public void testBug298554_lineSelectedWithoutWhitespaces() throws Exception { + addLineSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + // /*sel-start*/test foo bar + //test foo bar/*sel-end*/ + //} + public void testBug298554_multiLineSelectedWithoutWhitespaces() throws Exception { + addWordSelectionTemplate(); + addLineSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + // /*sel-start*/test/*sel-end*/ + //} + public void testBug304482_onlyWordOnLine() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP, + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + ///*sel-start*/test/*sel-end*/ + //} + public void testBug304482_onlyWordOnLineStartOfLine() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP, + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + +} |