Prototype of Refactoring VCS bridge module BLD200507241800
authorjbecicka@netbeans.org
Thu, 21 Jul 2005 09:03:46 +0000
changeset 6265f4c67686b8f4
parent 6264 f66e9ef33f8d
child 6266 5594d90520e7
Prototype of Refactoring VCS bridge module
refactoring.vcs/build.xml
refactoring.vcs/manifest.mf
refactoring.vcs/nbproject/project.xml
refactoring.vcs/src/META-INF/services/org.netbeans.modules.refactoring.spi.ReadOnlyFilesHandler
refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/Bundle.properties
refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/CheckoutFiles.java
refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/CheckoutPanel.form
refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/CheckoutPanel.java
refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/ReadOnlyFilesHandlerImpl.java
refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/layer.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/refactoring.vcs/build.xml	Thu Jul 21 09:03:46 2005 +0000
     1.3 @@ -0,0 +1,5 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<project name="refactoring/vcs" default="netbeans" basedir=".">
     1.6 +    <description>Builds, tests, and runs the project org.netbeans.modules.refactoring.vcs</description>
     1.7 +    <import file="../../nbbuild/templates/projectized.xml"/>
     1.8 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/refactoring.vcs/manifest.mf	Thu Jul 21 09:03:46 2005 +0000
     2.3 @@ -0,0 +1,6 @@
     2.4 +Manifest-Version: 1.0
     2.5 +OpenIDE-Module: org.netbeans.modules.refactoring.vcs
     2.6 +OpenIDE-Module-Layer: org/netbeans/modules/refactoring/vcs/layer.xml
     2.7 +OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/refactoring/vcs/Bundle.properties
     2.8 +OpenIDE-Module-Specification-Version: 1.0
     2.9 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/refactoring.vcs/nbproject/project.xml	Thu Jul 21 09:03:46 2005 +0000
     3.3 @@ -0,0 +1,53 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     3.6 +    <type>org.netbeans.modules.apisupport.project</type>
     3.7 +    <configuration>
     3.8 +        <data xmlns="http://www.netbeans.org/ns/nb-module-project/2">
     3.9 +            <code-name-base>org.netbeans.modules.refactoring.vcs</code-name-base>
    3.10 +            <module-dependencies>
    3.11 +                <dependency>
    3.12 +                    <code-name-base>org.netbeans.modules.refactoring</code-name-base>
    3.13 +                    <build-prerequisite/>
    3.14 +                    <compile-dependency/>
    3.15 +                    <run-dependency>
    3.16 +                        <release-version>1</release-version>
    3.17 +                    </run-dependency>
    3.18 +                </dependency>
    3.19 +                <dependency>
    3.20 +                    <code-name-base>org.openide.dialogs</code-name-base>
    3.21 +                    <build-prerequisite/>
    3.22 +                    <compile-dependency/>
    3.23 +                    <run-dependency>
    3.24 +                        <specification-version>6.2</specification-version>
    3.25 +                    </run-dependency>
    3.26 +                </dependency>
    3.27 +                <dependency>
    3.28 +                    <code-name-base>org.openide.awt</code-name-base>
    3.29 +                    <build-prerequisite/>
    3.30 +                    <compile-dependency/>
    3.31 +                    <run-dependency>
    3.32 +                        <specification-version>6.2</specification-version>
    3.33 +                    </run-dependency>
    3.34 +                </dependency>
    3.35 +                <dependency>
    3.36 +                    <code-name-base>org.openide.util</code-name-base>
    3.37 +                    <build-prerequisite/>
    3.38 +                    <compile-dependency/>
    3.39 +                    <run-dependency>
    3.40 +                        <specification-version>6.2</specification-version>
    3.41 +                    </run-dependency>
    3.42 +                </dependency>
    3.43 +                <dependency>
    3.44 +                    <code-name-base>org.openide.filesystems</code-name-base>
    3.45 +                    <build-prerequisite/>
    3.46 +                    <compile-dependency/>
    3.47 +                    <run-dependency>
    3.48 +                        <specification-version>6.2</specification-version>
    3.49 +                    </run-dependency>
    3.50 +                </dependency>
    3.51 +                
    3.52 +            </module-dependencies>
    3.53 +            <public-packages/>
    3.54 +        </data>
    3.55 +    </configuration>
    3.56 +</project>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/refactoring.vcs/src/META-INF/services/org.netbeans.modules.refactoring.spi.ReadOnlyFilesHandler	Thu Jul 21 09:03:46 2005 +0000
     4.3 @@ -0,0 +1,1 @@
     4.4 +org.netbeans.modules.refactoring.vcs.ReadOnlyFilesHandlerImpl
     4.5 \ No newline at end of file
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/Bundle.properties	Thu Jul 21 09:03:46 2005 +0000
     5.3 @@ -0,0 +1,1 @@
     5.4 +OpenIDE-Module-Name=Refactoring VCS Bridge
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/CheckoutFiles.java	Thu Jul 21 09:03:46 2005 +0000
     6.3 @@ -0,0 +1,58 @@
     6.4 +/*
     6.5 + *                 Sun Public License Notice
     6.6 + *
     6.7 + * The contents of this file are subject to the Sun Public License
     6.8 + * Version 1.0 (the "License"). You may not use this file except in
     6.9 + * compliance with the License. A copy of the License is available at
    6.10 + * http://www.sun.com/
    6.11 + *
    6.12 + * The Original Code is NetBeans. The Initial Developer of the Original
    6.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
    6.14 + * Microsystems, Inc. All Rights Reserved.
    6.15 + */
    6.16 +
    6.17 +package org.netbeans.modules.refactoring.vcs;
    6.18 +import java.util.Collection;
    6.19 +import javax.swing.Action;
    6.20 +import org.netbeans.modules.refactoring.spi.ProblemDetailsImplementation;
    6.21 +import org.openide.DialogDescriptor;
    6.22 +import org.openide.DialogDisplayer;
    6.23 +
    6.24 +/**
    6.25 + *
    6.26 + * @author Jan Becicka
    6.27 + */
    6.28 +public class CheckoutFiles implements ProblemDetailsImplementation {
    6.29 +    
    6.30 +    private Collection files;
    6.31 +    private static String CHECKOUT_OPTION;
    6.32 +    private static final String CANCEL_OPTION = "Cancel";
    6.33 +    /** Creates a new instance of CheckoutFiles */
    6.34 +    public CheckoutFiles(Collection files) {
    6.35 +        this.files=files;
    6.36 +    }
    6.37 +    
    6.38 +    public void showDetails(Action rerunRefactoringAction) {
    6.39 +        CHECKOUT_OPTION = "Checkout and " + rerunRefactoringAction.getValue(Action.NAME);
    6.40 +        org.openide.DialogDescriptor desc = new DialogDescriptor(new CheckoutPanel(files), "Update Files", true, new String[]{CHECKOUT_OPTION, CANCEL_OPTION}, CHECKOUT_OPTION, DialogDescriptor.DEFAULT_ALIGN, null, null);
    6.41 +        Object retval = DialogDisplayer.getDefault().notify(desc);
    6.42 +        if (retval == CHECKOUT_OPTION) {
    6.43 +            checkoutFiles();
    6.44 +            rerunRefactoring(rerunRefactoringAction);
    6.45 +        }
    6.46 +    }
    6.47 +    
    6.48 +    public String getDetailsHint() {
    6.49 +        return "Update Files";
    6.50 +    }
    6.51 +
    6.52 +    private void checkoutFiles() {
    6.53 +    }
    6.54 +    
    6.55 +    private void rerunRefactoring(Action rerunRefactoringAction) {
    6.56 +        Runnable close = (Runnable) rerunRefactoringAction.getValue("doCloseParent");
    6.57 +        close.run();
    6.58 +        rerunRefactoringAction.actionPerformed(null);
    6.59 +    }
    6.60 +    
    6.61 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/CheckoutPanel.form	Thu Jul 21 09:03:46 2005 +0000
     7.3 @@ -0,0 +1,57 @@
     7.4 +<?xml version="1.0" encoding="UTF-8" ?>
     7.5 +
     7.6 +<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     7.7 +  <Properties>
     7.8 +    <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
     7.9 +      <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
    7.10 +        <EmptyBorder bottom="11" left="12" right="11" top="12"/>
    7.11 +      </Border>
    7.12 +    </Property>
    7.13 +  </Properties>
    7.14 +  <AuxValues>
    7.15 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
    7.16 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
    7.17 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    7.18 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
    7.19 +    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,90,0,0,1,-93"/>
    7.20 +  </AuxValues>
    7.21 +
    7.22 +  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout">
    7.23 +    <Property name="verticalGap" type="int" value="6"/>
    7.24 +  </Layout>
    7.25 +  <SubComponents>
    7.26 +    <Component class="javax.swing.JLabel" name="topLabel">
    7.27 +      <Properties>
    7.28 +        <Property name="text" type="java.lang.String" value="Files To Update"/>
    7.29 +      </Properties>
    7.30 +      <Constraints>
    7.31 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
    7.32 +          <BorderConstraints direction="North"/>
    7.33 +        </Constraint>
    7.34 +      </Constraints>
    7.35 +    </Component>
    7.36 +    <Component class="javax.swing.JProgressBar" name="progressBar">
    7.37 +      <Constraints>
    7.38 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
    7.39 +          <BorderConstraints direction="South"/>
    7.40 +        </Constraint>
    7.41 +      </Constraints>
    7.42 +    </Component>
    7.43 +    <Container class="javax.swing.JScrollPane" name="scrollPane">
    7.44 +      <AuxValues>
    7.45 +        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
    7.46 +      </AuxValues>
    7.47 +      <Constraints>
    7.48 +        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
    7.49 +          <BorderConstraints direction="Center"/>
    7.50 +        </Constraint>
    7.51 +      </Constraints>
    7.52 +
    7.53 +      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
    7.54 +      <SubComponents>
    7.55 +        <Component class="javax.swing.JList" name="fileList">
    7.56 +        </Component>
    7.57 +      </SubComponents>
    7.58 +    </Container>
    7.59 +  </SubComponents>
    7.60 +</Form>
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/CheckoutPanel.java	Thu Jul 21 09:03:46 2005 +0000
     8.3 @@ -0,0 +1,88 @@
     8.4 +/*
     8.5 + *                 Sun Public License Notice
     8.6 + *
     8.7 + * The contents of this file are subject to the Sun Public License
     8.8 + * Version 1.0 (the "License"). You may not use this file except in
     8.9 + * compliance with the License. A copy of the License is available at
    8.10 + * http://www.sun.com/
    8.11 + *
    8.12 + * The Original Code is NetBeans. The Initial Developer of the Original
    8.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
    8.14 + * Microsystems, Inc. All Rights Reserved.
    8.15 + */
    8.16 +
    8.17 +package org.netbeans.modules.refactoring.vcs;
    8.18 +
    8.19 +import java.awt.Component;
    8.20 +import java.util.Collection;
    8.21 +import javax.swing.DefaultListCellRenderer;
    8.22 +import javax.swing.JList;
    8.23 +import org.openide.filesystems.FileObject;
    8.24 +import org.openide.filesystems.FileUtil;
    8.25 +
    8.26 +/**
    8.27 + *
    8.28 + * @author  Jan Becicka
    8.29 + */
    8.30 +public class CheckoutPanel extends javax.swing.JPanel {
    8.31 +    
    8.32 +    /**
    8.33 +     * Creates new form CheckoutPanel
    8.34 +     * 
    8.35 +     */
    8.36 +    public CheckoutPanel(Collection files) {
    8.37 +        initComponents();
    8.38 +        fileList.setListData(files.toArray());
    8.39 +        fileList.setCellRenderer(new DefaultListCellRenderer() {
    8.40 +                public Component getListCellRendererComponent(
    8.41 +                        JList list,
    8.42 +                        Object value,
    8.43 +                        int index,
    8.44 +                        boolean isSelected,
    8.45 +                        boolean cellHasFocus) 
    8.46 +                  {
    8.47 +                    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    8.48 +                    setText("<html>" + ((FileObject) value).getNameExt() + " <font color=#707070>(" + FileUtil.getFileDisplayName((FileObject) value) + ")</font></html>");
    8.49 +                    return this;
    8.50 +                }
    8.51 +                
    8.52 +                
    8.53 +        });
    8.54 +    }
    8.55 +    
    8.56 +    /** This method is called from within the constructor to
    8.57 +     * initialize the form.
    8.58 +     * WARNING: Do NOT modify this code. The content of this method is
    8.59 +     * always regenerated by the Form Editor.
    8.60 +     */
    8.61 +    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    8.62 +    private void initComponents() {
    8.63 +        topLabel = new javax.swing.JLabel();
    8.64 +        progressBar = new javax.swing.JProgressBar();
    8.65 +        scrollPane = new javax.swing.JScrollPane();
    8.66 +        fileList = new javax.swing.JList();
    8.67 +
    8.68 +        setLayout(new java.awt.BorderLayout(0, 6));
    8.69 +
    8.70 +        setBorder(new javax.swing.border.EmptyBorder(new java.awt.Insets(12, 12, 11, 11)));
    8.71 +        org.openide.awt.Mnemonics.setLocalizedText(topLabel, "Files To Update");
    8.72 +        add(topLabel, java.awt.BorderLayout.NORTH);
    8.73 +
    8.74 +        add(progressBar, java.awt.BorderLayout.SOUTH);
    8.75 +
    8.76 +        scrollPane.setViewportView(fileList);
    8.77 +
    8.78 +        add(scrollPane, java.awt.BorderLayout.CENTER);
    8.79 +
    8.80 +    }
    8.81 +    // </editor-fold>//GEN-END:initComponents
    8.82 +    
    8.83 +    
    8.84 +    // Variables declaration - do not modify//GEN-BEGIN:variables
    8.85 +    private javax.swing.JList fileList;
    8.86 +    private javax.swing.JProgressBar progressBar;
    8.87 +    private javax.swing.JScrollPane scrollPane;
    8.88 +    private javax.swing.JLabel topLabel;
    8.89 +    // End of variables declaration//GEN-END:variables
    8.90 +    
    8.91 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/ReadOnlyFilesHandlerImpl.java	Thu Jul 21 09:03:46 2005 +0000
     9.3 @@ -0,0 +1,34 @@
     9.4 +/*
     9.5 + *                 Sun Public License Notice
     9.6 + *
     9.7 + * The contents of this file are subject to the Sun Public License
     9.8 + * Version 1.0 (the "License"). You may not use this file except in
     9.9 + * compliance with the License. A copy of the License is available at
    9.10 + * http://www.sun.com/
    9.11 + *
    9.12 + * The Original Code is NetBeans. The Initial Developer of the Original
    9.13 + * Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun
    9.14 + * Microsystems, Inc. All Rights Reserved.
    9.15 + */
    9.16 +
    9.17 +package org.netbeans.modules.refactoring.vcs;
    9.18 +import java.util.Collection;
    9.19 +import org.netbeans.modules.refactoring.api.Problem;
    9.20 +import org.netbeans.modules.refactoring.spi.*;
    9.21 +
    9.22 +/**
    9.23 + *
    9.24 + * @author Jan Becicka
    9.25 + */
    9.26 +public class ReadOnlyFilesHandlerImpl implements ReadOnlyFilesHandler {
    9.27 +    
    9.28 +    /** Creates a new instance of ReadOnlyFilesHandlerImpl */
    9.29 +    public ReadOnlyFilesHandlerImpl() {
    9.30 +    }
    9.31 +    
    9.32 +    public Problem createProblem(Collection files) {
    9.33 +        //if files cannot be handled by VCS return null
    9.34 +        return new Problem(false, "Some files are checked out as read-only. You can update them as read-write.", ProblemDetailsFactory.createProblemDetails(new CheckoutFiles(files)));
    9.35 +    }
    9.36 +    
    9.37 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/refactoring.vcs/src/org/netbeans/modules/refactoring/vcs/layer.xml	Thu Jul 21 09:03:46 2005 +0000
    10.3 @@ -0,0 +1,5 @@
    10.4 +<?xml version="1.0" encoding="UTF-8"?>
    10.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
    10.6 +<filesystem>
    10.7 +</filesystem>
    10.8 +