Merging in a couple more contrib modules.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/javax.mail/build.xml Fri Apr 15 18:18:16 2011 -0400
1.3 @@ -0,0 +1,22 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!--
1.6 + The contents of this file are subject to the terms of the Common Development
1.7 + and Distribution License (the License). You may not use this file except in
1.8 + compliance with the License.
1.9 +
1.10 + You can obtain a copy of the License at http://www.netbeans.org/cddl.html
1.11 + or http://www.netbeans.org/cddl.txt.
1.12 +
1.13 + When distributing Covered Code, include this CDDL Header Notice in each file
1.14 + and include the License file at http://www.netbeans.org/cddl.txt.
1.15 + If applicable, add the following below the CDDL Header, with the fields
1.16 + enclosed by brackets [] replaced by your own identifying information:
1.17 + "Portions Copyrighted [year] [name of copyright owner]"
1.18 +
1.19 + The Original Software is NetBeans. The Initial Developer of the Original
1.20 + Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
1.21 + Microsystems, Inc. All Rights Reserved.
1.22 +-->
1.23 +<project name="contrib/javax.mail" default="netbeans" basedir=".">
1.24 + <import file="../../nbbuild/templates/projectized.xml"/>
1.25 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/javax.mail/manifest.mf Fri Apr 15 18:18:16 2011 -0400
2.3 @@ -0,0 +1,4 @@
2.4 +Manifest-Version: 1.0
2.5 +OpenIDE-Module: javax.mail
2.6 +OpenIDE-Module-Localizing-Bundle: javax/mail/Bundle.properties
2.7 +OpenIDE-Module-Specification-Version: 1.0
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/javax.mail/nbproject/project.properties Fri Apr 15 18:18:16 2011 -0400
3.3 @@ -0,0 +1,19 @@
3.4 +#
3.5 +# The contents of this file are subject to the terms of the Common Development
3.6 +# and Distribution License (the License). You may not use this file except in
3.7 +# compliance with the License.
3.8 +#
3.9 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
3.10 +# or http://www.netbeans.org/cddl.txt.
3.11 +#
3.12 +# When distributing Covered Code, include this CDDL Header Notice in each file
3.13 +# and include the License file at http://www.netbeans.org/cddl.txt.
3.14 +# If applicable, add the following below the CDDL Header, with the fields
3.15 +# enclosed by brackets [] replaced by your own identifying information:
3.16 +# "Portions Copyrighted [year] [name of copyright owner]"
3.17 +#
3.18 +# The Original Software is NetBeans. The Initial Developer of the Original
3.19 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
3.20 +# Microsystems, Inc. All Rights Reserved.
3.21 +
3.22 +is.autoload=true
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/javax.mail/nbproject/project.xml Fri Apr 15 18:18:16 2011 -0400
4.3 @@ -0,0 +1,46 @@
4.4 +<?xml version="1.0" encoding="UTF-8"?>
4.5 +<!--
4.6 + The contents of this file are subject to the terms of the Common Development
4.7 + and Distribution License (the License). You may not use this file except in
4.8 + compliance with the License.
4.9 +
4.10 + You can obtain a copy of the License at http://www.netbeans.org/cddl.html
4.11 + or http://www.netbeans.org/cddl.txt.
4.12 +
4.13 + When distributing Covered Code, include this CDDL Header Notice in each file
4.14 + and include the License file at http://www.netbeans.org/cddl.txt.
4.15 + If applicable, add the following below the CDDL Header, with the fields
4.16 + enclosed by brackets [] replaced by your own identifying information:
4.17 + "Portions Copyrighted [year] [name of copyright owner]"
4.18 +
4.19 + The Original Software is NetBeans. The Initial Developer of the Original
4.20 + Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
4.21 + Microsystems, Inc. All Rights Reserved.
4.22 +-->
4.23 +<project xmlns="http://www.netbeans.org/ns/project/1">
4.24 + <type>org.netbeans.modules.apisupport.project</type>
4.25 + <configuration>
4.26 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
4.27 + <code-name-base>javax.mail</code-name-base>
4.28 + <module-dependencies/>
4.29 + <public-packages>
4.30 + <package>com.sun.mail.handlers</package>
4.31 + <package>com.sun.mail.iap</package>
4.32 + <package>com.sun.mail.imap</package>
4.33 + <package>com.sun.mail.imap.protocol</package>
4.34 + <package>com.sun.mail.pop3</package>
4.35 + <package>com.sun.mail.smtp</package>
4.36 + <package>com.sun.mail.util</package>
4.37 + <package>javax.mail</package>
4.38 + <package>javax.mail.event</package>
4.39 + <package>javax.mail.internet</package>
4.40 + <package>javax.mail.search</package>
4.41 + <package>javax.mail.util</package>
4.42 + </public-packages>
4.43 + <class-path-extension>
4.44 + <runtime-relative-path>ext/mail.jar</runtime-relative-path>
4.45 + <binary-origin>release/modules/ext/mail.jar</binary-origin>
4.46 + </class-path-extension>
4.47 + </data>
4.48 + </configuration>
4.49 +</project>
5.1 Binary file javax.mail/release/modules/ext/mail.jar has changed
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/javax.mail/src/javax/mail/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
6.3 @@ -0,0 +1,19 @@
6.4 +#
6.5 +# The contents of this file are subject to the terms of the Common Development
6.6 +# and Distribution License (the License). You may not use this file except in
6.7 +# compliance with the License.
6.8 +#
6.9 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
6.10 +# or http://www.netbeans.org/cddl.txt.
6.11 +#
6.12 +# When distributing Covered Code, include this CDDL Header Notice in each file
6.13 +# and include the License file at http://www.netbeans.org/cddl.txt.
6.14 +# If applicable, add the following below the CDDL Header, with the fields
6.15 +# enclosed by brackets [] replaced by your own identifying information:
6.16 +# "Portions Copyrighted [year] [name of copyright owner]"
6.17 +#
6.18 +# The Original Software is NetBeans. The Initial Developer of the Original
6.19 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
6.20 +# Microsystems, Inc. All Rights Reserved.
6.21 +
6.22 +OpenIDE-Module-Name=mail
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/workflow.editor/build.xml Fri Apr 15 18:18:16 2011 -0400
7.3 @@ -0,0 +1,5 @@
7.4 +<?xml version="1.0" encoding="UTF-8"?>
7.5 +<project basedir="." default="netbeans" name="contrib/workflow.editor">
7.6 + <description>Builds, tests, and runs the project org.netbeans.modules.workflow.editor</description>
7.7 + <import file="../../nbbuild/templates/projectized.xml"/>
7.8 +</project>
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/workflow.editor/manifest.mf Fri Apr 15 18:18:16 2011 -0400
8.3 @@ -0,0 +1,9 @@
8.4 +Manifest-Version: 1.0
8.5 +OpenIDE-Module: org.netbeans.modules.workflow.editor
8.6 +OpenIDE-Module-Layer: org/netbeans/modules/workflow/editor/layer.xml
8.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/workflow/editor/Bundle.properties
8.8 +OpenIDE-Module-Specification-Version: 1.0
8.9 +
8.10 +Name: org/netbeans/modules/workflow/editor/dataloader/WorkflowDataLoader.class
8.11 +OpenIDE-Module-Class: Loader
8.12 +
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/workflow.editor/nbproject/project.properties Fri Apr 15 18:18:16 2011 -0400
9.3 @@ -0,0 +1,2 @@
9.4 +javac.compilerargs=-Xlint -Xlint:-serial
9.5 +javac.source=1.5
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/workflow.editor/nbproject/project.xml Fri Apr 15 18:18:16 2011 -0400
10.3 @@ -0,0 +1,162 @@
10.4 +<?xml version="1.0" encoding="UTF-8"?>
10.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
10.6 + <type>org.netbeans.modules.apisupport.project</type>
10.7 + <configuration>
10.8 + <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
10.9 + <code-name-base>org.netbeans.modules.workflow.editor</code-name-base>
10.10 + <module-dependencies>
10.11 + <dependency>
10.12 + <code-name-base>org.jdesktop.layout</code-name-base>
10.13 + <build-prerequisite/>
10.14 + <compile-dependency/>
10.15 + <run-dependency>
10.16 + <release-version>1</release-version>
10.17 + <specification-version>1.4</specification-version>
10.18 + </run-dependency>
10.19 + </dependency>
10.20 + <dependency>
10.21 + <code-name-base>org.netbeans.api.visual</code-name-base>
10.22 + <build-prerequisite/>
10.23 + <compile-dependency/>
10.24 + <run-dependency>
10.25 + <specification-version>2.9</specification-version>
10.26 + </run-dependency>
10.27 + </dependency>
10.28 + <dependency>
10.29 + <code-name-base>org.netbeans.api.xml</code-name-base>
10.30 + <build-prerequisite/>
10.31 + <compile-dependency/>
10.32 + <run-dependency>
10.33 + <release-version>1</release-version>
10.34 + <specification-version>1.14</specification-version>
10.35 + </run-dependency>
10.36 + </dependency>
10.37 + <dependency>
10.38 + <code-name-base>org.netbeans.core.multiview</code-name-base>
10.39 + <build-prerequisite/>
10.40 + <compile-dependency/>
10.41 + <run-dependency>
10.42 + <release-version>1</release-version>
10.43 + <specification-version>1.10</specification-version>
10.44 + </run-dependency>
10.45 + </dependency>
10.46 + <dependency>
10.47 + <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
10.48 + <build-prerequisite/>
10.49 + <compile-dependency/>
10.50 + <run-dependency>
10.51 + <release-version>1</release-version>
10.52 + <specification-version>1.1</specification-version>
10.53 + </run-dependency>
10.54 + </dependency>
10.55 + <dependency>
10.56 + <code-name-base>org.netbeans.modules.xml.xam</code-name-base>
10.57 + <build-prerequisite/>
10.58 + <compile-dependency/>
10.59 + <run-dependency>
10.60 + <release-version>1</release-version>
10.61 + <specification-version>1.2</specification-version>
10.62 + </run-dependency>
10.63 + </dependency>
10.64 + <dependency>
10.65 + <code-name-base>org.netbeans.modules.xml.xam.ui</code-name-base>
10.66 + <build-prerequisite/>
10.67 + <compile-dependency/>
10.68 + <run-dependency>
10.69 + <specification-version>1.0</specification-version>
10.70 + </run-dependency>
10.71 + </dependency>
10.72 + <dependency>
10.73 + <code-name-base>org.netbeans.spi.palette</code-name-base>
10.74 + <build-prerequisite/>
10.75 + <compile-dependency/>
10.76 + <run-dependency>
10.77 + <release-version>1</release-version>
10.78 + <specification-version>1.11</specification-version>
10.79 + </run-dependency>
10.80 + </dependency>
10.81 + <dependency>
10.82 + <code-name-base>org.openide.actions</code-name-base>
10.83 + <build-prerequisite/>
10.84 + <compile-dependency/>
10.85 + <run-dependency>
10.86 + <specification-version>6.6</specification-version>
10.87 + </run-dependency>
10.88 + </dependency>
10.89 + <dependency>
10.90 + <code-name-base>org.openide.awt</code-name-base>
10.91 + <build-prerequisite/>
10.92 + <compile-dependency/>
10.93 + <run-dependency>
10.94 + <specification-version>6.11</specification-version>
10.95 + </run-dependency>
10.96 + </dependency>
10.97 + <dependency>
10.98 + <code-name-base>org.openide.dialogs</code-name-base>
10.99 + <build-prerequisite/>
10.100 + <compile-dependency/>
10.101 + <run-dependency>
10.102 + <specification-version>7.5</specification-version>
10.103 + </run-dependency>
10.104 + </dependency>
10.105 + <dependency>
10.106 + <code-name-base>org.openide.explorer</code-name-base>
10.107 + <build-prerequisite/>
10.108 + <compile-dependency/>
10.109 + <run-dependency>
10.110 + <specification-version>6.11</specification-version>
10.111 + </run-dependency>
10.112 + </dependency>
10.113 + <dependency>
10.114 + <code-name-base>org.openide.filesystems</code-name-base>
10.115 + <build-prerequisite/>
10.116 + <compile-dependency/>
10.117 + <run-dependency>
10.118 + <specification-version>7.3</specification-version>
10.119 + </run-dependency>
10.120 + </dependency>
10.121 + <dependency>
10.122 + <code-name-base>org.openide.loaders</code-name-base>
10.123 + <build-prerequisite/>
10.124 + <compile-dependency/>
10.125 + <run-dependency>
10.126 + <specification-version>6.7</specification-version>
10.127 + </run-dependency>
10.128 + </dependency>
10.129 + <dependency>
10.130 + <code-name-base>org.openide.nodes</code-name-base>
10.131 + <build-prerequisite/>
10.132 + <compile-dependency/>
10.133 + <run-dependency>
10.134 + <specification-version>7.2</specification-version>
10.135 + </run-dependency>
10.136 + </dependency>
10.137 + <dependency>
10.138 + <code-name-base>org.openide.text</code-name-base>
10.139 + <build-prerequisite/>
10.140 + <compile-dependency/>
10.141 + <run-dependency>
10.142 + <specification-version>6.16</specification-version>
10.143 + </run-dependency>
10.144 + </dependency>
10.145 + <dependency>
10.146 + <code-name-base>org.openide.util</code-name-base>
10.147 + <build-prerequisite/>
10.148 + <compile-dependency/>
10.149 + <run-dependency>
10.150 + <specification-version>7.9</specification-version>
10.151 + </run-dependency>
10.152 + </dependency>
10.153 + <dependency>
10.154 + <code-name-base>org.openide.windows</code-name-base>
10.155 + <build-prerequisite/>
10.156 + <compile-dependency/>
10.157 + <run-dependency>
10.158 + <specification-version>6.17</specification-version>
10.159 + </run-dependency>
10.160 + </dependency>
10.161 + </module-dependencies>
10.162 + <public-packages/>
10.163 + </data>
10.164 + </configuration>
10.165 +</project>
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
11.3 @@ -0,0 +1,3 @@
11.4 +OpenIDE-Module-Name=Workflow Editor
11.5 +Services/MIMEResolver/WorkflowResolver.xml=Workflow Files
11.6 +Templates/Other/WorkflowTemplate.workflow=Workflow file
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/WorkflowResolver.xml Fri Apr 15 18:18:16 2011 -0400
12.3 @@ -0,0 +1,8 @@
12.4 +<?xml version="1.0" encoding="UTF-8"?>
12.5 +<!DOCTYPE MIME-resolver PUBLIC "-//NetBeans//DTD MIME Resolver 1.0//EN" "http://www.netbeans.org/dtds/mime-resolver-1_0.dtd">
12.6 +<MIME-resolver>
12.7 + <file>
12.8 + <ext name="workflow"/>
12.9 + <resolver mime="text/x-workflow"/>
12.10 + </file>
12.11 +</MIME-resolver>
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/WorkflowTemplate.workflow Fri Apr 15 18:18:16 2011 -0400
13.3 @@ -0,0 +1,1 @@
13.4 +sample content
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/dataloader/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
14.3 @@ -0,0 +1,1 @@
14.4 +LBL_Workflow_loader_name=Workflow Files
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/dataloader/WorkflowDataLoader.java Fri Apr 15 18:18:16 2011 -0400
15.3 @@ -0,0 +1,38 @@
15.4 +package org.netbeans.modules.workflow.editor.dataloader;
15.5 +
15.6 +import java.io.IOException;
15.7 +import org.openide.filesystems.FileObject;
15.8 +import org.openide.loaders.DataObjectExistsException;
15.9 +import org.openide.loaders.MultiDataObject;
15.10 +import org.openide.loaders.UniFileLoader;
15.11 +import org.openide.util.NbBundle;
15.12 +
15.13 +public class WorkflowDataLoader extends UniFileLoader {
15.14 +
15.15 + public static final String REQUIRED_MIME = "text/x-workflow";
15.16 + private static final long serialVersionUID = 1L;
15.17 +
15.18 + public WorkflowDataLoader() {
15.19 + super("org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject");
15.20 + }
15.21 +
15.22 + protected @Override
15.23 + String defaultDisplayName() {
15.24 + return NbBundle.getMessage(WorkflowDataLoader.class, "LBL_Workflow_loader_name");
15.25 + }
15.26 +
15.27 + protected @Override
15.28 + void initialize() {
15.29 + super.initialize();
15.30 + getExtensions().addMimeType(REQUIRED_MIME);
15.31 + }
15.32 +
15.33 + protected MultiDataObject createMultiObject(FileObject primaryFile) throws DataObjectExistsException, IOException {
15.34 + return new WorkflowDataObject(primaryFile, this);
15.35 + }
15.36 +
15.37 + protected @Override
15.38 + String actionsContext() {
15.39 + return "Loaders/" + REQUIRED_MIME + "/Actions";
15.40 + }
15.41 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/dataloader/WorkflowDataLoaderBeanInfo.java Fri Apr 15 18:18:16 2011 -0400
16.3 @@ -0,0 +1,31 @@
16.4 +package org.netbeans.modules.workflow.editor.dataloader;
16.5 +
16.6 +import java.awt.Image;
16.7 +import java.beans.BeanInfo;
16.8 +import java.beans.IntrospectionException;
16.9 +import java.beans.Introspector;
16.10 +import java.beans.SimpleBeanInfo;
16.11 +import org.openide.loaders.UniFileLoader;
16.12 +import org.openide.util.Utilities;
16.13 +
16.14 +public class WorkflowDataLoaderBeanInfo extends SimpleBeanInfo {
16.15 +
16.16 + public @Override
16.17 + BeanInfo[] getAdditionalBeanInfo() {
16.18 + try {
16.19 + return new BeanInfo[]{Introspector.getBeanInfo(UniFileLoader.class)};
16.20 + } catch ( IntrospectionException e) {
16.21 + throw new AssertionError(e);
16.22 + }
16.23 + }
16.24 +
16.25 + public @Override
16.26 + Image getIcon( int type) {
16.27 + if (type == BeanInfo.ICON_COLOR_16x16 || type == BeanInfo.ICON_MONO_16x16) {
16.28 + return Utilities.loadImage("org/netbeans/modules/workflow/editor/resources/images/workflowx16.png");
16.29 + } else {
16.30 + return null;
16.31 + }
16.32 +
16.33 + }
16.34 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/dataloader/WorkflowDataNode.java Fri Apr 15 18:18:16 2011 -0400
17.3 @@ -0,0 +1,32 @@
17.4 +package org.netbeans.modules.workflow.editor.dataloader;
17.5 +
17.6 +import org.openide.loaders.DataNode;
17.7 +import org.openide.nodes.Children;
17.8 +import org.openide.util.Lookup;
17.9 +
17.10 +public class WorkflowDataNode extends DataNode {
17.11 +
17.12 + private static final String IMAGE_ICON_BASE = "org/netbeans/modules/workflow/editor/resources/images/workflowx16.png";
17.13 +
17.14 + public WorkflowDataNode(WorkflowDataObject obj) {
17.15 + super(obj, Children.LEAF);
17.16 + setIconBaseWithExtension(IMAGE_ICON_BASE);
17.17 + }
17.18 +
17.19 + WorkflowDataNode(WorkflowDataObject obj, Lookup lookup) {
17.20 + super(obj, Children.LEAF, lookup);
17.21 + setIconBaseWithExtension(IMAGE_ICON_BASE);
17.22 + }
17.23 +
17.24 + // /** Creates a property sheet. */
17.25 +// protected @Override Sheet createSheet() {
17.26 +// Sheet s = super.createSheet();
17.27 +// Sheet.Set ss = s.get(Sheet.PROPERTIES);
17.28 +// if (ss == null) {
17.29 +// ss = Sheet.createPropertiesSet();
17.30 +// s.put(ss);
17.31 +// }
17.32 +// // TODO add some relevant properties: ss.put(...)
17.33 +// return s;
17.34 +// }
17.35 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/dataloader/WorkflowDataObject.java Fri Apr 15 18:18:16 2011 -0400
18.3 @@ -0,0 +1,60 @@
18.4 +package org.netbeans.modules.workflow.editor.dataloader;
18.5 +
18.6 +import java.io.IOException;
18.7 +import org.netbeans.modules.workflow.editor.multiview.WorkflowEditorSupport;
18.8 +import org.netbeans.modules.workflow.editor.multiview.WorkflowMultiviewSupport;
18.9 +import org.netbeans.spi.xml.cookies.CheckXMLSupport;
18.10 +import org.netbeans.spi.xml.cookies.DataObjectAdapters;
18.11 +import org.openide.filesystems.FileObject;
18.12 +import org.openide.loaders.DataObjectExistsException;
18.13 +import org.openide.loaders.MultiDataObject;
18.14 +import org.openide.nodes.CookieSet;
18.15 +import org.openide.nodes.Node;
18.16 +import org.openide.util.Lookup;
18.17 +import org.openide.text.DataEditorSupport;
18.18 +import org.xml.sax.InputSource;
18.19 +
18.20 +public class WorkflowDataObject extends MultiDataObject {
18.21 +
18.22 + public WorkflowDataObject(FileObject pf, WorkflowDataLoader loader) throws DataObjectExistsException, IOException {
18.23 + super(pf, loader);
18.24 + CookieSet cookies = getCookieSet();
18.25 + //cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
18.26 +
18.27 + editorSupport = new WorkflowEditorSupport(this);
18.28 + // editor support defines MIME type understood by EditorKits registry
18.29 + cookies.add(editorSupport);
18.30 +
18.31 +// Add check and validate cookies
18.32 + InputSource is = DataObjectAdapters.inputSource(this);
18.33 + cookies.add(new CheckXMLSupport(is));
18.34 + cookies.add(new WorkflowMultiviewSupport(this));
18.35 + /*//add validate action here
18.36 + set.add(new IEPValidateXMLCookie(this));
18.37 +
18.38 + set.add(new PlanReportCookie(this));
18.39 +
18.40 + SaveCookie saveCookie = set.getCookie(SaveCookie.class);
18.41 + */
18.42 +
18.43 + }
18.44 +
18.45 + protected @Override
18.46 + Node createNodeDelegate() {
18.47 + return new WorkflowDataNode(this, getLookup());
18.48 + }
18.49 +
18.50 + public @Override
18.51 + Lookup getLookup() {
18.52 + return getCookieSet().getLookup();
18.53 + }
18.54 +
18.55 + public WorkflowEditorSupport getWorkflowEditorSupport() {
18.56 + return editorSupport;
18.57 + }
18.58 +
18.59 + private transient WorkflowEditorSupport editorSupport;
18.60 +
18.61 + public static final String WORKFLOW_ICON_BASE_WITH_EXT = "org/netbeans/modules/workflow/editor/resources/images/workflowx16.png";
18.62 +
18.63 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/layer.xml Fri Apr 15 18:18:16 2011 -0400
19.3 @@ -0,0 +1,87 @@
19.4 +<?xml version="1.0" encoding="UTF-8"?>
19.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
19.6 +<filesystem>
19.7 + <folder name="Loaders">
19.8 + <folder name="text">
19.9 + <folder name="x-workflow">
19.10 + <folder name="Actions">
19.11 + <file name="org-openide-actions-CopyAction.shadow">
19.12 + <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-CopyAction.instance"/>
19.13 + <attr name="position" intvalue="500"/>
19.14 + </file>
19.15 + <file name="org-openide-actions-CutAction.shadow">
19.16 + <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-CutAction.instance"/>
19.17 + <attr name="position" intvalue="400"/>
19.18 + </file>
19.19 + <file name="org-openide-actions-DeleteAction.shadow">
19.20 + <attr name="originalFile" stringvalue="Actions/Edit/org-openide-actions-DeleteAction.instance"/>
19.21 + <attr name="position" intvalue="700"/>
19.22 + </file>
19.23 + <file name="org-openide-actions-FileSystemAction.shadow">
19.24 + <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-FileSystemAction.instance"/>
19.25 + <attr name="position" intvalue="200"/>
19.26 + </file>
19.27 + <file name="org-openide-actions-OpenAction.shadow">
19.28 + <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-OpenAction.instance"/>
19.29 + <attr name="position" intvalue="100"/>
19.30 + </file>
19.31 + <file name="org-openide-actions-PropertiesAction.shadow">
19.32 + <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-PropertiesAction.instance"/>
19.33 + <attr name="position" intvalue="1300"/>
19.34 + </file>
19.35 + <file name="org-openide-actions-RenameAction.shadow">
19.36 + <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-RenameAction.instance"/>
19.37 + <attr name="position" intvalue="800"/>
19.38 + </file>
19.39 + <file name="org-openide-actions-SaveAsTemplateAction.shadow">
19.40 + <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-SaveAsTemplateAction.instance"/>
19.41 + <attr name="position" intvalue="1000"/>
19.42 + </file>
19.43 + <file name="org-openide-actions-ToolsAction.shadow">
19.44 + <attr name="originalFile" stringvalue="Actions/System/org-openide-actions-ToolsAction.instance"/>
19.45 + <attr name="position" intvalue="1200"/>
19.46 + </file>
19.47 + <file name="sep-1.instance">
19.48 + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
19.49 + <attr name="position" intvalue="300"/>
19.50 + </file>
19.51 + <file name="sep-2.instance">
19.52 + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
19.53 + <attr name="position" intvalue="600"/>
19.54 + </file>
19.55 + <file name="sep-3.instance">
19.56 + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
19.57 + <attr name="position" intvalue="900"/>
19.58 + </file>
19.59 + <file name="sep-4.instance">
19.60 + <attr name="instanceClass" stringvalue="javax.swing.JSeparator"/>
19.61 + <attr name="position" intvalue="1100"/>
19.62 + </file>
19.63 + </folder>
19.64 + </folder>
19.65 + </folder>
19.66 + </folder>
19.67 + <folder name="Services">
19.68 + <folder name="MIMEResolver">
19.69 + <file name="WorkflowResolver.xml" url="WorkflowResolver.xml">
19.70 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.workflow.editor.Bundle"/>
19.71 + </file>
19.72 + </folder>
19.73 + </folder>
19.74 + <folder name="Templates">
19.75 + <folder name="Other">
19.76 + <file name="WorkflowTemplate.workflow" url="WorkflowTemplate.workflow">
19.77 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.workflow.editor.Bundle"/>
19.78 + <attr name="template" boolvalue="true"/>
19.79 + </file>
19.80 + </folder>
19.81 + </folder>
19.82 + <folder name="WorkflowPalette">
19.83 + <folder name="events">
19.84 + <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.workflow.editor.palette.Bundle"/>
19.85 + <file name="StartEvent.xml" url="nbresloc:/org/netbeans/modules/workflow/editor/palette/items/events/StartEvent.xml"/>
19.86 + <file name="IntermediateEvent.xml" url="nbresloc:/org/netbeans/modules/workflow/editor/palette/items/events/IntermediateEvent.xml"/>
19.87 + <file name="EndEvent.xml" url="nbresloc:/org/netbeans/modules/workflow/editor/palette/items/events/EndEvent.xml"/>
19.88 + </folder>
19.89 + </folder>
19.90 +</filesystem>
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
20.3 @@ -0,0 +1,7 @@
20.4 +#WorkflowSourceMultiviewDesc
20.5 +LBL_sourceView_name = Source
20.6 +
20.7 +#WorkflowDesignViewMultiViewDesc
20.8 +LBL_designView_name = Design
20.9 +
20.10 +MSG_NotWellformedWorkflow=The Workflow is not well-formed.
20.11 \ No newline at end of file
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/SourceCookieProxyLookup.java Fri Apr 15 18:18:16 2011 -0400
21.3 @@ -0,0 +1,143 @@
21.4 +/*
21.5 + * The contents of this file are subject to the terms of the Common Development
21.6 + * and Distribution License (the License). You may not use this file except in
21.7 + * compliance with the License.
21.8 + *
21.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
21.10 + * or http://www.netbeans.org/cddl.txt.
21.11 + *
21.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
21.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
21.14 + * If applicable, add the following below the CDDL Header, with the fields
21.15 + * enclosed by brackets [] replaced by your own identifying information:
21.16 + * "Portions Copyrighted [year] [name of copyright owner]"
21.17 + *
21.18 + * The Original Software is NetBeans. The Initial Developer of the Original
21.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
21.20 + * Microsystems, Inc. All Rights Reserved.
21.21 + */
21.22 +
21.23 +package org.netbeans.modules.workflow.editor.multiview;
21.24 +
21.25 +import java.beans.PropertyChangeEvent;
21.26 +import java.beans.PropertyChangeListener;
21.27 +
21.28 +import org.openide.nodes.Node;
21.29 +import org.openide.util.Lookup;
21.30 +import org.openide.util.lookup.Lookups;
21.31 +import org.openide.util.lookup.ProxyLookup;
21.32 +
21.33 +/**
21.34 + * A ProxyLookup that changes the last delegate lookup to not return instances
21.35 + * of Node.class depending on changes to the "activatedNodes" property. The
21.36 + * value of this is that the delegate lookup comes from a DataObject Node
21.37 + * delegate, which presumably provides cookies such as SaveCookie. But we
21.38 + * do not want the Node delegate to return instances of Node via its Lookup
21.39 + * (specifically the Node delegate itself).
21.40 + *
21.41 + * <p>Usage, from within a <code>TopComponent</code> constructor:</p>
21.42 + *
21.43 + * <pre>
21.44 + * CookieProxyLookup cpl = new CookieProxyLookup(new Lookup[] {
21.45 + * lookup1,
21.46 + * lookup2,
21.47 + * // The Node delegate Lookup must be the last one in the list
21.48 + * // for the CookieProxyLookup to work properly.
21.49 + * delegate.getLookup(),
21.50 + * }, delegate);
21.51 + * associateLookup(cpl);
21.52 + * addPropertyChangeListener("activatedNodes", cpl);
21.53 + * </pre>
21.54 + *
21.55 + * @author Nathan Fiedler
21.56 + */
21.57 +public class SourceCookieProxyLookup extends ProxyLookup
21.58 + implements PropertyChangeListener {
21.59 + /** Lookups excluding activated nodes and their lookups . */
21.60 + private Lookup[] lookups;
21.61 + /** The Node to which we delegate lookup for cookies. */
21.62 + private Node delegate;
21.63 + /** Signal that we are processing a property change event. */
21.64 + private boolean propertyChanging;
21.65 +
21.66 + /**
21.67 + * Creates a new instance of CookieProxyLookup.
21.68 + *
21.69 + * @param lookups the Lookup instances to which we proxy.
21.70 + * @param delegate the Node delegate from which cookies come.
21.71 + */
21.72 + public SourceCookieProxyLookup(Lookup[] lookups, Node delegate) {
21.73 + super();
21.74 + this.lookups = lookups;
21.75 + this.delegate = delegate;
21.76 + setLookups(new Lookup[] {
21.77 + new ProxyLookup(lookups),
21.78 + delegate.getLookup(),
21.79 + Lookups.singleton(delegate),
21.80 + });
21.81 + }
21.82 +
21.83 + public synchronized void propertyChange(PropertyChangeEvent event) {
21.84 + if (propertyChanging)
21.85 + {
21.86 + // Avoid an infinite loop whereby changing the lookup contents
21.87 + // causes the activated nodes to change, which calls us again.
21.88 + return;
21.89 + }
21.90 + propertyChanging = true;
21.91 + try
21.92 + {
21.93 + Node[] newNodes = (Node[]) event.getNewValue();
21.94 + if(newNodes==null || newNodes.length==0)
21.95 + {
21.96 + setLookups(new Lookup[] {
21.97 + new ProxyLookup(lookups),
21.98 + new NoNodeLookup(delegate.getLookup()),
21.99 + Lookups.singleton(delegate),
21.100 + });
21.101 + }
21.102 + else
21.103 + {
21.104 + Lookup[] newNodeLookups = new Lookup[newNodes.length];
21.105 + for (int i=0;i<newNodes.length;i++)
21.106 + {
21.107 + newNodeLookups[i]=new NoNodeLookup(newNodes[i].getLookup());
21.108 + }
21.109 + setLookups(new Lookup[] {
21.110 + new ProxyLookup(lookups),
21.111 + new ProxyLookup(newNodeLookups),
21.112 + Lookups.fixed(newNodes),
21.113 + });
21.114 + }
21.115 + }
21.116 + finally
21.117 + {
21.118 + propertyChanging = false;
21.119 + }
21.120 + }
21.121 +
21.122 + /*
21.123 + * Lookup that excludes nodes. Needed for use with instanceof in the
21.124 + * property change listener.
21.125 + */
21.126 + private static class NoNodeLookup extends Lookup {
21.127 + private final Lookup delegate;
21.128 +
21.129 + public NoNodeLookup(Lookup delegate) {
21.130 + this.delegate = delegate;
21.131 + }
21.132 +
21.133 + @Override
21.134 + public <T> T lookup(Class<T> clazz) {
21.135 + return (clazz == Node.class) ? null : delegate.lookup(clazz);
21.136 + }
21.137 +
21.138 + @Override
21.139 + public <T> Result<T> lookup(Template<T> template) {
21.140 + if (template.getType() == Node.class) {
21.141 + return Lookup.EMPTY.lookup(template);
21.142 + }
21.143 + return delegate.lookup(template);
21.144 + }
21.145 + }
21.146 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowDesignViewMultiViewDesc.java Fri Apr 15 18:18:16 2011 -0400
22.3 @@ -0,0 +1,139 @@
22.4 +/*
22.5 + * The contents of this file are subject to the terms of the Common Development
22.6 + * and Distribution License (the License). You may not use this file except in
22.7 + * compliance with the License.
22.8 + *
22.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
22.10 + * or http://www.netbeans.org/cddl.txt.
22.11 + *
22.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
22.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
22.14 + * If applicable, add the following below the CDDL Header, with the fields
22.15 + * enclosed by brackets [] replaced by your own identifying information:
22.16 + * "Portions Copyrighted [year] [name of copyright owner]"
22.17 + *
22.18 + * The Original Software is NetBeans. The Initial Developer of the Original
22.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
22.20 + * Microsystems, Inc. All Rights Reserved.
22.21 + */
22.22 +
22.23 +package org.netbeans.modules.workflow.editor.multiview;
22.24 +
22.25 +import java.io.IOException;
22.26 +import java.io.ObjectInput;
22.27 +import java.io.ObjectOutput;
22.28 +import java.io.Serializable;
22.29 +
22.30 +import org.netbeans.core.spi.multiview.MultiViewDescription;
22.31 +import org.netbeans.core.spi.multiview.MultiViewElement;
22.32 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
22.33 +import org.openide.util.HelpCtx;
22.34 +import org.openide.util.NbBundle;
22.35 +import org.openide.util.Utilities;
22.36 +import org.openide.windows.TopComponent;
22.37 +
22.38 +/**
22.39 + *
22.40 + *
22.41 + */
22.42 +public class WorkflowDesignViewMultiViewDesc extends Object
22.43 + implements MultiViewDescription, Serializable {
22.44 +
22.45 +
22.46 + /**
22.47 + *
22.48 + */
22.49 + private static final long serialVersionUID = 2580263536201519563L;
22.50 + public static final String PREFERRED_ID = "wsdl-treeview";
22.51 + private WorkflowDataObject workflowDataObject;
22.52 +
22.53 + /**
22.54 + *
22.55 + *
22.56 + */
22.57 + public WorkflowDesignViewMultiViewDesc() {
22.58 + super();
22.59 + }
22.60 +
22.61 +
22.62 + /**
22.63 + *
22.64 + *
22.65 + */
22.66 + public WorkflowDesignViewMultiViewDesc(WorkflowDataObject wsdlDataObject) {
22.67 + this.workflowDataObject = wsdlDataObject;
22.68 + }
22.69 +
22.70 +
22.71 + /**
22.72 + *
22.73 + *
22.74 + */
22.75 + public String preferredID() {
22.76 + return PREFERRED_ID;
22.77 + }
22.78 +
22.79 +
22.80 + /**
22.81 + *
22.82 + *
22.83 + */
22.84 + public int getPersistenceType() {
22.85 + return TopComponent.PERSISTENCE_NEVER;
22.86 + }
22.87 +
22.88 +
22.89 + /**
22.90 + *
22.91 + *
22.92 + */
22.93 + public java.awt.Image getIcon() {
22.94 + return Utilities.loadImage(WorkflowDataObject.WORKFLOW_ICON_BASE_WITH_EXT);
22.95 + }
22.96 +
22.97 +
22.98 + public HelpCtx getHelpCtx() {
22.99 + return new HelpCtx(WorkflowDesignViewMultiViewDesc.class);
22.100 + }
22.101 +
22.102 +
22.103 + /**
22.104 + *
22.105 + *
22.106 + */
22.107 + public String getDisplayName() {
22.108 + return NbBundle.getMessage(WorkflowDesignViewMultiViewDesc.class,
22.109 + "LBL_designView_name");
22.110 + }
22.111 +
22.112 +
22.113 + /**
22.114 + *
22.115 + *
22.116 + */
22.117 + public MultiViewElement createElement() {
22.118 + return new WorkflowDesignViewMultiViewElement(workflowDataObject);
22.119 + }
22.120 +
22.121 +
22.122 + /**
22.123 + *
22.124 + *
22.125 + */
22.126 + public void writeExternal(ObjectOutput out) throws IOException {
22.127 + out.writeObject(workflowDataObject);
22.128 + }
22.129 +
22.130 +
22.131 + /**
22.132 + *
22.133 + *
22.134 + */
22.135 + public void readExternal(ObjectInput in)
22.136 + throws IOException, ClassNotFoundException
22.137 + {
22.138 + Object firstObject = in.readObject();
22.139 + if (firstObject instanceof WorkflowDataObject)
22.140 + workflowDataObject = (WorkflowDataObject) firstObject;
22.141 + }
22.142 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowDesignViewMultiViewElement.java Fri Apr 15 18:18:16 2011 -0400
23.3 @@ -0,0 +1,419 @@
23.4 +/*
23.5 + * The contents of this file are subject to the terms of the Common Development
23.6 + * and Distribution License (the License). You may not use this file except in
23.7 + * compliance with the License.
23.8 + *
23.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
23.10 + * or http://www.netbeans.org/cddl.txt.
23.11 + *
23.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
23.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
23.14 + * If applicable, add the following below the CDDL Header, with the fields
23.15 + * enclosed by brackets [] replaced by your own identifying information:
23.16 + * "Portions Copyrighted [year] [name of copyright owner]"
23.17 + *
23.18 + * The Original Software is NetBeans. The Initial Developer of the Original
23.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
23.20 + * Microsystems, Inc. All Rights Reserved.
23.21 + */
23.22 +
23.23 +package org.netbeans.modules.workflow.editor.multiview;
23.24 +
23.25 +import java.awt.BorderLayout;
23.26 +import java.awt.Color;
23.27 +import java.awt.event.ActionEvent;
23.28 +import java.beans.PropertyVetoException;
23.29 +import java.io.File;
23.30 +import java.io.FileOutputStream;
23.31 +import java.util.Iterator;
23.32 +
23.33 +import javax.swing.AbstractAction;
23.34 +import javax.swing.Action;
23.35 +import javax.swing.ActionMap;
23.36 +import javax.swing.InputMap;
23.37 +import javax.swing.JComponent;
23.38 +import javax.swing.JToolBar;
23.39 +import javax.swing.KeyStroke;
23.40 +import javax.swing.UIManager;
23.41 +import javax.swing.text.DefaultEditorKit;
23.42 +
23.43 +import org.netbeans.core.api.multiview.MultiViewHandler;
23.44 +import org.netbeans.core.api.multiview.MultiViewPerspective;
23.45 +import org.netbeans.core.api.multiview.MultiViews;
23.46 +import org.netbeans.core.spi.multiview.CloseOperationState;
23.47 +import org.netbeans.core.spi.multiview.MultiViewElement;
23.48 +import org.netbeans.core.spi.multiview.MultiViewElementCallback;
23.49 +import org.netbeans.core.spi.multiview.MultiViewFactory;
23.50 +//import org.netbeans.modules.iep.editor.designer.ZoomManager;
23.51 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
23.52 +import org.netbeans.modules.workflow.editor.palette.WorkflowPaletteFactory;
23.53 +import org.netbeans.modules.workflow.editor.view.design.WorkflowDesignViewPanel;
23.54 +import org.netbeans.modules.xml.xam.Component;
23.55 +import org.netbeans.modules.xml.xam.spi.Validator.ResultItem;
23.56 +import org.netbeans.modules.xml.xam.ui.multiview.ActivatedNodesMediator;
23.57 +import org.netbeans.modules.xml.xam.ui.multiview.CookieProxyLookup;
23.58 +
23.59 +import org.openide.actions.FindAction;
23.60 +import org.openide.awt.UndoRedo;
23.61 +import org.openide.explorer.ExplorerManager;
23.62 +import org.openide.explorer.ExplorerUtils;
23.63 +import org.openide.nodes.Node;
23.64 +import org.openide.util.HelpCtx;
23.65 +import org.openide.util.Lookup;
23.66 +import org.openide.util.NbBundle;
23.67 +import org.openide.util.actions.CallbackSystemAction;
23.68 +import org.openide.util.actions.SystemAction;
23.69 +import org.openide.util.lookup.Lookups;
23.70 +import org.openide.windows.Mode;
23.71 +import org.openide.windows.TopComponent;
23.72 +import org.openide.windows.TopComponentGroup;
23.73 +import org.openide.windows.WindowManager;
23.74 +import org.netbeans.modules.xml.validation.ShowCookie;
23.75 +import org.netbeans.modules.xml.validation.ValidateAction;
23.76 +import org.openide.filesystems.FileUtil;
23.77 +
23.78 +/**
23.79 + * @author radval
23.80 + *
23.81 + * To change the template for this generated type comment go to
23.82 + * Window - Preferences - Java - Code Generation - Code and Comments
23.83 + */
23.84 +public class WorkflowDesignViewMultiViewElement extends TopComponent
23.85 + implements MultiViewElement, ExplorerManager.Provider {
23.86 + private static final long serialVersionUID = -655912409997381426L;
23.87 + private static final String ACTIVATED_NODES = "activatedNodes";//NOI18N
23.88 + private ExplorerManager manager;
23.89 + private WorkflowDataObject mObj;
23.90 + private transient MultiViewElementCallback multiViewObserver;
23.91 + private transient javax.swing.JLabel errorLabel = new javax.swing.JLabel();
23.92 + private transient JToolBar mToolbar;
23.93 + //private GraphView graphComponent;
23.94 +
23.95 + public WorkflowDesignViewMultiViewElement() {
23.96 + super();
23.97 + }
23.98 +
23.99 + public WorkflowDesignViewMultiViewElement(WorkflowDataObject dObj) {
23.100 + super();
23.101 + this.mObj = dObj;
23.102 + this.mObj.getWorkflowEditorSupport().setPlanDesignMultiviewElement(this);
23.103 + initialize();
23.104 + }
23.105 +
23.106 + private void initialize() {
23.107 + manager = new ExplorerManager();
23.108 + // Install our own actions.
23.109 + CallbackSystemAction globalFindAction = SystemAction.get(FindAction.class);
23.110 + Object mapKey = globalFindAction.getActionMapKey();
23.111 + Action action = new WSDLFindAction();
23.112 + ActionMap map = getActionMap();
23.113 + map.put(mapKey, action);
23.114 + map.put(DefaultEditorKit.copyAction, ExplorerUtils.actionCopy(manager));
23.115 + map.put(DefaultEditorKit.cutAction, ExplorerUtils.actionCut(manager));
23.116 + map.put(DefaultEditorKit.pasteAction, ExplorerUtils.actionPaste(manager));
23.117 + map.put("delete", ExplorerUtils.actionDelete(manager, false));
23.118 +
23.119 + // Define the keyboard shortcuts for the actions.
23.120 + InputMap keys = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
23.121 + KeyStroke key = (KeyStroke) globalFindAction.getValue(Action.ACCELERATOR_KEY);
23.122 + if (key == null) {
23.123 + key = KeyStroke.getKeyStroke("control F");
23.124 + }
23.125 + keys.put(key, mapKey);
23.126 +
23.127 + //show cookie
23.128 + ShowCookie showCookie = new ShowCookie() {
23.129 + public void show(ResultItem resultItem) {
23.130 + Component component = resultItem.getComponents();
23.131 + //graphComponent.showComponent(component);
23.132 + }
23.133 + };
23.134 +
23.135 + Node delegate = this.mObj.getNodeDelegate();
23.136 +
23.137 + CookieProxyLookup cpl = new CookieProxyLookup(new Lookup[] {
23.138 + Lookups.fixed(new Object[] {
23.139 + // Need the data object registered in the lookup so that the
23.140 + // projectui code will close our open editor windows when the
23.141 + // project is closed.
23.142 + this.mObj,
23.143 + showCookie,
23.144 + // Provides the PrintProvider for printing
23.145 + //new DesignViewPrintProvider(),
23.146 + // Component palette for the partner view.
23.147 + WorkflowPaletteFactory.getPalette(),
23.148 + // This is unusal, not sure why this is here.
23.149 + this,
23.150 + }),
23.151 + // The Node delegate Lookup must be the last one in the list
23.152 + // for the CookieProxyLookup to work properly.
23.153 + delegate.getLookup(),
23.154 + }, delegate);
23.155 +
23.156 + associateLookup(cpl);
23.157 + addPropertyChangeListener(ACTIVATED_NODES, cpl);
23.158 +
23.159 + setLayout(new BorderLayout());
23.160 + }
23.161 +
23.162 +
23.163 + private void cleanup() {
23.164 + try {
23.165 + manager.setSelectedNodes(new Node[0]);
23.166 + } catch (PropertyVetoException e) {
23.167 + }
23.168 +
23.169 + if (mToolbar != null) mToolbar.removeAll();
23.170 + mToolbar = null;
23.171 + removeAll();
23.172 + }
23.173 + public ExplorerManager getExplorerManager() {
23.174 + return manager;
23.175 + }
23.176 +
23.177 + @Override
23.178 + public int getPersistenceType() {
23.179 + return PERSISTENCE_NEVER;
23.180 + }
23.181 +
23.182 + public void setMultiViewCallback(final MultiViewElementCallback callback) {
23.183 + multiViewObserver = callback;
23.184 + }
23.185 +
23.186 + public CloseOperationState canCloseElement() {
23.187 + // if this is not the last cloned xml editor component, closing is OK
23.188 + if (!WorkflowEditorSupport.isLastView(multiViewObserver.getTopComponent())) {
23.189 + return CloseOperationState.STATE_OK;
23.190 + }
23.191 + // return a placeholder state - to be sure our CloseHandler is called
23.192 + return MultiViewFactory.createUnsafeCloseState(
23.193 + "ID_TEXT_CLOSING", // dummy ID // NOI18N
23.194 + MultiViewFactory.NOOP_CLOSE_ACTION,
23.195 + MultiViewFactory.NOOP_CLOSE_ACTION);
23.196 + }
23.197 +
23.198 +
23.199 + @Override
23.200 + public void componentHidden() {
23.201 + super.componentHidden();
23.202 +
23.203 + }
23.204 +
23.205 + @Override
23.206 + public void componentClosed() {
23.207 + super.componentClosed();
23.208 + cleanup();
23.209 + }
23.210 +
23.211 + @Override
23.212 + public void componentOpened() {
23.213 + super.componentOpened();
23.214 + initUI();
23.215 + }
23.216 +
23.217 + @Override
23.218 + public void componentActivated() {
23.219 + super.componentActivated();
23.220 + ExplorerUtils.activateActions(manager, true);
23.221 + mObj.getWorkflowEditorSupport().syncModel();
23.222 + updateGroupVisibility();
23.223 + }
23.224 +
23.225 + @Override
23.226 + public void componentDeactivated() {
23.227 + ExplorerUtils.activateActions(manager, false);
23.228 + super.componentDeactivated();
23.229 + updateGroupVisibility();
23.230 + }
23.231 +
23.232 + @Override
23.233 + public void componentShowing() {
23.234 + super.componentShowing();
23.235 + initUI();
23.236 +
23.237 +
23.238 + }
23.239 +
23.240 + @Override
23.241 + public void requestActive() {
23.242 + super.requestActive();
23.243 +
23.244 + }
23.245 +
23.246 + @Override
23.247 + public HelpCtx getHelpCtx() {
23.248 + return new HelpCtx(WorkflowDesignViewMultiViewDesc.class);
23.249 + }
23.250 +
23.251 + private static Boolean groupVisible = null;
23.252 +
23.253 + private void updateGroupVisibility() {
23.254 + WindowManager wm = WindowManager.getDefault();
23.255 + final TopComponentGroup group = wm.findTopComponentGroup("wsdl_ui"); // NOI18N
23.256 + if (group == null) {
23.257 + return; // group not found (should not happen)
23.258 + }
23.259 + //
23.260 + boolean isWSDLViewSelected = false;
23.261 + Iterator it = wm.getModes().iterator();
23.262 + while (it.hasNext()) {
23.263 + Mode mode = (Mode) it.next();
23.264 + TopComponent selected = mode.getSelectedTopComponent();
23.265 + if (selected != null) {
23.266 + MultiViewHandler mvh = MultiViews.findMultiViewHandler(selected);
23.267 + if (mvh != null) {
23.268 + MultiViewPerspective mvp = mvh.getSelectedPerspective();
23.269 + if (mvp != null) {
23.270 + String id = mvp.preferredID();
23.271 + if (WorkflowDesignViewMultiViewDesc.PREFERRED_ID.equals(id)) {
23.272 + isWSDLViewSelected = true;
23.273 + break;
23.274 + }
23.275 + }
23.276 + }
23.277 + }
23.278 + }
23.279 + //
23.280 + if (isWSDLViewSelected && !Boolean.TRUE.equals(groupVisible)) {
23.281 + group.open();
23.282 + } else if (!isWSDLViewSelected && !Boolean.FALSE.equals(groupVisible)) {
23.283 + group.close();
23.284 + }
23.285 + //
23.286 + groupVisible = isWSDLViewSelected ? Boolean.TRUE : Boolean.FALSE;
23.287 +
23.288 + }
23.289 +
23.290 + @Override
23.291 + protected String preferredID() {
23.292 + return "WSDLTreeViewMultiViewElementTC"; // NOI18N
23.293 + }
23.294 +
23.295 + /**
23.296 + * Construct the user interface.
23.297 + */
23.298 + private void initUI() {
23.299 + WorkflowEditorSupport editor = mObj.getWorkflowEditorSupport();
23.300 + /*IEPModel iepModel = editor.getModel();
23.301 + if (iepModel != null &&
23.302 + iepModel.getState() == IEPModel.State.VALID) {
23.303 + // Construct the standard editor interface.
23.304 + if (graphComponent == null) {
23.305 + graphComponent = new GraphView(iepModel);
23.306 + ZoomManager manager = new ZoomManager(graphComponent.getPlanCanvas());
23.307 + manager.addToolbarActions((JToolBar)getToolbarRepresentation());
23.308 + }
23.309 + removeAll();
23.310 + add(graphComponent, BorderLayout.CENTER);
23.311 + return;
23.312 + }*/
23.313 + if(true) {
23.314 + add(new WorkflowDesignViewPanel(), BorderLayout.CENTER);
23.315 + return;
23.316 + }
23.317 +
23.318 + //add(graphComponent, BorderLayout.CENTER);
23.319 +
23.320 + // Clear the interface and show the error message.
23.321 + removeAll();
23.322 +
23.323 + String errorMessage = null;
23.324 +
23.325 + errorLabel.setText("<" + errorMessage + ">");
23.326 + errorLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
23.327 + errorLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
23.328 + errorLabel.setEnabled(false);
23.329 + Color usualWindowBkg = UIManager.getColor("window"); //NOI18N
23.330 + errorLabel.setBackground(usualWindowBkg != null ? usualWindowBkg :
23.331 + Color.white);
23.332 + errorLabel.setOpaque(true);
23.333 + add(errorLabel, BorderLayout.CENTER);
23.334 + }
23.335 +
23.336 + public javax.swing.JComponent getToolbarRepresentation() {
23.337 + return new JToolBar();
23.338 + /*if (mToolbar == null) {
23.339 + IEPModel model = mObj.getPlanEditorSupport().getModel();
23.340 + if (model != null && model.getState() == IEPModel.State.VALID) {
23.341 + mToolbar = new JToolBar();
23.342 + mToolbar.setFloatable(false);
23.343 +
23.344 + mToolbar.addSeparator();
23.345 + mToolbar.add(new ValidateAction(model));
23.346 +
23.347 + Action overviewAction = new OverviewAction(graphComponent.getPlanCanvas(), model);
23.348 + mToolbar.add(overviewAction);
23.349 +
23.350 + Action toggleOrthoLinkAction = new ToggleOrthogonalLinkAction(graphComponent.getPlanCanvas(), model);
23.351 + mToolbar.add(toggleOrthoLinkAction);
23.352 +
23.353 + Action autoLayoutAction = new AutoLayoutAction(graphComponent.getPlanCanvas(), model);
23.354 + mToolbar.add(autoLayoutAction);
23.355 + mToolbar.addSeparator();
23.356 +
23.357 +// Action toggleScopeAction = new ToggleScopeAction(graphComponent.getPlanCanvas(), model);
23.358 +// mToolbar.add(toggleScopeAction);
23.359 +//
23.360 + addGenerateReportAction(mToolbar);
23.361 +
23.362 +
23.363 + addCustomizeReportAction(mToolbar);
23.364 + mToolbar.addSeparator();
23.365 + }
23.366 + }
23.367 + return mToolbar;*/
23.368 + }
23.369 + /*
23.370 + private void addGenerateReportAction(JToolBar toolbar) {
23.371 + try {
23.372 + toolbar.add(new GenerateReportAction(mObj));
23.373 + } catch(Exception ex) {
23.374 + ex.printStackTrace();
23.375 + }
23.376 +
23.377 +
23.378 + }
23.379 +
23.380 + private void addCustomizeReportAction(JToolBar toolbar) {
23.381 + CustomizeReportAction action = new CustomizeReportAction();
23.382 + toolbar.add(action);
23.383 +
23.384 + }*/
23.385 +
23.386 + @Override
23.387 + public UndoRedo getUndoRedo() {
23.388 + return mObj.getWorkflowEditorSupport().getUndoManager();
23.389 + }
23.390 +
23.391 +
23.392 +
23.393 + public javax.swing.JComponent getVisualRepresentation() {
23.394 + return this;
23.395 + }
23.396 +
23.397 + /* public GraphView getGraphView() {
23.398 + return this.graphComponent;
23.399 + }*/
23.400 +
23.401 + /**
23.402 + * Find action for WSDL editor.
23.403 + *
23.404 + * @author Nathan Fiedler
23.405 + */
23.406 + private class WSDLFindAction extends AbstractAction {
23.407 + /** silence compiler warnings */
23.408 + private static final long serialVersionUID = 1L;
23.409 +
23.410 + /**
23.411 + * Creates a new instance of WSDLFindAction.
23.412 + */
23.413 + public WSDLFindAction() {
23.414 + }
23.415 +
23.416 + public void actionPerformed(ActionEvent event) {
23.417 + WorkflowDesignViewMultiViewElement parent =
23.418 + WorkflowDesignViewMultiViewElement.this;
23.419 +
23.420 + }
23.421 + }
23.422 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowEditorSupport.java Fri Apr 15 18:18:16 2011 -0400
24.3 @@ -0,0 +1,526 @@
24.4 +/*
24.5 + * The contents of this file are subject to the terms of the Common Development
24.6 + * and Distribution License (the License). You may not use this file except in
24.7 + * compliance with the License.
24.8 + *
24.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
24.10 + * or http://www.netbeans.org/cddl.txt.
24.11 + *
24.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
24.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
24.14 + * If applicable, add the following below the CDDL Header, with the fields
24.15 + * enclosed by brackets [] replaced by your own identifying information:
24.16 + * "Portions Copyrighted [year] [name of copyright owner]"
24.17 + *
24.18 + * The Original Software is NetBeans. The Initial Developer of the Original
24.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
24.20 + * Microsystems, Inc. All Rights Reserved.
24.21 + */
24.22 +
24.23 +package org.netbeans.modules.workflow.editor.multiview;
24.24 +
24.25 +import java.awt.EventQueue;
24.26 +import java.io.File;
24.27 +import java.io.IOException;
24.28 +import java.io.Serializable;
24.29 +import java.util.ArrayList;
24.30 +import java.util.Date;
24.31 +import java.util.Enumeration;
24.32 +import java.util.List;
24.33 +import java.util.Set;
24.34 +
24.35 +import javax.swing.text.AbstractDocument;
24.36 +import javax.swing.text.StyledDocument;
24.37 +
24.38 +import org.netbeans.core.api.multiview.MultiViewHandler;
24.39 +import org.netbeans.core.api.multiview.MultiViews;
24.40 +import org.netbeans.core.spi.multiview.CloseOperationHandler;
24.41 +import org.netbeans.core.spi.multiview.CloseOperationState;
24.42 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataLoader;
24.43 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
24.44 +import org.openide.DialogDisplayer;
24.45 +import org.openide.NotifyDescriptor;
24.46 +import org.openide.awt.UndoRedo;
24.47 +import org.openide.cookies.CloseCookie;
24.48 +import org.openide.cookies.EditCookie;
24.49 +import org.openide.cookies.EditorCookie;
24.50 +import org.openide.cookies.LineCookie;
24.51 +import org.openide.cookies.OpenCookie;
24.52 +import org.openide.cookies.PrintCookie;
24.53 +import org.openide.filesystems.FileLock;
24.54 +import org.openide.filesystems.FileObject;
24.55 +import org.openide.loaders.DataObject;
24.56 +import org.openide.text.CloneableEditor;
24.57 +import org.openide.text.CloneableEditorSupport;
24.58 +import org.openide.text.DataEditorSupport;
24.59 +import org.openide.util.NbBundle;
24.60 +import org.openide.util.Task;
24.61 +import org.openide.util.TaskListener;
24.62 +import org.openide.windows.CloneableTopComponent;
24.63 +import org.openide.windows.Mode;
24.64 +import org.openide.windows.TopComponent;
24.65 +import org.openide.windows.WindowManager;
24.66 +import org.netbeans.modules.xml.retriever.catalog.Utilities;
24.67 +import org.netbeans.modules.xml.xam.ModelSource;
24.68 +import org.netbeans.modules.xml.xam.ui.undo.QuietUndoManager;
24.69 +
24.70 +/**
24.71 + *
24.72 + * @author Jeri Lockhart
24.73 + * @author Todd Fast, todd.fast@sun.com
24.74 + */
24.75 +public class WorkflowEditorSupport extends DataEditorSupport
24.76 + implements OpenCookie, EditCookie,
24.77 + EditorCookie.Observable, LineCookie, CloseCookie, PrintCookie {
24.78 + /** Used for managing the prepareTask listener. */
24.79 + private transient Task prepareTask2;
24.80 +
24.81 + private WorkflowDesignViewMultiViewElement mDesignViewElement;
24.82 +
24.83 + /**
24.84 + *
24.85 + *
24.86 + */
24.87 + public WorkflowEditorSupport(WorkflowDataObject sobj) {
24.88 + super(sobj, new WorkflowEditorEnv(sobj));
24.89 + setMIMEType(WorkflowDataLoader.REQUIRED_MIME);
24.90 + }
24.91 +
24.92 +
24.93 + /**
24.94 + *
24.95 + *
24.96 + */
24.97 + public WorkflowEditorEnv getEnv() {
24.98 + return (WorkflowEditorEnv)env;
24.99 + }
24.100 +
24.101 + @Override
24.102 + protected Pane createPane() {
24.103 + TopComponent tc = WorkflowMultiViewFactory.createMultiView(
24.104 + (WorkflowDataObject) getDataObject());
24.105 + // Note that initialization of the editor happens separately,
24.106 + // and we only need to handle that during the initial creation
24.107 + // of the text editor.
24.108 + Mode editorMode = WindowManager.getDefault().findMode(
24.109 + WorkflowEditorSupport.EDITOR_MODE);
24.110 + if (editorMode != null) {
24.111 + editorMode.dockInto(tc);
24.112 + }
24.113 + return (Pane) tc;
24.114 + }
24.115 +
24.116 + /**
24.117 + *
24.118 + *
24.119 + */
24.120 + public static boolean isLastView(TopComponent tc) {
24.121 +
24.122 + if (!(tc instanceof CloneableTopComponent))
24.123 + return false;
24.124 +
24.125 + boolean oneOrLess = true;
24.126 + Enumeration en =
24.127 + ((CloneableTopComponent)tc).getReference().getComponents();
24.128 + if (en.hasMoreElements()) {
24.129 + en.nextElement();
24.130 + if (en.hasMoreElements())
24.131 + oneOrLess = false;
24.132 + }
24.133 +
24.134 + return oneOrLess;
24.135 + }
24.136 +
24.137 + // Change method access to public
24.138 + @Override
24.139 + public void initializeCloneableEditor(CloneableEditor editor) {
24.140 + super.initializeCloneableEditor(editor);
24.141 + // Force the title to update so the * left over from when the
24.142 + // modified data object was discarded is removed from the title.
24.143 + EventQueue.invokeLater(new Runnable() {
24.144 + public void run() {
24.145 + // Have to do this later to avoid infinite loop.
24.146 + updateTitles();
24.147 + }
24.148 + });
24.149 + }
24.150 +
24.151 + @Override
24.152 + protected void updateTitles() {
24.153 + // This method is invoked by DataEditorSupport.DataNodeListener
24.154 + // whenever the DataNode displayName property is changed. It is
24.155 + // also called when the CloneableEditorSupport is (un)modified.
24.156 +
24.157 + // Let the superclass handle the CloneableEditor instances.
24.158 + super.updateTitles();
24.159 +
24.160 + // We need to get the title updated on the MultiViewTopComponent.
24.161 + EventQueue.invokeLater(new Runnable() {
24.162 + public void run() {
24.163 + // Create a list of TopComponents associated with the
24.164 + // editor's data object, starting with the active
24.165 + // TopComponent. Add all open TopComponents in any
24.166 + // mode that are associated with the DataObject.
24.167 + // [Note that EDITOR_MODE does not contain editors in
24.168 + // split mode.]
24.169 + List<TopComponent> associatedTCs = new ArrayList<TopComponent>();
24.170 + DataObject targetDO = getDataObject();
24.171 + TopComponent activeTC = TopComponent.getRegistry().getActivated();
24.172 + if (activeTC != null && targetDO == activeTC.getLookup().lookup(
24.173 + DataObject.class)) {
24.174 + associatedTCs.add(activeTC);
24.175 + }
24.176 + Set openTCs = TopComponent.getRegistry().getOpened();
24.177 + for (Object tc : openTCs) {
24.178 + TopComponent tcc = (TopComponent) tc;
24.179 + if (targetDO == tcc.getLookup().lookup(
24.180 + DataObject.class)) {
24.181 + associatedTCs.add(tcc);
24.182 + }
24.183 + }
24.184 + for (TopComponent tc : associatedTCs) {
24.185 + // Make sure this is a multiview window, and not just some
24.186 + // window that has our DataObject (e.g. Projects, Files).
24.187 + MultiViewHandler mvh = MultiViews.findMultiViewHandler(tc);
24.188 + if (mvh != null) {
24.189 + tc.setHtmlDisplayName(messageHtmlName());
24.190 + String name = messageName();
24.191 + tc.setDisplayName(name);
24.192 + tc.setName(name);
24.193 + tc.setToolTipText(messageToolTip());
24.194 + }
24.195 + }
24.196 + }
24.197 + });
24.198 + }
24.199 +
24.200 +
24.201 +
24.202 + /**
24.203 + * This method allows the close behavior of CloneableEditorSupport to be
24.204 + * invoked from the SourceMultiViewElement. The close method of
24.205 + * CloneableEditorSupport at least clears the undo queue and releases
24.206 + * the swing document.
24.207 + */
24.208 + public boolean silentClose() {
24.209 + return super.close(false);
24.210 + }
24.211 +
24.212 +
24.213 +
24.214 + ////////////////////////////////////////////////////////////////////////////
24.215 + // Inner class
24.216 + ////////////////////////////////////////////////////////////////////////////
24.217 +
24.218 + /**
24.219 + * Env class extends DataEditorSupport.Env.
24.220 + */
24.221 + protected static class WorkflowEditorEnv extends DataEditorSupport.Env {
24.222 +
24.223 + static final long serialVersionUID =1099957785497677206L;
24.224 +
24.225 + public WorkflowEditorEnv(WorkflowDataObject obj) {
24.226 + super(obj);
24.227 + }
24.228 +
24.229 + public CloneableEditorSupport findTextEditorSupport() {
24.230 + return getPlanDataObject().getWorkflowEditorSupport();
24.231 + }
24.232 +
24.233 + public WorkflowDataObject getPlanDataObject(){
24.234 + return (WorkflowDataObject) getDataObject();
24.235 + }
24.236 +
24.237 + @Override
24.238 + protected FileObject getFile() {
24.239 + return getDataObject().getPrimaryFile();
24.240 + }
24.241 +
24.242 + @Override
24.243 + protected FileLock takeLock() throws IOException {
24.244 + return getDataObject().getPrimaryFile().lock();
24.245 + }
24.246 + }
24.247 +
24.248 +
24.249 +
24.250 +
24.251 + ////////////////////////////////////////////////////////////////////////////
24.252 + // Inner class
24.253 + ////////////////////////////////////////////////////////////////////////////
24.254 +
24.255 + /**
24.256 + * Implementation of CloseOperationHandler for multiview. Ensures both
24.257 + * column view and xml editor are correctly closed, data saved, etc. Holds
24.258 + * a reference to DataObject only - to be serializable with the
24.259 + * multiview TopComponent without problems.
24.260 + */
24.261 + public static class CloseHandler implements CloseOperationHandler, Serializable {
24.262 + private static final long serialVersionUID =-3838395157610633251L;
24.263 + private DataObject dataObject;
24.264 +
24.265 + private CloseHandler() {
24.266 + super();
24.267 + }
24.268 +
24.269 + public CloseHandler(DataObject dobj) {
24.270 + dataObject = dobj;
24.271 + }
24.272 +
24.273 + private WorkflowEditorSupport getWSDLEditorSupport() {
24.274 + return dataObject instanceof WorkflowDataObject ?
24.275 + ((WorkflowDataObject) dataObject).getWorkflowEditorSupport() : null;
24.276 + }
24.277 +
24.278 + public boolean resolveCloseOperation(CloseOperationState[] elements) {
24.279 + WorkflowEditorSupport wsdlEditor = getWSDLEditorSupport();
24.280 + boolean canClose = wsdlEditor != null ? wsdlEditor.canClose() : true;
24.281 + // during the shutdown sequence this is called twice. The first time
24.282 + // through the multi-view infrastructure. The second time is done through
24.283 + // the TopComponent close. If the file is dirty and the user chooses
24.284 + // to discard changes, the second time will also ask whether the
24.285 + // to save or discard changes.
24.286 + if (canClose) {
24.287 + dataObject.setModified(false);
24.288 + }
24.289 + return canClose;
24.290 + }
24.291 + }
24.292 +
24.293 + /*
24.294 + public IEPModel getModel() {
24.295 + WorkflowDataObject dobj = getEnv().getPlanDataObject();
24.296 + ModelSource modelSource = Utilities.getModelSource(dobj.getPrimaryFile(), true);
24.297 + if(modelSource != null) {
24.298 + return IEPModelFactory.getDefault().getModel(modelSource);
24.299 + }
24.300 +
24.301 + return null;
24.302 + }*/
24.303 +
24.304 + /**
24.305 + * Have the IEP model sync with the document.
24.306 + */
24.307 + public void syncModel() {
24.308 + // Only sync the document if the change relates to loss of focus,
24.309 + // which indicates that we are switching from the source view.
24.310 + // Update the tree with the modified text.
24.311 + /* try {
24.312 + if(getModel() != null) {
24.313 + getModel().sync();
24.314 + }
24.315 + } catch (Throwable ioe) {
24.316 + // The document cannot be parsed
24.317 + NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(PlanEditorSupport.class, "MSG_NotWellformedWorkflow"), NotifyDescriptor.ERROR_MESSAGE);
24.318 + DialogDisplayer.getDefault().notify(nd);
24.319 + }
24.320 + */
24.321 + }
24.322 +
24.323 +
24.324 + @Override
24.325 + protected UndoRedo.Manager createUndoRedoManager() {
24.326 + // Override so the superclass will use our proxy undo manager
24.327 + // instead of the default, then we can intercept edits.
24.328 + return new QuietUndoManager(super.createUndoRedoManager());
24.329 + // Note we cannot set the document on the undo manager right
24.330 + // now, as CES is probably trying to open the document.
24.331 + }
24.332 +
24.333 + /**
24.334 + * Returns the UndoRedo.Manager instance managed by this editor support.
24.335 + *
24.336 + * @return UndoRedo.Manager instance.
24.337 + */
24.338 + public QuietUndoManager getUndoManager() {
24.339 + return (QuietUndoManager) getUndoRedo();
24.340 + }
24.341 +
24.342 + @Override
24.343 + public Task prepareDocument() {
24.344 + Task task = super.prepareDocument();
24.345 + // Avoid listening to the same task more than once.
24.346 + if (task != prepareTask2) {
24.347 + prepareTask2 = task;
24.348 + task.addTaskListener(new TaskListener() {
24.349 + public void taskFinished(Task task) {
24.350 + QuietUndoManager undo = getUndoManager();
24.351 + StyledDocument doc = getDocument();
24.352 + synchronized (undo) {
24.353 + // Now that the document is ready, pass it to the manager.
24.354 + undo.setDocument((AbstractDocument) doc);
24.355 + if (!undo.isCompound()) {
24.356 + // The superclass prepareDocument() adds the undo/redo
24.357 + // manager as a listener -- we need to remove it since
24.358 + // we will initially listen to the model instead.
24.359 + doc.removeUndoableEditListener(undo);
24.360 + // If not listening to document, then listen to model.
24.361 + addUndoManagerToModel(undo);
24.362 + }
24.363 + }
24.364 + prepareTask2 = null;
24.365 + }
24.366 + });
24.367 + }
24.368 + return task;
24.369 + }
24.370 +
24.371 + @Override
24.372 + public Task reloadDocument() {
24.373 + Task task = super.reloadDocument();
24.374 + task.addTaskListener(new TaskListener() {
24.375 + public void taskFinished(Task task) {
24.376 + EventQueue.invokeLater(new Runnable() {
24.377 + public void run() {
24.378 + QuietUndoManager undo = getUndoManager();
24.379 + StyledDocument doc = getDocument();
24.380 + // The superclass reloadDocument() adds the undo
24.381 + // manager as an undoable edit listener.
24.382 + synchronized (undo) {
24.383 + if (!undo.isCompound()) {
24.384 + doc.removeUndoableEditListener(undo);
24.385 + }
24.386 + }
24.387 + }
24.388 + });
24.389 + }
24.390 + });
24.391 + return task;
24.392 + }
24.393 +
24.394 + @Override
24.395 + protected void notifyClosed() {
24.396 + // Stop listening to the undoable edit sources when we are closed.
24.397 + /* QuietUndoManager undo = getUndoManager();
24.398 + StyledDocument doc = getDocument();
24.399 + synchronized (undo) {
24.400 + // May be null when closing the editor.
24.401 + if (doc != null) {
24.402 + doc.removeUndoableEditListener(undo);
24.403 + undo.endCompound();
24.404 + undo.setDocument(null);
24.405 + }
24.406 + IEPModel model = getModel();
24.407 + if (model != null) {
24.408 + model.removeUndoableEditListener(undo);
24.409 + }
24.410 + // Must unset the model when no longer listening to it.
24.411 + undo.setModel(null);
24.412 + }
24.413 + */
24.414 + super.notifyClosed();
24.415 + }
24.416 +
24.417 + /**
24.418 + * Adds the undo/redo manager to the document as an undoable edit
24.419 + * listener, so it receives the edits onto the queue. The manager
24.420 + * will be removed from the model as an undoable edit listener.
24.421 + *
24.422 + * <p>This method may be called repeatedly.</p>
24.423 + */
24.424 + public void addUndoManagerToDocument() {
24.425 + // This method may be called repeatedly.
24.426 + // Stop the undo manager from listening to the model, as it will
24.427 + // be listening to the document now.
24.428 + /* QuietUndoManager undo = getUndoManager();
24.429 + StyledDocument doc = getDocument();
24.430 + synchronized (undo) {
24.431 + IEPModel model = getModel();
24.432 + if (model != null) {
24.433 + model.removeUndoableEditListener(undo);
24.434 + }
24.435 + // Must unset the model when no longer listening to it.
24.436 + undo.setModel(null);
24.437 + // Document may be null if the cloned views are not behaving correctly.
24.438 + if (doc != null) {
24.439 + // Ensure the listener is not added twice.
24.440 + doc.removeUndoableEditListener(undo);
24.441 + doc.addUndoableEditListener(undo);
24.442 + // Start the compound mode of the undo manager, such that when
24.443 + // we are hidden, we will treat all of the edits as a single
24.444 + // compound edit. This avoids having the user invoke undo
24.445 + // numerous times when in the model view.
24.446 + undo.beginCompound();
24.447 + }
24.448 + }*/
24.449 + }
24.450 +
24.451 + /**
24.452 + * Removes the undo/redo manager undoable edit listener from the
24.453 + * document, to stop receiving undoable edits. The manager will
24.454 + * be added to the model as an undoable edit listener.
24.455 + *
24.456 + * <p>This method may be called repeatedly.</p>
24.457 + */
24.458 + public void removeUndoManagerFromDocument() {
24.459 + // This method may be called repeatedly.
24.460 + QuietUndoManager undo = getUndoManager();
24.461 + StyledDocument doc = getDocument();
24.462 + synchronized (undo) {
24.463 + // May be null when closing the editor.
24.464 + if (doc != null) {
24.465 + doc.removeUndoableEditListener(undo);
24.466 + undo.endCompound();
24.467 + }
24.468 + // Have the undo manager listen to the model when it is not
24.469 + // listening to the document.
24.470 + addUndoManagerToModel(undo);
24.471 + }
24.472 + }
24.473 +
24.474 + /**
24.475 + * Add the undo/redo manager undoable edit listener to the model.
24.476 + *
24.477 + * <p>Caller should synchronize on the undo manager prior to calling
24.478 + * this method, to avoid thread concurrency issues.</p>
24.479 + *
24.480 + * @param undo the undo manager.
24.481 + */
24.482 + private void addUndoManagerToModel(QuietUndoManager undo) {
24.483 + /*// This method may be called repeatedly.
24.484 + IEPModel model = getModel();
24.485 + if (model != null) {
24.486 + // Ensure the listener is not added twice.
24.487 + model.removeUndoableEditListener(undo);
24.488 + model.addUndoableEditListener(undo);
24.489 + // Ensure the model is sync'd when undo/redo is invoked,
24.490 + // otherwise the edits are added to the queue and eventually
24.491 + // cause exceptions.
24.492 + undo.setModel(model);
24.493 + }*/
24.494 + }
24.495 +
24.496 + public void save() {
24.497 + /*try {
24.498 + WorkflowDataObject dataObj = (WorkflowDataObject) getDataObject();
24.499 + Date planLastModified = dataObj.getPrimaryFile().lastModified();
24.500 +
24.501 + File wsdlFile = getModel().getWsdlFile();
24.502 + // Note that editor saves plan after saving its wsdl
24.503 + // Hence the only way wsdl has later modified time than plan is
24.504 + // through modification outside editor
24.505 + if (wsdlFile.exists() && planLastModified.before(new Date(wsdlFile.lastModified()))) {
24.506 + String msg = NbBundle.getMessage(PlanCanvas.class, "PlanDesigner.WSDL_HAS_BEEN_MANUALLY_CHANGED_OVERWRITE", wsdlFile.getName());
24.507 + NotifyDescriptor d = new NotifyDescriptor.Confirmation(msg, NotifyDescriptor.YES_NO_CANCEL_OPTION);
24.508 + DialogDisplayer.getDefault().notify(d);
24.509 + if (NotifyDescriptor.YES_OPTION == d.getValue()) {
24.510 + getModel().saveWsdl();
24.511 + }
24.512 + } else {
24.513 + getModel().saveWsdl();
24.514 + }
24.515 +
24.516 + //mStatusBar.setDirty(false);
24.517 + } catch (Exception e) {
24.518 + e.printStackTrace();
24.519 + }*/
24.520 + }
24.521 +
24.522 + public void setPlanDesignMultiviewElement(WorkflowDesignViewMultiViewElement designElement) {
24.523 + this.mDesignViewElement = designElement;
24.524 + }
24.525 +
24.526 + public WorkflowDesignViewMultiViewElement getPlanDesignMultiviewElement() {
24.527 + return this.mDesignViewElement;
24.528 + }
24.529 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowMultiViewFactory.java Fri Apr 15 18:18:16 2011 -0400
25.3 @@ -0,0 +1,92 @@
25.4 +/*
25.5 + * The contents of this file are subject to the terms of the Common Development
25.6 + * and Distribution License (the License). You may not use this file except in
25.7 + * compliance with the License.
25.8 + *
25.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
25.10 + * or http://www.netbeans.org/cddl.txt.
25.11 + *
25.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
25.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
25.14 + * If applicable, add the following below the CDDL Header, with the fields
25.15 + * enclosed by brackets [] replaced by your own identifying information:
25.16 + * "Portions Copyrighted [year] [name of copyright owner]"
25.17 + *
25.18 + * The Original Software is NetBeans. The Initial Developer of the Original
25.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
25.20 + * Microsystems, Inc. All Rights Reserved.
25.21 + */
25.22 +
25.23 +package org.netbeans.modules.workflow.editor.multiview;
25.24 +import org.netbeans.core.api.multiview.MultiViewHandler;
25.25 +import org.netbeans.core.api.multiview.MultiViewPerspective;
25.26 +import org.netbeans.core.api.multiview.MultiViews;
25.27 +import org.netbeans.core.spi.multiview.MultiViewDescription;
25.28 +import org.netbeans.core.spi.multiview.MultiViewFactory;
25.29 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
25.30 +import org.openide.windows.CloneableTopComponent;
25.31 +import org.openide.windows.TopComponent;
25.32 +
25.33 +/**
25.34 + *
25.35 + *
25.36 + */
25.37 +public class WorkflowMultiViewFactory {
25.38 + /**
25.39 + * Creates a new instance of WSDLMultiViewFactory
25.40 + */
25.41 + public WorkflowMultiViewFactory() {
25.42 + }
25.43 +
25.44 + public static CloneableTopComponent createMultiView(WorkflowDataObject workflowDataObject) {
25.45 + MultiViewDescription views[] = new MultiViewDescription[2];
25.46 +
25.47 + views[0] = getWorkflowSourceMultiviewDesc(workflowDataObject);
25.48 + views[1] = getWorkflowDesignMultiviewDesc(workflowDataObject);
25.49 +
25.50 +
25.51 + CloneableTopComponent multiview =
25.52 + MultiViewFactory.createCloneableMultiView(
25.53 +
25.54 + views,
25.55 + views[1],
25.56 + new WorkflowEditorSupport.CloseHandler(workflowDataObject));
25.57 +
25.58 + //IZ 84440 - show file name with extension
25.59 + String name = workflowDataObject.getNodeDelegate().getDisplayName();
25.60 + multiview.setDisplayName(name);
25.61 + multiview.setName(name);
25.62 +
25.63 +
25.64 + return multiview;
25.65 + }
25.66 +
25.67 +
25.68 + private static MultiViewDescription getWorkflowSourceMultiviewDesc(WorkflowDataObject wsdlDataObject) {
25.69 + return new WorkflowSourceMultiviewDesc(wsdlDataObject);
25.70 + }
25.71 +
25.72 + private static MultiViewDescription getWorkflowDesignMultiviewDesc(WorkflowDataObject wsdlDataObject) {
25.73 + return new WorkflowDesignViewMultiViewDesc(wsdlDataObject);
25.74 + }
25.75 +
25.76 + /**
25.77 + * Shows the desired multiview element. Must be called after the editor
25.78 + * has been opened (i.e. WSDLEditorSupport.open()) so the TopComponent
25.79 + * will be the active one in the registry.
25.80 + *
25.81 + * @param id identifier of the multiview element.
25.82 + */
25.83 + public static void requestMultiviewActive(String id) {
25.84 + TopComponent activeTC = TopComponent.getRegistry().getActivated();
25.85 + MultiViewHandler handler = MultiViews.findMultiViewHandler(activeTC);
25.86 + if (handler != null) {
25.87 + MultiViewPerspective[] perspectives = handler.getPerspectives();
25.88 + for (MultiViewPerspective perspective : perspectives) {
25.89 + if (perspective.preferredID().equals(id)) {
25.90 + handler.requestActive(perspective);
25.91 + }
25.92 + }
25.93 + }
25.94 + }
25.95 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowMultiviewSupport.java Fri Apr 15 18:18:16 2011 -0400
26.3 @@ -0,0 +1,183 @@
26.4 +package org.netbeans.modules.workflow.editor.multiview;
26.5 +
26.6 +import java.awt.EventQueue;
26.7 +import java.util.Collection;
26.8 +import java.util.Collections;
26.9 +import java.util.HashSet;
26.10 +
26.11 +import org.netbeans.core.api.multiview.MultiViewHandler;
26.12 +import org.netbeans.core.api.multiview.MultiViewPerspective;
26.13 +import org.netbeans.core.api.multiview.MultiViews;
26.14 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
26.15 +import org.netbeans.modules.xml.validation.ShowCookie;
26.16 +import org.netbeans.modules.xml.xam.Component;
26.17 +import org.netbeans.modules.xml.xam.dom.DocumentComponent;
26.18 +import org.netbeans.modules.xml.xam.spi.Validator.ResultItem;
26.19 +import org.netbeans.modules.xml.xam.ui.cookies.ViewComponentCookie;
26.20 +
26.21 +import org.openide.nodes.Node;
26.22 +import org.openide.windows.TopComponent;
26.23 +import org.openide.windows.WindowManager;
26.24 +
26.25 +public class WorkflowMultiviewSupport implements ViewComponentCookie, ShowCookie {
26.26 +
26.27 + /** The data object */
26.28 + private WorkflowDataObject dobj;
26.29 +
26.30 + /**
26.31 + * Creates a new instance of WSDLMultiViewSupport.
26.32 + *
26.33 + * @param dobj the data object.
26.34 + */
26.35 + public WorkflowMultiviewSupport(WorkflowDataObject dobj) {
26.36 + this.dobj = dobj;
26.37 + }
26.38 +
26.39 + public void view(final View view, final Component component,
26.40 + final Object... parameters) {
26.41 + if (!EventQueue.isDispatchThread()) {
26.42 + EventQueue.invokeLater(new Runnable() {
26.43 + public void run() {
26.44 + viewInSwingThread(view, component, parameters);
26.45 + }
26.46 + });
26.47 + } else {
26.48 + viewInSwingThread(view, component, parameters);
26.49 + }
26.50 + }
26.51 +
26.52 + // see schemamultiviewsupport for implementation
26.53 + private void viewInSwingThread(View view, Component component,
26.54 + Object... parameters) {
26.55 + if (canView(view,component)) {
26.56 + WorkflowEditorSupport editor = dobj.getWorkflowEditorSupport();
26.57 + editor.open();
26.58 + if (view != null) {
26.59 + switch (view) {
26.60 + case SOURCE:
26.61 + WorkflowMultiViewFactory.requestMultiviewActive(
26.62 + WorkflowSourceMultiviewDesc.PREFERRED_ID);
26.63 + break;
26.64 + case DESIGN:
26.65 + WorkflowMultiViewFactory.requestMultiviewActive(
26.66 + WorkflowDesignViewMultiViewDesc.PREFERRED_ID);
26.67 + break;
26.68 + }
26.69 + }
26.70 + TopComponent activeTC = TopComponent.getRegistry().getActivated();
26.71 + ShowCookie showCookie = activeTC.getLookup().lookup(ShowCookie.class);
26.72 + ResultItem resultItem = null;
26.73 + if (parameters != null && parameters.length != 0) {
26.74 + for (Object o : parameters) {
26.75 + if (o instanceof ResultItem) {
26.76 + resultItem = (ResultItem) o;
26.77 + break;
26.78 + }
26.79 + }
26.80 + }
26.81 + if (showCookie != null && component != null) {
26.82 + if (resultItem == null) {
26.83 + resultItem = new ResultItem(null, null, component, null);
26.84 + }
26.85 + showCookie.show(resultItem);
26.86 + }
26.87 + }
26.88 + }
26.89 +
26.90 + // see schemamultiviewsupport for implementation
26.91 + public boolean canView(ViewComponentCookie.View view, Component component) {
26.92 + if (view != null) {
26.93 + switch (view) {
26.94 + case SOURCE:
26.95 + if (!WorkflowSourceMultiviewDesc.PREFERRED_ID.equals(
26.96 + getMultiviewActive()) ||
26.97 + !getActiveComponents().contains(component)) {
26.98 + return true;
26.99 + }
26.100 + break;
26.101 + case CURRENT:
26.102 + case SUPER:
26.103 + return true;
26.104 + case DESIGN:
26.105 + if (WorkflowDesignViewMultiViewDesc.PREFERRED_ID.equals(
26.106 + getMultiviewActive())) {
26.107 + return false;
26.108 + }
26.109 +// // Determine if this type of component is displayed
26.110 +// // in the partner view or not.
26.111 +// boolean okay = false;
26.112 +// for (Class type : DESIGNABLE_COMPONENTS) {
26.113 +// if (type.isInstance(component)) {
26.114 +// return true;
26.115 +// }
26.116 +// }
26.117 + break;
26.118 + }
26.119 + }
26.120 + return false;
26.121 + }
26.122 +
26.123 + public void show(ResultItem resultItem) {
26.124 + /*View view = View.STRUCTURE;
26.125 + Component component = resultItem.getComponents();
26.126 + if (component == null || component.getModel() == null ||
26.127 + component.getModel().getState() == IEPModel.State.NOT_WELL_FORMED) {
26.128 + view(View.SOURCE,component,resultItem);
26.129 + } else {
26.130 + if (component instanceof DocumentComponent) {
26.131 + UIUtilities.annotateSourceView(dobj, (DocumentComponent) component,
26.132 + resultItem.getDescription(), false);
26.133 + }
26.134 +
26.135 + TopComponent tc = WindowManager.getDefault().getRegistry().getActivated();
26.136 + MultiViewHandler mvh = MultiViews.findMultiViewHandler(tc);
26.137 +
26.138 + if (mvh == null) {
26.139 + return;
26.140 + }
26.141 +
26.142 + MultiViewPerspective mvp = mvh.getSelectedPerspective();
26.143 + if (mvp.preferredID().equals(PlanSourceMultiviewDesc.PREFERRED_ID)) {
26.144 + view(View.SOURCE, component, resultItem);
26.145 + } else if (mvp.preferredID().equals(PlanDesignViewMultiViewDesc.PREFERRED_ID)) {
26.146 + view(View.DESIGN, component, resultItem);
26.147 + }
26.148 + }*/
26.149 + }
26.150 +
26.151 + /**
26.152 + * Finds the preferredID of active multiview element. If activated
26.153 + * TopComponent is not MultiViewTopComponent, returns null.
26.154 + *
26.155 + * @return identifier of the active multiview element.
26.156 + */
26.157 + private static String getMultiviewActive() {
26.158 + TopComponent activeTC = TopComponent.getRegistry().getActivated();
26.159 + MultiViewHandler handler = MultiViews.findMultiViewHandler(activeTC);
26.160 + if (handler != null) {
26.161 + return handler.getSelectedPerspective().preferredID();
26.162 + }
26.163 + return null;
26.164 + }
26.165 +
26.166 + /**
26.167 + * Finds the activated components of active TopComponent.
26.168 + *
26.169 + * @return collection of the active components.
26.170 + */
26.171 + private static Collection<Component> getActiveComponents() {
26.172 + TopComponent activeTC = TopComponent.getRegistry().getActivated();
26.173 + Collection<Component> activeComponents = Collections.emptySet();
26.174 + for (Node node : activeTC.getActivatedNodes()) {
26.175 + Component component = node.getLookup().lookup(Component.class);
26.176 + if (component != null) {
26.177 + if (activeComponents.isEmpty()) {
26.178 + activeComponents = new HashSet<Component>();
26.179 + }
26.180 + activeComponents.add(component);
26.181 + }
26.182 + }
26.183 + return activeComponents;
26.184 + }
26.185 +
26.186 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowSourceMultiViewElement.java Fri Apr 15 18:18:16 2011 -0400
27.3 @@ -0,0 +1,368 @@
27.4 +/*
27.5 + * The contents of this file are subject to the terms of the Common Development
27.6 + * and Distribution License (the License). You may not use this file except in
27.7 + * compliance with the License.
27.8 + *
27.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
27.10 + * or http://www.netbeans.org/cddl.txt.
27.11 + *
27.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
27.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
27.14 + * If applicable, add the following below the CDDL Header, with the fields
27.15 + * enclosed by brackets [] replaced by your own identifying information:
27.16 + * "Portions Copyrighted [year] [name of copyright owner]"
27.17 + *
27.18 + * The Original Software is NetBeans. The Initial Developer of the Original
27.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
27.20 + * Microsystems, Inc. All Rights Reserved.
27.21 + */
27.22 +
27.23 +package org.netbeans.modules.workflow.editor.multiview;
27.24 +
27.25 +import java.awt.EventQueue;
27.26 +import java.awt.event.ActionEvent;
27.27 +import java.awt.event.ActionListener;
27.28 +import java.io.IOException;
27.29 +import java.io.ObjectInput;
27.30 +import java.io.ObjectOutput;
27.31 +import java.util.List;
27.32 +
27.33 +import javax.swing.JComponent;
27.34 +import javax.swing.JEditorPane;
27.35 +import javax.swing.SwingUtilities;
27.36 +import javax.swing.Timer;
27.37 +import javax.swing.event.CaretEvent;
27.38 +import javax.swing.event.CaretListener;
27.39 +import javax.swing.text.Document;
27.40 +import javax.swing.text.StyledDocument;
27.41 +
27.42 +import org.netbeans.core.spi.multiview.CloseOperationState;
27.43 +import org.netbeans.core.spi.multiview.MultiViewElement;
27.44 +import org.netbeans.core.spi.multiview.MultiViewElementCallback;
27.45 +import org.netbeans.core.spi.multiview.MultiViewFactory;
27.46 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
27.47 +import org.netbeans.modules.xml.validation.ShowCookie;
27.48 +import org.netbeans.modules.xml.xam.Component;
27.49 +import org.netbeans.modules.xml.xam.dom.DocumentComponent;
27.50 +import org.netbeans.modules.xml.xam.spi.Validator.ResultItem;
27.51 +import org.openide.awt.UndoRedo;
27.52 +import org.openide.nodes.Node;
27.53 +import org.openide.nodes.NodeAdapter;
27.54 +import org.openide.nodes.NodeEvent;
27.55 +import org.openide.text.CloneableEditor;
27.56 +import org.openide.text.NbDocument;
27.57 +import org.openide.util.Lookup;
27.58 +import org.openide.util.RequestProcessor;
27.59 +import org.openide.util.lookup.Lookups;
27.60 +
27.61 +/**
27.62 + *
27.63 + * @author Jeri Lockhart
27.64 + */
27.65 +
27.66 +public class WorkflowSourceMultiViewElement extends CloneableEditor implements MultiViewElement {
27.67 +
27.68 + private static final long serialVersionUID = 4403502726950453345L;
27.69 +
27.70 + transient private JComponent toolbar;
27.71 + transient private MultiViewElementCallback multiViewObserver;
27.72 + private WorkflowDataObject mObj;
27.73 +
27.74 +
27.75 + // Do NOT remove. Only for externalization //
27.76 + public WorkflowSourceMultiViewElement() {
27.77 + super();
27.78 + }
27.79 +
27.80 + // Creates new editor //
27.81 + public WorkflowSourceMultiViewElement(WorkflowDataObject obj) {
27.82 + super(obj.getWorkflowEditorSupport());
27.83 + this.mObj = obj;
27.84 +
27.85 +
27.86 + // Initialize the editor support properly, which only needs to be
27.87 + // done when the editor is created (deserialization is working
27.88 + // due to CloneableEditor.readResolve() initializing the editor).
27.89 + // Note that this relies on the source view being the first in the
27.90 + // array of MultiViewDescription instances in WSDLMultiViewFactory,
27.91 + // since that results in the source view being created and opened
27.92 + // by default, only to be hidden when the DataObject default action
27.93 + // makes the tree view appear.
27.94 + // This initialization fixes CR 6380287 by ensuring that the Node
27.95 + // listener is registered with the DataObject Node delegate.
27.96 + mObj.getWorkflowEditorSupport().initializeCloneableEditor(this);
27.97 + initialize();
27.98 + }
27.99 +
27.100 + /**
27.101 + * create lookup, caretlistener, timer
27.102 + */
27.103 + private void initialize()
27.104 + {
27.105 +
27.106 + ShowCookie showCookie = new ShowCookie()
27.107 + {
27.108 +
27.109 + public void show(ResultItem resultItem) {
27.110 + /*if(isActiveTC()) {
27.111 + Component component = resultItem.getComponents();
27.112 + if (component.getModel() == null) return; //may have been deleted.
27.113 +
27.114 + UIUtilities.annotateSourceView(mObj, (DocumentComponent) component,
27.115 + resultItem.getDescription(), true);
27.116 + if(component instanceof IEPComponent) {
27.117 + int position = ((IEPComponent)component).findPosition();
27.118 + getEditorPane().setCaretPosition(position);
27.119 + } else {
27.120 + int line = resultItem.getLineNumber();
27.121 + try {
27.122 + int position = NbDocument.findLineOffset(
27.123 + (StyledDocument)getEditorPane().getDocument(),line);
27.124 + getEditorPane().setCaretPosition(position);
27.125 + } catch (IndexOutOfBoundsException iob) {
27.126 + // nothing
27.127 + }
27.128 + }
27.129 + }*/
27.130 + }
27.131 + };
27.132 +
27.133 +// create and associate lookup
27.134 + Node delegate = mObj.getNodeDelegate();
27.135 + SourceCookieProxyLookup lookup = new SourceCookieProxyLookup(new Lookup[] {
27.136 + Lookups.fixed(new Object[] {
27.137 + // Need ActionMap in lookup so editor actions work.
27.138 + getActionMap(),
27.139 + // Need the data object registered in the lookup so that the
27.140 + // projectui code will close our open editor windows when the
27.141 + // project is closed.
27.142 + mObj,
27.143 + // The Show Cookie in lookup to show schema component
27.144 + showCookie,
27.145 + }),
27.146 + },delegate);
27.147 + associateLookup(lookup);
27.148 + addPropertyChangeListener("activatedNodes", lookup);
27.149 +
27.150 + caretListener = new CaretListener() {
27.151 + public void caretUpdate(CaretEvent e) {
27.152 + timerSelNodes.restart();
27.153 + }
27.154 + };
27.155 +
27.156 + timerSelNodes = new Timer(1, new ActionListener() {
27.157 + public void actionPerformed(ActionEvent e) {
27.158 + if (!isActiveTC() || getEditorPane() == null) {
27.159 + return;
27.160 + }
27.161 + //selectElementsAtOffset();
27.162 + }
27.163 + });
27.164 + timerSelNodes.setRepeats(false);
27.165 + }
27.166 +
27.167 + public JComponent getToolbarRepresentation() {
27.168 + Document doc = getEditorPane().getDocument();
27.169 + if (doc instanceof NbDocument.CustomToolbar) {
27.170 + if (toolbar == null) {
27.171 + toolbar = ((NbDocument.CustomToolbar) doc).createToolbar(getEditorPane());
27.172 + }
27.173 + return toolbar;
27.174 + }
27.175 + return null;
27.176 + }
27.177 +
27.178 +
27.179 + @Override
27.180 + public UndoRedo getUndoRedo() {
27.181 + return mObj.getWorkflowEditorSupport().getUndoManager();
27.182 + }
27.183 +
27.184 + public JComponent getVisualRepresentation() {
27.185 + return this;
27.186 + }
27.187 +
27.188 + public void setMultiViewCallback(MultiViewElementCallback callback) {
27.189 + multiViewObserver = callback;
27.190 + }
27.191 +
27.192 + @Override
27.193 + public void requestVisible() {
27.194 + if (multiViewObserver != null)
27.195 + multiViewObserver.requestVisible();
27.196 + else
27.197 + super.requestVisible();
27.198 + }
27.199 +
27.200 + @Override
27.201 + public void requestActive() {
27.202 + if (multiViewObserver != null)
27.203 + multiViewObserver.requestActive();
27.204 + else
27.205 + super.requestActive();
27.206 + }
27.207 +
27.208 + @Override
27.209 + protected String preferredID() {
27.210 +
27.211 + return "WSDLSourceMultiViewElementTC"; // NOI18N
27.212 + }
27.213 +
27.214 +
27.215 + /* @Override
27.216 + public UndoRedo getUndoRedo() {
27.217 + return mObj.getWSDLEditorSupport().getUndoManager();
27.218 + }*/
27.219 +
27.220 + /**
27.221 + * The close last method should be called only for the last clone.
27.222 + * If there are still existing clones this method must return false. The
27.223 + * implementation from the FormEditor always returns true but this is
27.224 + * not the expected behavior. The intention is to close the editor support
27.225 + * once the last editor has been closed, using the silent close to avoid
27.226 + * displaying a new dialog which is already being displayed via the
27.227 + * close handler.
27.228 + */
27.229 + @Override
27.230 + protected boolean closeLast() {
27.231 + WorkflowEditorSupport support = mObj.getWorkflowEditorSupport();
27.232 + JEditorPane[] editors = support.getOpenedPanes();
27.233 + if (editors == null || editors.length == 0) {
27.234 + return support.silentClose();
27.235 + }
27.236 + return false;
27.237 + }
27.238 +
27.239 + public CloseOperationState canCloseElement() {
27.240 + // if this is not the last cloned xml editor component, closing is OK
27.241 + if (!WorkflowEditorSupport.isLastView(multiViewObserver.getTopComponent())) {
27.242 + return CloseOperationState.STATE_OK;
27.243 + }
27.244 + // return a placeholder state - to be sure our CloseHandler is called
27.245 + return MultiViewFactory.createUnsafeCloseState(
27.246 + "ID_TEXT_CLOSING", // dummy ID // NOI18N
27.247 + MultiViewFactory.NOOP_CLOSE_ACTION,
27.248 + MultiViewFactory.NOOP_CLOSE_ACTION);
27.249 + }
27.250 +
27.251 + @Override
27.252 + public void componentActivated() {
27.253 + JEditorPane p = getEditorPane();
27.254 + if (p != null) {
27.255 + p.addCaretListener(caretListener);
27.256 + }
27.257 + if(timerSelNodes!=null) {
27.258 + timerSelNodes.restart();
27.259 + }
27.260 + super.componentActivated();
27.261 + WorkflowEditorSupport editor = mObj.getWorkflowEditorSupport();
27.262 + editor.addUndoManagerToDocument();
27.263 + }
27.264 + @Override
27.265 + public void componentDeactivated() {
27.266 + // Note: componentDeactivated() is called when the entire
27.267 + // MultiViewTopComponent is deactivated, _not_ when switching
27.268 + // between the multiview elements.
27.269 + JEditorPane p = getEditorPane();
27.270 + if (p != null) {
27.271 + p.removeCaretListener(caretListener);
27.272 + }
27.273 + synchronized (this) {
27.274 + if (selectionTask != null) {
27.275 + selectionTask.cancel();
27.276 + selectionTask = null;
27.277 + }
27.278 + }
27.279 + if(timerSelNodes!=null) {
27.280 + timerSelNodes.stop();
27.281 + }
27.282 + super.componentDeactivated();
27.283 + WorkflowEditorSupport editor = mObj.getWorkflowEditorSupport();
27.284 + // Sync model before having undo manager listen to the model,
27.285 + // lest we get redundant undoable edits added to the queue.
27.286 + editor.syncModel();
27.287 + editor.removeUndoManagerFromDocument();
27.288 + }
27.289 +
27.290 + @Override
27.291 + public void componentOpened() {
27.292 + super.componentOpened();
27.293 + }
27.294 +
27.295 +
27.296 + /*
27.297 + * In other non-multiview editors, the text editor is the one that is docked into the editor mode.
27.298 + * and super.canClose() returns true and schedules the clean up of editor kit,
27.299 + * which in turn calls uninstallUI in NbEditorUI class.
27.300 + *
27.301 + * In our case, we need to explicitly call setEditorKit(null), so that uninstallUI gets called.
27.302 + * So our editor gets removed from different caches and propertychangesupports.
27.303 + *
27.304 + * (non-Javadoc)
27.305 + * @see org.openide.text.CloneableEditor#componentClosed()
27.306 + */
27.307 + @Override
27.308 + public void componentClosed() {
27.309 + super.componentClosed();
27.310 + multiViewObserver = null;
27.311 + }
27.312 +
27.313 + @Override
27.314 + public void componentShowing() {
27.315 + super.componentShowing();
27.316 + WorkflowEditorSupport editor = mObj.getWorkflowEditorSupport();
27.317 + editor.addUndoManagerToDocument();
27.318 + }
27.319 +
27.320 + @Override
27.321 + public void componentHidden() {
27.322 + super.componentHidden();
27.323 + WorkflowEditorSupport editor = mObj.getWorkflowEditorSupport();
27.324 + // Sync model before having undo manager listen to the model,
27.325 + // lest we get redundant undoable edits added to the queue.
27.326 + editor.syncModel();
27.327 + editor.removeUndoManagerFromDocument();
27.328 + }
27.329 +
27.330 + @Override
27.331 + public void writeExternal(ObjectOutput out) throws IOException {
27.332 + super.writeExternal(out);
27.333 + out.writeObject(mObj);
27.334 + }
27.335 +
27.336 + @Override
27.337 + public void readExternal(ObjectInput in)
27.338 + throws IOException, ClassNotFoundException {
27.339 + super.readExternal(in);
27.340 + Object firstObject = in.readObject();
27.341 + if (firstObject instanceof WorkflowDataObject) {
27.342 + mObj = (WorkflowDataObject) firstObject;
27.343 + initialize();
27.344 + }
27.345 + }
27.346 +
27.347 + // node support
27.348 + /** Root node of schema model */
27.349 + private Node rootNode;
27.350 + /** current selection*/
27.351 + private Node selectedNode;
27.352 + /** listens to selected node destroyed event */
27.353 + private NodeAdapter nl;
27.354 + /** Timer which countdowns the "update selected element node" time. */
27.355 + private Timer timerSelNodes;
27.356 + /** Listener on caret movements */
27.357 + private CaretListener caretListener;
27.358 + /* task */
27.359 + private transient RequestProcessor.Task selectionTask = null;
27.360 + /** Selects element at the caret position. */
27.361 +
27.362 +
27.363 +
27.364 +
27.365 + protected boolean isActiveTC() {
27.366 + if (multiViewObserver != null)
27.367 + return getRegistry().getActivated() == multiViewObserver.getTopComponent();
27.368 +
27.369 + return false;
27.370 + }
27.371 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/multiview/WorkflowSourceMultiviewDesc.java Fri Apr 15 18:18:16 2011 -0400
28.3 @@ -0,0 +1,98 @@
28.4 +/*
28.5 + * The contents of this file are subject to the terms of the Common Development
28.6 + * and Distribution License (the License). You may not use this file except in
28.7 + * compliance with the License.
28.8 + *
28.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
28.10 + * or http://www.netbeans.org/cddl.txt.
28.11 + *
28.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
28.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
28.14 + * If applicable, add the following below the CDDL Header, with the fields
28.15 + * enclosed by brackets [] replaced by your own identifying information:
28.16 + * "Portions Copyrighted [year] [name of copyright owner]"
28.17 + *
28.18 + * The Original Software is NetBeans. The Initial Developer of the Original
28.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
28.20 + * Microsystems, Inc. All Rights Reserved.
28.21 + */
28.22 +
28.23 +package org.netbeans.modules.workflow.editor.multiview;
28.24 +
28.25 +import java.io.IOException;
28.26 +import java.io.ObjectInput;
28.27 +import java.io.ObjectOutput;
28.28 +import java.io.Serializable;
28.29 +
28.30 +import org.netbeans.core.spi.multiview.MultiViewDescription;
28.31 +import org.netbeans.core.spi.multiview.MultiViewFactory;
28.32 +import org.netbeans.modules.workflow.editor.dataloader.WorkflowDataObject;
28.33 +import org.openide.util.NbBundle;
28.34 +import org.openide.util.Utilities;
28.35 +import org.openide.windows.TopComponent;
28.36 +/**
28.37 + *
28.38 + * @author Jeri Lockhart
28.39 + */
28.40 +public class WorkflowSourceMultiviewDesc
28.41 + implements MultiViewDescription, Serializable {
28.42 +
28.43 +
28.44 + private static final long serialVersionUID = -4505309173196320880L;
28.45 + public static final String PREFERRED_ID = "wsdl-sourceview";
28.46 + private WorkflowDataObject workflowDataObject;
28.47 +
28.48 + // Constructor for reserialization
28.49 + public WorkflowSourceMultiviewDesc( ) {
28.50 + }
28.51 +
28.52 + /**
28.53 + * Creates a new instance of WSDLSourceMultiviewDesc
28.54 + */
28.55 + public WorkflowSourceMultiviewDesc(WorkflowDataObject wsdlDataObject) {
28.56 + this.workflowDataObject = wsdlDataObject;
28.57 + }
28.58 +
28.59 + public String preferredID() {
28.60 + return PREFERRED_ID;
28.61 + }
28.62 +
28.63 + public int getPersistenceType() {
28.64 + return TopComponent.PERSISTENCE_ONLY_OPENED;
28.65 + }
28.66 +
28.67 + public java.awt.Image getIcon() {
28.68 + return Utilities.loadImage(WorkflowDataObject.WORKFLOW_ICON_BASE_WITH_EXT);
28.69 + }
28.70 +
28.71 + public org.openide.util.HelpCtx getHelpCtx() {
28.72 + return org.openide.util.HelpCtx.DEFAULT_HELP;
28.73 + }
28.74 +
28.75 + public String getDisplayName() {
28.76 + return NbBundle.getMessage(WorkflowSourceMultiviewDesc.class, "LBL_sourceView_name");
28.77 + }
28.78 +
28.79 + public org.netbeans.core.spi.multiview.MultiViewElement createElement() {
28.80 + WorkflowEditorSupport editorSupport = workflowDataObject.getWorkflowEditorSupport();
28.81 + if (editorSupport != null) {
28.82 + WorkflowSourceMultiViewElement editorComponent = new WorkflowSourceMultiViewElement(workflowDataObject);
28.83 + return editorComponent;
28.84 + }
28.85 + return MultiViewFactory.BLANK_ELEMENT;
28.86 +
28.87 + }
28.88 +
28.89 + public void writeExternal(ObjectOutput out) throws IOException {
28.90 + out.writeObject(workflowDataObject);
28.91 + }
28.92 +
28.93 + public void readExternal(ObjectInput in)
28.94 + throws IOException, ClassNotFoundException
28.95 + {
28.96 + Object firstObject = in.readObject();
28.97 + if (firstObject instanceof WorkflowDataObject)
28.98 + workflowDataObject = (WorkflowDataObject) firstObject;
28.99 + }
28.100 +
28.101 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
29.3 @@ -0,0 +1,32 @@
29.4 +# The contents of this file are subject to the terms of the Common Development
29.5 +# and Distribution License (the License). You may not use this file except in
29.6 +# compliance with the License.
29.7 +#
29.8 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
29.9 +# or http://www.netbeans.org/cddl.txt.
29.10 +
29.11 +#
29.12 +# The contents of this file are subject to the terms of the Common Development
29.13 +# and Distribution License (the License). You may not use this file except in
29.14 +# compliance with the License.
29.15 +#
29.16 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
29.17 +# or http://www.netbeans.org/cddl.txt.
29.18 +#
29.19 +# When distributing Covered Code, include this CDDL Header Notice in each file
29.20 +# and include the License file at http://www.netbeans.org/cddl.txt.
29.21 +# If applicable, add the following below the CDDL Header, with the fields
29.22 +# enclosed by brackets [] replaced by your own identifying information:
29.23 +# "Portions Copyrighted [year] [name of copyright owner]"
29.24 +#
29.25 +# The Original Software is NetBeans. The Initial Developer of the Original
29.26 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
29.27 +# Microsystems, Inc. All Rights Reserved.
29.28 +#
29.29 +
29.30 +#Workflow Palette: Actions
29.31 +ACT_OpenWorkflowCustomizer=&Workflow Components
29.32 +
29.33 +
29.34 +#workflow palette: categories
29.35 +WorkflowPalette/events=Events
29.36 \ No newline at end of file
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/PaletteItemConstants.java Fri Apr 15 18:18:16 2011 -0400
30.3 @@ -0,0 +1,54 @@
30.4 +/*
30.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
30.6 + *
30.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
30.8 + *
30.9 + * The contents of this file are subject to the terms of either the GNU
30.10 + * General Public License Version 2 only ("GPL") or the Common
30.11 + * Development and Distribution License("CDDL") (collectively, the
30.12 + * "License"). You may not use this file except in compliance with the
30.13 + * License. You can obtain a copy of the License at
30.14 + * http://www.netbeans.org/cddl-gplv2.html
30.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
30.16 + * specific language governing permissions and limitations under the
30.17 + * License. When distributing the software, include this License Header
30.18 + * Notice in each file and include the License file at
30.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
30.20 + * particular file as subject to the "Classpath" exception as provided
30.21 + * by Sun in the GPL Version 2 section of the License file that
30.22 + * accompanied this code. If applicable, add the following below the
30.23 + * License Header, with the fields enclosed by brackets [] replaced by
30.24 + * your own identifying information:
30.25 + * "Portions Copyrighted [year] [name of copyright owner]"
30.26 + *
30.27 + * If you wish your version of this file to be governed by only the CDDL
30.28 + * or only the GPL Version 2, indicate your decision by adding
30.29 + * "[Contributor] elects to include this software in this distribution
30.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
30.31 + * single choice of license, a recipient has the option to distribute
30.32 + * your version of this file under either the CDDL, the GPL Version 2 or
30.33 + * to extend the choice of license to its licensees as provided above.
30.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
30.35 + * Version 2 license, then the option applies only if the new code is
30.36 + * made subject to such option by the copyright holder.
30.37 + *
30.38 + * Contributor(s):
30.39 + *
30.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
30.41 + */
30.42 +
30.43 +package org.netbeans.modules.workflow.editor.palette;
30.44 +
30.45 +/**
30.46 + *
30.47 + * @author radval
30.48 + */
30.49 +public class PaletteItemConstants {
30.50 +
30.51 + public static final String WIDGET_START_EVENT = "StartEvent";
30.52 +
30.53 + public static final String WIDGET_INTERMEDIATE_EVENT = "IntermediateEvent";
30.54 +
30.55 + public static final String WIDGET_END_EVENT = "EndEvent";
30.56 +
30.57 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/WorkflowActiveEditorDrop.java Fri Apr 15 18:18:16 2011 -0400
31.3 @@ -0,0 +1,50 @@
31.4 +/*
31.5 + * The contents of this file are subject to the terms of the Common Development
31.6 + * and Distribution License (the License). You may not use this file except in
31.7 + * compliance with the License.
31.8 + *
31.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
31.10 + * or http://www.netbeans.org/cddl.txt.
31.11 + *
31.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
31.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
31.14 + * If applicable, add the following below the CDDL Header, with the fields
31.15 + * enclosed by brackets [] replaced by your own identifying information:
31.16 + * "Portions Copyrighted [year] [name of copyright owner]"
31.17 + *
31.18 + * The Original Software is NetBeans. The Initial Developer of the Original
31.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
31.20 + * Microsystems, Inc. All Rights Reserved.
31.21 + */
31.22 +
31.23 +
31.24 +package org.netbeans.modules.workflow.editor.palette;
31.25 +import javax.swing.text.BadLocationException;
31.26 +import javax.swing.text.JTextComponent;
31.27 +import org.openide.text.ActiveEditorDrop;
31.28 +
31.29 +
31.30 +
31.31 +/*
31.32 + *
31.33 + */
31.34 +public class WorkflowActiveEditorDrop implements ActiveEditorDrop {
31.35 +
31.36 + protected String mPath;
31.37 +
31.38 + public WorkflowActiveEditorDrop() {
31.39 + }
31.40 +
31.41 + public WorkflowActiveEditorDrop(String path) {
31.42 + mPath = path;
31.43 + }
31.44 +
31.45 + public boolean handleTransfer(JTextComponent targetComponent) {
31.46 + return true;
31.47 + }
31.48 +
31.49 + public String getComponentName() {
31.50 + return mPath;
31.51 + }
31.52 +
31.53 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/WorkflowDragAndDropHandler.java Fri Apr 15 18:18:16 2011 -0400
32.3 @@ -0,0 +1,88 @@
32.4 +/*
32.5 + * The contents of this file are subject to the terms of the Common Development
32.6 + * and Distribution License (the License). You may not use this file except in
32.7 + * compliance with the License.
32.8 + *
32.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
32.10 + * or http://www.netbeans.org/cddl.txt.
32.11 + *
32.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
32.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
32.14 + * If applicable, add the following below the CDDL Header, with the fields
32.15 + * enclosed by brackets [] replaced by your own identifying information:
32.16 + * "Portions Copyrighted [year] [name of copyright owner]"
32.17 + *
32.18 + * The Original Software is NetBeans. The Initial Developer of the Original
32.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
32.20 + * Microsystems, Inc. All Rights Reserved.
32.21 + */
32.22 +
32.23 +
32.24 +package org.netbeans.modules.workflow.editor.palette;
32.25 +
32.26 +import java.awt.datatransfer.DataFlavor;
32.27 +import java.awt.datatransfer.Transferable;
32.28 +import org.netbeans.spi.palette.DragAndDropHandler;
32.29 +import org.openide.text.ActiveEditorDrop;
32.30 +import org.openide.util.Lookup;
32.31 +import org.openide.util.datatransfer.ExTransferable;
32.32 +
32.33 +/*
32.34 + *
32.35 + */
32.36 +public class WorkflowDragAndDropHandler extends DragAndDropHandler {
32.37 + private static final java.util.logging.Logger mLog = java.util.logging.Logger.getLogger(WorkflowDragAndDropHandler.class.getName());
32.38 +
32.39 + /**
32.40 + * <code>DataFlavor</code> of palette items dragged from palette to editor.
32.41 + * The trasfer data returned from <code>Transferable</code> for this
32.42 + * <code>DataFlavor</code> is the <code>Lookup</code> of the <code>Node</code>
32.43 + * representing the palette item being dragged.
32.44 + */
32.45 + public static final DataFlavor ITEM_DATA_FLAVOR;
32.46 + static {
32.47 + try {
32.48 + ITEM_DATA_FLAVOR = new DataFlavor("text/active_editor_flavor;class=org.netbeans.modules.workflow.editor.palette.WorkflowActiveEditorDrop", // NOI18N
32.49 + "Paste Item", // XXX missing I18N!
32.50 + Lookup.class.getClassLoader());
32.51 + } catch (ClassNotFoundException e) {
32.52 + throw new AssertionError(e);
32.53 + }
32.54 + }
32.55 +
32.56 + public WorkflowDragAndDropHandler() {
32.57 + }
32.58 +
32.59 + public void customize(ExTransferable t, Lookup item) {
32.60 + WorkflowActiveEditorDrop activeDrop = (WorkflowActiveEditorDrop) item.lookup(WorkflowActiveEditorDrop.class);
32.61 + mLog.info("WorkflowActiveEditorDrop: " + activeDrop);
32.62 + PaletteItemTransferable s = new PaletteItemTransferable(activeDrop);
32.63 + t.put(s);
32.64 + }
32.65 +
32.66 + public boolean canDrop(Lookup targetCategory, DataFlavor[] flavors, int dndAction) {
32.67 + return false;
32.68 + }
32.69 +
32.70 + public boolean doDrop(Lookup targetCategory, Transferable item, int dndAction, int dropIndex) {
32.71 + return false;
32.72 + }
32.73 +
32.74 + private static class PaletteItemTransferable extends ExTransferable.Single {
32.75 +
32.76 + private WorkflowActiveEditorDrop drop;
32.77 +
32.78 + PaletteItemTransferable(WorkflowActiveEditorDrop drop) {
32.79 + super(ITEM_DATA_FLAVOR);
32.80 + this.drop = drop;
32.81 + }
32.82 +
32.83 + public Object getData () {
32.84 + return drop;
32.85 + }
32.86 +
32.87 + }
32.88 +
32.89 +}
32.90 +
32.91 +
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/WorkflowPaletteActions.java Fri Apr 15 18:18:16 2011 -0400
33.3 @@ -0,0 +1,80 @@
33.4 +/*
33.5 + * The contents of this file are subject to the terms of the Common Development
33.6 + * and Distribution License (the License). You may not use this file except in
33.7 + * compliance with the License.
33.8 + *
33.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
33.10 + * or http://www.netbeans.org/cddl.txt.
33.11 + *
33.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
33.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
33.14 + * If applicable, add the following below the CDDL Header, with the fields
33.15 + * enclosed by brackets [] replaced by your own identifying information:
33.16 + * "Portions Copyrighted [year] [name of copyright owner]"
33.17 + *
33.18 + * The Original Software is NetBeans. The Initial Developer of the Original
33.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
33.20 + * Microsystems, Inc. All Rights Reserved.
33.21 + */
33.22 +
33.23 +
33.24 +package org.netbeans.modules.workflow.editor.palette;
33.25 +
33.26 +import javax.swing.Action;
33.27 +import org.netbeans.spi.palette.PaletteActions;
33.28 +import org.openide.util.Lookup;
33.29 +
33.30 +/*
33.31 + *
33.32 + */
33.33 +public class WorkflowPaletteActions extends PaletteActions {
33.34 +
33.35 + /** Creates a new instance of FormPaletteProvider */
33.36 + public WorkflowPaletteActions() {
33.37 + }
33.38 +
33.39 + /**
33.40 + * @return An array of action that will be used to construct buttons for import
33.41 + * of new palette item in palette manager window.
33.42 + *
33.43 + */
33.44 + public Action[] getImportActions() {
33.45 + return new Action[0]; //TODO implement this
33.46 + }
33.47 +
33.48 + /**
33.49 + * @param category Lookup representing palette's category.
33.50 + *
33.51 + * @return Custom actions to be added to the top of default popup menu for the given category.
33.52 + */
33.53 + public Action[] getCustomCategoryActions(Lookup category) {
33.54 + return new Action[0]; //TODO implement this
33.55 + }
33.56 +
33.57 + /**
33.58 + * @param item Lookup representing palette's item.
33.59 + *
33.60 + * @return Custom actions to be added to the top of the default popup menu for the given palette item.
33.61 + */
33.62 + public Action[] getCustomItemActions(Lookup item) {
33.63 + return new Action[0]; //TODO implement this
33.64 + }
33.65 +
33.66 + /**
33.67 + * @return Custom actions to be added to the top of palette's default popup menu.
33.68 + */
33.69 + public Action[] getCustomPaletteActions() {
33.70 + return new Action[0]; //TODO implement this
33.71 + }
33.72 +
33.73 + /**
33.74 + * @param item Lookup representing palette's item.
33.75 + *
33.76 + * @return An action to be invoked when user double-clicks the item in the
33.77 + * palette (e.g. insert item at editor's default location).
33.78 + * Return null to disable preferred action for this item.
33.79 + */
33.80 + public Action getPreferredAction( Lookup item ) {
33.81 + return null;
33.82 + }
33.83 +}
33.84 \ No newline at end of file
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/WorkflowPaletteCustomizerAction.java Fri Apr 15 18:18:16 2011 -0400
34.3 @@ -0,0 +1,77 @@
34.4 +/*
34.5 + * The contents of this file are subject to the terms of the Common Development
34.6 + * and Distribution License (the License). You may not use this file except in
34.7 + * compliance with the License.
34.8 + *
34.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
34.10 + * or http://www.netbeans.org/cddl.txt.
34.11 + *
34.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
34.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
34.14 + * If applicable, add the following below the CDDL Header, with the fields
34.15 + * enclosed by brackets [] replaced by your own identifying information:
34.16 + * "Portions Copyrighted [year] [name of copyright owner]"
34.17 + *
34.18 + * The Original Software is NetBeans. The Initial Developer of the Original
34.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
34.20 + * Microsystems, Inc. All Rights Reserved.
34.21 + */
34.22 +
34.23 +package org.netbeans.modules.workflow.editor.palette;
34.24 +
34.25 +import java.io.IOException;
34.26 +import org.openide.ErrorManager;
34.27 +import org.openide.util.HelpCtx;
34.28 +import org.openide.util.NbBundle;
34.29 +import org.openide.util.actions.CallableSystemAction;
34.30 +
34.31 +/**
34.32 + *
34.33 + *
34.34 + * Created on November 20, 2005, 1:54 PM
34.35 + *
34.36 + *
34.37 + *
34.38 + */
34.39 +public class WorkflowPaletteCustomizerAction extends CallableSystemAction {
34.40 +
34.41 + private static String name;
34.42 +
34.43 + public WorkflowPaletteCustomizerAction () {
34.44 + putValue("noIconInMenu", Boolean.TRUE); // NOI18N
34.45 + }
34.46 +
34.47 + protected boolean asynchronous() {
34.48 + return false;
34.49 + }
34.50 +
34.51 + /**
34.52 + * Human presentable name of the action. This should be
34.53 + * presented as an item in a menu.
34.54 + * @return the name of the action
34.55 + */
34.56 + public String getName() {
34.57 + if (name == null)
34.58 + name = NbBundle.getBundle(WorkflowPaletteCustomizerAction.class).getString("ACT_OpenWorkflowCustomizer"); // NOI18N
34.59 +
34.60 + return name;
34.61 + }
34.62 +
34.63 + /**
34.64 + * Help context where to find more about the action.
34.65 + * @return the help context for this action
34.66 + */
34.67 + public HelpCtx getHelpCtx() {
34.68 + return null;
34.69 + }
34.70 +
34.71 + /**
34.72 + * This method is called by one of the "invokers" as a result of
34.73 + * some user's action that should lead to actual "performing" of the action.
34.74 + */
34.75 + public void performAction() {
34.76 + WorkflowPaletteFactory.getPalette().showCustomizer();
34.77 +
34.78 + }
34.79 +
34.80 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/WorkflowPaletteFactory.java Fri Apr 15 18:18:16 2011 -0400
35.3 @@ -0,0 +1,53 @@
35.4 +/*
35.5 + * The contents of this file are subject to the terms of the Common Development
35.6 + * and Distribution License (the License). You may not use this file except in
35.7 + * compliance with the License.
35.8 + *
35.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
35.10 + * or http://www.netbeans.org/cddl.txt.
35.11 + *
35.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
35.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
35.14 + * If applicable, add the following below the CDDL Header, with the fields
35.15 + * enclosed by brackets [] replaced by your own identifying information:
35.16 + * "Portions Copyrighted [year] [name of copyright owner]"
35.17 + *
35.18 + * The Original Software is NetBeans. The Initial Developer of the Original
35.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
35.20 + * Microsystems, Inc. All Rights Reserved.
35.21 + */
35.22 +
35.23 +package org.netbeans.modules.workflow.editor.palette;
35.24 +
35.25 +
35.26 +import java.io.IOException;
35.27 +import org.netbeans.spi.palette.PaletteController;
35.28 +import org.netbeans.spi.palette.PaletteFactory;
35.29 +
35.30 +
35.31 +/**
35.32 + *
35.33 + *
35.34 + *
35.35 + *
35.36 + *
35.37 + */
35.38 +public class WorkflowPaletteFactory {
35.39 +
35.40 + public static final String WORKFLOW_PALETTE_FOLDER = "WorkflowPalette";
35.41 +
35.42 + private static PaletteController palette = null;
35.43 +
35.44 + public static PaletteController getPalette() {
35.45 + try {
35.46 + if (palette == null)
35.47 + palette = PaletteFactory.createPalette(WORKFLOW_PALETTE_FOLDER, new WorkflowPaletteActions(), null, new WorkflowDragAndDropHandler());
35.48 +
35.49 + } catch (IOException e) {
35.50 + e.printStackTrace();
35.51 + }
35.52 +
35.53 + return palette;
35.54 + }
35.55 +
35.56 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
36.3 @@ -0,0 +1,49 @@
36.4 +# The contents of this file are subject to the terms of the Common Development
36.5 +# and Distribution License (the License). You may not use this file except in
36.6 +# compliance with the License.
36.7 +#
36.8 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
36.9 +# or http://www.netbeans.org/cddl.txt.
36.10 +
36.11 +#
36.12 +# The contents of this file are subject to the terms of the Common Development
36.13 +# and Distribution License (the License). You may not use this file except in
36.14 +# compliance with the License.
36.15 +#
36.16 +# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
36.17 +# or http://www.netbeans.org/cddl.txt.
36.18 +#
36.19 +# When distributing Covered Code, include this CDDL Header Notice in each file
36.20 +# and include the License file at http://www.netbeans.org/cddl.txt.
36.21 +# If applicable, add the following below the CDDL Header, with the fields
36.22 +# enclosed by brackets [] replaced by your own identifying information:
36.23 +# "Portions Copyrighted [year] [name of copyright owner]"
36.24 +#
36.25 +# The Original Software is NetBeans. The Initial Developer of the Original
36.26 +# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
36.27 +# Microsystems, Inc. All Rights Reserved.
36.28 +#
36.29 +
36.30 +NAME_html-startEvent=Start Event
36.31 +HINT_html-startEvent=\
36.32 +<html>\
36.33 +<b>Start Event</b><br>\
36.34 + indicates where a particular process will start.<br>\
36.35 +</html>\
36.36 +
36.37 +NAME_html-IntermediateEvent=Intermediate Event
36.38 +HINT_html-IntermediateEvent=\
36.39 +<html>\
36.40 +<b>Intermediate Event</b><br>\
36.41 +occur between a Start Event and an End Event. <br>\
36.42 +It will affect the flow of the process, <br>\
36.43 +but will not start or (directly) terminate the process.<br>\
36.44 +</html>\
36.45 +
36.46 +NAME_html-EndEvent=End Event
36.47 +HINT_html-EndEvent=\
36.48 +<html>\
36.49 +<b>End Event</b><br>\
36.50 +indicates where a process will end. <br>\
36.51 +</html>\
36.52 +
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/EndEvent.java Fri Apr 15 18:18:16 2011 -0400
37.3 @@ -0,0 +1,38 @@
37.4 +/*
37.5 + * The contents of this file are subject to the terms of the Common Development
37.6 + * and Distribution License (the License). You may not use this file except in
37.7 + * compliance with the License.
37.8 + *
37.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
37.10 + * or http://www.netbeans.org/cddl.txt.
37.11 + *
37.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
37.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
37.14 + * If applicable, add the following below the CDDL Header, with the fields
37.15 + * enclosed by brackets [] replaced by your own identifying information:
37.16 + * "Portions Copyrighted [year] [name of copyright owner]"
37.17 + *
37.18 + * The Original Software is NetBeans. The Initial Developer of the Original
37.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
37.20 + * Microsystems, Inc. All Rights Reserved.
37.21 + */
37.22 +
37.23 +package org.netbeans.modules.workflow.editor.palette.items.events;
37.24 +
37.25 +import org.netbeans.modules.workflow.editor.palette.PaletteItemConstants;
37.26 +import org.netbeans.modules.workflow.editor.palette.WorkflowActiveEditorDrop;
37.27 +
37.28 +
37.29 +/*
37.30 + *
37.31 + */
37.32 +public class EndEvent extends WorkflowActiveEditorDrop {
37.33 +
37.34 + /**
37.35 + * Creates a new instance of TupleBasedAggregator
37.36 + */
37.37 + public EndEvent() {
37.38 + mPath = PaletteItemConstants.WIDGET_END_EVENT;
37.39 + }
37.40 +
37.41 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/EndEvent.xml Fri Apr 15 18:18:16 2011 -0400
38.3 @@ -0,0 +1,30 @@
38.4 +<?xml version="1.0" encoding="UTF-8"?>
38.5 +<!--
38.6 + The contents of this file are subject to the terms of the Common Development
38.7 + and Distribution License (the License). You may not use this file except in
38.8 + compliance with the License.
38.9 +
38.10 + You can obtain a copy of the License at http://www.netbeans.org/cddl.html
38.11 + or http://www.netbeans.org/cddl.txt.
38.12 +
38.13 + When distributing Covered Code, include this CDDL Header Notice in each file
38.14 + and include the License file at http://www.netbeans.org/cddl.txt.
38.15 + If applicable, add the following below the CDDL Header, with the fields
38.16 + enclosed by brackets [] replaced by your own identifying information:
38.17 + "Portions Copyrighted [year] [name of copyright owner]"
38.18 +
38.19 + The Original Software is NetBeans. The Initial Developer of the Original
38.20 + Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
38.21 + Microsystems, Inc. All Rights Reserved.
38.22 +-->
38.23 +<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
38.24 +
38.25 +<editor_palette_item version="1.0">
38.26 + <class name="org.netbeans.modules.workflow.editor.palette.items.events.EndEvent"/>
38.27 +
38.28 + <icon16 urlvalue="org/netbeans/modules/workflow/editor/palette/items/events/resources/images/endx16.PNG" />
38.29 + <icon32 urlvalue="org/netbeans/modules/workflow/editor/palette/items/events/resources/images/endx32.PNG" />
38.30 + <description localizing-bundle="org.netbeans.modules.workflow.editor.palette.items.events.Bundle"
38.31 + display-name-key="NAME_html-EndEvent"
38.32 + tooltip-key="HINT_html-EndEvent" />
38.33 +</editor_palette_item>
38.34 \ No newline at end of file
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/IntermediateEvent.java Fri Apr 15 18:18:16 2011 -0400
39.3 @@ -0,0 +1,38 @@
39.4 +/*
39.5 + * The contents of this file are subject to the terms of the Common Development
39.6 + * and Distribution License (the License). You may not use this file except in
39.7 + * compliance with the License.
39.8 + *
39.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
39.10 + * or http://www.netbeans.org/cddl.txt.
39.11 + *
39.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
39.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
39.14 + * If applicable, add the following below the CDDL Header, with the fields
39.15 + * enclosed by brackets [] replaced by your own identifying information:
39.16 + * "Portions Copyrighted [year] [name of copyright owner]"
39.17 + *
39.18 + * The Original Software is NetBeans. The Initial Developer of the Original
39.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
39.20 + * Microsystems, Inc. All Rights Reserved.
39.21 + */
39.22 +
39.23 +package org.netbeans.modules.workflow.editor.palette.items.events;
39.24 +
39.25 +import org.netbeans.modules.workflow.editor.palette.PaletteItemConstants;
39.26 +import org.netbeans.modules.workflow.editor.palette.WorkflowActiveEditorDrop;
39.27 +
39.28 +
39.29 +/*
39.30 + *
39.31 + */
39.32 +public class IntermediateEvent extends WorkflowActiveEditorDrop {
39.33 +
39.34 + /**
39.35 + * Creates a new instance of TimeBasedAggregator
39.36 + */
39.37 + public IntermediateEvent() {
39.38 + mPath = PaletteItemConstants.WIDGET_INTERMEDIATE_EVENT;
39.39 + }
39.40 +
39.41 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/IntermediateEvent.xml Fri Apr 15 18:18:16 2011 -0400
40.3 @@ -0,0 +1,30 @@
40.4 +<?xml version="1.0" encoding="UTF-8"?>
40.5 +<!--
40.6 + The contents of this file are subject to the terms of the Common Development
40.7 + and Distribution License (the License). You may not use this file except in
40.8 + compliance with the License.
40.9 +
40.10 + You can obtain a copy of the License at http://www.netbeans.org/cddl.html
40.11 + or http://www.netbeans.org/cddl.txt.
40.12 +
40.13 + When distributing Covered Code, include this CDDL Header Notice in each file
40.14 + and include the License file at http://www.netbeans.org/cddl.txt.
40.15 + If applicable, add the following below the CDDL Header, with the fields
40.16 + enclosed by brackets [] replaced by your own identifying information:
40.17 + "Portions Copyrighted [year] [name of copyright owner]"
40.18 +
40.19 + The Original Software is NetBeans. The Initial Developer of the Original
40.20 + Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
40.21 + Microsystems, Inc. All Rights Reserved.
40.22 +-->
40.23 +<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
40.24 +
40.25 +<editor_palette_item version="1.0">
40.26 + <class name="org.netbeans.modules.workflow.editor.palette.items.events.IntermediateEvent"/>
40.27 +
40.28 + <icon16 urlvalue="org/netbeans/modules/workflow/editor/palette/items/events/resources/images/intermediatex16.PNG" />
40.29 + <icon32 urlvalue="org/netbeans/modules/workflow/editor/palette/items/events/resources/images/intermediatex32.PNG" />
40.30 + <description localizing-bundle="org.netbeans.modules.workflow.editor.palette.items.events.Bundle"
40.31 + display-name-key="NAME_html-IntermediateEvent"
40.32 + tooltip-key="HINT_html-IntermediateEvent" />
40.33 +</editor_palette_item>
40.34 \ No newline at end of file
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/StartEvent.java Fri Apr 15 18:18:16 2011 -0400
41.3 @@ -0,0 +1,39 @@
41.4 +/*
41.5 + * The contents of this file are subject to the terms of the Common Development
41.6 + * and Distribution License (the License). You may not use this file except in
41.7 + * compliance with the License.
41.8 + *
41.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
41.10 + * or http://www.netbeans.org/cddl.txt.
41.11 + *
41.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
41.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
41.14 + * If applicable, add the following below the CDDL Header, with the fields
41.15 + * enclosed by brackets [] replaced by your own identifying information:
41.16 + * "Portions Copyrighted [year] [name of copyright owner]"
41.17 + *
41.18 + * The Original Software is NetBeans. The Initial Developer of the Original
41.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
41.20 + * Microsystems, Inc. All Rights Reserved.
41.21 + */
41.22 +
41.23 +package org.netbeans.modules.workflow.editor.palette.items.events;
41.24 +
41.25 +import org.netbeans.modules.workflow.editor.palette.PaletteItemConstants;
41.26 +import org.netbeans.modules.workflow.editor.palette.WorkflowActiveEditorDrop;
41.27 +
41.28 +
41.29 +
41.30 +/*
41.31 + *
41.32 + */
41.33 +public class StartEvent extends WorkflowActiveEditorDrop {
41.34 +
41.35 + /**
41.36 + * Creates a new instance of RelationAggregator
41.37 + */
41.38 + public StartEvent() {
41.39 + mPath = PaletteItemConstants.WIDGET_START_EVENT;
41.40 + }
41.41 +
41.42 +}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/StartEvent.xml Fri Apr 15 18:18:16 2011 -0400
42.3 @@ -0,0 +1,30 @@
42.4 +<?xml version="1.0" encoding="UTF-8"?>
42.5 +<!--
42.6 + The contents of this file are subject to the terms of the Common Development
42.7 + and Distribution License (the License). You may not use this file except in
42.8 + compliance with the License.
42.9 +
42.10 + You can obtain a copy of the License at http://www.netbeans.org/cddl.html
42.11 + or http://www.netbeans.org/cddl.txt.
42.12 +
42.13 + When distributing Covered Code, include this CDDL Header Notice in each file
42.14 + and include the License file at http://www.netbeans.org/cddl.txt.
42.15 + If applicable, add the following below the CDDL Header, with the fields
42.16 + enclosed by brackets [] replaced by your own identifying information:
42.17 + "Portions Copyrighted [year] [name of copyright owner]"
42.18 +
42.19 + The Original Software is NetBeans. The Initial Developer of the Original
42.20 + Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
42.21 + Microsystems, Inc. All Rights Reserved.
42.22 +-->
42.23 +<!DOCTYPE editor_palette_item PUBLIC "-//NetBeans//Editor Palette Item 1.0//EN" "http://www.netbeans.org/dtds/editor-palette-item-1_0.dtd">
42.24 +
42.25 +<editor_palette_item version="1.0">
42.26 + <class name="org.netbeans.modules.workflow.editor.palette.items.events.StartEvent"/>
42.27 +
42.28 + <icon16 urlvalue="org/netbeans/modules/workflow/editor/palette/items/events/resources/images/startx16.PNG" />
42.29 + <icon32 urlvalue="org/netbeans/modules/workflow/editor/palette/items/events/resources/images/startx32.PNG" />
42.30 + <description localizing-bundle="org.netbeans.modules.workflow.editor.palette.items.events.Bundle"
42.31 + display-name-key="NAME_html-startEvent"
42.32 + tooltip-key="HINT_html-startEvent" />
42.33 +</editor_palette_item>
42.34 \ No newline at end of file
43.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/resources/images/endx16.PNG has changed
44.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/resources/images/endx32.PNG has changed
45.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/resources/images/intermediatex16.PNG has changed
46.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/resources/images/intermediatex32.PNG has changed
47.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/resources/images/startx16.PNG has changed
48.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/palette/items/events/resources/images/startx32.PNG has changed
49.1 Binary file workflow.editor/src/org/netbeans/modules/workflow/editor/resources/images/workflowx16.png has changed
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/AbstractWidget.java Fri Apr 15 18:18:16 2011 -0400
50.3 @@ -0,0 +1,100 @@
50.4 +/*
50.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
50.6 + *
50.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
50.8 + *
50.9 + * The contents of this file are subject to the terms of either the GNU
50.10 + * General Public License Version 2 only ("GPL") or the Common
50.11 + * Development and Distribution License("CDDL") (collectively, the
50.12 + * "License"). You may not use this file except in compliance with the
50.13 + * License. You can obtain a copy of the License at
50.14 + * http://www.netbeans.org/cddl-gplv2.html
50.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
50.16 + * specific language governing permissions and limitations under the
50.17 + * License. When distributing the software, include this License Header
50.18 + * Notice in each file and include the License file at
50.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
50.20 + * particular file as subject to the "Classpath" exception as provided
50.21 + * by Sun in the GPL Version 2 section of the License file that
50.22 + * accompanied this code. If applicable, add the following below the
50.23 + * License Header, with the fields enclosed by brackets [] replaced by
50.24 + * your own identifying information:
50.25 + * "Portions Copyrighted [year] [name of copyright owner]"
50.26 + *
50.27 + * If you wish your version of this file to be governed by only the CDDL
50.28 + * or only the GPL Version 2, indicate your decision by adding
50.29 + * "[Contributor] elects to include this software in this distribution
50.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
50.31 + * single choice of license, a recipient has the option to distribute
50.32 + * your version of this file under either the CDDL, the GPL Version 2 or
50.33 + * to extend the choice of license to its licensees as provided above.
50.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
50.35 + * Version 2 license, then the option applies only if the new code is
50.36 + * made subject to such option by the copyright holder.
50.37 + *
50.38 + * Contributor(s):
50.39 + *
50.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
50.41 + */
50.42 +
50.43 +package org.netbeans.modules.workflow.editor.view.design;
50.44 +
50.45 +import java.awt.Color;
50.46 +import java.awt.Image;
50.47 +import javax.swing.BorderFactory;
50.48 +import org.netbeans.api.visual.action.ActionFactory;
50.49 +import org.netbeans.api.visual.action.WidgetAction;
50.50 +import org.netbeans.api.visual.layout.LayoutFactory;
50.51 +import org.netbeans.api.visual.model.ObjectScene;
50.52 +import org.netbeans.api.visual.widget.ImageWidget;
50.53 +import org.netbeans.api.visual.widget.LabelWidget;
50.54 +import org.netbeans.api.visual.widget.Widget;
50.55 +import org.openide.util.Lookup;
50.56 +
50.57 +/**
50.58 + *
50.59 + * @author radval
50.60 + */
50.61 +public abstract class AbstractWidget extends Widget {
50.62 +
50.63 + private LabelWidget mLabelWidget;
50.64 +
50.65 + private ImageWidget mImageWidget;
50.66 +
50.67 + public AbstractWidget(ObjectScene scene, Lookup lookup) {
50.68 + super(scene);
50.69 + initWidget();
50.70 + }
50.71 +
50.72 + private void initWidget() {
50.73 + this.setLayout(LayoutFactory.createVerticalFlowLayout());
50.74 + this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
50.75 + mLabelWidget = new LabelWidget(getScene());
50.76 + this.addChild(mLabelWidget);
50.77 +
50.78 + mImageWidget = new ImageWidget(getScene(), getImage());
50.79 + this.addChild(mImageWidget);
50.80 +
50.81 + ObjectScene scene = (ObjectScene) getScene();
50.82 +
50.83 + WidgetAction selectAction = scene.createSelectAction();
50.84 + this.getActions().addAction(selectAction);
50.85 +
50.86 + WidgetAction moveAction = ActionFactory.createMoveAction();
50.87 + this.getActions().addAction(moveAction);
50.88 +
50.89 + WidgetAction hoverAction = scene.createObjectHoverAction();
50.90 + this.getActions().addAction(hoverAction);
50.91 +
50.92 + }
50.93 +
50.94 + public void setLabel(String label) {
50.95 + mLabelWidget.setLabel(label);
50.96 + }
50.97 +
50.98 + public String getLabel() {
50.99 + return mLabelWidget.getLabel();
50.100 + }
50.101 +
50.102 + public abstract Image getImage();
50.103 +}
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/Bundle.properties Fri Apr 15 18:18:16 2011 -0400
51.3 @@ -0,0 +1,1 @@
51.4 +WorkflowDesignViewPanel.jLabel1.text=This is workflow design panel
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/EndEventWidget.java Fri Apr 15 18:18:16 2011 -0400
52.3 @@ -0,0 +1,62 @@
52.4 +/*
52.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
52.6 + *
52.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
52.8 + *
52.9 + * The contents of this file are subject to the terms of either the GNU
52.10 + * General Public License Version 2 only ("GPL") or the Common
52.11 + * Development and Distribution License("CDDL") (collectively, the
52.12 + * "License"). You may not use this file except in compliance with the
52.13 + * License. You can obtain a copy of the License at
52.14 + * http://www.netbeans.org/cddl-gplv2.html
52.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
52.16 + * specific language governing permissions and limitations under the
52.17 + * License. When distributing the software, include this License Header
52.18 + * Notice in each file and include the License file at
52.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
52.20 + * particular file as subject to the "Classpath" exception as provided
52.21 + * by Sun in the GPL Version 2 section of the License file that
52.22 + * accompanied this code. If applicable, add the following below the
52.23 + * License Header, with the fields enclosed by brackets [] replaced by
52.24 + * your own identifying information:
52.25 + * "Portions Copyrighted [year] [name of copyright owner]"
52.26 + *
52.27 + * If you wish your version of this file to be governed by only the CDDL
52.28 + * or only the GPL Version 2, indicate your decision by adding
52.29 + * "[Contributor] elects to include this software in this distribution
52.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
52.31 + * single choice of license, a recipient has the option to distribute
52.32 + * your version of this file under either the CDDL, the GPL Version 2 or
52.33 + * to extend the choice of license to its licensees as provided above.
52.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
52.35 + * Version 2 license, then the option applies only if the new code is
52.36 + * made subject to such option by the copyright holder.
52.37 + *
52.38 + * Contributor(s):
52.39 + *
52.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
52.41 + */
52.42 +
52.43 +package org.netbeans.modules.workflow.editor.view.design;
52.44 +
52.45 +import java.awt.Image;
52.46 +import org.netbeans.api.visual.model.ObjectScene;
52.47 +import org.openide.util.Lookup;
52.48 +import org.openide.util.Utilities;
52.49 +
52.50 +/**
52.51 + *
52.52 + * @author radval
52.53 + */
52.54 +public class EndEventWidget extends AbstractWidget {
52.55 +
52.56 + public EndEventWidget(ObjectScene scene, Lookup lookup) {
52.57 + super(scene, lookup);
52.58 + }
52.59 +
52.60 + @Override
52.61 + public Image getImage() {
52.62 + return Utilities.loadImage("org/netbeans/modules/workflow/editor/palette/items/events/resources/images/endx16.PNG");
52.63 + }
52.64 +
52.65 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/IntermediateEventWidget.java Fri Apr 15 18:18:16 2011 -0400
53.3 @@ -0,0 +1,62 @@
53.4 +/*
53.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
53.6 + *
53.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
53.8 + *
53.9 + * The contents of this file are subject to the terms of either the GNU
53.10 + * General Public License Version 2 only ("GPL") or the Common
53.11 + * Development and Distribution License("CDDL") (collectively, the
53.12 + * "License"). You may not use this file except in compliance with the
53.13 + * License. You can obtain a copy of the License at
53.14 + * http://www.netbeans.org/cddl-gplv2.html
53.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
53.16 + * specific language governing permissions and limitations under the
53.17 + * License. When distributing the software, include this License Header
53.18 + * Notice in each file and include the License file at
53.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
53.20 + * particular file as subject to the "Classpath" exception as provided
53.21 + * by Sun in the GPL Version 2 section of the License file that
53.22 + * accompanied this code. If applicable, add the following below the
53.23 + * License Header, with the fields enclosed by brackets [] replaced by
53.24 + * your own identifying information:
53.25 + * "Portions Copyrighted [year] [name of copyright owner]"
53.26 + *
53.27 + * If you wish your version of this file to be governed by only the CDDL
53.28 + * or only the GPL Version 2, indicate your decision by adding
53.29 + * "[Contributor] elects to include this software in this distribution
53.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
53.31 + * single choice of license, a recipient has the option to distribute
53.32 + * your version of this file under either the CDDL, the GPL Version 2 or
53.33 + * to extend the choice of license to its licensees as provided above.
53.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
53.35 + * Version 2 license, then the option applies only if the new code is
53.36 + * made subject to such option by the copyright holder.
53.37 + *
53.38 + * Contributor(s):
53.39 + *
53.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
53.41 + */
53.42 +
53.43 +package org.netbeans.modules.workflow.editor.view.design;
53.44 +
53.45 +import java.awt.Image;
53.46 +import org.netbeans.api.visual.model.ObjectScene;
53.47 +import org.openide.util.Lookup;
53.48 +import org.openide.util.Utilities;
53.49 +
53.50 +/**
53.51 + *
53.52 + * @author radval
53.53 + */
53.54 +public class IntermediateEventWidget extends AbstractWidget {
53.55 +
53.56 + public IntermediateEventWidget(ObjectScene scene, Lookup lookup) {
53.57 + super(scene, lookup);
53.58 + }
53.59 +
53.60 + @Override
53.61 + public Image getImage() {
53.62 + return Utilities.loadImage("org/netbeans/modules/workflow/editor/palette/items/events/resources/images/intermediatex16.PNG");
53.63 + }
53.64 +
53.65 +}
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/MainScene.java Fri Apr 15 18:18:16 2011 -0400
54.3 @@ -0,0 +1,107 @@
54.4 +/*
54.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
54.6 + *
54.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
54.8 + *
54.9 + * The contents of this file are subject to the terms of either the GNU
54.10 + * General Public License Version 2 only ("GPL") or the Common
54.11 + * Development and Distribution License("CDDL") (collectively, the
54.12 + * "License"). You may not use this file except in compliance with the
54.13 + * License. You can obtain a copy of the License at
54.14 + * http://www.netbeans.org/cddl-gplv2.html
54.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
54.16 + * specific language governing permissions and limitations under the
54.17 + * License. When distributing the software, include this License Header
54.18 + * Notice in each file and include the License file at
54.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
54.20 + * particular file as subject to the "Classpath" exception as provided
54.21 + * by Sun in the GPL Version 2 section of the License file that
54.22 + * accompanied this code. If applicable, add the following below the
54.23 + * License Header, with the fields enclosed by brackets [] replaced by
54.24 + * your own identifying information:
54.25 + * "Portions Copyrighted [year] [name of copyright owner]"
54.26 + *
54.27 + * If you wish your version of this file to be governed by only the CDDL
54.28 + * or only the GPL Version 2, indicate your decision by adding
54.29 + * "[Contributor] elects to include this software in this distribution
54.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
54.31 + * single choice of license, a recipient has the option to distribute
54.32 + * your version of this file under either the CDDL, the GPL Version 2 or
54.33 + * to extend the choice of license to its licensees as provided above.
54.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
54.35 + * Version 2 license, then the option applies only if the new code is
54.36 + * made subject to such option by the copyright holder.
54.37 + *
54.38 + * Contributor(s):
54.39 + *
54.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
54.41 + */
54.42 +
54.43 +package org.netbeans.modules.workflow.editor.view.design;
54.44 +
54.45 +import java.awt.Point;
54.46 +import java.awt.datatransfer.DataFlavor;
54.47 +import java.awt.datatransfer.Transferable;
54.48 +import java.awt.datatransfer.UnsupportedFlavorException;
54.49 +import org.netbeans.api.visual.action.AcceptProvider;
54.50 +import org.netbeans.api.visual.action.ActionFactory;
54.51 +import org.netbeans.api.visual.action.ConnectorState;
54.52 +import org.netbeans.api.visual.action.WidgetAction;
54.53 +import org.netbeans.api.visual.model.ObjectScene;
54.54 +import org.netbeans.api.visual.widget.Widget;
54.55 +import org.netbeans.modules.workflow.editor.palette.WorkflowActiveEditorDrop;
54.56 +import org.openide.nodes.Node;
54.57 +
54.58 +/**
54.59 + *
54.60 + * @author radval
54.61 + */
54.62 +public class MainScene extends ObjectScene {
54.63 +
54.64 + public MainScene() {
54.65 + WidgetAction acceptAction = ActionFactory.createAcceptAction(new SceneAcceptProvider());
54.66 + this.getActions().addAction(acceptAction);
54.67 + }
54.68 +
54.69 + private class SceneAcceptProvider implements AcceptProvider {
54.70 +
54.71 + public ConnectorState isAcceptable(Widget widget, Point point, Transferable transferable) {
54.72 + return ConnectorState.ACCEPT;
54.73 + }
54.74 +
54.75 + public void accept(Widget widget, Point point, Transferable transferable) {
54.76 + if(widget instanceof MainScene) {
54.77 + if (transferable != null) {
54.78 + for (DataFlavor flavor : transferable.getTransferDataFlavors()) {
54.79 + Class repClass = flavor.getRepresentationClass();
54.80 + if (WorkflowActiveEditorDrop.class.isAssignableFrom(repClass)) {
54.81 + try {
54.82 + WorkflowActiveEditorDrop drop = (WorkflowActiveEditorDrop) transferable.getTransferData(flavor);
54.83 + String componentName = drop.getComponentName();
54.84 + if(componentName != null) {
54.85 + WidgetFactory factory = WidgetFactory.getDefault(MainScene.this);
54.86 + Widget newWidget = factory.createWidget(componentName);
54.87 + if(newWidget != null) {
54.88 + newWidget.setPreferredLocation(point);
54.89 + widget.addChild(newWidget);
54.90 + widget.getScene().validate();
54.91 + break;
54.92 + }
54.93 + }
54.94 + } catch(Exception ex) {
54.95 + ex.printStackTrace();
54.96 + }
54.97 + }
54.98 + }
54.99 + }
54.100 + /*
54.101 + Widget child = new StartEventWidget(MainScene.this, null);
54.102 + child.setPreferredLocation(point);
54.103 + widget.addChild(child);*/
54.104 + }
54.105 + }
54.106 +
54.107 + }
54.108 +
54.109 +
54.110 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/StartEventWidget.java Fri Apr 15 18:18:16 2011 -0400
55.3 @@ -0,0 +1,65 @@
55.4 +/*
55.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
55.6 + *
55.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
55.8 + *
55.9 + * The contents of this file are subject to the terms of either the GNU
55.10 + * General Public License Version 2 only ("GPL") or the Common
55.11 + * Development and Distribution License("CDDL") (collectively, the
55.12 + * "License"). You may not use this file except in compliance with the
55.13 + * License. You can obtain a copy of the License at
55.14 + * http://www.netbeans.org/cddl-gplv2.html
55.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
55.16 + * specific language governing permissions and limitations under the
55.17 + * License. When distributing the software, include this License Header
55.18 + * Notice in each file and include the License file at
55.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
55.20 + * particular file as subject to the "Classpath" exception as provided
55.21 + * by Sun in the GPL Version 2 section of the License file that
55.22 + * accompanied this code. If applicable, add the following below the
55.23 + * License Header, with the fields enclosed by brackets [] replaced by
55.24 + * your own identifying information:
55.25 + * "Portions Copyrighted [year] [name of copyright owner]"
55.26 + *
55.27 + * If you wish your version of this file to be governed by only the CDDL
55.28 + * or only the GPL Version 2, indicate your decision by adding
55.29 + * "[Contributor] elects to include this software in this distribution
55.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
55.31 + * single choice of license, a recipient has the option to distribute
55.32 + * your version of this file under either the CDDL, the GPL Version 2 or
55.33 + * to extend the choice of license to its licensees as provided above.
55.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
55.35 + * Version 2 license, then the option applies only if the new code is
55.36 + * made subject to such option by the copyright holder.
55.37 + *
55.38 + * Contributor(s):
55.39 + *
55.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
55.41 + */
55.42 +
55.43 +package org.netbeans.modules.workflow.editor.view.design;
55.44 +
55.45 +import java.awt.Image;
55.46 +import org.netbeans.api.visual.action.ActionFactory;
55.47 +import org.netbeans.api.visual.action.WidgetAction;
55.48 +import org.netbeans.api.visual.model.ObjectScene;
55.49 +import org.netbeans.api.visual.widget.Scene;
55.50 +import org.netbeans.api.visual.widget.general.IconNodeWidget;
55.51 +import org.openide.util.Lookup;
55.52 +import org.openide.util.Utilities;
55.53 +
55.54 +/**
55.55 + *
55.56 + * @author radval
55.57 + */
55.58 +public class StartEventWidget extends AbstractWidget {
55.59 +
55.60 + public StartEventWidget(ObjectScene scene, Lookup lookup) {
55.61 + super(scene, lookup);
55.62 + }
55.63 +
55.64 + @Override
55.65 + public Image getImage() {
55.66 + return Utilities.loadImage("org/netbeans/modules/workflow/editor/palette/items/events/resources/images/startx16.PNG");
55.67 + }
55.68 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/SwimlaneWidget.java Fri Apr 15 18:18:16 2011 -0400
56.3 @@ -0,0 +1,48 @@
56.4 +/*
56.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
56.6 + *
56.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
56.8 + *
56.9 + * The contents of this file are subject to the terms of either the GNU
56.10 + * General Public License Version 2 only ("GPL") or the Common
56.11 + * Development and Distribution License("CDDL") (collectively, the
56.12 + * "License"). You may not use this file except in compliance with the
56.13 + * License. You can obtain a copy of the License at
56.14 + * http://www.netbeans.org/cddl-gplv2.html
56.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
56.16 + * specific language governing permissions and limitations under the
56.17 + * License. When distributing the software, include this License Header
56.18 + * Notice in each file and include the License file at
56.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
56.20 + * particular file as subject to the "Classpath" exception as provided
56.21 + * by Sun in the GPL Version 2 section of the License file that
56.22 + * accompanied this code. If applicable, add the following below the
56.23 + * License Header, with the fields enclosed by brackets [] replaced by
56.24 + * your own identifying information:
56.25 + * "Portions Copyrighted [year] [name of copyright owner]"
56.26 + *
56.27 + * If you wish your version of this file to be governed by only the CDDL
56.28 + * or only the GPL Version 2, indicate your decision by adding
56.29 + * "[Contributor] elects to include this software in this distribution
56.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
56.31 + * single choice of license, a recipient has the option to distribute
56.32 + * your version of this file under either the CDDL, the GPL Version 2 or
56.33 + * to extend the choice of license to its licensees as provided above.
56.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
56.35 + * Version 2 license, then the option applies only if the new code is
56.36 + * made subject to such option by the copyright holder.
56.37 + *
56.38 + * Contributor(s):
56.39 + *
56.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
56.41 + */
56.42 +
56.43 +package org.netbeans.modules.workflow.editor.view.design;
56.44 +
56.45 +/**
56.46 + *
56.47 + * @author radval
56.48 + */
56.49 +public class SwimlaneWidget {
56.50 +
56.51 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/WidgetFactory.java Fri Apr 15 18:18:16 2011 -0400
57.3 @@ -0,0 +1,86 @@
57.4 +/*
57.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
57.6 + *
57.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
57.8 + *
57.9 + * The contents of this file are subject to the terms of either the GNU
57.10 + * General Public License Version 2 only ("GPL") or the Common
57.11 + * Development and Distribution License("CDDL") (collectively, the
57.12 + * "License"). You may not use this file except in compliance with the
57.13 + * License. You can obtain a copy of the License at
57.14 + * http://www.netbeans.org/cddl-gplv2.html
57.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
57.16 + * specific language governing permissions and limitations under the
57.17 + * License. When distributing the software, include this License Header
57.18 + * Notice in each file and include the License file at
57.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
57.20 + * particular file as subject to the "Classpath" exception as provided
57.21 + * by Sun in the GPL Version 2 section of the License file that
57.22 + * accompanied this code. If applicable, add the following below the
57.23 + * License Header, with the fields enclosed by brackets [] replaced by
57.24 + * your own identifying information:
57.25 + * "Portions Copyrighted [year] [name of copyright owner]"
57.26 + *
57.27 + * If you wish your version of this file to be governed by only the CDDL
57.28 + * or only the GPL Version 2, indicate your decision by adding
57.29 + * "[Contributor] elects to include this software in this distribution
57.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
57.31 + * single choice of license, a recipient has the option to distribute
57.32 + * your version of this file under either the CDDL, the GPL Version 2 or
57.33 + * to extend the choice of license to its licensees as provided above.
57.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
57.35 + * Version 2 license, then the option applies only if the new code is
57.36 + * made subject to such option by the copyright holder.
57.37 + *
57.38 + * Contributor(s):
57.39 + *
57.40 + * Portions Copyrighted 2007 Sun Microsystems, Inc.
57.41 + */
57.42 +
57.43 +package org.netbeans.modules.workflow.editor.view.design;
57.44 +
57.45 +import org.netbeans.api.visual.model.ObjectScene;
57.46 +import org.netbeans.modules.workflow.editor.palette.PaletteItemConstants;
57.47 +
57.48 +/**
57.49 + *
57.50 + * @author radval
57.51 + */
57.52 +public class WidgetFactory {
57.53 +
57.54 + private static WidgetFactory mInstance;
57.55 +
57.56 + private ObjectScene mScene;
57.57 +
57.58 + private WidgetFactory(ObjectScene scene) {
57.59 + this.mScene = scene;
57.60 + }
57.61 +
57.62 +
57.63 + public static WidgetFactory getDefault(ObjectScene scene) {
57.64 +
57.65 + if(mInstance == null) {
57.66 + mInstance = new WidgetFactory(scene);
57.67 + }
57.68 +
57.69 + return mInstance;
57.70 + }
57.71 +
57.72 + public AbstractWidget createWidget(String componentName) {
57.73 + AbstractWidget widget = null;
57.74 +
57.75 + if(componentName.equals(PaletteItemConstants.WIDGET_START_EVENT)) {
57.76 + widget = new StartEventWidget(mScene, null);
57.77 + } else if(componentName.equals(PaletteItemConstants.WIDGET_INTERMEDIATE_EVENT)) {
57.78 + widget = new IntermediateEventWidget(mScene, null);
57.79 + } else if(componentName.equals(PaletteItemConstants.WIDGET_END_EVENT)) {
57.80 + widget = new EndEventWidget(mScene, null);
57.81 + }
57.82 +
57.83 + return widget;
57.84 + }
57.85 +
57.86 + private void init() {
57.87 +
57.88 + }
57.89 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/WorkflowDesignViewPanel.form Fri Apr 15 18:18:16 2011 -0400
58.3 @@ -0,0 +1,44 @@
58.4 +<?xml version="1.0" encoding="UTF-8" ?>
58.5 +
58.6 +<Form version="1.5" maxVersion="1.5" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
58.7 + <AuxValues>
58.8 + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
58.9 + <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
58.10 + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
58.11 + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
58.12 + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
58.13 + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
58.14 + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
58.15 + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
58.16 + </AuxValues>
58.17 +
58.18 + <Layout>
58.19 + <DimensionLayout dim="0">
58.20 + <Group type="103" groupAlignment="0" attributes="0">
58.21 + <Group type="102" alignment="0" attributes="0">
58.22 + <EmptySpace max="-2" attributes="0"/>
58.23 + <Component id="jLabel1" pref="380" max="32767" attributes="0"/>
58.24 + <EmptySpace max="-2" attributes="0"/>
58.25 + </Group>
58.26 + </Group>
58.27 + </DimensionLayout>
58.28 + <DimensionLayout dim="1">
58.29 + <Group type="103" groupAlignment="0" attributes="0">
58.30 + <Group type="102" alignment="0" attributes="0">
58.31 + <EmptySpace max="-2" attributes="0"/>
58.32 + <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
58.33 + <EmptySpace pref="275" max="32767" attributes="0"/>
58.34 + </Group>
58.35 + </Group>
58.36 + </DimensionLayout>
58.37 + </Layout>
58.38 + <SubComponents>
58.39 + <Component class="javax.swing.JLabel" name="jLabel1">
58.40 + <Properties>
58.41 + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
58.42 + <ResourceString bundle="org/netbeans/modules/workflow/editor/view/design/Bundle.properties" key="WorkflowDesignViewPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
58.43 + </Property>
58.44 + </Properties>
58.45 + </Component>
58.46 + </SubComponents>
58.47 +</Form>
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/workflow.editor/src/org/netbeans/modules/workflow/editor/view/design/WorkflowDesignViewPanel.java Fri Apr 15 18:18:16 2011 -0400
59.3 @@ -0,0 +1,83 @@
59.4 +/*
59.5 + * WorkflowDesignViewPanel.java
59.6 + *
59.7 + * Created on October 19, 2007, 2:29 PM
59.8 + */
59.9 +
59.10 +package org.netbeans.modules.workflow.editor.view.design;
59.11 +
59.12 +import java.awt.BorderLayout;
59.13 +import java.awt.Color;
59.14 +import java.awt.Dimension;
59.15 +import java.awt.Point;
59.16 +import javax.swing.JComponent;
59.17 +import javax.swing.JScrollPane;
59.18 +
59.19 +/**
59.20 + *
59.21 + * @author radval
59.22 + */
59.23 +public class WorkflowDesignViewPanel extends javax.swing.JPanel {
59.24 +
59.25 + /** Creates new form WorkflowDesignViewPanel */
59.26 + public WorkflowDesignViewPanel() {
59.27 + initComponents();
59.28 + initGUI();
59.29 + }
59.30 +
59.31 + /** This method is called from within the constructor to
59.32 + * initialize the form.
59.33 + * WARNING: Do NOT modify this code. The content of this method is
59.34 + * always regenerated by the Form Editor.
59.35 + */
59.36 + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
59.37 + private void initComponents() {
59.38 +
59.39 + jLabel1 = new javax.swing.JLabel();
59.40 +
59.41 + jLabel1.setText(org.openide.util.NbBundle.getMessage(WorkflowDesignViewPanel.class, "WorkflowDesignViewPanel.jLabel1.text")); // NOI18N
59.42 +
59.43 + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
59.44 + this.setLayout(layout);
59.45 + layout.setHorizontalGroup(
59.46 + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
59.47 + .add(layout.createSequentialGroup()
59.48 + .addContainerGap()
59.49 + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
59.50 + .addContainerGap())
59.51 + );
59.52 + layout.setVerticalGroup(
59.53 + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
59.54 + .add(layout.createSequentialGroup()
59.55 + .addContainerGap()
59.56 + .add(jLabel1)
59.57 + .addContainerGap(275, Short.MAX_VALUE))
59.58 + );
59.59 + }// </editor-fold>//GEN-END:initComponents
59.60 +
59.61 + private void initGUI() {
59.62 + setLayout(new BorderLayout());
59.63 +
59.64 + MainScene scene = new MainScene();
59.65 + scene.setBackground(Color.WHITE);
59.66 +
59.67 +
59.68 + JComponent sceneView = scene.createView();
59.69 +
59.70 + JScrollPane panel = new JScrollPane(sceneView);
59.71 + panel.getVerticalScrollBar().setUnitIncrement(16);
59.72 + panel.getHorizontalScrollBar().setUnitIncrement(16);
59.73 + panel.setBorder(null);
59.74 + add(panel, BorderLayout.CENTER);
59.75 +
59.76 + StartEventWidget startWidget = new StartEventWidget(scene, null);
59.77 + //startWidget.setPreferredLocation(new Point(100, 100));
59.78 + //startWidget.setPreferredSize(new Dimension(50, 50));
59.79 + scene.addChild(startWidget);
59.80 +
59.81 + }
59.82 + // Variables declaration - do not modify//GEN-BEGIN:variables
59.83 + private javax.swing.JLabel jLabel1;
59.84 + // End of variables declaration//GEN-END:variables
59.85 +
59.86 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/workflow.editor/test/unit/src/META-INF/services/org.openide.loaders.DataLoader Fri Apr 15 18:18:16 2011 -0400
60.3 @@ -0,0 +1,1 @@
60.4 +org.netbeans.modules.workflow.editor.dataloader.WorkflowDataLoader