Author: DartPeng
Date: 2010-07-30 04:20:18 -0400 (Fri, 30 Jul 2010)
New Revision: 23822
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFieldMarker.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ITaskNodeProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ProcessGraphContentProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksTaskDetailsEditorSite.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/TaskTypeManager.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/IProcessProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessGraphicalViewerLabelProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTypeImpl.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskNodeFigure.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskTypeImpl.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TemplateAppyTaskNode.java
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
Log:
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF 2010-07-30
07:57:07 UTC (rev 23821)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF 2010-07-30
08:20:18 UTC (rev 23822)
@@ -11,7 +11,8 @@
org.jboss.tools.smooks.runtime,
org.eclipse.emf.ecore
Export-Package: org.jboss.tools.smooks.model,
- org.jboss.tools.smooks.model.core
+ org.jboss.tools.smooks.model.core,
+ org.jboss.tools.smooks.model.javabean
Bundle-ClassPath: .,
libs/commons-beanutils-1.8.3.jar,
libs/commons-beanutils-bean-collections-1.8.3.jar,
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2010-07-30
07:57:07 UTC (rev 23821)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2010-07-30
08:20:18 UTC (rev 23822)
@@ -16,7 +16,9 @@
org.eclipse.wst.sse.ui,
org.eclipse.emf.common,
org.jboss.tools.smooks.runtime,
- org.eclipse.emf.edit
+ org.eclipse.emf.edit,
+ org.eclipse.zest.core;bundle-version="1.2.0",
+ org.eclipse.zest.layouts;bundle-version="1.1.0"
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFieldMarker.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFieldMarker.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFieldMarker.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public interface IFieldMarker {
+
+ int TYPE_ERROR = 1;
+
+ int TYPE_WARINING = 2;
+
+ int TYPE_NONE = 0;
+
+ void setMessage(String message);
+
+ void setMarkerType(int type);
+
+ int getMarkerType();
+
+ String getMessage();
+
+ void clean();
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/IFieldMarker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2010-07-30
07:57:07 UTC (rev 23821)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -6,6 +6,7 @@
import org.eclipse.ui.PartInitException;
import org.jboss.tools.smooks.dbm.editor.SmooksConfigurationFormPage;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
+import org.jboss.tools.smooks.graphical.editors.SmooksProcessGraphicalEditor;
/**
* @author Dart
@@ -18,7 +19,7 @@
@Override
protected void addPages() {
-
+ addProcessGraphicalEditor();
optionsPage = createSmooksConfigurationOverviewPage();
addSourceSynchronizeListener(optionsPage);
addSmooksEditorInitListener(optionsPage);
@@ -37,4 +38,18 @@
"options_page", Messages.SmooksMultiFormEditor_optinepage_name, this);
//$NON-NLS-1$
}
+ private void addProcessGraphicalEditor() {
+ SmooksProcessGraphicalEditor processPage = new SmooksProcessGraphicalEditor(this,
+ "process", Messages.SmooksMultiFormEditor_processpage_name, this);
//$NON-NLS-1$
+// addSourceSynchronizeListener(processPage);
+// addValidateListener(processPage);
+// addSmooksEditorInitListener(processPage);
+ try {
+ int index = this.addPage(processPage);
+ setPageText(index, Messages.SmooksMultiFormEditor_processtabel_label);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+
}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-07-30
07:57:07 UTC (rev 23821)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -99,6 +99,7 @@
resourceChangeListener = new SmooksResourceTraker();
xmlDocumentTraker = new SmooksXMLEditorDocumentListener();
smooksEditorModelBuilder = new SmooksEditorModelBuilder();
+ initEditingDomain();
}
private void handleCommandStack(CommandStack commandStack) {
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+
+/**
+ * @author Dart
+ *
+ */
+public abstract class AbstractProcessGraphAction extends Action implements
ISelectionChangedListener{
+
+ protected ISmooksModelProvider provider;
+
+ protected ISelection currentSelection = null;
+
+ protected IEditorPart editorPart;
+
+ public AbstractProcessGraphAction(String text , ISmooksModelProvider provider ,
IEditorPart editorPart){
+ super();
+ this.editorPart = editorPart;
+ this.provider = provider;
+ this.setText(text);
+ init();
+ }
+
+ protected void init(){
+
+ }
+
+ @Override
+ public void run() {
+ super.run();
+ }
+
+ public void update(){
+
+ }
+
+ public ISmooksModelProvider getProvider() {
+ return provider;
+ }
+
+ public void setProvider(ISmooksModelProvider provider) {
+ this.provider = provider;
+ }
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ currentSelection = event.getSelection();
+ update();
+ }
+
+ protected List<TaskType> getCurrentSelectedTask(){
+ if(currentSelection != null){
+ List<TaskType> selectedTasks = new ArrayList<TaskType>();
+ List<?> selections = ((IStructuredSelection)currentSelection).toList();
+ for (Iterator<?> iterator = selections.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if(object != null && object instanceof TaskType){
+ selectedTasks.add((TaskType)object);
+ }
+ }
+ return selectedTasks;
+ }
+ return null;
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.actions;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessFactory;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * @author Dart
+ *
+ */
+public class AddNextTaskNodeAction extends AddTaskNodeAction {
+
+ public AddNextTaskNodeAction(String taskID, String text, ISmooksModelProvider provider,
IEditorPart editor) {
+ super(taskID, text, provider, editor);
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ }
+
+ protected void addFreemarkerTemplateTask(IWizard currentWizard, Model<SmooksModel>
resourceList) {
+// if (currentWizard instanceof FreemarkerTemplateParametersProvider) {
+//
+// Freemarker freemarker = FreemarkerFactory.eINSTANCE.createFreemarker();
+//
+// Map<String, String> parameters = ((FreemarkerTemplateParametersProvider)
currentWizard).getParameters();
+// Iterator<String> keys = parameters.keySet().iterator();
+// while (keys.hasNext()) {
+// String key = keys.next();
+// String value = parameters.get(key);
+//
+// ParamType param = SmooksFactory.eINSTANCE.createParamType();
+// param.setName(key);
+// param.setStringValue(value);
+//
+// freemarker.getParam().add(param);
+// }
+//
+// String type = ((FreemarkerTemplateParametersProvider)
currentWizard).getTemplateType();
+// if (type != null) {
+// ParamType param = SmooksFactory.eINSTANCE.createParamType();
+// param.setName(SmooksModelUtils.KEY_TEMPLATE_TYPE);
+// param.setStringValue(type);
+// freemarker.getParam().add(param);
+// }
+//
+// Command addFreemarkerCommand = AddCommand.create(this.provider.getEditingDomain(),
resourceList,
+// SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
FeatureMapUtil
+// .createEntry(FreemarkerPackage.Literals.DOCUMENT_ROOT__FREEMARKER,
freemarker));
+//
+// if (addFreemarkerCommand.canExecute()) {
+// provider.getEditingDomain().getCommandStack().execute(addFreemarkerCommand);
+// TaskType parentTask = this.getCurrentSelectedTask().get(0);
+// TaskType childTask = ProcessFactory.eINSTANCE.createTemplateTask();
+// childTask.addSmooksModel(freemarker);
+// childTask.setType(type);
+// parentTask.addTask(childTask);
+// }
+// }
+ }
+
+ @Override
+ public void run() {
+ super.run();
+ if (this.provider != null) {
+ Model<SmooksModel> root = provider.getSmooksModel();
+// SmooksResourceListType resourceList =
SmooksUIUtils.getSmooks11ResourceListType(provider.getSmooksModel());
+ if (taskID.equals(TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE)) {
+ // open wizard
+// TemplateMessageTypeWizard wizard = new TemplateMessageTypeWizard();
+// WizardDialog dialog = new WizardDialog(editorPart.getSite().getShell(), wizard);
+// if (dialog.open() == Dialog.OK) {
+// // init freemarker model
+// IWizard currentWizard = wizard.getWizard();
+// addFreemarkerTemplateTask(currentWizard, root);
+// } else {
+// return;
+// }
+ } else {
+ TaskType parentTask = this.getCurrentSelectedTask().get(0);
+ TaskType childTask = ProcessFactory.eINSTANCE.createTaskType();
+ childTask.setId(taskID);
+ childTask.setName(TaskTypeManager.getTaskLabel(childTask));
+ parentTask.addTask(childTask);
+ }
+ }
+ }
+
+ protected TaskType createTaskType() {
+ return ProcessFactory.eINSTANCE.createTaskType();
+ }
+
+ @Override
+ public void update() {
+ try{
+ super.update();
+ if (this.isEnabled()) {
+ TaskType testTaskType = ProcessFactory.eINSTANCE.createTaskType();
+ testTaskType.setId(taskID);
+ setEnabled(rules.isNextTask(this.getCurrentSelectedTask().get(0), testTaskType));
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,45 @@
+package org.jboss.tools.smooks.graphical.actions;
+
+import org.eclipse.ui.IEditorPart;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+
+public class AddTaskNodeAction extends AbstractProcessGraphAction {
+
+ protected String taskID = null;
+
+
+ protected TaskTypeRules rules = new TaskTypeRules();
+
+ public AddTaskNodeAction(String taskID, String text, ISmooksModelProvider provider,
IEditorPart editorPart) {
+ super(text, provider,editorPart);
+ this.taskID = taskID;
+ }
+
+ @Override
+ protected void init() {
+ // TODO Auto-generated method stub
+ super.init();
+ }
+
+ @Override
+ public void run() {
+ // TODO Auto-generated method stub
+ super.run();
+ }
+
+ @Override
+ public void update() {
+ this.setEnabled(false);
+ if (this.getCurrentSelectedTask() != null &&
this.getCurrentSelectedTask().size() == 1) {
+ TaskType currentTask = this.getCurrentSelectedTask().get(0);
+ String taskID = currentTask.getId();
+ if (taskID != null) {
+ if (taskID.equals(TaskTypeManager.TASK_ID_INPUT) ||
taskID.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING))
+ this.setEnabled(true);
+ }
+ }
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+import org.jboss.tools.smooks.graphical.editors.process.IProcessProvider;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessType;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+
+/**
+ * @author Dart
+ *
+ */
+public class DeleteTaskNodeAction extends AbstractProcessGraphAction {
+
+ private IProcessProvider processProvider;
+
+ public DeleteTaskNodeAction(IProcessProvider processProvider, ISmooksModelProvider
modelProvider, IEditorPart editor) {
+ super(Messages.DeleteTaskNodeAction_Action_Delete, modelProvider, editor);
+ this.processProvider = processProvider;
+ }
+
+ @Override
+ protected void init() {
+ super.init();
+ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+ setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ }
+
+ @Override
+ public void update() {
+ List<TaskType> taskList = this.getCurrentSelectedTask();
+ if (!taskList.isEmpty() && taskList.size() == 1) {
+ TaskType task = taskList.get(0);
+ if (TaskTypeManager.TASK_ID_INPUT.equals(task.getId())) {
+ this.setEnabled(false);
+ return;
+ }
+ }
+ this.setEnabled((taskList != null && !taskList.isEmpty() &&
taskList.size() == 1));
+ }
+
+ @Override
+ public void run() {
+ super.run();
+// if (getProvider() != null) {
+// if (processProvider != null) {
+// ProcessType process = processProvider.getProcess();
+// if (process != null) {
+// List<TaskType> currentTasks = getCurrentSelectedTask();
+// TaskType currentTask = currentTasks.get(0);
+// List<TaskType> allTask = new ArrayList<TaskType>();
+// SmooksUIUtils.fillAllTask(currentTask, allTask);
+// List<Object> associatedElements = new ArrayList<Object>();
+// SmooksResourceListType listType =
SmooksUIUtils.getSmooks11ResourceListType(provider
+// .getSmooksModel());
+// if (listType != null) {
+// for (Iterator<?> iterator = allTask.iterator(); iterator.hasNext();) {
+// TaskType taskType = (TaskType) iterator.next();
+// List<Object> elements =
TaskTypeManager.getAssociatedSmooksElements(taskType, listType);
+// if (elements != null && !elements.isEmpty()) {
+// associatedElements.addAll(elements);
+// }
+// }
+// }
+// Command remove = null;
+// if (associatedElements.isEmpty()) {
+// Object parent = currentTask.getParent();
+// if (parent instanceof Process) {
+// ((ProcessType) parent).removeTask(currentTask);
+// }
+// if (parent instanceof TaskType) {
+// ((TaskType) parent).removeTask(currentTask);
+// }
+// } else {
+// associatedElements = getDeletedObjects(associatedElements);
+// CompoundCommand ccommand = new CompoundCommand();
+// // Command removeTaskCommand =
+// // RemoveCommand.create(p.getEditingDomain(),
+// // currentTask.eContainer(),
+// // GraphPackage.Literals.TASK_TYPE__TASK, currentTask);
+// // if (removeTaskCommand.canExecute()) {
+// // ccommand.append(removeTaskCommand);
+// // }
+// remove = RemoveCommand.create(this.provider.getEditingDomain(), listType,
+// SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_RESOURCE_CONFIG_GROUP,
+// associatedElements);
+// if (remove.canExecute()) {
+// ccommand.append(remove);
+// Object parent = currentTask.getParent();
+// if (parent instanceof Process) {
+// ((ProcessType) parent).removeTask(currentTask);
+// }
+// if (parent instanceof TaskType) {
+// ((TaskType) parent).removeTask(currentTask);
+// }
+// }
+// provider.getEditingDomain().getCommandStack().execute(ccommand);
+// }
+// }
+// }
+// }
+ }
+
+ private List<Object> getDeletedObjects(List<Object> deletingObjects) {
+ List<Object> objs = new ArrayList<Object>();
+// for (Iterator<?> iterator = deletingObjects.iterator(); iterator.hasNext();) {
+// Object object = (Object) iterator.next();
+// EStructuralFeature feature = SmooksUIUtils.getFeature(object);
+// if (feature != null) {
+// object = FeatureMapUtil.createEntry(feature, object);
+// }
+// objs.add(object);
+// }
+ return objs;
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessType;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+
+/**
+ * @author Dart
+ *
+ */
+public class TaskTypeRules {
+
+ public static void fillAllTask(TaskType task, List<TaskType> taskList) {
+ taskList.add(task);
+ List<TaskType> children = task.getTask();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ TaskType taskType = (TaskType) iterator.next();
+ fillAllTask(taskType, taskList);
+ }
+ }
+
+ public boolean isNextTask(TaskType currentTask, TaskType testTask) {
+ TaskType parentTask = testTask;
+ String parentID = parentTask.getId();
+
+ Object parent = currentTask;
+ while (!(parent instanceof ProcessType) && parent != null) {
+ if (parent instanceof TaskType) {
+ parent = ((TaskType) parent).getParent();
+ }
+ }
+
+ if(parent == null) return false;
+
+ List<TaskType> currentList = ((ProcessType) parent).getTask();
+ List<TaskType> taskList = new ArrayList<TaskType>();
+ for (Iterator<?> iterator = currentList.iterator(); iterator.hasNext();) {
+ TaskType taskType = (TaskType) iterator.next();
+ TaskTypeRules.fillAllTask(taskType, taskList);
+ }
+
+ if (parentID.equals(TaskTypeManager.TASK_ID_INPUT)) {
+ // if (!SmooksConstants.TASK_ID_JAVA_MAPPING.equals(taskID))
+ return false;
+ }
+ if (parentID.equals(TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE)) {
+ if (!TaskTypeManager.TASK_ID_JAVA_MAPPING.equals(currentTask.getId())) {
+ return false;
+ }else{
+ for (Iterator<?> iterator = taskList.iterator(); iterator.hasNext();) {
+ TaskType taskType = (TaskType) iterator.next();
+ if (TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE.equals(taskType.getId())) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ if (parentID.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) {
+ if (!TaskTypeManager.TASK_ID_INPUT.equals(currentTask.getId())) {
+ return false;
+ } else {
+ for (Iterator<?> iterator = taskList.iterator(); iterator.hasNext();) {
+ TaskType taskType = (TaskType) iterator.next();
+ if (TaskTypeManager.TASK_ID_JAVA_MAPPING.equals(taskType.getId())) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean isPreTask(TaskType currentTask, TaskType testTask) {
+ TaskType parentTask = testTask;
+ String currentTaskID = parentTask.getId();
+ if (currentTaskID.equals(TaskTypeManager.TASK_ID_INPUT)) {
+ if (!TaskTypeManager.TASK_ID_JAVA_MAPPING.equals(currentTask.getId())) {
+ return false;
+ } else {
+ List<?> taskList = parentTask.getTask();
+ for (Iterator<?> iterator = taskList.iterator(); iterator.hasNext();) {
+ TaskType object = (TaskType) iterator.next();
+ if (TaskTypeManager.TASK_ID_JAVA_MAPPING.equals(object.getId())) {
+ return false;
+ }
+ }
+ }
+ }
+ if (currentTaskID.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) {
+ // if (!SmooksConstants.TASK_ID_JAVA_MAPPING.equals(taskID))
+ return false;
+ }
+ return true;
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/TaskTypeRules.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ITaskNodeProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ITaskNodeProvider.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ITaskNodeProvider.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors;
+
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ITaskNodeProvider {
+
+ public TaskType getTaskType();
+
+ public void setTaskType(TaskType taskType);
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ITaskNodeProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ProcessGraphContentProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ProcessGraphContentProvider.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ProcessGraphContentProvider.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.zest.core.viewers.IGraphEntityContentProvider;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessType;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+
+/**
+ * @author Dart
+ *
+ */
+public class ProcessGraphContentProvider implements IGraphEntityContentProvider {
+
+ private void collectTasks(List<Object> list, TaskType task) {
+ list.add(task);
+ List<?> tasks = task.getTask();
+ for (Iterator<?> iterator = tasks.iterator(); iterator.hasNext();) {
+ TaskType t = (TaskType) iterator.next();
+ collectTasks(list, t);
+ }
+ }
+
+ private void collectObjects(List<Object> list, ProcessType process) {
+ List<?> tasks = process.getTask();
+ for (Iterator<?> iterator = tasks.iterator(); iterator.hasNext();) {
+ TaskType t = (TaskType) iterator.next();
+ collectTasks(list, t);
+ }
+ }
+
+ public Object[] getElements(Object arg0) {
+ List<Object> list = new ArrayList<Object>();
+ if (arg0 instanceof ProcessType) {
+ collectObjects(list, (ProcessType) arg0);
+ }
+ return list.toArray();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
+ * .viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.viewers.IGraphEntityContentProvider#getConnectedTo
+ * (java.lang.Object)
+ */
+ public Object[] getConnectedTo(Object arg0) {
+ if (arg0 instanceof TaskType) {
+ return ((TaskType) arg0).getTask().toArray();
+ }
+ return new Object[] {};
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ProcessGraphContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,849 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.graphical.editors;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IEditorActionBarContributor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessage;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.widgets.CGraphNode;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.HorizontalTreeLayoutAlgorithm;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.graphical.actions.AbstractProcessGraphAction;
+import org.jboss.tools.smooks.graphical.actions.AddNextTaskNodeAction;
+import org.jboss.tools.smooks.graphical.actions.DeleteTaskNodeAction;
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager.TaskTypeDescriptor;
+import org.jboss.tools.smooks.graphical.editors.process.IProcessProvider;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessFactory;
+import
org.jboss.tools.smooks.graphical.editors.process.ProcessGraphicalViewerLabelProvider;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessTaskAnalyzer;
+import org.jboss.tools.smooks.graphical.editors.process.ProcessType;
+import org.jboss.tools.smooks.graphical.editors.process.TaskNodeFigure;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.graphical.editors.process.TemplateAppyTaskNode;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksProcessGraphicalEditor extends FormPage implements IProcessProvider ,
PropertyChangeListener , IPropertyListener{
+
+ private boolean processMapActived = false;
+
+ private int currentMessageType = IMessageProvider.NONE;
+
+ private String currentMessage = null;
+
+ private boolean processChanged = false;
+
+ private boolean lockProcessChangeEvent = false;
+
+ private List<IAction> processPanelActions = new ArrayList<IAction>();
+
+ public static final int EXECUTE_COMMAND = 0;
+
+ public static final int REDO_COMMAND = 1;
+
+ public static final int UNDO_COMMAND = 2;
+
+ private Object emptyKey = new Object();
+
+ private ISmooksModelProvider smooksModelProvider = null;
+
+ private GraphViewer processGraphViewer;
+
+// private ScrolledPageBook pageBook;
+
+ private Map<String, Object> registedTaskPages = new HashMap<String,
Object>();
+
+ private MenuManager manager;
+
+ protected boolean needupdatewhenshow = true;
+
+ private ProcessType process;
+
+ private Map<Object, String> smooksModelIdMap = new HashMap<Object,
String>();
+
+ private Map<String,Object> detailsControlMap = new HashMap<String,
Object>();
+
+ private Composite detailsContentsComposite;
+
+
+ public SmooksProcessGraphicalEditor(FormEditor editor, String id, String title,
ISmooksModelProvider provider) {
+ super(editor, id, title);
+ this.smooksModelProvider = provider;
+ }
+
+ public SmooksProcessGraphicalEditor(String id, String title, ISmooksModelProvider
provider) {
+ super(id, title);
+ this.smooksModelProvider = provider;
+ this.getManagedForm();
+ }
+
+ protected void createFormContent(IManagedForm managedForm) {
+ super.createFormContent(managedForm);
+ final ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ toolkit.decorateFormHeading(form.getForm());
+ form.getBody().setLayout(new FillLayout());
+ form.setText(Messages.SmooksProcessGraphicalEditor_FormText);
+
+ Composite mainComposite = toolkit.createComposite(form.getBody());
+
+ GridLayout mgl = new GridLayout();
+ mgl.marginHeight = 13;
+ mgl.horizontalSpacing = 20;
+ mainComposite.setLayout(mgl);
+
+ SashForm sashForm = new SashForm(mainComposite, SWT.VERTICAL);
+ sashForm.SASH_WIDTH = 1;
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ sashForm.setLayoutData(gd);
+
+ createProcessGraphicalSection(toolkit, sashForm);
+
+ createTaskDetailsSection(toolkit, sashForm);
+
+ sashForm.setWeights(new int[] { 2, 8 });
+
+// validateEnd(null);
+ }
+
+ protected void createTaskDetailsSection(FormToolkit toolkit, Composite parent) {
+ Composite taskDetailsComposite = toolkit.createComposite(parent);
+ FillLayout taskDetailsFillLayout = new FillLayout();
+ taskDetailsFillLayout.marginWidth = 0;
+ taskDetailsFillLayout.marginHeight = 5;
+ taskDetailsComposite.setLayout(taskDetailsFillLayout);
+
+ Section section = toolkit.createSection(taskDetailsComposite, Section.TITLE_BAR);
+ section.setText(Messages.SmooksProcessGraphicalEditor_TaskConfigurationSectionTitle);
+ detailsContentsComposite = toolkit.createComposite(section);
+ section.setClient(detailsContentsComposite);
+// pageBook = new ScrolledPageBook(section);
+ section.setLayout(new FillLayout());
+// pageBook.setBackground(toolkit.getColors().getBackground());
+// section.setClient(pageBook);
+
+// Composite emptyComposite = pageBook.createPage(emptyKey);
+// emptyComposite.setLayout(new FillLayout());
+// createEmptyTaskPanel(emptyComposite, toolkit);
+// pageBook.showPage(emptyKey);
+ }
+
+
+ protected void createProcessGraphicalSection(FormToolkit toolkit, Composite parent) {
+ Section processGraphSection = toolkit.createSection(parent, Section.TITLE_BAR);
+ processGraphSection.setText(Messages.SmooksProcessGraphicalEditor_TasksMapSectionTitle);
+
+ Composite processGraphComposite = toolkit.createComposite(processGraphSection);
+
+ GridLayout processGraphGridLayoutLayout = new GridLayout();
+ // processGraphFillLayout.marginWidth = 1;
+ // processGraphFillLayout.marginHeight = 1;
+ processGraphComposite.setLayout(processGraphGridLayoutLayout);
+
+ processGraphSection.setClient(processGraphComposite);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ // Composite toolBarComposite =
+ // toolkit.createComposite(processGraphComposite);
+ // FillLayout l = new FillLayout();
+ // l.marginHeight = 1;
+ // l.marginWidth = 1;
+ // toolBarComposite.setLayout(l);
+
+ // toolBarComposite.setLayoutData(gd);
+ //
+ // toolBarComposite.setBackground(toolkit.getColors().getBorderColor());
+ //
+ // createProcessToolBar(toolBarComposite, toolkit);
+
+ Composite graphMainComposite = toolkit.createComposite(processGraphComposite);
+ FillLayout l1 = new FillLayout();
+ l1.marginHeight = 1;
+ l1.marginWidth = 1;
+ graphMainComposite.setLayout(l1);
+ gd = new GridData(GridData.FILL_BOTH);
+ graphMainComposite.setLayoutData(gd);
+ graphMainComposite.setBackground(toolkit.getColors().getBorderColor());
+
+ createProcessGraphicalPanel(graphMainComposite);
+
+ hookProcessGraphicalViewer();
+ configProcessGraphicalViewer();
+ initProcessGraphicalViewer();
+ }
+
+ protected void initProcessGraphicalViewer() {
+ boolean disableProcessViewer = false;
+ if (process == null) {
+ process = ProcessFactory.eINSTANCE.createProcessType();
+ process.addPropertyChangeListener(this);
+ }
+ ProcessTaskAnalyzer analyzer = new ProcessTaskAnalyzer();
+ lockProcessChangeEvent = true;
+ analyzer.analyzeTaskNode(process, smooksModelProvider.getSmooksModel());
+ lockProcessChangeEvent = false;
+ if (getProcessGraphViewer() != null) {
+ getProcessGraphViewer().setInput(process);
+ }
+ if (disableProcessViewer) {
+ getProcessGraphViewer().getControl().setBackground(
+ getManagedForm().getToolkit().getColors().getBorderColor());
+ getProcessGraphViewer().setInput(null);
+ getProcessGraphViewer().getControl().setEnabled(false);
+ }
+ }
+
+ public GraphViewer getProcessGraphViewer() {
+ return processGraphViewer;
+ }
+
+ protected void initProcessGraphicalPanelActions(IMenuManager manager) {
+
+ // AddTaskNodeAction addInputTaskAction = new
+ // AddInputTaskAction(smooksModelProvider);
+ // manager.add(addInputTaskAction);
+ // processPanelActions.add(addInputTaskAction);
+
+ MenuManager addNextTaskMenuManager = new
MenuManager(Messages.SmooksProcessGraphicalEditor_AddTaskActionText);
+ manager.add(addNextTaskMenuManager);
+
+ generateNextTaskActions(addNextTaskMenuManager);
+
+ // MenuManager addPreTaskMenuManager = new
+ // MenuManager("Add Previous Task");
+ // manager.add(addPreTaskMenuManager);
+ //
+ // fillPreTaskMenu(addPreTaskMenuManager);
+
+ DeleteTaskNodeAction deleteAction = new DeleteTaskNodeAction(this, smooksModelProvider,
this);
+ manager.add(deleteAction);
+
+ this.processPanelActions.add(deleteAction);
+
+ }
+
+ private void generateNextTaskActions(MenuManager addNextTaskMenuManager) {
+ List<TaskTypeDescriptor> list = TaskTypeManager.getAllTaskList();
+ for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
+ TaskTypeDescriptor taskTypeDescriptor = (TaskTypeDescriptor) iterator.next();
+ AddNextTaskNodeAction addNextInputAction = new
AddNextTaskNodeAction(taskTypeDescriptor.getId(),
+ taskTypeDescriptor.getLabel(), smooksModelProvider, this);
+ this.processPanelActions.add(addNextInputAction);
+ addNextTaskMenuManager.add(addNextInputAction);
+ }
+ }
+
+
+ protected void configProcessGraphicalViewer() {
+ manager = new MenuManager();
+
+ initProcessGraphicalPanelActions(manager);
+
+ Menu menu = manager.createContextMenu(getProcessGraphViewer().getControl());
+ getProcessGraphViewer().getControl().setMenu(menu);
+ manager.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager manager) {
+ try {
+ manager.removeAll();
+ if (needupdatewhenshow) {
+ updateProcessActions(processGraphViewer.getSelection());
+ fillProcessMenu(manager);
+ } else {
+ for (Iterator<?> iterator = processPanelActions.iterator();
iterator.hasNext();) {
+ IAction action = (IAction) iterator.next();
+ if (action.isEnabled() && !(action instanceof DeleteTaskNodeAction)) {
+ manager.add(action);
+ }
+ }
+ }
+ needupdatewhenshow = true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ needupdatewhenshow = true;
+ }
+ });
+ }
+
+ public void updateProcessActions(ISelection selection) {
+ try{
+ for (Iterator<?> iterator = processPanelActions.iterator(); iterator.hasNext();)
{
+ IAction a = (IAction) iterator.next();
+ if (a instanceof AbstractProcessGraphAction) {
+ ((AbstractProcessGraphAction) a).selectionChanged(new
SelectionChangedEvent(processGraphViewer,
+ selection));
+ }
+ }
+ manager.update();
+ }catch(Throwable t){
+ t.printStackTrace();
+ }
+ }
+
+ public void fillProcessMenu(IMenuManager manager) {
+ MenuManager addNextTaskMenuManager = new
MenuManager(Messages.SmooksProcessGraphicalEditor_AddTaskActionText);
+ manager.add(addNextTaskMenuManager);
+
+ for (Iterator<?> iterator = processPanelActions.iterator(); iterator.hasNext();)
{
+ IAction action = (IAction) iterator.next();
+ if (action instanceof DeleteTaskNodeAction) {
+ manager.add(action);
+ } else {
+ addNextTaskMenuManager.add(action);
+ }
+ }
+ }
+
+
+
+ protected void hookProcessGraphicalViewer() {
+ getProcessGraphViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object firstElement = selection.getFirstElement();
+ if (firstElement == null) {
+ unhighlightGraphNodes();
+ }
+ Graph graph = getProcessGraphViewer().getGraphControl();
+ List<?> nodes = graph.getNodes();
+ GraphItem item = null;
+ for (Iterator<?> iterator = nodes.iterator(); iterator.hasNext();) {
+ GraphItem graphItem = (GraphItem) iterator.next();
+ if (graphItem.getData() == firstElement) {
+ item = graphItem;
+ break;
+ }
+ }
+ if (item != null) {
+ unhighlightGraphNodes();
+ highlightGraphNode(item);
+ }
+// showTaskControl(firstElement);
+// SmooksProcessGraphicalEditor.this.selectionChanged(event);
+ updateGlobalActions();
+ }
+ });
+ // when focus change , update the actions in the Eclipse menu via
+ // EditorContributor
+ getProcessGraphViewer().getControl().addFocusListener(new FocusListener() {
+
+ public void focusLost(FocusEvent e) {
+ processMapActived = false;
+ updateGlobalActions();
+ }
+
+ public void focusGained(FocusEvent e) {
+ processMapActived = true;
+ updateGlobalActions();
+ }
+ });
+ }
+
+ private void updateGlobalActions() {
+ IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ if (contributor != null && contributor instanceof
MultiPageEditorActionBarContributor) {
+ // clean all actions
+ ((MultiPageEditorActionBarContributor) contributor).setActivePage(null);
+ // re-active the page and add all actions
+ ((MultiPageEditorActionBarContributor)
contributor).setActivePage(SmooksProcessGraphicalEditor.this);
+ }
+ }
+
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (lockProcessChangeEvent)
+ return;
+ String name = evt.getPropertyName();
+ Object newtask = evt.getNewValue();
+ Object oldtask = evt.getOldValue();
+ if (ProcessType.PRO_ADD_CHILD.equals(name) ||
ProcessType.PRO_REMOVE_CHILD.equals(name)) {
+ if (getProcessGraphViewer() != null) {
+ getProcessGraphViewer().refresh();
+ getProcessGraphViewer().applyLayout();
+ }
+ processChanged = true;
+ getManagedForm().dirtyStateChanged();
+ }
+
+// if (ProcessType.PRO_ADD_CHILD.equals(name)) {
+// this.showTaskControl(newtask);
+// }
+// if (ProcessType.PRO_REMOVE_CHILD.equals(name)) {
+// this.showTaskControl(null);
+// disposeTaskDetails(oldtask);
+// }
+// validateEnd(null);
+ }
+
+ @Override
+ public boolean isDirty() {
+ boolean dirty = false;
+ Collection<Object> editors = registedTaskPages.values();
+ for (Iterator<?> iterator = editors.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof IEditorPart) {
+ dirty = (((IEditorPart) object).isDirty() || dirty);
+ }
+ }
+ return (dirty || processChanged);
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ Collection<Object> editors = registedTaskPages.values();
+ for (Iterator<?> iterator = editors.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ if (object instanceof IEditorPart) {
+ ((IEditorPart) object).doSave(monitor);
+ }
+ }
+ processChanged = false;
+ firePropertyChange(PROP_DIRTY);
+ }
+
+
+ protected void unhighlightGraphNodes() {
+
+ Graph graph = this.getProcessGraphViewer().getGraphControl();
+ List<?> elements = graph.getNodes();
+ for (Iterator<?> iterator = elements.iterator(); iterator.hasNext();) {
+ GraphItem graphItem = (GraphItem) iterator.next();
+ unhighlightGraphNode(graphItem);
+ }
+ }
+
+ protected void unhighlightGraphNode(GraphItem item) {
+ if (item instanceof CGraphNode) {
+ IFigure figure = ((CGraphNode) item).getFigure();
+ if (figure instanceof TaskNodeFigure) {
+ ((TaskNodeFigure) figure).unhighlightLabel();
+ }
+ }
+ }
+
+ protected void highlightGraphNode(GraphItem item) {
+ if (item instanceof CGraphNode) {
+ IFigure figure = ((CGraphNode) item).getFigure();
+ if (figure instanceof TaskNodeFigure) {
+ ((TaskNodeFigure)
figure).highlightLabel(org.eclipse.draw2d.ColorConstants.darkBlue);
+ }
+ }
+ }
+
+ private void showEmptyPage(){
+ Control[] childrens = detailsContentsComposite.getChildren();
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ GridData gd = new GridData();
+ gd.exclude = true;
+ child.setLayoutData(gd);
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ }
+ detailsContentsComposite.setLayout(new GridLayout());
+ detailsContentsComposite.layout(false);
+ }
+
+ protected boolean isSingltonEditor(Object taskID) {
+ if (taskID.equals(TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE)) {
+ return false;
+ }
+ return true;
+ }
+
+ protected String generateTaskSpecailID(TaskType task) {
+ if (task instanceof TemplateAppyTaskNode) {
+ if (!((TemplateAppyTaskNode) task).getSmooksModel().isEmpty()
+ && ((TemplateAppyTaskNode) task).getSmooksModel().size() == 1) {
+ Object freemarker = ((TemplateAppyTaskNode) task).getSmooksModel().get(0);
+ String taskID = smooksModelIdMap.get(freemarker);
+ if (taskID == null) {
+ String tempstamp = String.valueOf(System.currentTimeMillis());
+ taskID = "freemarker" + "_" + tempstamp; //$NON-NLS-1$
//$NON-NLS-2$
+ this.smooksModelIdMap.put(freemarker, taskID);
+ }
+ return taskID;
+ }
+ }
+ return null;
+ }
+
+ protected IEditorPart createEditorPart(Object taskID) {
+// if (taskID instanceof TemplateAppyTaskNode) {
+// String type = ((TemplateAppyTaskNode) taskID).getType();
+// SmooksFreemarkerTemplateGraphicalEditor freemarkerPart = new
SmooksFreemarkerCSVTemplateGraphicalEditor(
+// smooksModelProvider);
+// if (SmooksModelUtils.FREEMARKER_TEMPLATE_TYPE_CSV.equals(type)) {
+// freemarkerPart = new
SmooksFreemarkerCSVTemplateGraphicalEditor(smooksModelProvider);
+//
+// }
+// if (SmooksModelUtils.FREEMARKER_TEMPLATE_TYPE_XML.equals(type)) {
+// freemarkerPart = new SmooksFreemarkerTemplateGraphicalEditor(smooksModelProvider);
+//
+// }
+// return freemarkerPart;
+// }
+// if (taskID.equals(TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE)) {
+// SmooksFreemarkerTemplateGraphicalEditor freemarkerPart = new
SmooksFreemarkerCSVTemplateGraphicalEditor(
+// smooksModelProvider);
+// return freemarkerPart;
+// }
+// if (taskID.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) {
+// SmooksJavaMappingGraphicalEditor javaMappingPart = new
SmooksJavaMappingGraphicalEditor(smooksModelProvider);
+// return javaMappingPart;
+// }
+// if (taskID.equals(TaskTypeManager.TASK_ID_INPUT)) {
+// SmooksReaderFormPage readerPage = new SmooksReaderFormPage(getEditor(),
"input", "input"); //$NON-NLS-1$ //$NON-NLS-2$
+// return readerPage;
+// }
+ return null;
+ }
+
+ public void registeTaskDetailsPage(IEditorPart editor, String taskID) {
+ editor.addPropertyListener(this);
+ this.registedTaskPages.put(taskID, editor);
+ }
+
+ public Object getRegisteTaskPage(String id) {
+ return registedTaskPages.get(id);
+ }
+
+ protected Control createTaskPanel(Composite parent, FormToolkit toolkit, String taskID)
{
+
+ if (taskID == null)
+ return null;
+
+ if (taskID.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) {
+ return null;
+ }
+
+ if (taskID.equals(TaskTypeManager.TASK_ID_INPUT)) {
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ parent.setLayout(gl);
+ toolkit.createLabel(
+ parent,
+ "Click the link to switch to the \"Input\" tab to configurate the
Smooks Input : ");
+ Hyperlink link = toolkit.createHyperlink(parent,
+ "Go to the Input page", SWT.NONE);
+ link.addHyperlinkListener(new IHyperlinkListener() {
+
+ public void linkExited(HyperlinkEvent e) {
+
+ }
+
+ public void linkEntered(HyperlinkEvent e) {
+
+ }
+
+ public void linkActivated(HyperlinkEvent e) {
+ if (smooksModelProvider instanceof AbstractSmooksFormEditor) {
+ ((AbstractSmooksFormEditor) smooksModelProvider)
+ .setActivePage("reader_page");
+ }
+ }
+ });
+
+ return parent;
+ }
+
+ return null;
+ }
+
+ protected IEditorSite createSite(IEditorPart editor) {
+ return new SmooksTaskDetailsEditorSite(this.getEditor(), editor, this);
+ }
+
+ protected void createTaskPage(IEditorPart editorPart, Composite parent) throws
PartInitException {
+ IEditorSite site = createSite(editorPart);
+ editorPart.init(site, getEditorInput());
+ editorPart.createPartControl(parent);
+ }
+
+ protected void showTaskControl(Object model) {
+ if (detailsContentsComposite == null)
+ return;
+ if (model == null){
+ showEmptyPage();
+ }
+ final Object finalModel = model;
+ detailsContentsComposite.setLayout(new FillLayout());
+ detailsContentsComposite.getShell().getDisplay().syncExec(new Runnable() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ FormToolkit toolkit = ((AbstractSmooksFormEditor) smooksModelProvider).getToolkit();
+ if (finalModel instanceof TaskType) {
+ String id = ((TaskType) finalModel).getId();
+ if (!isSingltonEditor(id)) {
+ String idref = generateTaskSpecailID((TaskType) finalModel);
+ if (idref != null) {
+ // idref = id + "_" + idref;
+ if (getRegisteTaskPage(idref) == null) {
+ IEditorPart editor = createEditorPart(finalModel);
+ registeTaskDetailsPage(editor, idref);
+ }
+ id = idref;
+ } else {
+ id = id + "_unknown"; //$NON-NLS-1$
+ }
+ }
+ if (id != null) {
+ if (!detailsControlMap.containsKey(id)) {
+// Composite parent = pageBook.createPage(id);
+ Control[] childrens = detailsContentsComposite.getChildren();
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ if(child.getLayoutData() instanceof GridData){
+ ((GridData)child.getLayoutData()).exclude = true;
+ }
+ }
+ Object page = getRegisteTaskPage(id);
+ if (page != null && page instanceof IEditorPart) {
+ try {
+ detailsContentsComposite.setLayout(new GridLayout());
+ Composite contentParent = toolkit.createComposite(detailsContentsComposite);
+ contentParent.setLayout(new FillLayout());
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ contentParent.setLayoutData(gd);
+ ITaskNodeProvider nodeProvider = (ITaskNodeProvider) ((IEditorPart) page)
+ .getAdapter(ITaskNodeProvider.class);
+ if (nodeProvider != null) {
+ nodeProvider.setTaskType((TaskType) finalModel);
+ }
+ createTaskPage((IEditorPart) page, contentParent);
+ detailsContentsComposite.layout(false);
+ contentParent.setData(page);
+ detailsControlMap.put(id, contentParent);
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ detailsControlMap.remove(id);
+ showEmptyPage();
+ }
+ } else {
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ if(child.getLayoutData() instanceof GridData){
+ ((GridData)child.getLayoutData()).exclude = true;
+ }
+ }
+ Control control = createTaskPanel(detailsContentsComposite, toolkit, id);
+ if (control != null) {
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ control.setLayoutData(gd);
+ detailsContentsComposite.layout(false);
+ detailsControlMap.put(id, control);
+ } else {
+ detailsControlMap.remove(id);
+ showEmptyPage();
+// pageBook.removePage(id);
+// pageBook.showPage(emptyKey);
+ }
+ }
+ } else {
+ Object page = getRegisteTaskPage(id);
+ ITaskNodeProvider nodeProvider = (ITaskNodeProvider) ((IEditorPart) page)
+ .getAdapter(ITaskNodeProvider.class);
+ if (nodeProvider != null) {
+ nodeProvider.setTaskType((TaskType) finalModel);
+ }
+ Control[] childrens = detailsContentsComposite.getChildren();
+ for (int i = 0; i < childrens.length; i++) {
+ Control child = childrens[i];
+ GridData gd = new GridData();
+ gd.exclude = true;
+ child.setLayoutData(gd);
+ child.setVisible(false);
+ child.setBounds(new Rectangle(0, 0, 0, 0));
+ }
+ detailsContentsComposite.setLayout(new GridLayout());
+
+ Control contentParent = (Control)detailsControlMap.get(id);
+ contentParent.setVisible(true);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ contentParent.setLayoutData(gd);
+ detailsContentsComposite.layout(false);
+ }
+ }
+ } else {
+ showEmptyPage();
+ }
+ }
+
+ });
+ updateGlobalActions();
+ }
+
+ protected void createProcessGraphicalPanel(Composite parent) {
+ processGraphViewer = new GraphViewer(parent, SWT.NONE);
+ processGraphViewer.getControl().dispose();
+ processGraphViewer.setControl(new Graph(parent, SWT.NONE) {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.zest.core.widgets.Graph#dispose()
+ */
+ @Override
+ public void dispose() {
+ try {
+ super.dispose();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ });
+ // GridData gd = new GridData(GridData.FILL_BOTH);
+ // processGraphViewer.getControl().setLayoutData(gd);
+ // processGraphViewer.setNodeStyle(ZestStyles.NODES_FISHEYE);
+ processGraphViewer.setContentProvider(new ProcessGraphContentProvider());
+ processGraphViewer.setLabelProvider(new ProcessGraphicalViewerLabelProvider(this));
+ processGraphViewer.setConnectionStyle(ZestStyles.CONNECTIONS_DIRECTED);
+ HorizontalTreeLayoutAlgorithm layoutAlgorithm = new HorizontalTreeLayoutAlgorithm(
+ LayoutStyles.NO_LAYOUT_NODE_RESIZING);
+ processGraphViewer.setLayoutAlgorithm(layoutAlgorithm, true);
+ if (parent instanceof Section) {
+ ((Section) parent).setClient(processGraphViewer.getControl());
+ }
+ }
+
+
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ updateHeaderFormMessage();
+ }
+
+ protected void updateHeaderFormMessage() {
+ if (this.getManagedForm() != null) {
+ getManagedForm().getMessageManager().removeAllMessages();
+ getManagedForm().getMessageManager().update();
+ getProcessGraphViewer().getControl().setEnabled(true);
+ getProcessGraphViewer().getControl().setBackground(
+ getManagedForm().getToolkit().getColors().getBackground());
+ }
+ if (currentMessageType != IMessageProvider.NONE && currentMessage != null) {
+ if (this.getProcessGraphViewer() != null) {
+ getProcessGraphViewer().getControl().setBackground(GraphicsConstants.BORDER_CORLOR);
+ getProcessGraphViewer().getControl().setEnabled(false);
+ getProcessGraphViewer().setInput(new Object());
+// showTaskControl(null);
+ }
+ if (this.getManagedForm() != null) {
+
+ String[] messages = currentMessage.split("\n"); //$NON-NLS-1$
+ List<IMessage> messageList = new ArrayList<IMessage>();
+ for (int i = 0; i < messages.length; i++) {
+ String message = messages[i];
+ if (message != null)
+ message.trim();
+ if (message.length() == 0) {
+ continue;
+ }
+ messageList.add(new SmooksMessage(currentMessageType, message));
+ }
+ String mainMessage = null;
+ if (messageList.isEmpty()) {
+ mainMessage = currentMessage;
+ } else {
+ mainMessage = messageList.get(0).getMessage();
+ }
+
+ this.getManagedForm().getForm().getForm().setMessage(mainMessage,
currentMessageType,
+ messageList.toArray(new IMessage[] {}));
+
+ }
+ }
+ }
+
+ /**
+ * @return the needupdatewhenshow
+ */
+ public boolean isNeedupdatewhenshow() {
+ return needupdatewhenshow;
+ }
+
+ /**
+ * @param needupdatewhenshow
+ * the needupdatewhenshow to set
+ */
+ public void setNeedupdatewhenshow(boolean needupdatewhenshow) {
+ this.needupdatewhenshow = needupdatewhenshow;
+ }
+
+ public ProcessType getProcess() {
+ return this.process;
+ }
+
+ public void propertyChanged(Object source, int propId) {
+ this.firePropertyChange(propId);
+ if (propId == PROP_DIRTY) {
+ this.getManagedForm().dirtyStateChanged();
+ }
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksTaskDetailsEditorSite.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksTaskDetailsEditorSite.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksTaskDetailsEditorSite.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors;
+
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.part.MultiPageEditorSite;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksTaskDetailsEditorSite extends MultiPageEditorSite {
+
+ private FormPage parentEditor = null;
+
+ public SmooksTaskDetailsEditorSite(MultiPageEditorPart multiPageEditor, IEditorPart
editor,
+ FormPage parentEditor) {
+ super(multiPageEditor, editor);
+ this.parentEditor = parentEditor;
+ }
+
+ /**
+ * @return the parentEditor
+ */
+ public FormPage getParentEditor() {
+ return parentEditor;
+ }
+
+ /**
+ * @param parentEditor the parentEditor to set
+ */
+ public void setParentEditor(FormPage parentEditor) {
+ this.parentEditor = parentEditor;
+ }
+
+
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksTaskDetailsEditorSite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/TaskTypeManager.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/TaskTypeManager.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/TaskTypeManager.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.graphical.editors.process.TemplateAppyTaskNode;
+//import org.jboss.tools.smooks.model.freemarker.Freemarker;
+//import org.jboss.tools.smooks.model.javabean12.BeanType;
+//import org.jboss.tools.smooks.model.smooks.AbstractResourceConfig;
+//import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+
+/**
+ * @author Dart
+ *
+ */
+public class TaskTypeManager {
+
+ public static final String TASK_ID_INPUT = "input"; //$NON-NLS-1$
+
+ public static final String TASK_ID_JAVA_MAPPING = "java_mapping";
//$NON-NLS-1$
+
+ public static final String TASK_ID_XSL_TEMPLATE = "xsl_template";
//$NON-NLS-1$
+
+ public static final String TASK_ID_FREEMARKER_CSV_TEMPLATE =
"freemarker_csv_template"; //$NON-NLS-1$
+
+ public static final String TASK_ID_FREEMARKER_XML_TEMPLATE =
"freemarker_xml_template"; //$NON-NLS-1$
+
+ private static List<TaskTypeDescriptor> allTaskList = null;
+
+ public static String[] getChildTaskIDs(String parentId) {
+ if (parentId == null)
+ return null;
+ if (parentId.equals(TaskTypeManager.TASK_ID_INPUT)) {
+ return new String[] { TaskTypeManager.TASK_ID_JAVA_MAPPING };
+ }
+ if (parentId.equals(TaskTypeManager.TASK_ID_JAVA_MAPPING)) {
+ return new String[] { TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE };
+ }
+ return null;
+ }
+
+ /**
+ * @return the allTaskList
+ */
+ public static List<TaskTypeDescriptor> getAllTaskList() {
+ if (allTaskList == null) {
+ allTaskList = new ArrayList<TaskTypeDescriptor>();
+
+ // init
+ allTaskList.add(new TaskTypeDescriptor(TASK_ID_INPUT, Messages.TaskTypeManager_Input,
+ GraphicsConstants.IMAGE_INPUT_TASK));
+ allTaskList.add(new TaskTypeDescriptor(TASK_ID_JAVA_MAPPING,
Messages.TaskTypeManager_JavaMappingTaskLabel,
+ GraphicsConstants.IMAGE_JAVA_AMPPING_TASK));
+ allTaskList.add(new TaskTypeDescriptor(TASK_ID_FREEMARKER_CSV_TEMPLATE,
+ Messages.TaskTypeManager_ApplyTemplateTaskLabel,
GraphicsConstants.IMAGE_APPLY_FREEMARKER_TASK));
+ }
+ return allTaskList;
+ }
+
+ public static List<Object> getAssociatedSmooksElementsType(TaskType taskType) {
+ return null;
+ }
+
+// public static List<Object> getAssociatedSmooksElementsType(String taskID) {
+// List<Object> elementsType = new ArrayList<Object>();
+// if (taskID == null)
+// return null;
+// if (TASK_ID_JAVA_MAPPING.equals(taskID)) {
+// elementsType.add(BeanType.class);
+// }
+// if (TASK_ID_FREEMARKER_CSV_TEMPLATE.equals(taskID)) {
+// elementsType.add(Freemarker.class);
+// }
+// return elementsType;
+// }
+
+ public static String getTaskLabel(TaskType task) {
+ if (task != null) {
+ String taskId = task.getId();
+ if (taskId != null) {
+ if (taskId.equals(TASK_ID_FREEMARKER_CSV_TEMPLATE)) {
+ String messageType = ""; //$NON-NLS-1$
+ if (task instanceof TemplateAppyTaskNode) {
+ messageType = ((TemplateAppyTaskNode) task).getType();
+ }
+ if (messageType == null)
+ messageType = ""; //$NON-NLS-1$
+ if (messageType.length() > 0){
+ return Messages.TaskTypeManager_ApplyTemplateTaskLabel + " (" +
messageType +")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }else{
+ return Messages.TaskTypeManager_ApplyTemplateTaskLabel;
+ }
+ }
+ if (taskId.equals(TASK_ID_INPUT)) {
+ return Messages.TaskTypeManager_InputTaskLabel;
+ }
+ if (taskId.equals(TASK_ID_JAVA_MAPPING)) {
+ return Messages.TaskTypeManager_JavaMappingTaskLabel;
+ }
+ if (taskId.equals(TASK_ID_XSL_TEMPLATE)) {
+ return Messages.TaskTypeManager_ApplyXSLTemplateTaskLabel;
+ }
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+// /**
+// *
+// * @param taskID
+// * @param smooksResourceList
+// * @return
+// */
+// public static List<Object> getAssociatedSmooksElements(TaskType taskType,
SmooksResourceListType smooksResourceList) {
+// List<Object> elementTypes = getAssociatedSmooksElementsType(taskType.getId());
+// List<AbstractResourceConfig> resourceConfigList =
smooksResourceList.getAbstractResourceConfig();
+// List<Object> associatedElements = new ArrayList<Object>();
+// for (Iterator<?> iterator = resourceConfigList.iterator(); iterator.hasNext();)
{
+// AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig)
iterator.next();
+// if (isSameType(abstractResourceConfig, elementTypes) &&
canRemove(abstractResourceConfig, taskType)) {
+// associatedElements.add(abstractResourceConfig);
+// }
+// }
+// return associatedElements;
+// }
+//
+// private static boolean canRemove(AbstractResourceConfig abstractResourceConfig,
TaskType taskType) {
+// if (abstractResourceConfig instanceof Freemarker) {
+// return taskType.inTheTask(abstractResourceConfig);
+// }
+// return true;
+// }
+
+ private static boolean isSameType(Object element, List<Object> elementTypes) {
+ for (Iterator<?> iterator = elementTypes.iterator(); iterator.hasNext();) {
+ Class<?> object = (Class<?>) iterator.next();
+ if (object.isInstance(element)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static final class TaskTypeDescriptor {
+
+ private String id;
+
+ private String label;
+
+ private String imagePath;
+
+ public TaskTypeDescriptor(String id, String label, String imagePath) {
+ this.id = id;
+ this.label = label;
+ this.imagePath = imagePath;
+ }
+
+ /**
+ * @return the id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @param id
+ * the id to set
+ */
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * @return the label
+ */
+ public String getLabel() {
+ return label;
+ }
+
+ /**
+ * @param label
+ * the label to set
+ */
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ /**
+ * @return the imagePath
+ */
+ public String getImagePath() {
+ return imagePath;
+ }
+
+ /**
+ * @param imagePath
+ * the imagePath to set
+ */
+ public void setImagePath(String imagePath) {
+ this.imagePath = imagePath;
+ }
+
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/TaskTypeManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/IProcessProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/IProcessProvider.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/IProcessProvider.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors.process;
+
+
+/**
+ * @author Dart
+ *
+ */
+public interface IProcessProvider {
+ ProcessType getProcess();
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/IProcessProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessFactory.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors.process;
+
+/**
+ * @author Dart
+ *
+ */
+public class ProcessFactory {
+ public static ProcessFactory eINSTANCE = new ProcessFactory();
+
+ public TaskType createTaskType(){
+ return new TaskTypeImpl();
+ }
+
+ public ProcessType createProcessType(){
+ return new ProcessTypeImpl();
+ }
+
+ public TemplateAppyTaskNode createTemplateTask(){
+ return new TemplateAppyTaskNode();
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessGraphicalViewerLabelProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessGraphicalViewerLabelProvider.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessGraphicalViewerLabelProvider.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors.process;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.zest.core.viewers.IFigureProvider;
+import org.eclipse.zest.core.viewers.ISelfStyleProvider;
+import org.eclipse.zest.core.widgets.CGraphNode;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.configuration.editors.IFieldMarker;
+import org.jboss.tools.smooks.graphical.editors.SmooksProcessGraphicalEditor;
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager.TaskTypeDescriptor;
+
+/**
+ * @author Dart
+ *
+ */
+public class ProcessGraphicalViewerLabelProvider extends LabelProvider implements
IFigureProvider, ISelfStyleProvider {
+
+ private SmooksProcessGraphicalEditor processEditor;
+
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ public ProcessGraphicalViewerLabelProvider(SmooksProcessGraphicalEditor graph) {
+ this.processEditor = graph;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof TaskType) {
+ String id = ((TaskType) element).getId();
+ List<TaskTypeDescriptor> des = TaskTypeManager.getAllTaskList();
+ for (Iterator<?> iterator = des.iterator(); iterator.hasNext();) {
+ TaskTypeDescriptor taskTypeDescriptor = (TaskTypeDescriptor) iterator.next();
+ if (taskTypeDescriptor.getId().equals(id)) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ taskTypeDescriptor.getImagePath());
+ }
+ }
+ }
+ return super.getImage(element);
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof TaskType) {
+ String label = TaskTypeManager.getTaskLabel((TaskType)element);
+ if(label == null){
+ label = ((TaskType) element).getId();
+ }
+ return label;
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.zest.core.viewers.IFigureProvider#getFigure(java.lang.Object)
+ */
+ public IFigure getFigure(Object element) {
+ if (element instanceof TaskType) {
+ // if(TaskTypeManager.TASK_ID_INPUT.equals(((TaskType)element).getId())){
+ Image image = getImage(element);
+ String text = getText(element);
+ return new TaskNodeFigure(processEditor, image, text);
+ // }
+ }
+ return null;
+ }
+
+ public void selfStyleConnection(Object element, GraphConnection connection) {
+ connection.setLineColor(GraphicsConstants.BORDER_CORLOR);
+ }
+
+ private String getProblemMessage(List<String> message){
+ String m = null;
+ if(message != null && !message.isEmpty()){
+ m = ""; //$NON-NLS-1$
+ for (Iterator<String> iterator = message.iterator(); iterator.hasNext();) {
+ String string = (String) iterator.next();
+ m = m + " - " + string +" \n"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return m;
+ }
+
+ public void selfStyleNode(Object element, GraphNode node) {
+ if (node instanceof CGraphNode) {
+ IFigure figure = ((CGraphNode) node).getFigure();
+ if(figure instanceof TaskNodeFigure && element instanceof TaskType){
+ int problem = ((TaskType)element).getProblemType();
+ List<String> problemMessages = ((TaskType)element).getProblemMessages();
+
+ String message = getProblemMessage(problemMessages);
+
+ ImageRegistry ir = SmooksConfigurationActivator.getDefault().getImageRegistry();
+ switch(problem){
+ case IFieldMarker.TYPE_NONE:
+ ((TaskNodeFigure)figure).getLabel().setIcon(null);
+ break;
+ case IFieldMarker.TYPE_ERROR:
+ ((TaskNodeFigure)figure).getLabel().setIcon(ir.get(GraphicsConstants.IMAGE_ERROR));
+ break;
+ case IFieldMarker.TYPE_WARINING:
+ ((TaskNodeFigure)figure).getLabel().setIcon(ir.get(GraphicsConstants.IMAGE_WARNING));
+ break;
+ }
+ ((TaskNodeFigure)figure).setProblemMessage(message);
+ }
+ Dimension size = figure.getLayoutManager().getPreferredSize(figure, -1, -1);
+ figure.setSize(size);
+ }
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessGraphicalViewerLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors.process;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IComponent;
+import org.jboss.tools.smooks.model.javabean.IBean;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * @author Dart
+ *
+ */
+public class ProcessTaskAnalyzer {
+
+ public void analyzeTaskNode(ProcessType process,
+ Model<SmooksModel> rootSmooksModel) {
+ process.getTask().clear();
+ if (rootSmooksModel == null)
+ return;
+ // Input task node must be in process:
+ TaskType inputTask = ProcessFactory.eINSTANCE.createTaskType();
+ inputTask.setId(TaskTypeManager.TASK_ID_INPUT);
+ inputTask.setName(TaskTypeManager.getTaskLabel(inputTask));
+
+ process.addTask(inputTask);
+
+
+ List<IComponent> compoenents = rootSmooksModel.getModelRoot()
+ .getComponents();
+
+ // the java mapping is the next task node of input task:
+ TaskType javaMappingTask = null;
+ for (Iterator<?> iterator = compoenents.iterator(); iterator.hasNext();) {
+ IComponent component = (IComponent) iterator.next();
+ if (component instanceof IBean) {
+ javaMappingTask = ProcessFactory.eINSTANCE.createTaskType();
+ javaMappingTask.setId(TaskTypeManager.TASK_ID_JAVA_MAPPING);
+ javaMappingTask.setName(TaskTypeManager
+ .getTaskLabel(javaMappingTask));
+ inputTask.addTask(javaMappingTask);
+ break;
+ }
+ }
+
+ // the apply template is the next task node of java mapping task:
+ if (javaMappingTask != null) {
+// for (Iterator<?> iterator = compoenents.iterator(); iterator
+// .hasNext();) {
+// Component component = (Component) iterator.next();
+// if (component instanceof FreeMarkerTemplate) {
+// TemplateAppyTaskNode templateTask = (TemplateAppyTaskNode)
ProcessFactory.eINSTANCE
+// .createTemplateTask();
+// templateTask.setType("XML");
+// templateTask.addSmooksModel(component);
+// templateTask.setName(TaskTypeManager
+// .getTaskLabel(templateTask));
+// javaMappingTask.addTask(templateTask);
+// }
+// }
+// for (Iterator<?> iterator = resourceConfigList.iterator(); iterator
+// .hasNext();) {
+// AbstractResourceConfig abstractResourceConfig = (AbstractResourceConfig) iterator
+// .next();
+// if (abstractResourceConfig instanceof Freemarker) {
+// String messageType = SmooksModelUtils.getParamValue(
+// ((Freemarker) abstractResourceConfig).getParam(),
+// SmooksModelUtils.KEY_TEMPLATE_TYPE);
+// if (SmooksModelUtils.FREEMARKER_TEMPLATE_TYPE_CSV
+// .equals(messageType)
+// || SmooksModelUtils.FREEMARKER_TEMPLATE_TYPE_XML
+// .equals(messageType)) {
+// TemplateAppyTaskNode templateTask = (TemplateAppyTaskNode)
ProcessFactory.eINSTANCE
+// .createTemplateTask();
+// templateTask.setType(messageType);
+// templateTask.addSmooksModel(abstractResourceConfig);
+// templateTask.setName(TaskTypeManager
+// .getTaskLabel(templateTask));
+// javaMappingTask.addTask(templateTask);
+// }
+// }
+// }
+ }
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessType.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessType.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessType.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,120 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.graphical.editors.process;
+
+
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Process
Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.ProcessType#getTask
<em>Task</em>}</li>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.ProcessType#getId
<em>Id</em>}</li>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.ProcessType#getName
<em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getProcessType()
+ * @model extendedMetaData="name='process_._type'
kind='elementOnly'"
+ * @generated
+ */
+public interface ProcessType {
+
+ public static final String PRO_NAME_CHANGE = "pro_name_change"; //$NON-NLS-1$
+
+ public static final String PRO_ID_CHANGE = "pro_id_change"; //$NON-NLS-1$
+
+ public static final String PRO_ADD_CHILD = "pro_add_child"; //$NON-NLS-1$
+
+ public static final String PRO_REMOVE_CHILD = "pro_remove_child";
//$NON-NLS-1$
+
+ public void addPropertyChangeListener(PropertyChangeListener listener);
+
+ public void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * Returns the value of the '<em><b>Task</b></em>'
containment reference list.
+ * The list contents are of type {@link
org.jboss.tools.smooks.model.graphics.ext.TaskType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Task</em>' containment reference list
isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Task</em>' containment reference
list.
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getProcessType_Task()
+ * @model containment="true"
+ * extendedMetaData="kind='element' name='task'
namespace='##targetNamespace'"
+ * @generated
+ */
+ List<TaskType> getTask();
+
+ /**
+ * Returns the value of the '<em><b>Id</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id</em>' attribute.
+ * @see #setId(String)
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getProcessType_Id()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * extendedMetaData="kind='attribute' name='id'"
+ * @generated
+ */
+ String getId();
+
+ /**
+ * Sets the value of the '{@link
org.jboss.tools.smooks.model.graphics.ext.ProcessType#getId <em>Id</em>}'
attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(String value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getProcessType_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * extendedMetaData="kind='attribute' name='name'"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link
org.jboss.tools.smooks.model.graphics.ext.ProcessType#getName
<em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ public void addTask(TaskType task);
+
+ public void removeTask(TaskType task);
+
+} // ProcessType
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTypeImpl.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTypeImpl.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTypeImpl.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,191 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.graphical.editors.process;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '
+ * <em><b>Process Type</b></em>'. <!-- end-user-doc
-->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.jboss.tools.smooks.model.graphics.ext.impl.ProcessTypeImpl#getTask
+ * <em>Task</em>}</li>
+ * <li>
+ * {@link org.jboss.tools.smooks.model.graphics.ext.impl.ProcessTypeImpl#getId
+ * <em>Id</em>}</li>
+ * <li>
+ * {@link org.jboss.tools.smooks.model.graphics.ext.impl.ProcessTypeImpl#getName
+ * <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ProcessTypeImpl implements ProcessType {
+
+ private PropertyChangeSupport support = new PropertyChangeSupport(this);
+
+ /**
+ * The cached value of the '{@link #getTask() <em>Task</em>}'
containment
+ * reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getTask()
+ * @generated
+ * @ordered
+ */
+ protected List<TaskType> task;
+
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}'
attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
<!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}'
attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}'
attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ProcessTypeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public List<TaskType> getTask() {
+ if (task == null) {
+ task = new ArrayList<TaskType>();
+ }
+ return task;
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ support.removePropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ support.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setId(String newId) {
+ String oldId = name;
+ id = newId;
+ support.firePropertyChange(PRO_ID_CHANGE, oldId, newId);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ support.firePropertyChange(PRO_NAME_CHANGE, oldName, newName);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String toString() {
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (id: "); //$NON-NLS-1$
+ result.append(id);
+ result.append(", name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(')');
+ return result.toString();
+ }
+
+ public void addTask(TaskType task) {
+ if (task != null) {
+ this.getTask().add(task);
+ task.setParent(this);
+ task.setPropertyChangeSupport(support);
+ support.firePropertyChange(PRO_ADD_CHILD, null, task);
+ }
+ }
+
+ public void removeTask(TaskType task) {
+ if (task != null) {
+ this.getTask().remove(task);
+ task.setParent(null);
+ task.setPropertyChangeSupport(support);
+ support.firePropertyChange(PRO_REMOVE_CHILD, task, null);
+ }
+ }
+
+} // ProcessTypeImpl
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTypeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskNodeFigure.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskNodeFigure.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskNodeFigure.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,303 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors.process;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.ActionEvent;
+import org.eclipse.draw2d.ActionListener;
+import org.eclipse.draw2d.Clickable;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.GridData;
+import org.eclipse.draw2d.GridLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MouseEvent;
+import org.eclipse.draw2d.MouseMotionListener;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.zest.core.widgets.CGraphNode;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphItem;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.graphical.editors.SmooksProcessGraphicalEditor;
+
+/**
+ * @author Dart
+ *
+ */
+public class TaskNodeFigure extends Figure {
+
+ private Label problemTooltip;
+
+ private IFigure mainFigure;
+
+ private IFigure addTaskFigure;
+
+ private Image image;
+
+ private String labelText;
+
+ private SmooksProcessGraphicalEditor processGraphicalViewerEditor;
+
+ private Label label;
+
+ private IFigure imageFigure;
+
+ private Color oldLabelColor = null;
+
+ private boolean showAddFigure = false;
+
+ private Rectangle imageSourceRectangle = null;
+
+ public TaskNodeFigure(SmooksProcessGraphicalEditor graph, Image image, String labelText)
{
+ super();
+ this.image = image;
+ this.labelText = labelText;
+ this.processGraphicalViewerEditor = graph;
+ this.problemTooltip = new Label();
+ initFigure();
+ hookTaskNodeFigure();
+ }
+
+ public void setProblemMessage(String message){
+ if(message == null){
+ this.setToolTip(null);
+ }else{
+ this.problemTooltip.setText(message);
+ this.setToolTip(problemTooltip);
+ }
+ }
+
+ public Label getLabel() {
+ return label;
+ }
+
+ private void hookTaskNodeFigure() {
+ // this.addMouseMotionListener(new MouseMotionListener() {
+ //
+ // public void mouseDragged(MouseEvent me) {
+ // }
+ //
+ // public void mouseEntered(MouseEvent me) {
+ // showAddFigure = true;
+ // imageSourceRectangle = null;
+ // addTaskFigure.repaint();
+ // }
+ //
+ // public void mouseExited(MouseEvent me) {
+ // showAddFigure = false;
+ // addTaskFigure.repaint();
+ // }
+ //
+ // public void mouseHover(MouseEvent me) {
+ // }
+ //
+ // public void mouseMoved(MouseEvent me) {
+ // }
+ //
+ // });
+ addTaskFigure.addMouseMotionListener(new MouseMotionListener() {
+
+ public void mouseDragged(MouseEvent me) {
+ }
+
+ public void mouseEntered(MouseEvent me) {
+ showAddFigure = true;
+ imageSourceRectangle = null;
+ addTaskFigure.repaint();
+ }
+
+ public void mouseExited(MouseEvent me) {
+ showAddFigure = false;
+ addTaskFigure.repaint();
+ }
+
+ public void mouseHover(MouseEvent me) {
+ }
+
+ public void mouseMoved(MouseEvent me) {
+ }
+
+ });
+ }
+
+ protected void initFigure() {
+ initMainFigure();
+ initAddTaskFigure();
+ GridLayout girdlLayout = new GridLayout();
+ girdlLayout.numColumns = 2;
+ this.setLayoutManager(girdlLayout);
+ GridData d = new GridData(GridData.FILL_VERTICAL);
+ // ToolbarLayout layout = new ToolbarLayout(true);
+ // layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ this.add(mainFigure);
+ this.add(addTaskFigure);
+ girdlLayout.setConstraint(addTaskFigure, d);
+ // this.setLayoutManager(layout);
+ }
+
+ private void initAddTaskFigure() {
+ addTaskFigure = new Clickable() {
+ @Override
+ protected void paintBorder(Graphics graphics) {
+ }
+
+ @Override
+ protected void paintFigure(Graphics graphics) {
+ super.paintFigure(graphics);
+ Rectangle rect = getBounds();
+ Point center = rect.getCenter();
+ if (!showAddFigure) {
+// int feet = 4;
+ graphics.fillRectangle(rect);
+ return;
+ // imageSourceRectangle = new Rectangle(rect.x + feet,
+ // rect.y + feet, rect.width - feet * 2,
+ // rect.height - feet * 2);
+ }
+ Image image = SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_ADD_TASK_BUTTON);
+ if (image != null) {
+// System.out.println(center.x - image.getBounds().width / 2);
+ Point location = new Point(center.x - image.getBounds().width / 2, center.y
+ - image.getBounds().height / 2);
+ graphics.drawImage(image, location);
+ if (imageSourceRectangle == null) {
+// graphics.drawImage(image, getLocation());
+ } else {
+// graphics.drawImage(image, sourceRectangle, imageSourceRectangle);
+ }
+ }
+ }
+
+ };
+ ((Clickable) addTaskFigure).addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent event) {
+ if (!showAddFigure)
+ return;
+ Graph g = processGraphicalViewerEditor.getProcessGraphViewer().getGraphControl();
+ processGraphicalViewerEditor.setNeedupdatewhenshow(false);
+ List<?> nodes = g.getNodes();
+ for (Iterator<?> iterator = nodes.iterator(); iterator.hasNext();) {
+ GraphItem item = (GraphItem) iterator.next();
+ if (item instanceof CGraphNode) {
+ if (TaskNodeFigure.this == ((CGraphNode) item).getFigure()) {
+ processGraphicalViewerEditor.updateProcessActions(new
StructuredSelection(item.getData()));
+ break;
+ }
+ }
+ }
+ Menu menu =
processGraphicalViewerEditor.getProcessGraphViewer().getGraphControl().getMenu();
+ menu.setVisible(true);
+ // processGraphicalViewerEditor.setNeedupdatewhenshow(true);
+ }
+ });
+ addTaskFigure.setSize(16, 16);
+ }
+
+ private void initMainFigure() {
+ mainFigure = new Figure();
+ imageFigure = new Figure() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.draw2d.Figure#paintFigure(org.eclipse.draw2d.Graphics
+ * )
+ */
+ @Override
+ protected void paintFigure(Graphics graphics) {
+ super.paintFigure(graphics);
+ if (image != null) {
+ graphics.drawImage(image, getLocation());
+ } else {
+ graphics.drawRectangle(0, 0, 24, 24);
+ }
+ }
+
+ };
+ if (image != null) {
+ imageFigure.setSize(new Dimension(image.getBounds().width,
image.getBounds().height));
+ } else {
+ imageFigure.setSize(24, 24);
+ }
+
+ mainFigure.add(imageFigure);
+
+ label = new Label();
+ label.setForegroundColor(GraphicsConstants.BORDER_CORLOR);
+ label.setText(labelText);
+
+ oldLabelColor = label.getForegroundColor();
+
+ mainFigure.add(label);
+
+ ToolbarLayout layout = new ToolbarLayout(false);
+ layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ mainFigure.setLayoutManager(layout);
+ }
+
+ /**
+ * @return the image
+ */
+ public Image getImage() {
+ return image;
+ }
+
+ /**
+ * @param image
+ * the image to set
+ */
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ /**
+ * @return the labelText
+ */
+ public String getLabelText() {
+ return labelText;
+ }
+
+ /**
+ * @param labelText
+ * the labelText to set
+ */
+ public void setLabelText(String labelText) {
+ this.labelText = labelText;
+ }
+
+ public void highlightLabel(Color highlightColor) {
+ oldLabelColor = label.getForegroundColor();
+ label.setForegroundColor(highlightColor);
+ label.repaint();
+ }
+
+ public void unhighlightLabel() {
+ if (oldLabelColor != null) {
+ label.setForegroundColor(oldLabelColor);
+ label.repaint();
+ }
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskNodeFigure.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskType.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskType.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskType.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,163 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.graphical.editors.process;
+
+
+import java.beans.PropertyChangeSupport;
+import java.util.List;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Task
Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.TaskType#getTask
<em>Task</em>}</li>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.TaskType#getId
<em>Id</em>}</li>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.TaskType#getName
<em>Name</em>}</li>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.TaskType#getType
<em>Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getTaskType()
+ * @model extendedMetaData="name='task_._type'
kind='elementOnly'"
+ * @generated
+ */
+public interface TaskType {
+
+ int getProblemType();
+
+ /**
+ *
+ * @param type
+ */
+ void setProblemType(int type);
+
+ List<String> getProblemMessages();
+
+ void cleanProblemMessages();
+
+ void removeProblemMessage(String message);
+
+ void addProblemMessage(String message);
+
+ void setPropertyChangeSupport(PropertyChangeSupport support);
+
+ Object getParent();
+
+ void setParent(Object parent);
+
+ public void addTask(TaskType task);
+
+ public void removeTask(TaskType task);
+ /**
+ * Returns the value of the '<em><b>Task</b></em>'
containment reference list.
+ * The list contents are of type {@link
org.jboss.tools.smooks.model.graphics.ext.TaskType}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Task</em>' containment reference list
isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Task</em>' containment reference
list.
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getTaskType_Task()
+ * @model containment="true"
+ * extendedMetaData="kind='element' name='task'
namespace='##targetNamespace'"
+ * @generated
+ */
+ List<TaskType> getTask();
+
+ /**
+ * Returns the value of the '<em><b>Id</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Id</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Id</em>' attribute.
+ * @see #setId(String)
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getTaskType_Id()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * extendedMetaData="kind='attribute' name='id'"
+ * @generated
+ */
+ String getId();
+
+ /**
+ * Sets the value of the '{@link
org.jboss.tools.smooks.model.graphics.ext.TaskType#getId <em>Id</em>}'
attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Id</em>' attribute.
+ * @see #getId()
+ * @generated
+ */
+ void setId(String value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getTaskType_Name()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * extendedMetaData="kind='attribute' name='name'"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link
org.jboss.tools.smooks.model.graphics.ext.TaskType#getName <em>Name</em>}'
attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Type</b></em>'
attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Type</em>' attribute.
+ * @see #setType(String)
+ * @see org.jboss.tools.smooks.model.graphics.ext.GraphPackage#getTaskType_Type()
+ * @model dataType="org.eclipse.emf.ecore.xml.type.String"
+ * extendedMetaData="kind='attribute' name='type'"
+ * @generated
+ */
+ String getType();
+
+ /**
+ * Sets the value of the '{@link
org.jboss.tools.smooks.model.graphics.ext.TaskType#getType <em>Type</em>}'
attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Type</em>' attribute.
+ * @see #getType()
+ * @generated
+ */
+ void setType(String value);
+
+ boolean inTheTask(Object smooksModel);
+
+ void addSmooksModel(Object smooksModel);
+
+ void removeSmooksModel(Object smooksModel);
+
+} // TaskType
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskTypeImpl.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskTypeImpl.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskTypeImpl.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,320 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.jboss.tools.smooks.graphical.editors.process;
+
+import java.beans.PropertyChangeSupport;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.smooks.configuration.editors.IFieldMarker;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model object '
+ * <em><b>Task Type</b></em>'. <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>
+ * {@link org.jboss.tools.smooks.model.graphics.ext.impl.TaskTypeImpl#getTask
+ * <em>Task</em>}</li>
+ * <li>{@link org.jboss.tools.smooks.model.graphics.ext.impl.TaskTypeImpl#getId
+ * <em>Id</em>}</li>
+ * <li>
+ * {@link org.jboss.tools.smooks.model.graphics.ext.impl.TaskTypeImpl#getName
+ * <em>Name</em>}</li>
+ * <li>
+ * {@link org.jboss.tools.smooks.model.graphics.ext.impl.TaskTypeImpl#getType
+ * <em>Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class TaskTypeImpl implements TaskType {
+
+ private PropertyChangeSupport propertyChangeSupport = null;
+
+ private Object parent;
+
+ private List<Object> smooksModel = null;
+
+ private int problemType = IFieldMarker.TYPE_NONE;
+
+ private List<String> problemMessages = null;
+
+ public List<String> getProblemMessages() {
+ if (problemMessages == null) {
+ problemMessages = new ArrayList<String>();
+ }
+ return problemMessages;
+ }
+
+ public void addProblemMessage(String message) {
+ getProblemMessages().add(message);
+ }
+
+ public void removeProblemMessage(String message) {
+ getProblemMessages().remove(message);
+ }
+
+ public void cleanProblemMessages() {
+ getProblemMessages().clear();
+ }
+
+ public int getProblemType() {
+ return problemType;
+ }
+
+ public void setProblemType(int problemType) {
+ if (this.problemType == IFieldMarker.TYPE_ERROR && problemType ==
IFieldMarker.TYPE_WARINING) {
+ return;
+ }
+ this.problemType = problemType;
+ }
+
+ /**
+ * @return the propertyChangeSupport
+ */
+ public PropertyChangeSupport getPropertyChangeSupport() {
+ return propertyChangeSupport;
+ }
+
+ /**
+ * @param propertyChangeSupport
+ * the propertyChangeSupport to set
+ */
+ public void setPropertyChangeSupport(PropertyChangeSupport propertyChangeSupport) {
+ this.propertyChangeSupport = propertyChangeSupport;
+ }
+
+ /**
+ * @return the parent
+ */
+ public Object getParent() {
+ return parent;
+ }
+
+ /**
+ * @param parent
+ * the parent to set
+ */
+ public void setParent(Object parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * @return the smooksModel
+ */
+ public List<Object> getSmooksModel() {
+ if (smooksModel == null) {
+ smooksModel = new ArrayList<Object>();
+ }
+ return smooksModel;
+ }
+
+ /**
+ * The cached value of the '{@link #getTask() <em>Task</em>}'
containment
+ * reference list. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getTask()
+ * @generated
+ * @ordered
+ */
+ protected List<TaskType> task;
+
+ /**
+ * The default value of the '{@link #getId() <em>Id</em>}'
attribute. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected static final String ID_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
<!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getId()
+ * @generated
+ * @ordered
+ */
+ protected String id = ID_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}'
attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}'
attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getType() <em>Type</em>}'
attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final String TYPE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getType() <em>Type</em>}'
attribute.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected String type = TYPE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TaskTypeImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public List<TaskType> getTask() {
+ if (task == null) {
+ task = new ArrayList<TaskType>();
+ }
+ return task;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setId(String newId) {
+ String oldId = name;
+ id = newId;
+ if (propertyChangeSupport != null)
+ propertyChangeSupport.firePropertyChange(ProcessType.PRO_ID_CHANGE, oldId, newId);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (propertyChangeSupport != null)
+ propertyChangeSupport.firePropertyChange(ProcessType.PRO_NAME_CHANGE, oldName,
newName);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setType(String newType) {
+ type = newType;
+ }
+
+ public void addTask(TaskType task) {
+ if (task != null) {
+ this.getTask().add(task);
+ task.setParent(this);
+ task.setPropertyChangeSupport(propertyChangeSupport);
+ if (propertyChangeSupport != null)
+ propertyChangeSupport.firePropertyChange(ProcessType.PRO_ADD_CHILD, null, task);
+ }
+ }
+
+ public void removeTask(TaskType task) {
+ if (task != null) {
+ this.getTask().remove(task);
+ task.setParent(null);
+ task.setPropertyChangeSupport(null);
+ if (propertyChangeSupport != null)
+ propertyChangeSupport.firePropertyChange(ProcessType.PRO_REMOVE_CHILD, task, null);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String toString() {
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (id: "); //$NON-NLS-1$
+ result.append(id);
+ result.append(", name: "); //$NON-NLS-1$
+ result.append(name);
+ result.append(", type: "); //$NON-NLS-1$
+ result.append(type);
+ result.append(')');
+ return result.toString();
+ }
+
+ public void addSmooksModel(Object smooksModel) {
+ getSmooksModel().add(smooksModel);
+ }
+
+ public boolean inTheTask(Object smooksModel) {
+ return true;
+ }
+
+ public void removeSmooksModel(Object smooksModel) {
+ getSmooksModel().remove(smooksModel);
+ }
+
+} // TaskTypeImpl
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TaskTypeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TemplateAppyTaskNode.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TemplateAppyTaskNode.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TemplateAppyTaskNode.java 2010-07-30
08:20:18 UTC (rev 23822)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.graphical.editors.process;
+
+import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
+
+/**
+ * @author Dart
+ *
+ */
+public class TemplateAppyTaskNode extends TaskTypeImpl {
+
+ public TemplateAppyTaskNode() {
+ super();
+ this.setId(TaskTypeManager.TASK_ID_FREEMARKER_CSV_TEMPLATE);
+ this.setName(TaskTypeManager.getTaskLabel(this));
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.graphical.editors.process.TaskTypeImpl#inTheTask
+ * (java.lang.Object)
+ */
+ @Override
+ public boolean inTheTask(Object smooksModel) {
+ return this.getSmooksModel().contains(smooksModel);
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/TemplateAppyTaskNode.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain