Eclipse NetBeans java sun com javaone sf Robert Buffone

Document Sample
Eclipse NetBeans java sun com javaone sf Robert Buffone Powered By Docstoc
					                             Eclipse
       NetBeans™
                                                    java.sun.com/javaone/sf




        Robert Buffone

        Nexaweb Technologies, Inc.
        http://www.nexaweb.com
1   | 2004 JavaOneSM Conference | Session TS-1876
                                      Eclipse NetBeans™




2   | 2004 JavaOneSM Conference | Session TS-1876
    Eclipse NetBeans


                                  IDE               ?




3   | 2004 JavaOneSM Conference | Session TS-1876
    Eclipse NetBeans


                                  IDE               ?




4   | 2004 JavaOneSM Conference | Session TS-1876
    Nexaweb
                                            Web
    •        UI
    •           UI
    •
    • UI
    •    Java      JDK™ 1.1.4
    •    UI




5   | 2004 JavaOneSM Conference | Session TS-1876
            Nexaweb

6
6   | 2004 JavaOneSM Conference | Session TS-1876
    •
    •                 /
    •                 /
    •
    •




7   | 2004 JavaOneSM Conference | Session TS-1876
    Eclipse NetBeans


                                  IDE               ?




8   | 2004 JavaOneSM Conference | Session TS-1876
    •
            ─
            ─
    • Eclipse
            ─
            ─
            ─
    • NetBeans
            ─
            ─


