Search in sources :

Example 6 with CSSEditorView

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);
}
Also used : CSSEditorView(org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView) IPage(org.eclipse.ui.part.IPage) IFile(org.eclipse.core.resources.IFile) CSSPropertyPage(org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor)

Example 7 with CSSEditorView

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);
}
Also used : CSSEditorView(org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView) IFile(org.eclipse.core.resources.IFile) CSSRule(org.w3c.dom.css.CSSRule) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) CSSStructuredDocumentRegionContainer(org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer) ICSSModel(org.eclipse.wst.css.core.internal.provisional.document.ICSSModel) Tree(org.eclipse.swt.widgets.Tree) ICSSStyleSheet(org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor)

Example 8 with CSSEditorView

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);
    }
}
Also used : CSSEditorView(org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView) IFile(org.eclipse.core.resources.IFile) CSSRule(org.w3c.dom.css.CSSRule) CSSStructuredDocumentRegionContainer(org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer) ICSSModel(org.eclipse.wst.css.core.internal.provisional.document.ICSSModel) TabbedPropertyRegistry(org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistry) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) TabbedPropertySheetPage(org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) Method(java.lang.reflect.Method) ICSSStyleSheet(org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor) ITabDescriptor(org.eclipse.ui.views.properties.tabbed.ITabDescriptor) CSSPropertyPage(org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage) TabbedPropertyViewer(org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer)

Example 9 with CSSEditorView

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));
}
Also used : CSSEditorView(org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView) IPage(org.eclipse.ui.part.IPage) IFile(org.eclipse.core.resources.IFile) CSSPropertyPage(org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor)

Aggregations

IFile (org.eclipse.core.resources.IFile)9 StructuredTextEditor (org.eclipse.wst.sse.ui.StructuredTextEditor)9 CSSEditorView (org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView)9 CSSStructuredDocumentRegionContainer (org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer)4 ICSSModel (org.eclipse.wst.css.core.internal.provisional.document.ICSSModel)4 ICSSStyleSheet (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet)4 CSSPropertyPage (org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage)4 CSSRule (org.w3c.dom.css.CSSRule)4 IPage (org.eclipse.ui.part.IPage)3 StyleContainer (org.jboss.tools.jst.web.ui.internal.css.common.StyleContainer)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)2 IDOMDocument (org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument)2 IDOMElement (org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)2 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)2 Element (org.w3c.dom.Element)2 Method (java.lang.reflect.Method)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 Tree (org.eclipse.swt.widgets.Tree)1 TabbedPropertyRegistry (org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistry)1 TabbedPropertyViewer (org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer)1