From c824af980d16d6413747ea5175b21932dac76a38 Mon Sep 17 00:00:00 2001 From: jinxuesong Date: Mon, 10 May 2021 10:03:25 +0800 Subject: [PATCH] course add --- .../hit/education/action/AddCourseAction.java | 44 +++++++ .../education/action/AddNewCourseAction.java | 4 +- .../education/action/AddProcessAction.java | 44 +++++++ .../education/action/AddPropertyAction.java | 45 +++++++ ...NewCourseDialog.java => CourseDialog.java} | 41 ++++-- .../hit/education/dialog/ProcessDialog.java | 92 +++++++++++++ .../hit/education/dialog/PropertyDialog.java | 121 ++++++++++++++++++ ...ner.java => CourseDragSourceListener.java} | 4 +- ...ner.java => CourseDropTargetListener.java} | 4 +- .../hit/education/view/CourseExploreView.java | 23 ++-- .../education/view/CourseScheduleView.java | 4 +- src/educationschedule/Perspective.java | 2 +- 12 files changed, 398 insertions(+), 30 deletions(-) create mode 100644 src/cn/edu/hit/education/action/AddCourseAction.java create mode 100644 src/cn/edu/hit/education/action/AddProcessAction.java create mode 100644 src/cn/edu/hit/education/action/AddPropertyAction.java rename src/cn/edu/hit/education/dialog/{AddNewCourseDialog.java => CourseDialog.java} (82%) create mode 100644 src/cn/edu/hit/education/dialog/ProcessDialog.java create mode 100644 src/cn/edu/hit/education/dialog/PropertyDialog.java rename src/cn/edu/hit/education/listener/{MyDragSourceListener.java => CourseDragSourceListener.java} (91%) rename src/cn/edu/hit/education/listener/{MyDropTargetListener.java => CourseDropTargetListener.java} (83%) diff --git a/src/cn/edu/hit/education/action/AddCourseAction.java b/src/cn/edu/hit/education/action/AddCourseAction.java new file mode 100644 index 0000000..4e8b8a9 --- /dev/null +++ b/src/cn/edu/hit/education/action/AddCourseAction.java @@ -0,0 +1,44 @@ +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.dialog.CourseDialog; +import cn.edu.hit.education.pojo.Course; +import cn.edu.hit.education.service.ICourseService; +import cn.edu.hit.education.view.CourseExploreView; +import educationschedule.Activator; +import educationschedule.Application; + +public class AddCourseAction extends Action { + private CourseExploreView viewPart; + ICourseService courseService = (ICourseService)Application.applicationContext.getBean("courseServiceImpl"); + + public AddCourseAction(CourseExploreView viewPart){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/course_code_16px.png")); + this.setToolTipText("增加课程"); + this.setText("增加课程"); + this.viewPart = viewPart; + } + + @Override + public void run() { + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + CourseDialog courseDialog = new CourseDialog(parentShell); + Course course = new Course(); + courseDialog.setCourse(course); + if(IDialogConstants.OK_ID == courseDialog.open()){ + int count = courseService.insert(course); + if(count > 0){ + viewPart.refreshNewData(course); + } + } + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/action/AddNewCourseAction.java b/src/cn/edu/hit/education/action/AddNewCourseAction.java index 4771ca1..2c2cd91 100644 --- a/src/cn/edu/hit/education/action/AddNewCourseAction.java +++ b/src/cn/edu/hit/education/action/AddNewCourseAction.java @@ -7,7 +7,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; -import cn.edu.hit.education.dialog.AddNewCourseDialog; +import cn.edu.hit.education.dialog.CourseDialog; import cn.edu.hit.education.service.ICourseService; import cn.edu.hit.education.service.IScheduleService; import educationschedule.Activator; @@ -32,7 +32,7 @@ public class AddNewCourseAction extends Action { public void run() { // TODO Auto-generated method stub Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - AddNewCourseDialog dlg = new AddNewCourseDialog(parentShell); + CourseDialog dlg = new CourseDialog(parentShell); if(IDialogConstants.OK_ID == dlg.open()){ } diff --git a/src/cn/edu/hit/education/action/AddProcessAction.java b/src/cn/edu/hit/education/action/AddProcessAction.java new file mode 100644 index 0000000..58db672 --- /dev/null +++ b/src/cn/edu/hit/education/action/AddProcessAction.java @@ -0,0 +1,44 @@ +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.dialog.ProcessDialog; +import cn.edu.hit.education.pojo.Process; +import cn.edu.hit.education.service.IProcessService; +import cn.edu.hit.education.view.CourseExploreView; +import educationschedule.Activator; +import educationschedule.Application; + +public class AddProcessAction extends Action { + private CourseExploreView viewPart; + IProcessService processService = (IProcessService)Application.applicationContext.getBean("processServiceImpl"); + + public AddProcessAction(CourseExploreView viewPart){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/course_code_16px.png")); + this.setToolTipText("增加平台"); + this.setText("增加平台"); + this.viewPart = viewPart; + } + + @Override + public void run() { + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + ProcessDialog processDialog = new ProcessDialog(parentShell); + Process process = new Process(); + processDialog.setProcess(process); + if(IDialogConstants.OK_ID == processDialog.open()){ + int count = processService.insert(process); + if(count > 0){ + viewPart.refreshNewData(process); + } + } + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/action/AddPropertyAction.java b/src/cn/edu/hit/education/action/AddPropertyAction.java new file mode 100644 index 0000000..a6d0dbc --- /dev/null +++ b/src/cn/edu/hit/education/action/AddPropertyAction.java @@ -0,0 +1,45 @@ +package cn.edu.hit.education.action; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import cn.edu.hit.education.dialog.ProcessDialog; +import cn.edu.hit.education.dialog.PropertyDialog; +import cn.edu.hit.education.pojo.Property; +import cn.edu.hit.education.service.IPropertyService; +import cn.edu.hit.education.view.CourseExploreView; +import educationschedule.Activator; +import educationschedule.Application; + +public class AddPropertyAction extends Action { + private CourseExploreView viewPart; + IPropertyService propertyService = (IPropertyService)Application.applicationContext.getBean("propertyServiceImpl"); + + public AddPropertyAction(CourseExploreView viewPart){ + this.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/toolbar/course_code_16px.png")); + this.setToolTipText("增加课程性质"); + this.setText("增加课程性质"); + this.viewPart = viewPart; + } + + @Override + public void run() { + Shell parentShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + PropertyDialog propertyDialog = new PropertyDialog(parentShell); + Property property = new Property(); + propertyDialog.setProperty(property); + if(IDialogConstants.OK_ID == propertyDialog.open()){ + int count = propertyService.insert(property); + if(count > 0){ + viewPart.refreshNewData(property); + } + } + super.run(); + } + + + +} diff --git a/src/cn/edu/hit/education/dialog/AddNewCourseDialog.java b/src/cn/edu/hit/education/dialog/CourseDialog.java similarity index 82% rename from src/cn/edu/hit/education/dialog/AddNewCourseDialog.java rename to src/cn/edu/hit/education/dialog/CourseDialog.java index edb08ea..af61bea 100644 --- a/src/cn/edu/hit/education/dialog/AddNewCourseDialog.java +++ b/src/cn/edu/hit/education/dialog/CourseDialog.java @@ -4,19 +4,25 @@ import java.text.DecimalFormat; import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import cn.edu.hit.education.pojo.Course; import educationschedule.Activator; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.core.databinding.beans.PojoProperties; -public class AddNewCourseDialog extends TitleAreaDialog { +public class CourseDialog extends TitleAreaDialog { + private DataBindingContext m_bindingContext; IPreferenceStore store = Activator.getDefault().getPreferenceStore(); private DecimalFormat df2 = new DecimalFormat("0.00"); private Text text; @@ -26,8 +32,9 @@ public class AddNewCourseDialog extends TitleAreaDialog { private Text textCoursePeriod; private Text textCourseTheoretical; private Text textCourseExperiment; + private Course course; - public AddNewCourseDialog(Shell parentShell) { + public CourseDialog(Shell parentShell) { super(parentShell); // TODO Auto-generated constructor stub } @@ -117,6 +124,7 @@ public class AddNewCourseDialog extends TitleAreaDialog { text = new Text(composite, SWT.BORDER); text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));*/ + m_bindingContext = initDataBindings(); return composite; } @@ -124,4 +132,21 @@ public class AddNewCourseDialog extends TitleAreaDialog { super.configureShell(newShell); newShell.setText("添加新的课程"); } + + public Course getCourse() { + return course; + } + + public void setCourse(Course course) { + this.course = course; + } + protected DataBindingContext initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + // + IObservableValue observeTextTextCourseNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(textCourseName); + IObservableValue nameCourseObserveValue = PojoProperties.value("name").observe(course); + bindingContext.bindValue(observeTextTextCourseNameObserveWidget, nameCourseObserveValue, null, null); + // + return bindingContext; + } } diff --git a/src/cn/edu/hit/education/dialog/ProcessDialog.java b/src/cn/edu/hit/education/dialog/ProcessDialog.java new file mode 100644 index 0000000..4b2047e --- /dev/null +++ b/src/cn/edu/hit/education/dialog/ProcessDialog.java @@ -0,0 +1,92 @@ +package cn.edu.hit.education.dialog; + +import java.text.DecimalFormat; + +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import cn.edu.hit.education.pojo.Process; +import educationschedule.Activator; +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.core.databinding.beans.PojoProperties; + +public class ProcessDialog extends TitleAreaDialog { + private DataBindingContext m_bindingContext; + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + private DecimalFormat df2 = new DecimalFormat("0.00"); + private Text text; + private Text textName; + private Text textNode; + private Process process; + + public ProcessDialog(Shell parentShell) { + super(parentShell); + // TODO Auto-generated constructor stub + } + + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + composite.setLayout(new GridLayout(1, false)); + + Composite composite_1 = new Composite(composite, SWT.NONE); + composite_1.setLayout(new GridLayout(2, false)); + composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + Label label = new Label(composite_1, SWT.NONE); + label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label.setText("平台名称"); + + textName = new Text(composite_1, SWT.BORDER); + textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label label_2 = new Label(composite_1, SWT.NONE); + label_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label_2.setText("备 注"); + + textNode = new Text(composite_1, SWT.BORDER); + textNode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + /*if(university != null && university.getNote() != null){ + textNode.setText(university.getNote()); + }*/ + m_bindingContext = initDataBindings(); + + return composite; + } + + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("教育平台"); + } + + public Process getProcess() { + return process; + } + + public void setProcess(Process process) { + this.process = process; + } + + protected DataBindingContext initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + // + IObservableValue observeTextTextNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(textName); + IObservableValue nameUniversityObserveValue = PojoProperties.value("name").observe(process); + bindingContext.bindValue(observeTextTextNameObserveWidget, nameUniversityObserveValue, null, null); + // + IObservableValue observeTextTextNodeObserveWidget = WidgetProperties.text(SWT.Modify).observe(textNode); + IObservableValue noteUniversityObserveValue = PojoProperties.value("note").observe(process); + bindingContext.bindValue(observeTextTextNodeObserveWidget, noteUniversityObserveValue, null, null); + // + return bindingContext; + } +} diff --git a/src/cn/edu/hit/education/dialog/PropertyDialog.java b/src/cn/edu/hit/education/dialog/PropertyDialog.java new file mode 100644 index 0000000..880a3a2 --- /dev/null +++ b/src/cn/edu/hit/education/dialog/PropertyDialog.java @@ -0,0 +1,121 @@ +package cn.edu.hit.education.dialog; + +import java.text.DecimalFormat; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.PojoProperties; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +import cn.edu.hit.education.pojo.Property; +import educationschedule.Activator; + +public class PropertyDialog extends TitleAreaDialog { + private DataBindingContext m_bindingContext; + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + private DecimalFormat df2 = new DecimalFormat("0.00"); + private Text text; + private Text textName; + private Text textCode; + private Text textNode; + private Property property; + private Label label_1; + private Label label_3; + private Combo comboNeed; + + public PropertyDialog(Shell parentShell) { + super(parentShell); + // TODO Auto-generated constructor stub + } + + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + composite.setLayout(new GridLayout(1, false)); + + Composite composite_1 = new Composite(composite, SWT.NONE); + composite_1.setLayout(new GridLayout(2, false)); + composite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + Label label = new Label(composite_1, SWT.NONE); + label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label.setText("性质名称"); + + textName = new Text(composite_1, SWT.BORDER); + textName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + /*if(university != null && university.getName() != null){ + textName.setText(university.getName()); + }*/ + + label_1 = new Label(composite_1, SWT.NONE); + label_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label_1.setText("性质编码"); + + textCode = new Text(composite_1, SWT.BORDER); + textCode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + /*if(university != null && university.getAddress() != null){ + textAddress.setText(university.getAddress()); + }*/ + + label_3 = new Label(composite_1, SWT.NONE); + label_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label_3.setText("课程性质"); + + comboNeed = new Combo(composite_1, SWT.NONE); + comboNeed.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label label_2 = new Label(composite_1, SWT.NONE); + label_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label_2.setText("备 注"); + + textNode = new Text(composite_1, SWT.BORDER); + textNode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + /*if(university != null && university.getNote() != null){ + textNode.setText(university.getNote()); + }*/ + m_bindingContext = initDataBindings(); + + return composite; + } + + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("课程性质"); + } + + public Property getProperty() { + return property; + } + + public void setProperty(Property property) { + this.property = property; + } + + protected DataBindingContext initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + // + IObservableValue observeTextTextNameObserveWidget = WidgetProperties.text(SWT.Modify).observe(textName); + IObservableValue nameUniversityObserveValue = PojoProperties.value("name").observe(property); + bindingContext.bindValue(observeTextTextNameObserveWidget, nameUniversityObserveValue, null, null); + // + IObservableValue observeTextTextAddressObserveWidget = WidgetProperties.text(SWT.Modify).observe(textCode); + IObservableValue addressUniversityObserveValue = PojoProperties.value("code").observe(property); + bindingContext.bindValue(observeTextTextAddressObserveWidget, addressUniversityObserveValue, null, null); + // + IObservableValue observeTextTextNodeObserveWidget = WidgetProperties.text(SWT.Modify).observe(textNode); + IObservableValue noteUniversityObserveValue = PojoProperties.value("note").observe(property); + bindingContext.bindValue(observeTextTextNodeObserveWidget, noteUniversityObserveValue, null, null); + // + return bindingContext; + } +} diff --git a/src/cn/edu/hit/education/listener/MyDragSourceListener.java b/src/cn/edu/hit/education/listener/CourseDragSourceListener.java similarity index 91% rename from src/cn/edu/hit/education/listener/MyDragSourceListener.java rename to src/cn/edu/hit/education/listener/CourseDragSourceListener.java index 54d86eb..66beaa2 100644 --- a/src/cn/edu/hit/education/listener/MyDragSourceListener.java +++ b/src/cn/edu/hit/education/listener/CourseDragSourceListener.java @@ -10,7 +10,7 @@ import cn.edu.hit.education.model.CourseNode; import cn.edu.hit.education.model.Node; import educationschedule.Activator; -public class MyDragSourceListener extends DragSourceAdapter { +public class CourseDragSourceListener extends DragSourceAdapter { private TreeViewer treeViewer; /** @@ -20,7 +20,7 @@ public class MyDragSourceListener extends DragSourceAdapter { * - the drag source * */ - public MyDragSourceListener(TreeViewer treeViewer) { + public CourseDragSourceListener(TreeViewer treeViewer) { this.treeViewer = treeViewer; } diff --git a/src/cn/edu/hit/education/listener/MyDropTargetListener.java b/src/cn/edu/hit/education/listener/CourseDropTargetListener.java similarity index 83% rename from src/cn/edu/hit/education/listener/MyDropTargetListener.java rename to src/cn/edu/hit/education/listener/CourseDropTargetListener.java index a987620..5fccae5 100644 --- a/src/cn/edu/hit/education/listener/MyDropTargetListener.java +++ b/src/cn/edu/hit/education/listener/CourseDropTargetListener.java @@ -6,7 +6,7 @@ import org.eclipse.swt.dnd.TransferData; import cn.edu.hit.education.view.CourseScheduleView; -public class MyDropTargetListener extends ViewerDropAdapter { +public class CourseDropTargetListener extends ViewerDropAdapter { private CourseScheduleView view; /** * @param parentComposite @@ -14,7 +14,7 @@ public class MyDropTargetListener extends ViewerDropAdapter { * @param target * - the drop target */ - public MyDropTargetListener(TableViewer tableViewer,CourseScheduleView view) { + public CourseDropTargetListener(TableViewer tableViewer,CourseScheduleView view) { super(tableViewer); this.view = view; } diff --git a/src/cn/edu/hit/education/view/CourseExploreView.java b/src/cn/edu/hit/education/view/CourseExploreView.java index 8fdbc50..6c46e76 100644 --- a/src/cn/edu/hit/education/view/CourseExploreView.java +++ b/src/cn/edu/hit/education/view/CourseExploreView.java @@ -1,11 +1,7 @@ package cn.edu.hit.education.view; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.util.LocalSelectionTransfer; -import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; @@ -14,25 +10,18 @@ import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.part.ViewPart; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import cn.edu.hit.education.action.AddCollegeAction; -import cn.edu.hit.education.action.AddSpecialtyAction; -import cn.edu.hit.education.action.AddUniversityAction; import cn.edu.hit.education.contentprovider.CourseContentProvider; import cn.edu.hit.education.labelprovider.CourseLabelProvider; -import cn.edu.hit.education.listener.MyDragSourceListener; -import cn.edu.hit.education.model.CollegeNode; +import cn.edu.hit.education.listener.CourseDragSourceListener; import cn.edu.hit.education.model.CourseNode; import cn.edu.hit.education.model.CourseRootNode; import cn.edu.hit.education.model.Node; -import cn.edu.hit.education.model.OrganizationNode; -import cn.edu.hit.education.model.UniversityNode; import cn.edu.hit.education.pojo.Semester; import cn.edu.hit.education.pojo.Specialty; import cn.edu.hit.education.service.ICourseService; @@ -86,7 +75,7 @@ public class CourseExploreView extends ViewPart { treeViewer = new TreeViewer(parent, SWT.BORDER); tree = treeViewer.getTree(); - treeViewer.addDragSupport(DND.DROP_MOVE, transfer2, new MyDragSourceListener(treeViewer)); + treeViewer.addDragSupport(DND.DROP_MOVE, transfer2, new CourseDragSourceListener(treeViewer)); treeViewer.setContentProvider(new CourseContentProvider()); treeViewer.setLabelProvider(new CourseLabelProvider()); @@ -146,4 +135,12 @@ public class CourseExploreView extends ViewPart { public void setFocus() { treeViewer.getControl().setFocus(); } + + public void refreshNewData(Object obj){ + + } + + public void refreshUpdateData(Object obj){ + + } } diff --git a/src/cn/edu/hit/education/view/CourseScheduleView.java b/src/cn/edu/hit/education/view/CourseScheduleView.java index 96e563c..0d6e14b 100644 --- a/src/cn/edu/hit/education/view/CourseScheduleView.java +++ b/src/cn/edu/hit/education/view/CourseScheduleView.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; import cn.edu.hit.education.contentprovider.CourseScheduleContentProvider; import cn.edu.hit.education.labelprovider.CourseScheduleLabelProvider; -import cn.edu.hit.education.listener.MyDropTargetListener; +import cn.edu.hit.education.listener.CourseDropTargetListener; import cn.edu.hit.education.pojo.Course; import cn.edu.hit.education.pojo.ExCourse; import cn.edu.hit.education.pojo.Schedule; @@ -148,7 +148,7 @@ public class CourseScheduleView extends ViewPart implements ISelectionProvider{ tblclmnNewColumn.setWidth(100); tblclmnNewColumn.setText("\u5B9E\u9A8C\u5B66\u65F6"); tableViewer.addDropSupport(DND.DROP_MOVE, transfer2, - new MyDropTargetListener(tableViewer, this)); + new CourseDropTargetListener(tableViewer, this)); Menu contextMenu = new Menu(table); table.setMenu(contextMenu); diff --git a/src/educationschedule/Perspective.java b/src/educationschedule/Perspective.java index db5635d..4f8dfb4 100644 --- a/src/educationschedule/Perspective.java +++ b/src/educationschedule/Perspective.java @@ -24,7 +24,7 @@ public class Perspective implements IPerspectiveFactory { IFolderLayout mainArea = layout.createFolder("mainArea", IPageLayout.LEFT, 0.8f, editorArea); mainArea.addView(CourseScheduleView.ID); mainArea.addView(CourseInformationView.ID); - mainArea.addView(MovingBoxView.ID); + //mainArea.addView(MovingBoxView.ID); } } -- Gitee