akJ Eclipse RCP Codes

plugin.properties
plugin.xml
org.jpn.xucker.optipngwrapper
OptiPNGExecuter
ResultData
org.jpn.xucker.rcp.optipngwrapper
FileListImageView
Messages
OptimizeListener
OptipngWrapperApplication
OptipngWrapperPerspective
OptipngWrapperPlugin
optipngwrapperResources.properties
optipngwrapperResources_ja.properties
OptipngWrapperView
OptipngWrapperWorkbenchAdvisor
ResultView
org.jpn.xucker.rcp.optipngwrapper.actions
UpdateAction
akJ OptipngWrapper

----
TOP
Blog
ak's java blog
Applications
akJ OptipngWrapper
Links
EclipseCon 2005
many great tutorials pdfs.
Eclipse RCP
eclipsepowered
---
Japanese(日本語) Site
Creative Commons
I use Java2Html.nice tool.
ResultView.java
001 /*
002  * Created on 2005/03/04
003  * Author aki@www.xucker.jpn.org
004  * License Apache2.0 or Common Public License
005  */
006 package org.jpn.xucker.rcp.optipngwrapper;
007 
008 import org.eclipse.swt.SWT;
009 import org.eclipse.swt.events.SelectionEvent;
010 import org.eclipse.swt.events.SelectionListener;
011 import org.eclipse.swt.layout.RowData;
012 import org.eclipse.swt.widgets.Button;
013 import org.eclipse.swt.widgets.Composite;
014 import org.eclipse.swt.widgets.Table;
015 import org.eclipse.swt.widgets.TableColumn;
016 import org.eclipse.swt.widgets.TableItem;
017 import org.eclipse.ui.part.ViewPart;
018 import org.jpn.xucker.optipngwrapper.ResultData;
019 
020 /**
021  
022  *
023  */
024 public class ResultView extends ViewPart implements SelectionListener {
025 
026     public static final String ID_VIEW="org.jpn.xucker.rcp.optipngwrapper.ResultView"//$NON-NLS-1$
027   
028     private Table table1;
029 
030     private Button button1;
031 
032     public ResultView(){
033         //
034         
035     }
036 
037     
038     /* (non-Javadoc)
039      * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
040      */
041     public void createPartControl(Composite component) {
042          OptipngWrapperPlugin.getDefault().setResultView(this);
043        table1 = new Table(component, SWT.FULL_SELECTION);
044         table1.setHeaderVisible(true);
045         table1.addSelectionListener(this);
046         RowData table1_data = new RowData();
047         TableColumn table1_column = new TableColumn(table1, SWT.NULL);
048         table1_column.setText(Messages.getString("fileName"))//$NON-NLS-1$
049         table1_column.setWidth(85);
050         
051         TableColumn table1_column2 = new TableColumn(table1, SWT.NULL);
052         table1_column2.setText(Messages.getString("decrese_persent"))//$NON-NLS-1$
053         table1_column2.setWidth(50);
054         
055         TableColumn table1_column3 = new TableColumn(table1, SWT.NULL);
056         table1_column3.setText(Messages.getString("decrese_byte"))//$NON-NLS-1$
057         table1_column3.setWidth(65);
058         
059         TableColumn table1_column4 = new TableColumn(table1, SWT.NULL);
060         table1_column4.setText(Messages.getString("directory"))//$NON-NLS-1$
061         table1_column4.setWidth(80);
062         
063        
064     }
065 
066     /* (non-Javadoc)
067      * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
068      */
069     public void setFocus() {
070         // TODO Auto-generated method stub
071         
072     }
073 
074 
075     public void widgetSelected(SelectionEvent event) {
076         Object target = event.getSource();
077         if (target == null) {
078             //maybe not happen.
079             System.out.println("target==null")//$NON-NLS-1$
080         }
081         //null1
082         else if (target == table1) {
083             do_table1();
084         }
085         //    null1
086         else if (target == button1) {
087             do_button1();
088         }
089 
090     }
091 
092     public void widgetDefaultSelected(SelectionEvent arg0) {
093         // TODO Auto-generated method stub
094 
095     }
096 
097     //null1
098     public void do_table1() {
099         //System.out.println("table1");
100     }
101 
102     //    null1
103     public void do_button1() {
104        // shell.close();
105     }
106 
107     /**
108      @param data
109      */
110     public void setResultData(ResultData[] data) {
111         table1.removeAll();
112         //
113         for (int i = 0; i < data.length; i++) {
114             String values[]=new String[4];
115             values[0]=data[i].getFile();
116             values[1]=""+data[i].getPercent()+"%"//$NON-NLS-1$ //$NON-NLS-2$
117             values[2]=""+data[i].getBytes()//$NON-NLS-1$
118             values[3]=data[i].getDirectory();
119             TableItem item=new TableItem(table1,SWT.NULL);
120             item.setText(values);
121         }
122        
123         //
124     }
125 }