JBoss Tools SVN: r27428 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-14 03:46:56 -0500 (Tue, 14 Dec 2010)
New Revision: 27428
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Log:
[JBIDE-7880] clear images and clear instances before loading them.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-14 06:36:24 UTC (rev 27427)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-14 08:46:56 UTC (rev 27428)
@@ -1,9 +1,13 @@
2010-12-13 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
+ (loadInstances):
+ (loadImages):
+ [JBIDE-7880] clear images and clear instances before loading them.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java
(PROP_INSTANCES_ADDED):
(createInstance):
- [JBIDE-7877] added notification for instances being added
+ [JBIDE-7877] added notification for instances that are added
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
(IInstanceStateMatcher.matchesState):
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (State):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-14 06:36:24 UTC (rev 27427)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-12-14 08:46:56 UTC (rev 27428)
@@ -327,7 +327,7 @@
@Override
public boolean matchesState(DeltaCloudInstance instance, DeltaCloudInstance.State instanceState) {
- return expectedState != null && expectedState.equals(instanceState.getName());
+ return expectedState != null && expectedState.equals(instanceState);
}
};
return waitForState(instanceId, stateMatcher, pm);
@@ -367,6 +367,7 @@
*/
public void loadInstances() throws DeltaCloudException {
try {
+ clearInstances();
DeltaCloudInstancesRepository repo = getInstancesRepository();
DeltaCloudInstance[] oldInstances = repo.get();
repo.add(client.listInstances(), this);
@@ -566,6 +567,7 @@
*/
public void loadImages() throws DeltaCloudException {
try {
+ clearImages();
DeltaCloudImagesRepository repo = getImagesRepository();
DeltaCloudImage[] oldImages = repo.get();
repo.add(client.listImages(), this);
14 years
JBoss Tools SVN: r27427 - in trunk/common/plugins/org.jboss.tools.common: src/org/jboss/tools/common and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-14 01:36:24 -0500 (Tue, 14 Dec 2010)
New Revision: 27427
Added:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java
Modified:
trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
Log:
add chained-job to common plugin as possible central location
Modified: trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2010-12-14 01:38:52 UTC (rev 27426)
+++ trunk/common/plugins/org.jboss.tools.common/META-INF/MANIFEST.MF 2010-12-14 06:36:24 UTC (rev 27427)
@@ -12,6 +12,7 @@
org.jboss.tools.common.reporting,
org.jboss.tools.common.text,
org.jboss.tools.common.util,
+ org.jboss.tools.common.jobs,
org.jboss.tools.common.xml,
org.jboss.tools.common.zip
Require-Bundle: org.eclipse.core.runtime,
@@ -26,7 +27,7 @@
org.eclipse.jdt.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.jface.text,
- org.apache.commons.httpclient;bundle-version="3.1.0"
+ org.apache.commons.httpclient
Bundle-Version: 3.2.0.qualifier
Bundle-ActivationPolicy: lazy
Bundle-ManifestVersion: 2
Added: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java 2010-12-14 06:36:24 UTC (rev 27427)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.common.jobs;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+
+/**
+ * A Job that can start another job upon successful completion.
+ */
+public abstract class ChainedJob extends Job {
+ private Job nextJob;
+ private IJobChangeListener listener;
+ private String family;
+
+ /**
+ * Create a new dependent job.
+ *
+ * @param name the name of the job
+ * @param server the server to publish to
+ */
+ public ChainedJob(String name, String family) {
+ super(name);
+ this.family = family;
+ }
+
+ /**
+ * @see Job#belongsTo(java.lang.Object)
+ */
+ public boolean belongsTo(Object family) {
+ return this.family.equals(family);
+ }
+
+
+ /**
+ * Create a listener for when this job finishes.
+ */
+ protected void createListener() {
+ if (listener != null)
+ return;
+
+ listener = new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+ jobDone(event.getResult());
+ }
+ };
+
+ addJobChangeListener(listener);
+ }
+
+ /**
+ * Called when this job is complete.
+ *
+ * @param status the result of the current job
+ */
+ protected void jobDone(IStatus status) {
+ if (listener == null)
+ return;
+
+ removeJobChangeListener(listener);
+ listener = null;
+
+ if (nextJob != null && status != null && status.getSeverity() != IStatus.ERROR
+ && status.getSeverity() != IStatus.CANCEL)
+ nextJob.schedule();
+ }
+
+ /**
+ * Set the next job, which should be scheduled if and only if this job completes
+ * successfully. The next job will be run as long as the result of this job is
+ * not an ERROR or CANCEL status.
+ * This method is not thread-safe. However, the next job can be changed anytime
+ * up until the current job completes.
+ *
+ * @param job the next job that should be scheduled
+ */
+ public void setNextJob(Job job) {
+ nextJob = job;
+ createListener();
+ }
+}
14 years
JBoss Tools SVN: r27426 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-13 20:38:52 -0500 (Mon, 13 Dec 2010)
New Revision: 27426
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.classpath
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/bin/
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml
Log:
There was *STILL* no classpath file... ugh
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.classpath
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.classpath (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.classpath 2010-12-14 01:38:52 UTC (rev 27426)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project 2010-12-14 01:32:49 UTC (rev 27425)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project 2010-12-14 01:38:52 UTC (rev 27426)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.jboss.tools.deltacloud.as</name>
+ <name>org.jboss.tools.deltacloud.integration</name>
<comment></comment>
<projects>
</projects>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml 2010-12-14 01:32:49 UTC (rev 27425)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml 2010-12-14 01:38:52 UTC (rev 27426)
@@ -7,7 +7,7 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.jboss.tools.deltacloud.plugins</groupId>
- <artifactId>org.jboss.tools.deltacloud.as</artifactId>
+ <artifactId>org.jboss.tools.deltacloud.integration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
14 years
JBoss Tools SVN: r27425 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.integration and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-13 20:32:49 -0500 (Mon, 13 Dec 2010)
New Revision: 27425
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/about.html
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/
Log:
Adding all new plugin since last one had no classpath at all and I am very confused
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/.project 2010-12-14 01:32:49 UTC (rev 27425)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.deltacloud.as</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/ChangeLog 2010-12-14 01:32:49 UTC (rev 27425)
@@ -0,0 +1,3 @@
+2010-12-09 André Dietisheim <adietish(a)redhat.com>
+
+ * create new empty plugin
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2010-12-14 01:32:49 UTC (rev 27425)
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DeltaCloud Core (Experimental)
+Bundle-SymbolicName: org.jboss.tools.deltacloud.as
+Bundle-Version: 0.0.1.qualifier
+Bundle-Vendor: Red Hat Inc.
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/about.html
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/about.html (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/about.html 2010-12-14 01:32:49 UTC (rev 27425)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Cloud Development Tools</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>Cloud Development Tools</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a href="http://www.jboss.org/tools">JBoss Tools project page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License - Version 1.0</a>).
+</p>
+</body>
+</html>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties 2010-12-14 01:32:49 UTC (rev 27425)
@@ -0,0 +1,20 @@
+source.. = src/,\
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ lib/apache-mime4j-0.6.jar,\
+ lib/commons-codec-1.3.jar,\
+ lib/commons-logging-1.1.1.jar,\
+ lib/httpclient-4.0.1.jar,\
+ lib/httpcore-4.0.1.jar,\
+ lib/httpcore-nio-4.0.1.jar,\
+ lib/httpmime-4.0.1.jar,\
+ lib/log4j-1.2.14.jar,\
+ about.html,\
+ pom.xml,\
+ src/,\
+ .settings/,\
+ .project
+src.includes = bin/,\
+ lib/,\
+ pom.xml
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/pom.xml 2010-12-14 01:32:49 UTC (rev 27425)
@@ -0,0 +1,13 @@
+<project
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.deltacloud.plugins</groupId>
+ <artifactId>org.jboss.tools.deltacloud.as</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
14 years
JBoss Tools SVN: r27424 - trunk/deltacloud/plugins.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-13 20:30:05 -0500 (Mon, 13 Dec 2010)
New Revision: 27424
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/
Log:
ok deleting this stupid plugin and starting over
14 years
JBoss Tools SVN: r27423 - trunk/deltacloud/plugins.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-13 20:16:10 -0500 (Mon, 13 Dec 2010)
New Revision: 27423
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/
Log:
deleting previous plugin
14 years
JBoss Tools SVN: r27422 - trunk/deltacloud/plugins.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-13 20:14:27 -0500 (Mon, 13 Dec 2010)
New Revision: 27422
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/
Log:
copying plugin since move refuses to work
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration (from rev 27421, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as)
14 years
JBoss Tools SVN: r27421 - in trunk/deltacloud: plugins/org.jboss.tools.deltacloud.as and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-13 19:57:35 -0500 (Mon, 13 Dec 2010)
New Revision: 27421
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/src/org/jboss/tools/deltacloud/integration/
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/src/org/jboss/tools/deltacloud/as/
Modified:
trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/.project
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/pom.xml
Log:
renaming new plugin to deltacloud.integration
Modified: trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml
===================================================================
--- trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml 2010-12-13 22:56:19 UTC (rev 27420)
+++ trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml 2010-12-14 00:57:35 UTC (rev 27421)
@@ -30,35 +30,21 @@
unpack="false"/>
<plugin
- id="org.jboss.tools.deltacloud.ui"
+ id="org.jboss.tools.deltacloud.as"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.jboss.tools.deltacloud.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
- id="org.jboss.tools.deltacloud.as"
+ id="org.jboss.tools.deltacloud.docs"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.jboss.tools.deltacloud.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
- id="org.jboss.tools.deltacloud.docs"
+ id="org.jboss.tools.deltacloud.integration"
download-size="0"
install-size="0"
version="0.0.0"
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/.project
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/.project 2010-12-13 22:56:19 UTC (rev 27420)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/.project 2010-12-14 00:57:35 UTC (rev 27421)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.jboss.tools.deltacloud.as</name>
+ <name>org.jboss.tools.deltacloud.integration</name>
<comment></comment>
<projects>
</projects>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/META-INF/MANIFEST.MF 2010-12-13 22:56:19 UTC (rev 27420)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/META-INF/MANIFEST.MF 2010-12-14 00:57:35 UTC (rev 27421)
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DeltaCloud Core (Experimental)
-Bundle-SymbolicName: org.jboss.tools.deltacloud.as
+Bundle-SymbolicName: org.jboss.tools.deltacloud.integration
Bundle-Version: 0.0.1.qualifier
Bundle-Vendor: Red Hat Inc.
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/pom.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/pom.xml 2010-12-13 22:56:19 UTC (rev 27420)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/pom.xml 2010-12-14 00:57:35 UTC (rev 27421)
@@ -7,7 +7,7 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>org.jboss.tools.deltacloud.plugins</groupId>
- <artifactId>org.jboss.tools.deltacloud.as</artifactId>
+ <artifactId>org.jboss.tools.deltacloud.integration</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
Copied: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/src/org/jboss/tools/deltacloud/integration (from rev 27395, trunk/deltacloud/plugins/org.jboss.tools.deltacloud.as/src/org/jboss/tools/deltacloud/as)
14 years
JBoss Tools SVN: r27420 - trunk/documentation/jboss-tools-docs.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-12-13 17:56:19 -0500 (Mon, 13 Dec 2010)
New Revision: 27420
Modified:
trunk/documentation/jboss-tools-docs/settings.xml
Log:
updated settings file - trialing changes for nightly doc builds. If doesn't work I will revert to previous version of file
Modified: trunk/documentation/jboss-tools-docs/settings.xml
===================================================================
--- trunk/documentation/jboss-tools-docs/settings.xml 2010-12-13 21:07:04 UTC (rev 27419)
+++ trunk/documentation/jboss-tools-docs/settings.xml 2010-12-13 22:56:19 UTC (rev 27420)
@@ -14,7 +14,8 @@
<mirrors>
</mirrors>
<profiles>
- <profile>
+<!--Old Profile Information -->
+<!-- <profile>
<id>jboss</id>
<repositories>
<repository>
@@ -90,11 +91,116 @@
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
+ </profile> -->
+
+<!-- New Profile Information -->
+<profile>
+ <id>jboss.repository</id>
+ <activation>
+ <property>
+ <name>!jboss.repository.off</name>
+ </property>
+ </activation>
+ <repositories>
+ <repository>
+ <id>jboss-releases</id>
+ <url>http://repository.jboss.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>jboss-snapshots</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>jboss-releases</id>
+ <url>http://repository.jboss.org/maven2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>jboss-snapshots</id>
+ <url>http://snapshots.jboss.org/maven2</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>docbkx.snapshots</id>
+ <name>Maven Plugin Snapshots</name>
+ <url>http://docbkx-tools.sourceforge.net/snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ <pluginRepository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
</profile>
+
+ <profile>
+ <id>local-properties</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+
+ <properties>
+ <!-- This must point to the svn checkout of https://svn.jboss.org/repos/repository.jboss.com/maven2 -->
+ <maven.repository.root>${user.home}/repositories/repository.jboss.org/maven2</maven.repository.root>
+ </properties>
+ </profile>
+
</profiles>
- <activeProfiles>
+<!-- For use with old profile only -->
+
+<!-- <activeProfiles>
<activeProfile>jboss</activeProfile>
- </activeProfiles>
+ </activeProfiles> -->
</settings>
14 years
JBoss Tools SVN: r27419 - in trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram: META-INF and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2010-12-13 16:07:04 -0500 (Mon, 13 Dec 2010)
New Revision: 27419
Added:
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/Bpmn2PerspectiveFactory.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBendpointsImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBoundsImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnDiagramImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnEdgeImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnLabelImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnNotationFactory.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnShapeImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/figures/
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySectionBis.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySheetPage.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/util/
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Definitions.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DefinitionsPageImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Details.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DetailsPageImpl.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DefinitionsPage.java
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DetailsPage.java
Removed:
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/
Modified:
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/.classpath
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/META-INF/MANIFEST.MF
trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/util/Bpmn2ResourceFactoryImpl.java
Log:
make export feature work
Modified: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/.classpath
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/.classpath 2010-12-13 21:04:34 UTC (rev 27418)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/.classpath 2010-12-13 21:07:04 UTC (rev 27419)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-custom"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
Modified: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/META-INF/MANIFEST.MF 2010-12-13 21:04:34 UTC (rev 27418)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/META-INF/MANIFEST.MF 2010-12-13 21:07:04 UTC (rev 27419)
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.bpmn2.diagram; singleton:=true
+Bundle-SymbolicName: org.jboss.tools.bpmn2.process.diagram;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.jboss.tools.bpmn2.process.diagram.part.Bpmn2DiagramEditorPlugin
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/Bpmn2PerspectiveFactory.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/Bpmn2PerspectiveFactory.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/Bpmn2PerspectiveFactory.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/Bpmn2PerspectiveFactory.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.bpmn2;
+
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.progress.IProgressConstants;
+
+public class Bpmn2PerspectiveFactory implements IPerspectiveFactory {
+
+ public void createInitialLayout(IPageLayout layout) {
+ String editorArea = layout.getEditorArea();
+
+ IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
+ folder.addView(JavaUI.ID_PACKAGES);
+ folder.addPlaceholder("org.eclipse.ui.navigator.ProjectExplorer");
+ folder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
+ folder.addPlaceholder("org.eclipse.ui.views.ResourceNavigator");
+
+ layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.BOTTOM, (float)0.70, "left");
+
+ IFolderLayout bpmnFolder = layout.createFolder("bpmn", IPageLayout.BOTTOM, (float)0.70, editorArea);
+ bpmnFolder.addView("org.jboss.tools.bpmn2.details");
+ bpmnFolder.addView("org.jboss.tools.bpmn2.definitions");
+
+ IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.RIGHT, (float)0.33, "bpmn"); //$NON-NLS-1$
+ outputfolder.addView(IPageLayout.ID_PROP_SHEET);
+ outputfolder.addPlaceholder(IPageLayout.ID_PROBLEM_VIEW);
+ outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
+ outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
+ outputfolder.addPlaceholder("org.eclipse.search.ui.views.SearchView");
+ outputfolder.addPlaceholder("org.eclipse.ui.console.ConsoleView");
+ outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+ outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
+
+ layout.addActionSet("org.eclipse.debug.ui.launchActionSet");
+ layout.addActionSet(JavaUI.ID_ACTION_SET);
+ layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
+ layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
+
+ // views - java
+ layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
+ layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
+ layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
+ layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
+
+ // views - search
+ layout.addShowViewShortcut("org.eclipse.search.ui.views.SearchView");
+
+ // views - debugging
+ layout.addShowViewShortcut("org.eclipse.ui.console.ConsoleView");
+
+ // views - standard workbench
+ layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
+ layout.addShowViewShortcut("org.jbpm.gd.jpdl.overview");
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+ layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
+
+ // new actions - Java project creation wizard
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.jbpm.ui.wizard.new.file"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.jboss.tools.bpmn2.process.diagram.part.Bpmn2CreationWizardID");//$NON-NLS-1$
+ }
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/Bpmn2PerspectiveFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBendpointsImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnBendpointsImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBendpointsImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBendpointsImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,60 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import java.util.List;
+
+import org.eclipse.bpmn2.di.BPMNShape;
+import org.eclipse.dd.dc.Bounds;
+import org.eclipse.dd.dc.DcFactory;
+import org.eclipse.dd.dc.Point;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.gmf.runtime.notation.impl.RelativeBendpointsImpl;
+
+public class BpmnBendpointsImpl extends RelativeBendpointsImpl implements
+ RelativeBendpoints {
+
+ private Edge edge;
+
+ public void setEdge(Edge edge) {
+ this.edge = edge;
+ }
+
+ public Edge getEdge() {
+ return edge;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void setPoints(List newPoints) {
+ if (edge != null && edge instanceof BpmnEdgeImpl) {
+ List<Point> waypoints = (((BpmnEdgeImpl)edge).getBPMNEdge()).getWaypoint();
+ waypoints.clear();
+ if (newPoints != null) {
+ for (Object object : newPoints) {
+ if (object instanceof RelativeBendpoint) {
+ RelativeBendpoint relativeBendPoint = (RelativeBendpoint)object;
+ Point absoluteBendpoint = DcFactory.eINSTANCE.createPoint();
+ BPMNShape source = getEdgeSource();
+ if (source != null) {
+ Bounds sourceBounds = ((BPMNShape)source).getBounds();
+ absoluteBendpoint.setX(sourceBounds.getX() + relativeBendPoint.getSourceX());
+ absoluteBendpoint.setY(sourceBounds.getY() + relativeBendPoint.getSourceY());
+ }
+ waypoints.add(absoluteBendpoint);
+ }
+ }
+ }
+ }
+ super.setPoints(newPoints);
+ }
+
+ private BPMNShape getEdgeSource() {
+ if (edge == null) return null;
+ View source = edge.getSource();
+ if (!(source instanceof BpmnShapeImpl)) return null;
+ return ((BpmnShapeImpl)source).getBPMNShape();
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBendpointsImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBoundsImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnBoundsImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBoundsImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBoundsImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,122 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.impl.BoundsImpl;
+
+public class BpmnBoundsImpl extends BoundsImpl implements Bounds {
+
+ org.eclipse.dd.dc.Bounds bpmnBounds = null;
+
+ public BpmnBoundsImpl(org.eclipse.dd.dc.Bounds bounds) {
+ this.bpmnBounds = bounds;
+ }
+
+ public void initialize(BpmnShapeImpl shape) {
+ assert shape != null;
+ super.setHeight((int)bpmnBounds.getHeight());
+ super.setWidth((int)bpmnBounds.getWidth());
+ LayoutConstraint layoutConstraint = shape.getLayoutConstraint();
+ if (layoutConstraint instanceof BpmnBoundsImpl) {
+ org.eclipse.dd.dc.Bounds bounds = getParentContainerBounds();
+ super.setX((int)(bpmnBounds.getX() - (bounds != null ? bounds.getX() : 0)));
+ super.setY((int)(bpmnBounds.getY() - (bounds != null ? bounds.getY() : 0)));
+ }
+ }
+
+ public org.eclipse.dd.dc.Bounds getBPMNBounds() {
+ return bpmnBounds;
+ }
+
+ public void setX(int newX) {
+ super.setX(newX);
+ bpmnBounds.setX(getAbsoluteX(newX));
+ adjustChildren();
+ }
+
+ public void setY(int newY) {
+ super.setY(newY);
+ bpmnBounds.setY(getAbsoluteY(newY));
+ adjustChildren();
+ }
+
+ public void setHeight(int newHeight) {
+ super.setHeight(newHeight);
+ bpmnBounds.setHeight(newHeight);
+ }
+
+ public void setWidth(int newWidth) {
+ super.setWidth(newWidth);
+ bpmnBounds.setWidth(newWidth);
+ }
+
+ private int getAbsoluteX(int x) {
+ int result = x;
+ org.eclipse.dd.dc.Bounds parentContainerBounds = getParentContainerBounds();
+ if (parentContainerBounds != null) {
+ result += parentContainerBounds.getX();
+ }
+ return result;
+ }
+
+ private int getAbsoluteY(int y) {
+ int result = y;
+ org.eclipse.dd.dc.Bounds parentContainerBounds = getParentContainerBounds();
+ if (parentContainerBounds != null) {
+ result += parentContainerBounds.getY();
+ }
+ return result;
+ }
+
+ private org.eclipse.dd.dc.Bounds getParentContainerBounds() {
+ org.eclipse.dd.dc.Bounds result = null;
+ BpmnShapeImpl parent = getParentContainer();
+ if (parent != null) {
+ LayoutConstraint layoutConstraint = parent.getLayoutConstraint();
+ if (layoutConstraint instanceof BpmnBoundsImpl) {
+ BpmnBoundsImpl bpmnBounds = (BpmnBoundsImpl)layoutConstraint;
+ result = bpmnBounds.getBPMNBounds();
+ }
+ }
+ return result;
+ }
+
+ private BpmnShapeImpl getParentContainer() {
+ BpmnShapeImpl parent = getParent();
+ if (parent != null) {
+ Object parentContainer = parent.eContainer();
+ if (parentContainer != null && parentContainer instanceof BpmnShapeImpl) {
+ return (BpmnShapeImpl)parentContainer;
+ }
+ }
+ return null;
+ }
+
+ private BpmnShapeImpl getParent() {
+ EObject parent = this.eContainer();
+ if (parent != null && parent instanceof BpmnShapeImpl) {
+ return (BpmnShapeImpl)parent;
+ }
+ return null;
+ }
+
+ private void adjustChildren() {
+ BpmnShapeImpl parent = getParent();
+ if (parent != null) {
+ for (Object child : parent.getChildren()) {
+ if (child instanceof BpmnShapeImpl) {
+ BpmnShapeImpl bpmnShape = (BpmnShapeImpl)child;
+ LayoutConstraint layoutConstraint = bpmnShape.getLayoutConstraint();
+ if (layoutConstraint != null && layoutConstraint instanceof BpmnBoundsImpl) {
+ BpmnBoundsImpl bpmnBounds = (BpmnBoundsImpl)layoutConstraint;
+ // these calls reset the absolute coordinates of the adapted bounds object
+ bpmnBounds.setX(bpmnBounds.getX());
+ bpmnBounds.setY(bpmnBounds.getY());
+ }
+ }
+ }
+ }
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnBoundsImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnDiagramImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnDiagramImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnDiagramImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnDiagramImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,181 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.bpmn2.Artifact;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.FlowElementsContainer;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.SubProcess;
+import org.eclipse.bpmn2.di.BPMNDiagram;
+import org.eclipse.bpmn2.di.BPMNEdge;
+import org.eclipse.bpmn2.di.BPMNShape;
+import org.eclipse.dd.di.DiagramElement;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.MeasurementUnit;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.impl.DiagramImpl;
+
+public class BpmnDiagramImpl extends DiagramImpl implements Diagram {
+
+ BPMNDiagram bpmnDiagram;
+
+ public BpmnDiagramImpl(BPMNDiagram diagram) {
+ this.bpmnDiagram = diagram;
+ initialize();
+ }
+
+ private void initialize() {
+ setType("bpmn2");
+ setElement(bpmnDiagram.getPlane().getBpmnElement());
+ setMeasurementUnit(MeasurementUnit.get("Pixel"));
+ initializeViews((FlowElementsContainer)this.getElement(), createViewMap());
+ }
+
+ private void initializeNodes(FlowElementsContainer parent, Map<EObject, View> viewMap) {
+ for (FlowElement flowElement : parent.getFlowElements()) {
+ View view = viewMap.get(flowElement);
+ if (view == null) continue;
+ if (view instanceof BpmnShapeImpl) {
+ initializeShape(parent, flowElement, viewMap);
+ }
+ }
+ }
+
+ private void initializeArtifacts(FlowElementsContainer parent, Map<EObject, View> viewMap) {
+ List<Artifact> artifacts = null;
+ if (parent instanceof Process) {
+ artifacts = ((Process)parent).getArtifacts();
+ } else if (parent instanceof SubProcess) {
+ artifacts = ((SubProcess)parent).getArtifacts();
+ }
+ if (artifacts == null) return;
+ for (Artifact artifact : artifacts) {
+ initializeShape(parent, artifact, viewMap);
+ }
+ }
+
+ private void initializeEdges(FlowElementsContainer parent, Map<EObject, View> viewMap) {
+ for (FlowElement flowElement : parent.getFlowElements()) {
+ View view = viewMap.get(flowElement);
+ if (view == null) continue;
+ if (view instanceof BpmnEdgeImpl) {
+ initializeEdge(parent, flowElement, viewMap);
+ }
+ }
+ }
+
+ private void initializeViews(
+ FlowElementsContainer parent,
+ Map<EObject, View> viewMap) {
+ initializeNodes(parent, viewMap);
+ initializeArtifacts(parent, viewMap);
+ initializeEdges(parent, viewMap);
+ }
+
+ private void initializeEdge(FlowElementsContainer parent, EObject object, Map<EObject, View> viewMap) {
+ View view = viewMap.get(object);
+ if (view != null && view instanceof BpmnEdgeImpl) {
+ BpmnEdgeImpl edge = (BpmnEdgeImpl)view;
+ View parentView = viewMap.get(parent);
+ if (parentView != null && parentView instanceof Diagram) {
+ edge.initialize((Diagram)parentView, viewMap);
+ }
+// EObject bpmnElement = edge.getElement();
+// if (bpmnElement instanceof SequenceFlow) {
+// SequenceFlow sequenceFlow = (SequenceFlow)bpmnElement;
+// FlowNode source = sequenceFlow.getSourceRef();
+// FlowNode target = sequenceFlow.getTargetRef();
+// View sourceView = viewMap.get(source);
+// View targetView = viewMap.get(target);
+// edge.setSource(sourceView);
+// edge.setTarget(targetView);
+// }
+ }
+ }
+
+ private void initializeShape(
+ FlowElementsContainer parent,
+ EObject object,
+ Map<EObject, View> viewMap) {
+ View view = viewMap.get(object);
+ if (view != null && view instanceof BpmnShapeImpl) {
+ BpmnShapeImpl shape = (BpmnShapeImpl)view;
+ View parentView = viewMap.get(parent);
+ if (parentView != null) {
+ shape.initialize(parentView);
+ if (shape.getElement() instanceof FlowElementsContainer) {
+ initializeViews((FlowElementsContainer)shape.getElement(), viewMap);
+ }
+ }
+ }
+ }
+
+ private Map<EObject, View> createViewMap() {
+ List<DiagramElement> diagramElements = bpmnDiagram.getPlane().getPlaneElement();
+ Map<EObject, View> result = new HashMap<EObject, View>();
+ result.put(bpmnDiagram.getPlane().getBpmnElement(), this);
+ for (DiagramElement diagramElement : diagramElements) {
+ if (diagramElement instanceof BPMNShape) {
+ BPMNShape bpmnShape = (BPMNShape)diagramElement;
+ BpmnShapeImpl shape = BpmnNotationFactory.INSTANCE.createShape(bpmnShape);
+ result.put(bpmnShape.getBpmnElement(), shape);
+ } else if (diagramElement instanceof BPMNEdge) {
+ BPMNEdge bpmnEdge = (BPMNEdge)diagramElement;
+ BpmnEdgeImpl edge = BpmnNotationFactory.INSTANCE.createEdge(bpmnEdge);
+ result.put(bpmnEdge.getBpmnElement(), edge);
+ }
+ }
+ return result;
+ }
+
+ public void eNotify(Notification notifier) {
+ if (notifier.getEventType() == Notification.REMOVE) {
+ Object feature = notifier.getFeature();
+ if (feature instanceof EReference) {
+ String name = ((EReference) feature).getName();
+ Object oldValue = notifier.getOldValue();
+ if ("children".equals(name) && oldValue instanceof BpmnShapeImpl) {
+ removeDiagramElement(((BpmnShapeImpl)oldValue).getBPMNShape());
+ } else if ("edges".equals(name) && oldValue instanceof BpmnEdgeImpl) {
+ removeDiagramElement(((BpmnEdgeImpl)oldValue).getBPMNEdge());
+ }
+ }
+ }
+ super.eNotify(notifier);
+ }
+
+ public void insertChild(View child) {
+ super.insertChild(child);
+ if (child instanceof BpmnShapeImpl) {
+ insertShape((BpmnShapeImpl) child);
+ }
+ }
+
+ @Override
+ public void insertEdge(Edge edge) {
+ super.insertEdge(edge);
+ if (edge instanceof BpmnEdgeImpl) {
+ insertEdge((BpmnEdgeImpl)edge);
+ }
+ }
+
+ protected void insertEdge(BpmnEdgeImpl edge) {
+ bpmnDiagram.getPlane().getPlaneElement().add(edge.getBPMNEdge());
+ }
+
+ protected void insertShape(BpmnShapeImpl shape) {
+ bpmnDiagram.getPlane().getPlaneElement().add(shape.getBPMNShape());
+ }
+
+ protected void removeDiagramElement(DiagramElement elementToRemove) {
+ bpmnDiagram.getPlane().getPlaneElement().remove(elementToRemove);
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnDiagramImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnEdgeImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnEdgeImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnEdgeImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnEdgeImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,105 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.FlowNode;
+import org.eclipse.bpmn2.SequenceFlow;
+import org.eclipse.bpmn2.di.BPMNEdge;
+import org.eclipse.dd.dc.Bounds;
+import org.eclipse.dd.dc.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Bendpoints;
+import org.eclipse.gmf.runtime.notation.Connector;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+import org.eclipse.gmf.runtime.notation.impl.ConnectorImpl;
+import org.jboss.tools.bpmn2.process.diagram.part.Bpmn2VisualIDRegistry;
+
+public class BpmnEdgeImpl extends ConnectorImpl implements Connector {
+
+ BPMNEdge bpmnEdge;
+
+ public BpmnEdgeImpl(BPMNEdge edge) {
+ this.bpmnEdge = edge;
+ }
+
+ public BPMNEdge getBPMNEdge() {
+ return bpmnEdge;
+ }
+
+ @Override
+ public void setElement(EObject newElement) {
+ super.setElement(newElement);
+ if (newElement instanceof BaseElement) {
+ bpmnEdge.setBpmnElement((BaseElement) newElement);
+ }
+ }
+
+ @Override
+ public void setBendpoints(Bendpoints bendpoints) {
+ if (bendpoints != null && bendpoints instanceof BpmnBendpointsImpl) {
+ BpmnBendpointsImpl bpmnBendpoints = (BpmnBendpointsImpl)bendpoints;
+ if (bpmnBendpoints.getEdge() != this) {
+ bpmnBendpoints.setEdge(this);
+ // force refresh of the points list
+ bpmnBendpoints.setPoints(bpmnBendpoints.getPoints());
+ }
+ }
+ super.setBendpoints(bendpoints);
+ }
+
+ public void initialize(Diagram parentView, Map<EObject, View> viewMap) {
+ initializeElement(viewMap);
+ initializeBendpoints();
+ setType(Bpmn2VisualIDRegistry.getType(
+ Bpmn2VisualIDRegistry.getLinkWithClassVisualID(getElement())));
+ parentView.insertEdge(this);
+ }
+
+ private void initializeBendpoints() {
+ RelativeBendpoints bendpoints = BpmnNotationFactory.INSTANCE.createRelativeBendpoints();
+ List<Point> waypoints = getBPMNEdge().getWaypoint();
+ ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(waypoints.size());
+ for (Point waypoint : waypoints) {
+ float sourceX = 0, sourceY = 0, targetX = 0, targetY = 0;
+ View source = getSource();
+ if (source instanceof BpmnShapeImpl) {
+ Bounds bounds = ((BpmnShapeImpl)source).getBPMNShape().getBounds();
+ sourceX = waypoint.getX() - bounds.getX();
+ sourceY = waypoint.getY() - bounds.getY();
+ }
+ View target = getTarget();
+ if (target instanceof BpmnShapeImpl) {
+ Bounds bounds = ((BpmnShapeImpl)target).getBPMNShape().getBounds();
+ targetX = waypoint.getX() - bounds.getX();
+ targetY = waypoint.getY() - bounds.getY();
+ }
+ points.add(new RelativeBendpoint((int)sourceX, (int)sourceY, (int)targetX, (int)targetY));
+ }
+ bendpoints.setPoints(points);
+ setBendpoints(bendpoints);
+
+ }
+
+ private void initializeElement(Map<EObject, View> viewMap) {
+ EObject element = bpmnEdge.getBpmnElement();
+ if (element != null) {
+ super.setElement(element);
+ }
+ if (element instanceof SequenceFlow) {
+ SequenceFlow sequenceFlow = (SequenceFlow)element;
+ FlowNode source = sequenceFlow.getSourceRef();
+ FlowNode target = sequenceFlow.getTargetRef();
+ View sourceView = viewMap.get(source);
+ View targetView = viewMap.get(target);
+ setSource(sourceView);
+ setTarget(targetView);
+ }
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnEdgeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnLabelImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnLabelImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnLabelImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnLabelImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,39 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import org.eclipse.bpmn2.di.BPMNLabel;
+import org.eclipse.dd.dc.Bounds;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.impl.DecorationNodeImpl;
+
+public class BpmnLabelImpl extends DecorationNodeImpl implements DecorationNode {
+
+ BPMNLabel bpmnLabel;
+
+ public BpmnLabelImpl(BPMNLabel label) {
+ this.bpmnLabel = label;
+ initializeLocation();
+ }
+
+ public BPMNLabel getBPMNLabel() {
+ return bpmnLabel;
+ }
+
+ private void initializeLocation() {
+ Bounds bounds = bpmnLabel.getBounds();
+ if (bounds != null) {
+ super.setLayoutConstraint(BpmnNotationFactory.INSTANCE
+ .createBounds(bounds));
+ }
+ }
+
+ @Override
+ public void setLayoutConstraint(LayoutConstraint layoutConstraint) {
+ super.setLayoutConstraint(layoutConstraint);
+ if (layoutConstraint instanceof BpmnBoundsImpl) {
+ bpmnLabel.setBounds(((BpmnBoundsImpl) layoutConstraint)
+ .getBPMNBounds());
+ }
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnLabelImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnNotationFactory.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnNotationFactory.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnNotationFactory.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnNotationFactory.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,62 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import org.eclipse.bpmn2.di.BPMNDiagram;
+import org.eclipse.bpmn2.di.BPMNEdge;
+import org.eclipse.bpmn2.di.BPMNLabel;
+import org.eclipse.bpmn2.di.BPMNShape;
+import org.eclipse.bpmn2.di.BpmnDiFactory;
+import org.eclipse.dd.dc.Bounds;
+import org.eclipse.dd.dc.DcFactory;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+public class BpmnNotationFactory {
+
+ public static BpmnNotationFactory INSTANCE = new BpmnNotationFactory();
+
+ public BpmnEdgeImpl createEdge() {
+ BPMNEdge bpmnEdge = BpmnDiFactory.eINSTANCE.createBPMNEdge();
+ bpmnEdge.setId(EcoreUtil.generateUUID());
+ return createEdge(bpmnEdge);
+ }
+
+ public BpmnEdgeImpl createEdge(BPMNEdge bpmnEdge) {
+ return new BpmnEdgeImpl(bpmnEdge);
+ }
+
+ public BpmnShapeImpl createShape() {
+ BPMNShape bpmnShape = BpmnDiFactory.eINSTANCE.createBPMNShape();
+ bpmnShape.setId(EcoreUtil.generateUUID());
+ return createShape(bpmnShape);
+ }
+
+ public BpmnShapeImpl createShape(BPMNShape bpmnShape) {
+ return new BpmnShapeImpl(bpmnShape);
+ }
+
+ public BpmnLabelImpl createLabel() {
+ BPMNLabel bpmnLabel = BpmnDiFactory.eINSTANCE.createBPMNLabel();
+ bpmnLabel.setId(EcoreUtil.generateUUID());
+ return createLabel(bpmnLabel);
+ }
+
+ public BpmnLabelImpl createLabel(BPMNLabel label) {
+ return new BpmnLabelImpl(label);
+ }
+
+ public BpmnBoundsImpl createBounds() {
+ return createBounds(DcFactory.eINSTANCE.createBounds());
+ }
+
+ public BpmnBoundsImpl createBounds(Bounds bounds) {
+ return new BpmnBoundsImpl(bounds);
+ }
+
+ public BpmnDiagramImpl createDiagram(BPMNDiagram bpmnDiagram) {
+ return new BpmnDiagramImpl(bpmnDiagram);
+ }
+
+ public BpmnBendpointsImpl createRelativeBendpoints() {
+ return new BpmnBendpointsImpl();
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnNotationFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnShapeImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/gmf/notation/BpmnShapeImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnShapeImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnShapeImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,124 @@
+package org.jboss.tools.bpmn2.gmf.notation;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.di.BPMNLabel;
+import org.eclipse.bpmn2.di.BPMNPlane;
+import org.eclipse.bpmn2.di.BPMNShape;
+import org.eclipse.dd.dc.Bounds;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.LayoutConstraint;
+import org.eclipse.gmf.runtime.notation.Shape;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.impl.ShapeImpl;
+import org.jboss.tools.bpmn2.process.diagram.part.Bpmn2VisualIDRegistry;
+
+public class BpmnShapeImpl extends ShapeImpl implements Shape {
+
+ BPMNShape bpmnShape;
+
+ public BpmnShapeImpl(BPMNShape shape) {
+ this.bpmnShape = shape;
+ }
+
+ public void initialize(View parentView) {
+ initializeElement();
+ setType(Bpmn2VisualIDRegistry.getType(
+ Bpmn2VisualIDRegistry.getNodeVisualID(
+ parentView,
+ getElement())));
+ parentView.insertChild(this);
+ initializeBounds();
+ initializeLabel(parentView);
+ }
+
+ private void initializeElement() {
+ EObject element = bpmnShape.getBpmnElement();
+ if (element != null) {
+ super.setElement(element);
+ }
+ }
+
+ private void initializeLabel(View parentView) {
+ BPMNLabel bpmnLabel = bpmnShape.getLabel();
+ if (bpmnLabel != null) {
+ DecorationNode label = BpmnNotationFactory.INSTANCE.createLabel(bpmnLabel);
+ if (getElement() != null) {
+ int id = Bpmn2VisualIDRegistry.getLabelVisualId(parentView.getElement(), getElement());
+ if (id != -1) {
+ label.setType(Bpmn2VisualIDRegistry.getType(id));
+ }
+ }
+ super.insertChild(label);
+ }
+ }
+
+ private void initializeBounds() {
+ Bounds bounds = bpmnShape.getBounds();
+ if (bounds != null) {
+ BpmnBoundsImpl bpmnBounds = (BpmnBoundsImpl)BpmnNotationFactory.INSTANCE.createBounds(bounds);
+ super.setLayoutConstraint(bpmnBounds);
+ bpmnBounds.initialize(this);
+ }
+ }
+
+ public BPMNShape getBPMNShape() {
+ return bpmnShape;
+ }
+
+ @Override
+ public void setElement(EObject newElement) {
+ super.setElement(newElement);
+ if (newElement instanceof BaseElement) {
+ bpmnShape.setBpmnElement((BaseElement) newElement);
+ }
+ }
+
+ @Override
+ public void setLayoutConstraint(LayoutConstraint layoutConstraint) {
+ super.setLayoutConstraint(layoutConstraint);
+ if (layoutConstraint instanceof BpmnBoundsImpl) {
+ bpmnShape.setBounds(((BpmnBoundsImpl) layoutConstraint)
+ .getBPMNBounds());
+ }
+ }
+
+ @Override
+ public void insertChild(View child) {
+ super.insertChild(child);
+ if (child instanceof BpmnLabelImpl) {
+ insertLabel((BpmnLabelImpl) child);
+ } else if (child instanceof BpmnShapeImpl) {
+ insertShape((BpmnShapeImpl)child);
+ }
+ }
+
+ protected void insertLabel(BpmnLabelImpl label) {
+ bpmnShape.setLabel(label.getBPMNLabel());
+ }
+
+ protected void insertShape(BpmnShapeImpl shape) {
+ EObject container = bpmnShape.eContainer();
+ if (container instanceof BPMNPlane) {
+ BPMNPlane bpmnPlane = (BPMNPlane)container;
+ bpmnPlane.getPlaneElement().add(shape.getBPMNShape());
+ }
+ }
+
+ public void eNotify(Notification notifier) {
+ if (notifier.getEventType() == Notification.REMOVE) {
+ Object feature = notifier.getFeature();
+ if (feature instanceof EReference) {
+ String name = ((EReference) feature).getName();
+ Object oldValue = notifier.getOldValue();
+ if ("children".equals(name) && oldValue instanceof BpmnShapeImpl) {
+ getDiagram().eNotify(notifier);
+ }
+ }
+ }
+ super.eNotify(notifier);
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/gmf/notation/BpmnShapeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/figures (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/process/diagram/figures)
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySectionBis.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySectionBis.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySectionBis.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySectionBis.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,143 @@
+package org.jboss.tools.bpmn2.process.diagram.sheet;
+
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.provider.Bpmn2ItemProviderAdapterFactory;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+public class Bpmn2PropertySectionBis extends AbstractPropertySection {
+
+ private EObject selectedObject = null;
+ private TreeViewer treeViewer;
+ private PropertySheetPage propertySheetPage;
+ private AdapterFactory adapterFactory = new Bpmn2ItemProviderAdapterFactory();
+ private Composite master, details;
+
+ public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) {
+ super.createControls(parent, tabbedPropertySheetPage);
+ final Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ createMasterArea(composite);
+ createDetailsArea(composite);
+ }
+
+ private void createMasterArea(Composite composite) {
+ master = getWidgetFactory().createComposite(composite);
+ master.setLayoutData(createMasterAreaLayoutData());
+ master.setLayout(new FormLayout());
+ Tree eventTree = getWidgetFactory().createTree(
+ master, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ eventTree.setLayoutData(createFillLayoutData());
+ treeViewer = new TreeViewer(eventTree);
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ treeViewer.setFilters(new ViewerFilter[] { new RootFilter(), new FlowElementFilter() });
+ }
+
+ private FormData createMasterAreaLayoutData() {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(0, 150);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ return data;
+ }
+
+ private FormData createFillLayoutData() {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ return data;
+ }
+
+ private void createDetailsArea(Composite composite) {
+ details = getWidgetFactory().createComposite(composite, SWT.BORDER);
+ details.setLayoutData(createDetailsAreaLayoutData());
+ details.setLayout(new FormLayout());
+ propertySheetPage = new PropertySheetPage();
+ UndoableModelPropertySheetEntry root = new UndoableModelPropertySheetEntry(
+ OperationHistoryFactory.getOperationHistory());
+ root.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ propertySheetPage.setRootEntry(root);
+ propertySheetPage.createControl(details);
+ propertySheetPage.getControl().setLayoutData(createFillLayoutData());
+ }
+
+ private FormData createDetailsAreaLayoutData() {
+ FormData data = new FormData();
+ data.left = new FormAttachment(master, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ return data;
+ }
+
+ public boolean shouldUseExtraSpace() {
+ return true;
+ }
+
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ selectedObject = unwrapSelection(selection);
+ treeViewer.setInput(selectedObject.eContainer());
+ StructuredSelection sel = new StructuredSelection(selectedObject);
+ treeViewer.setSelection(sel);
+ propertySheetPage.selectionChanged(part, sel);
+ }
+
+ private EObject unwrapSelection(ISelection selection) {
+ if (!(selection instanceof StructuredSelection)) {
+ return null;
+ }
+ Object object = ((StructuredSelection)selection).getFirstElement();
+ if (object == null || !(object instanceof EditPart)) {
+ return null;
+ }
+ object = ((EditPart)object).getModel();
+ if (object == null || !(object instanceof View)) {
+ return null;
+ }
+ return ((View)object).getElement();
+ }
+
+ class RootFilter extends ViewerFilter {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (parentElement == selectedObject.eContainer() && element != selectedObject) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ class FlowElementFilter extends ViewerFilter {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (parentElement != selectedObject.eContainer() && element instanceof FlowElement) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySectionBis.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySheetPage.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySheetPage.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySheetPage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySheetPage.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,388 @@
+package org.jboss.tools.bpmn2.process.diagram.sheet;
+
+import org.eclipse.bpmn2.provider.Bpmn2ItemProviderAdapterFactory;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.jboss.tools.bpmn2.process.diagram.part.Bpmn2DiagramEditor;
+
+public class Bpmn2PropertySheetPage extends PropertySheetPage {
+
+// private EObject selectedEditorObject = null;
+// private EObject selectedObject = null;
+ private Bpmn2DiagramEditor editor;
+// private Composite mainControl, masterArea, detailsArea;
+// private TreeViewer treeViewer;
+// private PropertySheetPage propertySheetPage;
+// private AdapterFactory adapterFactory = new Bpmn2ItemProviderAdapterFactory();
+// private Menu popupMenu, addChildSubmenu, addSiblingSubmenu;
+ private AdapterFactory adapterFactory = new Bpmn2ItemProviderAdapterFactory();
+
+ public Bpmn2PropertySheetPage(Bpmn2DiagramEditor editor) {
+ this.editor = editor;
+ UndoableModelPropertySheetEntry root = new UndoableModelPropertySheetEntry(
+ OperationHistoryFactory.getOperationHistory());
+ root.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ setRootEntry(root);
+ }
+
+// @Override
+// public void createControl(Composite parent) {
+//// propertySheetPage = new PropertySheetPage();
+//// UndoableModelPropertySheetEntry root = new UndoableModelPropertySheetEntry(
+//// OperationHistoryFactory.getOperationHistory());
+//// root.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+//// propertySheetPage.setRootEntry(root);
+//// propertySheetPage.createControl(parent);
+//// propertySheetPage.getControl().setLayoutData(createFillLayoutData());
+// mainControl = createMainControl(parent);
+// createMasterArea(mainControl);
+// createDetailsArea(mainControl);
+// }
+//
+// public Composite createMainControl(Composite parent) {
+// Composite composite = editor.getFormToolkit().createComposite(parent);
+// FormLayout layout = new FormLayout();
+// layout.marginWidth = ITabbedPropertyConstants.HSPACE + 2;
+// layout.marginHeight = ITabbedPropertyConstants.VSPACE;
+// layout.spacing = ITabbedPropertyConstants.VMARGIN + 1;
+// composite.setLayout(layout);
+// return composite;
+// }
+//
+// private void createMasterArea(Composite composite) {
+// masterArea = editor.getFormToolkit().createComposite(composite);
+// masterArea.setLayoutData(createMasterAreaLayoutData());
+// masterArea.setLayout(new FormLayout());
+// Tree eventTree = editor.getFormToolkit().createTree(
+// masterArea, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+// eventTree.setLayoutData(createFillLayoutData());
+// popupMenu = createPopupMenu(eventTree);
+// eventTree.setMenu(popupMenu);
+// treeViewer = new TreeViewer(eventTree);
+// treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+// treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+// treeViewer.setFilters(new ViewerFilter[] { new RootFilter(), new FlowElementFilter() });
+// treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+// @Override
+// public void selectionChanged(SelectionChangedEvent event) {
+// handleTreeViewerSelectionChanged(event);
+// }
+// });
+// }
+//
+// private void handleTreeViewerSelectionChanged(SelectionChangedEvent event) {
+// propertySheetPage.selectionChanged(null, event.getSelection());
+// EObject object = unwrapSelection(event.getSelection());
+// if (object != selectedObject) {
+// selectedObject = object;
+// }
+// }
+//
+// private EObject unwrapSelection(ISelection selection) {
+// EObject result = null;
+// if (selection instanceof IStructuredSelection) {
+// Object object = ((IStructuredSelection)selection).getFirstElement();
+// if (object != null && object instanceof EditPart) {
+// object = ((EditPart)object).getModel();
+// }
+// if (object != null && object instanceof View) {
+// result = ((View)object).getElement();
+// } else if (object instanceof EObject) {
+// result = (EObject)object;
+// }
+// }
+// return result;
+// }
+//
+// private FormData createMasterAreaLayoutData() {
+// FormData data = new FormData();
+// data.left = new FormAttachment(0, 0);
+// data.right = new FormAttachment(0, 200);
+// data.top = new FormAttachment(0, 0);
+// data.bottom = new FormAttachment(100, 0);
+// return data;
+// }
+//
+// private FormData createFillLayoutData() {
+// FormData data = new FormData();
+// data.left = new FormAttachment(0, 0);
+// data.right = new FormAttachment(100, 0);
+// data.top = new FormAttachment(0, 0);
+// data.bottom = new FormAttachment(100, 0);
+// return data;
+// }
+//
+// private void createDetailsArea(Composite composite) {
+// detailsArea = editor.getFormToolkit().createComposite(composite, SWT.BORDER);
+// detailsArea.setLayoutData(createDetailsAreaLayoutData());
+// detailsArea.setLayout(new FormLayout());
+// propertySheetPage = new PropertySheetPage();
+// UndoableModelPropertySheetEntry root = new UndoableModelPropertySheetEntry(
+// OperationHistoryFactory.getOperationHistory());
+// root.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+// propertySheetPage.setRootEntry(root);
+// propertySheetPage.createControl(detailsArea);
+// propertySheetPage.getControl().setLayoutData(createFillLayoutData());
+// }
+//
+// private FormData createDetailsAreaLayoutData() {
+// FormData data = new FormData();
+// data.left = new FormAttachment(masterArea, 0);
+// data.right = new FormAttachment(100, 0);
+// data.top = new FormAttachment(0, 0);
+// data.bottom = new FormAttachment(100, 0);
+// return data;
+// }
+//
+// private Menu createPopupMenu(Composite composite) {
+// Menu popupMenu = new Menu(composite);
+// composite.setMenu(popupMenu);
+// popupMenu.addMenuListener(new MenuAdapter() {
+// public void menuShown(MenuEvent e) {
+// depopulatePopupMenu();
+// populatePopupMenu();
+// }
+// });
+// return popupMenu;
+// }
+//
+// private Object getTreeViewerSelectionUnwrapped() {
+// ISelection selection = treeViewer.getSelection();
+// if (selection instanceof IStructuredSelection) {
+// return ((IStructuredSelection)selection).getFirstElement();
+// }
+// return null;
+// }
+//
+// private void createAddChildSubmenu() {
+// MenuItem addChildMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+// addChildMenuItem.setText("&New Child");
+// addChildSubmenu = new Menu(addChildMenuItem);
+// addChildMenuItem.setMenu(addChildSubmenu);
+// Object obj = getTreeViewerSelectionUnwrapped();
+// Collection<?> descriptors = editor.getEditingDomain().getNewChildDescriptors(obj, null);
+// ArrayList<IAction> actions = new ArrayList<IAction>();
+// for (Object descriptor : descriptors) {
+// if (descriptor instanceof CommandParameter) {
+// CommandParameter commandParameter = (CommandParameter)descriptor;
+// Object value = commandParameter.getValue();
+// if (value instanceof FlowElement || value instanceof Artifact || !(value instanceof BaseElement)) continue;
+// actions.add(new CreateChildAction(editor.getEditingDomain(), treeViewer.getSelection(), descriptor));
+// }
+// }
+// addChildMenuItem.setEnabled(!actions.isEmpty());
+// for (final IAction action : actions) {
+// MenuItem menuItem = new MenuItem(addChildSubmenu, SWT.PUSH);
+// menuItem.setText(action.getText());
+// menuItem.setImage(action.getImageDescriptor().createImage());
+// menuItem.addSelectionListener(new SelectionAdapter() {
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// action.run();
+// }
+// });
+// }
+// }
+//
+// private void createAddSiblingSubmenu() {
+// MenuItem addSiblingMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+// addSiblingMenuItem.setText("N&ew Sibling");
+// addSiblingSubmenu = new Menu(addSiblingMenuItem);
+// addSiblingMenuItem.setMenu(addSiblingSubmenu);
+// if (!canEnableAddSibling()) {
+// addSiblingMenuItem.setEnabled(false);
+// } else {
+// Object obj = getTreeViewerSelectionUnwrapped();
+// Collection<?> descriptors = editor.getEditingDomain().getNewChildDescriptors(null, obj);
+// ArrayList<IAction> actions = new ArrayList<IAction>();
+// for (Object descriptor : descriptors) {
+// if (descriptor instanceof CommandParameter) {
+// CommandParameter commandParameter = (CommandParameter)descriptor;
+// Object value = commandParameter.getValue();
+// if (value instanceof FlowElement || value instanceof Artifact || !(value instanceof BaseElement)) continue;
+// actions.add(new CreateSiblingAction(editor.getEditingDomain(), treeViewer.getSelection(), descriptor));
+// }
+// }
+// addSiblingMenuItem.setEnabled(!actions.isEmpty());
+// for (final IAction action : actions) {
+// MenuItem menuItem = new MenuItem(addSiblingSubmenu, SWT.PUSH);
+// menuItem.setText(action.getText());
+// menuItem.setImage(action.getImageDescriptor().createImage());
+// menuItem.addSelectionListener(new SelectionAdapter() {
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// action.run();
+// }
+// });
+// }
+// }
+// }
+//
+// private boolean canEnableAddSibling() {
+// ISelection selection = treeViewer.getSelection();
+// if (selection instanceof IStructuredSelection) {
+// Object object = ((IStructuredSelection)selection).getFirstElement();
+// if (object != null && object instanceof EObject) {
+// return ((EObject)object).eContainer() != treeViewer.getInput();
+// }
+// }
+// return false;
+// }
+//
+// private void depopulatePopupMenu() {
+// disposePopupMenuItems(popupMenu);
+// }
+//
+// private void disposePopupMenuItems(Menu menu) {
+// for (MenuItem menuItem : menu.getItems()) {
+// Menu nestedMenu = menuItem.getMenu();
+// if (nestedMenu != null) {
+// disposePopupMenuItems(nestedMenu);
+// }
+// menuItem.dispose();
+// }
+// }
+//
+// private void populatePopupMenu() {
+// createAddChildSubmenu();
+// createAddSiblingSubmenu();
+// }
+//
+// @Override
+// public void dispose() {
+// popupMenu.dispose();
+// detailsArea.dispose();
+// masterArea.dispose();
+// mainControl.dispose();
+// }
+//
+// @Override
+// public Control getControl() {
+// return mainControl;
+// }
+//
+// @Override
+// public void setActionBars(IActionBars actionBars) {
+// // TODO Auto-generated method stub
+//
+// }
+//
+// @Override
+// public void setFocus() {
+// // TODO Auto-generated method stub
+//
+// }
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (part == editor) {
+ selection = new StructuredSelection(unwrapEditorSelection(selection));
+ }
+ super.selectionChanged(part, selection);
+// if (part == editor || part instanceof Bpmn2Details) {
+// EObject object = unwrapEditorSelection(selection);
+// if (object != selectedEditorObject) {
+// if (selectedEditorObject != null) {
+// selectedEditorObject.eAdapters().remove(selectedElementObserver);
+// }
+// selectedEditorObject = object;
+// if (selectedEditorObject != null) {
+// selectedEditorObject.eAdapters().add(selectedElementObserver);
+// treeViewer.setInput(selectedEditorObject.eContainer());
+// treeViewer.setSelection(new StructuredSelection(selectedEditorObject));
+// } else {
+// treeViewer.setInput(null);
+// treeViewer.setSelection(null);
+// }
+//
+// }
+// }
+// propertySheetPage.selectionChanged(null, selection);
+// EObject object = unwrapSelection(selection);
+// if (object != selectedObject) {
+// selectedObject = object;
+// propertySheetPage.selectionChanged(null, selection);
+// }
+ }
+
+ private EObject unwrapEditorSelection(ISelection selection) {
+ if (!(selection instanceof StructuredSelection)) {
+ return null;
+ }
+ Object object = ((StructuredSelection)selection).getFirstElement();
+ if (object == null || !(object instanceof EditPart)) {
+ return null;
+ }
+ object = ((EditPart)object).getModel();
+ if (object == null || !(object instanceof View)) {
+ return null;
+ }
+ return ((View)object).getElement();
+ }
+
+// class RootFilter extends ViewerFilter {
+// public boolean select(Viewer viewer, Object parentElement, Object element) {
+// if (parentElement == selectedEditorObject.eContainer() && element != selectedEditorObject) {
+// return false;
+// }
+// return true;
+// }
+// }
+//
+// class FlowElementFilter extends ViewerFilter {
+// public boolean select(Viewer viewer, Object parentElement, Object element) {
+// if (parentElement != selectedEditorObject.eContainer() && (element instanceof FlowElement || element instanceof Artifact)) {
+// return false;
+// }
+// return true;
+// }
+// }
+//
+// private SelectedElementObserver selectedElementObserver = new SelectedElementObserver();
+// class SelectedElementObserver extends EContentAdapter {
+// public void notifyChanged(Notification notification) {
+// super.notifyChanged(notification);
+// handleSelectedElementChanged(notification);
+// }
+// }
+//
+// private void handleSelectedElementChanged(Notification notification) {
+// int eventType = notification.getEventType();
+// if (eventType == Notification.ADD || eventType == Notification.SET) {
+// Object object = notification.getNewValue();
+// if (object instanceof EObject) {
+// setIdIfNotSet((EObject)object);
+// updateTreeSelection(object);
+// }
+// }
+// }
+//
+// private void updateTreeSelection(final Object object) {
+// getControl().getDisplay().asyncExec(new Runnable() {
+// @Override
+// public void run() {
+// treeViewer.setSelection(new StructuredSelection(object));
+// }
+// });
+// }
+//
+// protected void setIdIfNotSet(EObject obj) {
+// if (obj.eClass() != null) {
+// EStructuralFeature idAttr = obj.eClass().getEIDAttribute();
+// if (idAttr != null && !obj.eIsSet(idAttr)) {
+// CommandParameter commandParameter = new CommandParameter(obj, idAttr, EcoreUtil.generateUUID(), CommandParameter.NO_INDEX);
+// Command command = editor.getEditingDomain().createCommand(SetCommand.class, commandParameter);
+// editor.getEditingDomain().getCommandStack().execute(command);
+// }
+// }
+// }
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/process/diagram/sheet/Bpmn2PropertySheetPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/util (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/util)
Modified: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/util/Bpmn2ResourceFactoryImpl.java
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/util/Bpmn2ResourceFactoryImpl.java 2010-12-13 17:41:25 UTC (rev 27417)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/util/Bpmn2ResourceFactoryImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -19,7 +19,6 @@
private ResourceHandler resourceHandler = new Bpmn2ResourceHandlerImpl();
- @Override
public Resource createResource(URI uri) {
XMLResource result = (XMLResource)super.createResource(uri);
result.getDefaultLoadOptions().put(XMLResource.OPTION_RESOURCE_HANDLER, resourceHandler);
@@ -29,12 +28,10 @@
class Bpmn2ResourceHandlerImpl implements ResourceHandler {
- @Override
public void preLoad(XMLResource resource, InputStream inputStream,
Map<?, ?> options) {
}
- @Override
public void postLoad(XMLResource resource, InputStream inputStream,
Map<?, ?> options) {
TreeIterator<EObject> contents = resource.getAllContents();
@@ -54,23 +51,10 @@
return BpmnNotationFactory.INSTANCE.createDiagram(bpmnDiagram);
}
- @Override
public void preSave(XMLResource resource, OutputStream outputStream,
Map<?, ?> options) {
}
-// private View getParentView(View candidate, View view) {
-// for (Object child : candidate.getVisibleChildren()) {
-// if (child == view) {
-// return candidate;
-// } else {
-// return getParentView((View)child, view);
-// }
-// }
-// return null;
-// }
-
- @Override
public void postSave(XMLResource resource, OutputStream outputStream,
Map<?, ?> options) {
}
@@ -78,16 +62,4 @@
}
-
-// private void prepareSave(Resource resource) {
-// EObject cur;
-// for (Iterator<EObject> iter = resource.getAllContents(); iter.hasNext();) {
-// cur = iter.next();
-//
-// EStructuralFeature idAttr = cur.eClass().getEIDAttribute();
-// if (idAttr != null && !cur.eIsSet(idAttr)) {
-// cur.eSet(idAttr, EcoreUtil.generateUUID());
-// }
-// }
-// }
}
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Definitions.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/view/Bpmn2Definitions.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Definitions.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Definitions.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,21 @@
+package org.jboss.tools.bpmn2.view;
+
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPageBookViewPage;
+
+public class Bpmn2Definitions extends Bpmn2Details {
+
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ Object obj = part.getAdapter(IBpmn2DefinitionsPage.class);
+ if (obj instanceof IBpmn2DefinitionsPage) {
+ IBpmn2DefinitionsPage page = (IBpmn2DefinitionsPage) obj;
+ if (page instanceof IPageBookViewPage) {
+ initPage((IPageBookViewPage) page);
+ }
+ page.createControl(getPageBook());
+ return new PageRec(part, page);
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Definitions.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DefinitionsPageImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/view/Bpmn2DefinitionsPageImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DefinitionsPageImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DefinitionsPageImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,332 @@
+package org.jboss.tools.bpmn2.view;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.bpmn2.Artifact;
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.provider.Bpmn2ItemProviderAdapterFactory;
+import org.eclipse.dd.di.Diagram;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.Page;
+import org.jboss.tools.bpmn2.process.diagram.part.Bpmn2DiagramEditor;
+
+public class Bpmn2DefinitionsPageImpl extends Page implements IBpmn2DefinitionsPage {
+
+ class FlowElementFilter extends ViewerFilter {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof Process || element instanceof Diagram) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ class SelectedElementObserver extends EContentAdapter {
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ handleSelectedElementChanged(notification);
+ }
+ }
+
+ private EObject selectedTreeObject = null;
+ private Bpmn2DiagramEditor editor;
+ private TreeViewer treeViewer;
+ private AdapterFactory adapterFactory = new Bpmn2ItemProviderAdapterFactory();
+ private Menu popupMenu, addChildSubmenu, addSiblingSubmenu;
+ private SelectedElementObserver selectedElementObserver = new SelectedElementObserver();
+
+ public Bpmn2DefinitionsPageImpl(Bpmn2DiagramEditor editor) {
+ this.editor = editor;
+ }
+
+ public void createControl(Composite parent) {
+ Tree eventTree = editor.getFormToolkit().createTree(
+ parent, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ eventTree.setLayoutData(createFillLayoutData());
+ popupMenu = createPopupMenu(eventTree);
+ eventTree.setMenu(popupMenu);
+ treeViewer = new TreeViewer(eventTree);
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ treeViewer.setAutoExpandLevel(2);
+ treeViewer.setFilters(new ViewerFilter[] { new FlowElementFilter() });
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleTreeViewerSelectionChanged(event);
+ }
+ });
+ Definitions definitions = getDefinitions();
+ if (definitions != null) {
+ definitions.eAdapters().add(selectedElementObserver);
+ treeViewer.setInput(getDefinitions().eContainer());
+ treeViewer.setSelection(new StructuredSelection(definitions));
+ selectedTreeObject = definitions;
+ }
+ }
+
+ private Definitions getDefinitions() {
+ EObject object = editor.getDiagram().getElement();
+ if (object == null || !(object instanceof Process)) {
+ return null;
+ }
+ object = ((Process)object).eContainer();
+ if (!(object instanceof Definitions)) {
+ return null;
+ } else {
+ return (Definitions)object;
+ }
+ }
+
+ private FormData createFillLayoutData() {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ return data;
+ }
+
+ private Menu createPopupMenu(Composite composite) {
+ Menu popupMenu = new Menu(composite);
+ composite.setMenu(popupMenu);
+ popupMenu.addMenuListener(new MenuAdapter() {
+ public void menuShown(MenuEvent e) {
+ depopulatePopupMenu();
+ populatePopupMenu();
+ }
+ });
+ return popupMenu;
+ }
+
+ private void handleTreeViewerSelectionChanged(SelectionChangedEvent event) {
+ ISelectionProvider selectionProvider = getSite().getSelectionProvider();
+ if (selectionProvider != null) {
+ selectionProvider.setSelection(event.getSelection());
+ }
+ EObject object = unwrapTreeViewerSelection(event.getSelection());
+ if (object != selectedTreeObject) {
+ selectedTreeObject = object;
+ }
+ }
+
+ private EObject unwrapTreeViewerSelection(ISelection selection) {
+ EObject result = null;
+ if (selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+ if (object != null && object instanceof EObject) {
+ result = (EObject)object;
+ }
+ }
+ return result;
+ }
+
+ private void populatePopupMenu() {
+ createAddChildSubmenu();
+ createAddSiblingSubmenu();
+ }
+
+ private void createAddChildSubmenu() {
+ MenuItem addChildMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+ addChildMenuItem.setText("&New Child");
+ addChildSubmenu = new Menu(addChildMenuItem);
+ addChildMenuItem.setMenu(addChildSubmenu);
+ Object obj = getTreeViewerSelectionUnwrapped();
+ Collection<?> descriptors = editor.getEditingDomain().getNewChildDescriptors(obj, null);
+ ArrayList<IAction> actions = new ArrayList<IAction>();
+ for (Object descriptor : descriptors) {
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter commandParameter = (CommandParameter)descriptor;
+ Object value = commandParameter.getValue();
+ if (value instanceof FlowElement || value instanceof Artifact || !(value instanceof BaseElement)) continue;
+ actions.add(new CreateChildAction(editor.getEditingDomain(), treeViewer.getSelection(), descriptor));
+ }
+ }
+ addChildMenuItem.setEnabled(!actions.isEmpty());
+ for (final IAction action : actions) {
+ MenuItem menuItem = new MenuItem(addChildSubmenu, SWT.PUSH);
+ menuItem.setText(action.getText());
+ menuItem.setImage(action.getImageDescriptor().createImage());
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ action.run();
+ }
+ });
+ }
+ }
+
+ private void createAddSiblingSubmenu() {
+ MenuItem addSiblingMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+ addSiblingMenuItem.setText("N&ew Sibling");
+ addSiblingSubmenu = new Menu(addSiblingMenuItem);
+ addSiblingMenuItem.setMenu(addSiblingSubmenu);
+ if (!canEnableAddSibling()) {
+ addSiblingMenuItem.setEnabled(false);
+ } else {
+ Object obj = getTreeViewerSelectionUnwrapped();
+ Collection<?> descriptors = editor.getEditingDomain().getNewChildDescriptors(null, obj);
+ ArrayList<IAction> actions = new ArrayList<IAction>();
+ for (Object descriptor : descriptors) {
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter commandParameter = (CommandParameter)descriptor;
+ Object value = commandParameter.getValue();
+ if (value instanceof FlowElement || value instanceof Artifact || !(value instanceof BaseElement)) continue;
+ actions.add(new CreateSiblingAction(editor.getEditingDomain(), treeViewer.getSelection(), descriptor));
+ }
+ }
+ addSiblingMenuItem.setEnabled(!actions.isEmpty());
+ for (final IAction action : actions) {
+ MenuItem menuItem = new MenuItem(addSiblingSubmenu, SWT.PUSH);
+ menuItem.setText(action.getText());
+ menuItem.setImage(action.getImageDescriptor().createImage());
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ action.run();
+ }
+ });
+ }
+ }
+ }
+
+ private boolean canEnableAddSibling() {
+ ISelection selection = treeViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+ if (object != null && object instanceof EObject) {
+ return ((EObject)object).eContainer() != treeViewer.getInput();
+ }
+ }
+ return false;
+ }
+
+ private Object getTreeViewerSelectionUnwrapped() {
+ ISelection selection = treeViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection)selection).getFirstElement();
+ }
+ return null;
+ }
+
+ private void depopulatePopupMenu() {
+ disposePopupMenuItems(popupMenu);
+ }
+
+ private void disposePopupMenuItems(Menu menu) {
+ for (MenuItem menuItem : menu.getItems()) {
+ Menu nestedMenu = menuItem.getMenu();
+ if (nestedMenu != null) {
+ disposePopupMenuItems(nestedMenu);
+ }
+ menuItem.dispose();
+ }
+ }
+
+ public Control getControl() {
+ return treeViewer.getControl();
+ }
+
+ public void setFocus() {
+ // Nothing to do
+
+ }
+
+ public void dispose() {
+ popupMenu.dispose();
+ Definitions definitions = getDefinitions();
+ if (definitions != null) {
+ definitions.eAdapters().remove(selectedElementObserver);
+ }
+ super.dispose();
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ }
+
+ private void handleSelectedElementChanged(Notification notification) {
+ int eventType = notification.getEventType();
+ if (eventType == Notification.ADD || eventType == Notification.SET) {
+ Object object = notification.getNewValue();
+ if (object instanceof EObject) {
+ setIdIfNotSet((EObject)object);
+ updateTreeSelection(object);
+ }
+ }
+ }
+
+ private void updateTreeSelection(final Object object) {
+ getControl().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ treeViewer.setSelection(new StructuredSelection(object), true);
+ }
+ });
+ }
+
+ protected void setIdIfNotSet(EObject obj) {
+ if (obj.eClass() != null) {
+ EStructuralFeature idAttr = obj.eClass().getEIDAttribute();
+ if (idAttr != null && !obj.eIsSet(idAttr)) {
+ CommandParameter commandParameter = new CommandParameter(obj, idAttr, EcoreUtil.generateUUID(), CommandParameter.NO_INDEX);
+ Command command = editor.getEditingDomain().createCommand(SetCommand.class, commandParameter);
+ editor.getEditingDomain().getCommandStack().execute(command);
+ }
+ }
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ treeViewer.addSelectionChangedListener(listener);
+ }
+
+ public ISelection getSelection() {
+ return treeViewer.getSelection();
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ treeViewer.removeSelectionChangedListener(listener);
+
+ }
+
+ public void setSelection(ISelection selection) {
+ // ignore
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DefinitionsPageImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Details.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/view/Bpmn2Details.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Details.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Details.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,119 @@
+package org.jboss.tools.bpmn2.view;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.part.IPageBookViewPage;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.MessagePage;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.PageBookView;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.jboss.tools.bpmn2.process.diagram.part.Bpmn2DiagramEditor;
+
+public class Bpmn2Details extends PageBookView implements ISelectionProvider,
+ ISelectionChangedListener {
+
+ private ISelection bootstrapSelection;
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ getSelectionProvider().addSelectionChangedListener(listener);
+ }
+
+ protected IPage createDefaultPage(PageBook book) {
+ MessagePage page = new MessagePage();
+ initPage(page);
+ page.createControl(book);
+ page.setMessage("Details are not available");
+ return page;
+ }
+
+ protected PageRec doCreatePage(IWorkbenchPart part) {
+ Object obj = part.getAdapter(IBpmn2DetailsPage.class);
+ if (obj instanceof IBpmn2DetailsPage) {
+ IBpmn2DetailsPage page = (IBpmn2DetailsPage) obj;
+ if (page instanceof IPageBookViewPage) {
+ initPage((IPageBookViewPage) page);
+ }
+ page.createControl(getPageBook());
+ return new PageRec(part, page);
+ }
+ return null;
+ }
+
+ protected void doDestroyPage(IWorkbenchPart part, PageRec rec) {
+ IBpmn2DetailsPage page = (IBpmn2DetailsPage) rec.page;
+ page.dispose();
+ rec.dispose();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class type) {
+ IWorkbenchPart currentPart = getCurrentContributingPart();
+ if (type == IPropertySheetPage.class && currentPart != null && currentPart instanceof Bpmn2DiagramEditor) {
+ return ((Bpmn2DiagramEditor)currentPart).getAdapter(type);
+ }
+ return super.getAdapter(type);
+ }
+
+ @Override
+ protected IWorkbenchPart getBootstrapPart() {
+ IWorkbenchPage page = getSite().getPage();
+ if (page != null) {
+ bootstrapSelection = page.getSelection();
+ return page.getActiveEditor();
+ }
+ return null;
+ }
+
+ @Override
+ public void partActivated(IWorkbenchPart part) {
+ super.partActivated(part);
+ if (bootstrapSelection != null) {
+ IPage page = getCurrentPage();
+ if (page != null && page instanceof IBpmn2DetailsPage) {
+ ((IBpmn2DetailsPage)page).selectionChanged(part, bootstrapSelection);
+ bootstrapSelection = null;
+ }
+ }
+ }
+
+ public ISelection getSelection() {
+ return getSelectionProvider().getSelection();
+ }
+
+ protected boolean isImportant(IWorkbenchPart part) {
+ return (part instanceof IEditorPart);
+ }
+
+ public void partBroughtToTop(IWorkbenchPart part) {
+ partActivated(part);
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ getSelectionProvider().removeSelectionChangedListener(listener);
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ getSelectionProvider().selectionChanged(event);
+ }
+
+ public void setSelection(ISelection selection) {
+ getSelectionProvider().setSelection(selection);
+ }
+
+ protected void showPageRec(PageRec pageRec) {
+ IPageSite pageSite = getPageSite(pageRec.page);
+ ISelectionProvider provider = pageSite.getSelectionProvider();
+ if (provider == null && (pageRec.page instanceof IBpmn2DetailsPage)) {
+ pageSite.setSelectionProvider((IBpmn2DetailsPage) pageRec.page);
+ }
+ super.showPageRec(pageRec);
+ }
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2Details.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DetailsPageImpl.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/view/Bpmn2DetailsPageImpl.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DetailsPageImpl.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DetailsPageImpl.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,356 @@
+package org.jboss.tools.bpmn2.view;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.bpmn2.Artifact;
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.provider.Bpmn2ItemProviderAdapterFactory;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.CommandParameter;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MenuAdapter;
+import org.eclipse.swt.events.MenuEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.Page;
+import org.jboss.tools.bpmn2.process.diagram.part.Bpmn2DiagramEditor;
+
+public class Bpmn2DetailsPageImpl extends Page implements IBpmn2DetailsPage {
+
+ class RootFilter extends ViewerFilter {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (parentElement == selectedEditorObject.eContainer() && element != selectedEditorObject) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ class FlowElementFilter extends ViewerFilter {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (parentElement != selectedEditorObject.eContainer() && (element instanceof FlowElement || element instanceof Artifact)) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ class SelectedElementObserver extends EContentAdapter {
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ handleSelectedElementChanged(notification);
+ }
+ }
+
+ private EObject selectedEditorObject = null;
+ private EObject selectedTreeObject = null;
+ private Bpmn2DiagramEditor editor;
+ private TreeViewer treeViewer;
+ private AdapterFactory adapterFactory = new Bpmn2ItemProviderAdapterFactory();
+ private Menu popupMenu, addChildSubmenu, addSiblingSubmenu;
+ private SelectedElementObserver selectedElementObserver = new SelectedElementObserver();
+
+ public Bpmn2DetailsPageImpl(Bpmn2DiagramEditor editor) {
+ this.editor = editor;
+ }
+
+ public void init(IPageSite site) {
+ site.getPage().addSelectionListener(this);
+ super.init(site);
+ }
+
+ public void createControl(Composite parent) {
+ Tree eventTree = editor.getFormToolkit().createTree(
+ parent, SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
+ eventTree.setLayoutData(createFillLayoutData());
+ popupMenu = createPopupMenu(eventTree);
+ eventTree.setMenu(popupMenu);
+ treeViewer = new TreeViewer(eventTree);
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ treeViewer.setFilters(new ViewerFilter[] { new RootFilter(), new FlowElementFilter() });
+ treeViewer.setAutoExpandLevel(2);
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleTreeViewerSelectionChanged(event);
+ }
+ });
+ }
+
+ private FormData createFillLayoutData() {
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ return data;
+ }
+
+ private Menu createPopupMenu(Composite composite) {
+ Menu popupMenu = new Menu(composite);
+ composite.setMenu(popupMenu);
+ popupMenu.addMenuListener(new MenuAdapter() {
+ public void menuShown(MenuEvent e) {
+ depopulatePopupMenu();
+ populatePopupMenu();
+ }
+ });
+ return popupMenu;
+ }
+
+ private void handleTreeViewerSelectionChanged(SelectionChangedEvent event) {
+ ISelectionProvider selectionProvider = getSite().getSelectionProvider();
+ if (selectionProvider != null) {
+ selectionProvider.setSelection(event.getSelection());
+ }
+ EObject object = unwrapTreeViewerSelection(event.getSelection());
+ if (object != selectedTreeObject) {
+ selectedTreeObject = object;
+ }
+ }
+
+ private EObject unwrapTreeViewerSelection(ISelection selection) {
+ EObject result = null;
+ if (selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+ if (object != null && object instanceof EObject) {
+ result = (EObject)object;
+ }
+ }
+ return result;
+ }
+
+ private void populatePopupMenu() {
+ createAddChildSubmenu();
+ createAddSiblingSubmenu();
+ }
+
+ private void createAddChildSubmenu() {
+ MenuItem addChildMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+ addChildMenuItem.setText("&New Child");
+ addChildSubmenu = new Menu(addChildMenuItem);
+ addChildMenuItem.setMenu(addChildSubmenu);
+ Object obj = getTreeViewerSelectionUnwrapped();
+ Collection<?> descriptors = editor.getEditingDomain().getNewChildDescriptors(obj, null);
+ ArrayList<IAction> actions = new ArrayList<IAction>();
+ for (Object descriptor : descriptors) {
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter commandParameter = (CommandParameter)descriptor;
+ Object value = commandParameter.getValue();
+ if (value instanceof FlowElement || value instanceof Artifact || !(value instanceof BaseElement)) continue;
+ actions.add(new CreateChildAction(editor.getEditingDomain(), treeViewer.getSelection(), descriptor));
+ }
+ }
+ addChildMenuItem.setEnabled(!actions.isEmpty());
+ for (final IAction action : actions) {
+ MenuItem menuItem = new MenuItem(addChildSubmenu, SWT.PUSH);
+ menuItem.setText(action.getText());
+ menuItem.setImage(action.getImageDescriptor().createImage());
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ action.run();
+ }
+ });
+ }
+ }
+
+ private void createAddSiblingSubmenu() {
+ MenuItem addSiblingMenuItem = new MenuItem(popupMenu, SWT.CASCADE);
+ addSiblingMenuItem.setText("N&ew Sibling");
+ addSiblingSubmenu = new Menu(addSiblingMenuItem);
+ addSiblingMenuItem.setMenu(addSiblingSubmenu);
+ if (!canEnableAddSibling()) {
+ addSiblingMenuItem.setEnabled(false);
+ } else {
+ Object obj = getTreeViewerSelectionUnwrapped();
+ Collection<?> descriptors = editor.getEditingDomain().getNewChildDescriptors(null, obj);
+ ArrayList<IAction> actions = new ArrayList<IAction>();
+ for (Object descriptor : descriptors) {
+ if (descriptor instanceof CommandParameter) {
+ CommandParameter commandParameter = (CommandParameter)descriptor;
+ Object value = commandParameter.getValue();
+ if (value instanceof FlowElement || value instanceof Artifact || !(value instanceof BaseElement)) continue;
+ actions.add(new CreateSiblingAction(editor.getEditingDomain(), treeViewer.getSelection(), descriptor));
+ }
+ }
+ addSiblingMenuItem.setEnabled(!actions.isEmpty());
+ for (final IAction action : actions) {
+ MenuItem menuItem = new MenuItem(addSiblingSubmenu, SWT.PUSH);
+ menuItem.setText(action.getText());
+ menuItem.setImage(action.getImageDescriptor().createImage());
+ menuItem.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ action.run();
+ }
+ });
+ }
+ }
+ }
+
+ private boolean canEnableAddSibling() {
+ ISelection selection = treeViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+ if (object != null && object instanceof EObject) {
+ return ((EObject)object).eContainer() != treeViewer.getInput();
+ }
+ }
+ return false;
+ }
+
+ private Object getTreeViewerSelectionUnwrapped() {
+ ISelection selection = treeViewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ return ((IStructuredSelection)selection).getFirstElement();
+ }
+ return null;
+ }
+
+ private void depopulatePopupMenu() {
+ disposePopupMenuItems(popupMenu);
+ }
+
+ private void disposePopupMenuItems(Menu menu) {
+ for (MenuItem menuItem : menu.getItems()) {
+ Menu nestedMenu = menuItem.getMenu();
+ if (nestedMenu != null) {
+ disposePopupMenuItems(nestedMenu);
+ }
+ menuItem.dispose();
+ }
+ }
+
+ public Control getControl() {
+ return treeViewer.getControl();
+ }
+
+ public void setFocus() {
+ // Nothing to do
+
+ }
+
+ public void dispose() {
+ super.dispose();
+ popupMenu.dispose();
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (part == editor) {
+ EObject object = unwrapEditorSelection(selection);
+ if (selectedEditorObject == null || object != selectedEditorObject) {
+ if (selectedEditorObject != null) {
+ selectedEditorObject.eAdapters().remove(selectedElementObserver);
+ }
+ selectedEditorObject = object;
+ if (selectedEditorObject != null) {
+ selectedEditorObject.eAdapters().add(selectedElementObserver);
+ treeViewer.setInput(selectedEditorObject.eContainer());
+ treeViewer.setSelection(new StructuredSelection(selectedEditorObject));
+ } else {
+ treeViewer.setInput(null);
+ treeViewer.setSelection(null);
+ }
+
+ }
+ }
+ }
+
+ private EObject unwrapEditorSelection(ISelection selection) {
+ if (!(selection instanceof StructuredSelection)) {
+ return null;
+ }
+ Object object = ((StructuredSelection)selection).getFirstElement();
+ if (object == null || !(object instanceof EditPart)) {
+ return null;
+ }
+ object = ((EditPart)object).getModel();
+ if (object == null || !(object instanceof View)) {
+ return null;
+ }
+ return ((View)object).getElement();
+ }
+
+ private void handleSelectedElementChanged(Notification notification) {
+ int eventType = notification.getEventType();
+ if (eventType == Notification.ADD || eventType == Notification.SET) {
+ Object object = notification.getNewValue();
+ if (object instanceof EObject) {
+ setIdIfNotSet((EObject)object);
+ updateTreeSelection(object);
+ }
+ }
+ }
+
+ private void updateTreeSelection(final Object object) {
+ getControl().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ treeViewer.setSelection(new StructuredSelection(object));
+ }
+ });
+ }
+
+ protected void setIdIfNotSet(EObject obj) {
+ if (obj.eClass() != null) {
+ EStructuralFeature idAttr = obj.eClass().getEIDAttribute();
+ if (idAttr != null && !obj.eIsSet(idAttr)) {
+ CommandParameter commandParameter = new CommandParameter(obj, idAttr, EcoreUtil.generateUUID(), CommandParameter.NO_INDEX);
+ Command command = editor.getEditingDomain().createCommand(SetCommand.class, commandParameter);
+ editor.getEditingDomain().getCommandStack().execute(command);
+ }
+ }
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ treeViewer.addSelectionChangedListener(listener);
+ }
+
+ public ISelection getSelection() {
+ return treeViewer.getSelection();
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ treeViewer.removeSelectionChangedListener(listener);
+
+ }
+
+ public void setSelection(ISelection selection) {
+ // ignore
+ }
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/Bpmn2DetailsPageImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DefinitionsPage.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/view/IBpmn2DefinitionsPage.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DefinitionsPage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DefinitionsPage.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,7 @@
+package org.jboss.tools.bpmn2.view;
+
+
+
+public interface IBpmn2DefinitionsPage extends IBpmn2DetailsPage {
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DefinitionsPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DetailsPage.java (from rev 27417, trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src-custom/org/jboss/tools/bpmn2/view/IBpmn2DetailsPage.java)
===================================================================
--- trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DetailsPage.java (rev 0)
+++ trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DetailsPage.java 2010-12-13 21:07:04 UTC (rev 27419)
@@ -0,0 +1,9 @@
+package org.jboss.tools.bpmn2.view;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.part.IPage;
+
+public interface IBpmn2DetailsPage extends IPage, ISelectionListener, ISelectionProvider {
+
+}
Property changes on: trunk/bpmn/plugins/org.jboss.tools.bpmn2.process.diagram/src/org/jboss/tools/bpmn2/view/IBpmn2DetailsPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
14 years