JBoss Tools SVN: r7481 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-04-10 08:54:18 -0400 (Thu, 10 Apr 2008)
New Revision: 7481
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1992
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2008-04-10 12:35:11 UTC (rev 7480)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2008-04-10 12:54:18 UTC (rev 7481)
@@ -57,6 +57,8 @@
public static String SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_SOURCE_FOLDER_DOES_NOT_EXIST;
+ public static String SEAM_SETTINGS_PREFERENCE_PAGE_PACKAGE_IS_BLANK;
+
public static String SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_PACKAGE_IS_NOT_VALID;
public static String SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_PACKAGE_HAS_WARNING;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2008-04-10 12:35:11 UTC (rev 7480)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2008-04-10 12:54:18 UTC (rev 7481)
@@ -98,6 +98,7 @@
SEAM_SETTINGS_PREFERENCE_PAGE_ACTION_SOURCE_FOLDER_DOES_NOT_EXIST=Action/Form/Conversation source folder "{0}" does not exist.
SEAM_SETTINGS_PREFERENCE_PAGE_TEST_PROJECT_DOES_NOT_EXIST=Seam test project "{0}" does not exist.
SEAM_SETTINGS_PREFERENCE_PAGE_TEST_SOURCE_FOLDER_DOES_NOT_EXIST=Test source folder "{0}" does not exist.
+SEAM_SETTINGS_PREFERENCE_PAGE_PACKAGE_IS_BLANK=the use of the default package is discouraged.
SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_PACKAGE_IS_NOT_VALID=Model package name: {0}
SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_PACKAGE_HAS_WARNING=Model package name: {0}
SEAM_SETTINGS_PREFERENCE_PAGE_ACTION_PACKAGE_IS_NOT_VALID=Action/Form/Conversation package name: {0}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-04-10 12:35:11 UTC (rev 7480)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2008-04-10 12:54:18 UTC (rev 7481)
@@ -541,6 +541,8 @@
if(editorRegistry.get(editorName).isEnabled()) {
String packageName = getValue(editorName).trim();
if(packageName.length()==0) {
+ setMessage(NLS.bind(warningMessageKey, new String[]{SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_PACKAGE_IS_BLANK}), IMessageProvider.WARNING);
+ warning = true;
return true;
}
IStatus status = JavaConventions.validatePackageName(packageName, CompilerOptions.VERSION_1_5, CompilerOptions.VERSION_1_5);
17 years, 9 months
JBoss Tools SVN: r7480 - in trunk/jsf/docs: jsf_tools_tutorial/en/modules and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: tromanovich
Date: 2008-04-10 08:35:11 -0400 (Thu, 10 Apr 2008)
New Revision: 7480
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_config_file.xml
trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_support.xml
trunk/jsf/docs/jsf_tools_tutorial/en/modules/introduction.xml
trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml
trunk/jsf/docs/userguide/en/modules/editors.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-140 links in docs should be relative
Updating external links between documents
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_config_file.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_config_file.xml 2008-04-10 11:10:00 UTC (rev 7479)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_config_file.xml 2008-04-10 12:35:11 UTC (rev 7480)
@@ -212,8 +212,8 @@
</mediaobject>
</figure>
- <para>The JSF configuration editor also comes with a very useful <link
- linkend="../../jsf/html_single/index.html#OpenOnSelection4Hyperlinknavigation">OpenOn</link> selection feature.</para>
+ <para>The JSF configuration editor also comes with a very useful <ulink
+ url="../../jsf/html_single/index.html#OpenOnSelection4Hyperlinknavigation">OpenOn</ulink> selection feature.</para>
</section>
<section id="ErrorReporting3324">
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_support.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_support.xml 2008-04-10 11:10:00 UTC (rev 7479)
+++ trunk/jsf/docs/jsf_tools_ref_guide/en/modules/jsf_support.xml 2008-04-10 12:35:11 UTC (rev 7480)
@@ -189,8 +189,7 @@
<section>
<title>Facelets components</title>
- <para>ss</para>
- <para>The <link linkend="../../jsf/html_single/index.html#palette">JBoss Tools Palette</link> comes with the
+ <para>The <ulink url="../../jsf/html_single/index.html#palette">JBoss Tools Palette</ulink> comes with the
Facelets components ready to use. A useful tip appears when you
hover the mouse cursor over the tag, the tip includes a detailed
description of the tag component, the syntax and available
Modified: trunk/jsf/docs/jsf_tools_tutorial/en/modules/introduction.xml
===================================================================
--- trunk/jsf/docs/jsf_tools_tutorial/en/modules/introduction.xml 2008-04-10 11:10:00 UTC (rev 7479)
+++ trunk/jsf/docs/jsf_tools_tutorial/en/modules/introduction.xml 2008-04-10 12:35:11 UTC (rev 7480)
@@ -11,7 +11,7 @@
</chapterinfo>
<title>Introduction</title>
<para>The following chapters describe how to deal with classic/old style of JSF development. We
- recommend users to use <ulink url="../../seam/html/create_new_seam.html">JBoss
+ recommend users to use <ulink url="../../seam/html_single/index.html">JBoss
Seam</ulink> to simplify development, but until then you can read about classical JSF
usage here.</para>
</chapter>
Modified: trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml 2008-04-10 11:10:00 UTC (rev 7479)
+++ trunk/jsf/docs/userguide/en/modules/Visual_Web_Tools.xml 2008-04-10 12:35:11 UTC (rev 7480)
@@ -68,39 +68,39 @@
<row>
<entry>JSF and Facelets support</entry>
<entry>Step-by-step wizards for creating new JSF and Facelets projects with a number of predefined templates, importing existing ones and adding JSF capabilities to non-jsf web projects.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#jsf_support">jsf support</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#jsf_support">jsf support</ulink></entry>
</row>
<row>
<entry>Flexible and customizable project template management</entry>
<entry>Jump-start development with out-of-the-box templates or easily customized templates
for re-use.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#projects">working with projects</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#projects">working with projects</ulink></entry>
</row>
<row>
<entry>Support for Managed Beans</entry>
<entry>Adding new managed beans, generating code for attributes, properties and getter/setter methods.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#managed_beans">managed beans</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#managed_beans">managed beans</ulink></entry>
</row>
<row>
<entry>OpenOn</entry>
<entry>Easy navigation between views and other parts of your projects.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#FaceletsSupport865">facelets support</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#FaceletsSupport865">facelets support</ulink></entry>
</row>
<row>
<entry>Content Assist</entry>
<entry>Code completion proposals while working in java, xml, jsp, xhtml, xhtml, seam project and jsf configuration files. Content assist based on project data (dynamic code assist); with graphical editor. Code completion for values from property files, beans attributes and methods, navigation rule outcomes and jsf variables.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#ContentAssist976">content assist</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#ContentAssist976">content assist</ulink></entry>
</row>
<row>
<entry>Support for Custom Converters and Validators</entry>
<entry>Fast creating of custom converters and validators with tree view of faces-config.xml file.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#CreateAndRegisterACustomConverter94230">converters and validators</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#CreateAndRegisterACustomConverter94230">converters and validators</ulink></entry>
</row>
<row>
<entry>Verification and Validation</entry>
<entry>All occuring errors will be immediately reported by verification feature, no matter in what view you are working. Constant validation and errors checking allows to catch many of the errors during development process that significantly reduces development time.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#jsf_project_verification">verification and validation</link></entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#jsf_project_verification">verification and validation</ulink></entry>
</row>
<row>
@@ -111,13 +111,13 @@
<row>
<entry>Struts Support</entry>
<entry>Step-by-step wizards for creating a new struts project with a number of predefined templates, importing existing ones and adding struts capabilities to non-struts web projects.</entry>
- <entry><link linkend="../../struts_tools_ref_guide/html_single/index.html#projects">struts support</link></entry>
+ <entry><ulink url="../../struts_tools_ref_guide/html_single/index.html#projects">struts support</ulink></entry>
</row>
<row>
<entry>Support for JSF and Struts Configuration Files</entry>
<entry>Working on files using three modes: diagram, tree and source. Synchronization between the modes and full control over the code. Easy moving around the diagram using the Diagram Navigator. Working with struts projects that have multiple modules. Possibility to use Struts configuration file debugger allowing to set break points on struts diagram and then launch the server in debug mode.</entry>
- <entry><link linkend="../../jsf_tools_ref_guide/html_single/index.html#jsf_config_file">graphical editor for jsf</link> <link linkend="../../struts_tools_ref_guide/html_single/index.html#struts_config_editor">graphical editor for struts</link> </entry>
+ <entry><ulink url="../../jsf_tools_ref_guide/html_single/index.html#jsf_config_file">graphical editor for jsf</ulink> <ulink url="../../struts_tools_ref_guide/html_single/index.html#struts_config_editor">graphical editor for struts</ulink> </entry>
</row>
<row>
<entry>Rich Faces Support</entry>
Modified: trunk/jsf/docs/userguide/en/modules/editors.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/editors.xml 2008-04-10 11:10:00 UTC (rev 7479)
+++ trunk/jsf/docs/userguide/en/modules/editors.xml 2008-04-10 12:35:11 UTC (rev 7480)
@@ -12,10 +12,10 @@
<title>Editors</title>
<para>In previous chapters you had possibility to read about Graphical Editor for
- <link linkend="../../jsf_tools_ref_guide/html_single/index.html#jsf_config_file">JSF</link> and
- <link linkend="../../struts_tools_ref_guide/html_single/index.html#struts_config_editor">Struts</link> configuration files,
- <link linkend="../../struts_tools_ref_guide/html_single/index.html#GraphicalEditorForTilesFiles132">Graphical Editor for Tiles Files</link>,
- <link linkend="../../struts_tools_ref_guide/html_single/index.html#GraphicalEditorForStrutsValidationFiles86">Graphical Editor for Struts Validation Files</link>.
+ <ulink url="../../jsf_tools_ref_guide/html_single/index.html#jsf_config_file">JSF</ulink> and
+ <ulink url="../../struts_tools_ref_guide/html_single/index.html#struts_config_editor">Struts</ulink> configuration files,
+ <ulink url="../../struts_tools_ref_guide/html_single/index.html#GraphicalEditorForTilesFiles132">Graphical Editor for Tiles Files</ulink>,
+ <ulink url="../../struts_tools_ref_guide/html_single/index.html#GraphicalEditorForStrutsValidationFiles86">Graphical Editor for Struts Validation Files</ulink>.
All these editors have <link linkend="OpenOnSelection4Hyperlinknavigation"><property>OpenOn</property></link> and
<link linkend="CodeAssistAndDynamicCodeAssist42BasedOnProjectData"><property>Content Assist</property></link> features,
they are described more detail in this chapter. In addition you get to know a <link linkend="visual_page">Visual Page Editor</link> for combined visual and source editing
17 years, 9 months
JBoss Tools SVN: r7479 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-04-10 07:10:00 -0400 (Thu, 10 Apr 2008)
New Revision: 7479
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1559
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2008-04-10 11:09:57 UTC (rev 7478)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2008-04-10 11:10:00 UTC (rev 7479)
@@ -11,6 +11,10 @@
package org.jboss.tools.hibernate.ui.view.views;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.action.IAction;
@@ -23,27 +27,39 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class OpenDiagramActionDelegate extends OpenActionDelegate {
+
private HashMap hashMap = new HashMap();
public void run(IAction action) {
ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
+ Map mapCC_PCs = new HashMap();
TreePath[] paths = ((TreeSelection)objectPluginAction.getSelection()).getPaths();
for (int i = 0; i < paths.length; i++) {
Object last_el = paths[i].getLastSegment();
if (last_el instanceof PersistentClass) {
PersistentClass persClass = (PersistentClass) last_el;
ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(paths[i].getFirstSegment());
-
- try {
- openEditor(persClass, consoleConfiguration);
- } catch (PartInitException e) {
- ViewPlugin.getDefault().logError("Can't open mapping view.", e); //$NON-NLS-1$
- }
+ Set setPC = (Set)mapCC_PCs.get(consoleConfiguration);
+ if (null == setPC) {
+ setPC = new HashSet();
+ mapCC_PCs.put(consoleConfiguration, setPC);
+ }
+ setPC.add(persClass);
}
}
+ for (Iterator it = mapCC_PCs.keySet().iterator(); it.hasNext(); ) {
+ ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)it.next();
+ Set setPC = (Set)mapCC_PCs.get(consoleConfiguration);
+ try {
+ openEditor(setPC, consoleConfiguration);
+ } catch (PartInitException e) {
+ ViewPlugin.getDefault().logError("Can't open mapping view.", e); //$NON-NLS-1$
+ }
+ }
}
public IEditorPart openEditor(PersistentClass persClass,
@@ -60,4 +76,31 @@
return IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
}
+
+ public IEditorPart openEditor(Set setPC, ConsoleConfiguration consoleConfiguration) throws PartInitException {
+
+ if (0 >= setPC.size()) {
+ return null;
+ }
+
+ RootClass[] rcArr = new RootClass[setPC.size()];
+ String id = "";
+ PersistentClass persClass = null;
+ int i = 0;
+ for (Iterator it = setPC.iterator(); it.hasNext(); ) {
+ persClass = (PersistentClass)it.next();
+ id += "@" + persClass.toString();
+ rcArr[i++] = persClass.getRootClass();
+ }
+
+ ObjectEditorInput input = (ObjectEditorInput)hashMap.get(id);
+ IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
+
+ if (null == input) {
+ input = new ObjectEditorInput(consoleConfiguration, rcArr, proj);
+ hashMap.put(id, input);
+ }
+
+ return IDE.openEditor(ViewPlugin.getPage(),input ,"org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
+ }
}
\ No newline at end of file
17 years, 9 months
JBoss Tools SVN: r7478 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors: model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2008-04-10 07:09:57 -0400 (Thu, 10 Apr 2008)
New Revision: 7478
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1559
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java 2008-04-10 07:03:35 UTC (rev 7477)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/VisualEditor.java 2008-04-10 11:09:57 UTC (rev 7478)
@@ -141,9 +141,21 @@
super.setInput(input);
ObjectEditorInput objectEditorInput = (ObjectEditorInput)input;
ConsoleConfiguration configuration = objectEditorInput.getConfiguration();
- RootClass rootClass = (RootClass)(objectEditorInput).getObject();
- setPartName("Diagram for " + rootClass.getEntityName());
- ormDiagram = new OrmDiagram(configuration, rootClass, objectEditorInput.getJavaProject());
+ Object obj = objectEditorInput.getObject();
+ if (obj instanceof RootClass) {
+ RootClass rootClass = (RootClass)obj;
+ setPartName("Diagram for " + rootClass.getEntityName());
+ ormDiagram = new OrmDiagram(configuration, rootClass, objectEditorInput.getJavaProject());
+ }
+ else if (obj instanceof RootClass[]) {
+ RootClass[] rootClasses = (RootClass[])obj;
+ String name = rootClasses.length > 0 ? rootClasses[0].getEntityName() : "";
+ for (int i = 1; i < rootClasses.length; i++) {
+ name += " & " + rootClasses[i].getEntityName();
+ }
+ setPartName("Diagram for " + name);
+ ormDiagram = new OrmDiagram(configuration, rootClasses, objectEditorInput.getJavaProject());
+ }
}
public Object getAdapter(Class type) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2008-04-10 07:03:35 UTC (rev 7477)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2008-04-10 11:09:57 UTC (rev 7478)
@@ -55,30 +55,54 @@
private boolean dirty = false;
private String childrenLocations[];
private HashMap<String,OrmShape> elements = new HashMap<String,OrmShape>();
- private RootClass ormElement;
+ private RootClass[] ormElements;
private Configuration configuration;
private ConsoleConfiguration consoleConfiguration;
private IJavaProject javaProject;
- private String entityName;
+ private String[] entityNames;
public static final String HIBERNATE_MAPPING_LAYOUT_FOLDER_NAME = "hibernateMapping";
public OrmDiagram(ConsoleConfiguration configuration, RootClass ioe, IJavaProject javaProject) {
consoleConfiguration = configuration;
this.configuration = configuration.getConfiguration();
- ormElement = (RootClass)ioe;
- entityName = ioe.getEntityName();
+ ormElements = new RootClass[1];
+ ormElements[0] = ioe;
+ entityNames = new String[1];
+ entityNames[0] = ioe.getEntityName();
this.javaProject = javaProject;
- if (ormElement instanceof RootClass) {
+ if (ioe instanceof RootClass) {
String string = "";
childrenLocations = string.split("#");
}
- getOrCreatePersistentClass(ormElement, null);
+ getOrCreatePersistentClass(ormElements[0], null);
expandModel(this);
load();
setDirty(false);
}
+ public OrmDiagram(ConsoleConfiguration configuration, RootClass[] ioe, IJavaProject javaProject) {
+ consoleConfiguration = configuration;
+ this.configuration = configuration.getConfiguration();
+ ormElements = new RootClass[ioe.length];
+ System.arraycopy(ioe, 0, ormElements, 0, ioe.length);
+ entityNames = new String[ioe.length];
+ for (int i = 0; i < ormElements.length; i++) {
+ entityNames[i] = ormElements[i].getEntityName();
+ }
+ this.javaProject = javaProject;
+ if (ioe instanceof RootClass[]) {
+ String string = "";
+ childrenLocations = string.split("#");
+ }
+ for (int i = 0; i < ormElements.length; i++) {
+ getOrCreatePersistentClass(ormElements[i], null);
+ }
+ expandModel(this);
+ load();
+ setDirty(false);
+ }
+
private IPath getStoreFolderPath() {
return javaProject.getProject().getLocation().append(".settings").append(HIBERNATE_MAPPING_LAYOUT_FOLDER_NAME);
}
@@ -88,26 +112,48 @@
}
private String getStoreFileName() {
- return consoleConfiguration.getName() + "_" + getOrmElement().getClassName();
+ String name = ormElements.length > 0 ? ormElements[0].getClassName() : "";
+ for (int i = 1; i < ormElements.length; i++) {
+ name += "_" + ormElements[i].getClassName();
+ }
+ return consoleConfiguration.getName() + "_" + name;
}
public HashMap getCloneElements() {
return (HashMap)elements.clone();
}
- public RootClass getOrmElement() {
- return ormElement;
+ public RootClass getOrmElement(int idx) {
+ if (0 > idx || idx >= ormElements.length) {
+ return null;
+ }
+ return ormElements[idx];
}
+ public RootClass[] getOrmElements() {
+ return ormElements;
+ }
+
public void refresh() {
- RootClass newOrmElement = (RootClass) consoleConfiguration
- .getConfiguration().getClassMapping(entityName);
- if (ormElement.equals(newOrmElement)) return;
- ormElement = newOrmElement;
+ boolean bRefresh = false;
+ for (int i = 0; i < ormElements.length; i++) {
+ RootClass newOrmElement = (RootClass) consoleConfiguration
+ .getConfiguration().getClassMapping(entityNames[i]);
+ if (ormElements[i].equals(newOrmElement)) {
+ continue;
+ }
+ ormElements[i] = newOrmElement;
+ bRefresh = true;
+ }
+ if (!bRefresh) {
+ return;
+ }
saveHelper();
getChildren().clear();
elements.clear();
- getOrCreatePersistentClass(ormElement, null);
+ for (int i = 0; i < ormElements.length; i++) {
+ getOrCreatePersistentClass(ormElements[i], null);
+ }
expandModel(this);
load();
firePropertyChange(REFRESH, null, null);
@@ -141,22 +187,38 @@
private OrmShape createShape(Object ormElement) {
OrmShape ormShape = null;
if (ormElement instanceof RootClass) {
- ormShape = new OrmShape(ormElement);
- getChildren().add(ormShape);
- elements.put(HibernateUtils.getPersistentClassName(((RootClass)ormElement).getEntityName()), ormShape);
+ String key = HibernateUtils.getPersistentClassName(((RootClass)ormElement).getEntityName());
+ ormShape = (OrmShape)elements.get(key);
+ if (null == ormShape) {
+ ormShape = new OrmShape(ormElement);
+ getChildren().add(ormShape);
+ elements.put(key, ormShape);
+ }
} else if (ormElement instanceof Table) {
- ormShape = new OrmShape(ormElement);
- getChildren().add(ormShape);
- elements.put(HibernateUtils.getTableName((Table)ormElement), ormShape);
+ String key = HibernateUtils.getTableName((Table)ormElement);
+ ormShape = (OrmShape)elements.get(key);
+ if (null == ormShape) {
+ ormShape = new OrmShape(ormElement);
+ getChildren().add(ormShape);
+ elements.put(key, ormShape);
+ }
} else if (ormElement instanceof Property) {
SpecialRootClass specialRootClass = new SpecialRootClass((Property)ormElement);
- ormShape = new SpecialOrmShape(specialRootClass);
- getChildren().add(ormShape);
- elements.put(HibernateUtils.getPersistentClassName(specialRootClass.getEntityName()), ormShape);
+ String key = HibernateUtils.getPersistentClassName(specialRootClass.getEntityName());
+ ormShape = (OrmShape)elements.get(key);
+ if (null == ormShape) {
+ ormShape = new SpecialOrmShape(specialRootClass);
+ getChildren().add(ormShape);
+ elements.put(key, ormShape);
+ }
} else if (ormElement instanceof Subclass) {
- ormShape = new OrmShape(ormElement);
- getChildren().add(ormShape);
- elements.put(HibernateUtils.getPersistentClassName(((Subclass)ormElement).getEntityName()), ormShape);
+ String key = HibernateUtils.getPersistentClassName(((Subclass)ormElement).getEntityName());
+ ormShape = (OrmShape)elements.get(key);
+ if (null == ormShape) {
+ ormShape = new OrmShape(ormElement);
+ getChildren().add(ormShape);
+ elements.put(key, ormShape);
+ }
}
return ormShape;
}
@@ -246,7 +308,7 @@
componentClassShape = getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
Shape idPropertyShape = classShape.getChild(persistentClass.getIdentifierProperty());
- if (idPropertyShape != null) {
+ if (idPropertyShape != null && !isConnectionExist(idPropertyShape, componentClassShape)) {
new Connection(idPropertyShape, componentClassShape);
idPropertyShape.firePropertyChange(REFRESH, null, null);
componentClassShape.firePropertyChange(REFRESH, null, null);
@@ -440,7 +502,7 @@
} else if (collection.isOneToMany()) {
childShape = getOrCreateAssociationClass(property);
-if (childShape == null) return;
+ if (childShape == null) return;
if(!isConnectionExist((Shape)(componentShape.getChildren().get(1)), childShape)){
new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
((Shape)(componentShape.getChildren().get(1))).firePropertyChange(REFRESH, null, null);
@@ -626,7 +688,7 @@
try {
folder.create(true, true, null);
- file = folder.getFile(consoleConfiguration.getName() + "_" + getOrmElement().getClassName());
+ file = folder.getFile(getStoreFileName());
if (!file.exists()) {
file.create(source, true, null);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2008-04-10 07:03:35 UTC (rev 7477)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2008-04-10 11:09:57 UTC (rev 7478)
@@ -95,7 +95,7 @@
int point = 1;
int pointX = calculateTableLocation();
String string, xy[];
- for (int i = 0; i < childrenLocations.length; i++)
+ for (int i = 0; i < childrenLocations.length; i++) {
if (childrenLocations[i].indexOf('@') != -1
&& childrenLocations[i].indexOf(';') != -1) {
string = childrenLocations[i].substring(0, childrenLocations[i]
@@ -121,9 +121,10 @@
point = tempPoint;
}
}
- if (getCastedModel().getOrmElement() instanceof RootClass) {
- RootClass persistentClass = (RootClass) getCastedModel()
- .getOrmElement();
+ }
+ RootClass[] ormElements = getCastedModel().getOrmElements();
+ for (int i = 0; i < childrenLocations.length; i++) {
+ RootClass persistentClass = ormElements[i];
ormShape = (OrmShape) hashMap.remove(persistentClass
.getEntityName());
if (ormShape != null) {
17 years, 9 months
JBoss Tools SVN: r7477 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-04-10 03:03:35 -0400 (Thu, 10 Apr 2008)
New Revision: 7477
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java
Log:
JBIDE-2039
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java 2008-04-09 21:41:15 UTC (rev 7476)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/FileSystemImpl.java 2008-04-10 07:03:35 UTC (rev 7477)
@@ -67,6 +67,13 @@
if(thloc.toLowerCase().startsWith(prloc.toLowerCase())) {
String relative = thloc.substring(prloc.length());
IFolder f = project.getFolder(new Path(relative));
+ if(!f.exists() && !f.isSynchronized(IResource.DEPTH_ONE)) {
+ try {
+ f.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ }
if(!f.exists()) {
try {
if(f.getParent() != null && f.getParent().exists()) {
17 years, 9 months
JBoss Tools SVN: r7476 - trunk/as/plugins/org.jboss.ide.eclipse.as.core.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-04-09 17:41:15 -0400 (Wed, 09 Apr 2008)
New Revision: 7476
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBIDE-2038 - missing facet support
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2008-04-09 17:15:38 UTC (rev 7475)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2008-04-09 21:41:15 UTC (rev 7476)
@@ -448,6 +448,7 @@
<facet id="jst.web" version="2.2,2.3,2.4,2.5"/>
<facet id="jst.java" version="1.3,1.4,5.0,6.0"/>
<facet id="jst.utility" version="1.0"/>
+ <facet id="jst.connector" version="1.0,1.5"/>
<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"/>
@@ -460,6 +461,7 @@
<facet id="jst.web" version="2.2,2.3,2.4,2.5"/>
<facet id="jst.java" version="1.3,1.4,5.0,6.0"/>
<facet id="jst.utility" version="1.0"/>
+ <facet id="jst.connector" version="1.0,1.5"/>
<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"/>
@@ -472,6 +474,7 @@
<facet id="jst.web" version="2.2,2.3,2.4,2.5"/>
<facet id="jst.java" version="1.3,1.4,5.0,6.0"/>
<facet id="jst.utility" version="1.0"/>
+ <facet id="jst.connector" version="1.0,1.5"/>
<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"/>
17 years, 9 months
JBoss Tools SVN: r7475 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-04-09 13:15:38 -0400 (Wed, 09 Apr 2008)
New Revision: 7475
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
Log:
http://jira.jboss.org/jira/browse/JBIDE-2033
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2008-04-09 16:53:51 UTC (rev 7474)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/templates/vpe-templates-ajax4jsf.xml 2008-04-09 17:15:38 UTC (rev 7475)
@@ -63,8 +63,6 @@
</vpe:drop>
</vpe:dnd>
<vpe:textFormatting use-default-formats="yes">
- <vpe:format type="BlockFormat"
- handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BlockFormatHandler" />
<vpe:format type="UnderlineFormat" setDefault="true">
<vpe:formatAttribute type="style"/>
</vpe:format>
17 years, 9 months
JBoss Tools SVN: r7474 - in trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates: jsf-1.1/JSFKickStartWithLibs/WebContent/WEB-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-04-09 12:53:51 -0400 (Wed, 09 Apr 2008)
New Revision: 7474
Modified:
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFBlankWithLibs/WebContent/WEB-INF/web.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithLibs/WebContent/WEB-INF/web.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithoutLibs/WebContent/WEB-INF/web.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/Blank/WebContent/WEB-INF/web.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/KickStart/WebContent/WEB-INF/web.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/Blank/WebContent/WEB-INF/web.xml
trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/KickStart/WebContent/WEB-INF/web.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-2034
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFBlankWithLibs/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFBlankWithLibs/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFBlankWithLibs/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -4,6 +4,11 @@
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithLibs/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithLibs/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithLibs/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -4,6 +4,11 @@
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithoutLibs/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithoutLibs/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/jsf-1.1/JSFKickStartWithoutLibs/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -4,6 +4,11 @@
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/Blank/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/Blank/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/Blank/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -4,6 +4,11 @@
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/KickStart/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/KickStart/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.1/KickStart/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-
#if ($servlet_version == "2.4")
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/Blank/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/Blank/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/Blank/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-
#if ($servlet_version == "2.4")
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
Modified: trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/KickStart/WebContent/WEB-INF/web.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/KickStart/WebContent/WEB-INF/web.xml 2008-04-09 16:52:23 UTC (rev 7473)
+++ trunk/common/plugins/org.jboss.tools.common.projecttemplates/templates/struts/1.2/KickStart/WebContent/WEB-INF/web.xml 2008-04-09 16:53:51 UTC (rev 7474)
@@ -1,10 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-
#if ($servlet_version == "2.4")
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+#elseif ($servlet_version == "2.5")
+<web-app version="2.5"
+xmlns="http://java.sun.com/xml/ns/javaee"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
#else
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
17 years, 9 months
JBoss Tools SVN: r7473 - in trunk/vpe/plugins/org.jboss.tools.vpe: src/org/jboss/tools/vpe/editor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-04-09 12:52:23 -0400 (Wed, 09 Apr 2008)
New Revision: 7473
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
Log:
JBIDE-2006
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF 2008-04-09 16:52:12 UTC (rev 7472)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/META-INF/MANIFEST.MF 2008-04-09 16:52:23 UTC (rev 7473)
@@ -61,6 +61,7 @@
org.eclipse.ui.views,
org.eclipse.ui.ide,
org.jboss.tools.vpe.xulrunner,
- org.mozilla.xpcom
+ org.mozilla.xpcom,
+ org.eclipse.draw2d
Bundle-Version: 2.1.0
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-04-09 16:52:12 UTC (rev 7472)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-04-09 16:52:23 UTC (rev 7473)
@@ -169,6 +169,8 @@
ResourceReferenceListListener, ISelectionChangedListener,
IVisualController {
+ private boolean visualEditorVisible = true;
+ private boolean synced = true;
StructuredTextEditor sourceEditor;
private MozillaEditor visualEditor;
// MozillaBrowser browser;
@@ -394,6 +396,11 @@
final int eventType, final Object feature, final Object oldValue,
final Object newValue, final int pos) {
+ if (!visualEditorVisible) {
+ synced = false;
+ return;
+ }
+
// start job when we modify file in ui thread, without this code
// changes will be applied with 1 second delay
Display display = null;
@@ -2770,4 +2777,33 @@
this.selectionBuilder = selectionBuilder;
}
+ public boolean isVisualEditorVisible() {
+ return visualEditorVisible;
+ }
+
+ public void setVisualEditorVisible(boolean visualEditorVisible) {
+ this.visualEditorVisible = visualEditorVisible;
+ }
+
+ public boolean isSynced() {
+ return synced;
+ }
+
+ public void setSynced(boolean synced) {
+ this.synced = synced;
+ }
+
+ public void rebuildDom() {
+ if (visualBuilder == null)
+ return;
+ IDOMModel sourceModel = (IDOMModel) getModel();
+ if (sourceModel != null) {
+ IDOMDocument sourceDocument = sourceModel.getDocument();
+ visualBuilder.rebuildDom(sourceDocument);
+ } else {
+ visualBuilder.rebuildDom(null);
+ }
+ synced = true;
+ }
+
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-04-09 16:52:12 UTC (rev 7472)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-04-09 16:52:23 UTC (rev 7473)
@@ -27,6 +27,7 @@
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -48,6 +49,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.IStatusField;
import org.eclipse.ui.texteditor.ITextEditor;
@@ -66,12 +68,15 @@
import org.jboss.tools.vpe.editor.mozilla.EditorLoadWindowListener;
import org.jboss.tools.vpe.editor.mozilla.MozillaEditor;
import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
-import org.jboss.tools.vpe.editor.xpl.SashForm;
+import org.jboss.tools.vpe.editor.xpl.CustomSashForm;
+import org.jboss.tools.vpe.editor.xpl.EditorSettings;
+import org.jboss.tools.vpe.editor.xpl.SashSetting;
import org.jboss.tools.vpe.selbar.SelectionBar;
public class VpeEditorPart extends EditorPart implements ITextEditor,
ITextEditorExtension, IReusableEditor, IVisualEditor {
- private SashForm container;
+ private CustomSashForm container;
+ protected EditorSettings editorSettings;
private StructuredTextEditor sourceEditor = null;
private MozillaEditor visualEditor;
private IEditorPart activeEditor;
@@ -252,6 +257,12 @@
throws PartInitException {
setSite(site);
setInput(input);
+ if (editorSettings == null)
+ editorSettings = EditorSettings.getEditorSetting(this);
+ else if (input instanceof FileEditorInput) {
+ editorSettings.setInput((FileEditorInput) input);
+ }
+
}
public void setInput(IEditorInput input) {
@@ -441,7 +452,11 @@
cmpEd.setLayout(layoutEd);
cmpEd.setLayoutData(new GridData(GridData.FILL_BOTH));
// /////////////////////////////////////////////////////////////////
- container = new SashForm(cmpEd, SWT.VERTICAL);
+ //container = new SashForm(cmpEd, SWT.VERTICAL);
+ container = new CustomSashForm(cmpEd, SWT.VERTICAL);
+ if (editorSettings != null)
+ editorSettings.addSetting(new SashSetting(container));
+
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
sourceContent = new Composite(container, SWT.NONE);
sourceContent.setLayout(new FillLayout());
@@ -450,7 +465,8 @@
// Create a preview content
previewContent = new Composite(container, SWT.NONE);
- previewContent.setLayout(new FillLayout());
+ //previewContent.setLayout(new FillLayout());
+ previewContent.setLayout(new GridLayout());
// ////////////////////////////////////////////////////
@@ -465,6 +481,8 @@
int[] weights = loadSplitterPosition();
if (weights != null)
container.setWeights(weights);
+ container.setSashBorders(new boolean[] { true, true, true });
+
final PropertyChangeListener weightsChangeListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
saveSplitterPosition(container.getWeights());
@@ -493,14 +511,48 @@
public void widgetDisposed(DisposeEvent e) {
parent.removeControlListener(controlListener);
- container.removeDisposeListener(this);
+ parent.removeDisposeListener(this);
}
});
- //createVisualEditor();
+
+ final ControlListener visualContentControlListener = new ControlListener() {
+ public void controlMoved(ControlEvent event) {
- //createPreviewBrowser();
+ }
+ public void controlResized(ControlEvent event) {
+ Point point = visualContent.getSize();
+ if (point.x == 0 || point.y == 0) {
+ VpeController controller = getController();
+ if (controller != null)
+ controller.setVisualEditorVisible(false);
+ } else {
+ VpeController controller = getController();
+ if (controller != null
+ && !controller.isVisualEditorVisible()) {
+ controller.setVisualEditorVisible(true);
+ if (!controller.isSynced())
+ controller.rebuildDom();
+ }
+ }
+ }
+ };
+ visualContent.addControlListener(visualContentControlListener);
+ visualContent.addDisposeListener(new DisposeListener() {
+
+ public void widgetDisposed(DisposeEvent e) {
+ visualContent
+ .removeControlListener(visualContentControlListener);
+ visualContent.removeDisposeListener(this);
+ }
+
+ });
+
+ // createVisualEditor();
+
+ // createPreviewBrowser();
+
try {
sourceEditor.addPropertyListener(new IPropertyListener() {
public void propertyChanged(Object source, int propId) {
@@ -595,6 +647,9 @@
};
optionsObject.getModel().addModelTreeListener(listener);
+ if (editorSettings != null)
+ editorSettings.apply();
+
// ///////////////////////////////////////
cmpEd.layout();
}
@@ -655,6 +710,10 @@
listener=null;
optionsObject = null;
}
+ if (editorSettings != null) {
+ editorSettings.dispose();
+ editorSettings = null;
+ }
if (activationListener != null) {
IWorkbenchWindow window = getSite().getWorkbenchWindow();
window.getPartService().removePartListener(activationListener);
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/CustomSashForm.java 2008-04-09 16:52:23 UTC (rev 7473)
@@ -0,0 +1,915 @@
+package org.jboss.tools.vpe.editor.xpl;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.Cursors;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.MouseTrackAdapter;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Sash;
+
+/**
+ * A SashForm that allows move to/from max controls on sash.
+ *
+ * It only works with one sash (two children). It doesn't make sense
+ * for the arrows when there is more than one sash. Things get confusing for
+ * a restore position.
+ *
+ * Currently only handle top/bottom orientation. Wouldn't take much to handle left/right.
+ * @author richkulp
+ */
+public class CustomSashForm extends SashForm {
+
+ public static final String copyright = "(c) Copyright IBM Corporation 2002."; //$NON-NLS-1$
+ /**
+ * Custom style bits. They set whether max to one side of the other
+ * is not permitted. For example, if NO_MAX_UP, then there will be only
+ * one arrow. When not maxed, it will point down (and will do a max down),
+ * and when maxed down, it will point up (and will do a restore to the
+ * previous weight). There won't be a max to the top arrow.
+ */
+ public static final int
+ NO_MAX_LEFT = 0x1, // Custom style bit for not allow max left
+ NO_MAX_UP = NO_MAX_LEFT, // Custom style bit for not allow max up
+ NO_MAX_RIGHT = 0x2, // Custom style bit for not allow max right
+ NO_MAX_DOWN = NO_MAX_RIGHT; // Custom style bit for not allow max down
+
+
+ private static final int NO_WEIGHT = -1;
+ private static final int NO_ARROW = -1;
+ private final static String LAYOUT_RATIO = "layout ratio";
+ private final static String WEIGHTS = "weights";
+ private static class SashInfo {
+ public Sash sash;
+ public boolean enabled; // Whether this sashinfo is enabled (i.e. if there is more than one, this will be disabled).
+ public int weight = NO_WEIGHT; // If slammed to an edge this is the restore weight. -1 means not slammed. This is the weight in the next form (i.e. sash[0] == weight[1].
+ public int cursorOver = NO_ARROW; // Which arrow is cursor over,
+ public boolean sashBorderLeft; // Draw sash border left/top
+ public boolean sashBorderRight; // Draw sash border right/bottom
+ public int[][] sashLocs; // There is one entry for each arrow, It is arrowType/arrowDrawn/x/y/height/width of the arrow area.
+ // There may not be a second entry, in which case we have only one arrow.
+ public SashInfo(Sash sash) {
+ this.sash = sash;
+ }
+ };
+
+ public static interface ICustomSashFormListener{
+ public void dividerMoved(int firstControlWeight, int secondControlWeight);
+ }
+
+ protected SashInfo currentSashInfo = null; // When the sash goes away, its entry is made null.
+ protected boolean inMouseClick = false; // Because we can't stop drag even when we are in the arrow area, we need
+ // to know that mouse down is in process so that when drag is completed, we
+ // know not to recompute our position because a mouse up is about to happen
+ // and we want the correct arrow handled correctly.
+
+ protected boolean sashBorders[]; // Whether cooresponding control needs a sash border
+
+ protected boolean noMaxUp, noMaxDown;
+ protected List customSashFormListeners = null;
+ protected PropertyChangeSupport listeners = new PropertyChangeSupport(this);
+
+ protected static final int
+ UP_ARROW = 0,
+ UP_MAX_ARROW = 1,
+ DOWN_ARROW = 2,
+ DOWN_MAX_ARROW = 3,
+
+ MAX_ARROWS = 4;
+
+ protected static final int
+ ARROW_TYPE_INDEX = 0,
+ ARROW_DRAWN_INDEX = 1,
+ X_INDEX = 2,
+ Y_INDEX = 3,
+ WIDTH_INDEX = 4,
+ HEIGHT_INDEX = 5;
+
+ /**
+ * Constructor for CustomSashForm.
+ * @param parent
+ * @param style
+ */
+ public CustomSashForm(Composite parent, int style) {
+ this(parent, style, SWT.NONE);
+ }
+
+ /**
+ * Constructor taking a custom style too.
+ * Or in the Custom style bits defined above (e.g. NO_MAX_RIGHT,...)
+ */
+ public CustomSashForm(Composite parent, int style, int customStyle) {
+ super(parent, style);
+
+ // Need listener to force a layout
+ this.addListener(SWT.Resize, new Listener() {
+ public void handleEvent(Event e) {
+ layout(true);
+ }
+ });
+
+ noMaxUp = ((customStyle & NO_MAX_UP) != 0);
+ noMaxDown = ((customStyle & NO_MAX_DOWN) != 0);
+
+ if (noMaxUp & noMaxDown)
+ return; // If you can't max up or down, there there is no need for arrows.
+
+ SASH_WIDTH = 3+ getOrientation() == SWT.VERTICAL ? ARROW_HEIGHT : ARROW_SIZE;
+
+ arrowColor = new Color(parent.getDisplay(), 99, 101, 156);
+ //arrowColor = new Color(parent.getDisplay(), 0, 0, 0);
+ //arrowColor = new Color(parent.getDisplay(), 98, 170, 108);
+ borderColor = new Color(parent.getDisplay(), 132, 130, 132);
+ //borderColor = new Color(parent.getDisplay(),194,172,149 );
+
+ addDisposeListener(new DisposeListener() {
+ /**
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(DisposeEvent)
+ */
+ public void widgetDisposed(DisposeEvent e) {
+ arrowColor.dispose();
+ borderColor.dispose();
+ arrowColor = borderColor = null;
+ }
+
+ });
+ }
+
+ /**
+ * Call to set to max up
+ */
+ public void maxUp() {
+ if (noMaxUp)
+ return;
+
+ if (currentSashInfo == null)
+ currentSashInfo = new SashInfo(null);
+ upMaxClicked(currentSashInfo);
+ }
+
+ /**
+ * Call to set to max left
+ */
+ public void maxLeft() {
+ maxUp();
+ }
+
+
+ /**
+ * Call to set to max down
+ */
+ public void maxDown() {
+ if (noMaxDown)
+ return;
+
+ if (currentSashInfo == null)
+ currentSashInfo = new SashInfo(null);
+
+ downMaxClicked(currentSashInfo);
+ }
+
+ /**
+ * Call to set to max left
+ */
+ public void maxRight() {
+ maxDown();
+ }
+
+ /**
+ * Set the need sash borders for the controls.
+ */
+ public void setSashBorders(boolean[] sashBorders) {
+ //int[] weights = getWeights(); // KLUDGE This is a kludge just to see how many controls we have.
+ //if (weights.length != 2 || (sashBorders != null && sashBorders.length != 2)) {
+ // SWT.error(SWT.ERROR_INVALID_ARGUMENT);
+ //}
+ this.sashBorders = sashBorders;
+ }
+
+ /**
+ * @see org.eclipse.swt.widgets.Composite#layout(boolean)
+ */
+ public void layout(boolean changed) {
+ super.layout(changed);
+
+ if (noMaxUp && noMaxDown)
+ return; // No arrows to handle in this case.
+
+ if (getMaximizedControl() != null)
+ return; // We have a maximized control, so we don't need to worry about the sash.
+
+ // Let's get the list of all sashes the sash form now has. If there is more than one then just disable the sashinfo.
+ // If there is no current sash, and there is only one sash, then create the sashinfo for it.
+ Control[] children = getChildren();
+ Sash newSash = null;
+ for (int i = 0; i < children.length; i++) {
+ if (children[i] instanceof Sash)
+ if (newSash == null)
+ newSash = (Sash) children[i];
+ else {
+ // We have more than one sash, so need to disable current sash, if we have one.
+ if (currentSashInfo != null)
+ currentSashInfo.enabled = false;
+ return; // Don't go on.
+ }
+ }
+
+ if (newSash == null)
+ return; // We have no sashes at all.
+
+ // Now we need to see if this is a new sash.
+ if (currentSashInfo == null || currentSashInfo.sash == null) {
+ if (currentSashInfo == null)
+ currentSashInfo = new SashInfo(newSash);
+ else
+ currentSashInfo.sash = newSash;
+ newSash.addPaintListener(new PaintListener() {
+ /**
+ * @see org.eclipse.swt.events.PaintListener#paintControl(PaintEvent)
+ */
+ public void paintControl(PaintEvent e) {
+ // Need to find the index of the sash we're interested in.
+
+ GC gc = e.gc;
+ Color oldFg = gc.getForeground();
+ Color oldBg = gc.getBackground();
+
+ drawArrow(gc, currentSashInfo.sashLocs[0], currentSashInfo.cursorOver == 0); // Draw first arrow
+ if (currentSashInfo.sashLocs.length > 1)
+ drawArrow(gc, currentSashInfo.sashLocs[1], currentSashInfo.cursorOver == 1); // Draw second arrow
+
+ if (currentSashInfo.sashBorderLeft)
+ drawSashBorder(gc, currentSashInfo.sash, true);
+ if (currentSashInfo.sashBorderRight)
+ drawSashBorder(gc, currentSashInfo.sash, false);
+
+ gc.setForeground(oldFg);
+ gc.setBackground(oldBg);
+ }
+
+ });
+
+ newSash.addControlListener(new ControlListener() {
+ /**
+ * @see org.eclipse.swt.events.ControlAdapter#controlMoved(ControlEvent)
+ */
+ public void controlMoved(ControlEvent e) {
+ recomputeSashInfo();
+ }
+
+ /**
+ * @see org.eclipse.swt.events.ControlAdapter#controlResized(ControlEvent)
+ */
+ public void controlResized(ControlEvent e) {
+ recomputeSashInfo();
+ }
+
+
+ });
+
+ newSash.addDisposeListener(new DisposeListener() {
+ /**
+ * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(DisposeEvent)
+ */
+ public void widgetDisposed(DisposeEvent e) {
+ // Need to clear out the widget from current.
+ currentSashInfo= null;
+ }
+ });
+
+ // This is a kludge because we can't override the set cursor hit test.
+ newSash.addMouseMoveListener(new MouseMoveListener() {
+ /**
+ * @see org.eclipse.swt.events.MouseMoveListener#mouseMove(MouseEvent)
+ */
+ public void mouseMove(MouseEvent e) {
+ // See if within one of the arrows.
+ int x = e.x;
+ int y = e.y;
+ for (int i=0; i<currentSashInfo.sashLocs.length; i++) {
+ int[] locs = currentSashInfo.sashLocs[i];
+ boolean vertical = getOrientation() == SWT.VERTICAL;
+ int loc = vertical ? x : y;
+ int locIndex = vertical ? X_INDEX : Y_INDEX;
+ int sizeIndex = vertical ? WIDTH_INDEX : HEIGHT_INDEX;
+ if (locs[locIndex] <= loc && loc <= locs[locIndex]+locs[sizeIndex]) {
+ if (currentSashInfo.cursorOver == NO_ARROW) {
+ currentSashInfo.sash.setCursor(Cursors.ARROW);
+ }
+ if (currentSashInfo.cursorOver != i) {
+ currentSashInfo.cursorOver = i;
+ currentSashInfo.sash.redraw();
+ switch (locs[ARROW_TYPE_INDEX]) {
+ case UP_ARROW:
+ case DOWN_ARROW:
+ currentSashInfo.sash.setToolTipText("Restore Previous Location");
+ break;
+ case UP_MAX_ARROW:
+ case DOWN_MAX_ARROW:
+ currentSashInfo.sash.setToolTipText("Maximize Pane");
+ break;
+ }
+ }
+ return;
+ }
+ }
+ if (currentSashInfo.cursorOver != NO_ARROW) {
+ currentSashInfo.sash.setCursor(null);
+ currentSashInfo.cursorOver = NO_ARROW;
+ currentSashInfo.sash.redraw();
+ currentSashInfo.sash.setToolTipText(null);
+ }
+ }
+
+ });
+
+ // Need to know when we leave so that we can clear the cursor feedback if set.
+ newSash.addMouseTrackListener(new MouseTrackAdapter() {
+ /**
+ * @see org.eclipse.swt.events.MouseTrackAdapter#mouseExit(MouseEvent)
+ */
+ public void mouseExit(MouseEvent e) {
+ if (currentSashInfo.cursorOver != NO_ARROW) {
+ // Undo the cursor.
+ currentSashInfo.sash.setCursor(null);
+ currentSashInfo.cursorOver = NO_ARROW;
+ currentSashInfo.sash.redraw();
+ currentSashInfo.sash.setToolTipText(null);
+ }
+ }
+ });
+
+ // Want to handle mouse down as a selection.
+ newSash.addMouseListener(new MouseAdapter() {
+ /**
+ * @see org.eclipse.swt.events.MouseAdapter#mouseDown(MouseEvent)
+ */
+ public void mouseDown(MouseEvent e) {
+ inMouseClick = true;
+ // If we're within a button, then redraw to wipe out stipple and get button push effect.
+ int x = e.x;
+ int y = e.y;
+ for (int i=0; i<currentSashInfo.sashLocs.length; i++) {
+ int[] locs = currentSashInfo.sashLocs[i];
+ boolean vertical = getOrientation() == SWT.VERTICAL;
+ int loc = vertical ? x : y;
+ int locIndex = vertical ? X_INDEX : Y_INDEX;
+ int sizeIndex = vertical ? WIDTH_INDEX : HEIGHT_INDEX;
+ if (locs[locIndex] <= loc && loc <= locs[locIndex]+locs[sizeIndex]) {
+ currentSashInfo.sash.redraw();
+ break;
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.swt.events.MouseListener#mouseDown(MouseEvent)
+ */
+ public void mouseUp(MouseEvent e) {
+ // See if within one of the arrows.
+ inMouseClick = false; // No longer in down click
+ int x = e.x;
+ int y = e.y;
+ for (int i=0; i<currentSashInfo.sashLocs.length; i++) {
+ int[] locs = currentSashInfo.sashLocs[i];
+ boolean vertical = getOrientation() == SWT.VERTICAL;
+ int loc = vertical ? x : y;
+ int locIndex = vertical ? X_INDEX : Y_INDEX;
+ int sizeIndex = vertical ? WIDTH_INDEX : HEIGHT_INDEX;
+ if (locs[locIndex] <= loc && loc <= locs[locIndex]+locs[sizeIndex]) {
+ // We found it.
+ switch (locs[ARROW_TYPE_INDEX]) {
+ case UP_ARROW:
+ upClicked(currentSashInfo);
+ break;
+ case UP_MAX_ARROW:
+ upMaxClicked(currentSashInfo);
+ break;
+ case DOWN_ARROW:
+ downClicked(currentSashInfo);
+ break;
+ case DOWN_MAX_ARROW:
+ downMaxClicked(currentSashInfo);
+ break;
+ }
+ break;
+ }
+ }
+
+ currentSashInfo.sash.redraw(); // Make sure stipple goes away from the mouse up if not over an arrow button.
+ fireDividerMoved();
+ }
+
+ });
+ recomputeSashInfo(); // Get initial setting
+ }
+
+ }
+
+
+ protected void recomputeSashInfo() {
+ if (inMouseClick && currentSashInfo.cursorOver != NO_WEIGHT)
+ return; // Don't process because we are in the down mouse button on an arrow.
+
+ // We need to refigure size for the sash arrows.
+ int[] addArrows = null;
+ int[] drawArrows = null;
+ int[] weights = getWeights(); // This should be two entries only. We shouldn't of gotton here if there were more than two.
+ if (noMaxUp) {
+ addArrows = new int[1];
+ drawArrows = new int[1];
+ if (weights[1] == 0) {
+ // Slammed to the bottom
+ addArrows[0] = UP_ARROW;
+ drawArrows[0] = UP_ARROW;
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = false;
+ } else {
+ // Not slammed
+ addArrows[0] = DOWN_MAX_ARROW;
+ drawArrows[0] = DOWN_ARROW;
+ currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ }
+ } else if (noMaxDown) {
+ addArrows = new int[1];
+ drawArrows = new int[1];
+ if (weights[0] == 0) {
+ // Slammed to the top
+ addArrows[0] = DOWN_ARROW;
+ drawArrows[0] = DOWN_ARROW;
+ currentSashInfo.sashBorderLeft = false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ } else {
+ // Not slammed
+ addArrows[0] = UP_MAX_ARROW;
+ drawArrows[0] = UP_ARROW;
+ currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ }
+ } else {
+ addArrows = new int[2];
+ drawArrows = new int[2];
+ // TODO: SashForm as changed the folllwing is a temporary kludge
+ Rectangle sashBounds = currentSashInfo.sash.getBounds();
+ Rectangle clientArea = getClientArea();
+ final int DRAG_MINIMUM = 20; // TODO: kludge see SashForm.DRAG_MINIMUM
+ if (weights[0] == 0 || (currentSashInfo.weight != NO_WEIGHT && sashBounds.y <= DRAG_MINIMUM)) {
+ // Slammed to the top.
+ addArrows[0] = DOWN_MAX_ARROW;
+ drawArrows[0] = DOWN_MAX_ARROW;
+ addArrows[1] = DOWN_ARROW;
+ drawArrows[1] = DOWN_ARROW;
+ currentSashInfo.sashBorderLeft = false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ } else if (weights[1] == 0 || (currentSashInfo.weight != NO_WEIGHT && sashBounds.y+sashBounds.height >= clientArea.height-DRAG_MINIMUM)) {
+ // Slammed to the bottom
+ addArrows[0] = UP_ARROW;
+ drawArrows[0] = UP_ARROW;
+ addArrows[1] = UP_MAX_ARROW;
+ drawArrows[1] = UP_MAX_ARROW;
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = false;
+ } else {
+ // Not slammed
+ addArrows[0] = UP_MAX_ARROW;
+ drawArrows[0] = UP_ARROW;
+ addArrows[1] = DOWN_MAX_ARROW;
+ drawArrows[1] = DOWN_ARROW;
+ currentSashInfo.weight = NO_WEIGHT; // Since we are in the middle, there is no weight. We've could of been dragged here.
+ currentSashInfo.sashBorderLeft = sashBorders != null ? sashBorders[0] : false;
+ currentSashInfo.sashBorderRight = sashBorders != null ? sashBorders[1] : false;
+ }
+ }
+ getNewSashArray(currentSashInfo, addArrows, drawArrows);
+
+ currentSashInfo.sash.redraw(); // Need to schedule a redraw because it has already drawn the old ones during the set bounds in super layout.
+ }
+
+ protected void upClicked(SashInfo sashinfo) {
+ // This means restore just the sash below weight and reduce the above weight by the right amount.
+ int[] weights = getWeights();
+
+ weights[0] = 1000-sashinfo.weight; // Assume weights are always in units of 1000.
+ weights[1] = sashinfo.weight;
+ sashinfo.weight = NO_WEIGHT;
+
+ setWeights(weights);
+ fireDividerMoved();
+ }
+
+ protected void upMaxClicked(SashInfo sashinfo) {
+ int[] weights = getWeights();
+
+ // Up max, so save the current weight of 1 into the sash info, and move to the top.
+ if (currentSashInfo.weight == NO_WEIGHT)
+ currentSashInfo.weight = weights[1]; // Not currently maxed, save position.
+
+ weights[1] = 1000;
+ weights[0] = 0;
+
+ // If the upper panel has focus, flip focus to the lower panel because the upper panel is now hidden.
+ Control[] children = getChildren();
+ boolean upperFocus = isFocusAncestorA(children[0]);
+ setWeights(weights);
+ if (upperFocus)
+ children[1].setFocus();
+ fireDividerMoved();
+ }
+
+ protected void downClicked(SashInfo sashinfo) {
+ // This means restore just the sash below weight and increase the above weight by that amount.
+ int[] weights = getWeights();
+
+ weights[0] = 1000-sashinfo.weight; // Assume weights are always in units of 1000.
+ weights[1] = sashinfo.weight;
+ sashinfo.weight = NO_WEIGHT;
+
+ setWeights(weights);
+ fireDividerMoved();
+ }
+
+ protected void downMaxClicked(SashInfo sashinfo) {
+ int[] weights = getWeights();
+
+ // Down max, so save the current weight of 1 into the sash info, and move to the bottom.
+ if (currentSashInfo.weight == NO_WEIGHT)
+ currentSashInfo.weight = weights[1]; // Not currently maxed, save current weight.
+ weights[0] = 1000;
+ weights[1] = 0;
+
+ // If the lower panel has focus, flip focus to the upper panel because the lower panel is now hidden.
+ Control[] children = getChildren();
+ boolean lowerFocus = isFocusAncestorA(children[1]);
+ setWeights(weights);
+ if (lowerFocus)
+ children[0].setFocus();
+ fireDividerMoved();
+ }
+
+ /*
+ * This determines if the control or one of its children
+ * has the focus. It was hidden by SWT, but it is really useful.
+ */
+ protected boolean isFocusAncestorA (Control control) {
+ Display display = getDisplay ();
+ Control focusControl = display.getFocusControl ();
+ while (focusControl != null && focusControl != control) {
+ focusControl = focusControl. getParent();
+ }
+ return control == focusControl;
+ }
+
+ protected void getNewSashArray(SashInfo sashInfo, int[] addArrowTypes, int[] drawArrowTypes) {
+
+ int[][] thisSash = sashInfo.sashLocs;
+ if (thisSash == null)
+ thisSash = sashInfo.sashLocs = new int[addArrowTypes.length][];
+
+ int aSize = ARROW_SIZE; // Width of arrow
+ int tSize = aSize+2*ARROW_MARGIN; // Total Width (arrow + margin)
+ int neededSize = tSize*addArrowTypes.length;
+
+ boolean vertical = getOrientation() == SWT.VERTICAL;
+ Point s = sashInfo.sash.getSize();
+ int start = 0;
+ int x = 0;
+ int y = 0;
+ int width = 0;
+ int height = 0;
+ if (vertical) {
+ start = (s.x - neededSize) / 2;
+ x = start;
+ y = (s.y - ARROW_HEIGHT) / 2; // Center vertically, no margin required.
+ width = tSize;
+ height = aSize;
+ } else {
+ start = (s.y - neededSize) / 2;
+ y = start;
+ x = (s.x - ARROW_HEIGHT) / 2; // Center horizontally, no margin required.
+ width = aSize;
+ height = tSize;
+ }
+ for (int j=0; j<addArrowTypes.length; j++) {
+ if (thisSash[j] == null)
+ thisSash[j] = new int[] {addArrowTypes[j], drawArrowTypes[j], x, y, width, height};
+ else {
+ // Reuse the array
+ thisSash[j][ARROW_TYPE_INDEX] = addArrowTypes[j];
+ thisSash[j][ARROW_DRAWN_INDEX] = drawArrowTypes[j];
+ thisSash[j][X_INDEX] = x;
+ thisSash[j][Y_INDEX] = y;
+ thisSash[j][WIDTH_INDEX] = width;
+ thisSash[j][HEIGHT_INDEX] = height;
+ }
+ if (vertical)
+ x+=tSize;
+ else
+ y+=tSize;
+ }
+ }
+
+ protected void drawSashBorder(GC gc, Sash sash, boolean leftBorder) {
+ gc.setForeground(borderColor);
+ if (getOrientation() == SWT.VERTICAL) {
+ Point s = sash.getSize();
+ if (leftBorder)
+ gc.drawLine(0, 0, s.x-1, 0);
+ else
+ gc.drawLine(0, s.y-1, s.x-1, s.y-1);
+ } else {
+ Point s = sash.getSize();
+ if (leftBorder)
+ gc.drawLine(0, 0, 0, s.y-1);
+ else
+ gc.drawLine(s.x-1, 0, s.x-1, s.y-1);
+ }
+ }
+
+ protected void drawArrow(GC gc, int[] sashLoc, boolean selected) {
+ int indent = 0;
+ if (selected) {
+ if (!inMouseClick) {
+ // Draw the selection box.
+ Color highlightShadow = getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
+ Color normalShadow = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
+ gc.setForeground(highlightShadow);
+ gc.drawLine(sashLoc[X_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX], sashLoc[X_INDEX], sashLoc[Y_INDEX]);
+ gc.drawLine(sashLoc[X_INDEX], sashLoc[Y_INDEX], sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]);
+
+ gc.setForeground(normalShadow);
+ gc.drawLine(sashLoc[X_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX], sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX]);
+ gc.drawLine(sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX], sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]);
+ } else {
+ // Draw pushed selection box.
+ indent = 1;
+ Color highlightShadow = getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
+ Color normalShadow = getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
+ gc.setForeground(normalShadow);
+ gc.drawLine(sashLoc[X_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX], sashLoc[X_INDEX], sashLoc[Y_INDEX]);
+ gc.drawLine(sashLoc[X_INDEX], sashLoc[Y_INDEX], sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]);
+
+ gc.setForeground(highlightShadow);
+ gc.drawLine(sashLoc[X_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX], sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX]);
+ gc.drawLine(sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]+sashLoc[HEIGHT_INDEX], sashLoc[X_INDEX]+sashLoc[WIDTH_INDEX], sashLoc[Y_INDEX]);
+ }
+ }
+ if (getOrientation() == SWT.VERTICAL) {
+ switch (sashLoc[ARROW_DRAWN_INDEX]) {
+ case UP_ARROW:
+ drawUpArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ case DOWN_ARROW:
+ drawDownArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ case UP_MAX_ARROW:
+ drawUpMaxArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ case DOWN_MAX_ARROW:
+ drawDownMaxArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ }
+ } else {
+ switch (sashLoc[ARROW_DRAWN_INDEX]) {
+ case UP_ARROW:
+ drawLeftArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ case DOWN_ARROW:
+ drawRightArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ case UP_MAX_ARROW:
+ drawLeftMaxArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ case DOWN_MAX_ARROW:
+ drawRightMaxArrow(gc, sashLoc[X_INDEX]+indent, sashLoc[Y_INDEX]+indent);
+ break;
+ }
+ }
+ }
+
+ // These are for the up/down arrow. Just swap them for left/right arrow.
+ protected static final int
+ ARROW_SIZE = 8,
+ ARROW_HEIGHT = 8,
+ ARROW_MARGIN = 3; // Margin on each side of arrow
+
+ protected Color arrowColor, borderColor;
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawUpArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ x+=ARROW_MARGIN;
+ gc.drawLine(x+4, y+2, x+7, y+5);
+ gc.drawLine(x+3, y+2, x+3, y+2);
+
+ gc.drawLine(x+2, y+3, x+4, y+3);
+ gc.drawLine(x+1, y+4, x+5, y+4);
+ gc.drawLine(x, y+5, x+6, y+5);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawUpMaxArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ x+=ARROW_MARGIN;
+ gc.drawLine(x, y, x+7, y);
+ gc.drawLine(x, y+1, x+7, y+1);
+
+ gc.drawLine(x+4, y+2, x+7, y+5);
+ gc.drawLine(x+3, y+2, x+3, y+2);
+
+ gc.drawLine(x+2, y+3, x+4, y+3);
+ gc.drawLine(x+1, y+4, x+5, y+4);
+ gc.drawLine(x, y+5, x+6, y+5);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawDownArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ x+=ARROW_MARGIN;
+ gc.drawLine(x, y+2, x+3, y+5);
+ gc.drawLine(x+4, y+5, x+4, y+5);
+
+ gc.drawLine(x+3, y+4, x+5, y+4);
+ gc.drawLine(x+1, y+3, x+6, y+3);
+ gc.drawLine(x+1, y+2, x+7, y+2);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawDownMaxArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ x+=ARROW_MARGIN;
+ gc.drawLine(x, y+6, x+7, y+6);
+ gc.drawLine(x, y+7, x+7, y+7);
+
+ gc.drawLine(x, y+2, x+3, y+5);
+ gc.drawLine(x+4, y+5, x+4, y+5);
+
+ gc.drawLine(x+3, y+4, x+5, y+4);
+ gc.drawLine(x+1, y+3, x+6, y+3);
+ gc.drawLine(x+1, y+2, x+7, y+2);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawLeftArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ y+=ARROW_MARGIN;
+ gc.drawLine(x+2, y+4, x+5, y+7);
+ gc.drawLine(x+2, y+3, x+2, y+3);
+
+ gc.drawLine(x+3, y+2, x+3, y+4);
+ gc.drawLine(x+4, y+1, x+4, y+5);
+ gc.drawLine(x+5, y, x+5, y+6);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawLeftMaxArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ y+=ARROW_MARGIN;
+ gc.drawLine(x, y, x, y+7);
+ gc.drawLine(x+1, y, x+1, y+7);
+
+ gc.drawLine(x+2, y+4, x+5, y+7);
+ gc.drawLine(x+2, y+3, x+2, y+3);
+
+ gc.drawLine(x+3, y+2, x+3, y+4);
+ gc.drawLine(x+4, y+1, x+4, y+5);
+ gc.drawLine(x+5, y, x+5, y+6);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawRightArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ y+=ARROW_MARGIN;
+ gc.drawLine(x+2, y, x+5, y+3);
+ gc.drawLine(x+5, y+4, x+5, y+4);
+
+ gc.drawLine(x+4, y+3, x+4, y+5);
+ gc.drawLine(x+3, y+1, x+3, y+6);
+ gc.drawLine(x+2, y+1, x+2, y+7);
+ }
+
+ // Draw at the given x/y (upper left corner of arrow area).
+ protected void drawRightMaxArrow(GC gc, int x, int y) {
+ gc.setForeground(arrowColor);
+
+ y+=ARROW_MARGIN;
+ gc.drawLine(x+6, y, x+6, y+7);
+ gc.drawLine(x+7, y, x+7, y+7);
+
+ gc.drawLine(x+2, y, x+5, y+3);
+ gc.drawLine(x+5, y+4, x+5, y+4);
+
+ gc.drawLine(x+4, y+3, x+4, y+5);
+ gc.drawLine(x+3, y+1, x+3, y+6);
+ gc.drawLine(x+2, y+1, x+2, y+7);
+ }
+
+
+ public int getSavedWeight() {
+ if (currentSashInfo!=null)
+ return currentSashInfo.weight;
+ else
+ return -1;
+ }
+
+
+ protected Sash getSash() {
+ Control[] kids = getChildren();
+ for (int i = 0; i < kids.length; i++) {
+ if (kids[i] instanceof Sash)
+ return (Sash)kids[i];
+ }
+ return null;
+ }
+
+ public void setCurrentSavedWeight(int weight) {
+ if (weight>=0 && currentSashInfo!=null) {
+ recomputeSashInfo();
+ currentSashInfo.weight=weight;
+ }
+ }
+
+ /**
+ * Adds a custom sashform listener. This listener will be removed when
+ * this control is disposed.
+ *
+ * @param listener
+ *
+ * @since 1.2.0
+ */
+ public void addCustomSashFormListener(ICustomSashFormListener listener){
+ if(customSashFormListeners==null)
+ customSashFormListeners = new ArrayList();
+ customSashFormListeners.add(listener);
+ }
+
+ /**
+ * Removes the custom sashform listener.
+ *
+ * @param listener
+ *
+ * @since 1.2.0
+ */
+ public void removeCustomSashFormListener(ICustomSashFormListener listener){
+ if(customSashFormListeners!=null){
+ customSashFormListeners.remove(listener);
+ }
+ }
+
+ protected void fireDividerMoved(){
+ if(customSashFormListeners!=null && customSashFormListeners.size()>0){
+ int[] weights = getWeights();
+ if(weights!=null && weights.length==2){
+ int firstControlWeight = weights[0];
+ int secondControlWeight = weights[1];
+ for (Iterator listenerItr = customSashFormListeners.iterator(); listenerItr.hasNext();) {
+ ICustomSashFormListener listener = (ICustomSashFormListener) listenerItr.next();
+ listener.dividerMoved(firstControlWeight, secondControlWeight);
+ }
+ }
+ }
+ }
+ public void addWeightsChangeListener(PropertyChangeListener listener) {
+ listeners.addPropertyChangeListener(listener);
+ }
+
+ private void fireWeightsPropertyChange() {
+ listeners.firePropertyChange(WEIGHTS, 1, 0);
+ }
+
+ public void removeWeightsChangeListener(PropertyChangeListener listener) {
+ listeners.removePropertyChangeListener(listener);
+ }
+
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/EditorSettings.java 2008-04-09 16:52:23 UTC (rev 7473)
@@ -0,0 +1,91 @@
+package org.jboss.tools.vpe.editor.xpl;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.vpe.VpePlugin;
+
+
+/**
+ * EditorSettings holds a set of settings and drive their life cycle.
+ * @since 1.1.0
+ */
+public class EditorSettings {
+
+ public final static String SEPERATOR = ";"; //$NON-NLS-1$
+
+
+ protected IResource file;
+ protected IEditorPart editor;
+ protected ArrayList settings = new ArrayList();
+
+
+ /**
+ * The ability to apply/monitor/persist some editor setting
+ * It is up to the setting to monitor and persist it setting details.
+ * the apply method will be called when the editor comes up.
+ * @since 1.1.0
+ */
+ public interface ISetting {
+ public void apply();
+ public void dispose();
+ public void setQualifier(String q);
+ public void setEditor(IEditorPart e);
+ public void setResource(IResource r);
+ }
+
+ protected EditorSettings(IResource f, IEditorPart e) {
+ file = f;
+ editor = e;
+ }
+
+
+ public void apply() {
+ for (int i = 0; i < settings.size(); i++) {
+ ((ISetting)settings.get(i)).apply();
+ }
+ }
+
+ public void addSetting(ISetting s) {
+ s.setQualifier(VpePlugin.PLUGIN_ID);
+ s.setEditor(editor);
+ s.setResource(file);
+ settings.add(s);
+ }
+
+ public void addSettingAndApply(ISetting s) {
+ addSetting(s);
+ s.apply();
+ }
+
+ public void dispose() {
+ for (int i = 0; i < settings.size(); i++) {
+ ((ISetting)settings.get(i)).dispose();
+ }
+ editor=null;
+ }
+
+ public void setInput(FileEditorInput input) {
+ file = input.getFile();
+ for (int i = 0; i < settings.size(); i++) {
+ ((ISetting)settings.get(i)).setResource(file);
+ }
+ }
+
+
+ public static EditorSettings getEditorSetting (IEditorPart editor) {
+ EditorSettings settings = null;
+ if (editor!=null && editor.getEditorInput() instanceof FileEditorInput) {
+ IResource r = ((FileEditorInput)editor.getEditorInput()).getFile();
+ settings = new EditorSettings(r, editor);
+ }
+ return settings;
+ }
+
+ public String toString() {
+ return file.getName();
+ }
+
+}
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/xpl/SashSetting.java 2008-04-09 16:52:23 UTC (rev 7473)
@@ -0,0 +1,140 @@
+package org.jboss.tools.vpe.editor.xpl;
+
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.vpe.VpePlugin;
+
+
+
+/**
+ * This setting will monitor the sash' weights
+ * This setting is not global and will be persisted on a resource.
+ *
+ * @since 1.1.0
+ */
+public class SashSetting implements EditorSettings.ISetting {
+
+ public final static String id = "Settings.Sash"; //$NON-NLS-1$
+
+
+ private IEditorPart editor;
+ private IResource resource;
+ private QualifiedName name;
+ private CustomSashForm sash;
+
+ private ControlListener listener=null;
+ private Control listenedControl=null;
+
+ private int weights[];
+
+ /**
+ * Save both the current weights, and the (potential) save
+ * weights. The first value is the size of the
+ * current weights
+ *
+ * @since 1.1.0
+ */
+ protected void updateWeights() {
+ weights = sash.getWeights();
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < weights.length; i++) {
+ if (i>0)
+ sb.append(EditorSettings.SEPERATOR);
+ sb.append(weights[i]);
+ }
+ sb.append(EditorSettings.SEPERATOR);
+ sb.append(-1); // seperate between current weights, and saved weights
+ sb.append(EditorSettings.SEPERATOR);
+ sb.append(sash.getSavedWeight());
+ try {
+ resource.setPersistentProperty(name,sb.toString());
+ } catch (CoreException e) {
+ VpePlugin.getPluginLog().logError(e);
+ }
+ }
+
+ public SashSetting(CustomSashForm s) {
+ sash = s;
+ }
+
+ protected void addListener() {
+ if (listener==null && !sash.isDisposed()) {
+ listener = new ControlListener() {
+ public void controlResized(ControlEvent e) {
+ updateWeights();
+ }
+ public void controlMoved(ControlEvent e) {
+ updateWeights();
+ }
+ };
+ listenedControl = sash.getChildren()[0];
+ listenedControl.addControlListener(listener);
+ }
+ }
+
+ protected void removeListener() {
+ if (listenedControl!=null && !listenedControl.isDisposed()) {
+ listenedControl.removeControlListener(listener);
+ listener=null;
+ listenedControl=null;
+ }
+ }
+
+ public void apply() {
+ try {
+ String val = resource.getPersistentProperty(name);
+ if (val!=null) {
+ StringTokenizer st = new StringTokenizer(val,EditorSettings.SEPERATOR);
+ weights = new int[st.countTokens()];
+ int index = 0;
+ while(st.hasMoreTokens()) {
+ String s = st.nextToken();
+ weights[index++]=Integer.parseInt(s);
+ }
+ for (index = 0; index < weights.length; index++) {
+ if (weights[index]<0)
+ break;
+ }
+ int saved = -1;
+ if (index<weights.length) {
+ int w[] = new int[index];
+ for (int i = 0; i < w.length; i++) {
+ w[i] = weights[i];
+ }
+ saved = weights[index+1];
+ weights=w;
+ }
+ sash.setWeights(weights);
+ if (saved>=0)
+ sash.setCurrentSavedWeight(saved);
+ }
+ } catch (CoreException e1) {
+ VpePlugin.getPluginLog().logError(e1);
+ }
+ addListener();
+ }
+
+
+ public void dispose() {
+ removeListener();
+ }
+
+ public void setQualifier(String q) {
+ name = new QualifiedName(q,id);
+ }
+
+ public void setEditor(IEditorPart e) {
+ editor = e;
+ }
+
+ public void setResource(IResource r) {
+ resource = r;
+ }
+}
17 years, 9 months
JBoss Tools SVN: r7472 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-04-09 12:52:12 -0400 (Wed, 09 Apr 2008)
New Revision: 7472
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
Log:
JBIDE-2006
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-04-09 16:04:10 UTC (rev 7471)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-04-09 16:52:12 UTC (rev 7472)
@@ -432,7 +432,7 @@
} catch (PartInitException e) {
JspEditorPlugin.getPluginLog().logError(e);
}
- try {
+ /*try {
visualIndex = addPage(visualEditor, getEditorInput());
setPageText(visualIndex, JSPEditorMessages
.getString(VISUAL_TAB_LABEL));
@@ -448,7 +448,7 @@
setPartName(visualEditor.getTitle());
} catch (PartInitException e) {
JspEditorPlugin.getPluginLog().logError(e);
- }
+ }*/
// Add tab contain default web-browser
try {
17 years, 9 months