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

📄 viewforfilecontent.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:   ViewForFileContent.java

package fileexplorer.views;

import fileexplorer.action.FileActionGroup;
import fileexplorer.action.FileRightKeyActionGroup;
import java.io.File;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.part.ViewPart;

// Referenced classes of package fileexplorer.views:
//            FileSorter, FileContentContentProvider, FileContentLabelProvider

public class ViewForFileContent extends ViewPart
{

    public ViewForFileContent()
    {
        explorerViewId = null;
        filenameSorter0 = new FileSorter(1);
        filenameSorter1 = new FileSorter(-1);
        filesizeSorter0 = new FileSorter(2);
        filesizeSorter1 = new FileSorter(-2);
        filetypeSorter0 = new FileSorter(3);
        filetypeSorter1 = new FileSorter(-3);
        filedateSorter0 = new FileSorter(4);
        filedateSorter1 = new FileSorter(-4);
        filepathSorter0 = new FileSorter(5);
        filepathSorter1 = new FileSorter(-5);
    }

    public void createPartControl(Composite parent)
    {
        Composite container = new Composite(parent, 0);
        container.setLayout(new GridLayout(1, false));
        showComposite = new Composite(container, 0);
        GridLayout g = new GridLayout();
        g.numColumns = 3;
        showComposite.setLayout(g);
        showComposite.setLayoutData(new GridData(4, 0x1000000, true, false));
        label = new Label(showComposite, 16384);
        label.setText("\u5730\u5740:");
        GridData griddata = new GridData(16384, 1024, false, false);
        griddata.widthHint = 35;
        griddata.heightHint = 15;
        label.setLayoutData(griddata);
        AdressText = new Text(showComposite, 2048);
        AdressText.setText("");
        GridData griddata1 = new GridData(768);
        griddata1.widthHint = 300;
        griddata1.heightHint = 15;
        AdressText.setLayoutData(griddata1);
        tableViewer = new TableViewer(container, 0x10802);
        showLabel = new Label(container, 0);
        showLabel.setText("\u6587\u4EF6\u4E2A\u6570\uFF1A0 ");
        GridData griddata2 = new GridData(768);
        griddata2.widthHint = 300;
        griddata2.heightHint = 15;
        showLabel.setLayoutData(griddata2);
        table = tableViewer.getTable();
        table.setHeaderVisible(true);
        table.setLinesVisible(false);
        TableLayout daLayout = new TableLayout();
        table.setLayout(daLayout);
        table.setLayoutData(new GridData(4, 4, true, true));
        tableViewer.setContentProvider(new FileContentContentProvider());
        tableViewer.setLabelProvider(new FileContentLabelProvider());
        tableViewer.setInput(initInput());
        AdressText.setText("\u6211\u7684\u7535\u8111");
        FileActionGroup actionGroup = new FileActionGroup(tableViewer, AdressText, showLabel);
        org.eclipse.ui.IActionBars bars = getViewSite().getActionBars();
        actionGroup.fillActionBars(bars);
        FileRightKeyActionGroup actionGroup1 = new FileRightKeyActionGroup(tableViewer);
        actionGroup1.fillContextMenu(new MenuManager());
        TableColumn column = new TableColumn(table, 0);
        column.setText("\u6587\u4EF6\u540D\u79F0");
        column.setWidth(170);
        column.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e)
            {
                sortType = !sortType;
                tableViewer.setSorter(sortType ? filenameSorter0 : filenameSorter1);
            }

