Plugin for eclipse to make a calendar

zhaozj2021-02-16  62

Yesterday I saw a post (http://www.5d.cn/bbs/newsdetail.asp?id=980498), induced the idea of ​​writing a simple Eclipse plugin.

This is a program written last night.

Although there is not much necessary, it is still a bit used. I transformed this program and wrote an Eclipse plugin.

Calendarview.java

package com.eiffelqiu.tools; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.SWT; import org.eclipse.ui.part.ViewPart; / ** * Calendar plugin for eclipse * * @author Qiu Hai Feng * @version 1.0, Created on 2003-10-28 15:36:57 * / public class CalendarView extends ViewPart {label label; public CalendarView () {} public void CreatePartControl (Composite Parent) {label = new label (parent, swt.wrap); label.settext (Calendarimp.show ());} public void setfocus () {}}

Calendarimp.java

Package com.eiffelqiu.tools; import java.util. *; / ** * calendar type * * @Author qiu hai feng * @version 1.0, created on 2003-10-28 15:36:57 * / public class calendarimp { / ** * concate calendar output string * * @param void * @return String * / public static String show () {StringBuffer calString = new StringBuffer (); GregorianCalendar nowDate = new GregorianCalendar (); int today = nowDate.get (Calendar .Day_of_month; int month = nowdate.get (Calendar.Mont); Nowdate.Set (Calendar.day_of_month, 1); int weekday = node.get (Calendar.day_of_week); Calstring.Append ("Sun Mon Tue Wed Thu Fri SAT / N "); // Indent First Line of Calendar for (INT I = Calendar.Sunday; i

ID = "com.eiffelqiu.tools"

Name = "com.eiffelqiu.tools"

Version = "1.0.0">

ID = "com.eiffelqiu.tools.calendar"

Name = "Calendar" />

ID = "com.eiffelqiu.tools.calendar"

Name = "Eiffel Tools"

Category = "com.eiffelqiu.tools.calendar" class = "com.eiffelqiu.tools.calendarview" />

Test case:

package com.eiffelqiu.tools; import junit.framework.TestCase; / ** * Calendar implementation * * @author Qiu Hai Feng * @version 1.0, Created on 2003-10-28 15:36:57 * / public class CalendarImpTest extends . TestCase {/ ** * Constructor for CalendarImpTest * @param name * / public CalendarImpTest (String name) {super (name);} public static void main (String [] args) {junit.swingui.TestRunner.run (CalendarImpTest. Class);} / * * @see testcase # setup () * / protected void setup () throws exception {super.setup ();} / * * @see testcase # Teardown () * / protected void teardown () THROWS Exception {super.teardown (); public void testshow () {asserttrue (! calendarimp.show (). Equals (null); assertequals (Calendarimp.show (), Calendarimp.show ());}}

转载请注明原文地址:https://www.9cbs.com/read-16017.html

New Post(0)