⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fileactiongroup.java

📁 基于Eclipse RCP模型下的文档管理程序源代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   FileActionGroup.java

package fileexplorer.action;

import fileexplorer.system.fileImages;
import fileexplorer.views.ViewForFileContent;
import java.io.File;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionGroup;

public class FileActionGroup extends ActionGroup
{
    private class PrevAction extends Action
    {

        public void run()
        {
            int FolderNumbers = 0;
            int FileNumbers = 0;
            List list = new LinkedList();
            table = tv.getTable();
            if(table.getItemCount() != 0)
            {
                int l1 = table.getItem(0).getData().toString().length();
                int l2 = table.getItem(0).getText().toString().length();
                path = table.getItem(0).getData().toString().substring(0, l1 - l2 - 1);
            } else
            {
                path = ViewForFileContent.currentpath;
            }
            if(path.length() == 2)
            {
                File fileRoots[] = File.listRoots();
                for(int j = 0; j < fileRoots.length; j++)
                    list.add(fileRoots[j]);

                FolderNumbers = fileRoots.length;
                FileNumbers = 0;
                text.setText("\u6211\u7684\u7535\u8111");
            } else
            {
                int dotPos = path.lastIndexOf('\\');
                String path1 = path.substring(0, dotPos);
                ViewForFileContent.currentpath = path1;
                text.setText((new StringBuilder(String.valueOf(path1))).append("\\").toString());
                try
                {
                    File file = new File((new StringBuilder(String.valueOf(path1))).append("\\").toString());
                    if(file.isDirectory())
                    {
                        File files[] = file.listFiles();
                        if(files.length == 0)
                        {
                            list.add(file);
                        } else
                        {
                            for(int i = 0; i < files.length; i++)
                                list.add(files[i]);

                        }
                        for(int s = 0; s < files.length; s++)
                            if(files[s].isDirectory())
                                FolderNumbers++;
                            else
                                FileNumbers++;

                    } else
                    {
                        list.add(file);
                        FolderNumbers = 1;
                        FileNumbers = 0;
                    }
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            tv.setInput(list);
            label.setText((new StringBuilder("\u6587\u4EF6\u5939\u4E2A\u6570\uFF1A")).append(FolderNumbers).append(" ").append("\u6587\u4EF6\u4E2A\u6570\uFF1A").append(FileNumbers).append(" ").toString());
        }

        final FileActionGroup this$0;

        public PrevAction()
        {
            this$0 = FileActionGroup.this;
            super();
            setHoverImageDescriptor(fileImages.getImageDescriptor("PREV"));
            setText("\u4E0A\u4E00\u9875");
        }
    }

    private class NextAction extends Action
    {

        public void run()
        {
        }

        final FileActionGroup this$0;

        public NextAction()
        {
            this$0 = FileActionGroup.this;
            super();
            setHoverImageDescriptor(fileImages.getImageDescriptor("NEXT"));
            setText("\u4E0B\u4E00\u9875");
        }
    }

    private class HomeAction extends Action
    {

        public void run()
        {
            tv.setInput(initInput());
            text.setText("\u6211\u7684\u7535\u8111");
        }

        public Object initInput()
        {
            File fileRoots[] = File.listRoots();
            List list = new LinkedList();
            for(int j = 0; j < fileRoots.length; j++)
                list.add(fileRoots[j]);

            return list;
        }

        final FileActionGroup this$0;

        public HomeAction()
        {
            this$0 = FileActionGroup.this;
            super();
            setHoverImageDescriptor(fileImages.getImageDescriptor("HOME"));
            setText("\u6211\u7684\u7535\u8111");
        }
    }


    public FileActionGroup(TableViewer tableViewer, Text text, Label label)
    {
        path = "";
        tv = tableViewer;
        this.text = text;
        this.label = label;
    }

    public void fillActionBars(IActionBars actionBars)
    {
        IToolBarManager toolBar = actionBars.getToolBarManager();
        toolBar.add(new HomeAction());
        toolBar.add(new PrevAction());
        toolBar.add(new NextAction());
    }

    private String path;
    private TableViewer tv;
    private Table table;
    private Text text;
    private Label label;







}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -