Author: mareshkau
Date: 2010-12-07 05:41:14 -0500 (Tue, 07 Dec 2010)
New Revision: 27207
Added:
trunk/jst/plugins/org.jboss.tools.jst.css/images/
trunk/jst/plugins/org.jboss.tools.jst.css/images/cssdialog/
trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/
trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/new_css_class.gif
trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/new_css_file.gif
trunk/jst/plugins/org.jboss.tools.jst.css/resources/cssdialog/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CSSPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/AbstractCSSDialog.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSClassDialog.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSStyleDialog.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/FontFamilyDialog.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/ImageSelectionDialog.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/OpenCSSDialogActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/StyleComposite.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/builder/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/builder/CSSDialogBuilder.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPartComposite.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPreview.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSStyleClassSelector.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/jsp/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/jsp/outline/
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/web/
trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/cssDialog.exsd
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/AbstractCSSStyleDecorator.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSDialogBuilderInterface.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorDecorator.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorInterface.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogDecorator.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogInterface.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/Constants.java
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CSSStyleDialogTest.java
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CssClassNewWizardTest.java
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CSSStyleDialogTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/Constants.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog/
trunk/jst/plugins/org.jboss.tools.jst.jsp/resources/cssdialog/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/FontFamilyDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/OpenCSSDialogActionDelegate.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/
trunk/jst/plugins/org.jboss.tools.jst.web.ui/images/xstudio/wizards/new_css_class.gif
trunk/jst/plugins/org.jboss.tools.jst.web.ui/images/xstudio/wizards/new_css_file.gif
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
trunk/jst/plugins/org.jboss.tools.jst.css/.classpath
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs
trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.css/build.properties
trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleAttribyteContainer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSConstants.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSModel.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSSelectorValidator.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSStyleValueValidator.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSValidator.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/FileExtensionFilter.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/ICSSDialogModel.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/StyleAttributes.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/Util.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/BaseListener.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/CSSParser.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTableDragAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTableDropAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTreeDragAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSContainer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSJSPRecognizer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSRuleContainer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorTableModel.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorTreeModel.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorUtils.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSStyleSheetContainer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSTreeNode.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSClassSelectionChangedEvent.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSSelectionEventManager.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSTableSelectionChangedEvent.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSTreeSelectionChangedEvent.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/ICSSClassSelectionChangedListener.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorFilter.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTableContentProvider.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTableViewer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeContentProvider.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeLabelProvider.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeViewer.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/BaseTabControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/ICSSTabControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabBackgroundControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabBoxesControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabPreviewControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabPropertySheetControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabQuickEditControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabTextControl.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSTreeItemWidgetValueProperty.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSWidget.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSWidgetValueProperty.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/ImageCombo.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/SizeCombo.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/SizeText.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCSSSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/MessageCSSSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/NewCSSClassWizard.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/WizardNewCssClassPage.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogContentProposalProvider.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties
trunk/jst/tests/org.jboss.tools.jst.css.test/.classpath
trunk/jst/tests/org.jboss.tools.jst.css.test/.settings/org.eclipse.jdt.core.prefs
trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java
trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java
Log:
https://jira.jboss.org/browse/JBIDE-7740, code refactoring moving css functionality into
org.jboss.tools.css plugin
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesAbstractInplaceTemplate.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -16,7 +16,7 @@
import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.template.util.RichFaces;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CSSStyleDialogTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CSSStyleDialogTest.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CSSStyleDialogTest.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jsf.ui.test;
-
-import junit.framework.TestCase;
-
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSStyleDialog;
-import org.jboss.tools.test.util.WorkbenchUtils;
-
-/**
- * @author Sergey Dzmitrovich
- *
- */
-public class CSSStyleDialogTest extends TestCase {
-
- private static String CSS_STYLE = "color:red;size:10px;"; //$NON-NLS-1$
-
- public void testStyleDialog() {
- CSSStyleDialog dialog = null;
- try {
- dialog = new CSSStyleDialog(WorkbenchUtils
- .getActiveShell(), CSS_STYLE);
- dialog.setBlockOnOpen(false);
- dialog.open();
- } finally {
- if(dialog !=null) {
- dialog.close();
- }
- }
- }
-}
Deleted:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,146 +0,0 @@
-package org.jboss.tools.jsf.ui.test;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchWizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.test.util.WorkbenchUtils;
-
-
-public class CssClassNewWizardTest extends WizardTest {
-
-
- private static String CSS_FILE_PATH="WebContent/pages/main.css";
//$NON-NLS-1$
-
- public CssClassNewWizardTest(){
- super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard");
//$NON-NLS-1$
- }
-
- public void testCssClassNewWizardTestIsCreated() {
- wizardIsCreated();
- }
-
- public void testCssClassNewWizardValidation() {
- wizard = getWizard();
-
- boolean canFinish = wizard.canFinish();
-
- assertFalse("Finish button is enabled at first wizard page.", canFinish);
//$NON-NLS-1$
- }
-
- public void testCssClassNewWizardValidation2() {
- wizard = getWizardOnProject();
-
- boolean canFinish = wizard.canFinish();
-
- // Assert Finish button is enabled by default if wizard is called on Project
- assertFalse("Finish button is disabled at first wizard page.", canFinish);
//$NON-NLS-1$
-
- // Assert Finish button is disabled and error is present if
- // Folder field is empty
- // All other fields are correct
-
- // Assert Finish button is disabled and error is present if
- // Folder field points to folder that doesn't exist
- // All other fields are correct
-
- // Assert Finish button is disabled and error is present if
- // Folder field is correct
- // Name field is empty
-
- // Assert Finish button is disabled and error is present if
- // Folder field is correct
- // Name field contains forbidden characters
-
- // Assert Finish button is disabled and error is present if
- // Folder field is correct
- // Name field contains file name that already exists
- }
-
- public void testCssClassEditing() {
- ArrayList<IResource> list = new ArrayList<IResource>();
- IResource cssFile = project.findMember(CSS_FILE_PATH);
- assertNotNull(cssFile);
- list.add(cssFile);
- StructuredSelection selection = new StructuredSelection(list);
- wizard = WorkbenchUtils.findWizardByDefId(id);
-
- ((IWorkbenchWizard) wizard).init(PlatformUI.getWorkbench(), selection);
-
- dialog = new WizardDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), wizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
-
- assertFalse("Finish button is not disabled.", wizard.canFinish());
//$NON-NLS-1$
- assertFalse("Next button is not disabled.",
wizard.getContainer().getCurrentPage().canFlipToNextPage()); //$NON-NLS-1$
-
- try {
-
-
- Field selectFileTextField = wizard.getContainer().getCurrentPage()
- .getClass().getDeclaredField("selectFileText"); //$NON-NLS-1$
- selectFileTextField.setAccessible(true);
- Text selectFileText = (Text) selectFileTextField.get(wizard
- .getContainer().getCurrentPage());
- selectFileText.setText(cssFile.getFullPath().toString());
- Field classNameTextField = wizard.getContainer().getCurrentPage()
- .getClass().getDeclaredField("classNameText"); //$NON-NLS-1$
- classNameTextField.setAccessible(true);
- Text classNameTextText = (Text) classNameTextField.get(wizard
- .getContainer().getCurrentPage());
- classNameTextText.setText("newCSS"); //$NON-NLS-1$
-
-
- } catch (SecurityException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (NoSuchFieldException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- assertTrue("Next button is disabled.",
wizard.getContainer().getCurrentPage().canFlipToNextPage()); //$NON-NLS-1$
- assertFalse("Finish button is not disabled.", wizard.canFinish());
//$NON-NLS-1$
- wizard.getContainer().showPage(wizard.getNextPage(wizard.getContainer().getCurrentPage()));
- assertTrue("Finish button is disabled.", wizard.canFinish()); //$NON-NLS-1$
- }
-
- public void testCssClassWithEditor() {
-
- IResource cssFile = project.findMember(CSS_FILE_PATH);
-
- IEditorPart facesConfigEditor = WorkbenchUtils.openEditor(cssFile
- .getFullPath().toString());
-
- assertTrue(facesConfigEditor instanceof StructuredTextEditor);
-
-// ArrayList<IResource> list = new ArrayList<IResource>();
-
-// assertNotNull(cssFile);
-// list.add(cssFile);
-// StructuredSelection selection = new StructuredSelection(list);
- wizard = WorkbenchUtils.findWizardByDefId(id);
-//
-// ((IWorkbenchWizard) wizard).init(PlatformUI.getWorkbench(), selection);
-
- dialog = new WizardDialog(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), wizard);
- dialog.setBlockOnOpen(false);
- dialog.open();
- }
-
-}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/JsfUiAllTests.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -44,8 +44,6 @@
suite.addTestSuite(CASuggestsNotOnlyELProposalsJBIDE2437Test.class);
suite.addTestSuite(CAUnnecessaryElementsForDirAttributeInXHTMLPageJBIDE1813Test.class);
suite.addTestSuite(CAVarAttributeForDataTableTagJBIDE2016.class);
- suite.addTestSuite(CssClassNewWizardTest.class);
- suite.addTestSuite(CSSStyleDialogTest.class);
suite.addTestSuite(FacesConfigNewWizardTest.class);
suite.addTestSuite(FasesConfigEditorTest.class);
suite.addTestSuite(PropertiesNewWizardTest.class);
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/.classpath
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/.classpath 2010-12-07 09:50:36 UTC (rev
27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/.classpath 2010-12-07 10:41:14 UTC (rev
27207)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/.settings/org.eclipse.jdt.core.prefs 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1 +1,8 @@
-
+#Fri Dec 03 16:30:08 EET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF 2010-12-07 09:50:36 UTC
(rev 27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/META-INF/MANIFEST.MF 2010-12-07 10:41:14 UTC
(rev 27207)
@@ -3,7 +3,7 @@
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.jboss.tools.jst.css;singleton:=true
Bundle-Version: 3.2.0.qualifier
-Bundle-Activator: org.jboss.tools.jst.css.CssPlugin
+Bundle-Activator: org.jboss.tools.jst.css.CSSPlugin
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
@@ -16,11 +16,25 @@
org.eclipse.wst.sse.core,
org.eclipse.jface.text,
org.eclipse.wst.xml.core,
- org.eclipse.wst.sse.ui
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+ org.eclipse.wst.sse.ui,
+ org.jboss.tools.common;bundle-version="3.2.0",
+ org.jboss.tools.common.text.ext;bundle-version="3.2.0",
+ org.eclipse.wst.css.ui;bundle-version="1.0.501",
+ org.jboss.tools.common.model.ui;bundle-version="3.2.0",
+ org.jboss.tools.jst.web.kb;bundle-version="3.2.0",
+ org.jboss.tools.common.el.core;bundle-version="3.2.0",
+ org.eclipse.jface.databinding;bundle-version="1.4.0",
+ org.eclipse.core.databinding.property;bundle-version="1.3.0",
+ org.jboss.tools.jst.web;bundle-version="3.2.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.jst.css,
org.jboss.tools.jst.css.common,
+ org.jboss.tools.jst.css.dialog,
+ org.jboss.tools.jst.css.dialog.common,
+ org.jboss.tools.jst.css.dialog.parsers,
+ org.jboss.tools.jst.css.dialog.tabs,
+ org.jboss.tools.jst.css.dialog.widgets,
org.jboss.tools.jst.css.messages,
org.jboss.tools.jst.css.properties,
org.jboss.tools.jst.css.view
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/build.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/build.properties 2010-12-07 09:50:36 UTC
(rev 27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/build.properties 2010-12-07 10:41:14 UTC
(rev 27207)
@@ -1,9 +1,13 @@
-source.. = src/
+source.. = src/,\
+ resources/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
plugin.properties,\
resources/,\
- about.html
+ about.html,\
+ images/
jars.compile.order = .
+src.includes = images/,\
+ resources/
Copied: trunk/jst/plugins/org.jboss.tools.jst.css/images/cssdialog (from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/images/cssdialog)
Added: trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/new_css_class.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/new_css_class.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/new_css_file.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.css/images/wizards/new_css_file.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties 2010-12-07 09:50:36 UTC
(rev 27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/plugin.properties 2010-12-07 10:41:14 UTC
(rev 27207)
@@ -7,4 +7,8 @@
css.tabs.quickEdit.label=Edited Properties
css.editor_name=CSS Properties
css.preview_name=CSS Preview
-css.perspective_name=CSS Editing
\ No newline at end of file
+css.perspective_name=CSS Editing
+NewWizard_CSSFile=CSS File
+NewWizardDescription_CSSFile=Create a CSS File
+NewWizard_CSSClass=CSS Class
+NewWizardDescription_CSSClass=Create a CSS Class
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml 2010-12-07 09:50:36 UTC (rev
27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.css/plugin.xml 2010-12-07 10:41:14 UTC (rev
27207)
@@ -162,4 +162,84 @@
</perspectiveShortcut>
</perspectiveExtension>
</extension>
+ <extension point="org.eclipse.ui.editorActions">
+ <editorContribution
+ id="org.jboss.tools.jst.jsp.cssClassDialogEditorContribution"
+ targetID="org.eclipse.wst.css.core.csssource.source">
+ <menu
+ id="org.jboss.tools.jst.jsp.cssClassDialogSubMenu"
+ label="CSS"
+ path="additions">
+ <groupMarker
+ name="content">
+ </groupMarker>
+ <separator
+ name="additions">
+ </separator>
+ </menu>
+ <action
+
class="org.jboss.tools.jst.css.dialog.OpenCSSDialogActionDelegate"
+ definitionId="org.jboss.tools.jst.jsp.commands.openCSSDialog"
+ hoverIcon="$nl$/images/cssdialog/color_large.gif"
+ icon="$nl$/images/cssdialog/color_large.gif"
+ id="org.jboss.tools.jst.jsp.openCSSDialogEditor"
+ label="Open edit dialog"
+
menubarPath="org.jboss.tools.jst.jsp.cssClassDialogSubMenu/content"
+ style="push"
+ toolbarPath="Normal/additions"
+ tooltip="Open CSS Dialog based on the active CSS file">
+ <!--<selection
+ class="org.eclipse.core.resources.IFile">
+ </selection>-->
+ </action>
+ </editorContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.jboss.tools.jst.jsp.cssDialogPopupMenu"
+ nameFilter="*.css"
+ objectClass="org.eclipse.core.resources.IResource">
+ <action
+
class="org.jboss.tools.jst.css.dialog.OpenCSSDialogActionDelegate"
+ definitionId="org.jboss.tools.jst.jsp.commands.openCSSDialog"
+ icon="$nl$/images/cssdialog/color_large.gif"
+ id="org.jboss.tools.jst.jsp.openCSSDialogPopupMenu"
+ label="Open CSS Dialog"
+ menubarPath="additions"
+ tooltip="Open CSS Dialog based on the active CSS file">
+ </action>
+ <menu
+ id="org.jboss.tools.jst.jsp.popupSubMenu"
+ label="Open CSS Dialog"
+ path="additions">
+ <groupMarker name="content"/>
+ <separator name="additions"/>
+ </menu>
+ </objectContribution>
+ </extension>
+ <extension
+ point="org.jboss.tools.jst.jsp.cssDialog"
id="org.jboss.tools.jst.css.dialog.CSSStyleDialog" >
+ <css-dialogs-builder
+
class="org.jboss.tools.jst.css.dialog.builder.CSSDialogBuilder">
+ </css-dialogs-builder>
+ </extension>
+ <extension point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.jboss.tools.jst.web"
+ class="org.jboss.tools.jst.css.wizard.NewCSSClassWizard"
+
finalPerspective="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
+ icon="$nl$/images/wizards/new_css_class.gif"
+ id="org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard"
+ name="%NewWizard_CSSClass"
+
preferredPerspectives="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
+ project="false">
+ <description>
+ %NewWizardDescription_CSSClass
+ </description>
+ <selection class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ </extension>
</plugin>
Copied: trunk/jst/plugins/org.jboss.tools.jst.css/resources/cssdialog (from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/resources/cssdialog)
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CSSPlugin.java (from
rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CSSPlugin.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CSSPlugin.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class CSSPlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.jst.css";
//$NON-NLS-1$
+
+ // The shared instance
+ private static CSSPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public CSSPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static CSSPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given plug-in
+ * relative path
+ *
+ * @param path
+ * the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ /**
+ *
+ * @param message
+ */
+ public static void log(String message) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, message, null));
+ }
+}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/CssPlugin.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.css;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class CssPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.jst.css";
//$NON-NLS-1$
-
- // The shared instance
- private static CssPlugin plugin;
-
- /**
- * The constructor
- */
- public CssPlugin() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
- * )
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
- * )
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static CssPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given plug-in
- * relative path
- *
- * @param path
- * the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
- /**
- *
- * @param message
- */
- public static void log(String message) {
- getDefault().getLog().log(new Status(IStatus.ERROR, message, null));
- }
-}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleListener.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -27,7 +27,7 @@
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.internal.properties.ConfigurablePropertySheetPage;
-import org.jboss.tools.jst.css.CssPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
@SuppressWarnings("restriction")
public class CSSStyleListener implements ISelectionListener, INodeAdapter,
@@ -116,7 +116,7 @@
try {
l.selectionChanged(part, selectionToLiteners);
} catch (Exception e) {
- CssPlugin.log(e.getLocalizedMessage());
+ CSSPlugin.log(e.getLocalizedMessage());
}
}
@@ -174,7 +174,7 @@
try {
l.styleChanged(currentStyle);
} catch (Exception e) {
- CssPlugin.log(e.getLocalizedMessage());
+ CSSPlugin.log(e.getLocalizedMessage());
}
}
@@ -205,7 +205,7 @@
try {
((IPartListener) l).partActivated(part);
} catch (Exception e) {
- CssPlugin.log(e.getLocalizedMessage());
+ CSSPlugin.log(e.getLocalizedMessage());
}
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -27,9 +27,9 @@
import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleRuleContainer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -17,7 +17,7 @@
import org.eclipse.wst.css.core.internal.provisional.document.ICSSNodeList;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.CSSStyleRule;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleAttribyteContainer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleAttribyteContainer.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/StyleAttribyteContainer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -14,9 +14,9 @@
import java.util.Map;
import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.w3c.dom.Element;
/**
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/AbstractCSSDialog.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/AbstractCSSDialog.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/AbstractCSSDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.dialog;
+
+import java.util.Map;
+
+import org.eclipse.core.databinding.AggregateValidationStatus;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.Browser;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.model.ui.ModelUIImages;
+import org.jboss.tools.common.model.ui.widgets.Split;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.util.Constants;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public abstract class AbstractCSSDialog extends TitleAreaDialog {
+
+ private Browser browser;
+
+ private Text previewText;
+
+ private String previewContent;
+
+ private StyleAttributes styleAttributes;
+
+ private StyleComposite styleComposite;
+
+ private DataBindingContext bindingContext = new DataBindingContext();
+
+ private AggregateValidationStatus aggregateStatus;
+
+ private IStatus status = Status.OK_STATUS;
+
+ final public static int DEFAULT_DIALOG_WIDTH = 500;
+ final public static int DEFAULT_DIALOG_HEIGHT = 500;
+ final public static int DEFAULT_BROWTHER_WEIGHT = 15;
+ final public static int DEFAULT_CONTROLS_WEIGHT = 85;
+
+ /**
+ *
+ */
+ public AbstractCSSDialog(Shell shell) {
+ super(shell);
+
+ previewContent = JstUIMessages.DEFAULT_TEXT_FOR_BROWSER_PREVIEW;
+ styleAttributes = new StyleAttributes();
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ /*
+ * Set the dialog image
+ */
+ setTitleImage(ModelUIImages.getImageDescriptor(
+ ModelUIImages.WIZARD_DEFAULT).createImage());
+
+ Composite parentComposite = (Composite) super.createDialogArea(parent);
+ GridData gridData = (GridData) parentComposite.getLayoutData();
+ gridData.heightHint = DEFAULT_DIALOG_HEIGHT;
+ gridData.widthHint = DEFAULT_DIALOG_WIDTH;
+
+ createControlPane(parentComposite);
+
+ return parentComposite;
+ }
+
+ public Composite createControlPane(Composite parent) {
+
+ getStyleAttributes().addChangeListener(new IChangeListener() {
+
+ public void handleChange(ChangeEvent event) {
+ handleStyleChanged();
+
+ }
+
+ });
+
+ aggregateStatus = new AggregateValidationStatus(
+ getBindingContext().getValidationStatusProviders(),
+ AggregateValidationStatus.MAX_SEVERITY);
+ aggregateStatus.addValueChangeListener(new IValueChangeListener() {
+ public void handleValueChange(ValueChangeEvent event) {
+
+ handleStatusChanged((IStatus) event.diff.getNewValue());
+ }
+ });
+
+ // Create split component that separates dialog on 2 parts
+ Split dialogContainer = new Split(parent, SWT.VERTICAL);
+
+ createBrowserComposite(dialogContainer);
+ createControlComposite(dialogContainer);
+
+ dialogContainer.setWeights(new int[] { DEFAULT_BROWTHER_WEIGHT,
+ DEFAULT_CONTROLS_WEIGHT });
+ dialogContainer.setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, true, true));
+
+ return dialogContainer;
+ }
+
+ protected Composite createControlComposite(Composite parent) {
+
+ // Create down splitter container
+ Composite controlsContainer = new Composite(parent, SWT.None);
+ controlsContainer.setLayout(new GridLayout());
+ controlsContainer.setLayoutData(new GridData(GridData.FILL,
+ GridData.FILL, true, true));
+
+ createExtensionComposite(controlsContainer);
+ styleComposite = createStyleComposite(controlsContainer);
+
+ return controlsContainer;
+
+ }
+
+ protected void createExtensionComposite(Composite parent) {
+
+ }
+
+ /**
+ *
+ * @param parent
+ */
+ protected Composite createBrowserComposite(final Composite parent) {
+
+ final SashForm previewComposite = new SashForm(parent, SWT.None);
+ previewComposite.setLayout(new GridLayout());
+ GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
+ true);
+ previewComposite.setLayoutData(gridData);
+
+ browser = new Browser(previewComposite, SWT.BORDER | SWT.MOZILLA);
+ browser.setText(generateBrowserPage());
+ browser.setLayoutData(gridData);
+ browser.addMouseListener(new MouseAdapter() {
+ public void mouseDoubleClick(MouseEvent e) {
+ if (e.widget == browser) {
+ browser.setEnabled(false);
+ previewComposite.setMaximizedControl(previewText);
+ previewText.setFocus();
+ }
+ }
+ });
+
+ previewText = new Text(previewComposite, SWT.NONE | SWT.H_SCROLL);
+ previewText.setLayoutData(gridData);
+ previewText.setText(getPreviewContent());
+ previewText.addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent e) {
+ if (e.widget == previewText) {
+ String text = previewText.getText();
+ if (text == null || text.equals(Constants.EMPTY)) {
+ setPreviewContent(JstUIMessages.DEFAULT_TEXT_FOR_BROWSER_PREVIEW);
+ } else {
+ setPreviewContent(text);
+ }
+
+ browser.setEnabled(true);
+ browser.setText(generateBrowserPage());
+ previewComposite.setMaximizedControl(browser);
+ }
+ }
+ });
+
+ previewComposite.setMaximizedControl(browser);
+ return previewComposite;
+ }
+
+ protected StyleComposite createStyleComposite(Composite parent) {
+ return new StyleComposite(parent, getStyleAttributes(),
+ getBindingContext());
+ }
+
+ protected void handleStyleChanged() {
+ browser.setText(generateBrowserPage());
+ }
+
+ protected void handleStatusChanged(IStatus newStatus) {
+ if (newStatus.isOK() && !status.isOK()) {
+ setErrorMessage(null);
+ } else if (newStatus.getSeverity() == IStatus.ERROR) {
+ setErrorMessage(newStatus.getMessage());
+ }
+ if (newStatus.getSeverity() != status.getSeverity()) {
+ getButton(OK).setEnabled(newStatus.isOK());
+ }
+
+ status = newStatus;
+ }
+
+ public IStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * /** Method is used to build html body that is appropriate to browse.
+ *
+ * @return String html text representation
+ */
+ public String generateBrowserPage() {
+ StringBuffer html = new StringBuffer("<style>span{"); //$NON-NLS-1$
+
+ for (Map.Entry<String, String> styleItem : getStyleAttributes()
+ .entrySet()) {
+
+ html.append(styleItem.getKey() + Constants.COLON
+ + styleItem.getValue() + Constants.SEMICOLON);
+ }
+
+ html.append("}</style><span>" + getPreviewContent() +
"</span>"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return html.toString();
+ }
+
+ public void releaseResources() {
+ aggregateStatus.dispose();
+ }
+
+ @Override
+ public boolean close() {
+ releaseResources();
+ return super.close();
+ }
+
+ public Browser getBrowser() {
+ return browser;
+ }
+
+ public StyleAttributes getStyleAttributes() {
+ return styleAttributes;
+ }
+
+ public String getPreviewContent() {
+ return previewContent;
+ }
+
+ public void setPreviewContent(String previewContent) {
+ this.previewContent = previewContent;
+ }
+
+ public DataBindingContext getBindingContext() {
+ return bindingContext;
+ }
+
+ public StyleComposite getStyleComposite() {
+ return styleComposite;
+ }
+
+ public void setStatus(IStatus status) {
+ this.status = status;
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSClassDialog.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSClassDialog.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSClassDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,401 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.jst.css.dialog.common.CSSModel;
+import org.jboss.tools.jst.css.dialog.common.CSSSelectorValidator;
+import org.jboss.tools.jst.css.dialog.common.ICSSDialogModel;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.css.dialog.tabs.TabPreviewControl;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+
+/**
+ * This dialog represents CSSClass dialog.
+ *
+ * @author Igor Zhukov (izhukov(a)exadel.com)
+ */
+public class CSSClassDialog extends AbstractCSSDialog {
+
+ // model is the core of the CSS Class Dialog, it manages style attributes
+ private ICSSDialogModel cssModel;
+
+ // workbench selection when the wizard was started
+ protected IStructuredSelection selection;
+
+ private IFile file;
+
+ private Text fileText;
+
+ // css style classes
+ private Combo classCombo;
+
+ private String selectorLabel;
+
+ private Button addNewClassButton;
+
+ // apply button
+ private Button applyButton;
+
+ // preview tab
+ private TabPreviewControl preview;
+
+ /**
+ *
+ * @param parentShell
+ * @param file
+ * @param selection
+ */
+ public CSSClassDialog(Shell parentShell, IFile file,
+ IStructuredSelection selection) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
+ | SWT.APPLICATION_MODAL);
+
+ this.file = file;
+ this.cssModel = new CSSModel(file);
+ this.selection = selection;
+
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(JstUIMessages.CSS_STYLE_CLASS_EDITOR_TITLE);
+
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Control contents = super.createContents(parent);
+ updateControlPane();
+ return contents;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ setTitle(JstUIMessages.CSS_STYLE_CLASS_EDITOR_TITLE);
+ return super.createDialogArea(parent);
+ }
+
+ @Override
+ protected StyleComposite createStyleComposite(Composite parent) {
+ StyleComposite styleComposite = super.createStyleComposite(parent);
+
+ // add preview tab to styleComposite
+ preview = new TabPreviewControl(styleComposite.getTabFolder(),
+ getStyleAttributes(), cssModel);
+ styleComposite.createTabItem(preview, preview,
+ JstUIMessages.PREVIEW_SHEET_TAB_NAME,
+ JstUIMessages.PREVIEW_SHEET_TAB_NAME);
+
+ return styleComposite;
+ }
+
+ @Override
+ protected void createExtensionComposite(final Composite parent) {
+ Composite fileControlPanel = new Composite(parent, SWT.BORDER);
+ fileControlPanel.setLayoutData(new GridData(GridData.FILL,
+ GridData.BEGINNING, true, false));
+ fileControlPanel.setLayout(new GridLayout(3, false));
+
+ // add file path control
+ addLabel(fileControlPanel, JstUIMessages.CSS_CLASS_DIALOG_FILE_LABEL);
+
+ GridData fileLayoutData = new GridData(GridData.FILL, GridData.CENTER,
+ true, false);
+ fileLayoutData.horizontalSpan = 2;
+
+ fileText = new Text(fileControlPanel, SWT.BORDER | SWT.READ_ONLY);
+ fileText.setLayoutData(fileLayoutData);
+
+ // add class control
+ addLabel(fileControlPanel,
+ JstUIMessages.CSS_CLASS_DIALOG_STYLE_CLASS_LABEL);
+
+ classCombo = new Combo(fileControlPanel, SWT.BORDER | SWT.READ_ONLY);
+ classCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
+ true, false));
+
+ // this listener is responsible for processing dialog header message
+ // events
+ classCombo.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ handleSelectorSwitched();
+ }
+ });
+ // creates a button for add new class
+ addNewClassButton = new Button(fileControlPanel, SWT.PUSH);
+ addNewClassButton.setText(JstUIMessages.BUTTON_ADD_NEW_STYLE_CLASS);
+ addNewClassButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ InputDialog dlg = new InputDialog(parent.getShell(),
+ JstUIMessages.ENTER_CSS_CLASS_NAME,
+ JstUIMessages.ENTER_CSS_CLASS_NAME, classCombo
+ .getText(), CSSSelectorValidator.getInstance());
+ if (dlg.open() == Window.OK) {
+ addNewClass(dlg.getValue().trim());
+ }
+ }
+ });
+
+ }
+
+ @Override
+ protected Composite createControlComposite(Composite parent) {
+ Composite controlComposite = super.createControlComposite(parent);
+ createCustomButtonPanel(controlComposite);
+
+ return controlComposite;
+ }
+
+ /**
+ *
+ * @param parent
+ * @param label
+ */
+ protected Label addLabel(Composite parent, String label) {
+ Label labelControl = new Label(parent, SWT.LEFT);
+ labelControl.setLayoutData(new GridData(GridData.END, GridData.CENTER,
+ false, false));
+ labelControl.setText(label);
+ return labelControl;
+ }
+
+ /**
+ * This method is used to create custom button panel.
+ *
+ * @param parent
+ * Composite component
+ */
+ private void createCustomButtonPanel(Composite parent) {
+ Composite buttonComposite = new Composite(parent, SWT.NONE);
+ buttonComposite.setLayoutData(new GridData(GridData.END,
+ GridData.BEGINNING, true, false));
+ buttonComposite.setLayout(new GridLayout());
+ // add APPLY button
+ applyButton = createCustomButton(buttonComposite,
+ JstUIMessages.BUTTON_APPLY, JstUIMessages.CSS_APPLY_CHANGES,
+ false);
+ applyButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ save();
+ applyButton.setEnabled(false);
+ }
+ });
+ // add CLEAR button
+ Button clearButton = createCustomButton(buttonComposite,
+ JstUIMessages.BUTTON_CLEAR,
+ JstUIMessages.CSS_CLEAR_STYLE_SHEET, true);
+ clearButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ getStyleComposite().clearStyleComposite();
+ getStyleComposite().updateCurrentTab();
+ }
+ });
+ }
+
+ /**
+ * This method is used to create custom button.
+ *
+ * @param parent
+ * Composite component
+ * @param label
+ * Button label value
+ */
+ protected Button createCustomButton(Composite parent, String label,
+ String tooltip, boolean defaultState) {
+ // increment the number of columns in the button bar
+ ((GridLayout) parent.getLayout()).numColumns++;
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText(label);
+ button.setToolTipText(tooltip);
+ button.setEnabled(defaultState);
+ return button;
+ }
+
+ /**
+ * Method is used to correctly process style class change operation.
+ */
+ protected void handleSelectorSwitched() {
+ if (selectorLabel != null)
+ cssModel.updateCSSStyle(selectorLabel, getStyleAttributes());
+ selectorLabel = classCombo.getText();
+ preview.setSelector(selectorLabel);
+ classCombo.setToolTipText(cssModel.getCSSRuleText(selectorLabel));
+ getStyleComposite().setStyleProperties(
+ cssModel.getClassProperties(selectorLabel));
+ getStyleComposite().updateCurrentTab();
+ }
+
+ /**
+ * Add New Class to CSS Class Dialog
+ *
+ * @param styleClassName
+ * - name of new style class
+ */
+ public void addNewClass(String styleClassName) {
+ // add new css class
+ String newSelectorLabel = cssModel.addCSSRule(styleClassName);
+ // add it to combobox
+ classCombo.add(newSelectorLabel);
+ // select new class, after it in handleSelectorSwitched() dialog will be
+ // updated
+ classCombo.select(classCombo.getItemCount() - 1);
+
+ //this is require
+ applyButton.setEnabled(true);
+ }
+
+ @Override
+ public void releaseResources() {
+
+ super.releaseResources();
+ preview.releaseModel();
+
+ if (cssModel != null) {
+ cssModel.release();
+ cssModel = null;
+ }
+ }
+
+ /**
+ * Method should be called in case of dialog closure operation.
+ */
+ public void save() {
+ cssModel.updateCSSStyle(selectorLabel, getStyleAttributes());
+ cssModel.save();
+ }
+
+ /**
+ * TODO Gets current selected style class value.
+ *
+ * @return selector name
+ */
+ public String getSelectorName() {
+ return Util.formatCSSSelectorToStyleClassView(selectorLabel);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#close()
+ */
+ @Override
+ public boolean close() {
+ int code = getReturnCode();
+ switch (code) {
+ case OK:
+ save();
+ break;
+ case CANCEL:
+ default:
+ // make some closure operation
+ }
+ return super.close();
+ }
+
+ public void reinit() {
+ preview.releaseModel();
+ cssModel.setFile(file);
+ cssModel.reinit();
+ preview.reinit(cssModel);
+ getStyleComposite().clearStyleComposite();
+ updateControlPane();
+
+ }
+
+ public void setFile(IFile file) {
+ this.file = file;
+ }
+
+ @Override
+ protected void handleStyleChanged() {
+ super.handleStyleChanged();
+
+ if (getStatus().isOK())
+ applyButton.setEnabled(true);
+
+ }
+
+ @Override
+ protected void handleStatusChanged(IStatus newStatus) {
+
+ if (newStatus.getSeverity() != getStatus().getSeverity()) {
+ applyButton.setEnabled(newStatus.isOK());
+ getButton(OK).setEnabled(newStatus.isOK());
+ classCombo.setEnabled(newStatus.isOK());
+ addNewClassButton.setEnabled(newStatus.isOK());
+ }
+
+ super.handleStatusChanged(newStatus);
+ }
+
+ protected void updateControlPane() {
+
+ fileText.setText(file.getFullPath().toString());
+ classCombo.removeAll();
+ classCombo.setEnabled(true);
+ selectorLabel = cssModel
+ .getSelectorLabel(Util.getSelectionInFile(file).x);
+
+ getStyleComposite().setStyleProperties(
+ cssModel.getClassProperties(selectorLabel));
+ preview.setSelector(selectorLabel);
+
+ List<String> selectors = cssModel.getSelectorLabels();
+ for (int i = 0; i < selectors.size(); i++) {
+ String label = selectors.get(i);
+ classCombo.add(label);
+ if (label.equals(selectorLabel))
+ classCombo.select(i);
+
+ }
+
+ if(classCombo.getSelectionIndex() == -1 ){
+ classCombo.select(0);
+ }
+
+ applyButton.setEnabled(false);
+
+ }
+
+ protected Button getApplyButton() {
+ return applyButton;
+ }
+
+ protected Button getAddNewClassButton() {
+ return addNewClassButton;
+ }
+
+ protected Combo getClassCombo() {
+ return classCombo;
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSStyleDialog.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSStyleDialog.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/CSSStyleDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleDialogInterface;
+import org.jboss.tools.jst.jsp.util.Constants;
+
+/**
+ * Class for CSS editor dialog
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ */
+public class CSSStyleDialog extends AbstractCSSDialog implements
CSSStyleDialogInterface{
+
+ public CSSStyleDialog(final Shell parentShell, String style) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
+ | SWT.APPLICATION_MODAL);
+
+ getStyleAttributes().setStyleProperties(parseStyle(style));
+
+ }
+
+ public String getStyle() {
+ return getStyleAttributes().getStyle();
+ }
+
+ protected Map<String, String> parseStyle(String styleString) {
+
+ Map<String, String> properties = new HashMap<String, String>();
+
+ if ((styleString != null) && (styleString.length() > 0)) {
+
+ String[] styles = styleString.split(Constants.SEMICOLON);
+ for (String styleElement : styles) {
+ String[] styleElementParts = styleElement.trim().split(
+ Constants.COLON);
+ if ((styleElementParts != null)
+ && (styleElementParts.length == 2)
+ && Util.searchInElement(styleElementParts[0],
+ CSSConstants.CSS_STYLES_MAP)) {
+
+ properties.put(styleElementParts[0], styleElementParts[1]);
+ }
+ }
+
+ }
+ return properties;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(JstUIMessages.CSS_STYLE_EDITOR_TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ setTitle(JstUIMessages.CSS_STYLE_EDITOR_TITLE);
+ return super.createDialogArea(parent);
+ }
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/FontFamilyDialog.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/FontFamilyDialog.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/FontFamilyDialog.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/FontFamilyDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,490 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.DragSourceListener;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableItem;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.util.Constants;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Class for choosing CCS font-family attribute
+ *
+ * @author dsakovich(a)exadel.com
+ */
+public class FontFamilyDialog extends Dialog implements SelectionListener {
+
+ private static final int VIEWER_HEIGHT = 300;
+ private static final int BUTTOND_WIDTH = 50;
+ private static final int VIEWER_WIDTH = 175;
+
+ /** Font family string */
+ private String fontFamily;
+
+ /** Existing font family */
+ private String existFontFamily;
+ private TableViewer fontFamilyTable;
+ private TableViewer allFontFamilyTable;
+ private Button rightButton;
+ private Button leftButton;
+ private Composite buttonsContainer;
+ private static final String ALL_FONTS_TABLE_SOURCE = "all_fonts_table_source";
//$NON-NLS-1$
+ private static final String FONTS_TABLE_SOURCE = "fonts_table_source";
//$NON-NLS-1$
+
+ /**
+ * Constructor
+ *
+ * @param parentShell
+ * parent shell
+ * @param existingFontFamily
+ * existing font family
+ */
+ public FontFamilyDialog(Shell parentShell, String existingFontFamily) {
+ super(parentShell);
+ this.existFontFamily = existingFontFamily;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ final Composite composite = (Composite) super.createDialogArea(parent);
+ initControls(composite);
+ createLayout(composite);
+ initListeners();
+ initDND();
+ initDefaultContent(composite);
+ return composite;
+ }
+
+ private void initDefaultContent(Composite composite) {
+ Set<String> s = new HashSet<String>();
+ FontData[] fds = composite.getDisplay().getFontList(null, false);
+
+ for (int i = 0; i < fds.length; ++i) {
+ s.add(fds[i].getName());
+ }
+ fds = composite.getDisplay().getFontList(null, true);
+
+ for (int i = 0; i < fds.length; ++i) {
+ s.add(fds[i].getName());
+ }
+ String[] existFonts = fontFamilyParser();
+ Arrays.sort(existFonts);
+
+ String[] answer = new String[s.size()];
+ s.toArray(answer);
+ Arrays.sort(answer);
+
+ for (int i = 0; i < answer.length; i++) {
+ allFontFamilyTable.add(answer[i]);
+ }
+
+ if ((existFontFamily != null)
+ && !existFontFamily.equals(Constants.EMPTY)) {
+ for (int i = 0; i < existFonts.length; i++) {
+ fontFamilyTable.add(existFonts[i]);
+ allFontFamilyTable.remove(existFonts[i]);
+ }
+ }
+ }
+
+ private void initDND() {
+ Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
+
+ allFontFamilyTable.addDragSupport(DND.DROP_MOVE, types,
+ new DragSourceListener() {
+
+ public void dragFinished(DragSourceEvent event) {
+ if (event.doit) {
+ if (event.detail == DND.DROP_MOVE) {
+ handleAddFont();
+ }
+ }
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ event.data = ALL_FONTS_TABLE_SOURCE;
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = allFontFamilyTable.getTable()
+ .getSelectionCount() > 0;
+ }
+ });
+
+ allFontFamilyTable.addDropSupport(DND.DROP_MOVE, types,
+ new DropTargetAdapter() {
+
+ @Override
+ public void drop(DropTargetEvent event) {
+ if (event.data == null
+ || event.data.equals(ALL_FONTS_TABLE_SOURCE)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ }
+
+ });
+
+ fontFamilyTable.addDragSupport(DND.DROP_MOVE, types,
+ new DragSourceListener() {
+
+ public void dragFinished(DragSourceEvent event) {
+ if (event.doit) {
+ if (event.detail == DND.DROP_MOVE) {
+ handleRemoveFont();
+ }
+ }
+ }
+
+ public void dragSetData(DragSourceEvent event) {
+ event.data = FONTS_TABLE_SOURCE;
+ }
+
+ public void dragStart(DragSourceEvent event) {
+ event.doit = fontFamilyTable.getTable()
+ .getSelectionCount() > 0;
+ }
+ });
+
+ fontFamilyTable.addDropSupport(DND.DROP_MOVE, types,
+ new DropTargetAdapter() {
+ @Override
+ public void drop(DropTargetEvent event) {
+ if (event.data == null
+ || event.data.equals(FONTS_TABLE_SOURCE)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ }
+ });
+
+ }
+
+ private void initListeners() {
+ /** Control listeners */
+ allFontFamilyTable.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ handleAddFont();
+ }
+ });
+
+ allFontFamilyTable
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ fontFamilyTable.getTable().deselectAll();
+ leftButton.setEnabled(false);
+ rightButton.setEnabled(true);
+ }
+ });
+
+ fontFamilyTable
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ allFontFamilyTable.getTable().deselectAll();
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(true);
+ }
+ });
+
+ fontFamilyTable.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ handleRemoveFont();
+ }
+ });
+
+ fontFamilyTable.getTable().addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ if (SWT.ARROW_LEFT == e.keyCode && SWT.ALT == e.stateMask) {
+ handleRemoveFont();
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+
+ allFontFamilyTable.getTable().addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ if (SWT.ARROW_RIGHT== e.keyCode && SWT.ALT == e.stateMask) {
+ handleAddFont();
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+
+ rightButton.addSelectionListener(this);
+ leftButton.addSelectionListener(this);
+ }
+
+ private void createLayout(Composite composite) {
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ composite.setLayout(gridLayout);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ composite.setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = VIEWER_HEIGHT;
+ gridData.widthHint = VIEWER_WIDTH;
+ allFontFamilyTable.getTable().setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = VIEWER_HEIGHT;
+ gridData.widthHint = VIEWER_WIDTH;
+ fontFamilyTable.getTable().setLayoutData(gridData);
+
+ final GridLayout btmContGridLayout = new GridLayout();
+ btmContGridLayout.numColumns = 1;
+ buttonsContainer.setLayout(btmContGridLayout);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = BUTTOND_WIDTH;
+ rightButton.setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = BUTTOND_WIDTH;
+ leftButton.setLayoutData(gridData);
+
+ }
+
+ private void initControls(Composite composite) {
+ allFontFamilyTable = new TableViewer(composite, SWT.MULTI
+ | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ buttonsContainer = new Composite(composite, SWT.NONE);
+ rightButton = new Button(buttonsContainer, SWT.PUSH);
+ leftButton = new Button(buttonsContainer, SWT.PUSH);
+ fontFamilyTable = new TableViewer(composite, SWT.MULTI | SWT.BORDER
+ | SWT.V_SCROLL | SWT.H_SCROLL);
+ rightButton.setToolTipText(JstUIMessages.ADD_FONT_FAMILY_TIP);
+ ImageDescriptor rightDesc = CSSPlugin
+ .getImageDescriptor(Util.IMAGE_RIGHT_FILE_LOCATION);
+ Image rightImage = rightDesc.createImage();
+ rightButton.setImage(rightImage);
+ rightButton.setEnabled(false);
+ rightButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+
+ leftButton.setToolTipText(JstUIMessages.REMOVE_FONT_FAMILY_TIP);
+
+ ImageDescriptor leftDesc = CSSPlugin
+ .getImageDescriptor(Util.IMAGE_LEFT_FILE_LOCATION);
+ Image leftImage = leftDesc.createImage();
+ leftButton.setImage(leftImage);
+ leftButton.setEnabled(false);
+ leftButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+ }
+
+ private void handleAddFont() {
+ TableItem[] selectedItems = allFontFamilyTable.getTable()
+ .getSelection();
+ if (selectedItems != null) {
+ Object[] data = new Object[selectedItems.length];
+ for (int i = 0; i < selectedItems.length; i++) {
+ data[i] = selectedItems[i].getData();
+ }
+ fontFamilyTable.add(data);
+ allFontFamilyTable.remove(data);
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(false);
+ }
+
+ }
+
+ private void handleRemoveFont() {
+ TableItem[] selectedItems = fontFamilyTable.getTable().getSelection();
+ if (selectedItems != null) {
+ Object[] data = new Object[selectedItems.length];
+ for (int i = 0; i < selectedItems.length; i++) {
+ data[i] = selectedItems[i].getData();
+ }
+ addFonts(allFontFamilyTable, data);
+ fontFamilyTable.remove(data);
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(false);
+ }
+ }
+
+ /**
+ * Set title for dialog
+ */
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(JstUIMessages.FONT_FAMILY_DIALOG_TITLE);
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+ */
+ @Override
+ protected void okPressed() {
+ TableItem[] items = fontFamilyTable.getTable().getItems();
+ StringBuffer buf = new StringBuffer();
+
+ for (int i = 0; i < items.length; i++) {
+ buf.append(((i == 0) ? Constants.EMPTY : Constants.COMMA)
+ + items[i].getData());
+ }
+
+ fontFamily = buf.toString();
+ super.okPressed();
+ }
+
+ /**
+ * Method for add to font to sorted list
+ *
+ * @param table
+ * @param fonts
+ */
+ private void addFonts(TableViewer table, Object[] fonts) {
+ Set<Object> s = new HashSet<Object>();
+ TableItem[] items = table.getTable().getItems();
+
+ for (int i = 0; i < items.length; i++) {
+ s.add(items[i].getData());
+ }
+
+ for (int i = 0; i < fonts.length; i++) {
+ s.add(fonts[i]);
+ }
+ table.getTable().removeAll();
+
+ String[] answer = new String[s.size()];
+ s.toArray(answer);
+ Arrays.sort(answer);
+
+ for (int i = 0; i < answer.length; i++) {
+ table.add(answer[i]);
+ }
+ }
+
+ /**
+ * Getter for fontFamily attribute
+ *
+ * @return fontFamily
+ */
+ public String getFontFamily() {
+ return fontFamily;
+ }
+
+ /**
+ * Setter for fontFamily attribute
+ *
+ * @param fontFamily
+ */
+ public void setFontFamily(String fontFamily) {
+ this.fontFamily = fontFamily;
+ }
+
+ /**
+ * Method for parse font family string
+ *
+ * @param font
+ * family string
+ * @return list font family
+ */
+ private String[] fontFamilyParser() {
+ existFontFamily = existFontFamily.trim();
+
+ return existFontFamily.split(Constants.COMMA);
+ }
+
+ /**
+ * Selection listener
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent)
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+ Object ob = e.getSource();
+
+ if (ob.equals(leftButton)) {
+ handleRemoveFont();
+ } else if (ob.equals(rightButton)) {
+ handleAddFont();
+ } else if (ob.equals(allFontFamilyTable)) {
+ fontFamilyTable.getTable().deselectAll();
+ leftButton.setEnabled(false);
+ rightButton.setEnabled(true);
+ } else if (ob.equals(fontFamilyTable)) {
+ allFontFamilyTable.getTable().deselectAll();
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(true);
+ }
+ }
+
+ /**
+ * Selection listener
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+ Object ob = e.getSource();
+
+ if (ob.equals(leftButton)) {
+ handleRemoveFont();
+ } else if (ob.equals(rightButton)) {
+ handleAddFont();
+ }
+ }
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/ImageSelectionDialog.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/ImageSelectionDialog.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/ImageSelectionDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,696 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+import org.eclipse.ui.dialogs.SelectionStatusDialog;
+import org.eclipse.ui.internal.WorkbenchMessages;
+
+import org.jboss.tools.jst.css.dialog.common.FileExtensionFilter;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.util.Constants;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * Class for creating images selection dialog
+ *
+ * @author dsakovich(a)exadel.com
+ */
+@SuppressWarnings("restriction")
+public class ImageSelectionDialog extends SelectionStatusDialog {
+ @SuppressWarnings("nls")
+ final static String[][] fileExtensions = {
+ { "jpeg", "jpg", "jpe", "jfif" },
+ { "gif" },
+ { "bmp" },
+ { "tif", "tiff" },
+ { "png" },
+ { "ico" }
+ };
+ private Combo filterCombo;
+ private Canvas canvas;
+ private IFile file;
+ private Text resolution;
+ private Color emptyColor;
+ private TreeViewer fViewer;
+ private ILabelProvider fLabelProvider;
+ private ITreeContentProvider fContentProvider;
+ private ISelectionStatusValidator fValidator = null;
+ private ViewerComparator fComparator;
+ private boolean fAllowMultiple = true;
+ private boolean fDoubleClickSelects = true;
+ private String fEmptyListMessage =
WorkbenchMessages.ElementTreeSelectionDialog_nothing_available;
+ private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
IStatus.OK, Constants.EMPTY, null);
+ private List<ViewerFilter> fFilters;
+ private Object fInput;
+ private boolean fIsEmpty;
+ private int fWidth = 60;
+ private int fHeight = 18;
+
+ /**
+ * Constructs an instance of <code>ImageSelectionDialog</code>.
+ *
+ * @param parent
+ * The parent shell for the dialog
+ * @param labelProvider
+ * the label provider to render the entries
+ * @param contentProvider
+ * the content provider to evaluate the tree structure
+ */
+ public ImageSelectionDialog(Shell parent, ILabelProvider labelProvider,
+ ITreeContentProvider contentProvider) {
+ super(parent);
+
+ fLabelProvider = labelProvider;
+ fContentProvider = contentProvider;
+
+ setResult(new ArrayList<Object>(0));
+ setStatusLineAboveButtons(true);
+
+ int shellStyle = getShellStyle();
+ setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
+ }
+
+ /**
+ * Sets the initial selection. Convenience method.
+ *
+ * @param selection
+ * the initial selection.
+ */
+ public void setInitialSelection(Object selection) {
+ setInitialSelections(new Object[] { selection });
+ }
+
+ /**
+ * Sets the message to be displayed if the list is empty.
+ *
+ * @param message
+ * the message to be displayed.
+ */
+ public void setEmptyListMessage(String message) {
+ fEmptyListMessage = message;
+ }
+
+ /**
+ * Specifies if multiple selection is allowed.
+ *
+ * @param allowMultiple
+ */
+ public void setAllowMultiple(boolean allowMultiple) {
+ fAllowMultiple = allowMultiple;
+ }
+
+ /**
+ * Specifies if default selected events (double click) are created.
+ *
+ * @param doubleClickSelects
+ */
+ public void setDoubleClickSelects(boolean doubleClickSelects) {
+ fDoubleClickSelects = doubleClickSelects;
+ }
+
+ /**
+ * Sets the sorter used by the tree viewer.
+ *
+ * @param sorter
+ * @deprecated as of 3.3, use
+ * {@link ElementTreeSelectionDialog#setComparator(ViewerComparator)}
+ * instead
+ */
+ public void setSorter(ViewerSorter sorter) {
+ fComparator = sorter;
+ }
+
+ /**
+ * Sets the comparator used by the tree viewer.
+ *
+ * @param comparator
+ * @since 3.3
+ */
+ public void setComparator(ViewerComparator comparator) {
+ fComparator = comparator;
+ }
+
+ /**
+ * Adds a filter to the tree viewer.
+ *
+ * @param filter
+ * a filter.
+ */
+ public void addFilter(String[] extention) {
+ if (fFilters == null) {
+ fFilters = new ArrayList<ViewerFilter>(4);
+ }
+
+ fFilters.add(new FileExtensionFilter(extention));
+ }
+
+ /**
+ * Sets an optional validator to check if the selection is valid. The
+ * validator is invoked whenever the selection changes.
+ *
+ * @param validator
+ * the validator to validate the selection.
+ */
+ public void setValidator(ISelectionStatusValidator validator) {
+ fValidator = validator;
+ }
+
+ /**
+ * Sets the tree input.
+ *
+ * @param input
+ * the tree input.
+ */
+ public void setInput(Object input) {
+ fInput = input;
+ }
+
+ /**
+ * Sets the size of the tree in unit of characters.
+ *
+ * @param width
+ * the width of the tree.
+ * @param height
+ * the height of the tree.
+ */
+ public void setSize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ }
+
+ /**
+ * Validate the receiver and update the ok status.
+ *
+ */
+ protected void updateOKStatus() {
+ if (!fIsEmpty) {
+ if (fValidator != null) {
+ fCurrStatus = fValidator.validate(getResult());
+ updateStatus(fCurrStatus);
+ } else {
+ fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
"", null); //$NON-NLS-1$
+ }
+ } else {
+ fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
+ fEmptyListMessage, null);
+ }
+
+ updateStatus(fCurrStatus);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#open()
+ */
+ public int open() {
+ fIsEmpty = evaluateIfTreeEmpty(fInput);
+ super.open();
+
+ return getReturnCode();
+ }
+
+ /**
+ * Handles cancel button pressed event.
+ */
+ protected void cancelPressed() {
+ setResult(null);
+ super.cancelPressed();
+ }
+
+ /*
+ * @see SelectionStatusDialog#computeResult()
+ */
+ protected void computeResult() {
+ setResult(((IStructuredSelection) fViewer.getSelection()).toList());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.window.Window#create()
+ */
+ public void create() {
+ BusyIndicator.showWhile(null,
+ new Runnable() {
+ public void run() {
+ access$superCreate();
+ fViewer.setSelection(new
StructuredSelection(getInitialElementSelections()), true);
+ updateOKStatus();
+ }
+ });
+ }
+
+ /*
+ * @see Dialog#createDialogArea(Composite)
+ */
+ protected Control createDialogArea(Composite parent) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight =
convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
+ layout.marginWidth =
convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.verticalSpacing =
convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
+ layout.horizontalSpacing =
convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ super.applyDialogFont(composite);
+
+ Label messageLabel = createMessageArea(composite);
+ new Label(composite, SWT.NONE);
+
+ TreeViewer treeViewer = createTreeViewer(composite);
+
+ Composite comp = createPreview(composite);
+
+ GridData browserData = new GridData(GridData.FILL_BOTH);
+ browserData.widthHint = convertWidthInCharsToPixels(fWidth / 2);
+ browserData.heightHint = convertHeightInCharsToPixels(fHeight);
+ browserData.minimumWidth = convertWidthInCharsToPixels(fWidth / 2);
+ browserData.minimumHeight = convertHeightInCharsToPixels(fHeight);
+ comp.setLayoutData(browserData);
+
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+
+ Tree treeWidget = treeViewer.getTree();
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+
+ filterCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
+ filterCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
+
+ filterCombo.add(JstUIMessages.ALL_FILES);
+ filterCombo.add(JstUIMessages.ALL_IMAGE_FILES);
+
+ for (int i = 0; i < fileExtensions.length; i++) {
+ String[] str = fileExtensions[i];
+ StringBuffer buf = new StringBuffer();
+
+ for (int j = 0; j < str.length; j++) {
+ buf.append("*." + str[j].toUpperCase() + "; ");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ filterCombo.add(buf.toString());
+ }
+
+ filterCombo.select(0);
+ filterCombo.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (fViewer != null) {
+ ViewerFilter[] filters = fViewer.getFilters();
+
+ if (filters != null) {
+ for (int i = 0; i < filters.length; i++) {
+ fViewer.removeFilter(filters[i]);
+ }
+ }
+
+ if (filterCombo.getSelectionIndex() != 0) {
+ if (filterCombo.getSelectionIndex() == 1) {
+ Set<String> s = new HashSet<String>();
+
+ for (int i = 0; i < fileExtensions.length; i++) {
+ String[] tmp = fileExtensions[i];
+
+ for (int j = 0; j < tmp.length; j++)
+ s.add(tmp[j]);
+ }
+
+ String[] allExtensions = new String[s.size()];
+ s.toArray(allExtensions);
+ fViewer.addFilter(new
FileExtensionFilter(allExtensions));
+ } else {
+ fViewer.addFilter(new FileExtensionFilter(
+ fileExtensions[filterCombo.getSelectionIndex() -
2]));
+ }
+ }
+
+ fViewer.refresh();
+
+ if (fViewer.getTree().getItemCount() <= 0) {
+ fIsEmpty = true;
+ } else {
+ fIsEmpty = false;
+ }
+
+ if (fViewer.getTree().getSelectionCount() <= 0) {
+ file = null;
+ canvas.redraw();
+ }
+
+ updateOKStatus();
+ }
+ }
+ });
+
+ if (fIsEmpty) {
+ messageLabel.setEnabled(false);
+ treeWidget.setEnabled(false);
+ }
+
+ //JBIDE-3084, implementation of default validator
+ fValidator = new ISelectionStatusValidator() {
+ public IStatus validate(Object[] selection) {
+ if ((selection != null) && (selection.length == 1)) {
+ Object selecObject = selection[0];
+
+ if (selecObject instanceof IFile) {
+ return Status.OK_STATUS;
+ }
+ }
+
+ return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
IStatus.ERROR,
+ JstUIMessages.ImageSelectionDialog_InvalidImageFile, null);
+ }
+ };
+
+ return composite;
+ }
+
+ /**
+ * Creates the tree viewer.
+ *
+ * @param parent
+ * the parent composite
+ * @return the tree viewer
+ */
+ protected TreeViewer createTreeViewer(Composite parent) {
+ int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
+
+ fViewer = new TreeViewer(new Tree(parent, style));
+ fViewer.setContentProvider(fContentProvider);
+ fViewer.setLabelProvider(fLabelProvider);
+ fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @SuppressWarnings("unchecked")
+ public void selectionChanged(SelectionChangedEvent event) {
+ access$setResult(((IStructuredSelection)
event.getSelection()).toList());
+ updateOKStatus();
+ }
+ });
+
+ fViewer.getTree().addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ Object obj = getFirstResult();
+
+ if (obj instanceof IFile) {
+ file = (IFile) getFirstResult();
+ } else if (obj instanceof IFolder) {
+ file = null;
+ }
+
+ canvas.redraw();
+ }
+ });
+
+ fViewer.setComparator(fComparator);
+
+ if (fFilters != null) {
+ for (int i = 0; i != fFilters.size(); i++) {
+ fViewer.addFilter(fFilters.get(i));
+ }
+ }
+
+ if (fDoubleClickSelects) {
+ Tree tree = fViewer.getTree();
+ tree.addSelectionListener(new SelectionAdapter() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateOKStatus();
+
+ if (fCurrStatus.isOK()) {
+ access$superButtonPressed(IDialogConstants.OK_ID);
+ }
+ }
+ });
+ }
+
+ fViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ updateOKStatus();
+
+ // If it is not OK or if double click does not
+ // select then expand
+ if (!(fDoubleClickSelects && fCurrStatus.isOK())) {
+ ISelection selection = event.getSelection();
+
+ if (selection instanceof IStructuredSelection) {
+ Object item = ((IStructuredSelection)
selection).getFirstElement();
+
+ if (fViewer.getExpandedState(item)) {
+ fViewer.collapseToLevel(item, 1);
+ } else {
+ fViewer.expandToLevel(item, 1);
+ }
+ }
+ }
+ }
+ });
+
+ fViewer.setInput(fInput);
+
+ return fViewer;
+ }
+
+ /**
+ * Returns the tree viewer.
+ *
+ * @return the tree viewer
+ */
+ protected TreeViewer getTreeViewer() {
+ return fViewer;
+ }
+
+ /**
+ * Set the result using the super class implementation of buttonPressed.
+ *
+ * @param id
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ protected void access$superButtonPressed(int id) {
+ super.buttonPressed(id);
+ }
+
+ /**
+ * Set the result using the super class implementation of setResult.
+ *
+ * @param result
+ * @see SelectionStatusDialog#setResult(int, Object)
+ */
+ protected void access$setResult(List<Object> result) {
+ super.setResult(result);
+ }
+
+ /**
+ * @see org.eclipse.jface.window.Window#handleShellCloseEvent()
+ */
+ protected void handleShellCloseEvent() {
+ super.handleShellCloseEvent();
+
+ // Handle the closing of the shell by selecting the close icon
+ if (getReturnCode() == CANCEL) {
+ setResult(null);
+ }
+ }
+
+ private void access$superCreate() {
+ super.create();
+ }
+
+ /**
+ * Create image preview control
+ *
+ * @param parent
+ * @return composite
+ */
+ private Composite createPreview(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false,
false));
+ label.setText(JstUIMessages.IMAGE_PREVIEW);
+ canvas = new Canvas(composite, SWT.BORDER);
+
+ GridData browserData = new GridData(GridData.FILL_BOTH);
+ browserData.widthHint = convertWidthInCharsToPixels((fWidth) / 2);
+ browserData.heightHint = convertHeightInCharsToPixels(fHeight);
+ canvas.setLayoutData(browserData);
+
+ resolution = new Text(composite, SWT.READ_ONLY | SWT.CENTER);
+ resolution.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
+ resolution.setVisible(false);
+
+ emptyColor = canvas.getForeground();
+
+ canvas.addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ GC gc = new GC(canvas);
+ gc.setForeground(emptyColor);
+ gc.fillRectangle(1, 1, canvas.getSize().x - 2, canvas.getSize().y -
2);
+ // resolution.setText("");
+ resolution.setVisible(false);
+
+ if (file != null) {
+ Cursor parentCursor = getShell().getCursor();
+ final Cursor waitCursor = new Cursor(getShell().getDisplay(),
SWT.CURSOR_WAIT);
+ Point previewPoint = new Point(0, 0);
+ Point labelPoint = canvas.getSize();
+ InputStream stream = null;
+
+ try {
+ getShell().setCursor(waitCursor);
+ stream = new
FileInputStream(file.getLocation().toOSString());
+
+ ImageData imageData = new ImageData(stream);
+ stream.close();
+
+ if (imageData != null) {
+ Image image = new Image(getShell().getDisplay(),
imageData);
+
+ // set image in center
+ Point imagePoint = new Point(image.getBounds().width,
+ image.getBounds().height);
+
+ String imageInfo = imagePoint.x + " x " +
imagePoint.y + " px"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ // change resolution if image anymore image label
+ if ((imagePoint.x > labelPoint.x) || (imagePoint.y
> labelPoint.y)) {
+ float ratioImage = (float) imagePoint.x / (float)
imagePoint.y;
+
+ if (((imagePoint.y > labelPoint.y) &&
+ ((labelPoint.y * ratioImage) >
labelPoint.x)) ||
+ ((imagePoint.x > labelPoint.x) &&
+ ((labelPoint.x / ratioImage) <
labelPoint.y))) {
+ imageData = imageData.scaledTo(labelPoint.x -
10,
+ (int) (labelPoint.x / ratioImage));
+ } else {
+ imageData = imageData.scaledTo((int)
(labelPoint.y * ratioImage) -
+ 10, labelPoint.y);
+ }
+
+ image.dispose();
+ image = new Image(getShell().getDisplay(),
imageData);
+ imagePoint.x = image.getBounds().width;
+ imagePoint.y = image.getBounds().height;
+ }
+
+ previewPoint.x = (labelPoint.x / 2) - (imagePoint.x /
2);
+ previewPoint.y = (labelPoint.y / 2) - (imagePoint.y /
2);
+ gc.drawImage(image, previewPoint.x, previewPoint.y);
+ resolution.setVisible(true);
+ resolution.setText(imageInfo);
+ image.dispose();
+ gc.dispose();
+ }
+ } catch (IOException ev) {
+ //ignore
+ } catch (SWTException ex) {
+ //ignore (if select not image file)
+ } finally {
+ getShell().setCursor(parentCursor);
+
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e1) {
+ // ignore
+ }
+ }
+ }
+ }
+ }
+ });
+
+ return composite;
+ }
+
+ private boolean evaluateIfTreeEmpty(Object input) {
+ Object[] elements = fContentProvider.getElements(input);
+
+ if (elements.length > 0) {
+ if (fFilters != null) {
+ for (int i = 0; i < fFilters.size(); i++) {
+ ViewerFilter curr = fFilters.get(i);
+ elements = curr.filter(fViewer, input, elements);
+ }
+ }
+ }
+
+ return elements.length == 0;
+ }
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/OpenCSSDialogActionDelegate.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/OpenCSSDialogActionDelegate.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/OpenCSSDialogActionDelegate.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/OpenCSSDialogActionDelegate.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,135 @@
+package org.jboss.tools.jst.css.dialog;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * This is CSS dialog action delegate class that process actions that is
+ * contributed in Eclipse regarding CSS Dialog.
+ *
+ * @author Igor Zhukov
+ */
+public class OpenCSSDialogActionDelegate implements
+ IWorkbenchWindowActionDelegate, IObjectActionDelegate,
+ IEditorActionDelegate, IViewActionDelegate {
+
+ private Shell shell = null;
+ private IStructuredSelection selection;
+ private IFile file;
+
+ /**
+ * Initializes this action delegate with the view it will work in.
+ *
+ * @param view
+ * the view that provides the context for this delegate
+ * @see IViewActionDelegate#init(IViewPart)
+ */
+ public void init(IViewPart view) {
+ if (view != null) {
+ if (view.getSite() != null) {
+ shell = view.getSite().getShell();
+ } else if (view.getViewSite() != null) {
+ shell = view.getViewSite().getShell();
+ }
+ }
+ }
+
+ /**
+ * Initializes this action delegate with the view it will work in.
+ *
+ * @param view
+ * the view that provides the context for this delegate
+ * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+ if (window != null) {
+ shell = window.getShell();
+ }
+ }
+
+ /**
+ * Called when the user has selected this action to be executed.
+ */
+ public void run(IAction action) {
+ if ((shell != null) && (file != null)) {
+ String styleClass = null;
+ CSSClassDialog dialog = new CSSClassDialog(shell, file, selection);
+ if (dialog.open() == Window.OK) {
+ styleClass = dialog.getSelectorName();
+ }
+ }
+ }
+
+ /**
+ * Notifies this action delegate that the selection in the workbench has
+ * changed.
+ *
+ * @param action
+ * the action proxy that handles presentation portion of the
+ * action
+ * @param selection
+ * the current selection, or <code>null</code> if there is no
+ * selection.
+ * @see IActionDelegate#selectionChanged(IAction, ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.getFirstElement() instanceof IFile) {
+ this.file = (IFile) ((IStructuredSelection) selection)
+ .getFirstElement();
+
+ } else {
+ this.selection = structuredSelection;
+ }
+ }
+ }
+
+ /**
+ * Sets the active part for the delegate. This method will be called every
+ * time the action appears in a context menu. The targetPart may change with
+ * each invocation.
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ if (targetPart != null && targetPart.getSite() != null) {
+ shell = targetPart.getSite().getShell();
+ }
+ }
+
+ /**
+ * Sets the active editor for the delegate. Implementors should disconnect
+ * from the old editor, connect to the new editor, and update the action to
+ * reflect the new editor.
+ *
+ * @param action
+ * the action proxy that handles presentation portion of the
+ * action
+ * @param editor
+ * the new editor target
+ * @see IEditorActionDelegate #setActiveEditor(IAction, IEditorPart)
+ */
+ public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+ if (targetEditor != null && targetEditor.getSite() != null) {
+ shell = targetEditor.getSite().getShell();
+ if (targetEditor.getEditorInput() instanceof FileEditorInput)
+ file = ((FileEditorInput) targetEditor.getEditorInput())
+ .getFile();
+ }
+ }
+
+ public void dispose() {
+ }
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/StyleComposite.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/StyleComposite.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/StyleComposite.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog;
+
+import java.util.Map;
+
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.ICSSTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabBackgroundControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabBoxesControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabPropertySheetControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabQuickEditControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabTextControl;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+
+/**
+ * Class for creating style tabs
+ *
+ * @author Igor Zhukov (izhukov(a)exadel.com)
+ */
+public class StyleComposite extends Composite {
+
+ private TabFolder tabFolder;
+ private StyleAttributes styleAttributes;
+ public static int DEFAULT_START_TAB = 4;
+
+ /**
+ * StyleComposite constructor.
+ *
+ * @param parent
+ * Composite object
+ * @param styleAttributes
+ * StyleAttributes objects
+ * @param oldStyle
+ * String value
+ */
+ public StyleComposite(Composite parent, StyleAttributes styleAttributes,
+ DataBindingContext bindingContext) {
+ super(parent, SWT.NONE);
+ this.styleAttributes = styleAttributes;
+
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 1;
+ setLayout(gridLayout);
+ setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+
+ tabFolder = new TabFolder(this, SWT.NONE);
+ tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+ true, true));
+ tabFolder.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ updateTab((TabItem) e.item);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ // add text tab
+ ScrolledComposite tabComposite = createTabComposite();
+
+ BaseTabControl baseTabControl = new TabTextControl(tabComposite,
+ styleAttributes, bindingContext);
+
+ createTabItem(tabComposite, baseTabControl,
+ JstUIMessages.TEXT_FONT_TAB_NAME,
+ JstUIMessages.TEXT_FONT_TAB_NAME);
+
+ tabComposite.setContent(baseTabControl);
+ tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+
+ // add background tab
+ tabComposite = createTabComposite();
+
+ baseTabControl = new TabBackgroundControl(tabComposite,
+ styleAttributes, bindingContext);
+
+ createTabItem(tabComposite, baseTabControl,
+ JstUIMessages.BACKGROUND_TAB_NAME,
+ JstUIMessages.BACKGROUND_TAB_NAME);
+
+ tabComposite.setContent(baseTabControl);
+ tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+
+ // add boxes tab
+ tabComposite = createTabComposite();
+
+ baseTabControl = new TabBoxesControl(tabComposite, styleAttributes,
+ bindingContext);
+
+ createTabItem(tabComposite, baseTabControl,
+ JstUIMessages.BOXES_TAB_NAME, JstUIMessages.BOXES_TAB_NAME);
+
+ tabComposite.setContent(baseTabControl);
+ tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+
+ // add propertie tab
+ tabComposite = createTabComposite();
+ baseTabControl = new TabPropertySheetControl(tabComposite,
+ styleAttributes, bindingContext);
+
+ createTabItem(tabComposite, baseTabControl,
+ JstUIMessages.PROPERTY_SHEET_TAB_NAME,
+ JstUIMessages.PROPERTY_SHEET_TAB_NAME);
+
+ tabComposite.setContent(baseTabControl);
+ tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+
+ // add quick edit tab
+ tabComposite = createTabComposite();
+ baseTabControl = new TabQuickEditControl(tabComposite, styleAttributes,
+ bindingContext);
+
+ createTabItem(tabComposite, baseTabControl,
+ JstUIMessages.QUICK_EDIT_TAB_NAME,
+ JstUIMessages.QUICK_EDIT_TAB_NAME);
+
+ tabComposite.setContent(baseTabControl);
+ tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
+ SWT.DEFAULT));
+
+ tabFolder.setSelection(DEFAULT_START_TAB);
+
+ }
+
+ /**
+ * Clear whole style composite component.
+ */
+ public void clearStyleComposite() {
+ styleAttributes.clear();
+
+ }
+
+ /**
+ * Clear whole style composite component.
+ */
+ public void setStyleProperties(Map<String, String> properties) {
+ styleAttributes.setStyleProperties(properties);
+
+ }
+
+ public TabFolder getTabFolder() {
+ return tabFolder;
+ }
+
+ public TabItem createTabItem(Composite content, ICSSTabControl tabControl,
+ String label, String tooltip) {
+
+ TabItem item = new TabItem(tabFolder, SWT.NONE);
+ item.setText(label);
+ item.setToolTipText(tooltip);
+ item.setControl(content);
+ item.setData(tabControl);
+ return item;
+
+ }
+
+ public ScrolledComposite createTabComposite() {
+
+ ScrolledComposite scroll = new ScrolledComposite(tabFolder,
+ SWT.H_SCROLL | SWT.V_SCROLL);
+
+ scroll.setExpandHorizontal(true);
+ scroll.setExpandVertical(true);
+
+ return scroll;
+ }
+
+ public void selectTab(int index) {
+
+ tabFolder.setSelection(index);
+ TabItem item = tabFolder.getItem(index);
+ updateTab(item);
+
+ }
+
+ public void updateCurrentTab() {
+ updateTab(tabFolder.getSelection()[0]);
+ }
+
+ private void updateTab(TabItem item) {
+ if (item.getData() instanceof ICSSTabControl)
+ ((ICSSTabControl) item.getData()).update();
+ }
+
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/builder/CSSDialogBuilder.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/builder/CSSDialogBuilder.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/builder/CSSDialogBuilder.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog.builder;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.jst.css.dialog.CSSClassDialog;
+import org.jboss.tools.jst.css.dialog.CSSStyleDialog;
+import org.jboss.tools.jst.css.dialog.selector.CSSStyleClassSelector;
+import org.jboss.tools.jst.jsp.outline.css.CSSDialogBuilderInterface;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleClassSelectorInterface;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleDialogDecorator;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleDialogInterface;
+import org.jboss.tools.jst.jsp.util.Constants;
+
+/**
+ * Builder for building CSSStyleDialog
+ *
+ * @author mareshkau
+ *
+ */
+public class CSSDialogBuilder implements CSSDialogBuilderInterface {
+
+ @Override
+ public CSSStyleDialogInterface buildCSSStyleDialog(Shell shell, String style) {
+ return new CSSStyleDialog(shell,style);
+ }
+ @Override
+ public CSSStyleClassSelectorInterface buildCSSClassDialog(Shell parentShell) {
+ return new CSSStyleClassSelector(parentShell);
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common (from
rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSConstants.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSConstants.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSConstants.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.io.IOException;
import java.io.InputStream;
@@ -17,9 +17,9 @@
import java.util.Map;
import java.util.Properties;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.BaseListener;
-import org.jboss.tools.jst.jsp.outline.cssdialog.parsers.CSSParser;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.css.dialog.parsers.BaseListener;
+import org.jboss.tools.jst.css.dialog.parsers.CSSParser;
import org.xml.sax.Attributes;
/**
@@ -44,20 +44,16 @@
public static final String TEXT_DECORATION = "text-decoration"; //$NON-NLS-1$
public static final String TEXT_ALIGN = "text-align"; //$NON-NLS-1$
public static final String FONT_FAMILY = "font-family"; //$NON-NLS-1$
- public static final String COLOR = "color"; //$NON-NLS-1$
- public static final String STYLE = "style"; //$NON-NLS-1$
- public static final String CLASS = "class"; //$NON-NLS-1$
-
public static final Map<String, ArrayList<String>> CSS_STYLE_VALUES_MAP =
new HashMap<String, ArrayList<String>>();
public static final Map<String, ArrayList<String>> CSS_STYLES_MAP = new
HashMap<String, ArrayList<String>>();
public static Map<String, String> COLORS;
- private static final String CSS_VALUES_FILE =
"cssdialog/cssElementsWithCombo.xml"; //$NON-NLS-1$
- private static final String CSS_STYLES_FILE = "cssdialog/cssElements.xml";
//$NON-NLS-1$
- private static final String COLORS_FILE = "cssdialog/color_properties.xml";
//$NON-NLS-1$
+ private static final String CSS_VALUES_FILE =
"resources/cssdialog/cssElementsWithCombo.xml"; //$NON-NLS-1$
+ private static final String CSS_STYLES_FILE =
"resources/cssdialog/cssElements.xml"; //$NON-NLS-1$
+ private static final String COLORS_FILE =
"resources/cssdialog/color_properties.xml"; //$NON-NLS-1$
private static final String NODE_NAME_ELEMENTS = "elements"; //$NON-NLS-1$
private static final String NODE_NAME_VALUE = "value"; //$NON-NLS-1$
@@ -71,7 +67,7 @@
Properties properties = new Properties();
- InputStream is = JspEditorPlugin.getDefault().getBundle()
+ InputStream is = CSSPlugin.getDefault().getBundle()
.getResource(COLORS_FILE).openStream();
properties.loadFromXML(is);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSModel.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSModel.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSModel.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.io.IOException;
import java.util.ArrayList;
@@ -38,7 +38,8 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.exceptions.ResourceInUse;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
import org.w3c.dom.css.CSSStyleDeclaration;
@@ -120,11 +121,11 @@
}
}
} catch (IOException e) {
- JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ CSSPlugin.getDefault().logError(e.getMessage());
} catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ CSSPlugin.getDefault().logError(e.getMessage());
} catch (ResourceInUse e) {
- JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ CSSPlugin.getDefault().logError(e.getMessage());
}
}
@@ -261,9 +262,9 @@
oldText = newText;
}
} catch (IOException e) {
- JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ CSSPlugin.getDefault().logError(e.getMessage());
} catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logError(e.getMessage());
+ CSSPlugin.getDefault().logError(e.getMessage());
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSSelectorValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSSelectorValidator.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSSelectorValidator.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.io.IOException;
import java.io.StringReader;
@@ -16,7 +16,7 @@
import java.lang.ref.SoftReference;
import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.wst.css.core.internal.parser.CSSTokenizer;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.w3c.dom.css.CSSRuleList;
@@ -77,7 +77,7 @@
}
}
} catch (IOException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
cleanValidatingDocument();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSStyleValueValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSStyleValueValidator.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSStyleValueValidator.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
@@ -18,8 +18,9 @@
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.CSSStyleRule;
@@ -93,7 +94,7 @@
.getDeclaredField("logListeners"); //$NON-NLS-1$
logListeners.setAccessible(true);
} catch (Throwable e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
}
@@ -102,7 +103,7 @@
oldValue = logListeners.get(null);
logListeners.set(null, new ArrayList<Object>(0));
} catch (Throwable e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
}
@@ -112,7 +113,7 @@
logListeners.set(null, oldValue);
}
} catch (Throwable e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
} finally {
oldValue = null;
}
@@ -121,7 +122,7 @@
public IStatus validate(Object value) {
return isValidValue((String) value) ? Status.OK_STATUS : new Status(
- IStatus.ERROR, JspEditorPlugin.PLUGIN_ID,
+ IStatus.ERROR, CSSPlugin.PLUGIN_ID,
JstUIMessages.CSS_INVALID_STYLE_PROPERTY);
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSValidator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/CSSValidator.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/CSSValidator.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
import org.eclipse.wst.sse.core.StructuredModelManager;
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/Constants.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/Constants.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.RGB;
-
-/**
- *
- * Class for constants
- *
- * @author Evgeny Zheleznyakov
- *
- */
-public class Constants {
-
- public static final String extSizes[] = new String[] { "", "em",
"ex", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "px", "in", "cm", "mm", "pt",
"pc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
//$NON-NLS-6$
-
- public static final Set elemFolder = Collections
- .unmodifiableSet(new HashSet(
- Arrays
- .asList(new String[] {
- "background-image", "list-style-image", "cursor",
"cue-after", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "cue-before" }))); //$NON-NLS-1$
-
- public static final Set extElem = Collections
- .unmodifiableSet(new HashSet(
- Arrays
- .asList(new String[] {
- "border-bottom-width", "border-left-width",
"borer-right-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "border-top-width", "border-width", "bottom",
"font-size", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "height", "left", "letter-spacing",
"line-height", "margin", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$
- "margin-bottom", "margin-left", "margin-right",
"margin-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "margin-offset", "margin-bottom", "max-height",
"max-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "min-height", "min-width", "outline-width",
"padding", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "padding-bottom", "padding-left", "padding-right",
"padding-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "right", "size", "text-indent", "top",
"vertical-align", "width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- "word-spacing" }))); //$NON-NLS-1$
-
- public static final String NONE = "none"; //$NON-NLS-1$
-
- public static final String IMAGE_COLOR_FILE_LOCATION =
"images/cssdialog/color.gif"; //$NON-NLS-1$
- public static final String IMAGE_FOLDER_FILE_LOCATION =
"images/cssdialog/folder.gif"; //$NON-NLS-1$
- public static final String IMAGE_FONT_FILE_LOCATION =
"images/cssdialog/font.gif"; //$NON-NLS-1$
- public static final String IMAGE_COLORLARGE_FILE_LOCATION =
"images/cssdialog/color_large.gif"; //$NON-NLS-1$
- public static final String IMAGE_FOLDERLARGE_FILE_LOCATION =
"images/cssdialog/folder_large.gif"; //$NON-NLS-1$
- public static final String IMAGE_FONTLARGE_FILE_LOCATION =
"images/cssdialog/font_large.gif"; //$NON-NLS-1$
- public static final String IMAGE_LEFT_FILE_LOCATION =
"images/cssdialog/left.gif"; //$NON-NLS-1$
- public static final String IMAGE_RIGHT_FILE_LOCATION =
"images/cssdialog/right.gif"; //$NON-NLS-1$
- public static final String IMAGE_UP_FILE_LOCATION = "images/cssdialog/up.gif";
//$NON-NLS-1$
- public static final String IMAGE_DOWN_FILE_LOCATION =
"images/cssdialog/down.gif"; //$NON-NLS-1$
- public static final String IMAGE_SAMPLE_FILE_LOCATION =
"images/cssdialog/sample.gif"; //$NON-NLS-1$
- public static final String IMAGE_STYLE_SHEET_LOCATION =
"images/cssdialog/style_sheet.gif"; //$NON-NLS-1$
- public static final String IMAGE_STYLE_CLASS_LOCATION =
"images/cssdialog/style_class.gif"; //$NON-NLS-1$
-
- public static final int FIRST_COLUMN = 0;
- public static final int SECOND_COLUMN = 1;
-
- public static final String EMPTY = ""; //$NON-NLS-1$
- public static final String WHITE_SPACE = " "; //$NON-NLS-1$
- public static final String COLON = ":"; //$NON-NLS-1$
- public static final String SEMICOLON = ";"; //$NON-NLS-1$
- public static final String COMMA = ","; //$NON-NLS-1$
- public static final String DOT = "."; //$NON-NLS-1$
- public static final String DASH = "-"; //$NON-NLS-1$
- public static final String SLASH = "/"; //$NON-NLS-1$
- public static final String EQUAL = "="; //$NON-NLS-1$
- public static final String UNDERSCORE = "_"; //$NON-NLS-1$
- public static final String START_BRACKET = "("; //$NON-NLS-1$
- public static final String END_BRACKET = ")"; //$NON-NLS-1$
- public static final String GT = ">"; //$NON-NLS-1$
- public static final String LT = "<"; //$NON-NLS-1$
- public static final String PROPERTIES_EXTENTION = ".properties";
//$NON-NLS-1$
-
- public static final String LEFT_BRACE = "{"; //$NON-NLS-1$
- public static final String RIGHT_BRACE = "}"; //$NON-NLS-1$
-
- public static final RGB RGB_BLACK = new RGB(0, 0, 0);
- public static final RGB RGB_WHITE = new RGB(0xFF, 0xFF, 0xFF);
-
- public static final int DONT_CONTAIN = -1;
-
- public static String OPEN_SPAN_TAG = "<span style=\"width: 100%;";
//$NON-NLS-1$
- public static String CLOSE_SPAN_TAG = "</span>"; //$NON-NLS-1$
- public static String OPEN_DIV_TAG = "<div style=\"width: 100%;";
//$NON-NLS-1$
- public static String CLOSE_DIV_TAG = "</div>"; //$NON-NLS-1$
-}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/FileExtensionFilter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/FileExtensionFilter.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/FileExtensionFilter.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -17,7 +17,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
/**
* Class for creates filter by file extensions
@@ -51,7 +51,7 @@
return true;
}
} catch (CoreException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
}
return false;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/ICSSDialogModel.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/ICSSDialogModel.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/ICSSDialogModel.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.util.List;
import java.util.Map;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/StyleAttributes.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/StyleAttributes.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/StyleAttributes.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.util.Map;
import java.util.Set;
@@ -17,6 +17,7 @@
import org.eclipse.core.databinding.observable.IChangeListener;
import org.eclipse.core.databinding.observable.map.IObservableMap;
import org.eclipse.core.databinding.observable.map.WritableMap;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* Class is used to store an array of style attributes and support listeners.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/Util.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Util.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/common/Util.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.common;
+package org.jboss.tools.jst.css.dialog.common;
import java.util.ArrayList;
import java.util.Iterator;
@@ -34,7 +34,8 @@
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* Utility class
@@ -42,6 +43,20 @@
* @author Evgeny Zheleznyakov
*/
public class Util {
+ //plugin constants
+ public static final String IMAGE_COLOR_FILE_LOCATION =
"images/cssdialog/color.gif"; //$NON-NLS-1$
+ public static final String IMAGE_FOLDER_FILE_LOCATION =
"images/cssdialog/folder.gif"; //$NON-NLS-1$
+ public static final String IMAGE_FONT_FILE_LOCATION =
"images/cssdialog/font.gif"; //$NON-NLS-1$
+ public static final String IMAGE_COLORLARGE_FILE_LOCATION =
"images/cssdialog/color_large.gif"; //$NON-NLS-1$
+ public static final String IMAGE_FOLDERLARGE_FILE_LOCATION =
"images/cssdialog/folder_large.gif"; //$NON-NLS-1$
+ public static final String IMAGE_FONTLARGE_FILE_LOCATION =
"images/cssdialog/font_large.gif"; //$NON-NLS-1$
+ public static final String IMAGE_LEFT_FILE_LOCATION =
"images/cssdialog/left.gif"; //$NON-NLS-1$
+ public static final String IMAGE_RIGHT_FILE_LOCATION =
"images/cssdialog/right.gif"; //$NON-NLS-1$
+ public static final String IMAGE_UP_FILE_LOCATION = "images/cssdialog/up.gif";
//$NON-NLS-1$
+ public static final String IMAGE_DOWN_FILE_LOCATION =
"images/cssdialog/down.gif"; //$NON-NLS-1$
+ public static final String IMAGE_SAMPLE_FILE_LOCATION =
"images/cssdialog/sample.gif"; //$NON-NLS-1$
+ public static final String IMAGE_STYLE_SHEET_LOCATION =
"images/cssdialog/style_sheet.gif"; //$NON-NLS-1$
+ public static final String IMAGE_STYLE_CLASS_LOCATION =
"images/cssdialog/style_class.gif"; //$NON-NLS-1$
public static final String CSS_FILE_EXTENTION = "css"; //$NON-NLS-1$
@@ -292,7 +307,7 @@
*/
public static IResource getCurrentProject() {
IResource result = null;
- IWorkbenchPage page =
JspEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page =
CSSPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null && page.getActiveEditor() != null) {
IEditorPart editor = page.getActiveEditor();
IEditorInput input = editor.getEditorInput();
@@ -312,7 +327,7 @@
* @return IFile CSS file
*/
public static IFile getActiveCssFile() {
- IWorkbenchPage page =
JspEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page =
CSSPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null && page.getActiveEditor() != null) {
IEditorInput input = page.getActiveEditor().getEditorInput();
if (input instanceof IFileEditorInput) {
@@ -331,7 +346,7 @@
* @return selector name
*/
public static String getActivePageCSSSelectorIfAny() {
- IWorkbenchPage page =
JspEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page =
CSSPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
ISelection selection = page.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection)selection;
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers (from
rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/BaseListener.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/BaseListener.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/BaseListener.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.parsers;
+package org.jboss.tools.jst.css.dialog.parsers;
import java.util.ArrayList;
import java.util.HashMap;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/CSSParser.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/parsers/CSSParser.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/parsers/CSSParser.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,16 +8,14 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.parsers;
+package org.jboss.tools.jst.css.dialog.parsers;
import java.io.IOException;
import java.io.InputStream;
-
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
import org.xml.sax.SAXException;
/**
@@ -37,21 +35,21 @@
saxParser = SAXParserFactory.newInstance().newSAXParser();
} catch (ParserConfigurationException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
} catch (SAXException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
}
public void parse(String file) {
try {
- InputStream is = JspEditorPlugin.getDefault().getBundle()
+ InputStream is = CSSPlugin.getDefault().getBundle()
.getResource(file).openStream();
saxParser.parse(is, listener);
} catch (SAXException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
} catch (IOException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPartComposite.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPartComposite.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPartComposite.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,680 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.dialog.selector;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.SafeRunnable;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.css.dialog.selector.dnd.CSSTableDragAdapter;
+import org.jboss.tools.jst.css.dialog.selector.dnd.CSSTableDropAdapter;
+import org.jboss.tools.jst.css.dialog.selector.dnd.CSSTreeDragAdapter;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSJSPRecognizer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTableModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.selection.CSSClassSelectionChangedEvent;
+import org.jboss.tools.jst.css.dialog.selector.selection.CSSSelectionEventManager;
+import
org.jboss.tools.jst.css.dialog.selector.selection.ICSSClassSelectionChangedListener;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorFilter;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorTableViewer;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorTreeViewer;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.util.Constants;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSSelectorPartComposite extends Composite implements
+ SelectionListener {
+
+ private static final int VIEWER_HEIGHT = 500;
+ private static final int BUTTOND_WIDTH = 50;
+ private static final int VIEWER_WIDTH = 175;
+
+ /** Existing font family */
+ private Composite moveButtonsContainer;
+ private Composite tableButtonsContainer;
+ private Button rightButton;
+ private Button leftButton;
+ private Button upButton;
+ private Button downButton;
+ private String setClasses;
+ private CSSSelectorTreeViewer allCSSStyleClassViewer;
+ private CSSSelectorTableViewer selectedClassesTableViewer;
+ private Map<String, Map<String, String>> allCSSClassStyles;
+ private StyleAttributes styleAttributes;
+ private CSSSelectorTreeModel styleClassTreeModel;
+ private CSSSelectorFilter filter;
+ private List<ICSSClassSelectionChangedListener> changedListeners = new
ArrayList<ICSSClassSelectionChangedListener>(
+ 0);
+
+ public CSSSelectorPartComposite(StyleAttributes styleAttributes,
+ Composite parentComposite, String setClasses) {
+ super(parentComposite, SWT.BORDER);
+ this.setClasses = setClasses;
+ this.styleAttributes = styleAttributes;
+ creatSelectorPart();
+ }
+
+ private void creatSelectorPart() {
+ initControls();
+ createLayout();
+ initListeners();
+ initDND();
+ initDefaultContent();
+ }
+
+ private void initDefaultContent() {
+ IEditorPart editorPart = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (!(editorPart instanceof JSPMultiPageEditor)) {
+ return;
+ }
+ String[] selectedClasses = parseSetClasses();
+ selectedClassesTableViewer.setModel(new CSSSelectorTableModel(
+ selectedClasses));
+ CSSJSPRecognizer recognizer = new CSSJSPRecognizer(
+ (JSPMultiPageEditor) editorPart);
+ if (recognizer.parseCSS() == CSSJSPRecognizer.VOID_RESULT) {
+ return;
+ }
+ styleClassTreeModel = recognizer.getCssStyleClassTreeModel();
+ allCSSClassStyles = recognizer.getCSSStyleMap();
+ allCSSStyleClassViewer.setModel(styleClassTreeModel);
+ updateStyles();
+ }
+
+ private void initDND() {
+ Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
+
+ allCSSStyleClassViewer.addDragSupport(DND.DROP_MOVE, types,
+ new CSSTreeDragAdapter(this, allCSSStyleClassViewer,
+ selectedClassesTableViewer));
+
+ selectedClassesTableViewer.addDragSupport(DND.DROP_MOVE, types,
+ new CSSTableDragAdapter(this, allCSSStyleClassViewer,
+ selectedClassesTableViewer));
+
+ allCSSStyleClassViewer.addDropSupport(DND.DROP_MOVE, types,
+ new DropTargetAdapter() {
+ @Override
+ public void drop(DropTargetEvent event) {
+ if (event.data == null
+ || event.data
+ .equals(CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID)) {
+ event.detail = DND.DROP_NONE;
+ return;
+ }
+ }
+ });
+
+ selectedClassesTableViewer.addDropSupport(DND.DROP_MOVE, types,
+ new CSSTableDropAdapter(this, allCSSStyleClassViewer,
+ selectedClassesTableViewer));
+
+ }
+
+ private void initListeners() {
+
+ allCSSStyleClassViewer
+ .addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ handleAddClass();
+ }
+ });
+
+ selectedClassesTableViewer
+ .addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ handleRemoveClass();
+ }
+
+ });
+
+ allCSSStyleClassViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(
+ final SelectionChangedEvent event) {
+ if (!CSSSelectionEventManager.getInstance()
+ .isHandleSelection()) {
+ CSSSelectionEventManager.getInstance()
+ .setHandleSelection(true);
+ return;
+ }
+ if (!event.getSelection().isEmpty()) {
+ rightButton.setEnabled(true);
+ leftButton.setEnabled(false);
+ } else {
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(false);
+ }
+ selectedClassesTableViewer.getTable().deselectAll();
+ checkForTableMove(event);
+ if (event.getSelection().isEmpty()) {
+ return;
+ }
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ fireClassSelectionChanged(CSSSelectionEventManager
+ .getInstance()
+ .createTreeSelectionChangedEvent(
+ event,
+ allCSSStyleClassViewer
+ .getModel()));
+ }
+ });
+ }
+ });
+
+ selectedClassesTableViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(
+ final SelectionChangedEvent event) {
+ if (!CSSSelectionEventManager.getInstance()
+ .isHandleSelection()) {
+ CSSSelectionEventManager.getInstance()
+ .setHandleSelection(true);
+ return;
+ }
+ if (!event.getSelection().isEmpty()) {
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(true);
+ } else {
+ rightButton.setEnabled(false);
+ leftButton.setEnabled(false);
+ }
+ checkForTableMove(event);
+ allCSSStyleClassViewer.getTree().deselectAll();
+ if (event.getSelection().isEmpty()) {
+ return;
+ }
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ fireClassSelectionChanged(CSSSelectionEventManager
+ .getInstance()
+ .createTableSelectionChangedEvent(
+ event,
+ allCSSStyleClassViewer
+ .getModel()));
+ }
+ });
+ }
+ });
+
+ allCSSStyleClassViewer.getTree().addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ if (SWT.ARROW_RIGHT == e.keyCode && SWT.ALT == e.stateMask) {
+ handleAddClass();
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+
+ selectedClassesTableViewer.getTable().addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ if (SWT.ARROW_LEFT == e.keyCode && SWT.ALT == e.stateMask) {
+ handleRemoveClass();
+ }
+ }
+
+ public void keyPressed(KeyEvent e) {
+ }
+ });
+
+ rightButton.addSelectionListener(this);
+ leftButton.addSelectionListener(this);
+ upButton.addSelectionListener(this);
+ downButton.addSelectionListener(this);
+ }
+
+ private void checkForTableMove(SelectionChangedEvent event) {
+ if (event.getSelection().isEmpty()) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ return;
+ }
+ int[] selectionIndices = selectedClassesTableViewer.getTable()
+ .getSelectionIndices();
+ if (selectionIndices.length == 0) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ return;
+ }
+ if (!isSequencedIndices(selectionIndices)) {
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ } else {
+ if (selectionIndices[0] != 0
+ && (selectionIndices[selectionIndices.length - 1] !=
selectedClassesTableViewer
+ .getTable().getItemCount() - 1)) {
+ upButton.setEnabled(true);
+ downButton.setEnabled(true);
+ } else if (selectionIndices[0] != 0) {
+ downButton.setEnabled(false);
+ upButton.setEnabled(true);
+ } else if (selectionIndices[selectionIndices.length - 1] !=
selectedClassesTableViewer
+ .getTable().getItemCount() - 1) {
+ downButton.setEnabled(true);
+ upButton.setEnabled(false);
+ } else if (selectionIndices[0] == 0
+ && (selectionIndices[selectionIndices.length - 1] ==
selectedClassesTableViewer
+ .getTable().getItemCount() - 1)) {
+ upButton.setEnabled(false);
+ downButton.setEnabled(false);
+ }
+ }
+ }
+
+ private boolean isSequencedIndices(int[] indices) {
+ for (int i = 0; i < indices.length - 1; i++) {
+ if (indices[i + 1] - indices[i] != 1)
+ return false;
+ }
+ return true;
+ }
+
+ private void initControls() {
+ allCSSStyleClassViewer = new CSSSelectorTreeViewer(this, SWT.MULTI
+ | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
+ filter = new CSSSelectorFilter();
+ allCSSStyleClassViewer.addFilter(filter);
+ moveButtonsContainer = new Composite(this, SWT.NONE);
+ rightButton = new Button(moveButtonsContainer, SWT.PUSH);
+ leftButton = new Button(moveButtonsContainer, SWT.PUSH);
+ selectedClassesTableViewer = new CSSSelectorTableViewer(this, SWT.MULTI
+ | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ tableButtonsContainer = new Composite(this, SWT.NONE);
+ upButton = new Button(tableButtonsContainer, SWT.PUSH);
+ downButton = new Button(tableButtonsContainer, SWT.PUSH);
+ rightButton.setToolTipText(JstUIMessages.CSS_ADD_CSS_CLASS_TIP);
+ ImageDescriptor rightDesc = CSSPlugin
+ .getImageDescriptor(Util.IMAGE_RIGHT_FILE_LOCATION);
+ Image rightImage = rightDesc.createImage();
+ rightButton.setImage(rightImage);
+ rightButton.setEnabled(false);
+ rightButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+
+ leftButton.setToolTipText(JstUIMessages.CSS_REMOVE_CSS_CLASS_TIP);
+
+ ImageDescriptor leftDesc = CSSPlugin
+ .getImageDescriptor(Util.IMAGE_LEFT_FILE_LOCATION);
+ Image leftImage = leftDesc.createImage();
+ leftButton.setImage(leftImage);
+ leftButton.setEnabled(false);
+ leftButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+ upButton.setToolTipText(JstUIMessages.CSS_MOVE_UP_CSS_CLASS_TIP);
+
+ ImageDescriptor upDesc = CSSPlugin
+ .getImageDescriptor(Util.IMAGE_UP_FILE_LOCATION);
+ Image upImage = upDesc.createImage();
+ upButton.setImage(upImage);
+ upButton.setEnabled(false);
+ upButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+ downButton.setToolTipText(JstUIMessages.CSS_MOVE_DOWN_CSS_CLASS_TIP);
+
+ ImageDescriptor downDesc = CSSPlugin
+ .getImageDescriptor(Util.IMAGE_DOWN_FILE_LOCATION);
+ Image downImage = downDesc.createImage();
+ downButton.setImage(downImage);
+ downButton.setEnabled(false);
+ downButton.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ Button button = (Button) e.getSource();
+ button.getImage().dispose();
+ }
+ });
+ }
+
+ private String[] parseSetClasses() {
+ if (setClasses == null || setClasses.length() == 0) {
+ return new String[0];
+ }
+ StringTokenizer stringTokenizer = new StringTokenizer(
+ setClasses.trim(), " ", false); //$NON-NLS-1$
+ java.util.List<String> list = new ArrayList<String>(0);
+ while (stringTokenizer.hasMoreTokens()) {
+ String token = stringTokenizer.nextToken();
+ list.add(token.trim());
+ }
+ return list.toArray(new String[0]);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ Object ob = e.getSource();
+ if (ob.equals(leftButton)) {
+ handleRemoveClass();
+ } else if (ob.equals(rightButton)) {
+ handleAddClass();
+ } else if (ob.equals(upButton)) {
+ handleMoveUp();
+ } else if (ob.equals(downButton)) {
+ handleMoveDown();
+ } else if (ob.equals(allCSSStyleClassViewer.getTree())) {
+ selectedClassesTableViewer.setSelection(new StructuredSelection());
+ } else if (ob.equals(selectedClassesTableViewer.getTable())) {
+ allCSSStyleClassViewer.setSelection(new StructuredSelection());
+ }
+ }
+
+ private void handleMoveDown() {
+ StructuredSelection selection = (StructuredSelection) selectedClassesTableViewer
+ .getSelection();
+ Object[] selectedItems = selection.toArray();
+ int[] selectedIndices = selectedClassesTableViewer.getTable()
+ .getSelectionIndices();
+ int itemsCount = selectedClassesTableViewer.getTable().getItemCount();
+ int selectionLength = selectedIndices.length;
+ for (int i = 0; i < selectionLength; i++) {
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ selectedClassesTableViewer.remove(selectedItems[selectionLength - 1
+ - i]);
+ if (selectedIndices[selectionLength - 1 - i] == itemsCount - 1) {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(), itemsCount - 1);
+ item.setData(selectedItems[selectionLength - 1 - i]);
+ itemsCount--;
+ } else {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(),
+ selectedIndices[selectionLength - 1 - i] + 1);
+ item.setData(selectedItems[selectionLength - 1 - i]);
+ }
+ }
+ selectedClassesTableViewer.refresh();
+ selectedClassesTableViewer.setSelection(new StructuredSelection(
+ selectedItems));
+ updateStyles();
+ }
+
+ private void handleMoveUp() {
+ StructuredSelection selection = (StructuredSelection) selectedClassesTableViewer
+ .getSelection();
+ Object[] selectedItems = selection.toArray();
+ int[] selectedIndices = selectedClassesTableViewer.getTable()
+ .getSelectionIndices();
+ CSSSelectionEventManager.getInstance().setHandleSelection(false);
+ selectedClassesTableViewer.remove(selection.toArray());
+ for (int i = 0; i < selectedIndices.length; i++) {
+ if (selectedIndices[i] == i) {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(), i);
+ item.setData(selectedItems[i]);
+ } else {
+ TableItem item = new TableItem(selectedClassesTableViewer
+ .getTable(), selectedClassesTableViewer.getTable()
+ .getStyle(), selectedIndices[i] - 1);
+ item.setData(selectedItems[i]);
+ }
+ }
+ selectedClassesTableViewer.refresh();
+ selectedClassesTableViewer.setSelection(new StructuredSelection(
+ selectedItems));
+ updateStyles();
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ Object ob = e.getSource();
+ if (ob.equals(leftButton)) {
+ handleRemoveClass();
+ } else if (ob.equals(rightButton)) {
+ handleAddClass();
+ } else if (ob.equals(upButton)) {
+ handleMoveUp();
+ } else if (ob.equals(downButton)) {
+ handleMoveDown();
+ }
+ }
+
+ private void handleRemoveClass() {
+ TableItem[] selectedItems = selectedClassesTableViewer.getTable()
+ .getSelection();
+ if (selectedItems != null && selectedItems.length > 0) {
+ List<String> itemsToRemove = new ArrayList<String>(0);
+ for (int i = 0; i < selectedItems.length; i++) {
+ itemsToRemove.add(selectedItems[i].getData().toString());
+ }
+ selectedClassesTableViewer.remove(itemsToRemove.toArray());
+ updateStyles();
+ }
+ }
+
+ private void handleAddClass() {
+ Set<String> itemsToMove = new LinkedHashSet<String>(0);
+ TreeItem[] selectedItems = allCSSStyleClassViewer.getTree()
+ .getSelection();
+ if (selectedItems != null && selectedItems.length > 0) {
+ for (int i = 0; i < selectedItems.length; i++) {
+ TreeItem item = selectedItems[i];
+ CSSContainer container = ((CSSTreeNode) item.getData())
+ .getCSSContainer();
+ CSSTreeNode treeNode = (CSSTreeNode) item.getData();
+ if ((container instanceof CSSStyleSheetContainer)) {
+ List<CSSTreeNode> children = treeNode.getChildren();
+ for (int j = 0; j < children.size(); j++) {
+ itemsToMove.add(children.get(j).toString());
+ }
+ } else if (container instanceof CSSRuleContainer) {
+ itemsToMove.add(treeNode.toString());
+ }
+ }
+ selectedClassesTableViewer.add(itemsToMove.toArray());
+ updateStyles();
+ allCSSStyleClassViewer.setSelection(new StructuredSelection());
+ }
+ }
+
+ private void createLayout() {
+ final GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 4;
+ setLayout(gridLayout);
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = VIEWER_HEIGHT;
+ gridData.widthHint = VIEWER_WIDTH;
+ allCSSStyleClassViewer.getTree().setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.heightHint = VIEWER_HEIGHT;
+ gridData.widthHint = VIEWER_WIDTH;
+ selectedClassesTableViewer.getTable().setLayoutData(gridData);
+
+ final GridLayout moveBtnContGridLayout = new GridLayout();
+ moveBtnContGridLayout.numColumns = 1;
+ moveButtonsContainer.setLayout(moveBtnContGridLayout);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = BUTTOND_WIDTH;
+ rightButton.setLayoutData(gridData);
+
+ gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.widthHint = BUTTOND_WIDTH;
+ leftButton.setLayoutData(gridData);
+
+ final GridLayout tableBtnContGridLayout = new GridLayout();
+ tableBtnContGridLayout.numColumns = 1;
+ tableButtonsContainer.setLayout(tableBtnContGridLayout);
+ }
+
+ public void updateStyles() {
+ String[] selectedItems = getItemsFromSelectedTable();
+ styleAttributes.clear();
+ if (filter == null) {
+ filter = new CSSSelectorFilter();
+ allCSSStyleClassViewer.addFilter(filter);
+ }
+ filter.removeAllFilters();
+ if (selectedItems != null && selectedItems.length != 0) {
+ selectedItems = getSortedStyleClasses(selectedItems);
+ for (int i = 0; i < selectedItems.length; i++) {
+ if (selectedItems[i] != null) {
+ styleAttributes.putAll(allCSSClassStyles
+ .get(selectedItems[i]));
+ filter.addFilterName(selectedItems[i]);
+ }
+ }
+ }
+ allCSSStyleClassViewer.refresh();
+ }
+
+ public String getCSSStyleClasses() {
+ StringBuilder stringBuilder = new StringBuilder(""); //$NON-NLS-1$
+ String[] selectedItems = getItemsFromSelectedTable();
+ if (selectedItems != null && selectedItems.length != 0) {
+ for (int i = 0; i < selectedItems.length - 1; i++) {
+ stringBuilder.append(selectedItems[i] + " "); //$NON-NLS-1$
+ }
+ stringBuilder.append(selectedItems[selectedItems.length - 1]);
+ }
+ return stringBuilder.toString();
+ }
+
+ private String[] getSortedStyleClasses(String[] unsortedClasses) {
+ String[] sortedStyleClasses = new String[unsortedClasses.length];
+ if (allCSSClassStyles != null) {
+ Set<String> keySet = allCSSClassStyles.keySet();
+ int iter = 0;
+ for (Iterator<String> iterator = keySet.iterator(); iterator
+ .hasNext();) {
+ String styleClassName = iterator.next();
+ for (int i = 0; i < unsortedClasses.length; i++) {
+ if (unsortedClasses[i].equals(styleClassName)) {
+ sortedStyleClasses[iter] = styleClassName;
+ iter++;
+ continue;
+ }
+ }
+ }
+ }
+ return sortedStyleClasses;
+ }
+
+ private String[] getItemsFromSelectedTable() {
+ TableItem[] selectedTableItems = selectedClassesTableViewer.getTable()
+ .getItems();
+ java.util.List<String> selectedItemsList = new ArrayList<String>(0);
+ if (selectedTableItems != null) {
+ for (int i = 0; i < selectedTableItems.length; i++) {
+ selectedItemsList.add((String) selectedTableItems[i].getData());
+ }
+ }
+ return selectedItemsList.toArray(new String[0]);
+ }
+
+ private void fireClassSelectionChanged(
+ final CSSClassSelectionChangedEvent event) {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ final ICSSClassSelectionChangedListener listener = changedListeners
+ .get(i);
+ SafeRunner.run(new SafeRunnable() {
+ public void run() throws Exception {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ listener.classSelectionChanged(event);
+ }
+ }
+ });
+ }
+ }
+
+ public synchronized void addCSSClassSelectionChangedListener(
+ ICSSClassSelectionChangedListener listener) {
+ changedListeners.add(listener);
+ }
+
+ public synchronized void removeCSSClassSelectionChangedListener(
+ ICSSClassSelectionChangedListener listener) {
+ changedListeners.remove(listener);
+ }
+
+ @Override
+ public void dispose() {
+ for (int i = 0; i < changedListeners.size(); i++) {
+ removeCSSClassSelectionChangedListener(changedListeners.get(i));
+ }
+ changedListeners = null;
+ super.dispose();
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPreview.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPreview.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSSelectorPreview.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,106 @@
+package org.jboss.tools.jst.css.dialog.selector;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.IElementComparer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.wst.css.core.internal.modelhandler.CSSModelLoader;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
+import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.selection.CSSClassSelectionChangedEvent;
+import
org.jboss.tools.jst.css.dialog.selector.selection.ICSSClassSelectionChangedListener;
+import org.w3c.dom.css.CSSRuleList;
+
+@SuppressWarnings("restriction")
+public class CSSSelectorPreview extends Composite implements
+ ICSSClassSelectionChangedListener, IElementComparer {
+
+ private ISelection prevSelection;
+ private StructuredTextViewer viewer;
+ private ICSSModel model;
+ private ICSSStyleSheet styleSheet;
+
+ public CSSSelectorPreview(Composite parent) {
+ super(parent, SWT.BORDER);
+ setLayout(new FillLayout());
+ initPreview();
+ }
+
+ private void initPreview() {
+ StructuredTextViewerConfiguration baseConfiguration = new
StructuredTextViewerConfigurationCSS();
+
+ viewer = new StructuredTextViewer(this, null, null, false, SWT.BORDER
+ | SWT.V_SCROLL | SWT.H_SCROLL);
+ ((StructuredTextViewer) viewer).getTextWidget().setFont(
+ JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
+
+ viewer.configure(baseConfiguration);
+ CSSModelLoader cssModelLoader = new CSSModelLoader();
+ IStructuredModel model = cssModelLoader.createModel();
+ this.model = (ICSSModel) model;
+ styleSheet = (ICSSStyleSheet) this.model.getDocument();
+ viewer.setDocument(model.getStructuredDocument());
+ viewer.setEditable(false);
+ }
+
+ public void classSelectionChanged(final CSSClassSelectionChangedEvent event) {
+ CSSRuleContainer[] containers = event.getSelectedRuleContainers();
+ if (containers.length != 0) {
+ List<CSSRuleContainer> ruleContainerList = new
ArrayList<CSSRuleContainer>(0);
+ for (int i = 0; i < containers.length; i++) {
+ ruleContainerList.add(containers[i]);
+ }
+ ISelection newSelection = new StructuredSelection(ruleContainerList, this);
+ if (prevSelection == null) {
+ prevSelection = new StructuredSelection(ruleContainerList, this);
+ clearPreview();
+ for (int i = 0; i < containers.length; i++) {
+ appendRuleFromContainer(containers[i]);
+ }
+ }
+ if (!prevSelection.equals(newSelection)) {
+ clearPreview();
+ for (int i = 0; i < containers.length; i++) {
+ appendRuleFromContainer(containers[i]);
+ }
+ prevSelection = newSelection;
+ }
+ }
+ }
+
+ private void appendRuleFromContainer(CSSRuleContainer container) {
+ StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
+ ICSSStyleRule rule = (ICSSStyleRule) container.getRule();
+ String text = rule.getCssText();
+ String styleDef = text.substring(text.indexOf('{'));
+ builder.append("." + container.getSelectorName() + styleDef); //$NON-NLS-1$
+ styleSheet.appendRule(styleSheet.createCSSRule(builder.toString()));
+ }
+
+ private void clearPreview() {
+ CSSRuleList ruleList = styleSheet.getCssRules();
+ for (int i = 0; i < ruleList.getLength(); i++) {
+ styleSheet.removeRule(ruleList.item(i));
+ }
+ }
+
+ public boolean equals(Object a, Object b) {
+ return a.equals(b);
+ }
+
+ public int hashCode(Object element) {
+ return 0;
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSStyleClassSelector.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSStyleClassSelector.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/CSSStyleClassSelector.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.css.dialog.selector;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.common.model.ui.widgets.Split;
+import org.jboss.tools.jst.css.dialog.AbstractCSSDialog;
+import org.jboss.tools.jst.jsp.messages.JstUIMessages;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleClassSelectorInterface;
+
+/**
+ *
+ * @author yzhishko
+ *
+ */
+
+public class CSSStyleClassSelector extends AbstractCSSDialog implements
CSSStyleClassSelectorInterface {
+
+ private String currentCSSStyleClass;
+ private CSSSelectorPartComposite cssClassComposite;
+ private String selectesCSSStylesClasses;
+ private CSSSelectorPreview preview;
+
+ public CSSStyleClassSelector(Shell shell) {
+ super(shell);
+ setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
+ | SWT.APPLICATION_MODAL);
+ }
+
+ @Override
+ protected Composite createControlComposite(Composite parent) {
+ // Create down splitter container
+ Split controlsContainer = new Split(parent, SWT.VERTICAL);
+ controlsContainer.setLayout(new GridLayout());
+ controlsContainer.setLayoutData(new GridData(GridData.FILL,
+ GridData.FILL, true, true));
+ cssClassComposite = createCSSClassComposite(controlsContainer);
+ preview = createPreviewComposite(controlsContainer);
+ cssClassComposite.addCSSClassSelectionChangedListener(preview);
+ return controlsContainer;
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite composite = (Composite) super.createContents(parent);
+ return composite;
+ }
+
+ private CSSSelectorPartComposite createCSSClassComposite(Composite parent) {
+ return new CSSSelectorPartComposite(getStyleAttributes(), parent,
+ currentCSSStyleClass);
+ }
+
+ public void setCurrentStyleClass(String value) {
+ currentCSSStyleClass = value;
+ }
+
+ public String getCSSStyleClasses() {
+ return selectesCSSStylesClasses;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == OK) {
+ selectesCSSStylesClasses = cssClassComposite.getCSSStyleClasses();
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(JstUIMessages.CSS_SELECTOR_TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ setTitle(JstUIMessages.CSS_SELECTOR_TITLE);
+ return super.createDialogArea(parent);
+ }
+
+ private CSSSelectorPreview createPreviewComposite(Composite parent) {
+ return new CSSSelectorPreview(parent);
+ }
+
+}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTableDragAdapter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDragAdapter.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTableDragAdapter.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+package org.jboss.tools.jst.css.dialog.selector.dnd;
import java.util.ArrayList;
import java.util.List;
@@ -22,8 +22,8 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Tree;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
+import org.jboss.tools.jst.css.dialog.selector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorTableViewer;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTableDropAdapter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTableDropAdapter.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTableDropAdapter.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+package org.jboss.tools.jst.css.dialog.selector.dnd;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -26,14 +26,14 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSSelectionEventManager;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
+import org.jboss.tools.jst.css.dialog.selector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.selection.CSSSelectionEventManager;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorTableViewer;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorTreeViewer;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTreeDragAdapter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/dnd/CSSTreeDragAdapter.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/dnd/CSSTreeDragAdapter.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd;
+package org.jboss.tools.jst.css.dialog.selector.dnd;
import java.util.ArrayList;
import java.util.Iterator;
@@ -25,12 +25,12 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSSelectorPartComposite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
+import org.jboss.tools.jst.css.dialog.selector.CSSSelectorPartComposite;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.viewers.CSSSelectorTreeViewer;
import org.w3c.dom.css.CSSRule;
/**
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSContainer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSContainer.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSContainer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSJSPRecognizer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSJSPRecognizer.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSJSPRecognizer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import java.util.ArrayList;
import java.util.LinkedHashMap;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSRuleContainer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSRuleContainer.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSRuleContainer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import org.w3c.dom.css.CSSRule;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorTableModel.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTableModel.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorTableModel.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import java.util.ArrayList;
import java.util.List;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorTreeModel.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorTreeModel.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorTreeModel.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import java.util.ArrayList;
import java.util.List;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorUtils.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSSelectorUtils.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSSelectorUtils.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import java.io.IOException;
import java.io.StringReader;
@@ -17,7 +17,7 @@
import java.util.List;
import java.util.StringTokenizer;
import org.eclipse.wst.css.core.internal.parser.CSSTokenizer;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
/**
*
@@ -45,7 +45,7 @@
}
}
} catch (IOException e) {
- JspEditorPlugin.getPluginLog().logError(e);
+ CSSPlugin.getDefault().logError(e);
}
return className.substring(className.indexOf('.') + 1);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSStyleSheetContainer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSStyleSheetContainer.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSStyleSheetContainer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import org.w3c.dom.css.CSSStyleSheet;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSTreeNode.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/model/CSSTreeNode.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/model/CSSTreeNode.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model;
+package org.jboss.tools.jst.css.dialog.selector.model;
import java.util.ArrayList;
import java.util.List;
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSClassSelectionChangedEvent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSClassSelectionChangedEvent.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSClassSelectionChangedEvent.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+package org.jboss.tools.jst.css.dialog.selector.selection;
import java.util.ArrayList;
import java.util.Iterator;
@@ -17,9 +17,9 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
/**
* yzhishko
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSSelectionEventManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSSelectionEventManager.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSSelectionEventManager.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,10 +9,10 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+package org.jboss.tools.jst.css.dialog.selector.selection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTreeModel;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSTableSelectionChangedEvent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTableSelectionChangedEvent.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSTableSelectionChangedEvent.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,12 +9,12 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+package org.jboss.tools.jst.css.dialog.selector.selection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTreeModel;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSTreeSelectionChangedEvent.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/CSSTreeSelectionChangedEvent.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/CSSTreeSelectionChangedEvent.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+package org.jboss.tools.jst.css.dialog.selector.selection;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -18,11 +18,11 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.TreeSelection;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/ICSSClassSelectionChangedListener.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/selection/ICSSClassSelectionChangedListener.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/selection/ICSSClassSelectionChangedListener.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection;
+package org.jboss.tools.jst.css.dialog.selector.selection;
/**
*
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorFilter.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorFilter.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorFilter.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,13 +9,13 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+package org.jboss.tools.jst.css.dialog.selector.viewers;
import java.util.HashSet;
import java.util.Set;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTableContentProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableContentProvider.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTableContentProvider.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+package org.jboss.tools.jst.css.dialog.selector.viewers;
import java.util.List;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTableViewer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTableViewer.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTableViewer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,10 +9,11 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+package org.jboss.tools.jst.css.dialog.selector.viewers;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.DisposeEvent;
@@ -20,9 +21,9 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.TableItem;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTableModel;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTableModel;
/**
*
@@ -33,8 +34,8 @@
public class CSSSelectorTableViewer extends TableViewer {
public final static String CSS_SELECTOR_TABLE_VIWER_ID =
"css_selector_table_viwer"; //$NON-NLS-1$
- private Image CSS_STYLE_CLASS_IMAGE = JspEditorPlugin.getImageDescriptor(
- Constants.IMAGE_STYLE_CLASS_LOCATION).createImage();
+ private Image CSS_STYLE_CLASS_IMAGE = CSSPlugin.getImageDescriptor(
+ Util.IMAGE_STYLE_CLASS_LOCATION).createImage();
private CSSSelectorTableModel model;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeContentProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeContentProvider.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeContentProvider.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,11 +9,11 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+package org.jboss.tools.jst.css.dialog.selector.viewers;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
/**
*
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeLabelProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeLabelProvider.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeLabelProvider.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,15 +9,15 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+package org.jboss.tools.jst.css.dialog.selector.viewers;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSRuleContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSStyleSheetContainer;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSTreeNode;
/**
*
@@ -27,10 +27,10 @@
public class CSSSelectorTreeLabelProvider extends LabelProvider {
- private Image CSS_STYLE_SHEET_IMAGE = JspEditorPlugin.getImageDescriptor(
- Constants.IMAGE_STYLE_SHEET_LOCATION).createImage();
- private Image CSS_STYLE_CLASS_IMAGE = JspEditorPlugin.getImageDescriptor(
- Constants.IMAGE_STYLE_CLASS_LOCATION).createImage();
+ private Image CSS_STYLE_SHEET_IMAGE = CSSPlugin.getImageDescriptor(
+ Util.IMAGE_STYLE_SHEET_LOCATION).createImage();
+ private Image CSS_STYLE_CLASS_IMAGE = CSSPlugin.getImageDescriptor(
+ Util.IMAGE_STYLE_CLASS_LOCATION).createImage();
@Override
public Image getImage(Object element) {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeViewer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/viewers/CSSSelectorTreeViewer.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/selector/viewers/CSSSelectorTreeViewer.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,11 +9,11 @@
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers;
+package org.jboss.tools.jst.css.dialog.selector.viewers;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
+import org.jboss.tools.jst.css.dialog.selector.model.CSSSelectorTreeModel;
/**
*
Copied: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/BaseTabControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/BaseTabControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/BaseTabControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import java.util.List;
import java.util.Map;
@@ -43,21 +43,21 @@
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.css.CSSPlugin;
+import org.jboss.tools.jst.css.dialog.FontFamilyDialog;
+import org.jboss.tools.jst.css.dialog.ImageSelectionDialog;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.CSSStyleValueValidator;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.css.dialog.widgets.CSSTreeItemWidgetValueProperty;
+import org.jboss.tools.jst.css.dialog.widgets.CSSWidget;
+import org.jboss.tools.jst.css.dialog.widgets.CSSWidgetValueProperty;
+import org.jboss.tools.jst.css.dialog.widgets.ImageCombo;
+import org.jboss.tools.jst.css.dialog.widgets.SizeCombo;
+import org.jboss.tools.jst.css.dialog.widgets.SizeText;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.FontFamilyDialog;
-import org.jboss.tools.jst.jsp.outline.cssdialog.ImageSelectionDialog;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSStyleValueValidator;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
-import org.jboss.tools.jst.jsp.outline.cssdialog.widgets.CSSTreeItemWidgetValueProperty;
-import org.jboss.tools.jst.jsp.outline.cssdialog.widgets.CSSWidget;
-import org.jboss.tools.jst.jsp.outline.cssdialog.widgets.CSSWidgetValueProperty;
-import org.jboss.tools.jst.jsp.outline.cssdialog.widgets.ImageCombo;
-import org.jboss.tools.jst.jsp.outline.cssdialog.widgets.SizeCombo;
-import org.jboss.tools.jst.jsp.outline.cssdialog.widgets.SizeText;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* This is base tab control component that should be re-implemented by
@@ -159,7 +159,7 @@
GridData.CENTER, true, false));
Button button = createButton(wrapper,
- Constants.IMAGE_FONTLARGE_FILE_LOCATION,
+ Util.IMAGE_FONTLARGE_FILE_LOCATION,
JstUIMessages.FONT_FAMILY_TIP);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
@@ -197,7 +197,7 @@
}
Button button = createButton(wrapper,
- Constants.IMAGE_COLORLARGE_FILE_LOCATION,
+ Util.IMAGE_COLORLARGE_FILE_LOCATION,
JstUIMessages.COLOR_TIP);
button.addSelectionListener(new SelectionAdapter() {
@@ -236,7 +236,7 @@
}
Button button = createButton(wrapper,
- Constants.IMAGE_FOLDERLARGE_FILE_LOCATION,
+ Util.IMAGE_FOLDERLARGE_FILE_LOCATION,
JstUIMessages.BACKGROUND_IMAGE);
button.addSelectionListener(new SelectionAdapter() {
@@ -401,7 +401,7 @@
false));
button.setToolTipText(tooltip);
- button.setImage(JspEditorPlugin.getImageDescriptor(imageFile)
+ button.setImage(CSSPlugin.getImageDescriptor(imageFile)
.createImage());
button.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
@@ -425,7 +425,7 @@
Control control = null;
if (CSSConstants.CSS_STYLE_VALUES_MAP.keySet().contains(property)) {
- if (property.indexOf(CSSConstants.COLOR) != Constants.DONT_CONTAIN) {
+ if (property.indexOf(Constants.COLOR) != Constants.DONT_CONTAIN) {
control = addColorComposite(parent, property);
} else if (Constants.elemFolder.contains(property)) {
control = addImageFileComposite(parent,
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/ICSSTabControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/ICSSTabControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/ICSSTabControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,4 +1,4 @@
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
public interface ICSSTabControl {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabBackgroundControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBackgroundControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabBackgroundControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,14 +8,14 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
/**
* Class for creating control in Background tab
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabBoxesControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabBoxesControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabBoxesControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,14 +8,14 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
/**
* Class for creating control in Boxes tab
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabPreviewControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPreviewControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabPreviewControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.source.SourceViewer;
@@ -19,8 +19,8 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.ICSSDialogModel;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
+import org.jboss.tools.jst.css.dialog.common.ICSSDialogModel;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
/**
* Class for creating Preview sheet tab
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabPropertySheetControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabPropertySheetControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabPropertySheetControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import java.util.ArrayList;
import java.util.Set;
@@ -25,9 +25,9 @@
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
/**
* Class for creating Property sheet tab
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabQuickEditControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabQuickEditControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabQuickEditControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import java.util.ArrayList;
import java.util.Collections;
@@ -18,8 +18,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
/**
* Class for creating control in Quick edit tab
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabTextControl.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/tabs/TabTextControl.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/tabs/TabTextControl.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,14 +8,15 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.tabs;
+package org.jboss.tools.jst.css.dialog.tabs;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.jst.css.dialog.common.CSSConstants;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* Class for creating Text tab controls
@@ -45,7 +46,7 @@
// Add COLOR element
addLabel(this, JstUIMessages.COLOR);
- addColorComposite(this, CSSConstants.COLOR);
+ addColorComposite(this, Constants.COLOR);
// Add FONT_SIZE element
addLabel(this, JstUIMessages.FONT_SIZE);
Copied:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets (from
rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSTreeItemWidgetValueProperty.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/CSSTreeItemWidgetValueProperty.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSTreeItemWidgetValueProperty.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.widgets;
+package org.jboss.tools.jst.css.dialog.widgets;
import org.eclipse.jface.databinding.swt.WidgetValueProperty;
import org.eclipse.swt.widgets.TreeItem;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSWidget.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/CSSWidget.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSWidget.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.widgets;
+package org.jboss.tools.jst.css.dialog.widgets;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSWidgetValueProperty.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/CSSWidgetValueProperty.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/CSSWidgetValueProperty.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.widgets;
+package org.jboss.tools.jst.css.dialog.widgets;
import org.eclipse.jface.databinding.swt.WidgetValueProperty;
import org.eclipse.swt.SWT;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/ImageCombo.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/ImageCombo.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/ImageCombo.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.widgets;
+package org.jboss.tools.jst.css.dialog.widgets;
import java.util.Arrays;
@@ -40,7 +40,7 @@
import org.eclipse.swt.widgets.TypedListener;
import org.eclipse.swt.widgets.Widget;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/SizeCombo.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/SizeCombo.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/SizeCombo.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.widgets;
+package org.jboss.tools.jst.css.dialog.widgets;
import java.util.List;
@@ -21,8 +21,8 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/SizeText.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/widgets/SizeText.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/dialog/widgets/SizeText.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.widgets;
+package org.jboss.tools.jst.css.dialog.widgets;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -19,8 +19,8 @@
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
+import org.jboss.tools.jst.css.dialog.common.Util;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/CSSUIMessages.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -5,6 +5,20 @@
public class CSSUIMessages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.tools.jst.css.messages.messages"; //$NON-NLS-1$
public static String CSSPreview_DefaultBrowserText;
+ public static String CSS_CLASS_NAME_LABEL;
+ public static String WIZARD_WINDOW_TITLE;
+ public static String WIZARD_TITLE;
+ public static String WIZARD_DESCRIPTION;
+ public static String WIZARD_ERROR_FILE_SELECTION;
+ public static String WIZARD_ERROR_EMPTY_CLASSNAME;
+ public static String WIZARD_ERROR_INVALID_CLASSNAME;
+
+ public static String FILE_SELECT_DIALOG_EMPTY_MESSAGE;
+ public static String FILE_SELECT_DIALOG_MESSAGE;
+ public static String FILE_SELECT_DIALOG_TITLE;
+ public static String FILE_SELECT_LABEL;
+ public static String FILE_SELECT_BUTTON;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, CSSUIMessages.class);
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/messages/messages.properties 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1 +1,14 @@
-CSSPreview_DefaultBrowserText=Double click to edit preview.
\ No newline at end of file
+FILE_SELECT_DIALOG_EMPTY_MESSAGE=No CSS file in the current project
+FILE_SELECT_DIALOG_MESSAGE=Select CSS file from the tree:
+FILE_SELECT_DIALOG_TITLE=CSS File Selection
+FILE_SELECT_LABEL=CSS File
+FILE_SELECT_BUTTON=Browse
+
+CSSPreview_DefaultBrowserText=Double click to edit preview.
+CSS_CLASS_NAME_LABEL=CSS Class
+WIZARD_WINDOW_TITLE=CSS Style Class Editor
+WIZARD_TITLE=CSS Class
+WIZARD_DESCRIPTION=Create New CSS Class
+WIZARD_ERROR_FILE_SELECTION=No file specified
+WIZARD_ERROR_EMPTY_CLASSNAME=Class name is empty
+WIZARD_ERROR_INVALID_CLASSNAME = Class name is not valid
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCSSSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCSSSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/AbstractCSSSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -14,11 +14,10 @@
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BackgroundSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -12,8 +12,8 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBackgroundControl;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabBackgroundControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/BoxesSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -12,8 +12,8 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBoxesControl;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabBoxesControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/CSSPropertyPage.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -25,8 +25,8 @@
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.jboss.tools.jst.css.common.StyleContainer;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
import org.jboss.tools.jst.css.view.CSSEditorView;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/MessageCSSSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/MessageCSSSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/MessageCSSSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -24,7 +24,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/PropertiesSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -12,8 +12,8 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPropertySheetControl;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabPropertySheetControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/QuickEditSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -14,8 +14,8 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabQuickEditControl;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabQuickEditControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/properties/TextSection.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -12,8 +12,8 @@
package org.jboss.tools.jst.css.properties;
import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabTextControl;
+import org.jboss.tools.jst.css.dialog.tabs.BaseTabControl;
+import org.jboss.tools.jst.css.dialog.tabs.TabTextControl;
/**
* @author Sergey Dzmitrovich
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSEditorView.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -11,7 +11,6 @@
package org.jboss.tools.jst.css.view;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPart;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/view/CSSPreview.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -36,7 +36,7 @@
import org.jboss.tools.jst.css.common.ICSSViewListner;
import org.jboss.tools.jst.css.common.StyleContainer;
import org.jboss.tools.jst.css.messages.CSSUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* @author Sergey Dzmitrovich
Copied: trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard (from
rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css)
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/NewCSSClassWizard.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/NewCSSClassWizard.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/NewCSSClassWizard.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.web.ui.wizards.css;
+package org.jboss.tools.jst.css.wizard;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -27,8 +27,8 @@
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSClassDialog;
-import org.jboss.tools.jst.web.ui.wizards.messages.WebUIMessages;
+import org.jboss.tools.jst.css.dialog.CSSClassDialog;
+import org.jboss.tools.jst.css.messages.CSSUIMessages;
/**
* New CSS class wizard.
@@ -52,7 +52,7 @@
*/
public NewCSSClassWizard() {
super();
- setWindowTitle(WebUIMessages.WIZARD_WINDOW_TITLE);
+ setWindowTitle(CSSUIMessages.WIZARD_WINDOW_TITLE);
}
/**
@@ -157,8 +157,8 @@
*/
public NewCSSClassWizardPage() {
super("newCSSClassWizard"); //$NON-NLS-1$
- setTitle(WebUIMessages.WIZARD_TITLE);
- setDescription(WebUIMessages.WIZARD_DESCRIPTION);
+ setTitle(CSSUIMessages.WIZARD_TITLE);
+ setDescription(CSSUIMessages.WIZARD_DESCRIPTION);
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/WizardNewCssClassPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/css/WizardNewCssClassPage.java 2010-12-03
11:32:19 UTC (rev 27140)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/wizard/WizardNewCssClassPage.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -9,7 +9,7 @@
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.jst.web.ui.wizards.css;
+package org.jboss.tools.jst.css.wizard;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
@@ -34,10 +34,10 @@
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSSelectorValidator;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.FileExtensionFilter;
-import org.jboss.tools.jst.web.ui.wizards.css.NewCSSClassWizard.CSSClassDescription;
-import org.jboss.tools.jst.web.ui.wizards.messages.WebUIMessages;
+import org.jboss.tools.jst.css.dialog.common.CSSSelectorValidator;
+import org.jboss.tools.jst.css.dialog.common.FileExtensionFilter;
+import org.jboss.tools.jst.css.messages.CSSUIMessages;
+import org.jboss.tools.jst.css.wizard.NewCSSClassWizard.CSSClassDescription;
/**
* @author Sergey Dzmitrovich
@@ -59,8 +59,8 @@
public WizardNewCssClassPage(CSSClassDescription classDescription) {
super("WizardNewCssClassPage"); //$NON-NLS-1$
this.classDescription = classDescription;
- setTitle(WebUIMessages.WIZARD_TITLE);
- setDescription(WebUIMessages.WIZARD_DESCRIPTION);
+ setTitle(CSSUIMessages.WIZARD_TITLE);
+ setDescription(CSSUIMessages.WIZARD_DESCRIPTION);
}
@@ -79,7 +79,7 @@
container.setLayout(layout);
Label selectFileLabel = new Label(container, SWT.NONE);
- selectFileLabel.setText(WebUIMessages.FILE_SELECT_LABEL
+ selectFileLabel.setText(CSSUIMessages.FILE_SELECT_LABEL
+ REQUIRED_FIELD_SIGN);
selectFileText = new Text(container, SWT.SINGLE | SWT.BORDER);
@@ -87,7 +87,7 @@
selectFileText.setFont(parent.getFont());
Button selectFileButton = new Button(container, SWT.NONE);
- selectFileButton.setText(WebUIMessages.FILE_SELECT_BUTTON);
+ selectFileButton.setText(CSSUIMessages.FILE_SELECT_BUTTON);
selectFileButton.addSelectionListener(new SelectionAdapter() {
@Override
@@ -96,8 +96,8 @@
getShell(), new WorkbenchLabelProvider(),
new BaseWorkbenchContentProvider());
dialog.addFilter(new FileExtensionFilter(fileExtensions));
- dialog.setTitle(WebUIMessages.FILE_SELECT_DIALOG_TITLE);
- dialog.setMessage(WebUIMessages.FILE_SELECT_DIALOG_MESSAGE);
+ dialog.setTitle(CSSUIMessages.FILE_SELECT_DIALOG_TITLE);
+ dialog.setMessage(CSSUIMessages.FILE_SELECT_DIALOG_MESSAGE);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setAllowMultiple(false);
dialog.setDoubleClickSelects(true);
@@ -113,14 +113,14 @@
}
return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
IStatus.ERROR,
- WebUIMessages.WIZARD_ERROR_FILE_SELECTION, null);
+ CSSUIMessages.WIZARD_ERROR_FILE_SELECTION, null);
}
});
if (classDescription.getCssFile() != null) {
dialog.setInitialSelection(classDescription.getCssFile());
}
dialog
- .setEmptyListMessage(WebUIMessages.FILE_SELECT_DIALOG_EMPTY_MESSAGE);
+ .setEmptyListMessage(CSSUIMessages.FILE_SELECT_DIALOG_EMPTY_MESSAGE);
if (dialog.open() == Window.OK) {
classDescription.setCssFile((IResource) dialog
@@ -133,7 +133,7 @@
});
Label classNameLabel = new Label(container, SWT.NONE);
- classNameLabel.setText(WebUIMessages.CSS_CLASS_NAME_LABEL
+ classNameLabel.setText(CSSUIMessages.CSS_CLASS_NAME_LABEL
+ REQUIRED_FIELD_SIGN);
classNameText = new Text(container, SWT.SINGLE | SWT.BORDER);
@@ -165,13 +165,13 @@
classDescription.setCssFile(getResource(selectFileText.getText()));
if (getCssFile(selectFileText.getText()) == null) {
- setErrorMessage(WebUIMessages.WIZARD_ERROR_FILE_SELECTION);
+ setErrorMessage(CSSUIMessages.WIZARD_ERROR_FILE_SELECTION);
} else if ((classNameText.getText() == null)
|| (classNameText.getText().length() == 0)) {
- setErrorMessage(WebUIMessages.WIZARD_ERROR_EMPTY_CLASSNAME);
+ setErrorMessage(CSSUIMessages.WIZARD_ERROR_EMPTY_CLASSNAME);
} else if (!CSSSelectorValidator.getInstance().isValidSelector(
classNameText.getText())) {
- setErrorMessage(WebUIMessages.WIZARD_ERROR_INVALID_CLASSNAME);
+ setErrorMessage(CSSUIMessages.WIZARD_ERROR_INVALID_CLASSNAME);
} else {
setErrorMessage(null);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2010-12-07 09:50:36 UTC
(rev 27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/META-INF/MANIFEST.MF 2010-12-07 10:41:14 UTC
(rev 27207)
@@ -7,6 +7,7 @@
Bundle-SymbolicName: org.jboss.tools.jst.jsp;singleton:=true
Bundle-Localization: plugin
Export-Package: org.jboss.tools.jst.jsp,
+ org.jboss.tools.jst.jsp.bundle,
org.jboss.tools.jst.jsp.contentassist,
org.jboss.tools.jst.jsp.contentassist.computers,
org.jboss.tools.jst.jsp.contentassist.xpl,
@@ -14,23 +15,18 @@
org.jboss.tools.jst.jsp.drop.treeviewer.ui,
org.jboss.tools.jst.jsp.editor,
org.jboss.tools.jst.jsp.format,
+ org.jboss.tools.jst.jsp.i18n,
org.jboss.tools.jst.jsp.jspeditor,
org.jboss.tools.jst.jsp.jspeditor.dnd,
org.jboss.tools.jst.jsp.messages,
org.jboss.tools.jst.jsp.outline,
- org.jboss.tools.jst.jsp.outline.cssdialog,
- org.jboss.tools.jst.jsp.outline.cssdialog.common,
- org.jboss.tools.jst.jsp.outline.cssdialog.parsers,
- org.jboss.tools.jst.jsp.outline.cssdialog.tabs,
- org.jboss.tools.jst.jsp.outline.cssdialog.widgets,
+ org.jboss.tools.jst.jsp.outline.css,
org.jboss.tools.jst.jsp.preferences,
+ org.jboss.tools.jst.jsp.selection,
org.jboss.tools.jst.jsp.support.kb,
org.jboss.tools.jst.jsp.text,
org.jboss.tools.jst.jsp.ui.action,
- org.jboss.tools.jst.jsp.util,
- org.jboss.tools.jst.jsp.selection,
- org.jboss.tools.jst.jsp.i18n,
- org.jboss.tools.jst.jsp.bundle
+ org.jboss.tools.jst.jsp.util
Require-Bundle: org.jboss.tools.common.el.core,
org.jboss.tools.common.model.ui,
org.jboss.tools.jst.web,
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-12-07 09:50:36 UTC (rev
27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-12-07 10:41:14 UTC (rev
27207)
@@ -6,7 +6,8 @@
name="%occurrenceStructureProvidersExtensionPoint" />
<extension-point id="visulaEditorImplementations" name="Visual Editor
Implementations" schema="schema/visulaEditorImplementations.exsd" />
<extension-point id="editorContentAssistent"
name="editorContentAssistent"
schema="schema/editorContentAssistent.exsd"/>
- <extension-point id="localeProvider" name="Locale provider for an
opened file" schema="schema/localeProvider.exsd"/>
+ <extension-point id="localeProvider" name="Locale provider for an
opened file" schema="schema/localeProvider.exsd"/>
+ <extension-point id="cssDialog" name="cssDialog"
schema="schema/cssDialog.exsd"/>
<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
@@ -247,36 +248,6 @@
label="Move">
</action>
</editorContribution>-->
- <editorContribution
- id="org.jboss.tools.jst.jsp.cssClassDialogEditorContribution"
- targetID="org.eclipse.wst.css.core.csssource.source">
- <menu
- id="org.jboss.tools.jst.jsp.cssClassDialogSubMenu"
- label="CSS"
- path="additions">
- <groupMarker
- name="content">
- </groupMarker>
- <separator
- name="additions">
- </separator>
- </menu>
- <action
-
class="org.jboss.tools.jst.jsp.outline.cssdialog.OpenCSSDialogActionDelegate"
- definitionId="org.jboss.tools.jst.jsp.commands.openCSSDialog"
- hoverIcon="$nl$/images/cssdialog/color_large.gif"
- icon="$nl$/images/cssdialog/color_large.gif"
- id="org.jboss.tools.jst.jsp.openCSSDialogEditor"
- label="Open edit dialog"
-
menubarPath="org.jboss.tools.jst.jsp.cssClassDialogSubMenu/content"
- style="push"
- toolbarPath="Normal/additions"
- tooltip="Open CSS Dialog based on the active CSS file">
- <!--<selection
- class="org.eclipse.core.resources.IFile">
- </selection>-->
- </action>
- </editorContribution>
</extension>
<extension
@@ -750,31 +721,6 @@
-->
</extension>
<extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="true"
- id="org.jboss.tools.jst.jsp.cssDialogPopupMenu"
- nameFilter="*.css"
- objectClass="org.eclipse.core.resources.IResource">
- <action
-
class="org.jboss.tools.jst.jsp.outline.cssdialog.OpenCSSDialogActionDelegate"
- definitionId="org.jboss.tools.jst.jsp.commands.openCSSDialog"
- icon="$nl$/images/cssdialog/color_large.gif"
- id="org.jboss.tools.jst.jsp.openCSSDialogPopupMenu"
- label="Open CSS Dialog"
- menubarPath="additions"
- tooltip="Open CSS Dialog based on the active CSS file">
- </action>
- <menu
- id="org.jboss.tools.jst.jsp.popupSubMenu"
- label="Open CSS Dialog"
- path="additions">
- <groupMarker name="content"/>
- <separator name="additions"/>
- </menu>
- </objectContribution>
- </extension>
- <extension
point="org.eclipse.ui.commands">
<category
description="CSSDialog"
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/cssDialog.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/cssDialog.exsd
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/cssDialog.exsd 2010-12-07 10:41:14
UTC (rev 27207)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.jst.jsp"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.jst.jsp"
id="cssDialog" name="cssDialog"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="css-dialogs-builder"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="css-dialogs-builder">
+ <complexType>
+ <attribute name="class" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/bundle/BundleMap.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -52,8 +52,8 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.i18n.MainLocaleProvider;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogContentProposalProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogContentProposalProvider.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogContentProposalProvider.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -40,7 +40,7 @@
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.jsp.outline.ValueHelper;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.PageProcessor;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizard.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -51,7 +51,7 @@
import org.jboss.tools.jst.jsp.jspeditor.dnd.JSPPaletteInsertHelper;
import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.jst.web.tld.TaglibData;
import org.jboss.tools.jst.web.tld.URIConstants;
import org.w3c.dom.Element;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardPage.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -79,7 +79,7 @@
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.jspeditor.SourceEditorPageContext;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.jst.jsp.util.FaceletsUtil;
import org.jboss.tools.jst.web.project.WebProject;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsWizardRegisterBundlePage.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -29,7 +29,7 @@
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.ui.ModelUIImages;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* The Class ExternalizeStringsWizardRegisterBundlePage.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -34,10 +34,9 @@
import org.jboss.tools.common.model.ui.objecteditor.ExtendedCellEditorProvider;
import org.jboss.tools.jst.jsp.contentassist.JSPDialogContentProposalProvider;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSStyleDialog;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.CSSStyleClassSelector;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleClassSelectorDecorator;
+import org.jboss.tools.jst.jsp.outline.css.CSSStyleDialogDecorator;
+import org.jboss.tools.jst.jsp.util.Constants;
/**
* @author Kabanovich Cell Editor for JSP attributes, of which values can be
@@ -76,8 +75,8 @@
}
String attributeName = Constants.EMPTY +
context.getProperty("attributeName"); //$NON-NLS-1$
- if(attributeName.equalsIgnoreCase(CSSConstants.STYLE)
- || attributeName.equalsIgnoreCase(CSSConstants.CLASS)) {
+ if(attributeName.equalsIgnoreCase(Constants.STYLE)
+ || attributeName.equalsIgnoreCase(Constants.CLASS)) {
hasProposals = true;
return;
}
@@ -133,9 +132,9 @@
context.put("value", value); //$NON-NLS-1$
attributeName = attributeName.toLowerCase();
- if (attributeName.equalsIgnoreCase(CSSConstants.CLASS)
- || attributeName.endsWith(CSSConstants.CLASS.toLowerCase())) {
- CSSStyleClassSelector dialog = new
CSSStyleClassSelector(cellEditorWindow.getShell());
+ if (attributeName.equalsIgnoreCase(Constants.CLASS)
+ || attributeName.endsWith(Constants.CLASS.toLowerCase())) {
+ CSSStyleClassSelectorDecorator dialog = new
CSSStyleClassSelectorDecorator(cellEditorWindow.getShell());
dialog.setCurrentStyleClass(value);
if (dialog.open() == Window.OK) {
@@ -144,9 +143,9 @@
return dialog.getCSSStyleClasses();
}
} else
- if (attributeName.equalsIgnoreCase(CSSConstants.STYLE)
- || attributeName.endsWith(CSSConstants.STYLE.toLowerCase())) {
- CSSStyleDialog dialog = new CSSStyleDialog(cellEditorWindow.getShell(),
+ if (attributeName.equalsIgnoreCase(Constants.STYLE)
+ || attributeName.endsWith(Constants.STYLE.toLowerCase())) {
+ CSSStyleDialogDecorator dialog = new
CSSStyleDialogDecorator(cellEditorWindow.getShell(),
((value == null) ? Constants.EMPTY : value));
if (dialog.open() == Window.OK) {
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/AbstractCSSStyleDecorator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/AbstractCSSStyleDecorator.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/AbstractCSSStyleDecorator.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.css;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class AbstractCSSStyleDecorator {
+
+ private static final String CSSStyleDialogExtensionPointName="cssDialog";
//$NON-NLS-1$
+ private static final String
CSSStyleDialogImplementationId="org.jboss.tools.jst.css.dialog.CSSStyleDialog";
//$NON-NLS-1$
+ private CSSDialogBuilderInterface dialogBuilder;
+
+ protected CSSDialogBuilderInterface getCSSDialogBuilder(){
+ if(dialogBuilder==null){
+ try {
+ IExtension visualEditorExtension = Platform.getExtensionRegistry()
+ .getExtension(JspEditorPlugin.PLUGIN_ID,
+ CSSStyleDialogExtensionPointName,
+ CSSStyleDialogImplementationId);
+ if (visualEditorExtension != null) {
+ IConfigurationElement[] configurationElements = visualEditorExtension
+ .getConfigurationElements();
+ if (configurationElements != null
+ && configurationElements.length == 1) {
+ dialogBuilder = (CSSDialogBuilderInterface) configurationElements[0]
+ .createExecutableExtension("class"); //$NON-NLS-1$
+ } else {
+ JspEditorPlugin
+ .getPluginLog()
+ .logError(
+ "CSS Dialog Implementation not available"); //$NON-NLS-1$
+ }
+ } else {
+ JspEditorPlugin.getPluginLog().logError(
+ "CSS Dialog Implementation not available"); //$NON-NLS-1$
+ }
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logError(
+ "CSS Dialog Implementation not available" + e); //$NON-NLS-1$
+ }
+ }
+ return dialogBuilder;
+ }
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSDialogBuilderInterface.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSDialogBuilderInterface.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSDialogBuilderInterface.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.css;
+
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @author mareshkau
+ *
+ */
+public interface CSSDialogBuilderInterface {
+
+ /**
+ * Builds CSS Style Dialog
+ */
+ public CSSStyleDialogInterface buildCSSStyleDialog(Shell shell, String style);
+
+ /**
+ * Builds CSS Class Dialog
+ */
+ public CSSStyleClassSelectorInterface buildCSSClassDialog(Shell parentShell);
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorDecorator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorDecorator.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorDecorator.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.css;
+
+
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ * @author mareshkau
+ *
+ */
+public class CSSStyleClassSelectorDecorator extends AbstractCSSStyleDecorator{
+
+ private CSSStyleClassSelectorInterface cssStyleClassSelector;
+ public CSSStyleClassSelectorDecorator(Shell parentShell) {
+ if(getCSSDialogBuilder()!=null){
+ cssStyleClassSelector=getCSSDialogBuilder().buildCSSClassDialog(parentShell);
+ }
+ }
+
+ public void setCurrentStyleClass(String value) {
+ if(cssStyleClassSelector!=null){
+ cssStyleClassSelector.setCurrentStyleClass(value);
+ }
+
+ }
+
+ public int open() {
+ if(cssStyleClassSelector!=null){
+ return cssStyleClassSelector.open();
+ }
+ return org.eclipse.jface.window.Window.CANCEL;
+ }
+
+ public String getCSSStyleClasses() {
+ if(cssStyleClassSelector!=null){
+ return cssStyleClassSelector.getCSSStyleClasses();
+ }
+ return null;
+ }
+
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorInterface.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorInterface.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleClassSelectorInterface.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.css;
+
+/**
+ * @author mareshkau
+ *
+ */
+public interface CSSStyleClassSelectorInterface {
+
+ public void setCurrentStyleClass(String value);
+
+ public int open();
+
+ public String getCSSStyleClasses();
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogDecorator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogDecorator.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogDecorator.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.css;
+
+
+
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * Decorator for CSS Dialog
+ * @author mareshkau
+ *
+ */
+public class CSSStyleDialogDecorator extends AbstractCSSStyleDecorator{
+
+
+ private CSSStyleDialogInterface cssStyleDialog;
+ private String oldStyle;
+
+ public CSSStyleDialogDecorator(final Shell parentShell,final String style) {
+ if(getCSSDialogBuilder()!=null){
+ cssStyleDialog=getCSSDialogBuilder().buildCSSStyleDialog(parentShell, style);
+ }
+ oldStyle=style;
+ }
+
+ public String getStyle() {
+ if(cssStyleDialog!=null)
+ return cssStyleDialog.getStyle();
+ else return oldStyle;
+ }
+
+ public int open() {
+ if(cssStyleDialog!=null)
+ return cssStyleDialog.open();
+ else return Window.CANCEL;
+ }
+
+}
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogInterface.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogInterface.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/css/CSSStyleDialogInterface.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.outline.css;
+
+public interface CSSStyleDialogInterface {
+ public String getStyle();
+ public int open();
+}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/AbstractCSSDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,286 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import java.util.Map;
-
-import org.eclipse.core.databinding.AggregateValidationStatus;
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.observable.ChangeEvent;
-import org.eclipse.core.databinding.observable.IChangeListener;
-import org.eclipse.core.databinding.observable.value.IValueChangeListener;
-import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.common.model.ui.ModelUIImages;
-import org.jboss.tools.common.model.ui.widgets.Split;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-
-/**
- * @author Sergey Dzmitrovich
- *
- */
-public abstract class AbstractCSSDialog extends TitleAreaDialog {
-
- private Browser browser;
-
- private Text previewText;
-
- private String previewContent;
-
- private StyleAttributes styleAttributes;
-
- private StyleComposite styleComposite;
-
- private DataBindingContext bindingContext = new DataBindingContext();
-
- private AggregateValidationStatus aggregateStatus;
-
- private IStatus status = Status.OK_STATUS;
-
- final public static int DEFAULT_DIALOG_WIDTH = 500;
- final public static int DEFAULT_DIALOG_HEIGHT = 500;
- final public static int DEFAULT_BROWTHER_WEIGHT = 15;
- final public static int DEFAULT_CONTROLS_WEIGHT = 85;
-
- /**
- *
- */
- public AbstractCSSDialog(Shell shell) {
- super(shell);
-
- previewContent = JstUIMessages.DEFAULT_TEXT_FOR_BROWSER_PREVIEW;
- styleAttributes = new StyleAttributes();
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- /*
- * Set the dialog image
- */
- setTitleImage(ModelUIImages.getImageDescriptor(
- ModelUIImages.WIZARD_DEFAULT).createImage());
-
- Composite parentComposite = (Composite) super.createDialogArea(parent);
- GridData gridData = (GridData) parentComposite.getLayoutData();
- gridData.heightHint = DEFAULT_DIALOG_HEIGHT;
- gridData.widthHint = DEFAULT_DIALOG_WIDTH;
-
- createControlPane(parentComposite);
-
- return parentComposite;
- }
-
- public Composite createControlPane(Composite parent) {
-
- getStyleAttributes().addChangeListener(new IChangeListener() {
-
- public void handleChange(ChangeEvent event) {
- handleStyleChanged();
-
- }
-
- });
-
- aggregateStatus = new AggregateValidationStatus(
- getBindingContext().getValidationStatusProviders(),
- AggregateValidationStatus.MAX_SEVERITY);
- aggregateStatus.addValueChangeListener(new IValueChangeListener() {
- public void handleValueChange(ValueChangeEvent event) {
-
- handleStatusChanged((IStatus) event.diff.getNewValue());
- }
- });
-
- // Create split component that separates dialog on 2 parts
- Split dialogContainer = new Split(parent, SWT.VERTICAL);
-
- createBrowserComposite(dialogContainer);
- createControlComposite(dialogContainer);
-
- dialogContainer.setWeights(new int[] { DEFAULT_BROWTHER_WEIGHT,
- DEFAULT_CONTROLS_WEIGHT });
- dialogContainer.setLayoutData(new GridData(GridData.FILL,
- GridData.BEGINNING, true, true));
-
- return dialogContainer;
- }
-
- protected Composite createControlComposite(Composite parent) {
-
- // Create down splitter container
- Composite controlsContainer = new Composite(parent, SWT.None);
- controlsContainer.setLayout(new GridLayout());
- controlsContainer.setLayoutData(new GridData(GridData.FILL,
- GridData.FILL, true, true));
-
- createExtensionComposite(controlsContainer);
- styleComposite = createStyleComposite(controlsContainer);
-
- return controlsContainer;
-
- }
-
- protected void createExtensionComposite(Composite parent) {
-
- }
-
- /**
- *
- * @param parent
- */
- protected Composite createBrowserComposite(final Composite parent) {
-
- final SashForm previewComposite = new SashForm(parent, SWT.None);
- previewComposite.setLayout(new GridLayout());
- GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
- true);
- previewComposite.setLayoutData(gridData);
-
- browser = new Browser(previewComposite, SWT.BORDER | SWT.MOZILLA);
- browser.setText(generateBrowserPage());
- browser.setLayoutData(gridData);
- browser.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent e) {
- if (e.widget == browser) {
- browser.setEnabled(false);
- previewComposite.setMaximizedControl(previewText);
- previewText.setFocus();
- }
- }
- });
-
- previewText = new Text(previewComposite, SWT.NONE | SWT.H_SCROLL);
- previewText.setLayoutData(gridData);
- previewText.setText(getPreviewContent());
- previewText.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- if (e.widget == previewText) {
- String text = previewText.getText();
- if (text == null || text.equals(Constants.EMPTY)) {
- setPreviewContent(JstUIMessages.DEFAULT_TEXT_FOR_BROWSER_PREVIEW);
- } else {
- setPreviewContent(text);
- }
-
- browser.setEnabled(true);
- browser.setText(generateBrowserPage());
- previewComposite.setMaximizedControl(browser);
- }
- }
- });
-
- previewComposite.setMaximizedControl(browser);
- return previewComposite;
- }
-
- protected StyleComposite createStyleComposite(Composite parent) {
- return new StyleComposite(parent, getStyleAttributes(),
- getBindingContext());
- }
-
- protected void handleStyleChanged() {
- browser.setText(generateBrowserPage());
- }
-
- protected void handleStatusChanged(IStatus newStatus) {
- if (newStatus.isOK() && !status.isOK()) {
- setErrorMessage(null);
- } else if (newStatus.getSeverity() == IStatus.ERROR) {
- setErrorMessage(newStatus.getMessage());
- }
- if (newStatus.getSeverity() != status.getSeverity()) {
- getButton(OK).setEnabled(newStatus.isOK());
- }
-
- status = newStatus;
- }
-
- public IStatus getStatus() {
- return status;
- }
-
- /**
- * /** Method is used to build html body that is appropriate to browse.
- *
- * @return String html text representation
- */
- public String generateBrowserPage() {
- StringBuffer html = new StringBuffer("<style>span{"); //$NON-NLS-1$
-
- for (Map.Entry<String, String> styleItem : getStyleAttributes()
- .entrySet()) {
-
- html.append(styleItem.getKey() + Constants.COLON
- + styleItem.getValue() + Constants.SEMICOLON);
- }
-
- html.append("}</style><span>" + getPreviewContent() +
"</span>"); //$NON-NLS-1$ //$NON-NLS-2$
-
- return html.toString();
- }
-
- public void releaseResources() {
- aggregateStatus.dispose();
- }
-
- @Override
- public boolean close() {
- releaseResources();
- return super.close();
- }
-
- public Browser getBrowser() {
- return browser;
- }
-
- public StyleAttributes getStyleAttributes() {
- return styleAttributes;
- }
-
- public String getPreviewContent() {
- return previewContent;
- }
-
- public void setPreviewContent(String previewContent) {
- this.previewContent = previewContent;
- }
-
- public DataBindingContext getBindingContext() {
- return bindingContext;
- }
-
- public StyleComposite getStyleComposite() {
- return styleComposite;
- }
-
- public void setStatus(IStatus status) {
- this.status = status;
- }
-
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,401 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSModel;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSSelectorValidator;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.ICSSDialogModel;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPreviewControl;
-
-/**
- * This dialog represents CSSClass dialog.
- *
- * @author Igor Zhukov (izhukov(a)exadel.com)
- */
-public class CSSClassDialog extends AbstractCSSDialog {
-
- // model is the core of the CSS Class Dialog, it manages style attributes
- private ICSSDialogModel cssModel;
-
- // workbench selection when the wizard was started
- protected IStructuredSelection selection;
-
- private IFile file;
-
- private Text fileText;
-
- // css style classes
- private Combo classCombo;
-
- private String selectorLabel;
-
- private Button addNewClassButton;
-
- // apply button
- private Button applyButton;
-
- // preview tab
- private TabPreviewControl preview;
-
- /**
- *
- * @param parentShell
- * @param file
- * @param selection
- */
- public CSSClassDialog(Shell parentShell, IFile file,
- IStructuredSelection selection) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
- | SWT.APPLICATION_MODAL);
-
- this.file = file;
- this.cssModel = new CSSModel(file);
- this.selection = selection;
-
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(JstUIMessages.CSS_STYLE_CLASS_EDITOR_TITLE);
-
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control contents = super.createContents(parent);
- updateControlPane();
- return contents;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- setTitle(JstUIMessages.CSS_STYLE_CLASS_EDITOR_TITLE);
- return super.createDialogArea(parent);
- }
-
- @Override
- protected StyleComposite createStyleComposite(Composite parent) {
- StyleComposite styleComposite = super.createStyleComposite(parent);
-
- // add preview tab to styleComposite
- preview = new TabPreviewControl(styleComposite.getTabFolder(),
- getStyleAttributes(), cssModel);
- styleComposite.createTabItem(preview, preview,
- JstUIMessages.PREVIEW_SHEET_TAB_NAME,
- JstUIMessages.PREVIEW_SHEET_TAB_NAME);
-
- return styleComposite;
- }
-
- @Override
- protected void createExtensionComposite(final Composite parent) {
- Composite fileControlPanel = new Composite(parent, SWT.BORDER);
- fileControlPanel.setLayoutData(new GridData(GridData.FILL,
- GridData.BEGINNING, true, false));
- fileControlPanel.setLayout(new GridLayout(3, false));
-
- // add file path control
- addLabel(fileControlPanel, JstUIMessages.CSS_CLASS_DIALOG_FILE_LABEL);
-
- GridData fileLayoutData = new GridData(GridData.FILL, GridData.CENTER,
- true, false);
- fileLayoutData.horizontalSpan = 2;
-
- fileText = new Text(fileControlPanel, SWT.BORDER | SWT.READ_ONLY);
- fileText.setLayoutData(fileLayoutData);
-
- // add class control
- addLabel(fileControlPanel,
- JstUIMessages.CSS_CLASS_DIALOG_STYLE_CLASS_LABEL);
-
- classCombo = new Combo(fileControlPanel, SWT.BORDER | SWT.READ_ONLY);
- classCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER,
- true, false));
-
- // this listener is responsible for processing dialog header message
- // events
- classCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- handleSelectorSwitched();
- }
- });
- // creates a button for add new class
- addNewClassButton = new Button(fileControlPanel, SWT.PUSH);
- addNewClassButton.setText(JstUIMessages.BUTTON_ADD_NEW_STYLE_CLASS);
- addNewClassButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- InputDialog dlg = new InputDialog(parent.getShell(),
- JstUIMessages.ENTER_CSS_CLASS_NAME,
- JstUIMessages.ENTER_CSS_CLASS_NAME, classCombo
- .getText(), CSSSelectorValidator.getInstance());
- if (dlg.open() == Window.OK) {
- addNewClass(dlg.getValue().trim());
- }
- }
- });
-
- }
-
- @Override
- protected Composite createControlComposite(Composite parent) {
- Composite controlComposite = super.createControlComposite(parent);
- createCustomButtonPanel(controlComposite);
-
- return controlComposite;
- }
-
- /**
- *
- * @param parent
- * @param label
- */
- protected Label addLabel(Composite parent, String label) {
- Label labelControl = new Label(parent, SWT.LEFT);
- labelControl.setLayoutData(new GridData(GridData.END, GridData.CENTER,
- false, false));
- labelControl.setText(label);
- return labelControl;
- }
-
- /**
- * This method is used to create custom button panel.
- *
- * @param parent
- * Composite component
- */
- private void createCustomButtonPanel(Composite parent) {
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- buttonComposite.setLayoutData(new GridData(GridData.END,
- GridData.BEGINNING, true, false));
- buttonComposite.setLayout(new GridLayout());
- // add APPLY button
- applyButton = createCustomButton(buttonComposite,
- JstUIMessages.BUTTON_APPLY, JstUIMessages.CSS_APPLY_CHANGES,
- false);
- applyButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- save();
- applyButton.setEnabled(false);
- }
- });
- // add CLEAR button
- Button clearButton = createCustomButton(buttonComposite,
- JstUIMessages.BUTTON_CLEAR,
- JstUIMessages.CSS_CLEAR_STYLE_SHEET, true);
- clearButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- getStyleComposite().clearStyleComposite();
- getStyleComposite().updateCurrentTab();
- }
- });
- }
-
- /**
- * This method is used to create custom button.
- *
- * @param parent
- * Composite component
- * @param label
- * Button label value
- */
- protected Button createCustomButton(Composite parent, String label,
- String tooltip, boolean defaultState) {
- // increment the number of columns in the button bar
- ((GridLayout) parent.getLayout()).numColumns++;
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- button.setToolTipText(tooltip);
- button.setEnabled(defaultState);
- return button;
- }
-
- /**
- * Method is used to correctly process style class change operation.
- */
- protected void handleSelectorSwitched() {
- if (selectorLabel != null)
- cssModel.updateCSSStyle(selectorLabel, getStyleAttributes());
- selectorLabel = classCombo.getText();
- preview.setSelector(selectorLabel);
- classCombo.setToolTipText(cssModel.getCSSRuleText(selectorLabel));
- getStyleComposite().setStyleProperties(
- cssModel.getClassProperties(selectorLabel));
- getStyleComposite().updateCurrentTab();
- }
-
- /**
- * Add New Class to CSS Class Dialog
- *
- * @param styleClassName
- * - name of new style class
- */
- public void addNewClass(String styleClassName) {
- // add new css class
- String newSelectorLabel = cssModel.addCSSRule(styleClassName);
- // add it to combobox
- classCombo.add(newSelectorLabel);
- // select new class, after it in handleSelectorSwitched() dialog will be
- // updated
- classCombo.select(classCombo.getItemCount() - 1);
-
- //this is require
- applyButton.setEnabled(true);
- }
-
- @Override
- public void releaseResources() {
-
- super.releaseResources();
- preview.releaseModel();
-
- if (cssModel != null) {
- cssModel.release();
- cssModel = null;
- }
- }
-
- /**
- * Method should be called in case of dialog closure operation.
- */
- public void save() {
- cssModel.updateCSSStyle(selectorLabel, getStyleAttributes());
- cssModel.save();
- }
-
- /**
- * TODO Gets current selected style class value.
- *
- * @return selector name
- */
- public String getSelectorName() {
- return Util.formatCSSSelectorToStyleClassView(selectorLabel);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#close()
- */
- @Override
- public boolean close() {
- int code = getReturnCode();
- switch (code) {
- case OK:
- save();
- break;
- case CANCEL:
- default:
- // make some closure operation
- }
- return super.close();
- }
-
- public void reinit() {
- preview.releaseModel();
- cssModel.setFile(file);
- cssModel.reinit();
- preview.reinit(cssModel);
- getStyleComposite().clearStyleComposite();
- updateControlPane();
-
- }
-
- public void setFile(IFile file) {
- this.file = file;
- }
-
- @Override
- protected void handleStyleChanged() {
- super.handleStyleChanged();
-
- if (getStatus().isOK())
- applyButton.setEnabled(true);
-
- }
-
- @Override
- protected void handleStatusChanged(IStatus newStatus) {
-
- if (newStatus.getSeverity() != getStatus().getSeverity()) {
- applyButton.setEnabled(newStatus.isOK());
- getButton(OK).setEnabled(newStatus.isOK());
- classCombo.setEnabled(newStatus.isOK());
- addNewClassButton.setEnabled(newStatus.isOK());
- }
-
- super.handleStatusChanged(newStatus);
- }
-
- protected void updateControlPane() {
-
- fileText.setText(file.getFullPath().toString());
- classCombo.removeAll();
- classCombo.setEnabled(true);
- selectorLabel = cssModel
- .getSelectorLabel(Util.getSelectionInFile(file).x);
-
- getStyleComposite().setStyleProperties(
- cssModel.getClassProperties(selectorLabel));
- preview.setSelector(selectorLabel);
-
- List<String> selectors = cssModel.getSelectorLabels();
- for (int i = 0; i < selectors.size(); i++) {
- String label = selectors.get(i);
- classCombo.add(label);
- if (label.equals(selectorLabel))
- classCombo.select(i);
-
- }
-
- if(classCombo.getSelectionIndex() == -1 ){
- classCombo.select(0);
- }
-
- applyButton.setEnabled(false);
-
- }
-
- protected Button getApplyButton() {
- return applyButton;
- }
-
- protected Button getAddNewClassButton() {
- return addNewClassButton;
- }
-
- protected Combo getClassCombo() {
- return classCombo;
- }
-
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSStyleDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.CSSConstants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
-
-/**
- * Class for CSS editor dialog
- *
- * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
- */
-public class CSSStyleDialog extends AbstractCSSDialog {
-
- public CSSStyleDialog(final Shell parentShell, String style) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
- | SWT.APPLICATION_MODAL);
-
- getStyleAttributes().setStyleProperties(parseStyle(style));
-
- }
-
- public String getStyle() {
- return getStyleAttributes().getStyle();
- }
-
- protected Map<String, String> parseStyle(String styleString) {
-
- Map<String, String> properties = new HashMap<String, String>();
-
- if ((styleString != null) && (styleString.length() > 0)) {
-
- String[] styles = styleString.split(Constants.SEMICOLON);
- for (String styleElement : styles) {
- String[] styleElementParts = styleElement.trim().split(
- Constants.COLON);
- if ((styleElementParts != null)
- && (styleElementParts.length == 2)
- && Util.searchInElement(styleElementParts[0],
- CSSConstants.CSS_STYLES_MAP)) {
-
- properties.put(styleElementParts[0], styleElementParts[1]);
- }
- }
-
- }
- return properties;
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(JstUIMessages.CSS_STYLE_EDITOR_TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- setTitle(JstUIMessages.CSS_STYLE_EDITOR_TITLE);
- return super.createDialogArea(parent);
- }
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/FontFamilyDialog.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/FontFamilyDialog.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/FontFamilyDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,488 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TableItem;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Class for choosing CCS font-family attribute
- *
- * @author dsakovich(a)exadel.com
- */
-public class FontFamilyDialog extends Dialog implements SelectionListener {
-
- private static final int VIEWER_HEIGHT = 300;
- private static final int BUTTOND_WIDTH = 50;
- private static final int VIEWER_WIDTH = 175;
-
- /** Font family string */
- private String fontFamily;
-
- /** Existing font family */
- private String existFontFamily;
- private TableViewer fontFamilyTable;
- private TableViewer allFontFamilyTable;
- private Button rightButton;
- private Button leftButton;
- private Composite buttonsContainer;
- private static final String ALL_FONTS_TABLE_SOURCE = "all_fonts_table_source";
//$NON-NLS-1$
- private static final String FONTS_TABLE_SOURCE = "fonts_table_source";
//$NON-NLS-1$
-
- /**
- * Constructor
- *
- * @param parentShell
- * parent shell
- * @param existingFontFamily
- * existing font family
- */
- public FontFamilyDialog(Shell parentShell, String existingFontFamily) {
- super(parentShell);
- this.existFontFamily = existingFontFamily;
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
- @Override
- protected Control createDialogArea(Composite parent) {
- final Composite composite = (Composite) super.createDialogArea(parent);
- initControls(composite);
- createLayout(composite);
- initListeners();
- initDND();
- initDefaultContent(composite);
- return composite;
- }
-
- private void initDefaultContent(Composite composite) {
- Set<String> s = new HashSet<String>();
- FontData[] fds = composite.getDisplay().getFontList(null, false);
-
- for (int i = 0; i < fds.length; ++i) {
- s.add(fds[i].getName());
- }
- fds = composite.getDisplay().getFontList(null, true);
-
- for (int i = 0; i < fds.length; ++i) {
- s.add(fds[i].getName());
- }
- String[] existFonts = fontFamilyParser();
- Arrays.sort(existFonts);
-
- String[] answer = new String[s.size()];
- s.toArray(answer);
- Arrays.sort(answer);
-
- for (int i = 0; i < answer.length; i++) {
- allFontFamilyTable.add(answer[i]);
- }
-
- if ((existFontFamily != null)
- && !existFontFamily.equals(Constants.EMPTY)) {
- for (int i = 0; i < existFonts.length; i++) {
- fontFamilyTable.add(existFonts[i]);
- allFontFamilyTable.remove(existFonts[i]);
- }
- }
- }
-
- private void initDND() {
- Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
-
- allFontFamilyTable.addDragSupport(DND.DROP_MOVE, types,
- new DragSourceListener() {
-
- public void dragFinished(DragSourceEvent event) {
- if (event.doit) {
- if (event.detail == DND.DROP_MOVE) {
- handleAddFont();
- }
- }
- }
-
- public void dragSetData(DragSourceEvent event) {
- event.data = ALL_FONTS_TABLE_SOURCE;
- }
-
- public void dragStart(DragSourceEvent event) {
- event.doit = allFontFamilyTable.getTable()
- .getSelectionCount() > 0;
- }
- });
-
- allFontFamilyTable.addDropSupport(DND.DROP_MOVE, types,
- new DropTargetAdapter() {
-
- @Override
- public void drop(DropTargetEvent event) {
- if (event.data == null
- || event.data.equals(ALL_FONTS_TABLE_SOURCE)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
-
- });
-
- fontFamilyTable.addDragSupport(DND.DROP_MOVE, types,
- new DragSourceListener() {
-
- public void dragFinished(DragSourceEvent event) {
- if (event.doit) {
- if (event.detail == DND.DROP_MOVE) {
- handleRemoveFont();
- }
- }
- }
-
- public void dragSetData(DragSourceEvent event) {
- event.data = FONTS_TABLE_SOURCE;
- }
-
- public void dragStart(DragSourceEvent event) {
- event.doit = fontFamilyTable.getTable()
- .getSelectionCount() > 0;
- }
- });
-
- fontFamilyTable.addDropSupport(DND.DROP_MOVE, types,
- new DropTargetAdapter() {
- @Override
- public void drop(DropTargetEvent event) {
- if (event.data == null
- || event.data.equals(FONTS_TABLE_SOURCE)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- });
-
- }
-
- private void initListeners() {
- /** Control listeners */
- allFontFamilyTable.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- handleAddFont();
- }
- });
-
- allFontFamilyTable
- .addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- fontFamilyTable.getTable().deselectAll();
- leftButton.setEnabled(false);
- rightButton.setEnabled(true);
- }
- });
-
- fontFamilyTable
- .addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- allFontFamilyTable.getTable().deselectAll();
- rightButton.setEnabled(false);
- leftButton.setEnabled(true);
- }
- });
-
- fontFamilyTable.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- handleRemoveFont();
- }
- });
-
- fontFamilyTable.getTable().addKeyListener(new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- if (SWT.ARROW_LEFT == e.keyCode && SWT.ALT == e.stateMask) {
- handleRemoveFont();
- }
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
-
- allFontFamilyTable.getTable().addKeyListener(new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- if (SWT.ARROW_RIGHT== e.keyCode && SWT.ALT == e.stateMask) {
- handleAddFont();
- }
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
-
- rightButton.addSelectionListener(this);
- leftButton.addSelectionListener(this);
- }
-
- private void createLayout(Composite composite) {
- final GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 3;
- composite.setLayout(gridLayout);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- composite.setLayoutData(gridData);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = VIEWER_HEIGHT;
- gridData.widthHint = VIEWER_WIDTH;
- allFontFamilyTable.getTable().setLayoutData(gridData);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = VIEWER_HEIGHT;
- gridData.widthHint = VIEWER_WIDTH;
- fontFamilyTable.getTable().setLayoutData(gridData);
-
- final GridLayout btmContGridLayout = new GridLayout();
- btmContGridLayout.numColumns = 1;
- buttonsContainer.setLayout(btmContGridLayout);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.widthHint = BUTTOND_WIDTH;
- rightButton.setLayoutData(gridData);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.widthHint = BUTTOND_WIDTH;
- leftButton.setLayoutData(gridData);
-
- }
-
- private void initControls(Composite composite) {
- allFontFamilyTable = new TableViewer(composite, SWT.MULTI
- | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- buttonsContainer = new Composite(composite, SWT.NONE);
- rightButton = new Button(buttonsContainer, SWT.PUSH);
- leftButton = new Button(buttonsContainer, SWT.PUSH);
- fontFamilyTable = new TableViewer(composite, SWT.MULTI | SWT.BORDER
- | SWT.V_SCROLL | SWT.H_SCROLL);
- rightButton.setToolTipText(JstUIMessages.ADD_FONT_FAMILY_TIP);
- ImageDescriptor rightDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_RIGHT_FILE_LOCATION);
- Image rightImage = rightDesc.createImage();
- rightButton.setImage(rightImage);
- rightButton.setEnabled(false);
- rightButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- Button button = (Button) e.getSource();
- button.getImage().dispose();
- }
- });
-
- leftButton.setToolTipText(JstUIMessages.REMOVE_FONT_FAMILY_TIP);
-
- ImageDescriptor leftDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_LEFT_FILE_LOCATION);
- Image leftImage = leftDesc.createImage();
- leftButton.setImage(leftImage);
- leftButton.setEnabled(false);
- leftButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- Button button = (Button) e.getSource();
- button.getImage().dispose();
- }
- });
- }
-
- private void handleAddFont() {
- TableItem[] selectedItems = allFontFamilyTable.getTable()
- .getSelection();
- if (selectedItems != null) {
- Object[] data = new Object[selectedItems.length];
- for (int i = 0; i < selectedItems.length; i++) {
- data[i] = selectedItems[i].getData();
- }
- fontFamilyTable.add(data);
- allFontFamilyTable.remove(data);
- rightButton.setEnabled(false);
- leftButton.setEnabled(false);
- }
-
- }
-
- private void handleRemoveFont() {
- TableItem[] selectedItems = fontFamilyTable.getTable().getSelection();
- if (selectedItems != null) {
- Object[] data = new Object[selectedItems.length];
- for (int i = 0; i < selectedItems.length; i++) {
- data[i] = selectedItems[i].getData();
- }
- addFonts(allFontFamilyTable, data);
- fontFamilyTable.remove(data);
- rightButton.setEnabled(false);
- leftButton.setEnabled(false);
- }
- }
-
- /**
- * Set title for dialog
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(JstUIMessages.FONT_FAMILY_DIALOG_TITLE);
- }
-
- /**
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- @Override
- protected void okPressed() {
- TableItem[] items = fontFamilyTable.getTable().getItems();
- StringBuffer buf = new StringBuffer();
-
- for (int i = 0; i < items.length; i++) {
- buf.append(((i == 0) ? Constants.EMPTY : Constants.COMMA)
- + items[i].getData());
- }
-
- fontFamily = buf.toString();
- super.okPressed();
- }
-
- /**
- * Method for add to font to sorted list
- *
- * @param table
- * @param fonts
- */
- private void addFonts(TableViewer table, Object[] fonts) {
- Set<Object> s = new HashSet<Object>();
- TableItem[] items = table.getTable().getItems();
-
- for (int i = 0; i < items.length; i++) {
- s.add(items[i].getData());
- }
-
- for (int i = 0; i < fonts.length; i++) {
- s.add(fonts[i]);
- }
- table.getTable().removeAll();
-
- String[] answer = new String[s.size()];
- s.toArray(answer);
- Arrays.sort(answer);
-
- for (int i = 0; i < answer.length; i++) {
- table.add(answer[i]);
- }
- }
-
- /**
- * Getter for fontFamily attribute
- *
- * @return fontFamily
- */
- public String getFontFamily() {
- return fontFamily;
- }
-
- /**
- * Setter for fontFamily attribute
- *
- * @param fontFamily
- */
- public void setFontFamily(String fontFamily) {
- this.fontFamily = fontFamily;
- }
-
- /**
- * Method for parse font family string
- *
- * @param font
- * family string
- * @return list font family
- */
- private String[] fontFamilyParser() {
- existFontFamily = existFontFamily.trim();
-
- return existFontFamily.split(Constants.COMMA);
- }
-
- /**
- * Selection listener
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- Object ob = e.getSource();
-
- if (ob.equals(leftButton)) {
- handleRemoveFont();
- } else if (ob.equals(rightButton)) {
- handleAddFont();
- } else if (ob.equals(allFontFamilyTable)) {
- fontFamilyTable.getTable().deselectAll();
- leftButton.setEnabled(false);
- rightButton.setEnabled(true);
- } else if (ob.equals(fontFamilyTable)) {
- allFontFamilyTable.getTable().deselectAll();
- rightButton.setEnabled(false);
- leftButton.setEnabled(true);
- }
- }
-
- /**
- * Selection listener
- *
- * @see org.eclipse.swt.events.SelectionListener#widgetSelected(SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- Object ob = e.getSource();
-
- if (ob.equals(leftButton)) {
- handleRemoveFont();
- } else if (ob.equals(rightButton)) {
- handleAddFont();
- }
- }
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/ImageSelectionDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,696 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
-import org.eclipse.ui.dialogs.ISelectionStatusValidator;
-import org.eclipse.ui.dialogs.SelectionStatusDialog;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.FileExtensionFilter;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-
-/**
- * Class for creating images selection dialog
- *
- * @author dsakovich(a)exadel.com
- */
-@SuppressWarnings("restriction")
-public class ImageSelectionDialog extends SelectionStatusDialog {
- @SuppressWarnings("nls")
- final static String[][] fileExtensions = {
- { "jpeg", "jpg", "jpe", "jfif" },
- { "gif" },
- { "bmp" },
- { "tif", "tiff" },
- { "png" },
- { "ico" }
- };
- private Combo filterCombo;
- private Canvas canvas;
- private IFile file;
- private Text resolution;
- private Color emptyColor;
- private TreeViewer fViewer;
- private ILabelProvider fLabelProvider;
- private ITreeContentProvider fContentProvider;
- private ISelectionStatusValidator fValidator = null;
- private ViewerComparator fComparator;
- private boolean fAllowMultiple = true;
- private boolean fDoubleClickSelects = true;
- private String fEmptyListMessage =
WorkbenchMessages.ElementTreeSelectionDialog_nothing_available;
- private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID,
IStatus.OK, Constants.EMPTY, null);
- private List<ViewerFilter> fFilters;
- private Object fInput;
- private boolean fIsEmpty;
- private int fWidth = 60;
- private int fHeight = 18;
-
- /**
- * Constructs an instance of <code>ImageSelectionDialog</code>.
- *
- * @param parent
- * The parent shell for the dialog
- * @param labelProvider
- * the label provider to render the entries
- * @param contentProvider
- * the content provider to evaluate the tree structure
- */
- public ImageSelectionDialog(Shell parent, ILabelProvider labelProvider,
- ITreeContentProvider contentProvider) {
- super(parent);
-
- fLabelProvider = labelProvider;
- fContentProvider = contentProvider;
-
- setResult(new ArrayList<Object>(0));
- setStatusLineAboveButtons(true);
-
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
- }
-
- /**
- * Sets the initial selection. Convenience method.
- *
- * @param selection
- * the initial selection.
- */
- public void setInitialSelection(Object selection) {
- setInitialSelections(new Object[] { selection });
- }
-
- /**
- * Sets the message to be displayed if the list is empty.
- *
- * @param message
- * the message to be displayed.
- */
- public void setEmptyListMessage(String message) {
- fEmptyListMessage = message;
- }
-
- /**
- * Specifies if multiple selection is allowed.
- *
- * @param allowMultiple
- */
- public void setAllowMultiple(boolean allowMultiple) {
- fAllowMultiple = allowMultiple;
- }
-
- /**
- * Specifies if default selected events (double click) are created.
- *
- * @param doubleClickSelects
- */
- public void setDoubleClickSelects(boolean doubleClickSelects) {
- fDoubleClickSelects = doubleClickSelects;
- }
-
- /**
- * Sets the sorter used by the tree viewer.
- *
- * @param sorter
- * @deprecated as of 3.3, use
- * {@link ElementTreeSelectionDialog#setComparator(ViewerComparator)}
- * instead
- */
- public void setSorter(ViewerSorter sorter) {
- fComparator = sorter;
- }
-
- /**
- * Sets the comparator used by the tree viewer.
- *
- * @param comparator
- * @since 3.3
- */
- public void setComparator(ViewerComparator comparator) {
- fComparator = comparator;
- }
-
- /**
- * Adds a filter to the tree viewer.
- *
- * @param filter
- * a filter.
- */
- public void addFilter(String[] extention) {
- if (fFilters == null) {
- fFilters = new ArrayList<ViewerFilter>(4);
- }
-
- fFilters.add(new FileExtensionFilter(extention));
- }
-
- /**
- * Sets an optional validator to check if the selection is valid. The
- * validator is invoked whenever the selection changes.
- *
- * @param validator
- * the validator to validate the selection.
- */
- public void setValidator(ISelectionStatusValidator validator) {
- fValidator = validator;
- }
-
- /**
- * Sets the tree input.
- *
- * @param input
- * the tree input.
- */
- public void setInput(Object input) {
- fInput = input;
- }
-
- /**
- * Sets the size of the tree in unit of characters.
- *
- * @param width
- * the width of the tree.
- * @param height
- * the height of the tree.
- */
- public void setSize(int width, int height) {
- fWidth = width;
- fHeight = height;
- }
-
- /**
- * Validate the receiver and update the ok status.
- *
- */
- protected void updateOKStatus() {
- if (!fIsEmpty) {
- if (fValidator != null) {
- fCurrStatus = fValidator.validate(getResult());
- updateStatus(fCurrStatus);
- } else {
- fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK,
"", null); //$NON-NLS-1$
- }
- } else {
- fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR,
- fEmptyListMessage, null);
- }
-
- updateStatus(fCurrStatus);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.window.Window#open()
- */
- public int open() {
- fIsEmpty = evaluateIfTreeEmpty(fInput);
- super.open();
-
- return getReturnCode();
- }
-
- /**
- * Handles cancel button pressed event.
- */
- protected void cancelPressed() {
- setResult(null);
- super.cancelPressed();
- }
-
- /*
- * @see SelectionStatusDialog#computeResult()
- */
- protected void computeResult() {
- setResult(((IStructuredSelection) fViewer.getSelection()).toList());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.window.Window#create()
- */
- public void create() {
- BusyIndicator.showWhile(null,
- new Runnable() {
- public void run() {
- access$superCreate();
- fViewer.setSelection(new
StructuredSelection(getInitialElementSelections()), true);
- updateOKStatus();
- }
- });
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- final Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight =
convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth =
convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing =
convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing =
convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- super.applyDialogFont(composite);
-
- Label messageLabel = createMessageArea(composite);
- new Label(composite, SWT.NONE);
-
- TreeViewer treeViewer = createTreeViewer(composite);
-
- Composite comp = createPreview(composite);
-
- GridData browserData = new GridData(GridData.FILL_BOTH);
- browserData.widthHint = convertWidthInCharsToPixels(fWidth / 2);
- browserData.heightHint = convertHeightInCharsToPixels(fHeight);
- browserData.minimumWidth = convertWidthInCharsToPixels(fWidth / 2);
- browserData.minimumHeight = convertHeightInCharsToPixels(fHeight);
- comp.setLayoutData(browserData);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(fWidth);
- data.heightHint = convertHeightInCharsToPixels(fHeight);
-
- Tree treeWidget = treeViewer.getTree();
- treeWidget.setLayoutData(data);
- treeWidget.setFont(parent.getFont());
-
- filterCombo = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);
- filterCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
-
- filterCombo.add(JstUIMessages.ALL_FILES);
- filterCombo.add(JstUIMessages.ALL_IMAGE_FILES);
-
- for (int i = 0; i < fileExtensions.length; i++) {
- String[] str = fileExtensions[i];
- StringBuffer buf = new StringBuffer();
-
- for (int j = 0; j < str.length; j++) {
- buf.append("*." + str[j].toUpperCase() + "; ");
//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- filterCombo.add(buf.toString());
- }
-
- filterCombo.select(0);
- filterCombo.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- if (fViewer != null) {
- ViewerFilter[] filters = fViewer.getFilters();
-
- if (filters != null) {
- for (int i = 0; i < filters.length; i++) {
- fViewer.removeFilter(filters[i]);
- }
- }
-
- if (filterCombo.getSelectionIndex() != 0) {
- if (filterCombo.getSelectionIndex() == 1) {
- Set<String> s = new HashSet<String>();
-
- for (int i = 0; i < fileExtensions.length; i++) {
- String[] tmp = fileExtensions[i];
-
- for (int j = 0; j < tmp.length; j++)
- s.add(tmp[j]);
- }
-
- String[] allExtensions = new String[s.size()];
- s.toArray(allExtensions);
- fViewer.addFilter(new
FileExtensionFilter(allExtensions));
- } else {
- fViewer.addFilter(new FileExtensionFilter(
- fileExtensions[filterCombo.getSelectionIndex() -
2]));
- }
- }
-
- fViewer.refresh();
-
- if (fViewer.getTree().getItemCount() <= 0) {
- fIsEmpty = true;
- } else {
- fIsEmpty = false;
- }
-
- if (fViewer.getTree().getSelectionCount() <= 0) {
- file = null;
- canvas.redraw();
- }
-
- updateOKStatus();
- }
- }
- });
-
- if (fIsEmpty) {
- messageLabel.setEnabled(false);
- treeWidget.setEnabled(false);
- }
-
- //JBIDE-3084, implementation of default validator
- fValidator = new ISelectionStatusValidator() {
- public IStatus validate(Object[] selection) {
- if ((selection != null) && (selection.length == 1)) {
- Object selecObject = selection[0];
-
- if (selecObject instanceof IFile) {
- return Status.OK_STATUS;
- }
- }
-
- return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID,
IStatus.ERROR,
- JstUIMessages.ImageSelectionDialog_InvalidImageFile, null);
- }
- };
-
- return composite;
- }
-
- /**
- * Creates the tree viewer.
- *
- * @param parent
- * the parent composite
- * @return the tree viewer
- */
- protected TreeViewer createTreeViewer(Composite parent) {
- int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
-
- fViewer = new TreeViewer(new Tree(parent, style));
- fViewer.setContentProvider(fContentProvider);
- fViewer.setLabelProvider(fLabelProvider);
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @SuppressWarnings("unchecked")
- public void selectionChanged(SelectionChangedEvent event) {
- access$setResult(((IStructuredSelection)
event.getSelection()).toList());
- updateOKStatus();
- }
- });
-
- fViewer.getTree().addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- Object obj = getFirstResult();
-
- if (obj instanceof IFile) {
- file = (IFile) getFirstResult();
- } else if (obj instanceof IFolder) {
- file = null;
- }
-
- canvas.redraw();
- }
- });
-
- fViewer.setComparator(fComparator);
-
- if (fFilters != null) {
- for (int i = 0; i != fFilters.size(); i++) {
- fViewer.addFilter(fFilters.get(i));
- }
- }
-
- if (fDoubleClickSelects) {
- Tree tree = fViewer.getTree();
- tree.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {
- updateOKStatus();
-
- if (fCurrStatus.isOK()) {
- access$superButtonPressed(IDialogConstants.OK_ID);
- }
- }
- });
- }
-
- fViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- updateOKStatus();
-
- // If it is not OK or if double click does not
- // select then expand
- if (!(fDoubleClickSelects && fCurrStatus.isOK())) {
- ISelection selection = event.getSelection();
-
- if (selection instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection)
selection).getFirstElement();
-
- if (fViewer.getExpandedState(item)) {
- fViewer.collapseToLevel(item, 1);
- } else {
- fViewer.expandToLevel(item, 1);
- }
- }
- }
- }
- });
-
- fViewer.setInput(fInput);
-
- return fViewer;
- }
-
- /**
- * Returns the tree viewer.
- *
- * @return the tree viewer
- */
- protected TreeViewer getTreeViewer() {
- return fViewer;
- }
-
- /**
- * Set the result using the super class implementation of buttonPressed.
- *
- * @param id
- * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
- */
- protected void access$superButtonPressed(int id) {
- super.buttonPressed(id);
- }
-
- /**
- * Set the result using the super class implementation of setResult.
- *
- * @param result
- * @see SelectionStatusDialog#setResult(int, Object)
- */
- protected void access$setResult(List<Object> result) {
- super.setResult(result);
- }
-
- /**
- * @see org.eclipse.jface.window.Window#handleShellCloseEvent()
- */
- protected void handleShellCloseEvent() {
- super.handleShellCloseEvent();
-
- // Handle the closing of the shell by selecting the close icon
- if (getReturnCode() == CANCEL) {
- setResult(null);
- }
- }
-
- private void access$superCreate() {
- super.create();
- }
-
- /**
- * Create image preview control
- *
- * @param parent
- * @return composite
- */
- private Composite createPreview(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(composite, SWT.NONE);
- label.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false,
false));
- label.setText(JstUIMessages.IMAGE_PREVIEW);
- canvas = new Canvas(composite, SWT.BORDER);
-
- GridData browserData = new GridData(GridData.FILL_BOTH);
- browserData.widthHint = convertWidthInCharsToPixels((fWidth) / 2);
- browserData.heightHint = convertHeightInCharsToPixels(fHeight);
- canvas.setLayoutData(browserData);
-
- resolution = new Text(composite, SWT.READ_ONLY | SWT.CENTER);
- resolution.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false,
false));
- resolution.setVisible(false);
-
- emptyColor = canvas.getForeground();
-
- canvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- GC gc = new GC(canvas);
- gc.setForeground(emptyColor);
- gc.fillRectangle(1, 1, canvas.getSize().x - 2, canvas.getSize().y -
2);
- // resolution.setText("");
- resolution.setVisible(false);
-
- if (file != null) {
- Cursor parentCursor = getShell().getCursor();
- final Cursor waitCursor = new Cursor(getShell().getDisplay(),
SWT.CURSOR_WAIT);
- Point previewPoint = new Point(0, 0);
- Point labelPoint = canvas.getSize();
- InputStream stream = null;
-
- try {
- getShell().setCursor(waitCursor);
- stream = new
FileInputStream(file.getLocation().toOSString());
-
- ImageData imageData = new ImageData(stream);
- stream.close();
-
- if (imageData != null) {
- Image image = new Image(getShell().getDisplay(),
imageData);
-
- // set image in center
- Point imagePoint = new Point(image.getBounds().width,
- image.getBounds().height);
-
- String imageInfo = imagePoint.x + " x " +
imagePoint.y + " px"; //$NON-NLS-1$ //$NON-NLS-2$
-
- // change resolution if image anymore image label
- if ((imagePoint.x > labelPoint.x) || (imagePoint.y
> labelPoint.y)) {
- float ratioImage = (float) imagePoint.x / (float)
imagePoint.y;
-
- if (((imagePoint.y > labelPoint.y) &&
- ((labelPoint.y * ratioImage) >
labelPoint.x)) ||
- ((imagePoint.x > labelPoint.x) &&
- ((labelPoint.x / ratioImage) <
labelPoint.y))) {
- imageData = imageData.scaledTo(labelPoint.x -
10,
- (int) (labelPoint.x / ratioImage));
- } else {
- imageData = imageData.scaledTo((int)
(labelPoint.y * ratioImage) -
- 10, labelPoint.y);
- }
-
- image.dispose();
- image = new Image(getShell().getDisplay(),
imageData);
- imagePoint.x = image.getBounds().width;
- imagePoint.y = image.getBounds().height;
- }
-
- previewPoint.x = (labelPoint.x / 2) - (imagePoint.x /
2);
- previewPoint.y = (labelPoint.y / 2) - (imagePoint.y /
2);
- gc.drawImage(image, previewPoint.x, previewPoint.y);
- resolution.setVisible(true);
- resolution.setText(imageInfo);
- image.dispose();
- gc.dispose();
- }
- } catch (IOException ev) {
- //ignore
- } catch (SWTException ex) {
- //ignore (if select not image file)
- } finally {
- getShell().setCursor(parentCursor);
-
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e1) {
- // ignore
- }
- }
- }
- }
- }
- });
-
- return composite;
- }
-
- private boolean evaluateIfTreeEmpty(Object input) {
- Object[] elements = fContentProvider.getElements(input);
-
- if (elements.length > 0) {
- if (fFilters != null) {
- for (int i = 0; i < fFilters.size(); i++) {
- ViewerFilter curr = fFilters.get(i);
- elements = curr.filter(fViewer, input, elements);
- }
- }
- }
-
- return elements.length == 0;
- }
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/OpenCSSDialogActionDelegate.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/OpenCSSDialogActionDelegate.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/OpenCSSDialogActionDelegate.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,135 +0,0 @@
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * This is CSS dialog action delegate class that process actions that is
- * contributed in Eclipse regarding CSS Dialog.
- *
- * @author Igor Zhukov
- */
-public class OpenCSSDialogActionDelegate implements
- IWorkbenchWindowActionDelegate, IObjectActionDelegate,
- IEditorActionDelegate, IViewActionDelegate {
-
- private Shell shell = null;
- private IStructuredSelection selection;
- private IFile file;
-
- /**
- * Initializes this action delegate with the view it will work in.
- *
- * @param view
- * the view that provides the context for this delegate
- * @see IViewActionDelegate#init(IViewPart)
- */
- public void init(IViewPart view) {
- if (view != null) {
- if (view.getSite() != null) {
- shell = view.getSite().getShell();
- } else if (view.getViewSite() != null) {
- shell = view.getViewSite().getShell();
- }
- }
- }
-
- /**
- * Initializes this action delegate with the view it will work in.
- *
- * @param view
- * the view that provides the context for this delegate
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- if (window != null) {
- shell = window.getShell();
- }
- }
-
- /**
- * Called when the user has selected this action to be executed.
- */
- public void run(IAction action) {
- if ((shell != null) && (file != null)) {
- String styleClass = null;
- CSSClassDialog dialog = new CSSClassDialog(shell, file, selection);
- if (dialog.open() == Window.OK) {
- styleClass = dialog.getSelectorName();
- }
- }
- }
-
- /**
- * Notifies this action delegate that the selection in the workbench has
- * changed.
- *
- * @param action
- * the action proxy that handles presentation portion of the
- * action
- * @param selection
- * the current selection, or <code>null</code> if there is no
- * selection.
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection.getFirstElement() instanceof IFile) {
- this.file = (IFile) ((IStructuredSelection) selection)
- .getFirstElement();
-
- } else {
- this.selection = structuredSelection;
- }
- }
- }
-
- /**
- * Sets the active part for the delegate. This method will be called every
- * time the action appears in a context menu. The targetPart may change with
- * each invocation.
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- if (targetPart != null && targetPart.getSite() != null) {
- shell = targetPart.getSite().getShell();
- }
- }
-
- /**
- * Sets the active editor for the delegate. Implementors should disconnect
- * from the old editor, connect to the new editor, and update the action to
- * reflect the new editor.
- *
- * @param action
- * the action proxy that handles presentation portion of the
- * action
- * @param editor
- * the new editor target
- * @see IEditorActionDelegate #setActiveEditor(IAction, IEditorPart)
- */
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- if (targetEditor != null && targetEditor.getSite() != null) {
- shell = targetEditor.getSite().getShell();
- if (targetEditor.getEditorInput() instanceof FileEditorInput)
- file = ((FileEditorInput) targetEditor.getEditorInput())
- .getFile();
- }
- }
-
- public void dispose() {
- }
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/StyleComposite.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog;
-
-import java.util.Map;
-
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TabFolder;
-import org.eclipse.swt.widgets.TabItem;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.BaseTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.ICSSTabControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBackgroundControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabBoxesControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabPropertySheetControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabQuickEditControl;
-import org.jboss.tools.jst.jsp.outline.cssdialog.tabs.TabTextControl;
-
-/**
- * Class for creating style tabs
- *
- * @author Igor Zhukov (izhukov(a)exadel.com)
- */
-public class StyleComposite extends Composite {
-
- private TabFolder tabFolder;
- private StyleAttributes styleAttributes;
- public static int DEFAULT_START_TAB = 4;
-
- /**
- * StyleComposite constructor.
- *
- * @param parent
- * Composite object
- * @param styleAttributes
- * StyleAttributes objects
- * @param oldStyle
- * String value
- */
- public StyleComposite(Composite parent, StyleAttributes styleAttributes,
- DataBindingContext bindingContext) {
- super(parent, SWT.NONE);
- this.styleAttributes = styleAttributes;
-
- final GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 1;
- setLayout(gridLayout);
- setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
- tabFolder = new TabFolder(this, SWT.NONE);
- tabFolder.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
- true, true));
- tabFolder.addSelectionListener(new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- updateTab((TabItem) e.item);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
-
- // add text tab
- ScrolledComposite tabComposite = createTabComposite();
-
- BaseTabControl baseTabControl = new TabTextControl(tabComposite,
- styleAttributes, bindingContext);
-
- createTabItem(tabComposite, baseTabControl,
- JstUIMessages.TEXT_FONT_TAB_NAME,
- JstUIMessages.TEXT_FONT_TAB_NAME);
-
- tabComposite.setContent(baseTabControl);
- tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
- SWT.DEFAULT));
-
- // add background tab
- tabComposite = createTabComposite();
-
- baseTabControl = new TabBackgroundControl(tabComposite,
- styleAttributes, bindingContext);
-
- createTabItem(tabComposite, baseTabControl,
- JstUIMessages.BACKGROUND_TAB_NAME,
- JstUIMessages.BACKGROUND_TAB_NAME);
-
- tabComposite.setContent(baseTabControl);
- tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
- SWT.DEFAULT));
-
- // add boxes tab
- tabComposite = createTabComposite();
-
- baseTabControl = new TabBoxesControl(tabComposite, styleAttributes,
- bindingContext);
-
- createTabItem(tabComposite, baseTabControl,
- JstUIMessages.BOXES_TAB_NAME, JstUIMessages.BOXES_TAB_NAME);
-
- tabComposite.setContent(baseTabControl);
- tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
- SWT.DEFAULT));
-
- // add propertie tab
- tabComposite = createTabComposite();
- baseTabControl = new TabPropertySheetControl(tabComposite,
- styleAttributes, bindingContext);
-
- createTabItem(tabComposite, baseTabControl,
- JstUIMessages.PROPERTY_SHEET_TAB_NAME,
- JstUIMessages.PROPERTY_SHEET_TAB_NAME);
-
- tabComposite.setContent(baseTabControl);
- tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
- SWT.DEFAULT));
-
- // add quick edit tab
- tabComposite = createTabComposite();
- baseTabControl = new TabQuickEditControl(tabComposite, styleAttributes,
- bindingContext);
-
- createTabItem(tabComposite, baseTabControl,
- JstUIMessages.QUICK_EDIT_TAB_NAME,
- JstUIMessages.QUICK_EDIT_TAB_NAME);
-
- tabComposite.setContent(baseTabControl);
- tabComposite.setMinSize(baseTabControl.computeSize(SWT.DEFAULT,
- SWT.DEFAULT));
-
- tabFolder.setSelection(DEFAULT_START_TAB);
-
- }
-
- /**
- * Clear whole style composite component.
- */
- public void clearStyleComposite() {
- styleAttributes.clear();
-
- }
-
- /**
- * Clear whole style composite component.
- */
- public void setStyleProperties(Map<String, String> properties) {
- styleAttributes.setStyleProperties(properties);
-
- }
-
- public TabFolder getTabFolder() {
- return tabFolder;
- }
-
- public TabItem createTabItem(Composite content, ICSSTabControl tabControl,
- String label, String tooltip) {
-
- TabItem item = new TabItem(tabFolder, SWT.NONE);
- item.setText(label);
- item.setToolTipText(tooltip);
- item.setControl(content);
- item.setData(tabControl);
- return item;
-
- }
-
- public ScrolledComposite createTabComposite() {
-
- ScrolledComposite scroll = new ScrolledComposite(tabFolder,
- SWT.H_SCROLL | SWT.V_SCROLL);
-
- scroll.setExpandHorizontal(true);
- scroll.setExpandVertical(true);
-
- return scroll;
- }
-
- public void selectTab(int index) {
-
- tabFolder.setSelection(index);
- TabItem item = tabFolder.getItem(index);
- updateTab(item);
-
- }
-
- public void updateCurrentTab() {
- updateTab(tabFolder.getSelection()[0]);
- }
-
- private void updateTab(TabItem item) {
- if (item.getData() instanceof ICSSTabControl)
- ((ICSSTabControl) item.getData()).update();
- }
-
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPartComposite.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,679 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import org.eclipse.core.runtime.SafeRunner;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTableDragAdapter;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTableDropAdapter;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.dnd.CSSTreeDragAdapter;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSJSPRecognizer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTableModel;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSSelectorTreeModel;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSStyleSheetContainer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSTreeNode;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSClassSelectionChangedEvent;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSSelectionEventManager;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.ICSSClassSelectionChangedListener;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorFilter;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTableViewer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.viewers.CSSSelectorTreeViewer;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public class CSSSelectorPartComposite extends Composite implements
- SelectionListener {
-
- private static final int VIEWER_HEIGHT = 500;
- private static final int BUTTOND_WIDTH = 50;
- private static final int VIEWER_WIDTH = 175;
-
- /** Existing font family */
- private Composite moveButtonsContainer;
- private Composite tableButtonsContainer;
- private Button rightButton;
- private Button leftButton;
- private Button upButton;
- private Button downButton;
- private String setClasses;
- private CSSSelectorTreeViewer allCSSStyleClassViewer;
- private CSSSelectorTableViewer selectedClassesTableViewer;
- private Map<String, Map<String, String>> allCSSClassStyles;
- private StyleAttributes styleAttributes;
- private CSSSelectorTreeModel styleClassTreeModel;
- private CSSSelectorFilter filter;
- private List<ICSSClassSelectionChangedListener> changedListeners = new
ArrayList<ICSSClassSelectionChangedListener>(
- 0);
-
- public CSSSelectorPartComposite(StyleAttributes styleAttributes,
- Composite parentComposite, String setClasses) {
- super(parentComposite, SWT.BORDER);
- this.setClasses = setClasses;
- this.styleAttributes = styleAttributes;
- creatSelectorPart();
- }
-
- private void creatSelectorPart() {
- initControls();
- createLayout();
- initListeners();
- initDND();
- initDefaultContent();
- }
-
- private void initDefaultContent() {
- IEditorPart editorPart = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if (!(editorPart instanceof JSPMultiPageEditor)) {
- return;
- }
- String[] selectedClasses = parseSetClasses();
- selectedClassesTableViewer.setModel(new CSSSelectorTableModel(
- selectedClasses));
- CSSJSPRecognizer recognizer = new CSSJSPRecognizer(
- (JSPMultiPageEditor) editorPart);
- if (recognizer.parseCSS() == CSSJSPRecognizer.VOID_RESULT) {
- return;
- }
- styleClassTreeModel = recognizer.getCssStyleClassTreeModel();
- allCSSClassStyles = recognizer.getCSSStyleMap();
- allCSSStyleClassViewer.setModel(styleClassTreeModel);
- updateStyles();
- }
-
- private void initDND() {
- Transfer[] types = new Transfer[] { TextTransfer.getInstance() };
-
- allCSSStyleClassViewer.addDragSupport(DND.DROP_MOVE, types,
- new CSSTreeDragAdapter(this, allCSSStyleClassViewer,
- selectedClassesTableViewer));
-
- selectedClassesTableViewer.addDragSupport(DND.DROP_MOVE, types,
- new CSSTableDragAdapter(this, allCSSStyleClassViewer,
- selectedClassesTableViewer));
-
- allCSSStyleClassViewer.addDropSupport(DND.DROP_MOVE, types,
- new DropTargetAdapter() {
- @Override
- public void drop(DropTargetEvent event) {
- if (event.data == null
- || event.data
- .equals(CSSSelectorTreeViewer.CSS_SELECTOR_TREE_VIWER_ID)) {
- event.detail = DND.DROP_NONE;
- return;
- }
- }
- });
-
- selectedClassesTableViewer.addDropSupport(DND.DROP_MOVE, types,
- new CSSTableDropAdapter(this, allCSSStyleClassViewer,
- selectedClassesTableViewer));
-
- }
-
- private void initListeners() {
-
- allCSSStyleClassViewer
- .addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- handleAddClass();
- }
- });
-
- selectedClassesTableViewer
- .addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- handleRemoveClass();
- }
-
- });
-
- allCSSStyleClassViewer
- .addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(
- final SelectionChangedEvent event) {
- if (!CSSSelectionEventManager.getInstance()
- .isHandleSelection()) {
- CSSSelectionEventManager.getInstance()
- .setHandleSelection(true);
- return;
- }
- if (!event.getSelection().isEmpty()) {
- rightButton.setEnabled(true);
- leftButton.setEnabled(false);
- } else {
- rightButton.setEnabled(false);
- leftButton.setEnabled(false);
- }
- selectedClassesTableViewer.getTable().deselectAll();
- checkForTableMove(event);
- if (event.getSelection().isEmpty()) {
- return;
- }
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- fireClassSelectionChanged(CSSSelectionEventManager
- .getInstance()
- .createTreeSelectionChangedEvent(
- event,
- allCSSStyleClassViewer
- .getModel()));
- }
- });
- }
- });
-
- selectedClassesTableViewer
- .addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(
- final SelectionChangedEvent event) {
- if (!CSSSelectionEventManager.getInstance()
- .isHandleSelection()) {
- CSSSelectionEventManager.getInstance()
- .setHandleSelection(true);
- return;
- }
- if (!event.getSelection().isEmpty()) {
- rightButton.setEnabled(false);
- leftButton.setEnabled(true);
- } else {
- rightButton.setEnabled(false);
- leftButton.setEnabled(false);
- }
- checkForTableMove(event);
- allCSSStyleClassViewer.getTree().deselectAll();
- if (event.getSelection().isEmpty()) {
- return;
- }
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- fireClassSelectionChanged(CSSSelectionEventManager
- .getInstance()
- .createTableSelectionChangedEvent(
- event,
- allCSSStyleClassViewer
- .getModel()));
- }
- });
- }
- });
-
- allCSSStyleClassViewer.getTree().addKeyListener(new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- if (SWT.ARROW_RIGHT == e.keyCode && SWT.ALT == e.stateMask) {
- handleAddClass();
- }
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
-
- selectedClassesTableViewer.getTable().addKeyListener(new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- if (SWT.ARROW_LEFT == e.keyCode && SWT.ALT == e.stateMask) {
- handleRemoveClass();
- }
- }
-
- public void keyPressed(KeyEvent e) {
- }
- });
-
- rightButton.addSelectionListener(this);
- leftButton.addSelectionListener(this);
- upButton.addSelectionListener(this);
- downButton.addSelectionListener(this);
- }
-
- private void checkForTableMove(SelectionChangedEvent event) {
- if (event.getSelection().isEmpty()) {
- upButton.setEnabled(false);
- downButton.setEnabled(false);
- return;
- }
- int[] selectionIndices = selectedClassesTableViewer.getTable()
- .getSelectionIndices();
- if (selectionIndices.length == 0) {
- upButton.setEnabled(false);
- downButton.setEnabled(false);
- return;
- }
- if (!isSequencedIndices(selectionIndices)) {
- upButton.setEnabled(true);
- downButton.setEnabled(true);
- } else {
- if (selectionIndices[0] != 0
- && (selectionIndices[selectionIndices.length - 1] !=
selectedClassesTableViewer
- .getTable().getItemCount() - 1)) {
- upButton.setEnabled(true);
- downButton.setEnabled(true);
- } else if (selectionIndices[0] != 0) {
- downButton.setEnabled(false);
- upButton.setEnabled(true);
- } else if (selectionIndices[selectionIndices.length - 1] !=
selectedClassesTableViewer
- .getTable().getItemCount() - 1) {
- downButton.setEnabled(true);
- upButton.setEnabled(false);
- } else if (selectionIndices[0] == 0
- && (selectionIndices[selectionIndices.length - 1] ==
selectedClassesTableViewer
- .getTable().getItemCount() - 1)) {
- upButton.setEnabled(false);
- downButton.setEnabled(false);
- }
- }
- }
-
- private boolean isSequencedIndices(int[] indices) {
- for (int i = 0; i < indices.length - 1; i++) {
- if (indices[i + 1] - indices[i] != 1)
- return false;
- }
- return true;
- }
-
- private void initControls() {
- allCSSStyleClassViewer = new CSSSelectorTreeViewer(this, SWT.MULTI
- | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- filter = new CSSSelectorFilter();
- allCSSStyleClassViewer.addFilter(filter);
- moveButtonsContainer = new Composite(this, SWT.NONE);
- rightButton = new Button(moveButtonsContainer, SWT.PUSH);
- leftButton = new Button(moveButtonsContainer, SWT.PUSH);
- selectedClassesTableViewer = new CSSSelectorTableViewer(this, SWT.MULTI
- | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- tableButtonsContainer = new Composite(this, SWT.NONE);
- upButton = new Button(tableButtonsContainer, SWT.PUSH);
- downButton = new Button(tableButtonsContainer, SWT.PUSH);
- rightButton.setToolTipText(JstUIMessages.CSS_ADD_CSS_CLASS_TIP);
- ImageDescriptor rightDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_RIGHT_FILE_LOCATION);
- Image rightImage = rightDesc.createImage();
- rightButton.setImage(rightImage);
- rightButton.setEnabled(false);
- rightButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- Button button = (Button) e.getSource();
- button.getImage().dispose();
- }
- });
-
- leftButton.setToolTipText(JstUIMessages.CSS_REMOVE_CSS_CLASS_TIP);
-
- ImageDescriptor leftDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_LEFT_FILE_LOCATION);
- Image leftImage = leftDesc.createImage();
- leftButton.setImage(leftImage);
- leftButton.setEnabled(false);
- leftButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- Button button = (Button) e.getSource();
- button.getImage().dispose();
- }
- });
- upButton.setToolTipText(JstUIMessages.CSS_MOVE_UP_CSS_CLASS_TIP);
-
- ImageDescriptor upDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_UP_FILE_LOCATION);
- Image upImage = upDesc.createImage();
- upButton.setImage(upImage);
- upButton.setEnabled(false);
- upButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- Button button = (Button) e.getSource();
- button.getImage().dispose();
- }
- });
- downButton.setToolTipText(JstUIMessages.CSS_MOVE_DOWN_CSS_CLASS_TIP);
-
- ImageDescriptor downDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_DOWN_FILE_LOCATION);
- Image downImage = downDesc.createImage();
- downButton.setImage(downImage);
- downButton.setEnabled(false);
- downButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- Button button = (Button) e.getSource();
- button.getImage().dispose();
- }
- });
- }
-
- private String[] parseSetClasses() {
- if (setClasses == null || setClasses.length() == 0) {
- return new String[0];
- }
- StringTokenizer stringTokenizer = new StringTokenizer(
- setClasses.trim(), " ", false); //$NON-NLS-1$
- java.util.List<String> list = new ArrayList<String>(0);
- while (stringTokenizer.hasMoreTokens()) {
- String token = stringTokenizer.nextToken();
- list.add(token.trim());
- }
- return list.toArray(new String[0]);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- Object ob = e.getSource();
- if (ob.equals(leftButton)) {
- handleRemoveClass();
- } else if (ob.equals(rightButton)) {
- handleAddClass();
- } else if (ob.equals(upButton)) {
- handleMoveUp();
- } else if (ob.equals(downButton)) {
- handleMoveDown();
- } else if (ob.equals(allCSSStyleClassViewer.getTree())) {
- selectedClassesTableViewer.setSelection(new StructuredSelection());
- } else if (ob.equals(selectedClassesTableViewer.getTable())) {
- allCSSStyleClassViewer.setSelection(new StructuredSelection());
- }
- }
-
- private void handleMoveDown() {
- StructuredSelection selection = (StructuredSelection) selectedClassesTableViewer
- .getSelection();
- Object[] selectedItems = selection.toArray();
- int[] selectedIndices = selectedClassesTableViewer.getTable()
- .getSelectionIndices();
- int itemsCount = selectedClassesTableViewer.getTable().getItemCount();
- int selectionLength = selectedIndices.length;
- for (int i = 0; i < selectionLength; i++) {
- CSSSelectionEventManager.getInstance().setHandleSelection(false);
- selectedClassesTableViewer.remove(selectedItems[selectionLength - 1
- - i]);
- if (selectedIndices[selectionLength - 1 - i] == itemsCount - 1) {
- TableItem item = new TableItem(selectedClassesTableViewer
- .getTable(), selectedClassesTableViewer.getTable()
- .getStyle(), itemsCount - 1);
- item.setData(selectedItems[selectionLength - 1 - i]);
- itemsCount--;
- } else {
- TableItem item = new TableItem(selectedClassesTableViewer
- .getTable(), selectedClassesTableViewer.getTable()
- .getStyle(),
- selectedIndices[selectionLength - 1 - i] + 1);
- item.setData(selectedItems[selectionLength - 1 - i]);
- }
- }
- selectedClassesTableViewer.refresh();
- selectedClassesTableViewer.setSelection(new StructuredSelection(
- selectedItems));
- updateStyles();
- }
-
- private void handleMoveUp() {
- StructuredSelection selection = (StructuredSelection) selectedClassesTableViewer
- .getSelection();
- Object[] selectedItems = selection.toArray();
- int[] selectedIndices = selectedClassesTableViewer.getTable()
- .getSelectionIndices();
- CSSSelectionEventManager.getInstance().setHandleSelection(false);
- selectedClassesTableViewer.remove(selection.toArray());
- for (int i = 0; i < selectedIndices.length; i++) {
- if (selectedIndices[i] == i) {
- TableItem item = new TableItem(selectedClassesTableViewer
- .getTable(), selectedClassesTableViewer.getTable()
- .getStyle(), i);
- item.setData(selectedItems[i]);
- } else {
- TableItem item = new TableItem(selectedClassesTableViewer
- .getTable(), selectedClassesTableViewer.getTable()
- .getStyle(), selectedIndices[i] - 1);
- item.setData(selectedItems[i]);
- }
- }
- selectedClassesTableViewer.refresh();
- selectedClassesTableViewer.setSelection(new StructuredSelection(
- selectedItems));
- updateStyles();
- }
-
- public void widgetSelected(SelectionEvent e) {
- Object ob = e.getSource();
- if (ob.equals(leftButton)) {
- handleRemoveClass();
- } else if (ob.equals(rightButton)) {
- handleAddClass();
- } else if (ob.equals(upButton)) {
- handleMoveUp();
- } else if (ob.equals(downButton)) {
- handleMoveDown();
- }
- }
-
- private void handleRemoveClass() {
- TableItem[] selectedItems = selectedClassesTableViewer.getTable()
- .getSelection();
- if (selectedItems != null && selectedItems.length > 0) {
- List<String> itemsToRemove = new ArrayList<String>(0);
- for (int i = 0; i < selectedItems.length; i++) {
- itemsToRemove.add(selectedItems[i].getData().toString());
- }
- selectedClassesTableViewer.remove(itemsToRemove.toArray());
- updateStyles();
- }
- }
-
- private void handleAddClass() {
- Set<String> itemsToMove = new LinkedHashSet<String>(0);
- TreeItem[] selectedItems = allCSSStyleClassViewer.getTree()
- .getSelection();
- if (selectedItems != null && selectedItems.length > 0) {
- for (int i = 0; i < selectedItems.length; i++) {
- TreeItem item = selectedItems[i];
- CSSContainer container = ((CSSTreeNode) item.getData())
- .getCSSContainer();
- CSSTreeNode treeNode = (CSSTreeNode) item.getData();
- if ((container instanceof CSSStyleSheetContainer)) {
- List<CSSTreeNode> children = treeNode.getChildren();
- for (int j = 0; j < children.size(); j++) {
- itemsToMove.add(children.get(j).toString());
- }
- } else if (container instanceof CSSRuleContainer) {
- itemsToMove.add(treeNode.toString());
- }
- }
- selectedClassesTableViewer.add(itemsToMove.toArray());
- updateStyles();
- allCSSStyleClassViewer.setSelection(new StructuredSelection());
- }
- }
-
- private void createLayout() {
- final GridLayout gridLayout = new GridLayout();
- gridLayout.numColumns = 4;
- setLayout(gridLayout);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- setLayoutData(gridData);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = VIEWER_HEIGHT;
- gridData.widthHint = VIEWER_WIDTH;
- allCSSStyleClassViewer.getTree().setLayoutData(gridData);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.heightHint = VIEWER_HEIGHT;
- gridData.widthHint = VIEWER_WIDTH;
- selectedClassesTableViewer.getTable().setLayoutData(gridData);
-
- final GridLayout moveBtnContGridLayout = new GridLayout();
- moveBtnContGridLayout.numColumns = 1;
- moveButtonsContainer.setLayout(moveBtnContGridLayout);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.widthHint = BUTTOND_WIDTH;
- rightButton.setLayoutData(gridData);
-
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.widthHint = BUTTOND_WIDTH;
- leftButton.setLayoutData(gridData);
-
- final GridLayout tableBtnContGridLayout = new GridLayout();
- tableBtnContGridLayout.numColumns = 1;
- tableButtonsContainer.setLayout(tableBtnContGridLayout);
- }
-
- public void updateStyles() {
- String[] selectedItems = getItemsFromSelectedTable();
- styleAttributes.clear();
- if (filter == null) {
- filter = new CSSSelectorFilter();
- allCSSStyleClassViewer.addFilter(filter);
- }
- filter.removeAllFilters();
- if (selectedItems != null && selectedItems.length != 0) {
- selectedItems = getSortedStyleClasses(selectedItems);
- for (int i = 0; i < selectedItems.length; i++) {
- if (selectedItems[i] != null) {
- styleAttributes.putAll(allCSSClassStyles
- .get(selectedItems[i]));
- filter.addFilterName(selectedItems[i]);
- }
- }
- }
- allCSSStyleClassViewer.refresh();
- }
-
- public String getCSSStyleClasses() {
- StringBuilder stringBuilder = new StringBuilder(""); //$NON-NLS-1$
- String[] selectedItems = getItemsFromSelectedTable();
- if (selectedItems != null && selectedItems.length != 0) {
- for (int i = 0; i < selectedItems.length - 1; i++) {
- stringBuilder.append(selectedItems[i] + " "); //$NON-NLS-1$
- }
- stringBuilder.append(selectedItems[selectedItems.length - 1]);
- }
- return stringBuilder.toString();
- }
-
- private String[] getSortedStyleClasses(String[] unsortedClasses) {
- String[] sortedStyleClasses = new String[unsortedClasses.length];
- if (allCSSClassStyles != null) {
- Set<String> keySet = allCSSClassStyles.keySet();
- int iter = 0;
- for (Iterator<String> iterator = keySet.iterator(); iterator
- .hasNext();) {
- String styleClassName = iterator.next();
- for (int i = 0; i < unsortedClasses.length; i++) {
- if (unsortedClasses[i].equals(styleClassName)) {
- sortedStyleClasses[iter] = styleClassName;
- iter++;
- continue;
- }
- }
- }
- }
- return sortedStyleClasses;
- }
-
- private String[] getItemsFromSelectedTable() {
- TableItem[] selectedTableItems = selectedClassesTableViewer.getTable()
- .getItems();
- java.util.List<String> selectedItemsList = new ArrayList<String>(0);
- if (selectedTableItems != null) {
- for (int i = 0; i < selectedTableItems.length; i++) {
- selectedItemsList.add((String) selectedTableItems[i].getData());
- }
- }
- return selectedItemsList.toArray(new String[0]);
- }
-
- private void fireClassSelectionChanged(
- final CSSClassSelectionChangedEvent event) {
- for (int i = 0; i < changedListeners.size(); i++) {
- final ICSSClassSelectionChangedListener listener = changedListeners
- .get(i);
- SafeRunner.run(new SafeRunnable() {
- public void run() throws Exception {
- for (int i = 0; i < changedListeners.size(); i++) {
- listener.classSelectionChanged(event);
- }
- }
- });
- }
- }
-
- public synchronized void addCSSClassSelectionChangedListener(
- ICSSClassSelectionChangedListener listener) {
- changedListeners.add(listener);
- }
-
- public synchronized void removeCSSClassSelectionChangedListener(
- ICSSClassSelectionChangedListener listener) {
- changedListeners.remove(listener);
- }
-
- @Override
- public void dispose() {
- for (int i = 0; i < changedListeners.size(); i++) {
- removeCSSClassSelectionChangedListener(changedListeners.get(i));
- }
- changedListeners = null;
- super.dispose();
- }
-
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSSelectorPreview.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,106 +0,0 @@
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.IElementComparer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.css.core.internal.modelhandler.CSSModelLoader;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
-import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.model.CSSRuleContainer;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.CSSClassSelectionChangedEvent;
-import
org.jboss.tools.jst.jsp.outline.cssdialog.cssselector.selection.ICSSClassSelectionChangedListener;
-import org.w3c.dom.css.CSSRuleList;
-
-@SuppressWarnings("restriction")
-public class CSSSelectorPreview extends Composite implements
- ICSSClassSelectionChangedListener, IElementComparer {
-
- private ISelection prevSelection;
- private StructuredTextViewer viewer;
- private ICSSModel model;
- private ICSSStyleSheet styleSheet;
-
- public CSSSelectorPreview(Composite parent) {
- super(parent, SWT.BORDER);
- setLayout(new FillLayout());
- initPreview();
- }
-
- private void initPreview() {
- StructuredTextViewerConfiguration baseConfiguration = new
StructuredTextViewerConfigurationCSS();
-
- viewer = new StructuredTextViewer(this, null, null, false, SWT.BORDER
- | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(
- JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
-
- viewer.configure(baseConfiguration);
- CSSModelLoader cssModelLoader = new CSSModelLoader();
- IStructuredModel model = cssModelLoader.createModel();
- this.model = (ICSSModel) model;
- styleSheet = (ICSSStyleSheet) this.model.getDocument();
- viewer.setDocument(model.getStructuredDocument());
- viewer.setEditable(false);
- }
-
- public void classSelectionChanged(final CSSClassSelectionChangedEvent event) {
- CSSRuleContainer[] containers = event.getSelectedRuleContainers();
- if (containers.length != 0) {
- List<CSSRuleContainer> ruleContainerList = new
ArrayList<CSSRuleContainer>(0);
- for (int i = 0; i < containers.length; i++) {
- ruleContainerList.add(containers[i]);
- }
- ISelection newSelection = new StructuredSelection(ruleContainerList, this);
- if (prevSelection == null) {
- prevSelection = new StructuredSelection(ruleContainerList, this);
- clearPreview();
- for (int i = 0; i < containers.length; i++) {
- appendRuleFromContainer(containers[i]);
- }
- }
- if (!prevSelection.equals(newSelection)) {
- clearPreview();
- for (int i = 0; i < containers.length; i++) {
- appendRuleFromContainer(containers[i]);
- }
- prevSelection = newSelection;
- }
- }
- }
-
- private void appendRuleFromContainer(CSSRuleContainer container) {
- StringBuilder builder = new StringBuilder(""); //$NON-NLS-1$
- ICSSStyleRule rule = (ICSSStyleRule) container.getRule();
- String text = rule.getCssText();
- String styleDef = text.substring(text.indexOf('{'));
- builder.append("." + container.getSelectorName() + styleDef); //$NON-NLS-1$
- styleSheet.appendRule(styleSheet.createCSSRule(builder.toString()));
- }
-
- private void clearPreview() {
- CSSRuleList ruleList = styleSheet.getCssRules();
- for (int i = 0; i < ruleList.getLength(); i++) {
- styleSheet.removeRule(ruleList.item(i));
- }
- }
-
- public boolean equals(Object a, Object b) {
- return a.equals(b);
- }
-
- public int hashCode(Object element) {
- return 0;
- }
-
-}
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/cssselector/CSSStyleClassSelector.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.outline.cssdialog.cssselector;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.jboss.tools.common.model.ui.widgets.Split;
-import org.jboss.tools.jst.jsp.messages.JstUIMessages;
-import org.jboss.tools.jst.jsp.outline.cssdialog.AbstractCSSDialog;
-
-/**
- *
- * @author yzhishko
- *
- */
-
-public class CSSStyleClassSelector extends AbstractCSSDialog {
-
- private String currentCSSStyleClass;
- private CSSSelectorPartComposite cssClassComposite;
- private String selectesCSSStylesClasses;
- private CSSSelectorPreview preview;
-
- public CSSStyleClassSelector(Shell shell) {
- super(shell);
- setShellStyle(getShellStyle() | SWT.RESIZE | SWT.MAX
- | SWT.APPLICATION_MODAL);
- }
-
- @Override
- protected Composite createControlComposite(Composite parent) {
- // Create down splitter container
- Split controlsContainer = new Split(parent, SWT.VERTICAL);
- controlsContainer.setLayout(new GridLayout());
- controlsContainer.setLayoutData(new GridData(GridData.FILL,
- GridData.FILL, true, true));
- cssClassComposite = createCSSClassComposite(controlsContainer);
- preview = createPreviewComposite(controlsContainer);
- cssClassComposite.addCSSClassSelectionChangedListener(preview);
- return controlsContainer;
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Composite composite = (Composite) super.createContents(parent);
- return composite;
- }
-
- private CSSSelectorPartComposite createCSSClassComposite(Composite parent) {
- return new CSSSelectorPartComposite(getStyleAttributes(), parent,
- currentCSSStyleClass);
- }
-
- public void setCurrentStyleClass(String value) {
- currentCSSStyleClass = value;
- }
-
- public String getCSSStyleClasses() {
- return selectesCSSStylesClasses;
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- if (buttonId == OK) {
- selectesCSSStylesClasses = cssClassComposite.getCSSStyleClasses();
- }
- super.buttonPressed(buttonId);
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(JstUIMessages.CSS_SELECTOR_TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- setTitle(JstUIMessages.CSS_SELECTOR_TITLE);
- return super.createDialogArea(parent);
- }
-
- private CSSSelectorPreview createPreviewComposite(Composite parent) {
- return new CSSSelectorPreview(parent);
- }
-
-}
Copied:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/Constants.java
(from rev 27140,
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/common/Constants.java)
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/Constants.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/util/Constants.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.util;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.swt.graphics.RGB;
+
+/**
+ *
+ * Class for constants
+ *
+ * @author Evgeny Zheleznyakov
+ *
+ */
+public class Constants {
+
+ public static final String extSizes[] = new String[] { "", "em",
"ex", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "px", "in", "cm", "mm", "pt",
"pc" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
//$NON-NLS-6$
+
+ public static final Set elemFolder = Collections
+ .unmodifiableSet(new HashSet(
+ Arrays
+ .asList(new String[] {
+ "background-image", "list-style-image", "cursor",
"cue-after", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "cue-before" }))); //$NON-NLS-1$
+
+ public static final Set extElem = Collections
+ .unmodifiableSet(new HashSet(
+ Arrays
+ .asList(new String[] {
+ "border-bottom-width", "border-left-width",
"borer-right-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "border-top-width", "border-width", "bottom",
"font-size", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "height", "left", "letter-spacing",
"line-height", "margin", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$
+ "margin-bottom", "margin-left", "margin-right",
"margin-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "margin-offset", "margin-bottom", "max-height",
"max-width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "min-height", "min-width", "outline-width",
"padding", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "padding-bottom", "padding-left", "padding-right",
"padding-top", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ "right", "size", "text-indent", "top",
"vertical-align", "width", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
//$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ "word-spacing" }))); //$NON-NLS-1$
+
+ public static final String NONE = "none"; //$NON-NLS-1$
+ public static final int FIRST_COLUMN = 0;
+ public static final int SECOND_COLUMN = 1;
+
+ public static final String EMPTY = ""; //$NON-NLS-1$
+ public static final String WHITE_SPACE = " "; //$NON-NLS-1$
+ public static final String COLON = ":"; //$NON-NLS-1$
+ public static final String SEMICOLON = ";"; //$NON-NLS-1$
+ public static final String COMMA = ","; //$NON-NLS-1$
+ public static final String DOT = "."; //$NON-NLS-1$
+ public static final String DASH = "-"; //$NON-NLS-1$
+ public static final String SLASH = "/"; //$NON-NLS-1$
+ public static final String EQUAL = "="; //$NON-NLS-1$
+ public static final String UNDERSCORE = "_"; //$NON-NLS-1$
+ public static final String START_BRACKET = "("; //$NON-NLS-1$
+ public static final String END_BRACKET = ")"; //$NON-NLS-1$
+ public static final String GT = ">"; //$NON-NLS-1$
+ public static final String LT = "<"; //$NON-NLS-1$
+ public static final String PROPERTIES_EXTENTION = ".properties";
//$NON-NLS-1$
+
+ public static final String LEFT_BRACE = "{"; //$NON-NLS-1$
+ public static final String RIGHT_BRACE = "}"; //$NON-NLS-1$
+
+ public static final RGB RGB_BLACK = new RGB(0, 0, 0);
+ public static final RGB RGB_WHITE = new RGB(0xFF, 0xFF, 0xFF);
+
+ public static final int DONT_CONTAIN = -1;
+
+ public static final String OPEN_SPAN_TAG = "<span style=\"width:
100%;"; //$NON-NLS-1$
+ public static final String CLOSE_SPAN_TAG = "</span>"; //$NON-NLS-1$
+ public static final String OPEN_DIV_TAG = "<div style=\"width: 100%;";
//$NON-NLS-1$
+ public static final String CLOSE_DIV_TAG = "</div>"; //$NON-NLS-1$
+ public static final String COLOR = "color"; //$NON-NLS-1$
+ public static final String STYLE = "style"; //$NON-NLS-1$
+ public static final String CLASS = "class"; //$NON-NLS-1$
+}
\ No newline at end of file
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/images/xstudio/wizards/new_css_class.gif
===================================================================
(Binary files differ)
Deleted:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/images/xstudio/wizards/new_css_file.gif
===================================================================
(Binary files differ)
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties 2010-12-07 09:50:36 UTC
(rev 27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.properties 2010-12-07 10:41:14 UTC
(rev 27207)
@@ -21,10 +21,6 @@
PreferencePage_LibrarySets=Library Sets
NewWizardCat_JBossToolsWeb=JBoss Tools Web
-NewWizard_CSSFile=CSS File
-NewWizardDescription_CSSFile=Create a CSS File
-NewWizard_CSSClass=CSS Class
-NewWizardDescription_CSSClass=Create a CSS Class
NewWizard_JSFile=JS File
NewWizardDescription_JSFile=Create a JS File
NewWizard_WebDescriptor=Web Descriptor
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-12-07 09:50:36 UTC (rev
27206)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-12-07 10:41:14 UTC (rev
27207)
@@ -124,21 +124,6 @@
</wizard>
<wizard
category="org.jboss.tools.jst.web"
- class="org.jboss.tools.jst.web.ui.wizards.css.NewCSSClassWizard"
-
finalPerspective="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
- icon="$nl$/images/xstudio/wizards/new_css_class.gif"
- id="org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard"
- name="%NewWizard_CSSClass"
-
preferredPerspectives="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
- project="false">
- <description>
- %NewWizardDescription_CSSClass
- </description>
- <selection class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
- <wizard
- category="org.jboss.tools.jst.web"
class="org.jboss.tools.jst.web.ui.wizards.newfile.NewWebFileWizard"
finalPerspective="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
icon="$nl$/images/xstudio/wizards/new_webapp_file.gif"
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/WebUIMessages.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -4,18 +4,6 @@
public class WebUIMessages extends NLS {
private static final String BUNDLE_NAME =
"org.jboss.tools.jst.web.ui.wizards.messages.messages"; //$NON-NLS-1$
- public static String FILE_SELECT_DIALOG_EMPTY_MESSAGE;
- public static String FILE_SELECT_DIALOG_MESSAGE;
- public static String FILE_SELECT_DIALOG_TITLE;
- public static String FILE_SELECT_LABEL;
- public static String FILE_SELECT_BUTTON;
- public static String CSS_CLASS_NAME_LABEL;
- public static String WIZARD_WINDOW_TITLE;
- public static String WIZARD_TITLE;
- public static String WIZARD_DESCRIPTION;
- public static String WIZARD_ERROR_FILE_SELECTION;
- public static String WIZARD_ERROR_EMPTY_CLASSNAME;
- public static String WIZARD_ERROR_INVALID_CLASSNAME;
static {
// initialize resource bundle
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/messages/messages.properties 2010-12-07
10:41:14 UTC (rev 27207)
@@ -1,12 +0,0 @@
-FILE_SELECT_DIALOG_EMPTY_MESSAGE=No CSS file in the current project
-FILE_SELECT_DIALOG_MESSAGE=Select CSS file from the tree:
-FILE_SELECT_DIALOG_TITLE=CSS File Selection
-FILE_SELECT_LABEL=CSS File
-FILE_SELECT_BUTTON=Browse
-CSS_CLASS_NAME_LABEL=CSS Class
-WIZARD_WINDOW_TITLE=CSS Style Class Editor
-WIZARD_TITLE=CSS Class
-WIZARD_DESCRIPTION=Create New CSS Class
-WIZARD_ERROR_FILE_SELECTION=No file specified
-WIZARD_ERROR_EMPTY_CLASSNAME=Class name is empty
-WIZARD_ERROR_INVALID_CLASSNAME = Class name is not valid
Modified: trunk/jst/tests/org.jboss.tools.jst.css.test/.classpath
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.css.test/.classpath 2010-12-07 09:50:36 UTC (rev
27206)
+++ trunk/jst/tests/org.jboss.tools.jst.css.test/.classpath 2010-12-07 10:41:14 UTC (rev
27207)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Modified:
trunk/jst/tests/org.jboss.tools.jst.css.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/.settings/org.eclipse.jdt.core.prefs 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/.settings/org.eclipse.jdt.core.prefs 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,8 @@
+#Mon Dec 06 19:13:47 EET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF 2010-12-07 09:50:36
UTC (rev 27206)
+++ trunk/jst/tests/org.jboss.tools.jst.css.test/META-INF/MANIFEST.MF 2010-12-07 10:41:14
UTC (rev 27207)
@@ -22,8 +22,9 @@
org.jboss.tools.jst.jsp,
org.eclipse.wst.xml.core,
org.jboss.tools.common.text.ext,
- org.jboss.tools.jst.web
+ org.jboss.tools.jst.web,
+ org.jboss.tools.jsf.ui.test;bundle-version="3.2.0"
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/CSSAllTests.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -13,7 +13,7 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-
+import org.jboss.tools.jst.css.test.jbide.CSSStyleDialogTest;
import org.jboss.tools.jst.css.test.jbide.CaseSensitiveTest_JBIDE4940;
import org.jboss.tools.jst.css.test.jbide.ExtendingCSSViewTest_JBIDE4850;
import org.jboss.tools.jst.css.test.jbide.IncorrectPageAfterSelectionTest_JBIDE4849;
@@ -43,6 +43,7 @@
suite.addTestSuite(NotCompletedCSS_JBIDE4677.class);
suite.addTestSuite(IncorrectPageAfterSelectionTest_JBIDE4849.class);
suite.addTestSuite(CaseSensitiveTest_JBIDE4940.class);
+ suite.addTestSuite(CSSStyleDialogTest.class);
// $JUnit-END$
return new ProjectImportTestSetup(
Copied:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CSSStyleDialogTest.java
(from rev 27194,
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CSSStyleDialogTest.java)
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CSSStyleDialogTest.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CSSStyleDialogTest.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.css.test.jbide;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.jst.css.dialog.CSSStyleDialog;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class CSSStyleDialogTest extends TestCase {
+
+ private static String CSS_STYLE = "color:red;size:10px;"; //$NON-NLS-1$
+
+ public void testStyleDialog() {
+ CSSStyleDialog dialog = null;
+ try {
+ dialog = new CSSStyleDialog(WorkbenchUtils
+ .getActiveShell(), CSS_STYLE);
+ dialog.setBlockOnOpen(false);
+ dialog.open();
+ } finally {
+ if(dialog !=null) {
+ dialog.close();
+ }
+ }
+ }
+}
Copied:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CssClassNewWizardTest.java
(from rev 27194,
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/CssClassNewWizardTest.java)
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CssClassNewWizardTest.java
(rev 0)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/CssClassNewWizardTest.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -0,0 +1,147 @@
+package org.jboss.tools.jst.css.test.jbide;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
+
+public class CssClassNewWizardTest //extends WizardTest
+{
+
+
+ private static String CSS_FILE_PATH="WebContent/pages/main.css";
//$NON-NLS-1$
+
+ public CssClassNewWizardTest(){
+// super("org.jboss.tools.jst.web.ui.wizards.newfile.NewCSSClassWizard");
//$NON-NLS-1$
+ }
+
+ public void testCssClassNewWizardTestIsCreated() {
+// wizardIsCreated();
+ }
+
+ public void testCssClassNewWizardValidation() {
+// wizard = getWizard();
+//
+// boolean canFinish = wizard.canFinish();
+//
+// assertFalse("Finish button is enabled at first wizard page.", canFinish);
//$NON-NLS-1$
+ }
+
+ public void testCssClassNewWizardValidation2() {
+// wizard = getWizardOnProject();
+//
+// boolean canFinish = wizard.canFinish();
+//
+// // Assert Finish button is enabled by default if wizard is called on Project
+// assertFalse("Finish button is disabled at first wizard page.", canFinish);
//$NON-NLS-1$
+//
+// // Assert Finish button is disabled and error is present if
+ // Folder field is empty
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field points to folder that doesn't exist
+ // All other fields are correct
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field is empty
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains forbidden characters
+
+ // Assert Finish button is disabled and error is present if
+ // Folder field is correct
+ // Name field contains file name that already exists
+ }
+
+ public void testCssClassEditing() {
+// ArrayList<IResource> list = new ArrayList<IResource>();
+// IResource cssFile = project.findMember(CSS_FILE_PATH);
+// assertNotNull(cssFile);
+// list.add(cssFile);
+// StructuredSelection selection = new StructuredSelection(list);
+// wizard = WorkbenchUtils.findWizardByDefId(id);
+//
+// ((IWorkbenchWizard) wizard).init(PlatformUI.getWorkbench(), selection);
+//
+// dialog = new WizardDialog(PlatformUI.getWorkbench()
+// .getActiveWorkbenchWindow().getShell(), wizard);
+// dialog.setBlockOnOpen(false);
+// dialog.open();
+//
+// assertFalse("Finish button is not disabled.", wizard.canFinish());
//$NON-NLS-1$
+// assertFalse("Next button is not disabled.",
wizard.getContainer().getCurrentPage().canFlipToNextPage()); //$NON-NLS-1$
+//
+// try {
+//
+//
+// Field selectFileTextField = wizard.getContainer().getCurrentPage()
+// .getClass().getDeclaredField("selectFileText"); //$NON-NLS-1$
+// selectFileTextField.setAccessible(true);
+// Text selectFileText = (Text) selectFileTextField.get(wizard
+// .getContainer().getCurrentPage());
+// selectFileText.setText(cssFile.getFullPath().toString());
+// Field classNameTextField = wizard.getContainer().getCurrentPage()
+// .getClass().getDeclaredField("classNameText"); //$NON-NLS-1$
+// classNameTextField.setAccessible(true);
+// Text classNameTextText = (Text) classNameTextField.get(wizard
+// .getContainer().getCurrentPage());
+// classNameTextText.setText("newCSS"); //$NON-NLS-1$
+//
+//
+// } catch (SecurityException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (NoSuchFieldException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (IllegalArgumentException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (IllegalAccessException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+//
+// assertTrue("Next button is disabled.",
wizard.getContainer().getCurrentPage().canFlipToNextPage()); //$NON-NLS-1$
+// assertFalse("Finish button is not disabled.", wizard.canFinish());
//$NON-NLS-1$
+// wizard.getContainer().showPage(wizard.getNextPage(wizard.getContainer().getCurrentPage()));
+// assertTrue("Finish button is disabled.", wizard.canFinish());
//$NON-NLS-1$
+ }
+
+ public void testCssClassWithEditor() {
+
+// IResource cssFile = project.findMember(CSS_FILE_PATH);
+//
+// IEditorPart facesConfigEditor = WorkbenchUtils.openEditor(cssFile
+// .getFullPath().toString());
+//
+// assertTrue(facesConfigEditor instanceof StructuredTextEditor);
+//
+//// ArrayList<IResource> list = new ArrayList<IResource>();
+//
+//// assertNotNull(cssFile);
+//// list.add(cssFile);
+//// StructuredSelection selection = new StructuredSelection(list);
+// wizard = WorkbenchUtils.findWizardByDefId(id);
+////
+//// ((IWorkbenchWizard) wizard).init(PlatformUI.getWorkbench(), selection);
+//
+// dialog = new WizardDialog(PlatformUI.getWorkbench()
+// .getActiveWorkbenchWindow().getShell(), wizard);
+// dialog.setBlockOnOpen(false);
+// dialog.open();
+ }
+
+}
Modified:
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java
===================================================================
---
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/jst/tests/org.jboss.tools.jst.css.test/src/org/jboss/tools/jst/css/test/jbide/InputFractionalValueTest_JBIDE4790.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -16,11 +16,11 @@
import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.jst.css.dialog.common.StyleAttributes;
+import org.jboss.tools.jst.css.dialog.common.Util;
import org.jboss.tools.jst.css.properties.CSSPropertyPage;
import org.jboss.tools.jst.css.test.AbstractCSSViewTest;
import org.jboss.tools.jst.css.view.CSSEditorView;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.StyleAttributes;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Util;
import org.w3c.dom.DOMException;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSStyleDeclaration;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF 2010-12-07 09:50:36 UTC
(rev 27206)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF 2010-12-07 10:41:14 UTC
(rev 27207)
@@ -59,6 +59,7 @@
org.eclipse.wst.sse.core,
org.eclipse.core.expressions,
org.jboss.tools.common.model.ui,
- org.eclipse.wst.xml.xpath.core
+ org.eclipse.wst.xml.xpath.core,
+ org.jboss.tools.jst.css;bundle-version="3.2.0"
Bundle-Version: 3.2.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java 2010-12-07
09:50:36 UTC (rev 27206)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeEditAnyDialog.java 2010-12-07
10:41:14 UTC (rev 27207)
@@ -10,29 +10,19 @@
******************************************************************************/
package org.jboss.tools.vpe.editor.template;
-import java.io.IOException;
-import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.regex.Pattern;
-
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -50,12 +40,13 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.common.model.ui.ModelUIImages;
+import org.jboss.tools.jst.css.dialog.CSSStyleDialog;
+import org.jboss.tools.jst.css.dialog.common.Util;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.outline.cssdialog.CSSStyleDialog;
-import org.jboss.tools.jst.jsp.outline.cssdialog.common.Constants;
+import org.jboss.tools.jst.jsp.util.Constants;
import org.jboss.tools.vpe.VpePlugin;
-import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
import org.jboss.tools.vpe.editor.Message;
+import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilder;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilderException;
import org.jboss.tools.vpe.messages.VpeUIMessages;
import org.w3c.dom.DOMException;
@@ -247,7 +238,7 @@
button.setLayoutData(new GridData(SWT.LEFT, SWT.NONE, false, false, 1, 1));
button.setToolTipText(VpeUIMessages.EDIT_STYLE_TIP);
ImageDescriptor colorDesc = JspEditorPlugin
- .getImageDescriptor(Constants.IMAGE_COLORLARGE_FILE_LOCATION);
+ .getImageDescriptor(Util.IMAGE_COLORLARGE_FILE_LOCATION);
Image im = colorDesc.createImage();
button.setImage(im);