Package org.apache.tools.ant.gui.acs

Examples of org.apache.tools.ant.gui.acs.ACSProjectElement


            getContext().getEventBus().
                postEvent(new ErrorEvent(getContext(), message));
        }
        else {
            try {
                ACSProjectElement project =
                    getContext().getProjectManager().open(_file);
                getContext().getEventBus().postEvent(
                    new NewProjectEvent(getContext(), project));
            }
            catch(Exception ex) {
View Full Code Here


   *
   * @param context Application context.
   */
    public SaveCmd(AppContext context) {
        super(context);
        ACSProjectElement project =
            getContext().getSelectionManager().getSelectedProject();
        if(project != null) {
            setLocation(project.getLocation());
        }
    }
View Full Code Here

    /**
     * Create a new project and make it active.
     *
     */
    public void run() {
        ACSProjectElement project =
            getContext().getProjectManager().createNew();
        project.setName(getContext().getResources().
                        getString(getClass(), "defName") + " " + _count++);
        getContext().getEventBus().postEvent(
            new NewProjectEvent(getContext(), project));
       
    }
View Full Code Here

        public boolean eventPosted(EventObject event) {
           
            // We should only get project closed events
           
            // Find the name of the file which was just closed.
            ACSProjectElement project =
            getContext().getSelectionManager().getSelectedProject();
            URL url = project.getLocation();
            if (url == null) {
                return true;
            }
            String file = url.getFile();
           
View Full Code Here

           
            if (event instanceof ProjectSelectedEvent ||
                event instanceof ElementChangedEvent ||
                event instanceof ProjectSavedEvent) {
                   
                ACSProjectElement project =
                    getContext().getSelectionManager().getSelectedProject();

                // Save the original title
                if (_prefix == null) {
                    _prefix = frame.getTitle();
                }

                String title = _prefix + " - " + project.getDisplayName();
                if (project.getOwnerDocument().isModified()) {
                   
                    // FIX ME a resource file should be used here
                    title += " (Modified)";
                }
                frame.setTitle(title);
View Full Code Here

            getContext().getEventBus().
                postEvent(new ErrorEvent(getContext(), message));
        }
        else {
            try {
                ACSProjectElement project =
                    getContext().getProjectManager().open(_file);
                getContext().getEventBus().postEvent(
                    new NewProjectEvent(getContext(), project));
            }
            catch(Exception ex) {
View Full Code Here

                ACSElement element = ((DeleteElementEvent)event).getDeletedElement();
                model.fireNodeDeleted(element);
                _tree.updateUI();
           }
            else {
                ACSProjectElement project = null;
                if(event instanceof ProjectSelectedEvent) {
                    ProjectSelectedEvent e = (ProjectSelectedEvent) event;
                    project = e.getSelectedProject();
                }
               
                if(project == null) {
                    // The project has been closed.
                    // XXX this needs to be tested against
                    // different version of Swing...
                    _tree.setModel(null);
                    _tree.setSelectionModel(null);
                    // Send an empty selection event to notify others that
                    // nothing is selected.
                    ElementSelectionEvent.createEvent(getContext(), null);
                }
                else {
                    boolean updateModel = false;
                    TreeModel testModel = _tree.getModel();
                   
                    // Set the model if's not an ElementTreeModel
                    if (testModel instanceof ElementTreeModel) {
                        ElementTreeModel etm = (ElementTreeModel) testModel;
                        ACSProjectElement currentProject =
                            (ACSProjectElement) etm.getRoot();
                       
                        // Set the model if the project is wrong
                        if (currentProject != project) {
                            updateModel = true;
View Full Code Here

    }

    /** Handler for selecting the project. */
    private class ActionHandler implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            ACSProjectElement project =
                (ACSProjectElement) _menus.get(e.getSource());
            _context.getEventBus().postEvent(
                new ProjectSelectedEvent(_context, project));
        }
View Full Code Here

    }

    /** Handler for selecting the project. */
    private class ActionHandler implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            ACSProjectElement project =
                (ACSProjectElement) _menus.get(e.getSource());
            _context.getEventBus().postEvent(
                new ProjectSelectedEvent(_context, project));
        }
View Full Code Here

     * @param location Location of project file.
     * @return Successfully loaded project.
     * @throws IOException thrown if there is a problem opening the project.
     */
    public ACSProjectElement open(URL location) throws IOException {
        ACSProjectElement retval = null;
        retval = ACSFactory.getInstance().load(location);
        retval.setLocation(location);
        _projects.add(retval);
        return retval;
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.gui.acs.ACSProjectElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.