JBoss Tools SVN: r6653 - trunk/as/docs/reference.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-02-29 12:09:39 -0500 (Fri, 29 Feb 2008)
New Revision: 6653
Added:
trunk/as/docs/reference/pom.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1703 Maven2 migration, Jboss.org styles are added
Added: trunk/as/docs/reference/pom.xml
===================================================================
--- trunk/as/docs/reference/pom.xml (rev 0)
+++ trunk/as/docs/reference/pom.xml 2008-02-29 17:09:39 UTC (rev 6653)
@@ -0,0 +1,114 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>server-manager-ref-guide-${translation}</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>Server_Manager_Reference_Guide_(${translation})</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.0.0</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.0.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ <dependency>
+ <groupId>com.uwyn</groupId>
+ <artifactId>jhighlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>de.java2html</groupId>
+ <artifactId>java2html</artifactId>
+ <version>5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.exadel.docbook.colorer</groupId>
+ <artifactId>highlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${pom.basedir}/en</sourceDirectory>
+ <imageResource>
+ <directory>${pom.basedir}/en</directory>
+ <includes>
+ <include>images/**/*</include>
+ </includes>
+ </imageResource>
+ <!--<cssResource>
+ <directory>src/main/css</directory>
+ </cssResource>-->
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/main-pdf.xsl</stylesheetResource>
+ <finalName>${pom.name}.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/main-html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/nochunk-html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/main-eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <properties>
+ <translation>en-US</translation>
+ </properties>
+
+
+</project>
16 years, 10 months
JBoss Tools SVN: r6652 - trunk/seam/docs/reference.
by jbosstools-commits@lists.jboss.org
Author: afedosik
Date: 2008-02-29 12:00:14 -0500 (Fri, 29 Feb 2008)
New Revision: 6652
Added:
trunk/seam/docs/reference/pom.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1703 Maven2 migration, Jboss.org styles are added
Added: trunk/seam/docs/reference/pom.xml
===================================================================
--- trunk/seam/docs/reference/pom.xml (rev 0)
+++ trunk/seam/docs/reference/pom.xml 2008-02-29 17:00:14 UTC (rev 6652)
@@ -0,0 +1,114 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>seam-tools-ref-guide-${translation}</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>Seam_Tools_Reference Guide_(${translation})</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.0.0</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.0.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ <dependency>
+ <groupId>com.uwyn</groupId>
+ <artifactId>jhighlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>de.java2html</groupId>
+ <artifactId>java2html</artifactId>
+ <version>5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.exadel.docbook.colorer</groupId>
+ <artifactId>highlight</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${pom.basedir}/en</sourceDirectory>
+ <imageResource>
+ <directory>${pom.basedir}/en</directory>
+ <includes>
+ <include>images/**/*</include>
+ </includes>
+ </imageResource>
+ <!--<cssResource>
+ <directory>src/main/css</directory>
+ </cssResource>-->
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/main-pdf.xsl</stylesheetResource>
+ <finalName>${pom.name}.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/main-html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/nochunk-html.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/main-eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
+ </options>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <properties>
+ <translation>en-US</translation>
+ </properties>
+
+
+</project>
16 years, 10 months
JBoss Tools SVN: r6651 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-29 09:30:05 -0500 (Fri, 29 Feb 2008)
New Revision: 6651
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
Log:
JBIDE-1828
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2008-02-29 14:29:27 UTC (rev 6650)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2008-02-29 14:30:05 UTC (rev 6651)
@@ -22,6 +22,9 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.JavaUI;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.model.ServiceDialog;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.BeanType;
@@ -442,6 +445,11 @@
public void open() {
if(type == null) return;
+ if(!type.exists()) {
+ ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
+ d.showDialog("Warning", "Type " + type.getElementName() + " does not exist.", new String[]{SpecialWizardSupport.OK}, null, ServiceDialog.WARNING);
+ return;
+ }
try {
JavaUI.openInEditor(type);
} catch (Exception e) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2008-02-29 14:29:27 UTC (rev 6650)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2008-02-29 14:30:05 UTC (rev 6651)
@@ -24,7 +24,10 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.model.ServiceDialog;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.seam.core.ISeamElement;
@@ -114,6 +117,12 @@
FindObjectHelper.findModelObject(o, FindObjectHelper.IN_EDITOR_ONLY);
} else if(getResource() instanceof IFile) {
IFile f = (IFile)getResource();
+ if(f == null || !f.exists()) {
+ ServiceDialog d = PreferenceModelUtilities.getPreferenceModel().getService();
+ d.showDialog("Warning", "File " + getSourcePath() + " does not exist.", new String[]{SpecialWizardSupport.OK}, null, ServiceDialog.WARNING);
+ return;
+ }
+
try {
IWorkbench workbench = SeamCorePlugin.getDefault().getWorkbench();
if(workbench == null) return;
16 years, 10 months
JBoss Tools SVN: r6650 - trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-29 09:29:27 -0500 (Fri, 29 Feb 2008)
New Revision: 6650
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/OpenEditorWizard.java
Log:
JBIDE-1828
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/OpenEditorWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/OpenEditorWizard.java 2008-02-29 14:23:33 UTC (rev 6649)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/editor/OpenEditorWizard.java 2008-02-29 14:29:27 UTC (rev 6650)
@@ -47,16 +47,16 @@
if(input instanceof IFileEditorInput) {
IFileEditorInput fei = (IFileEditorInput)input;
IFile f = fei.getFile();
- if(!f.isSynchronized(IResource.DEPTH_INFINITE)) {
+ if(f != null && !f.isSynchronized(IResource.DEPTH_INFINITE)) {
try {
f.getParent().refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (Exception e) {
ModelUIPlugin.getPluginLog().logError(e);
}
}
- if(!f.exists()) {
+ if(f == null || !f.exists()) {
ServiceDialog d = object.getModel().getService();
- String message = "The file " + f.getLocation().toString() + " was removed externally.";
+ String message = "The file " + f.getFullPath() + " was removed externally.";
d.showDialog("Warning", message, new String[]{"Close"}, null, ServiceDialog.WARNING);
object.getModel().update();
return 1;
16 years, 10 months
JBoss Tools SVN: r6649 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.console: src/org/hibernate/eclipse/console/actions and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-02-29 09:23:33 -0500 (Fri, 29 Feb 2008)
New Revision: 6649
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/removeall.gif
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/removeall_disable.gif
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CloseAllQueryPageAction.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabViewActionGroup.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1442
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/removeall.gif
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/removeall.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/removeall_disable.gif
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/removeall_disable.gif
___________________________________________________________________
Name: svn:mime-type
+ image/gif
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CloseAllQueryPageAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CloseAllQueryPageAction.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CloseAllQueryPageAction.java 2008-02-29 14:23:33 UTC (rev 6649)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.hibernate.eclipse.console.actions;
+
+import java.util.Iterator;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.hibernate.console.ImageConstants;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.QueryPage;
+import org.hibernate.eclipse.console.utils.EclipseImages;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class CloseAllQueryPageAction extends Action {
+
+ public CloseAllQueryPageAction() {
+ setImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.CLOSE_ALL) );
+ setDisabledImageDescriptor(EclipseImages.getImageDescriptor(ImageConstants.CLOSE_ALL_DISABLED) );
+
+ setToolTipText("Close all query pages");
+ }
+
+ @Override
+ public void run() {
+ for (Iterator i = KnownConfigurations.getInstance().getQueryPageModel().getPages(); i.hasNext(); ) {
+ KnownConfigurations.getInstance().getQueryPageModel().remove( (QueryPage) i.next() );
+ }
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/CloseAllQueryPageAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabViewActionGroup.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabViewActionGroup.java 2008-02-29 14:23:20 UTC (rev 6648)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/QueryPageTabViewActionGroup.java 2008-02-29 14:23:33 UTC (rev 6649)
@@ -26,6 +26,7 @@
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.actions.ActionGroup;
+import org.hibernate.eclipse.console.actions.CloseAllQueryPageAction;
import org.hibernate.eclipse.console.actions.CloseQueryPageAction;
/**
@@ -36,13 +37,17 @@
Action closeAction;
+ Action closeAllAction;
+
public QueryPageTabViewActionGroup(IViewPart part, ISelectionProvider provider) {
- closeAction = new CloseQueryPageAction(provider);
+ closeAction = new CloseQueryPageAction(provider);
+ closeAllAction = new CloseAllQueryPageAction();
}
- public void fillActionBars(IActionBars actionBars) {
+ public void fillActionBars(IActionBars actionBars) {
actionBars.getToolBarManager().add(closeAction);
+ actionBars.getToolBarManager().add(closeAllAction);
}
}
16 years, 10 months
JBoss Tools SVN: r6648 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2008-02-29 09:23:20 -0500 (Fri, 29 Feb 2008)
New Revision: 6648
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1442
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java 2008-02-29 13:25:29 UTC (rev 6647)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java 2008-02-29 14:23:20 UTC (rev 6648)
@@ -57,7 +57,11 @@
public static final String CLOSE_PATH = "images/close.gif";
public static final String CLOSE_DISABLED_PATH = "images/close_disabled.gif";
+
+ public static final String CLOSE_ALL_PATH = "images/removeall.gif";
+ public static final String CLOSE_ALL_DISABLED_PATH = "images/removeall_disabled.gif";
+
public static final String IDPROPERTY_PATH = "images/idproperty.gif";
public static final String TYPES_PATH = "images/types.gif";
@@ -87,7 +91,11 @@
public static final String CLOSE = "CLOSE";
public static final String CLOSE_DISABLED = "CLOSE_DISABLED";
+
+ public static final String CLOSE_ALL = "CLOSE_ALL";
+ public static final String CLOSE_ALL_DISABLED = "CLOSE_ALL_DISABLED";
+
public static final String IDPROPERTY = "IDPROPERTY";
public static final String TYPES = "TYPES";
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java 2008-02-29 13:25:29 UTC (rev 6647)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java 2008-02-29 14:23:20 UTC (rev 6648)
@@ -47,6 +47,8 @@
declareRegistryImage(EXECUTE, EXECUTE_PATH);
declareRegistryImage(CLOSE, CLOSE_PATH);
declareRegistryImage(CLOSE_DISABLED, CLOSE_DISABLED_PATH);
+ declareRegistryImage(CLOSE_ALL, CLOSE_ALL_PATH);
+ declareRegistryImage(CLOSE_ALL_DISABLED, CLOSE_ALL_DISABLED_PATH);
declareRegistryImage(CLEAR, CLEAR_PATH);
declareRegistryImage(CONFIGURATION, "images/hibernate_config.gif");
declareRegistryImage(ADD, "images/treeplus.gif");
16 years, 10 months
JBoss Tools SVN: r6647 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: src/org/jboss/tools/jsf/vpe/richfaces/template and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-02-29 08:25:29 -0500 (Fri, 29 Feb 2008)
New Revision: 6647
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1682, code adjustment
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css 2008-02-29 10:30:54 UTC (rev 6646)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/resources/calendar/calendar.css 2008-02-29 13:25:29 UTC (rev 6647)
@@ -1,7 +1,7 @@
.rich-calendar-input {
cursor: pointer;
vertical-align: middle;
- text-align: right;
+ text-align: left;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2008-02-29 10:30:54 UTC (rev 6646)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCalendarTemplate.java 2008-02-29 13:25:29 UTC (rev 6647)
@@ -81,6 +81,7 @@
static final String CELL_HEIGHT = "cellHeight";
static final String CELL_WIDTH = "cellWidth";
static final String DATE_PATTERN = "datePattern";
+ static final String VALUE = "value";
static final String DISABLED = "disabled";
static final String HORIZONTAL_OFFSET = "horizontalOffset";
static final String VERTICAL_OFFSET = "verticalOffset";
@@ -148,6 +149,7 @@
private String cellHeight;
private String cellWidth;
private String datePattern;
+ private String value;
private String disabled;
private String enableManualInput;
private String horizontalOffset;
@@ -373,10 +375,11 @@
if ("true".equals(disabled)) {
input.setAttribute(HtmlComponentUtil.HTML_ATTR_DISABLED, "true");
}
-
- if (attrPresents(datePattern)) {
- input.setAttribute(HtmlComponentUtil.HTML_VALUE_ATTR, datePattern);
+
+ if (attrPresents(value)) {
+ input.setAttribute(HtmlComponentUtil.HTML_VALUE_ATTR, value);
}
+
td1_1.appendChild(input);
}
@@ -893,6 +896,7 @@
cellHeight = source.getAttribute(CELL_HEIGHT);
cellWidth = source.getAttribute(CELL_WIDTH);
datePattern = source.getAttribute(DATE_PATTERN);
+ value = source.getAttribute(VALUE);
disabled = source.getAttribute(DISABLED);
enableManualInput = source.getAttribute(ENABLE_MANUAL_INPUT);
horizontalOffset = source.getAttribute(HORIZONTAL_OFFSET);
16 years, 10 months
JBoss Tools SVN: r6646 - in trunk/jsf/plugins/org.jboss.tools.jsf: src/org/jboss/tools/jsf/model/handlers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-29 05:30:54 -0500 (Fri, 29 Feb 2008)
New Revision: 6646
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/resources/help/keys-jsf.properties
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/RenameViewSupport.java
Log:
JBIDE-1816
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/resources/help/keys-jsf.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/resources/help/keys-jsf.properties 2008-02-28 17:11:00 UTC (rev 6645)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/resources/help/keys-jsf.properties 2008-02-29 10:30:54 UTC (rev 6646)
@@ -579,7 +579,7 @@
JSFProcessGroup_Rename_0=/jsf/noHelpYet.html
JSFProcessGroup_Rename_0.WindowTitle=Rename
-JSFProcessGroup_Rename_0.Title=
+JSFProcessGroup_Rename_0.Title=JSF Process View
JSFProcessGroup_Rename_0.Message=
JSFProcessGroup_Properties=/jsf/noHelpYet.html
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java 2008-02-28 17:11:00 UTC (rev 6645)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/AddViewSupport.java 2008-02-29 10:30:54 UTC (rev 6646)
@@ -223,12 +223,13 @@
return isCorrectPath(path) && !fileExists(path);
}
- String FORBIDDEN_INDICES = "\"\n\t*\\:<>?|";
+ static String FORBIDDEN_INDICES = "\"\n\t*\\:<>?|";
- private boolean isCorrectPath(String path) {
+ static boolean isCorrectPath(String path) {
if(path == null || path.equals("/") || path.indexOf("//") >= 0) return false;
if(path.endsWith("/") || path.indexOf("../") >= 0) return false;
if(path.endsWith("..")) return false;
+ if(path.equals("*")) return true;
for (int i = 0; i < FORBIDDEN_INDICES.length(); i++) {
if(path.indexOf(FORBIDDEN_INDICES.charAt(i)) >= 0) {
return false;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/RenameViewSupport.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/RenameViewSupport.java 2008-02-28 17:11:00 UTC (rev 6645)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/RenameViewSupport.java 2008-02-29 10:30:54 UTC (rev 6646)
@@ -11,13 +11,16 @@
package org.jboss.tools.jsf.model.handlers;
import java.util.*;
+
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
import org.jboss.tools.common.meta.action.impl.*;
import org.jboss.tools.common.meta.action.impl.handlers.DefaultRemoveHandler;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+import org.jboss.tools.jsf.messages.JSFUIMessages;
import org.jboss.tools.jsf.model.*;
+import org.jboss.tools.jsf.model.handlers.AddViewSupport.ViewValidator;
import org.jboss.tools.jsf.model.helpers.*;
import org.jboss.tools.jsf.model.impl.NavigationRuleObjectImpl;
@@ -199,4 +202,24 @@
}
}
+ protected DefaultWizardDataValidator viewValidator = new ViewValidator();
+
+ public WizardDataValidator getValidator(int step) {
+ viewValidator.setSupport(this, step);
+ return viewValidator;
+ }
+
+ class ViewValidator extends DefaultWizardDataValidator {
+ public void validate(Properties data) {
+ super.validate(data);
+ if(message != null) return;
+ String path = data.getProperty("from-view-id");
+ if(!AddViewSupport.isCorrectPath(path)) {
+ message = JSFUIMessages.ATTRIBUTE_FROM_VIEW_ID_IS_NOT_CORRECT;
+ }
+ if(message != null) return;
+
+ }
+ }
+
}
16 years, 10 months
JBoss Tools SVN: r6645 - in trunk/jst/plugins/org.jboss.tools.jst.web.ui: src/org/jboss/tools/jst/web/ui/navigator and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-28 12:11:00 -0500 (Thu, 28 Feb 2008)
New Revision: 6645
Modified:
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/navigator/WebProjectsContentProvider.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/XContentProvider.java
Log:
JBIDE-1433
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2008-02-28 17:10:42 UTC (rev 6644)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2008-02-28 17:11:00 UTC (rev 6645)
@@ -574,9 +574,16 @@
entities="FileTLD_PRO,FileTLD_1_2,FileTLD_2_0,FileTLD_2_1"
name="File TLD"
partition="Tag Libraries"
- variables="shortname,uri,display-name"
- defaultValue="{name} [{shortname}]"
- >
+ defaultValue="{name} [{shortname}]">
+ <variable name="shortname" description="attribute of taglib node"/>
+ <variable name="uri" description="attribute of taglib node"/>
+ <variable name="display-name" description="attribute of taglib node"/>
+ <example entity="FileTLD_1_2">
+ <put name="name" value="taglib"/>
+ <put name="shortname" value="c"/>
+ <put name="uri" value="http://java.sun.com/jstl/core"/>
+ <put name="display-name" value="JSTL Core"/>
+ </example>
</labelDecorator>
</extension>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsContentProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsContentProvider.java 2008-02-28 17:10:42 UTC (rev 6644)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsContentProvider.java 2008-02-28 17:11:00 UTC (rev 6645)
@@ -11,14 +11,18 @@
package org.jboss.tools.jst.web.ui.navigator;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.ui.navigator.TreeViewerModelListenerImpl;
+import org.jboss.tools.common.model.ui.preferences.DecoratorPreferencesListener;
import org.jboss.tools.common.model.ui.views.navigator.NavigatorContentProvider;
public class WebProjectsContentProvider extends NavigatorContentProvider {
+ DecoratorPreferencesListener decoratorListener = null;
protected TreeViewerModelListenerImpl createListener() {
return new WebProjectsTreeListener();
@@ -40,4 +44,22 @@
}
}
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ if(viewer instanceof StructuredViewer) {
+ if(decoratorListener == null) {
+ decoratorListener = new DecoratorPreferencesListener();
+ decoratorListener.init();
+ }
+ decoratorListener.setViewer((StructuredViewer)viewer);
+ }
+ }
+
+ public void dispose() {
+ if(decoratorListener != null) {
+ decoratorListener.dispose();
+ decoratorListener = null;
+ }
+ super.dispose();
+ }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java 2008-02-28 17:10:42 UTC (rev 6644)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java 2008-02-28 17:11:00 UTC (rev 6645)
@@ -12,7 +12,6 @@
import org.jboss.tools.common.model.ui.navigator.NavigatorLabelProvider;
import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorManager;
-import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorPart;
import org.jboss.tools.common.model.ui.navigator.decorator.XModelObjectDecorator;
import org.jboss.tools.common.model.XModelObject;
@@ -20,6 +19,9 @@
public class WebProjectsLabelProvider extends NavigatorLabelProvider {
+ public WebProjectsLabelProvider() {
+ }
+
public String getText(Object element) {
if(!(element instanceof XModelObject)) return "";
XModelObject o = (XModelObject)element;
@@ -43,19 +45,10 @@
} else if("FileSystemFolder".equals(entity)) {
String s = o.getAttributeValue("location").replace('\\', '/');
return s.substring(s.lastIndexOf('/') + 1);
- } else if(entity.startsWith("FileTLD")) {
- String s = super.getText(element);
- String shortname = o.getAttributeValue("shortname");
- if(shortname != null) {
- s += " " + shortname;
- }
- String uri = o.getAttributeValue("uri");
- if(uri != null && uri.length() > 0) {
- s += " " + uri;
- }
- return s;
}
return super.getText(element);
}
+ public void dispose() {}
+
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/XContentProvider.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/XContentProvider.java 2008-02-28 17:10:42 UTC (rev 6644)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/XContentProvider.java 2008-02-28 17:11:00 UTC (rev 6645)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.jboss.tools.common.model.XFilteredTree;
@@ -25,6 +26,7 @@
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.navigator.TreeViewerModelListenerImpl;
+import org.jboss.tools.common.model.ui.preferences.DecoratorPreferencesListener;
import org.jboss.tools.common.model.ui.views.navigator.FilteredTreesCache;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelTreeListenerSWTASync;
@@ -34,7 +36,9 @@
protected Viewer viewer = null;
protected TreeViewerModelListenerImpl listener = createListener();
protected XModelTreeListenerSWTASync syncListener = new XModelTreeListenerSWTASync(listener);
-
+
+ DecoratorPreferencesListener decoratorListener = null;
+
protected TreeViewerModelListenerImpl createListener() {
return new TreeViewerModelListenerImpl();
}
@@ -104,6 +108,10 @@
syncListener = null;
listener = null;
}
+ if(decoratorListener != null) {
+ decoratorListener.dispose();
+ decoratorListener = null;
+ }
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
@@ -111,6 +119,13 @@
if(listener != null && viewer instanceof TreeViewer) {
listener.setViewer((TreeViewer)viewer);
}
+ if(viewer instanceof StructuredViewer) {
+ if(decoratorListener == null) {
+ decoratorListener = new DecoratorPreferencesListener();
+ decoratorListener.init();
+ }
+ decoratorListener.setViewer((StructuredViewer)viewer);
+ }
}
protected XFilteredTree getFilteredTree(Object object) {
16 years, 10 months
JBoss Tools SVN: r6644 - in trunk/common/plugins/org.jboss.tools.common.model.ui: schema and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-02-28 12:10:42 -0500 (Thu, 28 Feb 2008)
New Revision: 6644
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorConstants.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Example.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/IDecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Variable.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorGeneralPreferencesPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesListener.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorTextPreferencesPage.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java
Log:
JBIDE-1433
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-02-28 17:10:42 UTC (rev 6644)
@@ -221,6 +221,12 @@
id="org.jboss.tools.common.model.ui"
name="Web">
</page>
+ <page
+ category="org.jboss.tools.common.model.ui"
+ class="org.jboss.tools.common.model.ui.preferences.DecoratorPreferencesPage"
+ id="org.jboss.tools.common.model.ui.decorator"
+ name="Label Decorations">
+ </page>
</extension>
<extension point="org.eclipse.ui.preferencePages">
<page
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/schema/labelDecorator.exsd 2008-02-28 17:10:42 UTC (rev 6644)
@@ -44,6 +44,10 @@
<element name="labelDecorator">
<complexType>
+ <sequence>
+ <element ref="variable" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="example" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
<attribute name="partition" type="string" use="required">
<annotation>
<documentation>
@@ -65,23 +69,69 @@
</documentation>
</annotation>
</attribute>
- <attribute name="variables" type="string">
+ <attribute name="defaultValue" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
- <attribute name="defaultValue" type="string">
+ </complexType>
+ </element>
+
+ <element name="variable">
+ <complexType>
+ <attribute name="name" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
+ <element name="example">
+ <complexType>
+ <sequence>
+ <element ref="put" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="entity" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="put">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appInfo>
<meta.section type="since"/>
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/AttributeDecoratorPart.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
import org.jboss.tools.common.model.XModelObject;
@@ -2,11 +12,15 @@
-public class AttributeDecoratorPart extends DecoratorPart {
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class AttributeDecoratorPart implements IDecoratorPart {
+ Variable variable;
- public AttributeDecoratorPart(String value) {
- super(value);
+ public AttributeDecoratorPart(Variable variable) {
+ this.variable = variable;
}
public String getLabelPart(XModelObject object) {
- String v = object.getAttributeValue(value);
- return v == null ? "{" + value + "}" : v;
+ String v = object.getAttributeValue(variable.getName());
+ return v == null ? "{" + variable.getName() + "}" : v;
}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorConstants.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorConstants.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorConstants.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface DecoratorConstants {
+
+ public String ATTR_NAME = "name";
+
+ public String ATTR_PARTITION = "partition";
+
+ public String ATTR_ENTITIES = "entities";
+
+ public String ATTR_ENTITY = "entity";
+
+ public String ATTR_DEFAULT = "defaultValue";
+
+ public String ATTR_DESCRIPTION = "description";
+
+ public String ATTR_VALUE = "value";
+
+ public String NODE_VARIABLE = "variable";
+
+ public String NODE_EXAMPLE = "example";
+
+ public String NODE_PUT = "put";
+
+ public String RULE_OPENING = "{";
+
+ public String RULE_CLOSING = "}";
+
+}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorManager.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
import java.io.IOException;
@@ -5,6 +15,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.TreeSet;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
@@ -14,8 +25,11 @@
import org.eclipse.jface.preference.IPreferenceStore;
import org.jboss.tools.common.model.ui.ModelUIPlugin;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class DecoratorManager {
- private static String EXTENSION_POINT_ID = ModelUIPlugin.PLUGIN_ID + ".labelDecorator";
+ public static final String EXTENSION_POINT_ID = ModelUIPlugin.PLUGIN_ID + ".labelDecorator";
private static Object LOCK = new Object();
private static DecoratorManager INSTANCE;
@@ -23,6 +37,7 @@
private Map<String, XModelObjectDecorator> mapByName = new HashMap<String, XModelObjectDecorator>();
private Map<String, XModelObjectDecorator> mapByEntity = new HashMap<String, XModelObjectDecorator>();
private Map<String, Set<XModelObjectDecorator>> mapByPartition = new HashMap<String, Set<XModelObjectDecorator>>();
+ private Map<String, String> entityByPartition = new HashMap<String, String>();
private DecoratorManager() {
load();
@@ -48,6 +63,16 @@
return mapByPartition.get(partition);
}
+ public String getBaseEntityForPartition(String partition) {
+ return entityByPartition.get(partition);
+ }
+
+ public String[] getPartitions() {
+ Set<String> set = new TreeSet<String>();
+ set.addAll(mapByPartition.keySet());
+ return set.toArray(new String[0]);
+ }
+
private void load() {
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID);
if(point == null) return;
@@ -69,6 +94,9 @@
set.add(d);
for (String entity: entities) {
mapByEntity.put(entity, d);
+ if(entity.startsWith("File") && entityByPartition.get(partition) == null) {
+ entityByPartition.put(partition, entity);
+ }
}
}
}
@@ -114,7 +142,7 @@
d.setValue(d.getDefaultValue());
}
}
-
+
public static IPreferenceStore getPreferences() {
return ModelUIPlugin.getDefault().getPreferenceStore();
}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/DecoratorPart.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
import org.jboss.tools.common.model.XModelObject;
@@ -2,3 +12,6 @@
-public class DecoratorPart {
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DecoratorPart implements IDecoratorPart {
String value;
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Example.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Example.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Example.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
+
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class Example implements DecoratorConstants {
+
+ public static XModelObject load(IConfigurationElement element) {
+ String entity = element.getAttribute(ATTR_ENTITY);
+ if(entity == null || entity.length() == 0) {
+ return null;
+ }
+ Properties p = new Properties();
+ IConfigurationElement[] cs = element.getChildren(NODE_PUT);
+ for (int i = 0; i < cs.length; i++) {
+ String name = cs[i].getAttribute(ATTR_NAME);
+ String value = cs[i].getAttribute(ATTR_VALUE);
+ if(name == null || value == null) continue;
+ p.setProperty(name, value);
+ }
+
+ return PreferenceModelUtilities.getPreferenceModel().createModelObject(entity, p);
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/IDecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/IDecoratorPart.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/IDecoratorPart.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
+
+import org.jboss.tools.common.model.XModelObject;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface IDecoratorPart {
+ public String getLabelPart(XModelObject object);
+}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/NameDecoratorPart.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
import org.jboss.tools.common.model.XModelObject;
@@ -2,6 +12,8 @@
-public class NameDecoratorPart extends DecoratorPart {
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class NameDecoratorPart implements IDecoratorPart {
public NameDecoratorPart() {
- super("name");
}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Variable.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Variable.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/Variable.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class Variable implements DecoratorConstants {
+ public static Variable NAME = new Variable("name", "default label");
+
+ String name;
+ String description;
+
+ public Variable() {}
+
+ Variable(String name, String description) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getRuleText() {
+ return RULE_OPENING + name + RULE_CLOSING;
+ }
+
+ public String toString() {
+ if(description == null || description.length() == 0) {
+ return name;
+ }
+ return name + " - " + description;
+ }
+
+ public void load(IConfigurationElement element) {
+ name = element.getAttribute(ATTR_NAME);
+ description = element.getAttribute(ATTR_DESCRIPTION);
+ }
+
+}
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java 2008-02-28 16:05:23 UTC (rev 6643)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/navigator/decorator/XModelObjectDecorator.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -1,31 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.navigator.decorator;
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.StringTokenizer;
import org.eclipse.core.runtime.IConfigurationElement;
import org.jboss.tools.common.model.XModelObject;
-public class XModelObjectDecorator {
- static String ATTR_NAME = "name";
- static String ATTR_PARTITION= "partition";
- static String ATTR_ENTITIES = "entities";
- static String ATTR_VARIABLES = "variables";
- static String ATTR_DEFAULT = "defaultValue";
-
-
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class XModelObjectDecorator implements DecoratorConstants {
String name;
String partition;
Set<String> entities = new HashSet<String>();
- String[] variables = new String[0];
+ Variable[] variables = new Variable[0];
+ Map<String, Variable> variableByName = new HashMap<String, Variable>();
String defaultValue;
String value;
- List<DecoratorPart> parts = null;
+ List<IDecoratorPart> parts = null;
+ XModelObject[] examples = new XModelObject[0];
+
public XModelObjectDecorator() {}
public String getName() {
@@ -40,10 +51,18 @@
return entities;
}
- public String[] getVariables() {
+ public Variable[] getVariables() {
return variables;
}
+ public Variable getVariableByName(String name) {
+ return variableByName.get(name);
+ }
+
+ public XModelObject[] getExamples() {
+ return examples;
+ }
+
public String getDefaultValue() {
return defaultValue;
}
@@ -58,7 +77,7 @@
}
this.value = value;
if(value == null || value.length() == 0) {
- value = "{name}";
+ value = Variable.NAME.getRuleText();
}
parts = null;
}
@@ -74,39 +93,53 @@
String[] es = s.split(",");
for (int i = 0; i < es.length; i++) entities.add(es[i]);
}
- s = element.getAttribute(ATTR_VARIABLES);
- List<String> vs = new ArrayList<String>();
- vs.add("name");
- if(s != null) {
- String[] es = s.split(",");
- for (int i = 0; i < es.length; i++) vs.add(es[i]);
+ IConfigurationElement[] cs = element.getChildren(NODE_VARIABLE);
+ List<Variable> vs = new ArrayList<Variable>();
+ vs.add(Variable.NAME);
+ variableByName.put(Variable.NAME.getName(), Variable.NAME);
+ for (int i = 0; i < cs.length; i++) {
+ Variable v = new Variable();
+ v.load(cs[i]);
+ vs.add(v);
+ variableByName.put(v.getName(), v);
}
- variables = vs.toArray(new String[0]);
+ variables = vs.toArray(new Variable[0]);
+
+ List<XModelObject> es = new ArrayList<XModelObject>();
+ cs = element.getChildren(NODE_EXAMPLE);
+ for (int i = 0; i < cs.length; i++) {
+ XModelObject o = Example.load(cs[i]);
+ if(o != null) es.add(o);
+ }
+ examples = es.toArray(new XModelObject[0]);
}
- List<DecoratorPart> compile() {
+ List<IDecoratorPart> compile() {
if(this.parts != null) return this.parts;
- List<DecoratorPart> parts = new ArrayList<DecoratorPart>();
+ List<IDecoratorPart> parts = new ArrayList<IDecoratorPart>();
String v = value;
if(value == null || value.length() == 0) v = defaultValue;
if(v == null) v = "";
- if(v.indexOf("{name}") < 0) {
+ if(v.indexOf(Variable.NAME.getRuleText()) < 0) {
if(v.length() > 0) v += " ";
- v += "{name}";
+ v += Variable.NAME.getRuleText();
}
- StringTokenizer s = new StringTokenizer(v, "{}", true);
+ StringTokenizer s = new StringTokenizer(v, RULE_OPENING + RULE_CLOSING, true);
boolean inVariable = false;
while(s.hasMoreTokens()) {
String t = s.nextToken();
- if(t.equals("{")) {
+ if(t.equals(RULE_OPENING)) {
inVariable = true;
- } else if(t.equals("}")) {
+ } else if(t.equals(RULE_CLOSING)) {
inVariable = false;
} else if(inVariable) {
- if(t.equals("name")) {
+ Variable variable = getVariableByName(t);
+ if(variable == Variable.NAME) {
parts.add(new NameDecoratorPart());
+ } else if(variable != null){
+ parts.add(new AttributeDecoratorPart(variable));
} else {
- parts.add(new AttributeDecoratorPart(t));
+ parts.add(new DecoratorPart(RULE_OPENING + t + RULE_CLOSING));
}
} else {
parts.add(new DecoratorPart(t));
@@ -116,12 +149,29 @@
}
public String getLabel(XModelObject object) {
- List<DecoratorPart> parts = compile();
+ List<IDecoratorPart> parts = compile();
StringBuffer sb = new StringBuffer();
- for (DecoratorPart d: parts) {
+ for (IDecoratorPart d: parts) {
sb.append(d.getLabelPart(object));
}
return sb.toString();
}
+
+ /**
+ * Needed only to work with value
+ * @return
+ */
+ public XModelObjectDecorator getWorkingCopy() {
+ XModelObjectDecorator copy = new XModelObjectDecorator();
+ copy.name = name;
+ copy.partition = partition;
+ copy.defaultValue = defaultValue;
+ copy.value = value;
+ copy.entities = entities;
+ copy.variables = variables;
+ copy.variableByName = variableByName;
+
+ return copy;
+ }
}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorGeneralPreferencesPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorGeneralPreferencesPage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorGeneralPreferencesPage.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+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.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DecoratorGeneralPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage, IPreferencePageExt {
+
+ public DecoratorGeneralPreferencesPage() {
+ setTitle("General");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Composite g = new Composite(parent, SWT.NONE);
+ g.setLayout(new GridLayout(1, false));
+ Label label = new Label(g, SWT.NONE);
+ label.setText("Bla-bla-bla");
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return g;
+ }
+
+ public void init(IWorkbench workbench) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean performCancel() {
+
+ return true;
+ }
+
+ public boolean performOk() {
+
+ return super.performOk();
+ }
+
+ public void performDefaults() {
+
+ }
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesListener.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesListener.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesListener.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.preferences;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
+import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorManager;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DecoratorPreferencesListener implements IPropertyChangeListener {
+ StructuredViewer viewer;
+
+ public DecoratorPreferencesListener() {}
+
+ public void setViewer(StructuredViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ public void init() {
+ ModelUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this);
+ }
+
+ public void dispose() {
+ ModelUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ String s = event.getProperty();
+ if(s.startsWith(DecoratorManager.EXTENSION_POINT_ID + ".")) {
+ if(viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) {
+ viewer.refresh(true);
+ }
+ }
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorPreferencesPage.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.preferences;
+
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DecoratorPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage {
+ DecoratorGeneralPreferencesPage general = new DecoratorGeneralPreferencesPage();
+ DecoratorTextPreferencesPage text = new DecoratorTextPreferencesPage();
+
+ public DecoratorPreferencesPage() {}
+
+ @Override
+ protected Control createContents(Composite parent) {
+ this.noDefaultAndApplyButton();
+ TabFolder tabbedComposite = new TabFolder(parent,SWT.NULL);
+ tabbedComposite.setBackground(parent.getBackground());
+ TabItem newTab = new TabItem(tabbedComposite,SWT.NULL);
+
+ general.createControl(tabbedComposite);
+ newTab.setControl(general.getControl());
+ newTab.setText(general.getTitle());
+
+ newTab = new TabItem(tabbedComposite,SWT.NULL);
+
+ text.createControl(tabbedComposite);
+ newTab.setControl(text.getControl());
+ newTab.setText(text.getTitle());
+
+ return tabbedComposite;
+ }
+
+ public void init(IWorkbench workbench) {
+
+ }
+
+ public boolean performCancel() {
+ general.performCancel();
+ text.performCancel();
+
+ return true;
+ }
+
+ public boolean performOk() {
+ general.performOk();
+ text.performOk();
+
+ return super.performOk();
+ }
+
+ public void performDefaults() {
+ general.performDefaults();
+ text.performDefaults();
+ }
+
+ public void dispose() {
+ general.dispose();
+ text.dispose();
+
+ super.dispose();
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorTextPreferencesPage.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorTextPreferencesPage.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/preferences/DecoratorTextPreferencesPage.java 2008-02-28 17:10:42 UTC (rev 6644)
@@ -0,0 +1,388 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.common.model.ui.preferences;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.jface.preference.PreferencePage;
+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.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+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.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.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.ui.attribute.adapter.DefaultXModelObjectLabelProvider;
+import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorManager;
+import org.jboss.tools.common.model.ui.navigator.decorator.Variable;
+import org.jboss.tools.common.model.ui.navigator.decorator.XModelObjectDecorator;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DecoratorTextPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage, IPreferencePageExt {
+ TreeViewer decorators;
+ Composite editor;
+ Text formatField;
+ ModifyListener formatListener = new ML();
+ Button addVariableButton;
+
+ TreeViewer examples;
+
+ XModelObjectDecorator selection = null;
+
+ Map<XModelObjectDecorator,String> currentValues = new HashMap<XModelObjectDecorator, String>();
+
+ public DecoratorTextPreferencesPage() {
+ setTitle("Text");
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ init(null);
+ Composite g = new Composite(parent, SWT.NONE);
+ g.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(g, SWT.NONE);
+ label.setText("Select decorator:");
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ decorators = new TreeViewer(g, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ decorators.setAutoExpandLevel(2);
+ decorators.setLabelProvider(new LabelProvider() {
+ public String getText(Object element) {
+ if(element instanceof XModelObjectDecorator) {
+ XModelObjectDecorator d = (XModelObjectDecorator)element;
+ return d.getName();
+ }
+ return super.getText(element);
+ }
+
+ public Image getImage(Object element) {
+ String entity = null;
+ if(element instanceof XModelObjectDecorator) {
+ XModelObjectDecorator d = (XModelObjectDecorator)element;
+ Set<String> es = d.getEntities();
+ entity = (es == null || es.size() == 0) ? null : es.iterator().next();
+ } else if(element instanceof String) {
+ entity = DecoratorManager.getInstance().getBaseEntityForPartition(element.toString());
+ }
+ XModelObject o = entity == null ? null : PreferenceModelUtilities.getPreferenceModel().createModelObject(entity, new Properties());
+ return (o != null) ? EclipseResourceUtil.getImage(o) : null;
+ }
+
+ });
+ decorators.setContentProvider(new ITreeContentProvider() {
+
+ public Object[] getChildren(Object parentElement) {
+ if(parentElement instanceof String) {
+ Set<XModelObjectDecorator> set = DecoratorManager.getInstance().getDecoratorsByPartition(parentElement.toString());
+ return set != null ? set.toArray(new XModelObjectDecorator[0]) : new Object[0];
+ }
+ return new Object[0];
+ }
+
+ public Object getParent(Object element) {
+ if(element instanceof XModelObjectDecorator) {
+ return ((XModelObjectDecorator)element).getPartition();
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return element instanceof String;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if(inputElement == DecoratorManager.getInstance()) {
+ return DecoratorManager.getInstance().getPartitions();
+ }
+ return new Object[0];
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+
+ }
+
+ });
+
+ decorators.setInput(DecoratorManager.getInstance());
+
+ decorators.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ onSelectionChanged(event.getSelection());
+ }
+ });
+
+ GridData treeLayoutData = new GridData(GridData.FILL_HORIZONTAL);
+ treeLayoutData.heightHint = 150;
+ decorators.getTree().setLayoutData(treeLayoutData);
+
+ Composite c = new Composite(g, SWT.NONE);
+ editor = c;
+ GridLayout cLayout = new GridLayout(3, false);
+ c.setLayout(cLayout);
+ c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ Label cLabel = new Label(c, SWT.NONE);
+ cLabel.setText("Format:");
+
+ formatField = new Text(c, SWT.SINGLE | SWT.BORDER);
+ formatField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ addVariableButton = new Button(c, SWT.PUSH);
+ addVariableButton.setText("Add Variable...");
+
+ addVariableButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ addVariable();
+ }
+
+ });
+
+
+ label = new Label(g, SWT.NONE);
+ label.setText("Preview:");
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ examples = new TreeViewer(g, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ examples.setContentProvider(new ITreeContentProvider() {
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object[] getElements(Object inputElement) {
+ if(selection != null) {
+ return selection.getExamples();
+ }
+ return new Object[0];
+ }
+ public void dispose() {
+ }
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ }
+
+ });
+ examples.setLabelProvider(new DefaultXModelObjectLabelProvider() {
+ public String getText(Object element) {
+ if(selection == null) {
+ return super.getText(element);
+ }
+ String result = "";
+ if (element instanceof XModelObject) {
+ XModelObject modelObject = (XModelObject)element;
+ XModelObjectDecorator d = selection.getWorkingCopy();
+ d.setValue(formatField.getText());
+ result = d.getLabel(modelObject);
+ } else {
+ result = "?";
+ }
+ return result;
+ }
+
+ });
+
+ treeLayoutData = new GridData(GridData.FILL_HORIZONTAL);
+ treeLayoutData.heightHint = 100;
+ examples.getTree().setLayoutData(treeLayoutData);
+
+ examples.setInput(DecoratorManager.getInstance());
+
+ setSelectedObject(null);
+
+ return g;
+ }
+
+ public void init(IWorkbench workbench) {
+ String[] ps = DecoratorManager.getInstance().getPartitions();
+ for (int i = 0; i < ps.length; i++) {
+ Set<XModelObjectDecorator> set = DecoratorManager.getInstance().getDecoratorsByPartition(ps[i]);
+ for (XModelObjectDecorator d: set) {
+ currentValues.put(d, d.getValue());
+ }
+ }
+ }
+
+ public boolean performCancel() {
+ return true;
+ }
+
+ public boolean performOk() {
+ boolean change = false;
+ for (XModelObjectDecorator d: currentValues.keySet()) {
+ if(equal(d.getValue(), currentValues.get(d))) continue;
+ change = true;
+ d.setValue(currentValues.get(d));
+ }
+ if(change) {
+ DecoratorManager.getInstance().applyToPreferences();
+ }
+ return super.performOk();
+ }
+
+ private boolean equal(String a, String b) {
+ if(a == null) return b == null;
+ return a.equals(b);
+ }
+
+ public void performDefaults() {
+ for (XModelObjectDecorator d: currentValues.keySet()) {
+ String dv = d.getDefaultValue();
+ if(dv == null || dv.length() == 0) {
+ dv = Variable.NAME.getRuleText();
+ }
+ currentValues.put(d, dv);
+ }
+ if(selection != null) {
+ setText(currentValues.get(selection));
+ }
+ }
+
+ private void onSelectionChanged(ISelection s) {
+ if(!s.isEmpty() && (s instanceof IStructuredSelection)) {
+ Object o = ((IStructuredSelection)s).getFirstElement();
+ if(o instanceof XModelObjectDecorator) {
+ setSelectedObject((XModelObjectDecorator)o);
+ return;
+ }
+ }
+ setSelectedObject(null);
+ }
+
+ private void setSelectedObject(XModelObjectDecorator d) {
+ selection = d;
+ if(d != null) {
+// editor.setVisible(true);
+ formatField.setEnabled(true);
+ addVariableButton.setEnabled(true);
+
+ String text = currentValues.get(d);
+ setText(text);
+
+ } else {
+// editor.setVisible(false);
+ formatField.setEnabled(false);
+ addVariableButton.setEnabled(false);
+ setText("");
+ }
+ examples.refresh(true);
+ }
+
+ private void setText(String text) {
+ if(text == null) text = "";
+ formatField.removeModifyListener(formatListener);
+ formatField.setText(text);
+ formatField.addModifyListener(formatListener);
+ }
+
+ class ML implements ModifyListener {
+ public void modifyText(ModifyEvent e) {
+ if(selection != null) {
+ currentValues.put(selection, formatField.getText());
+ examples.refresh(true);
+ }
+ }
+ }
+
+ private void addVariable() {
+ CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(
+ addVariableButton.getShell(),
+ new LabelProvider(),
+ new ITreeContentProvider() {
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object[] getElements(Object inputElement) {
+ if(selection != null) {
+ return selection.getVariables();
+ }
+ return new Object[0];
+ }
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ }
+ }
+ );
+ dialog.setInput(selection);
+ dialog.setTitle("Select Variable");
+ dialog.create();
+ int result = dialog.open();
+ if(result == Window.OK) {
+ addVariable(dialog.getResult());
+ }
+ }
+
+ private void addVariable(Object[] checked) {
+ if(checked == null || checked.length == 0) return;
+ String text = formatField.getText();
+ int c = formatField.getCaretPosition();
+ if(c < 0 || c > text.length()) c = text.length();
+ StringBuffer sb = new StringBuffer(text.substring(0, c));
+ for (int i = 0; i < checked.length; i++) {
+ Variable v = (Variable)checked[i];
+ sb.append(v.getRuleText());
+ }
+ int cn = sb.length();
+ sb.append(text.substring(c));
+ text = sb.toString();
+ currentValues.put(selection, text);
+ setText(text);
+ formatField.setSelection(cn);
+ }
+
+}
16 years, 10 months