use of org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView in project jbosstools-jst by jbosstools.
the class IncorrectPageAfterSelectionTest_JBIDE4849 method testIncorrectPageAfterSelection.
public void testIncorrectPageAfterSelection() throws CoreException, SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
IFile pageFile = getComponentPath(TEST_PAGE_NAME, getProjectName());
assertNotNull(pageFile);
StructuredTextEditor editor = (StructuredTextEditor) openEditor(pageFile, CSS_EDITOR_ID);
JobUtils.waitForIdle();
assertNotNull(editor);
CSSEditorView view = (CSSEditorView) openView(CSS_EDITOR_VIEW);
assertNotNull(view);
IPage page = view.getDefaultPage();
assertNotNull(page);
assertTrue(page instanceof CSSPropertyPage);
}
use of org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView in project jbosstools-jst by jbosstools.
the class SelectionLosingByPropertySheet_JBIDE4791 method testSelectionLosingByPropertySheet.
public void testSelectionLosingByPropertySheet() throws CoreException, SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
IFile pageFile = getComponentPath(TEST_PAGE_NAME, getProjectName());
assertNotNull(pageFile);
PropertySheet propertySheet = (PropertySheet) openView(PROPERTY_SHEET_VIEW_ID);
assertNotNull(propertySheet);
StructuredTextEditor editor = (StructuredTextEditor) openEditor(pageFile, CSS_EDITOR_ID);
assertNotNull(editor);
ICSSModel model = (ICSSModel) getStructuredModel(pageFile);
assertNotNull(model);
ICSSStyleSheet document = (ICSSStyleSheet) model.getDocument();
assertNotNull(document);
CSSRule cssRule = document.getCssRules().item(0);
assertNotNull(cssRule);
int cssRuleOffset = ((CSSStructuredDocumentRegionContainer) cssRule).getStartOffset();
setSelection(editor, cssRuleOffset, 0);
Tree propertySheetTree = (Tree) propertySheet.getCurrentPage().getControl();
String colorValue = getPropertyValue(propertySheetTree.getItems(), FIRST_CSS_PROPERTY_NAME);
assertEquals(FIRST_CSS_PROPERTY_VALUE, colorValue);
CSSEditorView view = (CSSEditorView) openView(CSS_EDITOR_VIEW);
int counter = 10;
do {
JobUtils.delay(2000);
propertySheetTree = (Tree) propertySheet.getCurrentPage().getControl();
colorValue = getPropertyValue(propertySheetTree.getItems(), FIRST_CSS_PROPERTY_NAME);
counter--;
} while (colorValue == null && counter > 0);
// if after 20s it is still null - fail
assertEquals(FIRST_CSS_PROPERTY_VALUE, colorValue);
}
use of org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView in project jbosstools-jst by jbosstools.
the class CSSViewTest method testEditorViewTabs.
public void testEditorViewTabs() throws CoreException, SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
IFile pageFile = getComponentPath(TEST_PAGE_NAME, getProjectName());
assertNotNull(pageFile);
StructuredTextEditor editor = (StructuredTextEditor) openEditor(pageFile, CSS_EDITOR_ID);
assertNotNull(editor);
CSSEditorView view = (CSSEditorView) openView(CSS_EDITOR_VIEW);
assertNotNull(view);
CSSPropertyPage page = (CSSPropertyPage) view.getCurrentPage();
assertNotNull(page);
ICSSModel model = (ICSSModel) getStructuredModel(pageFile);
assertNotNull(model);
ICSSStyleSheet document = (ICSSStyleSheet) model.getDocument();
assertNotNull(document);
CSSRule cssRule = document.getCssRules().item(0);
assertNotNull(cssRule);
int offset = ((CSSStructuredDocumentRegionContainer) cssRule).getStartOffset();
setSelection(editor, offset, 0);
TabbedPropertyRegistry registry = (TabbedPropertyRegistry) getFieldValue(page, TabbedPropertySheetPage.class, // $NON-NLS-1$
"registry");
ITabDescriptor[] descriptors = (ITabDescriptor[]) getFieldValue(registry, // $NON-NLS-1$
"tabDescriptors");
TabbedPropertyViewer tabbedPropertyViewer = (TabbedPropertyViewer) getFieldValue(page, TabbedPropertySheetPage.class, // $NON-NLS-1$
"tabbedPropertyViewer");
Method method = Viewer.class.getDeclaredMethod("fireSelectionChanged", SelectionChangedEvent.class);
method.setAccessible(true);
for (int i = 0; i < descriptors.length; i++) {
method.invoke(tabbedPropertyViewer, new SelectionChangedEvent(tabbedPropertyViewer, new StructuredSelection(descriptors[i])));
JobUtils.delay(2000);
}
}
use of org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView in project jbosstools-jst by jbosstools.
the class CaseSensitiveTest_JBIDE4940 method testCaseSensitive.
public void testCaseSensitive() throws CoreException, SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
IFile pageFile = getComponentPath(TEST_PAGE_NAME, getProjectName());
assertNotNull(pageFile);
StructuredTextEditor editor = (StructuredTextEditor) openEditor(pageFile, CSS_EDITOR_ID);
JobUtils.waitForIdle();
assertNotNull(editor);
CSSEditorView view = (CSSEditorView) openView(CSS_EDITOR_VIEW);
assertNotNull(view);
IPage page = view.getCurrentPage();
assertNotNull(page);
assertTrue(page instanceof CSSPropertyPage);
assertNotNull(((CSSPropertyPage) page).getStyleAttributes().get(TESTED_ATTRIBUTE));
}
Aggregations