            boolean sortType;
            final ViewForFileContent this$0;

            
            {
                this$0 = ViewForFileContent.this;
                super();
                sortType = true;
            }
        }
);
        TableColumn columnSize = new TableColumn(table, 0);
        columnSize.setText("\u6587\u4EF6\u5927\u5C0F");
        columnSize.setWidth(130);
        columnSize.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e)
            {
                sortType = !sortType;
                tableViewer.setSorter(sortType ? filesizeSorter0 : filesizeSorter1);
            }

            boolean sortType;
            final ViewForFileContent this$0;

            
            {
                this$0 = ViewForFileContent.this;
                super();
                sortType = true;
            }
        }
);
        TableColumn columnType = new TableColumn(table, 0);
        columnType.setText("\u6587\u4EF6\u7C7B\u578B");
        columnType.setWidth(130);
        columnType.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e)
            {
                sortType = !sortType;
                tableViewer.setSorter(sortType ? filetypeSorter0 : filetypeSorter1);
            }

            boolean sortType;
            final ViewForFileContent this$0;

            
            {
                this$0 = ViewForFileContent.this;
                super();
                sortType = true;
            }
        }
);
        TableColumn columnDate = new TableColumn(table, 0);
        columnDate.setText("\u4FEE\u6539\u65E5\u671F");
        columnDate.setWidth(130);
        columnDate.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e)
            {
                sortType = !sortType;
                tableViewer.setSorter(sortType ? filedateSorter0 : filedateSorter1);
            }

            boolean sortType;
            final ViewForFileContent this$0;

            
            {
                this$0 = ViewForFileContent.this;
                super();
                sortType = true;
            }
        }
);
        TableColumn columnpath = new TableColumn(table, 0);
        columnpath.setText("\u6587\u4EF6\u8DEF\u5F84");
        columnpath.setWidth(200);
        columnpath.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e)
            {
                sortType = !sortType;
                tableViewer.setSorter(sortType ? filepathSorter0 : filepathSorter1);
            }

            boolean sortType;
            final ViewForFileContent this$0;

            
            {
                this$0 = ViewForFileContent.this;
                super();
                sortType = true;
            }
        }
);
        table.addMouseListener(new MouseAdapter() {

            public void mouseDown(MouseEvent e)
            {
                String path = "";
                path = table.getSelection()[0].getData().toString();
                AdressText.setText(path);
                File file;
                if(table.getSelection()[0].getData() instanceof File)
                    file = (File)table.getSelection()[0].getData();
            }

            public void mouseDoubleClick(MouseEvent e)
            {
                ViewForFileContent.FileNumbers = 0;
                ViewForFileContent.FolderNumbers = 0;
                String path = "";
                path = table.getSelection()[0].getData().toString();
                ViewForFileContent.currentpath = path;
                AdressText.setText(path);
                File file = new File(path);
                List list = new LinkedList();
                if(file.isDirectory())
                {
                    File files[] = file.listFiles();
                    if(files.length != 0)
                    {
                        for(int i = 0; i < files.length; i++)
                            list.add(files[i]);

                    }
                    tableViewer.setInput(list);
                    table.layout();
                    for(int s = 0; s < files.length; s++)
                        if(files[s].isDirectory())
                            ViewForFileContent.FolderNumbers++;
                        else
                            ViewForFileContent.FileNumbers++;

                    showLabel.setText((new StringBuilder("\u6587\u4EF6\u5939\u4E2A\u6570\uFF1A")).append(ViewForFileContent.FolderNumbers).append(" ").append("\u6587\u4EF6\u4E2A\u6570\uFF1A").append(ViewForFileContent.FileNumbers).append(" ").toString());
                } else
                {
                    Runtime hello = Runtime.getRuntime();
                    String path11 = table.getSelection()[0].getData().toString();
                    try
                    {
                        hello.exec((new StringBuilder("cmd /E:ON /c start ")).append(path11.replace(" ", "\" \"")).toString());
                    }
                    catch(IOException e1)
                    {
                        e1.printStackTrace();
                    }
                }
            }

            final ViewForFileContent this$0;

            
            {
                this$0 = ViewForFileContent.this;
                super();
            }
        }
);
    }

    public void setFocus()
    {
    }

    public TableViewer getTableViewer()
    {
        return tableViewer;
    }

    public Label getShowLabel()
    {
        return showLabel;
    }

    public Text getAdressText()
    {
        return AdressText;
    }

    public String getExplorerViewId()
    {
        return explorerViewId;
    }

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

        return list;
    }

    public static final String ID = "fileexplorer.views.ViewForFileContent";
    private TableViewer tableViewer;
    private Table table;
    private Composite showComposite;
    private String explorerViewId;
    private Label label;
    private Text AdressText;
    private Label showLabel;
    private ViewerSorter filenameSorter0;
    private ViewerSorter filenameSorter1;
    private ViewerSorter filesizeSorter0;
    private ViewerSorter filesizeSorter1;
    private ViewerSorter filetypeSorter0;
    private ViewerSorter filetypeSorter1;
    private ViewerSorter filedateSorter0;
    private ViewerSorter filedateSorter1;
    private ViewerSorter filepathSorter0;
    private ViewerSorter filepathSorter1;
    public static int FolderNumbers = 0;
    public static int FileNumbers = 0;
    public static String currentpath = "";















}

⌨️ 快捷键说明

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