View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.examples.tutorial.mainwnd;
17  
18  import java.awt.Desktop;
19  
20  /**
21   * <p>
22   * A specialized action task for editing a selected file.
23   * </p>
24   *
25   * @author Oliver Heger
26   * @version $Id: EditDesktopTask.java 205 2012-01-29 18:29:57Z oheger $
27   */
28  public class EditDesktopTask extends AbstractDesktopTask
29  {
30      /**
31       * Creates a new instance of {@code EditDesktopTask} and sets the main
32       * controller.
33       *
34       * @param ctrl the main controller
35       */
36      public EditDesktopTask(MainWndController ctrl)
37      {
38          super(ctrl);
39      }
40  
41      /**
42       * Performs the desktop operation. This implementation asks the
43       * {@code Desktop} object to edit the selected file.
44       */
45      @Override
46      protected void performDesktopOperation(Desktop desktop) throws Exception
47      {
48          desktop.edit(getSelectedFile());
49      }
50  }