9   | 2004 JavaOneSM Conference | Session TS-1876
     public class Project{


     /** Handles all the possible menu actions. */
     public String perform(ClientEvent clientEvent){
            String actionid = clientEvent.getActionID();
            if (actionid.equals(
                    "designer-menu-tools-preview”)){
                    currentFile.preview();
            }else if ()
            ….
     }
     …
     }
10   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse

     public class PreviewAction implements
                             IActionDelegate{
            //called to perform the action
            public void run(IAction action) {
                    currentFile.preview();
            }
            // Notifies this action delegate that the
            // selection in the workbench has changed.
            public void selectionChanged(IAction action,
                     ISelection selection){
            }
     …


11   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse—plugin.xml

     <extension point=“org.eclipse.ui.popupMenus”>
     <actionSet label=“Designer Tools” …>
     <action
        label=“Preview“
        icon=“icons/preview.gif"
        tooltip=“Preview the current file"
        class="com.nexaweb.actions.PreviewAction"
        toolbarPath=“NexawebDesignerToolbar“
        menubarPath=“NexawebDesignerMenuBar”
        id="com.nexaweb.actions.Preview">
     </action>
     </actionSet>
     </extension>



12   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans

     public class PreviewAction extends
        CallableSystemAction {
            //Perform the action
            public void performAction() {
                    currentFile.preview();
            }
            //Get action display icon
            protected String iconResource() {
                    return "/icons/preview.gif";
            }
            //Get the action display name
            public String getName() {
                    return “Preview”;
13   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans                                   —mf-layer.xml

     <folder name="Menu">
              <attr name=“View/Designer Tools”
                         boolvalue=“true”/>
              <folder name=“Designer Tools">
                      <file name="com-nexaweb-actions-
                           PreviewAction.instance"/>
              </folder>
     </folder>




14   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse                      NetBeans

     •
     •                 /
     •                 /
     •
     •




15   | 2004 JavaOneSM Conference | Session TS-1876
     •
             ─
     • Eclipse
             ─
             ─
     • NetBeans
             ─
             ─




16   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse

     public class NewXmlFileWizard extends Wizard{
            /**Adding the page to the wizard.*/
            public void addPages() {
                    wp = new WizardNewFileCreationPage(“File“);
                    addPage(wp);
            }
            /** Called when the user presses finish */
            public boolean performFinish() {
                    IFile iFile = wp.createNewFile();
                    /*Add contents to file*/
                    …
            }
17   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse—plugin.xml

     <wizard
            name=“Empty UI File”
            icon=“icons/newXmlToolbar.gif”
            category="Nexaweb"
            class="com.nexaweb.designer.wizards.NewXml
            FileWizard” project="false"
            id="com.nexaweb.designer.wizards.NewXulFile
            Wizard">
     </wizard>




18   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans                                   —mf-layer.xml

       <folder name="Templates">
              <folder name="Nexaweb">
                    <file name="Empty UI File"
                                url="templates/empty.xml">
             <attr name="SystemFileSystem.icon"
     urlvalue="nbresloc:/icons/newXulToolbar.gif"/>
             <attr name="templateWizardURL"
     urlvalue="nbresloc:templates/help/emptyui.html" />
                    </file>
            </folder>
     </folder>


19   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse                      NetBeans

     •
     •                 /
     •                 /
     •
     •




20   | 2004 JavaOneSM Conference | Session TS-1876
                 /

     •
             ─
     • Eclipse
             ─
             ─
             ─
     • NetBeans
             ─
             ─              Bean
             ─


21   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse

     public class NexawebPreferencePage
           extends FieldEditorPreferencePage
           implements IWorkbenchPreferencePage {
                   //add your property field editor
                   public void createFieldEditors() {
                           new StringFieldEditor(…);
                           new DirectoryFieldEditor(…);
                           new FontFieldEditor(…);
                           new FileFieldEditor(…);
                           …
     }
22   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse—plugin.xml

     <extension
              point="org.eclipse.ui.preferencePages">
             <page name=“Nexaweb"
            class="com.nexaweb.designer.preferences.
               NexawebPreferencePage"
            id="com.nexaweb.designer.preferences.
                    NexawebPreferencePage">
              </page>
     </extension>




23   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans                                   —mf-layer.xml

     public class Option extends SystemOption {
            public String displayName() {
                    return "Editors";
            }
            protected void initialize () {
                    super.initialize();
                    putProperty(“serverAddress, _address, true);
            }
            public String getServerAddress(){
                    return _address;
            }


24   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans                                   —mf-layer.xml

     public class OptionBeanInfo extends SimpleBeanInfo
     public PropertyDescriptor[] getPropertyDescriptors ()
            try{
                          PropertyDescriptor version = new
                          PropertyDescriptor(“serverAddress”,
                          Option.class);
                           version.setDisplayName (“Server Address");
                           version.setShortDescription (“Address");
                           return new PropertyDescriptor[] { version };
            } catch (IntrospectionException ie) {
            ..
            }

25   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans                                   —mf-layer.xml

       <folder name="UI">
                    <folder name="Services">
            <folder name="Nexaweb Designer">
                    <file name="com-nexaweb-settings-
     ModuleSettings2.instance">
                             <attr name="originalFile"
     stringvalue="Services/com-nexaweb-settings-
     ModuleSettings2.settings"/>
                                          </file>
                           </folder>
                    </folder>
              </folder>
26   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse                      NetBeans

     •
     •                 /
     •                 /
     •
     •




27   | 2004 JavaOneSM Conference | Session TS-1876
                                       UI
     •
             ─
             ─
     • Eclipse
             ─
             ─
             ─ SWT
     • NetBeans
             ─
             ─ Java                                  (JFC/Swing)


28   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse

     public class NexawebPropertiesView extends ViewPart
            public void createPartControl(Composite parent) {
                    //create the AWT panel.
                    _awtPanel = SWT_AWT.new_Panel(parent);
                    _awtPanel.setLayout(new BorderLayout());
                    //add
                    Panel panel = new Panel();
                    add(panel, BorderLayout.CENTER);
            }
     …
     }
29   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse—plugin.xml

     <extension point="org.eclipse.ui.views">
                   <category name="Nexaweb"
                           id="com.nexaweb.designer.views“/>
                           <view name=“Nexaweb Designer Properties"
                                  icon=“/icons/properties.gif"
                                  category="com.nexaweb.designer.views"
                                  class="com.nexaweb.designer.views.
                                  NexawebPropertiesView"
                                  id="com.nexaweb.designer.views.
                                  NexawebPropertiesView">
                           </view>
     </extension>


30   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans

     public class PropertiesViewAction extends
     CallableSystemAction {
        public void performAction() {
           PropertiesView propertiesView =
              PropertiesView.getInstance();
           //get window manager
           WindowManager wMgr=WindowManager.getDefault
           Mode mode = wMgr.findMode("output");
           mode.dockInto(propertiesView);
           propertiesView.open();
        }
     }



31   | 2004 JavaOneSM Conference | Session TS-1876
     NetBeans

     public class PropertiesView extends ExplorerPanel {
         /** Creates a new instance of PropertiesView */
         private PropertiesView() {
           initialize();
         }
         //create the view’s contents
         private initialize() {
           Panel panel = new Panel();
           add(panel, BorderLayout.CENTER);
         }
         protected void updateTitle() {
           setName("Nexaweb Designer Properties");
         }
     }
32   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse                      NetBeans

     •
     •                 /
     •                 /
     •
     •




33   | 2004 JavaOneSM Conference | Session TS-1876
     •
             ─
             ─                                       50%
     • Eclipse
             ─
             ─
             ─
     • NetBeans
             ─
             ─
             ─
34   | 2004 JavaOneSM Conference | Session TS-1876
35
35   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse NetBeans


                                   IDE               ?




36   | 2004 JavaOneSM Conference | Session TS-1876
                               UI

     • JFC/Swing APIs
             ─
             ─ NetBeans                              UI
             ─
             ─
     • SWT
             ─ Eclipse                   UI
             ─
             ─
             ─


37   | 2004 JavaOneSM Conference | Session TS-1876
           AWT                                Eclipse

     • SWT AWT
             ─              AWT                      SWT
     •
             public void createContents(){
             _awtPanel = SWT_AWT.new_Panel(parent);
             _awtPanel.setLayout(new BorderLayout());
             _awtPanel.add(awtPanel, BorderLayout.CENTER);
             }




38   | 2004 JavaOneSM Conference | Session TS-1876
     SWT                  AWT

     public static Panel new_Panel (final Composite
       parent){
           frame = new WEmbeddedFrame()
           frame.createInstance(parent.handle);
           panel = new Panel();
           frame.add(panel);
           //forwards for events on the WEmbeddedFrame to
           panel
           return panel;
     }




39   | 2004 JavaOneSM Conference | Session TS-1876
           SWT                                NetBeans
                     Eclipse
     •                 Jar
             ─ ...\org.eclipse.jface_2.1.0\jface.jar
             ─ …\org.eclipse.swt.win32_2.1.0\ws\win32\swt.jar
             ─ …\org.eclipse.ui.workbench_2.1.0\workbench.jar
             ─ …\org.eclipse.core.runtime_2.1.0\runtime.jar

     •           swt-win32-2135.dll
             ─




40   | 2004 JavaOneSM Conference | Session TS-1876
           SWT                                NetBeans

     public void performAction() {
        openDialog();
     }


     public void openDialog(){
            //Create the SWT dialog
            Display                     display = new Display();
            Shell                       shell = new Shell();
            MyDialog                 dialog = new MyDialog(shell);
            dialog.open();
     }



41   | 2004 JavaOneSM Conference | Session TS-1876
           SWT                                NetBeans

     import org.eclipse.jface.dialogs.Dialog;
     …
     //SWT dialog
     public class MyDialog extends Dialog {
         public MyDialog(Shell parentShell){
                 super(parentShell);
         }
         //Add widgets to dialog content area.
         protected Control createDialogArea(Composite
         parent) {
             …
     }


42   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse NetBeans


                                   IDE               ?




43   | 2004 JavaOneSM Conference | Session TS-1876
                                      IDE            ?

     •
             ─
             ─
             ─

     •
             ─
             ─
             ─


44   | 2004 JavaOneSM Conference | Session TS-1876
     Eclipse NetBeans


                                   IDE               ?




45   | 2004 JavaOneSM Conference | Session TS-1876
     •
     •
     •
     •
     • Eclipse NetBeans
             ─
             ─




46   | 2004 JavaOneSM Conference | Session TS-1876
     •
             ─    http://www.nexaweb.com
             ─    http://www.eclipse.org
             ─    http://www.netbeans.org
             ─    http://eclipse-plugins.2y.net
     •
             ─ The Java Developers Guide to Eclipse
     •
             ─ Eclipse              1701
             ─                2730 NetBeans
             ─ TS-1662,TS-3210,TS-1694
47   | 2004 JavaOneSM Conference | Session TS-1876
     Robert Buffone

48
48   | 2004 JavaOneSM Conference | Session TS-1876
                              Eclipse
        NetBeans™
                                                     java.sun.com/javaone/sf




         Robert Buffone

         Nexaweb Technologies, Inc.
         http://www.nexaweb.com
49   | 2004 JavaOneSM Conference | Session TS-1876