Search in sources :

Example 1 with CSSPropertyPage

use of org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage in project jbosstools-jst by jbosstools.

the class InputFractionalValueTest_JBIDE4790 method testInputFractionalValue.

public void testInputFractionalValue() throws CoreException {
    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);
    CSSStyleDeclaration declaration = ((CSSStyleRule) cssRule).getStyle();
    String testedValue = declaration.getPropertyValue(TEST_CSS_ATTRIBUTE_NAME);
    assertNotNull(testedValue);
    StyleAttributes styleAttributes = page.getStyleAttributes();
    assertEquals(testedValue, styleAttributes.get(TEST_CSS_ATTRIBUTE_NAME));
    String[] parsedTestValue = Util.convertExtString(testedValue);
    assertEquals(parsedTestValue.length, 2);
    // $NON-NLS-1$
    String newTestedValue = removeWhitespaces(parsedTestValue[0]) + "3" + parsedTestValue[1];
    try {
        styleAttributes.put(TEST_CSS_ATTRIBUTE_NAME, newTestedValue);
    } catch (DOMException e) {
        // $NON-NLS-1$
        fail("Changing of attribute's value leads to DOMException. Probably it is problem concerned with of JBIDE-4790 ");
    }
    testedValue = declaration.getPropertyValue(TEST_CSS_ATTRIBUTE_NAME);
    assertNotNull(testedValue);
    assertEquals(removeWhitespaces(testedValue), removeWhitespaces(newTestedValue));
}
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) ICSSStyleSheet(org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet) CSSStyleDeclaration(org.w3c.dom.css.CSSStyleDeclaration) StructuredTextEditor(org.eclipse.wst.sse.ui.StructuredTextEditor) DOMException(org.w3c.dom.DOMException) StyleAttributes(org.jboss.tools.jst.web.ui.internal.css.dialog.common.StyleAttributes) CSSPropertyPage(org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage) CSSStyleRule(org.w3c.dom.css.CSSStyleRule)

Example 2 with CSSPropertyPage

use of org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage in project jbosstools-jst by jbosstools.

the class AbstractCSSViewTest method getSelectedObject.

protected Object getSelectedObject(CSSEditorView view) throws SecurityException, IllegalArgumentException, NoSuchFieldException, IllegalAccessException {
    CSSPropertyPage page = (CSSPropertyPage) view.getCurrentPage();
    assertNotNull(page);
    return getFieldValue(page, CSS_PREVIEW_SELECTED_OBJECT);
}
Also used : CSSPropertyPage(org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage)

Example 3 with CSSPropertyPage

use of org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage 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 4 with CSSPropertyPage

use of org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage 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 5 with CSSPropertyPage

use of org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage 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

CSSPropertyPage (org.jboss.tools.jst.web.ui.internal.css.properties.CSSPropertyPage)6 IFile (org.eclipse.core.resources.IFile)4 StructuredTextEditor (org.eclipse.wst.sse.ui.StructuredTextEditor)4 CSSEditorView (org.jboss.tools.jst.web.ui.internal.css.view.CSSEditorView)4 IPage (org.eclipse.ui.part.IPage)2 CSSStructuredDocumentRegionContainer (org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer)2 ICSSModel (org.eclipse.wst.css.core.internal.provisional.document.ICSSModel)2 ICSSStyleSheet (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet)2 CSSRule (org.w3c.dom.css.CSSRule)2 Method (java.lang.reflect.Method)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 TabbedPropertyRegistry (org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyRegistry)1 TabbedPropertyViewer (org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer)1 IPropertySheetPage (org.eclipse.ui.views.properties.IPropertySheetPage)1 ITabDescriptor (org.eclipse.ui.views.properties.tabbed.ITabDescriptor)1 ITabbedPropertySheetPageContributor (org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor)1 TabbedPropertySheetPage (org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)1 StyleAttributes (org.jboss.tools.jst.web.ui.internal.css.dialog.common.StyleAttributes)1 DOMException (org.w3c.dom.DOMException)1