JBoss Tools SVN: r27207 - in trunk: jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test and 49 other directories.
by jbosstools-commits@lists.jboss.org
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);
14 years
JBoss Tools SVN: r27206 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-07 04:50:36 -0500 (Tue, 07 Dec 2010)
New Revision: 27206
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java
Log:
removed unneeded method
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java 2010-12-07 09:19:35 UTC (rev 27205)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java 2010-12-07 09:50:36 UTC (rev 27206)
@@ -26,11 +26,7 @@
public AllImageFilter(DeltaCloud cloud) {
super(cloud);
}
-
- protected DeltaCloudImage[] getCloudElements() throws DeltaCloudException {
- return getCloud().getImages();
- }
-
+
@Override
public boolean matches(DeltaCloudImage image) {
return true;
14 years
JBoss Tools SVN: r27205 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-07 04:19:35 -0500 (Tue, 07 Dec 2010)
New Revision: 27205
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java
Log:
added TODO comment
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java 2010-12-07 09:11:55 UTC (rev 27204)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java 2010-12-07 09:19:35 UTC (rev 27205)
@@ -34,6 +34,7 @@
try {
return doRun(monitor);
} catch (Exception e) {
+ // TODO: internationalize strings
return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
MessageFormat.format("Could not {0}", getName()));
}
14 years
JBoss Tools SVN: r27204 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-07 04:11:55 -0500 (Tue, 07 Dec 2010)
New Revision: 27204
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java
Log:
added author
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java 2010-12-07 08:34:15 UTC (rev 27203)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudJob.java 2010-12-07 09:11:55 UTC (rev 27204)
@@ -17,6 +17,9 @@
import org.eclipse.core.runtime.jobs.Job;
import org.jboss.tools.common.log.StatusFactory;
+/**
+ * @author André Dietisheim
+ */
public abstract class AbstractCloudJob extends Job {
public AbstractCloudJob(String name) {
14 years
JBoss Tools SVN: r27203 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.ui and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-07 03:34:15 -0500 (Tue, 07 Dec 2010)
New Revision: 27203
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
Log:
[JBIDE-7819] I now show the user that things are being loaded ("Loading..." node). Since I now load data async now, nodes are added in #listChanged and I have to add children to the tree manually (and not return them on #getChildren)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -188,19 +188,19 @@
public void addCloud(DeltaCloud d) throws DeltaCloudException {
doGetClouds().add(d);
saveClouds();
- notifyListeners(ICloudManagerListener.ADD_EVENT);
+ notifyListeners(ICloudManagerListener.ADD_EVENT, d);
}
public void removeCloud(DeltaCloud d) throws DeltaCloudException {
doGetClouds().remove(d);
d.dispose();
saveClouds();
- notifyListeners(ICloudManagerListener.REMOVE_EVENT);
+ notifyListeners(ICloudManagerListener.REMOVE_EVENT, d);
}
- public void notifyCloudRename() throws DeltaCloudException {
+ public void notifyCloudRename(DeltaCloud cloud) throws DeltaCloudException {
saveClouds();
- notifyListeners(ICloudManagerListener.RENAME_EVENT);
+ notifyListeners(ICloudManagerListener.RENAME_EVENT, cloud);
}
public void addCloudManagerListener(ICloudManagerListener listener) {
@@ -214,11 +214,11 @@
cloudManagerListeners.remove(listener);
}
- public void notifyListeners(int type) {
+ public void notifyListeners(int type, DeltaCloud cloud) {
if (cloudManagerListeners != null) {
Object[] listeners = cloudManagerListeners.getListeners();
for (int i = 0; i < listeners.length; ++i) {
- ((ICloudManagerListener) listeners[i]).cloudsChanged(type);
+ ((ICloudManagerListener) listeners[i]).cloudsChanged(type, cloud);
}
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -16,5 +16,5 @@
public static int REMOVE_EVENT = 2;
public static int RENAME_EVENT = 3;
- void cloudsChanged(int type);
+ void cloudsChanged(int type, DeltaCloud cloud);
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,3 +1,17 @@
+2010-12-07 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java (setLoadingIndicator):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java:
+ [JBIDE-7819] I now show the user that things are being loaded ("Loading..." node)
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java (listChanged):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java (listChanged):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
+ (addChild):
+ (addChildren):
+ (removeChild):
+ [JBIDE-7819] since loading data async now, nodes are added in #listChanged and I have to add children
+ to the tree manually (and not return them on #getChildren)
+
2010-12-06 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java (validate):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-07 08:34:15 UTC (rev 27203)
@@ -11,19 +11,19 @@
name="%CloudViewerName"
icon="icons/delta.gif"
category="org.jboss.tools.deltacloud.ui"
- class="org.jboss.tools.deltacloud.ui.views.DeltaCloudView"
+ class="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudView"
id="org.jboss.tools.deltacloud.ui.views.CloudView">
</view>
<view
category="org.jboss.tools.deltacloud.ui"
- class="org.jboss.tools.deltacloud.ui.views.InstanceView"
+ class="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView"
icon="icons/delta.gif"
id="org.jboss.tools.deltacloud.ui.views.InstanceView"
name="%InstanceViewer.name">
</view>
<view
category="org.jboss.tools.deltacloud.ui"
- class="org.jboss.tools.deltacloud.ui.views.ImageView"
+ class="org.jboss.tools.deltacloud.ui.views.cloudelements.ImageView"
icon="icons/delta.gif"
id="org.jboss.tools.deltacloud.ui.views.ImageView"
name="%ImageViewer.name"
@@ -40,7 +40,7 @@
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
<propertyContributor
contributorId="org.jboss.tools.deltacloud.ui.views.CloudView"
- typeMapper="org.jboss.tools.deltacloud.ui.views.CVTypeMapper">
+ typeMapper="org.jboss.tools.deltacloud.ui.views.cloud.CVTypeMapper">
<propertyCategory
category="main"></propertyCategory>
</propertyContributor>
@@ -61,11 +61,11 @@
<propertySections
contributorId="org.jboss.tools.deltacloud.ui.views.CloudView">
<propertySection
- class="org.jboss.tools.deltacloud.ui.views.CVPropertySection"
+ class="org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySection"
id="org.jboss.tools.deltacloud.ui.propertySection.advanced"
tab="cloudview.advancedTab">
<input
- type="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ type="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</input>
</propertySection>
</propertySections>
@@ -116,7 +116,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</with>
@@ -136,7 +136,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</with>
@@ -158,7 +158,7 @@
<count value="+" />
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</and>
@@ -177,7 +177,7 @@
<activeWhen>
<with
variable="activePart">
- <instanceof value="org.jboss.tools.deltacloud.ui.views.InstanceView" />
+ <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
</with>
</activeWhen>
</handler>
@@ -187,15 +187,9 @@
<activeWhen>
<with
variable="activePart">
- <instanceof value="org.jboss.tools.deltacloud.ui.views.ImageView" />
+ <instanceof value="org.jboss.tools.deltacloud.ui.views.cloudelements.ImageView" />
</with>
</activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <count value="+" />
- </with>
- </enabledWhen>
</handler>
</extension>
<extension
@@ -305,7 +299,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</with>
@@ -681,7 +675,7 @@
variable="selection">
<iterate>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement">
</instanceof>
</iterate>
</with>
@@ -705,11 +699,11 @@
<iterate>
<and>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
<not>
<instanceof
- value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+ value="org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement">
</instanceof>
</not>
</and>
@@ -876,7 +870,7 @@
<extension
point="org.eclipse.core.runtime.adapters">
<factory
- adaptableType="org.jboss.tools.deltacloud.ui.views.CloudViewElement"
+ adaptableType="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement"
class="org.jboss.tools.deltacloud.ui.adapter.CloudViewElementAdapterFactory">
<adapter
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
@@ -885,7 +879,7 @@
type="org.jboss.tools.deltacloud.core.DeltaCloud">
</adapter>
<adapter
- type="org.jboss.tools.deltacloud.ui.views.InstancePropertySource">
+ type="org.jboss.tools.deltacloud.ui.views.cloud.property.InstancePropertySource">
</adapter>
<adapter
type="org.jboss.tools.deltacloud.core.DeltaCloudImage">
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -16,9 +16,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.views.CVImageElement;
-import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
public class CloudViewElementAdapterFactory implements IAdapterFactory {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -21,8 +21,8 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstanceWizard2;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -37,9 +37,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
/**
* @author Andre Dietisheim
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -21,8 +21,8 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.EditCloudConnectionWizard;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -25,7 +25,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudMultiException;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,402 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TableViewer;
-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.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
-import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.ui.Activator;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.internal.deltacloud.ui.preferences.TextPreferenceValue;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-/**
- * A common superclass for viewers that operate on IDeltaCloudElements
- * (currently DeltaCloudImage and DeltaCloudInstance)
- *
- * @see InstanceView
- * @see ImageView
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class AbstractCloudElementTableView<CLOUDELEMENT extends IDeltaCloudElement> extends ViewPart implements
- ICloudManagerListener {
-
- private final static String CLOUD_SELECTOR_LABEL = "CloudSelector.label"; //$NON-NLS-1$
-
- private static final String FILTERED_LABEL = "Filtered.label"; //$NON-NLS-1$
- private static final String FILTERED_TOOLTIP = "FilteredImages.tooltip"; //$NON-NLS-1$
-
- private Combo currentCloudSelector;
- private Label currentCloudSelectorLabel;
- private TableViewer viewer;
-
- private DeltaCloud currentCloud;
-
- private TextPreferenceValue lastSelectedCloudPref;
-
- private ModifyListener cloudModifyListener = new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- int index = currentCloudSelector.getSelectionIndex();
- if (index < 0) {
- return;
- }
-
-// removeListener(currentCloud);
-
- AbstractCloudElementTableView.this.currentCloud = getCurrentCloud(index, getClouds());
- if (currentCloud != null) {
- lastSelectedCloudPref.store(currentCloud.getName());
- Display.getCurrent().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- setViewerInput(currentCloud);
-// addListener(currentCloud);
- }
- });
- }
- }
- };
-
- private ISelectionListener workbenchSelectionListener = new ISelectionListener() {
-
- @Override
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
- if (cloud != null) {
- currentCloudSelector.select(getCloudIndex(cloud, getClouds()));
- }
- }
- };
-
-// private Job viewerInputJob = new Job("") {
-//
-// @Override
-// protected IStatus run(IProgressMonitor monitor) {
-//
-// return Status.OK_STATUS;
-// }
-// };
-
- public AbstractCloudElementTableView() {
- lastSelectedCloudPref = new TextPreferenceValue(getSelectedCloudPrefsKey(), Activator.getDefault());
- }
-
- private class ColumnListener extends SelectionAdapter {
-
- private int column;
-
- public ColumnListener(int column) {
- this.column = column;
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- TableViewerColumnComparator comparator = (TableViewerColumnComparator) viewer.getComparator();
- Table t = viewer.getTable();
- if (comparator.getColumn() == column) {
- comparator.reverseDirection();
- }
- comparator.setColumn(column);
- TableColumn tc = (TableColumn) e.getSource();
- t.setSortColumn(tc);
- t.setSortDirection(SWT.NONE);
- viewer.refresh();
- }
- };
-
- protected abstract String getSelectedCloudPrefsKey();
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- super.dispose();
- }
-
- @Override
- public void createPartControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- FormLayout layout = new FormLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- container.setLayout(layout);
-
- DeltaCloud[] clouds = getClouds();
-
- createCloudSelector(container);
- initCloudSelector(lastSelectedCloudPref.get(), currentCloudSelector, clouds);
-
- Label filterLabel = new Label(container, SWT.NULL);
- filterLabel.setText(CVMessages.getString(FILTERED_LABEL));
- filterLabel.setToolTipText(CVMessages.getString(FILTERED_TOOLTIP));
-
- Composite tableArea = new Composite(container, SWT.NULL);
- viewer = createTableViewer(tableArea);
-
- currentCloud = getCurrentCloud(currentCloudSelector.getSelectionIndex(), clouds);
-
-// addListener(currentCloud);
- setViewerInput(currentCloud);
- setFilterLabelVisible(currentCloud, filterLabel);
-
- Point p1 = currentCloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point p2 = currentCloudSelector.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int centering = (p2.y - p1.y + 1) / 2;
-
- FormData f = new FormData();
- f.top = new FormAttachment(0, 5 + centering);
- f.left = new FormAttachment(0, 30);
- currentCloudSelectorLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(0, 5);
- f.left = new FormAttachment(currentCloudSelectorLabel, 5);
- currentCloudSelector.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(0, 5 + centering);
- f.right = new FormAttachment(100, -10);
- filterLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(currentCloudSelector, 8);
- f.left = new FormAttachment(0, 0);
- f.right = new FormAttachment(100, 0);
- f.bottom = new FormAttachment(100, 0);
- tableArea.setLayoutData(f);
-
- // Create the help context id for the viewer's control
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.jboss.tools.deltacloud.ui.viewer");
- hookContextMenu(viewer.getControl());
- getSite().setSelectionProvider(viewer);
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(workbenchSelectionListener);
-
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- private TableViewer createTableViewer(Composite tableArea) {
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableArea.setLayout(tableLayout);
-
- TableViewer viewer = new TableViewer(tableArea,
- SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
- Table table = viewer.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- ITableContentAndLabelProvider provider = getContentAndLabelProvider();
- viewer.setContentProvider(provider);
- viewer.setLabelProvider(provider);
- createColumns(tableLayout, table);
-
- viewer.setComparator(new TableViewerColumnComparator());
- table.setSortDirection(SWT.NONE);
-
- return viewer;
- }
-
- protected abstract ITableContentAndLabelProvider getContentAndLabelProvider();
-
- private void setViewerInput(DeltaCloud cloud) {
- if (currentCloud != null) {
- viewer.setInput(currentCloud);
- }
- }
-
- /**
- * Gets the clouds that are available in the model.
- *
- * @return the clouds
- */
- private DeltaCloud[] getClouds() {
- DeltaCloud[] clouds = new DeltaCloud[] {};
- try {
- clouds = DeltaCloudManager.getDefault().getClouds();
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Could not get all clouds",
- e, Display.getDefault().getActiveShell());
- }
- return clouds;
- }
-
- private int getCloudIndex(DeltaCloud cloud, DeltaCloud[] clouds) {
- if (cloud == null) {
- return 0;
- }
- return getCloudIndex(cloud.getName(), clouds);
- }
-
- private int getCloudIndex(String cloudName, DeltaCloud[] clouds) {
- int index = 0;
- if (cloudName != null && clouds.length > 0) {
- for (int i = 0; i < clouds.length; i++) {
- DeltaCloud cloud = clouds[i];
- if (cloudName != null && cloudName.equals(cloud.getName())) {
- index = i;
- break;
- }
- }
- }
- return index;
- }
-
- private void setFilterLabelVisible(DeltaCloud currentCloud, Label filterLabel) {
- if (currentCloud == null) {
- filterLabel.setVisible(false);
- return;
- }
-
- IInstanceFilter filter = currentCloud.getInstanceFilter();
- filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
- }
-
- private DeltaCloud getCurrentCloud(int cloudIndex, DeltaCloud[] clouds) {
- if (cloudIndex < 0 || cloudIndex >= clouds.length) {
- return null;
- }
-
- return clouds[cloudIndex];
- }
-
- private void createColumns(TableColumnLayout tableLayout, Table table) {
- for (int i = 0; i < InstanceViewLabelAndContentProvider.Column.getSize(); ++i) {
- InstanceViewLabelAndContentProvider.Column c =
- InstanceViewLabelAndContentProvider.Column.getColumn(i);
- TableColumn tc = new TableColumn(table, SWT.NONE);
- if (i == 0) {
- table.setSortColumn(tc);
- }
- tc.setText(CVMessages.getString(c.name()));
- tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight(), true));
- tc.addSelectionListener(new ColumnListener(i));
- }
- }
-
- private void createCloudSelector(Composite parent) {
- this.currentCloudSelectorLabel = new Label(parent, SWT.NULL);
- currentCloudSelectorLabel.setText(CVMessages.getString(CLOUD_SELECTOR_LABEL));
-
- this.currentCloudSelector = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- currentCloudSelector.addModifyListener(cloudModifyListener);
- // Following is a kludge so that on Linux the Combo is read-only but
- // has a white background.
- currentCloudSelector.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- e.doit = false;
- }
- });
- }
-
- private void hookContextMenu(Control control) {
- IMenuManager contextMenu = UIUtils.createContextMenu(control);
- UIUtils.registerContributionManager(UIUtils.getContextMenuId(getViewID()), contextMenu, control);
- }
-
- protected abstract String getViewID();
-
- private void initCloudSelector(String cloudNameToSelect, Combo cloudSelector, DeltaCloud[] clouds) {
- if (clouds.length > 0
- && cloudNameToSelect != null && cloudNameToSelect.length() > 0) {
- cloudSelector.setItems(toCloudNames(clouds));
- cloudSelector.select(getCloudIndex(cloudNameToSelect, clouds));
- }
- }
-
- public void cloudsChanged(int type) {
- int currIndex = 0;
- if (currentCloud != null) {
- currIndex = currentCloudSelector.getSelectionIndex();
- }
- DeltaCloud[] clouds = getClouds();
- int index = getCloudIndex(currentCloud, getClouds());
- if (type == ICloudManagerListener.RENAME_EVENT) {
- index = currIndex; // no change in cloud displayed
- }
-
- String[] cloudNames = toCloudNames(clouds);
- setCloudSelectorItems(cloudNames, currentCloudSelector);
- this.currentCloud = getCurrentCloud(index, clouds);
-
- if (cloudNames.length > 0) {
- currentCloudSelector.setText(cloudNames[index]);
- setViewerInput(currentCloud);
- } else {
- currentCloudSelector.setText("");
- setViewerInput(null);
- }
- }
-
- private String[] toCloudNames(DeltaCloud[] clouds) {
- List<String> cloudNames = new ArrayList<String>();
- for (DeltaCloud cloud : clouds) {
- if (cloud != null) {
- cloudNames.add(cloud.getName());
- }
- }
- return (String[]) cloudNames.toArray(new String[cloudNames.size()]);
- }
-
- private void setCloudSelectorItems(String[] cloudNames, Combo cloudSelector) {
- cloudSelector.removeModifyListener(cloudModifyListener);
- cloudSelector.setItems(cloudNames);
- cloudSelector.addModifyListener(cloudModifyListener);
- }
-
- /**
- * Refresh the states of the commands in the toolbar.
- */
- protected abstract void refreshToolbarCommandStates();
-
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * A common superclass for content- and label-providers that operate on
- * IDeltaCloudElements (currently DeltaCloudImage and DeltaCloudInstance)
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class AbstractCloudElementViewLabelAndContentProvider<CLOUDELEMENT extends IDeltaCloudElement> extends
- BaseLabelProvider implements ITableContentAndLabelProvider {
-
- private DeltaCloud currentCloud;
- private ICloudElementFilter<CLOUDELEMENT> localFilter;
- private TableViewer viewer;
-
- @Override
- public Object[] getElements(Object input) {
- return new Object[] {};
- }
-
- public void setFilter(ICloudElementFilter<CLOUDELEMENT> filter) {
- this.localFilter = filter;
- }
-
- @Override
- public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
- if (!(newInput instanceof DeltaCloud)) {
- return;
- }
- Assert.isTrue(viewer instanceof TableViewer);
- this.viewer = (TableViewer) viewer;
- removeListener(currentCloud);
- this.currentCloud = (DeltaCloud) newInput;
- addListener(currentCloud);
- // TODO internationalize strings
- asyncGetCloudElements(currentCloud);
- }
-
- public void listChanged(final DeltaCloud cloud, final CLOUDELEMENT[] cloudElements) {
- if (isCurrentCloud(cloud)) {
- addToViewer(cloudElements);
- }
- }
-
- private boolean isCurrentCloud(final DeltaCloud cloud) {
- return cloud != null
- && currentCloud != null
- && cloud.getName().equals(currentCloud.getName());
- }
-
- private void addToViewer(final CLOUDELEMENT[] cloudElements) {
- viewer.getControl().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- try {
- Object[] elements = filter(getFilter(currentCloud), cloudElements);
- viewer.add(elements);
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Could not get elements of clouds " + currentCloud.getName(),
- e, Display.getDefault().getActiveShell());
-
- }
- }
- });
- }
-
- private ICloudElementFilter<CLOUDELEMENT> getFilter(DeltaCloud cloud) {
- if (localFilter != null) {
- return localFilter;
- } else {
- return getCloudFilter(cloud);
- }
- }
-
- protected Object[] filter(ICloudElementFilter<CLOUDELEMENT> filter, CLOUDELEMENT[] cloudElements)
- throws DeltaCloudException {
- if (cloudElements == null) {
- return new Object[] {};
- }
- if (filter == null) {
- return cloudElements;
- } else {
- return filter.filter(cloudElements).toArray();
- }
- }
-
- @Override
- public void dispose() {
- removeListener(currentCloud);
- }
-
- protected abstract void addListener(DeltaCloud cloud);
-
- protected abstract void removeListener(DeltaCloud cloud);
-
- protected abstract ICloudElementFilter<CLOUDELEMENT> getCloudFilter(DeltaCloud cloud);
-
- protected abstract void asyncGetCloudElements(DeltaCloud cloud);
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVCloudElement extends CloudViewElement {
-
- private TreeViewer viewer;
-
- public CVCloudElement(Object element, String name, TreeViewer viewer) {
- super(element, viewer);
- this.viewer = viewer;
- }
-
- public String getName() {
- Object element = getElement();
- if (element instanceof DeltaCloud) {
- return ((DeltaCloud) element).getName();
- } else {
- return "";
- }
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public synchronized Object[] getChildren() {
- if (!initialized.get()) {
- DeltaCloud cloud = (DeltaCloud) getElement();
- CVCloudElementCategoryElement instances = new CVInstancesCategoryElement(cloud, viewer);
- addCategory(instances);
- CVCloudElementCategoryElement images = new CVImagesCategoryElement(cloud, viewer);
- addCategory(images);
- }
- initialized.set(true);
- return super.getChildren();
- }
-
- private void addCategory(CVCloudElementCategoryElement categoryElement) {
- children.add(categoryElement);
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new CloudPropertySource(getElement());
- }
-
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class CVCloudElementCategoryElement extends CloudViewElement {
-
- public CVCloudElementCategoryElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- addCloudElementListener(getCloud());
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public Object[] getChildren() {
- if (!initialized.get()) {
- setLoadingIndicator();
- asyncGetCloudElements();
- initialized.set(true);
- }
- return super.getChildren();
- }
-
- private void setLoadingIndicator() {
- children.add(new LoadingCloudViewElement(getViewer()));
- }
-
- protected abstract void asyncGetCloudElements();
-
- protected void addChildren(Object[] modelElements) {
- if (modelElements.length > CVNumericFoldingElement.FOLDING_SIZE) {
- addFoldedChildren(modelElements);
- } else {
- addChildren(getElements(modelElements, 0, modelElements.length));
- }
- }
-
- protected void addFoldedChildren(Object[] modelElements) {
- int min = 0;
- int max = CVNumericFoldingElement.FOLDING_SIZE;
- int length = modelElements.length;
- while (length > CVNumericFoldingElement.FOLDING_SIZE) {
- CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, getViewer());
- addChild(f);
- f.addChildren(getElements(modelElements, min, max));
- min += CVNumericFoldingElement.FOLDING_SIZE;
- max += CVNumericFoldingElement.FOLDING_SIZE;
- length -= CVNumericFoldingElement.FOLDING_SIZE;
- }
- if (length > 0) {
- CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, getViewer());
- addChild(f);
- f.addChildren(getElements(modelElements, min, min + length));
- }
- }
-
- protected abstract CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex);
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for cathegories
- return null;
- }
-
- protected DeltaCloud getCloud() {
- return (DeltaCloud) getElement();
- }
-
- @Override
- protected void dispose() {
- removeCloudElementListener(getCloud());
- }
-
- protected abstract void addCloudElementListener(DeltaCloud cloud);
-
- protected abstract void removeCloudElementListener(DeltaCloud cloud);
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVImageElement extends CloudViewElement {
-
- public CVImageElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- Object element = getElement();
- if (element instanceof DeltaCloudImage) {
- return ((DeltaCloudImage) element).getName();
- } else {
- return "";
- }
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new ImagePropertySource(getElement());
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.core.GetImagesCommand;
-import org.jboss.tools.deltacloud.core.IImageFilter;
-import org.jboss.tools.deltacloud.core.IImageListListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVImagesCategoryElement extends CVCloudElementCategoryElement implements IImageListListener {
-
- private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName"; //$NON-NLS-1$
-
- public CVImagesCategoryElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- return CVMessages.getString(IMAGE_CATEGORY_NAME);
- }
-
- protected void asyncGetCloudElements() {
- new GetImagesCommand(getCloud()).execute();
- }
-
- @Override
- protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
- CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
- for (int i = startIndex; i < stopIndex; ++i) {
- elements[i - startIndex] = new CVImageElement(modelElements[i], getViewer());
- }
- return elements;
- }
-
- @Override
- public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
- try {
- clearChildren();
- initialized.set(false);
- DeltaCloudImage[] images = filter(newImages);
- addChildren(images);
-// refresh();
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- MessageFormat.format("Could not get images from cloud \"{0}\"", cloud.getName()), e,
- getViewer().getControl().getShell());
- } finally {
- initialized.set(true);
- }
- // refresh();
- }
-
- // private void refresh() {
- // getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- //
- // @Override
- // public void run() {
- // getViewer().refresh(this, true);
- // }
- // });
- // }
-
- public DeltaCloudImage[] filter(DeltaCloudImage[] images) throws DeltaCloudException {
- DeltaCloud cloud = (DeltaCloud) getElement();
- IImageFilter f = cloud.getImageFilter();
- return f.filter(images).toArray(new DeltaCloudImage[images.length]);
- }
-
- protected void addCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.addImageListListener(this);
- }
- }
-
- protected void removeCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.removeImageListListener(this);
- }
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVInstanceElement extends CloudViewElement {
-
- public CVInstanceElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- Object element = getElement();
- StringBuilder sb = new StringBuilder();
- if (element instanceof DeltaCloudInstance) {
- DeltaCloudInstance instance = (DeltaCloudInstance) element;
- if (instance.getName() != null) {
- sb.append(instance.getName());
- }
- if (instance.getId() != null) {
- sb.append(" [").append(instance.getId()).append("] ");
- }
- }
- return sb.toString();
-
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new InstancePropertySource(this, getElement());
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.GetInstancesCommand;
-import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.core.IInstanceListListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVInstancesCategoryElement extends CVCloudElementCategoryElement implements IInstanceListListener {
-
- private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName"; //$NON-NLS-1$
-
- public CVInstancesCategoryElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- return CVMessages.getString(INSTANCE_CATEGORY_NAME);
- }
-
- protected void asyncGetCloudElements() {
- new GetInstancesCommand(getCloud()).execute();
- }
-
- @Override
- protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
- CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
- for (int i = startIndex; i < stopIndex; ++i) {
- elements[i - startIndex] = new CVInstanceElement(modelElements[i], getViewer());
- }
- return elements;
- }
-
- protected void addChildrenFor(Object[] modelElements, int startIndex, int stopIndex) {
- for (int i = startIndex; i < stopIndex; ++i) {
- addChild(new CVInstanceElement(modelElements[i], getViewer()));
- }
- }
-
- @Override
- public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
- try {
- initialized.set(false);
- clearChildren();
- final DeltaCloudInstance[] instances = filter(newInstances);
- addChildren(instances);
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- MessageFormat.format("Could not get instanceso from cloud \"{0}\"", cloud.getName()), e,
- getViewer().getControl().getShell());
- } finally {
- initialized.set(true);
- }
- }
-
- public DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) throws DeltaCloudException {
- IInstanceFilter f = getCloud().getInstanceFilter();
- return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
- }
-
- protected void addCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.addInstanceListListener(this);
- }
- }
-
- protected void removeCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.removeInstanceListListener(this);
- }
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVNumericFoldingElement extends CloudViewElement {
-
- public static int FOLDING_SIZE = 50;
- private Object min;
- private int max;
-
- public CVNumericFoldingElement(int min, int max, TreeViewer viewer) {
- super(null, viewer);
- this.min = min;
- this.max = max;
- }
-
- @Override
- public String getName() {
- return new StringBuilder()
- .append("[")
- .append(min)
- .append("..")
- .append(max - 1)
- .append("]").toString();
- }
-
- @Override
- public Object[] getChildren() {
- return super.getChildren();
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return null;
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-public class CVPropertySection extends AbstractPropertySection {
-
- /**
- * The Property Sheet Page.
- */
- protected PropertySheetPage page;
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
- * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- */
- public void createControls(Composite parent, final TabbedPropertySheetPage atabbedPropertySheetPage) {
- super.createControls(parent, atabbedPropertySheetPage);
-
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- page = new CVPropertySheetPage();
- page.createControl(composite);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- page.getControl().setLayoutData(data);
-
- page.getControl().addControlListener(new ControlAdapter() {
-
- public void controlResized(ControlEvent e) {
- atabbedPropertySheetPage.resizeScrolledComposite();
- }
- });
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
- page.selectionChanged(part, selection);
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose()
- */
- public void dispose() {
- super.dispose();
-
- if (page != null) {
- page.dispose();
- page = null;
- }
-
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
- */
- public void refresh() {
- page.refresh();
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
- */
- public boolean shouldUseExtraSpace() {
- return true;
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.ui.views.properties.IPropertySheetEntry;
-import org.eclipse.ui.views.properties.PropertySheetSorter;
-
-public class CVPropertySheetNonSorter extends PropertySheetSorter {
-
- public void sort(IPropertySheetEntry[] entries) {
- // do nothing
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.ui.views.properties.PropertySheetPage;
-
-public class CVPropertySheetPage extends PropertySheetPage {
-
- public CVPropertySheetPage() {
- super();
- setSorter(new CVPropertySheetNonSorter());
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVRootElement extends CloudViewElement implements ICloudManagerListener {
-
- public CVRootElement(TreeViewer viewer) {
- super(DeltaCloudManager.getDefault(), viewer); //$NON-NLS-1$
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- @Override
- public String getName() {
- return "root"; //$NON-NLS-1$
- }
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for the root element
- return null;
- }
-
- @Override
- public Object[] getChildren() {
- if (!initialized.get()) {
- DeltaCloudManager m = DeltaCloudManager.getDefault();
- try {
- addClouds(m.getClouds());
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError("Error", "Could not get clouds", e, Display.getDefault().getActiveShell());
- } finally {
- initialized.set(true);
- }
- }
- return super.getChildren();
- }
-
- private void addClouds(DeltaCloud[] clouds) {
- for (DeltaCloud cloud : clouds) {
- CVCloudElement e = new CVCloudElement(cloud, cloud.getName(), getViewer());
- children.add(e);
- }
- }
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- }
-
- public void cloudsChanged(int type) {
- DeltaCloudManager m = DeltaCloudManager.getDefault();
- try {
- DeltaCloud[] clouds = m.getClouds();
- addClouds(clouds);
- initialized.set(true);
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Could not get all clouds",
- e, Display.getDefault().getActiveShell());
- }
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
-
-public class CVTypeMapper extends AbstractTypeMapper {
-
- @SuppressWarnings("rawtypes")
- @Override
- public Class mapType(Object object) {
- if (object instanceof TreeNode) {
- return ((TreeNode) object).getValue().getClass();
- }
- return super.mapType(object);
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-public class CloudPropertySource implements IPropertySource {
-
- private static final String PROPERTY_NAME = "deltacloud.views.cloud.name"; //$NON-NLS-1$
- private static final String PROPERTY_URL = "deltacloud.views.cloud.id"; //$NON-NLS-1$
- private static final String PROPERTY_USERNAME = "deltacloud.views.cloud.username"; //$NON-NLS-1$
- private static final String PROPERTY_NAME_TITLE = "PropertyName.title"; //$NON-NLS-1$
- private static final String PROPERTY_URL_TITLE = "PropertyURL.title"; //$NON-NLS-1$
- private static final String PROPERTY_USERNAME_TITLE = "PropertyUsername.title"; //$NON-NLS-1$
-
- private IPropertyDescriptor[] propertyDescriptors;
- private DeltaCloud cloud;
-
- public CloudPropertySource(Object o) {
- cloud = (DeltaCloud)o;
- }
-
- @Override
- public Object getEditableValue() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
- CVMessages.getString(PROPERTY_NAME_TITLE));
- PropertyDescriptor urlDescriptor = new PropertyDescriptor(PROPERTY_URL,
- CVMessages.getString(PROPERTY_URL_TITLE));
- PropertyDescriptor userDescriptor = new PropertyDescriptor(PROPERTY_USERNAME,
- CVMessages.getString(PROPERTY_USERNAME_TITLE));
-
- propertyDescriptors = new IPropertyDescriptor[] {
- nameDescriptor,
- urlDescriptor,
- userDescriptor,
- };
- }
- return propertyDescriptors;
- }
-
- @Override
- public Object getPropertyValue(Object id) {
- if (id.equals(PROPERTY_NAME))
- return cloud.getName();
- if (id.equals(PROPERTY_URL))
- return cloud.getURL();
- if (id.equals(PROPERTY_USERNAME))
- return cloud.getUsername();
- return null;
- }
-
- @Override
- public boolean isPropertySet(Object id) {
- return false;
- }
-
-
- @Override
- public void resetPropertyValue(Object id) {
- // do nothing
- }
-
- @Override
- public void setPropertyValue(Object id, Object value) {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class CloudViewContentProvider implements ITreeContentProvider {
-
- private CloudViewElement root;
-
- @Override
- public Object[] getChildren(Object parentElement) {
- CloudViewElement e = (CloudViewElement)parentElement;
- return e.getChildren();
- }
-
- @Override
- public Object getParent(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.getParent();
- }
-
- @Override
- public boolean hasChildren(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.hasChildren();
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return root.getChildren();
- }
-
- @Override
- public void dispose() {
-
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- root = (CloudViewElement)newInput;
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class CloudViewElement implements IAdaptable {
-
- private TreeViewer viewer;
- private Object element;
- private CloudViewElement parent;
- protected Collection<CloudViewElement> children =
- Collections.synchronizedCollection(new ArrayList<CloudViewElement>());
- protected AtomicBoolean initialized = new AtomicBoolean();
-
- public CloudViewElement(Object element, TreeViewer viewer) {
- this.element = element;
- this.viewer = viewer;
- initDisposeListener(viewer);
- }
-
- public abstract String getName();
-
- public Object[] getChildren() {
- return children.toArray();
- }
-
- protected void clearChildren() {
- children.clear();
- }
-
- public boolean hasChildren() {
- return children.size() > 0;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public void addChild(final CloudViewElement e) {
- addChildToModel(e);
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- getViewer().add(this, e);
- }
- });
- }
-
- public void addChildToModel(CloudViewElement element) {
- children.add(element);
- element.setParent(this);
- }
-
- public void addChildren(final CloudViewElement[] elements) {
- for (CloudViewElement element : elements) {
- addChildToModel(element);
- }
-
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- getViewer().add(this, elements);
- }
- });
- }
-
- public void setParent(CloudViewElement e) {
- parent = e;
- }
-
- public Object getElement() {
- return element;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter == IPropertySource.class) {
- IPropertySource p = getPropertySource();
- return p;
- }
- return null;
- }
-
- public abstract IPropertySource getPropertySource();
-
- protected TreeViewer getViewer() {
- return viewer;
- }
-
- private void initDisposeListener(Viewer viewer) {
- final Control control = viewer.getControl();
- control.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- control.addDisposeListener(new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- }
- });
- }
- });
- }
-
- protected void dispose() {
- // nothing to do
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-
-public class CloudViewLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof CVCloudElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_CLOUD);
- } else if (element instanceof CVCloudElementCategoryElement ||
- element instanceof CVNumericFoldingElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_FOLDER);
- } else if (element instanceof CVInstanceElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_INSTANCE);
- } else if (element instanceof CVImageElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_IMAGE);
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.getName();
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-public class DeltaCloudView extends ViewPart implements ICloudManagerListener,
- ITabbedPropertySheetPageContributor {
-
- /**
- * The ID of the view as specified by the extension.
- */
- public static final String ID = "org.jboss.tools.deltacloud.ui.views.DeltaCloudView";
-
- public static final String COLLAPSE_ALL = "CollapseAll.label"; //$NON-NLS-1$
- private static final String HELP_CONTEXTID = "org.jboss.tools.deltacloud.ui.viewer";
-
- private TreeViewer viewer;
-
- private Action collapseall;
-
- public void createPartControl(Composite parent) {
- viewer = createTreeViewer(parent);
-
- // Create the help context id for the viewer's control
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), HELP_CONTEXTID);
- makeActions();
- hookContextMenu(viewer.getTree());
- contributeToActionBars();
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- private TreeViewer createTreeViewer(Composite parent) {
- TreeViewer viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.setContentProvider(new CloudViewContentProvider());
- viewer.setLabelProvider(new CloudViewLabelProvider());
- viewer.setUseHashlookup(true);
- viewer.setInput(new CVRootElement(viewer));
- viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- getSite().setSelectionProvider(viewer);
- return viewer;
- }
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- super.dispose();
- }
-
- private void hookContextMenu(Control control) {
- IMenuManager contextMenu = UIUtils.createContextMenu(control);
- UIUtils.registerContributionManager(UIUtils.getContextMenuId(ID), contextMenu, control);
- }
-
- private void contributeToActionBars() {
- // TODO: replace by declarative command
- fillLocalToolBar(getViewSite().getActionBars().getToolBarManager());
- }
-
- private void fillLocalToolBar(IToolBarManager manager) {
- manager.add(collapseall);
- }
-
- private void makeActions() {
- collapseall = createCollapseAllAction();
- }
-
- private Action createCollapseAllAction() {
- Action collapseAll = new Action() {
- public void run() {
- viewer.collapseAll();
- }
- };
- collapseAll.setText(CVMessages.getString(COLLAPSE_ALL));
- collapseAll.setToolTipText(CVMessages.getString(COLLAPSE_ALL));
- collapseAll.setImageDescriptor(SWTImagesFactory.DESC_COLLAPSE_ALL);
- return collapseAll;
- }
-
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- @Override
- public void cloudsChanged(int type) {
- viewer.setInput(new CVRootElement(viewer));
- }
-
- @Override
- public String getContributorId() {
- return getSite().getId();
- }
-
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- if (adapter == IPropertySheetPage.class)
- // If Tabbed view is desired, then change the
- // following to new TabbedPropertySheetPage(this)
- return new CVPropertySheetPage();
- return super.getAdapter(adapter);
- }
-}
\ No newline at end of file
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-
-/**
- * @author Andre Dietisheim
- */
-public interface ITableContentAndLabelProvider extends IStructuredContentProvider, ITableLabelProvider{
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-
-public class ImagePropertySource implements IPropertySource {
-
- private static final String PROPERTY_NAME = "deltacloud.views.image.name"; //$NON-NLS-1$
- private static final String PROPERTY_ID = "deltacloud.views.image.id"; //$NON-NLS-1$
- private static final String PROPERTY_ARCH = "deltacloud.views.image.arch"; //$NON-NLS-1$
- private static final String PROPERTY_DESCRIPTION = "deltacloud.views.image.description"; //$NON-NLS-1$
- private static final String PROPERTY_NAME_TITLE = "PropertyName.title"; //$NON-NLS-1$
- private static final String PROPERTY_ID_TITLE = "PropertyId.title"; //$NON-NLS-1$
- private static final String PROPERTY_ARCH_TITLE = "PropertyArch.title"; //$NON-NLS-1$
- private static final String PROPERTY_DESCRIPTION_TITLE = "PropertyDescription.title"; //$NON-NLS-1$
-
- private IPropertyDescriptor[] propertyDescriptors;
- private DeltaCloudImage image;
-
- public ImagePropertySource(Object o) {
- image = (DeltaCloudImage)o;
- }
-
- @Override
- public Object getEditableValue() {
- return null;
- }
-
- @Override
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
- CVMessages.getString(PROPERTY_NAME_TITLE));
- PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
- CVMessages.getString(PROPERTY_ID_TITLE));
- PropertyDescriptor archDescriptor = new PropertyDescriptor(PROPERTY_ARCH,
- CVMessages.getString(PROPERTY_ARCH_TITLE));
- PropertyDescriptor descDescriptor = new PropertyDescriptor(PROPERTY_DESCRIPTION,
- CVMessages.getString(PROPERTY_DESCRIPTION_TITLE));
-
- propertyDescriptors = new IPropertyDescriptor[] {
- nameDescriptor,
- idDescriptor,
- archDescriptor,
- descDescriptor,
- };
- }
- return propertyDescriptors;
- }
-
- @Override
- public Object getPropertyValue(Object id) {
- if (id.equals(PROPERTY_NAME))
- return image.getName();
- if (id.equals(PROPERTY_ID))
- return image.getId();
- if (id.equals(PROPERTY_ARCH))
- return image.getArchitecture();
- if (id.equals(PROPERTY_DESCRIPTION))
- return image.getDescription();
- return null;
- }
-
- @Override
- public boolean isPropertySet(Object id) {
- return false;
- }
-
-
- @Override
- public void resetPropertyValue(Object id) {
- }
-
- @Override
- public void setPropertyValue(Object id, Object value) {
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-
-/**
- * A view that displays images of a DeltaCloud.
- *
- * @see DeltaCloud#getImages()
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class ImageView extends AbstractCloudElementTableView<DeltaCloudImage> { //implements IImageListListener {
-
- @Override
- protected String getSelectedCloudPrefsKey() {
- return IDeltaCloudPreferenceConstants.LAST_CLOUD_IMAGE_VIEW;
- }
-
- @Override
- protected String getViewID() {
- return "org.jboss.tools.deltacloud.ui.views.ImageView";
- }
-
- @Override
- protected ITableContentAndLabelProvider getContentAndLabelProvider() {
- return new ImageViewLabelAndContentProvider();
- }
-
- @Override
- protected void refreshToolbarCommandStates() {
- // do nothing
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.core.GetImagesCommand;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IImageListListener;
-
-/**
- * @author Jeff Johnston
- * @author André Dietisheim
- */
-public class ImageViewLabelAndContentProvider extends AbstractCloudElementViewLabelAndContentProvider<DeltaCloudImage>
- implements ITableContentAndLabelProvider, IImageListListener {
-
- public enum Column {
- NAME(0, 20),
- ID(1, 20),
- ARCH(2, 20),
- DESC(3, 40);
-
- private int column;
- private int weight;
- private static final Map<Integer, Column> lookup = new HashMap<Integer, Column>();
-
- static {
- for (Column c : EnumSet.allOf(Column.class))
- lookup.put(c.getColumnNumber(), c);
- }
-
- private Column(int column, int weight) {
- this.column = column;
- this.weight = weight;
- }
-
- public int getColumnNumber() {
- return column;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public static Column getColumn(int number) {
- return lookup.get(number);
- }
-
- public static int getSize() {
- return lookup.size();
- }
-
- };
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- Column c = Column.getColumn(columnIndex);
- DeltaCloudImage i = (DeltaCloudImage) element;
- switch (c) {
- case NAME:
- return i.getName();
- case ID:
- return i.getId();
- case ARCH:
- return i.getArchitecture();
- case DESC:
- return i.getDescription();
- }
- return "";
- }
-
- protected ICloudElementFilter<DeltaCloudImage> getCloudFilter(DeltaCloud cloud) {
- return cloud.getImageFilter();
- }
-
- @Override
- protected void asyncGetCloudElements(DeltaCloud cloud) {
- new GetImagesCommand(cloud).execute();
- }
-
- @Override
- protected void addListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.addImageListListener(this);
- }
- }
-
- @Override
- protected void removeListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.removeImageListListener(this);
- }
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.util.List;
-
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
-
-public class InstancePropertySource implements IPropertySource {
-
- private static final String PROPERTY_NAME = "deltacloud.views.instance.name"; //$NON-NLS-1$
- private static final String PROPERTY_ID = "deltacloud.views.instance.id"; //$NON-NLS-1$
- public static final String PROPERTY_OWNER = "deltacloud.views.instance.owner"; //$NON-NLS-1$
- public static final String PROPERTY_STATE = "deltacloud.views.instance.state"; //$NON-NLS-1$
- private static final String PROPERTY_HOSTNAME = "deltacloud.views.instance.hostname"; //$NON-NLS-1$
- private static final String PROPERTY_KEYNAME = "deltacloud.views.instance.keyname"; //$NON-NLS-1$
- private static final String PROPERTY_PROFILEID = "deltacloud.views.instance.profileid"; //$NON-NLS-1$
- private static final String PROPERTY_REALMID = "deltacloud.views.instance.realmid"; //$NON-NLS-1$
- private static final String PROPERTY_IMAGEID = "deltacloud.views.instance.imageid"; //$NON-NLS-1$
- private static final String PROPERTY_NAME_TITLE = "PropertyName.title"; //$NON-NLS-1$
- private static final String PROPERTY_ID_TITLE = "PropertyId.title"; //$NON-NLS-1$
- private static final String PROPERTY_OWNER_TITLE = "PropertyOwnerId.title"; //$NON-NLS-1$
- private static final String PROPERTY_STATE_TITLE = "PropertyState.title"; //$NON-NLS-1$
- private static final String PROPERTY_HOSTNAME_TITLE = "PropertyHostname.title"; //$NON-NLS-1$
- private static final String PROPERTY_KEYNAME_TITLE = "PropertyKeyname.title"; //$NON-NLS-1$
- private static final String PROPERTY_PROFILEID_TITLE = "PropertyProfileId.title"; //$NON-NLS-1$
- private static final String PROPERTY_REALMID_TITLE = "PropertyRealmId.title"; //$NON-NLS-1$
- private static final String PROPERTY_IMAGEID_TITLE = "PropertyImageId.title"; //$NON-NLS-1$
-
- private IPropertyDescriptor[] propertyDescriptors;
- private DeltaCloudInstance instance;
- private DeltaCloud cloud;
-
- public InstancePropertySource(CVInstanceElement element, Object o) {
- cloud = CloudViewElementUtils.getCloud(element);
- instance = (DeltaCloudInstance) o;
- }
-
- @Override
- public Object getEditableValue() {
- return null;
- }
-
- @Override
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
- CVMessages.getString(PROPERTY_NAME_TITLE));
- PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
- CVMessages.getString(PROPERTY_ID_TITLE));
- PropertyDescriptor ownerDescriptor = new PropertyDescriptor(PROPERTY_OWNER,
- CVMessages.getString(PROPERTY_OWNER_TITLE));
- PropertyDescriptor stateDescriptor = new PropertyDescriptor(PROPERTY_STATE,
- CVMessages.getString(PROPERTY_STATE_TITLE));
- PropertyDescriptor hardwareDescriptor = new PropertyDescriptor(PROPERTY_PROFILEID,
- CVMessages.getString(PROPERTY_PROFILEID_TITLE));
- PropertyDescriptor realmDescriptor = new PropertyDescriptor(PROPERTY_REALMID,
- CVMessages.getString(PROPERTY_REALMID_TITLE));
- PropertyDescriptor imageDescriptor = new PropertyDescriptor(PROPERTY_IMAGEID,
- CVMessages.getString(PROPERTY_IMAGEID_TITLE));
- PropertyDescriptor hostnameDescriptor = new PropertyDescriptor(PROPERTY_HOSTNAME,
- CVMessages.getString(PROPERTY_HOSTNAME_TITLE));
- PropertyDescriptor keyDescriptor = new PropertyDescriptor(PROPERTY_KEYNAME,
- CVMessages.getString(PROPERTY_KEYNAME_TITLE));
-
- propertyDescriptors = new IPropertyDescriptor[] {
- nameDescriptor,
- idDescriptor,
- ownerDescriptor,
- stateDescriptor,
- hostnameDescriptor,
- keyDescriptor,
- hardwareDescriptor,
- realmDescriptor,
- imageDescriptor,
- };
- }
- return propertyDescriptors;
- }
-
- @Override
- public Object getPropertyValue(Object id) {
- if (id.equals(PROPERTY_NAME))
- return instance.getName();
- if (id.equals(PROPERTY_ID))
- return instance.getId();
- if (id.equals(PROPERTY_OWNER))
- return instance.getOwnerId();
- if (id.equals(PROPERTY_PROFILEID))
- return instance.getProfileId();
- if (id.equals(PROPERTY_REALMID))
- return instance.getRealmId();
- if (id.equals(PROPERTY_IMAGEID))
- return instance.getImageId();
- if (id.equals(PROPERTY_KEYNAME)) {
- return getKey();
- }
- if (id.equals(PROPERTY_STATE)) {
- return instance.getState();
- }
- if (id.equals(PROPERTY_HOSTNAME)) {
- List<String> hostnames = instance.getHostNames();
- if (hostnames.size() >= 1)
- return hostnames.get(0);
- }
- return null;
- }
-
- private Object getKey() {
- // At present (Deltacloud 0.0.7), the keyname is omitted
- // in the data passed back from a listInstances request.
- // If an instance is running and the keyname is missing,
- // we can refresh the instance by its id and this will give us
- // the full data. We can then replace the instance so that
- // it will be complete for future requests until a refresh gets the
- // entire list again.
- String key = null;
- try {
- key = instance.getKey();
- if (!cloud.getType().equals(DeltaCloud.MOCK_TYPE)) {
- if (instance.getState().equals(DeltaCloudInstance.RUNNING) && (key == null || key.length() == 0)) {
- instance = cloud.refreshInstance(instance.getId());
- if (instance != null) {
- key = instance.getKey();
- if (key != null && key.length() > 0)
- cloud.replaceInstance(instance);
- }
- }
- }
- } catch (DeltaCloudException e) {
- ErrorUtils.handleError(
- "Error", "Could not get key for instance " + instance.getName(),
- e, Display.getDefault().getActiveShell());
- }
- return key;
- }
-
- @Override
- public boolean isPropertySet(Object id) {
- return false;
- }
-
- @Override
- public void resetPropertyValue(Object id) {
- // do nothing
- }
-
- @Override
- public void setPropertyValue(Object id, Object value) {
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.services.IEvaluationService;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-
-/**
- * A view that displays instances of a DeltaCloud
- *
- * @see DeltaCloud#getInstances()
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class InstanceView extends AbstractCloudElementTableView<DeltaCloudInstance> {
-
- protected String getSelectedCloudPrefsKey() {
- return IDeltaCloudPreferenceConstants.LAST_CLOUD_INSTANCE_VIEW;
- }
-
- @Override
- protected String getViewID() {
- return "org.jboss.tools.deltacloud.ui.views.InstanceView";
- }
-
- @Override
- protected ITableContentAndLabelProvider getContentAndLabelProvider() {
- return new InstanceViewLabelAndContentProvider();
- }
-
- @Override
- protected void refreshToolbarCommandStates() {
- IEvaluationService evaluationService = (IEvaluationService) PlatformUI.getWorkbench().getService(
- IEvaluationService.class);
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStart");
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStop");
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canReboot");
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canDestroy");
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.GetInstancesCommand;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IInstanceListListener;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-
-/**
- * @author Jeff Jonhston
- * @author Andre Dietisheim
- */
-public class InstanceViewLabelAndContentProvider extends
- AbstractCloudElementViewLabelAndContentProvider<DeltaCloudInstance> implements ITableContentAndLabelProvider, IInstanceListListener {
-
- public enum Column {
- NAME(0, 20),
- ID(1, 20),
- STATUS(2, 6),
- HOSTNAME(3, 40);
-
- private int column;
- private int weight;
- private static final Map<Integer, Column> lookup = new HashMap<Integer, Column>();
-
- static {
- for (Column c : EnumSet.allOf(Column.class))
- lookup.put(c.getColumnNumber(), c);
- }
-
- private Column(int column, int weight) {
- this.column = column;
- this.weight = weight;
- }
-
- public int getColumnNumber() {
- return column;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public static Column getColumn(int number) {
- return lookup.get(number);
- }
-
- public static int getSize() {
- return lookup.size();
- }
-
- };
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- Column c = Column.getColumn(columnIndex);
- DeltaCloudInstance i = (DeltaCloudInstance) element;
- switch (c) {
- case STATUS:
- return getStatusIcon(i.getState());
- default:
- return null;
- }
- }
-
- private Image getStatusIcon(String status) {
- if (DeltaCloudInstance.STOPPED.equals(status)) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_STOPPED);
- } else if (DeltaCloudInstance.RUNNING.equals(status)) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_RUNNING);
- } else if (DeltaCloudInstance.BOGUS.equals(status)) {
- return PlatformUI.getWorkbench().getSharedImages().
- getImage(ISharedImages.IMG_DEC_FIELD_WARNING);
- } else {
- return null;
- }
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- Column c = Column.getColumn(columnIndex);
- DeltaCloudInstance i = (DeltaCloudInstance) element;
- if (i != null) {
- switch (c) {
- case NAME:
- return i.getName();
- case ID:
- return i.getId();
- case STATUS:
- return "";
- case HOSTNAME:
- return i.getHostName();
- }
- }
- return "";
- }
-
- @Override
- public void dispose() {
- }
-
- protected ICloudElementFilter<DeltaCloudInstance> getCloudFilter(DeltaCloud cloud) {
- return cloud.getInstanceFilter();
- }
-
- @Override
- protected void asyncGetCloudElements(DeltaCloud cloud) {
- new GetInstancesCommand(cloud).execute();
- }
-
- @Override
- protected void addListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.addInstanceListListener(this);
- }
- }
-
- @Override
- protected void removeListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.removeInstanceListListener(this);
- }
- }
-
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * A tree element that shows the user that the tree is currently loading
- * elements
- */
-public class LoadingCloudViewElement extends CloudViewElement {
- protected LoadingCloudViewElement(TreeViewer viewer) {
- super(null, viewer);
- }
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for this element
- return null;
- }
-
- @Override
- public String getName() {
- // TODO: internationalize strings
- return "Loading...";
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-
-/**
- * A viewer comparator that compares labels in a column of a table.<br>
- * This implementation was extracted out of the former Image- and
- * InstanceComparator which were mostly identical.
- *
- * @see ViewerComparator
- *
- * @author Jeff Johnston
- * @author André Dietisheim
- */
-public class TableViewerColumnComparator extends ViewerComparator {
-
- private final static int UP = 1;
-
- private int column;
- private int direction;
-
- public TableViewerColumnComparator() {
- this(0);
- }
-
- public TableViewerColumnComparator(int column) {
- this.column = column;
- this.direction = UP;
- }
-
- public void setColumn(int newColumn) {
- if (column != newColumn)
- direction = UP;
- column = newColumn;
- }
-
- public int getColumn() {
- return column;
- }
-
- public void reverseDirection() {
- direction *= -1;
- }
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- int tmp = compareByColumn(viewer, e1, e2);
- return tmp * direction;
- }
-
- private int compareByColumn(Viewer viewer, Object e1, Object e2) {
- Assert.isTrue(viewer instanceof TableViewer
- && ((TableViewer) viewer).getLabelProvider() instanceof ITableLabelProvider);
-
- ITableLabelProvider provider = (ITableLabelProvider) ((TableViewer) viewer).getLabelProvider();
- String s1 = provider.getColumnText(e1, column);
- String s2 = provider.getColumnText(e2, column);
- return s1.compareToIgnoreCase(s2);
- }
-}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CloudPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVCloudElement extends CloudViewElement {
+
+ private TreeViewer viewer;
+
+ public CVCloudElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ this.viewer = viewer;
+ }
+
+ public String getName() {
+ Object element = getElement();
+ if (element instanceof DeltaCloud) {
+ return ((DeltaCloud) element).getName();
+ } else {
+ return "";
+ }
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public synchronized Object[] getChildren() {
+ if (!initialized.get()) {
+ DeltaCloud cloud = (DeltaCloud) getElement();
+ CVCloudElementCategoryElement instances = new CVInstancesCategoryElement(cloud, this, viewer);
+ addCategory(instances);
+ CVCloudElementCategoryElement images = new CVImagesCategoryElement(cloud, this, viewer);
+ addCategory(images);
+ }
+ initialized.set(true);
+ return super.getChildren();
+ }
+
+ private void addCategory(CVCloudElementCategoryElement categoryElement) {
+ children.add(categoryElement);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new CloudPropertySource(getElement());
+ }
+
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class CVCloudElementCategoryElement extends CloudViewElement {
+
+ public CVCloudElementCategoryElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ addCloudElementListener(getCloud());
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized.get()) {
+ setLoadingIndicator();
+ asyncGetCloudElements();
+ initialized.set(true);
+ }
+ return super.getChildren();
+ }
+
+ private void setLoadingIndicator() {
+ children.add(new LoadingCloudViewElement(this, viewer));
+ }
+
+ protected abstract void asyncGetCloudElements();
+
+ protected void addChildren(Object[] modelElements) {
+ if (modelElements.length > CVNumericFoldingElement.FOLDING_SIZE) {
+ addFoldedChildren(modelElements);
+ } else {
+ addChildren(getElements(modelElements, 0, modelElements.length));
+ }
+ }
+
+ protected void addFoldedChildren(Object[] modelElements) {
+ int min = 0;
+ int max = CVNumericFoldingElement.FOLDING_SIZE;
+ int length = modelElements.length;
+ while (length > CVNumericFoldingElement.FOLDING_SIZE) {
+ CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, this, viewer);
+ addChild(f);
+ f.addChildren(getElements(modelElements, min, max));
+ min += CVNumericFoldingElement.FOLDING_SIZE;
+ max += CVNumericFoldingElement.FOLDING_SIZE;
+ length -= CVNumericFoldingElement.FOLDING_SIZE;
+ }
+ if (length > 0) {
+ CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, this, viewer);
+ addChild(f);
+ f.addChildren(getElements(modelElements, min, min + length));
+ }
+ }
+
+ protected abstract CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex);
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for cathegories
+ return null;
+ }
+
+ protected DeltaCloud getCloud() {
+ return (DeltaCloud) getElement();
+ }
+
+ @Override
+ protected void dispose() {
+ removeCloudElementListener(getCloud());
+ }
+
+ protected abstract void addCloudElementListener(DeltaCloud cloud);
+
+ protected abstract void removeCloudElementListener(DeltaCloud cloud);
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.ImagePropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVImageElement extends CloudViewElement {
+
+ public CVImageElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ Object element = getElement();
+ if (element instanceof DeltaCloudImage) {
+ return ((DeltaCloudImage) element).getName();
+ } else {
+ return "";
+ }
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new ImagePropertySource(getElement());
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
+import org.jboss.tools.deltacloud.core.IImageFilter;
+import org.jboss.tools.deltacloud.core.IImageListListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVImagesCategoryElement extends CVCloudElementCategoryElement implements IImageListListener {
+
+ private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName"; //$NON-NLS-1$
+
+ public CVImagesCategoryElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ return CVMessages.getString(IMAGE_CATEGORY_NAME);
+ }
+
+ protected void asyncGetCloudElements() {
+ new GetImagesCommand(getCloud()).execute();
+ }
+
+ @Override
+ protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
+ CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
+ for (int i = startIndex; i < stopIndex; ++i) {
+ elements[i - startIndex] = new CVImageElement(modelElements[i], this, viewer);
+ }
+ return elements;
+ }
+
+ @Override
+ public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
+ try {
+ clearChildren();
+ initialized.set(false);
+ DeltaCloudImage[] images = filter(newImages);
+ addChildren(images);
+ expand();
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get images from cloud \"{0}\"", cloud.getName()), e,
+ viewer.getControl().getShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+
+ public DeltaCloudImage[] filter(DeltaCloudImage[] images) throws DeltaCloudException {
+ DeltaCloud cloud = (DeltaCloud) getElement();
+ IImageFilter f = cloud.getImageFilter();
+ return f.filter(images).toArray(new DeltaCloudImage[images.length]);
+ }
+
+ protected void addCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.addImageListListener(this);
+ }
+ }
+
+ protected void removeCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.removeImageListListener(this);
+ }
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.InstancePropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVInstanceElement extends CloudViewElement {
+
+ public CVInstanceElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ Object element = getElement();
+ StringBuilder sb = new StringBuilder();
+ if (element instanceof DeltaCloudInstance) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) element;
+ if (instance.getName() != null) {
+ sb.append(instance.getName());
+ }
+ if (instance.getId() != null) {
+ sb.append(" [").append(instance.getId()).append("] ");
+ }
+ }
+ return sb.toString();
+
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new InstancePropertySource(this, getElement());
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
+import org.jboss.tools.deltacloud.core.IInstanceFilter;
+import org.jboss.tools.deltacloud.core.IInstanceListListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVInstancesCategoryElement extends CVCloudElementCategoryElement implements IInstanceListListener {
+
+ private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName"; //$NON-NLS-1$
+
+ public CVInstancesCategoryElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ return CVMessages.getString(INSTANCE_CATEGORY_NAME);
+ }
+
+ protected void asyncGetCloudElements() {
+ new GetInstancesCommand(getCloud()).execute();
+ }
+
+ @Override
+ protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int stopIndex) {
+ CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
+ for (int i = startIndex; i < stopIndex; ++i) {
+ elements[i - startIndex] = new CVInstanceElement(modelElements[i], this, viewer);
+ }
+ return elements;
+ }
+
+ @Override
+ public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
+ try {
+ clearChildren();
+ initialized.set(false);
+ final DeltaCloudInstance[] instances = filter(newInstances);
+ addChildren(instances);
+ expand();
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get instanceso from cloud \"{0}\"", cloud.getName()), e,
+ viewer.getControl().getShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+
+ public DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) throws DeltaCloudException {
+ IInstanceFilter f = getCloud().getInstanceFilter();
+ return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
+ }
+
+ protected void addCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.addInstanceListListener(this);
+ }
+ }
+
+ protected void removeCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.removeInstanceListListener(this);
+ }
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVNumericFoldingElement extends CloudViewElement {
+
+ public static int FOLDING_SIZE = 50;
+ private Object min;
+ private int max;
+
+ public CVNumericFoldingElement(int min, int max, CloudViewElement parent, TreeViewer viewer) {
+ super(null, parent, viewer);
+ this.min = min;
+ this.max = max;
+ }
+
+ @Override
+ public String getName() {
+ return new StringBuilder()
+ .append("[")
+ .append(min)
+ .append("..")
+ .append(max - 1)
+ .append("]").toString();
+ }
+
+ @Override
+ public Object[] getChildren() {
+ return super.getChildren();
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return null;
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVRootElement extends CloudViewElement implements ICloudManagerListener {
+
+ public CVRootElement(TreeViewer viewer) {
+ super(DeltaCloudManager.getDefault(), null, viewer); //$NON-NLS-1$
+ DeltaCloudManager.getDefault().addCloudManagerListener(this);
+ }
+
+ @Override
+ public String getName() {
+ return "root"; //$NON-NLS-1$
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for the root element
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized.get()) {
+ DeltaCloudManager m = DeltaCloudManager.getDefault();
+ try {
+ addClouds(m.getClouds());
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError("Error", "Could not get clouds", e, Display.getDefault().getActiveShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+ return super.getChildren();
+ }
+
+ private void addClouds(DeltaCloud[] clouds) {
+ for (DeltaCloud cloud : clouds) {
+ addCloud(cloud);
+ }
+ }
+
+ private void addCloud(DeltaCloud cloud) {
+ CVCloudElement e = new CVCloudElement(cloud, this, viewer);
+ children.add(e);
+ }
+
+ private CloudViewElement getCloudViewElement(DeltaCloud cloudToMatch) {
+ for (CloudViewElement cloudElement : children) {
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ if (cloudToMatch.equals(cloud)) {
+ return cloudElement;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ DeltaCloudManager.getDefault().removeCloudManagerListener(this);
+ }
+
+ public void cloudsChanged(int type, DeltaCloud cloud) {
+ switch (type) {
+ case ICloudManagerListener.ADD_EVENT:
+ addChild(new CVCloudElement(cloud, this, viewer));
+ break;
+ case ICloudManagerListener.REMOVE_EVENT:
+ removeChild(getCloudViewElement(cloud));
+ break;
+ case ICloudManagerListener.RENAME_EVENT:
+ CloudViewElement cloudViewElement = getCloudViewElement(cloud);
+ viewer.refresh(cloudViewElement);
+ break;
+ }
+ initialized.set(true);
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
+
+public class CVTypeMapper extends AbstractTypeMapper {
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Class mapType(Object object) {
+ if (object instanceof TreeNode) {
+ return ((TreeNode) object).getValue().getClass();
+ }
+ return super.mapType(object);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class CloudViewContentProvider implements ITreeContentProvider {
+
+ private CloudViewElement root;
+
+ @Override
+ public Object[] getChildren(Object element) {
+ if (element instanceof CloudViewElement) {
+ return ((CloudViewElement) element).getChildren();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof CloudViewElement) {
+ return ((CloudViewElement) element).getParent();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ CloudViewElement e = (CloudViewElement) element;
+ return e.hasChildren();
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return root.getChildren();
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ root = (CloudViewElement) newInput;
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class CloudViewElement implements IAdaptable {
+
+ private Object element;
+ private CloudViewElement parent;
+ protected List<CloudViewElement> children =
+ Collections.synchronizedList(new ArrayList<CloudViewElement>());
+ protected TreeViewer viewer;
+ protected AtomicBoolean initialized = new AtomicBoolean();
+
+ public CloudViewElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ this.element = element;
+ this.parent = parent;
+ this.viewer = viewer;
+ initDisposeListener(viewer);
+ }
+
+ public abstract String getName();
+
+ public Object[] getChildren() {
+ return children.toArray();
+ }
+
+ protected void clearChildren() {
+ getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ // viewer.getTree().setRedraw(false);
+ for (final CloudViewElement element : children) {
+ viewer.remove(element);
+ }
+ // viewer.getTree().setRedraw(true);
+ }
+ });
+ children.clear();
+ }
+
+ public boolean hasChildren() {
+ return children.size() > 0;
+ }
+
+ public Object getParent() {
+ return parent;
+ }
+
+ public void addChild(final CloudViewElement element) {
+ children.add(element);
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.add(CloudViewElement.this, element);
+ }
+ });
+ }
+
+ public void addChildren(final CloudViewElement[] elements) {
+ for (CloudViewElement element : elements) {
+ children.add(element);
+ }
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.add(CloudViewElement.this, elements);
+ }
+ });
+ }
+
+ public void removeChild(final CloudViewElement element) {
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (element != null) {
+ int index = children.indexOf(element);
+ viewer.remove(CloudViewElement.this, index);
+ }
+ }
+ });
+ }
+
+ protected void expand() {
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.setExpandedState(CloudViewElement.this, true);
+ }
+ });
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ IPropertySource p = getPropertySource();
+ return p;
+ }
+ return null;
+ }
+
+ public abstract IPropertySource getPropertySource();
+
+ private void initDisposeListener(Viewer viewer) {
+ final Control control = viewer.getControl();
+ control.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ control.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ });
+ }
+ });
+ }
+
+ protected Display getDisplay() {
+ return viewer.getControl().getDisplay();
+ }
+
+ protected void dispose() {
+ // nothing to do
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+public class CloudViewLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof CVCloudElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_CLOUD);
+ } else if (element instanceof CVCloudElementCategoryElement ||
+ element instanceof CVNumericFoldingElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_FOLDER);
+ } else if (element instanceof CVInstanceElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_INSTANCE);
+ } else if (element instanceof CVImageElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_IMAGE);
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ CloudViewElement e = (CloudViewElement)element;
+ return e.getName();
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySheetPage;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+public class DeltaCloudView extends ViewPart implements ITabbedPropertySheetPageContributor {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.jboss.tools.deltacloud.ui.views.DeltaCloudView";
+
+ public static final String COLLAPSE_ALL = "CollapseAll.label"; //$NON-NLS-1$
+ private static final String HELP_CONTEXTID = "org.jboss.tools.deltacloud.ui.viewer";
+
+ private TreeViewer viewer;
+
+ private Action collapseall;
+
+ public void createPartControl(Composite parent) {
+ viewer = createTreeViewer(parent);
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), HELP_CONTEXTID);
+ makeActions();
+ hookContextMenu(viewer.getTree());
+ contributeToActionBars();
+ }
+
+ private TreeViewer createTreeViewer(Composite parent) {
+ TreeViewer viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ viewer.setContentProvider(new CloudViewContentProvider());
+ viewer.setLabelProvider(new CloudViewLabelProvider());
+ viewer.setUseHashlookup(true);
+ viewer.setInput(new CVRootElement(viewer));
+ viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ getSite().setSelectionProvider(viewer);
+ return viewer;
+ }
+
+ private void hookContextMenu(Control control) {
+ IMenuManager contextMenu = UIUtils.createContextMenu(control);
+ UIUtils.registerContributionManager(UIUtils.getContextMenuId(ID), contextMenu, control);
+ }
+
+ private void contributeToActionBars() {
+ // TODO: replace by declarative command
+ fillLocalToolBar(getViewSite().getActionBars().getToolBarManager());
+ }
+
+ private void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(collapseall);
+ }
+
+ private void makeActions() {
+ collapseall = createCollapseAllAction();
+ }
+
+ private Action createCollapseAllAction() {
+ Action collapseAll = new Action() {
+ public void run() {
+ viewer.collapseAll();
+ }
+ };
+ collapseAll.setText(CVMessages.getString(COLLAPSE_ALL));
+ collapseAll.setToolTipText(CVMessages.getString(COLLAPSE_ALL));
+ collapseAll.setImageDescriptor(SWTImagesFactory.DESC_COLLAPSE_ALL);
+ return collapseAll;
+ }
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ @Override
+ public String getContributorId() {
+ return getSite().getId();
+ }
+
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ if (adapter == IPropertySheetPage.class)
+ // If Tabbed view is desired, then change the
+ // following to new TabbedPropertySheetPage(this)
+ return new CVPropertySheetPage();
+ return super.getAdapter(adapter);
+ }
+}
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * A tree element that shows the user that the tree is currently loading
+ * elements
+ */
+public class LoadingCloudViewElement extends CloudViewElement {
+ protected LoadingCloudViewElement(CloudViewElement parent, TreeViewer viewer) {
+ super(null, parent, viewer);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for this element
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO: internationalize strings
+ return "Loading...";
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java (from rev 27061, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud.property;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+public class CVPropertySection extends AbstractPropertySection {
+
+ /**
+ * The Property Sheet Page.
+ */
+ protected PropertySheetPage page;
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(Composite parent, final TabbedPropertySheetPage atabbedPropertySheetPage) {
+ super.createControls(parent, atabbedPropertySheetPage);
+
+ Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ page = new CVPropertySheetPage();
+ page.createControl(composite);
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ page.getControl().setLayoutData(data);
+
+ page.getControl().addControlListener(new ControlAdapter() {
+
+ public void controlResized(ControlEvent e) {
+ atabbedPropertySheetPage.resizeScrolledComposite();
+ }
+ });
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ page.selectionChanged(part, selection);
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+
+ if (page != null) {
+ page.dispose();
+ page = null;
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ page.refresh();
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
+ */
+ public boolean shouldUseExtraSpace() {
+ return true;
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java (from rev 27061, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud.property;
+
+import org.eclipse.ui.views.properties.IPropertySheetEntry;
+import org.eclipse.ui.views.properties.PropertySheetSorter;
+
+public class CVPropertySheetNonSorter extends PropertySheetSorter {
+
+ public void sort(IPropertySheetEntry[] entries) {
+ // do nothing
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java (from rev 27061, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud.property;
+
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+public class CVPropertySheetPage extends PropertySheetPage {
+
+ public CVPropertySheetPage() {
+ super();
+ setSorter(new CVPropertySheetNonSorter());
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java (from rev 27061, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud.property;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+public class CloudPropertySource implements IPropertySource {
+
+ private static final String PROPERTY_NAME = "deltacloud.views.cloud.name"; //$NON-NLS-1$
+ private static final String PROPERTY_URL = "deltacloud.views.cloud.id"; //$NON-NLS-1$
+ private static final String PROPERTY_USERNAME = "deltacloud.views.cloud.username"; //$NON-NLS-1$
+ private static final String PROPERTY_NAME_TITLE = "PropertyName.title"; //$NON-NLS-1$
+ private static final String PROPERTY_URL_TITLE = "PropertyURL.title"; //$NON-NLS-1$
+ private static final String PROPERTY_USERNAME_TITLE = "PropertyUsername.title"; //$NON-NLS-1$
+
+ private IPropertyDescriptor[] propertyDescriptors;
+ private DeltaCloud cloud;
+
+ public CloudPropertySource(Object o) {
+ cloud = (DeltaCloud)o;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ if (propertyDescriptors == null) {
+ PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
+ CVMessages.getString(PROPERTY_NAME_TITLE));
+ PropertyDescriptor urlDescriptor = new PropertyDescriptor(PROPERTY_URL,
+ CVMessages.getString(PROPERTY_URL_TITLE));
+ PropertyDescriptor userDescriptor = new PropertyDescriptor(PROPERTY_USERNAME,
+ CVMessages.getString(PROPERTY_USERNAME_TITLE));
+
+ propertyDescriptors = new IPropertyDescriptor[] {
+ nameDescriptor,
+ urlDescriptor,
+ userDescriptor,
+ };
+ }
+ return propertyDescriptors;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(PROPERTY_NAME))
+ return cloud.getName();
+ if (id.equals(PROPERTY_URL))
+ return cloud.getURL();
+ if (id.equals(PROPERTY_USERNAME))
+ return cloud.getUsername();
+ return null;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ // do nothing
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java (from rev 27061, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud.property;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+public class ImagePropertySource implements IPropertySource {
+
+ private static final String PROPERTY_NAME = "deltacloud.views.image.name"; //$NON-NLS-1$
+ private static final String PROPERTY_ID = "deltacloud.views.image.id"; //$NON-NLS-1$
+ private static final String PROPERTY_ARCH = "deltacloud.views.image.arch"; //$NON-NLS-1$
+ private static final String PROPERTY_DESCRIPTION = "deltacloud.views.image.description"; //$NON-NLS-1$
+ private static final String PROPERTY_NAME_TITLE = "PropertyName.title"; //$NON-NLS-1$
+ private static final String PROPERTY_ID_TITLE = "PropertyId.title"; //$NON-NLS-1$
+ private static final String PROPERTY_ARCH_TITLE = "PropertyArch.title"; //$NON-NLS-1$
+ private static final String PROPERTY_DESCRIPTION_TITLE = "PropertyDescription.title"; //$NON-NLS-1$
+
+ private IPropertyDescriptor[] propertyDescriptors;
+ private DeltaCloudImage image;
+
+ public ImagePropertySource(Object o) {
+ image = (DeltaCloudImage)o;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ if (propertyDescriptors == null) {
+ PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
+ CVMessages.getString(PROPERTY_NAME_TITLE));
+ PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
+ CVMessages.getString(PROPERTY_ID_TITLE));
+ PropertyDescriptor archDescriptor = new PropertyDescriptor(PROPERTY_ARCH,
+ CVMessages.getString(PROPERTY_ARCH_TITLE));
+ PropertyDescriptor descDescriptor = new PropertyDescriptor(PROPERTY_DESCRIPTION,
+ CVMessages.getString(PROPERTY_DESCRIPTION_TITLE));
+
+ propertyDescriptors = new IPropertyDescriptor[] {
+ nameDescriptor,
+ idDescriptor,
+ archDescriptor,
+ descDescriptor,
+ };
+ }
+ return propertyDescriptors;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(PROPERTY_NAME))
+ return image.getName();
+ if (id.equals(PROPERTY_ID))
+ return image.getId();
+ if (id.equals(PROPERTY_ARCH))
+ return image.getArchitecture();
+ if (id.equals(PROPERTY_DESCRIPTION))
+ return image.getDescription();
+ return null;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java (from rev 27061, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud.property;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVInstanceElement;
+import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
+
+public class InstancePropertySource implements IPropertySource {
+
+ private static final String PROPERTY_NAME = "deltacloud.views.instance.name"; //$NON-NLS-1$
+ private static final String PROPERTY_ID = "deltacloud.views.instance.id"; //$NON-NLS-1$
+ public static final String PROPERTY_OWNER = "deltacloud.views.instance.owner"; //$NON-NLS-1$
+ public static final String PROPERTY_STATE = "deltacloud.views.instance.state"; //$NON-NLS-1$
+ private static final String PROPERTY_HOSTNAME = "deltacloud.views.instance.hostname"; //$NON-NLS-1$
+ private static final String PROPERTY_KEYNAME = "deltacloud.views.instance.keyname"; //$NON-NLS-1$
+ private static final String PROPERTY_PROFILEID = "deltacloud.views.instance.profileid"; //$NON-NLS-1$
+ private static final String PROPERTY_REALMID = "deltacloud.views.instance.realmid"; //$NON-NLS-1$
+ private static final String PROPERTY_IMAGEID = "deltacloud.views.instance.imageid"; //$NON-NLS-1$
+ private static final String PROPERTY_NAME_TITLE = "PropertyName.title"; //$NON-NLS-1$
+ private static final String PROPERTY_ID_TITLE = "PropertyId.title"; //$NON-NLS-1$
+ private static final String PROPERTY_OWNER_TITLE = "PropertyOwnerId.title"; //$NON-NLS-1$
+ private static final String PROPERTY_STATE_TITLE = "PropertyState.title"; //$NON-NLS-1$
+ private static final String PROPERTY_HOSTNAME_TITLE = "PropertyHostname.title"; //$NON-NLS-1$
+ private static final String PROPERTY_KEYNAME_TITLE = "PropertyKeyname.title"; //$NON-NLS-1$
+ private static final String PROPERTY_PROFILEID_TITLE = "PropertyProfileId.title"; //$NON-NLS-1$
+ private static final String PROPERTY_REALMID_TITLE = "PropertyRealmId.title"; //$NON-NLS-1$
+ private static final String PROPERTY_IMAGEID_TITLE = "PropertyImageId.title"; //$NON-NLS-1$
+
+ private IPropertyDescriptor[] propertyDescriptors;
+ private DeltaCloudInstance instance;
+ private DeltaCloud cloud;
+
+ public InstancePropertySource(CVInstanceElement element, Object o) {
+ cloud = CloudViewElementUtils.getCloud(element);
+ instance = (DeltaCloudInstance) o;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ if (propertyDescriptors == null) {
+ PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
+ CVMessages.getString(PROPERTY_NAME_TITLE));
+ PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
+ CVMessages.getString(PROPERTY_ID_TITLE));
+ PropertyDescriptor ownerDescriptor = new PropertyDescriptor(PROPERTY_OWNER,
+ CVMessages.getString(PROPERTY_OWNER_TITLE));
+ PropertyDescriptor stateDescriptor = new PropertyDescriptor(PROPERTY_STATE,
+ CVMessages.getString(PROPERTY_STATE_TITLE));
+ PropertyDescriptor hardwareDescriptor = new PropertyDescriptor(PROPERTY_PROFILEID,
+ CVMessages.getString(PROPERTY_PROFILEID_TITLE));
+ PropertyDescriptor realmDescriptor = new PropertyDescriptor(PROPERTY_REALMID,
+ CVMessages.getString(PROPERTY_REALMID_TITLE));
+ PropertyDescriptor imageDescriptor = new PropertyDescriptor(PROPERTY_IMAGEID,
+ CVMessages.getString(PROPERTY_IMAGEID_TITLE));
+ PropertyDescriptor hostnameDescriptor = new PropertyDescriptor(PROPERTY_HOSTNAME,
+ CVMessages.getString(PROPERTY_HOSTNAME_TITLE));
+ PropertyDescriptor keyDescriptor = new PropertyDescriptor(PROPERTY_KEYNAME,
+ CVMessages.getString(PROPERTY_KEYNAME_TITLE));
+
+ propertyDescriptors = new IPropertyDescriptor[] {
+ nameDescriptor,
+ idDescriptor,
+ ownerDescriptor,
+ stateDescriptor,
+ hostnameDescriptor,
+ keyDescriptor,
+ hardwareDescriptor,
+ realmDescriptor,
+ imageDescriptor,
+ };
+ }
+ return propertyDescriptors;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(PROPERTY_NAME))
+ return instance.getName();
+ if (id.equals(PROPERTY_ID))
+ return instance.getId();
+ if (id.equals(PROPERTY_OWNER))
+ return instance.getOwnerId();
+ if (id.equals(PROPERTY_PROFILEID))
+ return instance.getProfileId();
+ if (id.equals(PROPERTY_REALMID))
+ return instance.getRealmId();
+ if (id.equals(PROPERTY_IMAGEID))
+ return instance.getImageId();
+ if (id.equals(PROPERTY_KEYNAME)) {
+ return getKey();
+ }
+ if (id.equals(PROPERTY_STATE)) {
+ return instance.getState();
+ }
+ if (id.equals(PROPERTY_HOSTNAME)) {
+ List<String> hostnames = instance.getHostNames();
+ if (hostnames.size() >= 1)
+ return hostnames.get(0);
+ }
+ return null;
+ }
+
+ private Object getKey() {
+ // At present (Deltacloud 0.0.7), the keyname is omitted
+ // in the data passed back from a listInstances request.
+ // If an instance is running and the keyname is missing,
+ // we can refresh the instance by its id and this will give us
+ // the full data. We can then replace the instance so that
+ // it will be complete for future requests until a refresh gets the
+ // entire list again.
+ String key = null;
+ try {
+ key = instance.getKey();
+ if (!cloud.getType().equals(DeltaCloud.MOCK_TYPE)) {
+ if (instance.getState().equals(DeltaCloudInstance.RUNNING) && (key == null || key.length() == 0)) {
+ instance = cloud.refreshInstance(instance.getId());
+ if (instance != null) {
+ key = instance.getKey();
+ if (key != null && key.length() > 0)
+ cloud.replaceInstance(instance);
+ }
+ }
+ }
+ } catch (DeltaCloudException e) {
+ ErrorUtils.handleError(
+ "Error", "Could not get key for instance " + instance.getName(),
+ e, Display.getDefault().getActiveShell());
+ }
+ return key;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ // do nothing
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java (from rev 27175, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,403 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TableViewer;
+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.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
+import org.jboss.tools.deltacloud.core.IInstanceFilter;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.internal.deltacloud.ui.preferences.TextPreferenceValue;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * A common superclass for viewers that operate on IDeltaCloudElements
+ * (currently DeltaCloudImage and DeltaCloudInstance)
+ *
+ * @see InstanceView
+ * @see ImageView
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractCloudElementTableView<CLOUDELEMENT extends IDeltaCloudElement> extends ViewPart implements
+ ICloudManagerListener {
+
+ private final static String CLOUD_SELECTOR_LABEL = "CloudSelector.label"; //$NON-NLS-1$
+
+ private static final String FILTERED_LABEL = "Filtered.label"; //$NON-NLS-1$
+ private static final String FILTERED_TOOLTIP = "FilteredImages.tooltip"; //$NON-NLS-1$
+
+ private Combo currentCloudSelector;
+ private Label currentCloudSelectorLabel;
+ private TableViewer viewer;
+
+ private DeltaCloud currentCloud;
+
+ private TextPreferenceValue lastSelectedCloudPref;
+
+ private ModifyListener cloudModifyListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ int index = currentCloudSelector.getSelectionIndex();
+ if (index < 0) {
+ return;
+ }
+
+// removeListener(currentCloud);
+
+ AbstractCloudElementTableView.this.currentCloud = getCurrentCloud(index, getClouds());
+ if (currentCloud != null) {
+ lastSelectedCloudPref.store(currentCloud.getName());
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ setViewerInput(currentCloud);
+// addListener(currentCloud);
+ }
+ });
+ }
+ }
+ };
+
+ private ISelectionListener workbenchSelectionListener = new ISelectionListener() {
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ if (cloud != null) {
+ currentCloudSelector.select(getCloudIndex(cloud, getClouds()));
+ }
+ }
+ };
+
+// private Job viewerInputJob = new Job("") {
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+//
+// return Status.OK_STATUS;
+// }
+// };
+
+ public AbstractCloudElementTableView() {
+ lastSelectedCloudPref = new TextPreferenceValue(getSelectedCloudPrefsKey(), Activator.getDefault());
+ }
+
+ private class ColumnListener extends SelectionAdapter {
+
+ private int column;
+
+ public ColumnListener(int column) {
+ this.column = column;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TableViewerColumnComparator comparator = (TableViewerColumnComparator) viewer.getComparator();
+ Table t = viewer.getTable();
+ if (comparator.getColumn() == column) {
+ comparator.reverseDirection();
+ }
+ comparator.setColumn(column);
+ TableColumn tc = (TableColumn) e.getSource();
+ t.setSortColumn(tc);
+ t.setSortDirection(SWT.NONE);
+ viewer.refresh();
+ }
+ };
+
+ protected abstract String getSelectedCloudPrefsKey();
+
+ @Override
+ public void dispose() {
+ DeltaCloudManager.getDefault().removeCloudManagerListener(this);
+ super.dispose();
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ container.setLayout(layout);
+
+ DeltaCloud[] clouds = getClouds();
+
+ createCloudSelector(container);
+ initCloudSelector(lastSelectedCloudPref.get(), currentCloudSelector, clouds);
+
+ Label filterLabel = new Label(container, SWT.NULL);
+ filterLabel.setText(CVMessages.getString(FILTERED_LABEL));
+ filterLabel.setToolTipText(CVMessages.getString(FILTERED_TOOLTIP));
+
+ Composite tableArea = new Composite(container, SWT.NULL);
+ viewer = createTableViewer(tableArea);
+
+ currentCloud = getCurrentCloud(currentCloudSelector.getSelectionIndex(), clouds);
+
+// addListener(currentCloud);
+ setViewerInput(currentCloud);
+ setFilterLabelVisible(currentCloud, filterLabel);
+
+ Point p1 = currentCloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = currentCloudSelector.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.top = new FormAttachment(0, 5 + centering);
+ f.left = new FormAttachment(0, 30);
+ currentCloudSelectorLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(0, 5);
+ f.left = new FormAttachment(currentCloudSelectorLabel, 5);
+ currentCloudSelector.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(0, 5 + centering);
+ f.right = new FormAttachment(100, -10);
+ filterLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(currentCloudSelector, 8);
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ f.bottom = new FormAttachment(100, 0);
+ tableArea.setLayoutData(f);
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.jboss.tools.deltacloud.ui.viewer");
+ hookContextMenu(viewer.getControl());
+ getSite().setSelectionProvider(viewer);
+ getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(workbenchSelectionListener);
+
+ DeltaCloudManager.getDefault().addCloudManagerListener(this);
+ }
+
+ private TableViewer createTableViewer(Composite tableArea) {
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableArea.setLayout(tableLayout);
+
+ TableViewer viewer = new TableViewer(tableArea,
+ SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
+ Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ ITableContentAndLabelProvider provider = getContentAndLabelProvider();
+ viewer.setContentProvider(provider);
+ viewer.setLabelProvider(provider);
+ createColumns(tableLayout, table);
+
+ viewer.setComparator(new TableViewerColumnComparator());
+ table.setSortDirection(SWT.NONE);
+
+ return viewer;
+ }
+
+ protected abstract ITableContentAndLabelProvider getContentAndLabelProvider();
+
+ private void setViewerInput(DeltaCloud cloud) {
+ if (currentCloud != null) {
+ viewer.setInput(currentCloud);
+ }
+ }
+
+ /**
+ * Gets the clouds that are available in the model.
+ *
+ * @return the clouds
+ */
+ private DeltaCloud[] getClouds() {
+ DeltaCloud[] clouds = new DeltaCloud[] {};
+ try {
+ clouds = DeltaCloudManager.getDefault().getClouds();
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ "Could not get all clouds",
+ e, Display.getDefault().getActiveShell());
+ }
+ return clouds;
+ }
+
+ private int getCloudIndex(DeltaCloud cloud, DeltaCloud[] clouds) {
+ if (cloud == null) {
+ return 0;
+ }
+ return getCloudIndex(cloud.getName(), clouds);
+ }
+
+ private int getCloudIndex(String cloudName, DeltaCloud[] clouds) {
+ int index = 0;
+ if (cloudName != null && clouds.length > 0) {
+ for (int i = 0; i < clouds.length; i++) {
+ DeltaCloud cloud = clouds[i];
+ if (cloudName != null && cloudName.equals(cloud.getName())) {
+ index = i;
+ break;
+ }
+ }
+ }
+ return index;
+ }
+
+ private void setFilterLabelVisible(DeltaCloud currentCloud, Label filterLabel) {
+ if (currentCloud == null) {
+ filterLabel.setVisible(false);
+ return;
+ }
+
+ IInstanceFilter filter = currentCloud.getInstanceFilter();
+ filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
+ }
+
+ private DeltaCloud getCurrentCloud(int cloudIndex, DeltaCloud[] clouds) {
+ if (cloudIndex < 0 || cloudIndex >= clouds.length) {
+ return null;
+ }
+
+ return clouds[cloudIndex];
+ }
+
+ private void createColumns(TableColumnLayout tableLayout, Table table) {
+ for (int i = 0; i < InstanceViewLabelAndContentProvider.Column.getSize(); ++i) {
+ InstanceViewLabelAndContentProvider.Column c =
+ InstanceViewLabelAndContentProvider.Column.getColumn(i);
+ TableColumn tc = new TableColumn(table, SWT.NONE);
+ if (i == 0) {
+ table.setSortColumn(tc);
+ }
+ tc.setText(CVMessages.getString(c.name()));
+ tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight(), true));
+ tc.addSelectionListener(new ColumnListener(i));
+ }
+ }
+
+ private void createCloudSelector(Composite parent) {
+ this.currentCloudSelectorLabel = new Label(parent, SWT.NULL);
+ currentCloudSelectorLabel.setText(CVMessages.getString(CLOUD_SELECTOR_LABEL));
+
+ this.currentCloudSelector = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ currentCloudSelector.addModifyListener(cloudModifyListener);
+ // Following is a kludge so that on Linux the Combo is read-only but
+ // has a white background.
+ currentCloudSelector.addVerifyListener(new VerifyListener() {
+ @Override
+ public void verifyText(VerifyEvent e) {
+ e.doit = false;
+ }
+ });
+ }
+
+ private void hookContextMenu(Control control) {
+ IMenuManager contextMenu = UIUtils.createContextMenu(control);
+ UIUtils.registerContributionManager(UIUtils.getContextMenuId(getViewID()), contextMenu, control);
+ }
+
+ protected abstract String getViewID();
+
+ private void initCloudSelector(String cloudNameToSelect, Combo cloudSelector, DeltaCloud[] clouds) {
+ if (clouds.length > 0
+ && cloudNameToSelect != null && cloudNameToSelect.length() > 0) {
+ cloudSelector.setItems(toCloudNames(clouds));
+ cloudSelector.select(getCloudIndex(cloudNameToSelect, clouds));
+ }
+ }
+
+ public void cloudsChanged(int type, DeltaCloud cloud) {
+ int currIndex = 0;
+ if (currentCloud != null) {
+ currIndex = currentCloudSelector.getSelectionIndex();
+ }
+ DeltaCloud[] clouds = getClouds();
+ int index = getCloudIndex(currentCloud, getClouds());
+ if (type == ICloudManagerListener.RENAME_EVENT) {
+ index = currIndex; // no change in cloud displayed
+ }
+
+ String[] cloudNames = toCloudNames(clouds);
+ setCloudSelectorItems(cloudNames, currentCloudSelector);
+ this.currentCloud = getCurrentCloud(index, clouds);
+
+ if (cloudNames.length > 0) {
+ currentCloudSelector.setText(cloudNames[index]);
+ setViewerInput(currentCloud);
+ } else {
+ currentCloudSelector.setText("");
+ setViewerInput(null);
+ }
+ }
+
+ private String[] toCloudNames(DeltaCloud[] clouds) {
+ List<String> cloudNames = new ArrayList<String>();
+ for (DeltaCloud cloud : clouds) {
+ if (cloud != null) {
+ cloudNames.add(cloud.getName());
+ }
+ }
+ return (String[]) cloudNames.toArray(new String[cloudNames.size()]);
+ }
+
+ private void setCloudSelectorItems(String[] cloudNames, Combo cloudSelector) {
+ cloudSelector.removeModifyListener(cloudModifyListener);
+ cloudSelector.setItems(cloudNames);
+ cloudSelector.addModifyListener(cloudModifyListener);
+ }
+
+ /**
+ * Refresh the states of the commands in the toolbar.
+ */
+ protected abstract void refreshToolbarCommandStates();
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java (from rev 27190, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+
+/**
+ * A common superclass for content- and label-providers that operate on
+ * IDeltaCloudElements (currently DeltaCloudImage and DeltaCloudInstance)
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractCloudElementViewLabelAndContentProvider<CLOUDELEMENT extends IDeltaCloudElement> extends
+ BaseLabelProvider implements ITableContentAndLabelProvider {
+
+ private DeltaCloud currentCloud;
+ private ICloudElementFilter<CLOUDELEMENT> localFilter;
+ private TableViewer viewer;
+
+ @Override
+ public Object[] getElements(Object input) {
+ return new Object[] {};
+ }
+
+ public void setFilter(ICloudElementFilter<CLOUDELEMENT> filter) {
+ this.localFilter = filter;
+ }
+
+ @Override
+ public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
+ if (!(newInput instanceof DeltaCloud)) {
+ return;
+ }
+ Assert.isTrue(viewer instanceof TableViewer);
+ this.viewer = (TableViewer) viewer;
+ removeListener(currentCloud);
+ this.currentCloud = (DeltaCloud) newInput;
+ addListener(currentCloud);
+ // TODO internationalize strings
+ asyncGetCloudElements(currentCloud);
+ }
+
+ public void listChanged(final DeltaCloud cloud, final CLOUDELEMENT[] cloudElements) {
+ if (isCurrentCloud(cloud)) {
+ addToViewer(cloudElements);
+ }
+ }
+
+ private boolean isCurrentCloud(final DeltaCloud cloud) {
+ return cloud != null
+ && currentCloud != null
+ && cloud.getName().equals(currentCloud.getName());
+ }
+
+ private void addToViewer(final CLOUDELEMENT[] cloudElements) {
+ viewer.getControl().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ Object[] elements = filter(getFilter(currentCloud), cloudElements);
+ viewer.add(elements);
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ "Could not get elements of clouds " + currentCloud.getName(),
+ e, Display.getDefault().getActiveShell());
+
+ }
+ }
+ });
+ }
+
+ private ICloudElementFilter<CLOUDELEMENT> getFilter(DeltaCloud cloud) {
+ if (localFilter != null) {
+ return localFilter;
+ } else {
+ return getCloudFilter(cloud);
+ }
+ }
+
+ protected Object[] filter(ICloudElementFilter<CLOUDELEMENT> filter, CLOUDELEMENT[] cloudElements)
+ throws DeltaCloudException {
+ if (cloudElements == null) {
+ return new Object[] {};
+ }
+ if (filter == null) {
+ return cloudElements;
+ } else {
+ return filter.filter(cloudElements).toArray();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ removeListener(currentCloud);
+ }
+
+ protected abstract void addListener(DeltaCloud cloud);
+
+ protected abstract void removeListener(DeltaCloud cloud);
+
+ protected abstract ICloudElementFilter<CLOUDELEMENT> getCloudFilter(DeltaCloud cloud);
+
+ protected abstract void asyncGetCloudElements(DeltaCloud cloud);
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java (from rev 27084, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface ITableContentAndLabelProvider extends IStructuredContentProvider, ITableLabelProvider{
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java (from rev 27175, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+
+/**
+ * A view that displays images of a DeltaCloud.
+ *
+ * @see DeltaCloud#getImages()
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class ImageView extends AbstractCloudElementTableView<DeltaCloudImage> {
+
+ @Override
+ protected String getSelectedCloudPrefsKey() {
+ return IDeltaCloudPreferenceConstants.LAST_CLOUD_IMAGE_VIEW;
+ }
+
+ @Override
+ protected String getViewID() {
+ return "org.jboss.tools.deltacloud.ui.views.ImageView";
+ }
+
+ @Override
+ protected ITableContentAndLabelProvider getContentAndLabelProvider() {
+ return new ImageViewLabelAndContentProvider();
+ }
+
+ @Override
+ protected void refreshToolbarCommandStates() {
+ // do nothing
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java (from rev 27185, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IImageListListener;
+
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
+public class ImageViewLabelAndContentProvider extends AbstractCloudElementViewLabelAndContentProvider<DeltaCloudImage>
+ implements ITableContentAndLabelProvider, IImageListListener {
+
+ public enum Column {
+ NAME(0, 20),
+ ID(1, 20),
+ ARCH(2, 20),
+ DESC(3, 40);
+
+ private int column;
+ private int weight;
+ private static final Map<Integer, Column> lookup = new HashMap<Integer, Column>();
+
+ static {
+ for (Column c : EnumSet.allOf(Column.class))
+ lookup.put(c.getColumnNumber(), c);
+ }
+
+ private Column(int column, int weight) {
+ this.column = column;
+ this.weight = weight;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public static Column getColumn(int number) {
+ return lookup.get(number);
+ }
+
+ public static int getSize() {
+ return lookup.size();
+ }
+
+ };
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudImage i = (DeltaCloudImage) element;
+ switch (c) {
+ case NAME:
+ return i.getName();
+ case ID:
+ return i.getId();
+ case ARCH:
+ return i.getArchitecture();
+ case DESC:
+ return i.getDescription();
+ }
+ return "";
+ }
+
+ protected ICloudElementFilter<DeltaCloudImage> getCloudFilter(DeltaCloud cloud) {
+ return cloud.getImageFilter();
+ }
+
+ @Override
+ protected void asyncGetCloudElements(DeltaCloud cloud) {
+ new GetImagesCommand(cloud).execute();
+ }
+
+ @Override
+ protected void addListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.addImageListListener(this);
+ }
+ }
+
+ @Override
+ protected void removeListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.removeImageListListener(this);
+ }
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java (from rev 27175, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.services.IEvaluationService;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+
+/**
+ * A view that displays instances of a DeltaCloud
+ *
+ * @see DeltaCloud#getInstances()
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class InstanceView extends AbstractCloudElementTableView<DeltaCloudInstance> {
+
+ protected String getSelectedCloudPrefsKey() {
+ return IDeltaCloudPreferenceConstants.LAST_CLOUD_INSTANCE_VIEW;
+ }
+
+ @Override
+ protected String getViewID() {
+ return "org.jboss.tools.deltacloud.ui.views.InstanceView";
+ }
+
+ @Override
+ protected ITableContentAndLabelProvider getContentAndLabelProvider() {
+ return new InstanceViewLabelAndContentProvider();
+ }
+
+ @Override
+ protected void refreshToolbarCommandStates() {
+ IEvaluationService evaluationService = (IEvaluationService) PlatformUI.getWorkbench().getService(
+ IEvaluationService.class);
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStart");
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStop");
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canReboot");
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canDestroy");
+ }
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java (from rev 27185, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IInstanceListListener;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+/**
+ * @author Jeff Jonhston
+ * @author Andre Dietisheim
+ */
+public class InstanceViewLabelAndContentProvider extends
+ AbstractCloudElementViewLabelAndContentProvider<DeltaCloudInstance> implements ITableContentAndLabelProvider, IInstanceListListener {
+
+ public enum Column {
+ NAME(0, 20),
+ ID(1, 20),
+ STATUS(2, 6),
+ HOSTNAME(3, 40);
+
+ private int column;
+ private int weight;
+ private static final Map<Integer, Column> lookup = new HashMap<Integer, Column>();
+
+ static {
+ for (Column c : EnumSet.allOf(Column.class))
+ lookup.put(c.getColumnNumber(), c);
+ }
+
+ private Column(int column, int weight) {
+ this.column = column;
+ this.weight = weight;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public static Column getColumn(int number) {
+ return lookup.get(number);
+ }
+
+ public static int getSize() {
+ return lookup.size();
+ }
+
+ };
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudInstance i = (DeltaCloudInstance) element;
+ switch (c) {
+ case STATUS:
+ return getStatusIcon(i.getState());
+ default:
+ return null;
+ }
+ }
+
+ private Image getStatusIcon(String status) {
+ if (DeltaCloudInstance.STOPPED.equals(status)) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_STOPPED);
+ } else if (DeltaCloudInstance.RUNNING.equals(status)) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_RUNNING);
+ } else if (DeltaCloudInstance.BOGUS.equals(status)) {
+ return PlatformUI.getWorkbench().getSharedImages().
+ getImage(ISharedImages.IMG_DEC_FIELD_WARNING);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudInstance i = (DeltaCloudInstance) element;
+ if (i != null) {
+ switch (c) {
+ case NAME:
+ return i.getName();
+ case ID:
+ return i.getId();
+ case STATUS:
+ return "";
+ case HOSTNAME:
+ return i.getHostName();
+ }
+ }
+ return "";
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ protected ICloudElementFilter<DeltaCloudInstance> getCloudFilter(DeltaCloud cloud) {
+ return cloud.getInstanceFilter();
+ }
+
+ @Override
+ protected void asyncGetCloudElements(DeltaCloud cloud) {
+ new GetInstancesCommand(cloud).execute();
+ }
+
+ @Override
+ protected void addListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.addInstanceListListener(this);
+ }
+ }
+
+ @Override
+ protected void removeListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.removeInstanceListListener(this);
+ }
+ }
+
+}
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java (from rev 27084, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java)
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+
+/**
+ * A viewer comparator that compares labels in a column of a table.<br>
+ * This implementation was extracted out of the former Image- and
+ * InstanceComparator which were mostly identical.
+ *
+ * @see ViewerComparator
+ *
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
+public class TableViewerColumnComparator extends ViewerComparator {
+
+ private final static int UP = 1;
+
+ private int column;
+ private int direction;
+
+ public TableViewerColumnComparator() {
+ this(0);
+ }
+
+ public TableViewerColumnComparator(int column) {
+ this.column = column;
+ this.direction = UP;
+ }
+
+ public void setColumn(int newColumn) {
+ if (column != newColumn)
+ direction = UP;
+ column = newColumn;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public void reverseDirection() {
+ direction *= -1;
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int tmp = compareByColumn(viewer, e1, e2);
+ return tmp * direction;
+ }
+
+ private int compareByColumn(Viewer viewer, Object e1, Object e2) {
+ Assert.isTrue(viewer instanceof TableViewer
+ && ((TableViewer) viewer).getLabelProvider() instanceof ITableLabelProvider);
+
+ ITableLabelProvider provider = (ITableLabelProvider) ((TableViewer) viewer).getLabelProvider();
+ String s1 = provider.getColumnText(e1, column);
+ String s2 = provider.getColumnText(e2, column);
+ return s1.compareToIgnoreCase(s2);
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -11,8 +11,8 @@
package org.jboss.tools.internal.deltacloud.ui.utils;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
public class CloudViewElementUtils {
@@ -46,7 +46,8 @@
* @see CVCloudElement
*/
public static CVCloudElement getCVCloudElement(CloudViewElement element) {
- while (!(element instanceof CVCloudElement)) {
+ while (!(element instanceof CVCloudElement)
+ && element != null) {
element = (CloudViewElement) element.getParent();
}
return (CVCloudElement) element;
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -33,7 +33,7 @@
initialCloud.editCloud(name, url, username, password, type);
DeltaCloudManager.getDefault().saveClouds();
if (!name.equals(oldName)) {
- DeltaCloudManager.getDefault().notifyCloudRename();
+ DeltaCloudManager.getDefault().notifyCloudRename(initialCloud);
}
} catch (Exception e) {
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-07 08:22:00 UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-07 08:34:15 UTC (rev 27203)
@@ -30,8 +30,8 @@
import org.jboss.tools.deltacloud.core.ImageFilter;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.ImageViewLabelAndContentProvider;
-import org.jboss.tools.deltacloud.ui.views.TableViewerColumnComparator;
+import org.jboss.tools.deltacloud.ui.views.cloudelements.ImageViewLabelAndContentProvider;
+import org.jboss.tools.deltacloud.ui.views.cloudelements.TableViewerColumnComparator;
public class FindImagePage extends WizardPage implements IImageListListener {
14 years
JBoss Tools SVN: r27202 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-07 03:22:00 -0500 (Tue, 07 Dec 2010)
New Revision: 27202
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBIDE-7786
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2010-12-07 07:53:46 UTC (rev 27201)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2010-12-07 08:22:00 UTC (rev 27202)
@@ -699,7 +699,6 @@
<runtime-component-version
type="org.jboss.ide.eclipse.eap.runtime.component"
version="5.0"/>
-
<supported>
<runtime-component
id="org.jboss.ide.eclipse.eap.runtime.component"
@@ -723,6 +722,7 @@
<facet id="jst.ejb" version="2.0,2.1,3.0"/>
<facet id="jst.ear" version="1.2,1.3,1.4,5.0"/>
<facet id="jst.appclient" version="1.2,1.3,1.4,5.0"/>
+ <facet id="jbt.bpel.facet.core" version="1.2,2.0"/>
</supported>
</extension>
@@ -812,6 +812,7 @@
<facet id="jst.ejb" version="2.0,2.1,3.0"/>
<facet id="jst.ear" version="1.2,1.3,1.4,5.0"/>
<facet id="jst.appclient" version="1.2,1.3,1.4,5.0"/>
+ <facet id="jbt.bpel.facet.core" version="1.2,2.0"/>
</supported>
<supported>
@@ -825,6 +826,7 @@
<facet id="jst.ejb" version="2.0,2.1,3.0,3.1"/>
<facet id="jst.ear" version="1.2,1.3,1.4,5.0,6.0"/>
<facet id="jst.appclient" version="1.2,1.3,1.4,5.0,6.0"/>
+ <facet id="jbt.bpel.facet.core" version="1.2,2.0"/>
</supported>
</extension>
14 years
JBoss Tools SVN: r27201 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-07 02:53:46 -0500 (Tue, 07 Dec 2010)
New Revision: 27201
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
Log:
JBIDE-7822 - the wizard fragment for most servers had some errant code in it which set the deploy type to server for basically all new servers. It seems to have been added in last month. It is now removed.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2010-12-07 06:32:52 UTC (rev 27200)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossServerWizardFragment.java 2010-12-07 07:53:46 UTC (rev 27201)
@@ -225,10 +225,6 @@
IServerWorkingCopy serverWC = (IServerWorkingCopy) getTaskModel().getObject(TaskModel.TASK_SERVER);
serverWC.setRuntime((IRuntime)getTaskModel().getObject(TaskModel.TASK_RUNTIME));
serverWC.setServerConfiguration(null); // no inside jboss folder
- // just make sure the shouldnt-happen doesn't happen
- String tmp = serverWC.getAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, (String)null);
- if( IDeployableServer.DEPLOY_METADATA.equals(tmp))
- serverWC.setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_SERVER);
}
private IJBossServerRuntime getRuntime() {
14 years
JBoss Tools SVN: r27200 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ssh: src/org/jboss/ide/eclipse/as/ssh and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-07 01:32:52 -0500 (Tue, 07 Dec 2010)
New Revision: 27200
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
Log:
JBIDE-7825
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2010-12-06 23:40:26 UTC (rev 27199)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/plugin.xml 2010-12-07 06:32:52 UTC (rev 27200)
@@ -121,5 +121,13 @@
serverTypes="org.jboss.ide.eclipse.as.ssh.server.remoteServerType">
</publishMethod>
</extension>
-
+ <extension
+ point="org.eclipse.wst.server.ui.editorPageSections">
+ <section
+ class="org.jboss.ide.eclipse.as.ssh.ui.editor.ServerPasswordSection"
+ id="org.jboss.ide.eclipse.as.ui.editor.passwordSection"
+ insertionId="org.eclipse.wst.server.editor.overview.left"
+ order="10"
+ typeIds="org.jboss.ide.eclipse.as.ssh.server.remoteServerType"/>
+ </extension>
</plugin>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-12-06 23:40:26 UTC (rev 27199)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.java 2010-12-07 06:32:52 UTC (rev 27200)
@@ -15,6 +15,7 @@
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.jboss.ide.eclipse.as.ssh.Messages"; //$NON-NLS-1$
+ public static String SCPEditorLoginCredentials;
public static String browse;
public static String UserLabel;
public static String PassLabel;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-12-06 23:40:26 UTC (rev 27199)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/Messages.properties 2010-12-07 06:32:52 UTC (rev 27200)
@@ -9,4 +9,5 @@
EditorSetDeployCommandLabel=Set Remote Deployment Folder
SCPDeploymentSectionTitle=SCP Deployment
SCPDeploymentDescription=Deploy your modules via SCP file transfer
-SCPServerDescription=A server which allows remote deployment via SCP
\ No newline at end of file
+SCPServerDescription=A server which allows remote deployment via SCP
+SCPEditorLoginCredentials=Remote Server Login Credentials
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/editor/ServerPasswordSection.java 2010-12-07 06:32:52 UTC (rev 27200)
@@ -0,0 +1,148 @@
+/**
+ * JBoss by Red Hat
+ * Copyright 2006-2009, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.ssh.ui.editor;
+
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.ui.editor.ServerEditorSection;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.ssh.server.ISSHDeploymentConstants;
+import org.jboss.ide.eclipse.as.ui.Messages;
+
+/**
+ *
+ * @author Rob Stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class ServerPasswordSection extends ServerEditorSection {
+
+ private ModifyListener nameModifyListener, passModifyListener;
+ private Text nameText, passText;
+ private ServerAttributeHelper helper;
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ helper = new ServerAttributeHelper(server.getOriginal(), server);
+ }
+
+ public void createSection(Composite parent) {
+ super.createSection(parent);
+ FormToolkit toolkit = new FormToolkit(parent.getDisplay());
+
+ Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE|ExpandableComposite.EXPANDED|ExpandableComposite.TITLE_BAR);
+ section.setText(org.jboss.ide.eclipse.as.ssh.Messages.SCPEditorLoginCredentials);
+ section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
+
+ Composite composite = toolkit.createComposite(section);
+
+ composite.setLayout(new GridLayout(2, false));
+
+ Label username = toolkit.createLabel(composite, Messages.swf_Username);
+ username.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ String n = helper.getAttribute(ISSHDeploymentConstants.USERNAME, ""); //$NON-NLS-1$
+ String p = helper.getAttribute(ISSHDeploymentConstants.PASSWORD, ""); //$NON-NLS-1$
+ nameText = toolkit.createText(composite, n);
+ Label password = toolkit.createLabel(composite, Messages.swf_Password);
+ password.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ passText = toolkit.createText(composite, p);
+
+ GridData d = new GridData();
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ nameText.setLayoutData(d);
+ d = new GridData(); d.grabExcessHorizontalSpace = true; d.widthHint = 100;
+ passText.setLayoutData(d);
+
+ nameModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetUserCommand(server));
+ }
+ };
+
+ passModifyListener = new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ execute(new SetPassCommand(server));
+ }
+ };
+
+ nameText.addModifyListener(nameModifyListener);
+ passText.addModifyListener(passModifyListener);
+ toolkit.paintBordersFor(composite);
+ section.setClient(composite);
+ }
+
+
+ public class SetUserCommand extends SetVarCommand {
+ public SetUserCommand(IServerWorkingCopy server) {
+ super(server, Messages.EditorChangeUsernameCommandName, nameText, nameText.getText(),
+ ISSHDeploymentConstants.USERNAME, nameModifyListener);
+ }
+ }
+
+ public class SetPassCommand extends SetVarCommand {
+ public SetPassCommand(IServerWorkingCopy server) {
+ super(server, Messages.EditorChangePasswordCommandName, passText, passText.getText(),
+ ISSHDeploymentConstants.PASSWORD, passModifyListener);
+ }
+ }
+
+ public class SetVarCommand extends ServerCommand {
+ private String oldVal;
+ private String newVal;
+ private String key;
+ private Text text;
+ private ModifyListener listener;
+
+ public SetVarCommand(IServerWorkingCopy wc, String name,
+ Text text, String newVal, String attributeKey,
+ ModifyListener listener) {
+ super(wc, name);
+ this.text = text;
+ this.key = attributeKey;
+ this.newVal = newVal;
+ this.listener = listener;
+ this.oldVal = helper.getAttribute(attributeKey, ""); //$NON-NLS-1$
+ }
+
+ public void execute() {
+ helper.setAttribute(key, newVal);
+ }
+
+ public void undo() {
+ text.removeModifyListener(listener);
+ helper.setAttribute(key, oldVal);
+ text.setText(oldVal);
+ text.addModifyListener(listener);
+ }
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-12-06 23:40:26 UTC (rev 27199)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ssh/src/org/jboss/ide/eclipse/as/ssh/ui/wizard/SCPServerWizardFragment.java 2010-12-07 06:32:52 UTC (rev 27200)
@@ -1,36 +1,27 @@
package org.jboss.ide.eclipse.as.ssh.ui.wizard;
-import java.io.File;
-
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jst.j2ee.model.internal.validation.ValidateBMPBean;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
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.FileDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.TaskModel;
import org.eclipse.wst.server.ui.internal.ImageResource;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
-import org.jboss.ide.eclipse.as.core.util.ServerUtil;
import org.jboss.ide.eclipse.as.ssh.Messages;
import org.jboss.ide.eclipse.as.ssh.server.SSHServerDelegate;
@@ -135,5 +126,7 @@
server.setPassword(pass); //$NON-NLS-1$
server.setHostsFile(null);
server.setDeployFolder(deploy);
+ IServer tmp = serverWC.save(true, monitor);
+ getTaskModel().putObject(TaskModel.TASK_SERVER, tmp);
}
}
14 years
JBoss Tools SVN: r27199 - workspace/snjeza/seam-examples.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-12-06 18:40:26 -0500 (Mon, 06 Dec 2010)
New Revision: 27199
Modified:
workspace/snjeza/seam-examples/booking22.zip
Log:
JBIDE-7821 Booking22 Example requires JDK5
Modified: workspace/snjeza/seam-examples/booking22.zip
===================================================================
(Binary files differ)
14 years
JBoss Tools SVN: r27198 - branches/jbosstools-3.2.0.Beta2/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-12-06 17:34:24 -0500 (Mon, 06 Dec 2010)
New Revision: 27198
Modified:
branches/jbosstools-3.2.0.Beta2/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
Log:
JBIDE-7822 Deployment from workspace metadata does not work when workspace path contains space character
Modified: branches/jbosstools-3.2.0.Beta2/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- branches/jbosstools-3.2.0.Beta2/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2010-12-06 22:27:51 UTC (rev 27197)
+++ branches/jbosstools-3.2.0.Beta2/runtime/plugins/org.jboss.tools.runtime/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2010-12-06 22:34:24 UTC (rev 27198)
@@ -55,6 +55,7 @@
import org.eclipse.wst.server.core.internal.ServerPlugin;
import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.eclipse.wst.server.core.internal.XMLMemento;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.bean.JBossServerType;
import org.jboss.ide.eclipse.as.core.server.bean.ServerBeanLoader;
import org.jboss.tools.runtime.Activator;
@@ -259,9 +260,11 @@
server.setName(name);
// JBossServer.DEPLOY_DIRECTORY
- String deployVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
- ((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory", deployVal); //$NON-NLS-1$
-
+ // JBIDE-7822
+ // String deployVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("deploy").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
+ // ((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.deployDirectory", deployVal); //$NON-NLS-1$
+ ((ServerWorkingCopy) server).setAttribute(IDeployableServer.DEPLOY_DIRECTORY_TYPE, IDeployableServer.DEPLOY_SERVER);
+
// IDeployableServer.TEMP_DEPLOY_DIRECTORY
String deployTmpFolderVal = runtime.getLocation().append("server").append(JBOSS_AS_DEFAULT_CONFIGURATION_NAME).append("tmp").append("jbosstoolsTemp").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
((ServerWorkingCopy) server).setAttribute("org.jboss.ide.eclipse.as.core.server.tempDeployDirectory", deployTmpFolderVal); //$NON-NLS-1$
14 years