當前位置: 首頁>>代碼示例>>Java>>正文


Java FileDialog.getFilterPath方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.FileDialog.getFilterPath方法的典型用法代碼示例。如果您正苦於以下問題:Java FileDialog.getFilterPath方法的具體用法?Java FileDialog.getFilterPath怎麽用?Java FileDialog.getFilterPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.FileDialog的用法示例。


在下文中一共展示了FileDialog.getFilterPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: chooseFile

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
protected void chooseFile ()
{
    final FileDialog dlg = new FileDialog ( getShell (), SWT.OPEN | SWT.MULTI );
    dlg.setFilterExtensions ( new String[] { "*.xml", "*.*" } );
    dlg.setFilterNames ( new String[] { "Eclipse NeoSCADA Exporter Files", "All files" } );
    final String result = dlg.open ();
    if ( result != null )
    {
        final File base = new File ( dlg.getFilterPath () );

        for ( final String name : dlg.getFileNames () )
        {
            this.fileText.setText ( new File ( base, name ).getAbsolutePath () );
        }
        makeDirty ();
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:18,代碼來源:HiveTab.java

示例2: write

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
public boolean write(StyledText textArea, File file)// �˷����������ļ��л����п��ٱ����ļ�
{
	File f = null;
	if (file == null) {

		FileDialog saveDialog = new FileDialog(black, SWT.SAVE);

		saveDialog.setFilterExtensions(filterExtensionsForSaveAs);

		saveDialog.open();
		if (saveDialog.getFileName().length() > 0) {
			f = new File(saveDialog.getFilterPath() + "/"
					+ saveDialog.getFileName());
			// .setCurrentFileSaveLocation(fullScreenWord.getCurrentEditFile().getAbsolutePath());
		} else {
			return false;
		}

	} else
		f = file;

	inputAndOutput(f, 1);

	return true;
}
 
開發者ID:piiiiq,項目名稱:Black,代碼行數:26,代碼來源:io.java

示例3: saveAllAsTextToOneFile

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
public void saveAllAsTextToOneFile() {
	if (b.fileindex.size() == 0)
		return;

	FileDialog fd = getFileDialog("����ΪTXT�ļ�", "", b, SWT.SAVE, new String[] { "*.txt" });

	if (fd.getFileNames().length == 1) {
		File f = new File(fd.getFilterPath() + System.getProperty("file.separator") + fd.getFileName());
		b.saveCurrentFile(false, false);
		findinfo_[] text = getAllTextFromProject(true, false);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < text.length; i++) {
			if (text[i].stringbuilder != null)
				sb.append(text[i].stringbuilder.toString());
		}
		ioThread io = new ioThread(b);
		if (io.writeTextFile(f, sb.toString(), "utf-8"))
			getMessageBox("", "����ɹ�");
		else
			getMessageBox("", "����ʧ��");
	}

}
 
開發者ID:piiiiq,項目名稱:Black,代碼行數:24,代碼來源:blackAction.java

示例4: showOpenFilesDialog

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
public static ArrayList<String> showOpenFilesDialog(Shell shell, String title, String filterPath, String[] exts) {
	FileDialog fd = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
	fd.setOverwrite(true); // prompt user if file exists!
	fd.setText(title);
	if (filterPath == null)
		filterPath = System.getProperty("user.dir");
	fd.setFilterPath(filterPath);
	if (exts == null)
		exts = new String[]{"*.*"};
	fd.setFilterExtensions(exts);
	
	ArrayList<String> files = new ArrayList<String>();
    if (fd.open() != null) {
      String[] names = fd.getFileNames();
      for (int i = 0, n = names.length; i < n; i++) {
        StringBuffer buf = new StringBuffer(fd.getFilterPath());
        if (buf.charAt(buf.length() - 1) != File.separatorChar)
          buf.append(File.separatorChar);
        buf.append(names[i]);
        files.add(buf.toString());
      }
    }
    System.out.println(files);

	return files;
}
 
開發者ID:Transkribus,項目名稱:TranskribusSwtGui,代碼行數:27,代碼來源:DialogUtil.java

示例5: menuOpenFile

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
void menuOpenFile() {
	// Get the user to choose an image file.
	FileDialog fileChooser = new FileDialog(getShell(), SWT.OPEN);
	if (lastPath != null) {
		fileChooser.setFilterPath(lastPath);
	}
	fileChooser.setFilterExtensions(new String[] { "*.bmp; *.gif; *.ico; *.jpg; *.pcx; *.png; *.tif", "*.bmp",
	        "*.gif", "*.ico", "*.jpg", "*.pcx", "*.png", "*.tif" });
	fileChooser.setFilterNames(new String[] {
	        ImageAnalyzer.bundle.getString("All_images") + " (bmp, gif, ico, jpg, pcx, png, tif)", "BMP (*.bmp)",
	        "GIF (*.gif)", "ICO (*.ico)", "JPEG (*.jpg)", "PCX (*.pcx)", "PNG (*.png)", "TIFF (*.tif)" });
	String filename = fileChooser.open();
	lastPath = fileChooser.getFilterPath();
	if (filename == null) {
		return;
	}

	menuOpenFile(filename);
}
 
開發者ID:aroog,項目名稱:code,代碼行數:20,代碼來源:ImageAnalyzer.java

示例6: getLogFileTargetLocation

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
/**
 * Display a {@link FileDialog} to the user and obtain the location for the log file.
 * @return path to target file, null if user canceled the dialog
 */
private String getLogFileTargetLocation() {
    FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);

    fd.setText("Save Log..");
    fd.setFileName("log.txt");

    if (mLogFileExportFolder == null) {
        mLogFileExportFolder = System.getProperty("user.home");
    }
    fd.setFilterPath(mLogFileExportFolder);

    fd.setFilterNames(new String[] {
            "Text Files (*.txt)"
    });
    fd.setFilterExtensions(new String[] {
            "*.txt"
    });

    String fName = fd.open();
    if (fName != null) {
        mLogFileExportFolder = fd.getFilterPath();  /* save path to restore on future calls */
    }

    return fName;
}
 
開發者ID:utds3lab,項目名稱:SMVHunter,代碼行數:30,代碼來源:LogCatPanel.java

示例7: getFile

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
private File[] getFile(File startingDirectory) {
    int style = SWT.OPEN;
    if (multiple) {
        style |= SWT.MULTI;
    }
    final FileDialog dialog = new FileDialog(getShell(), style);
    if (startingDirectory != null) {
        dialog.setFileName(startingDirectory.getPath());
    }
    if (extensions != null) {
        dialog.setFilterExtensions(extensions);
    }
    dialog.open();
    final String[] fileNames = dialog.getFileNames();
    if (fileNames.length > 0) {
        final File[] files = new File[fileNames.length];
        for (int i = 0; i < fileNames.length; i++) {
            files[i] = new File(dialog.getFilterPath(), fileNames[i]);
        }
        return files;
    }
    return null;
}
 
開發者ID:dbflute-session,項目名稱:erflute,代碼行數:24,代碼來源:MultiFileFieldEditor.java

示例8: getFile

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
private File[] getFile(final File startingDirectory) {

        int style = SWT.OPEN;
        if (multiple) {
            style |= SWT.MULTI;
        }

        final FileDialog dialog = new FileDialog(getShell(), style);
        if (startingDirectory != null) {
            dialog.setFileName(startingDirectory.getPath());
        }
        if (extensions != null) {
            dialog.setFilterExtensions(extensions);
        }
        dialog.open();
        final String[] fileNames = dialog.getFileNames();

        if (fileNames.length > 0) {
            final File[] files = new File[fileNames.length];

            for (int i = 0; i < fileNames.length; i++) {
                files[i] = new File(dialog.getFilterPath(), fileNames[i]);
            }

            return files;
        }

        return null;
    }
 
開發者ID:roundrop,項目名稱:ermasterr,代碼行數:30,代碼來源:MultiFileFieldEditor.java

示例9: onFileOpen

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
/**
 * Call back funtion of button "open". Will open a file dialog, and choose
 * the image file. It supports image formats supported by Eclipse.
 */
public void onFileOpen() {
	FileDialog fileChooser = new FileDialog(getShell(), SWT.OPEN);
	fileChooser.setText("Open image file");
	fileChooser.setFilterPath(currentDir);
	fileChooser.setFilterExtensions(
		new String[] { "*.gif; *.jpg; *.png; *.ico; *.bmp" });
	fileChooser.setFilterNames(
		new String[] { "SWT image" + " (gif, jpeg, png, ico, bmp)" });
	String filename = fileChooser.open();
	if (filename != null){
		loadImage(filename);
		currentDir = fileChooser.getFilterPath();
	}
}
 
開發者ID:NineWorlds,項目名稱:xstreamer,代碼行數:19,代碼來源:SWTImageCanvas.java

示例10: saveAsText

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
public void saveAsText() {
	if (b.currentEditFile == null || b.text == null)
		return;
	FileDialog fd = getFileDialog("ת��Ϊtxt�ļ�", getShowNameByRealName(b.getCurrentEditFile().getName()), b, SWT.SAVE,
			new String[] { "*.txt" });
	if (fd.getFileNames().length == 1) {
		File f = new File(fd.getFilterPath() + System.getProperty("file.separator") + fd.getFileName());
		if (saveCurrentFileAsTXT(f, "utf-8"))
			getMessageBox("", "ת��ɹ�");
		else
			getMessageBox("", "ת��ʧ��");
	}
}
 
開發者ID:piiiiq,項目名稱:Black,代碼行數:14,代碼來源:blackAction.java

示例11: getFile

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
private File[] getFile(File startingDirectory) {

		int style = SWT.OPEN;
		if (multiple) {
			style |= SWT.MULTI;
		}

		FileDialog dialog = new FileDialog(getShell(), style);
		if (startingDirectory != null) {
			dialog.setFileName(startingDirectory.getPath());
		}
		if (extensions != null) {
			dialog.setFilterExtensions(extensions);
		}
		dialog.open();
		String[] fileNames = dialog.getFileNames();

		if (fileNames.length > 0) {
			File[] files = new File[fileNames.length];

			for (int i = 0; i < fileNames.length; i++) {
				files[i] = new File(dialog.getFilterPath(), fileNames[i]);
			}

			return files;
		}

		return null;
	}
 
開發者ID:kozake,項目名稱:ermaster-k,代碼行數:30,代碼來源:MultiFileFieldEditor.java

示例12: onFileOpen

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
/**
 * Opens the file dialog to create the imports here
 */
public void onFileOpen() {
	FileDialog fileChooser = new FileDialog(Display.getCurrent()
			.getActiveShell(), SWT.MULTI);
	fileChooser.setText("Choose image");
	// fileChooser.setFilterPath("");
	fileChooser
			.setFilterExtensions(new String[] { "*.gif; *.jpg; *.png; *.ico; *.bmp" });
	fileChooser.setFilterNames(new String[] { "SWT image"
			+ " (gif, jpeg, png, ico, bmp)" });
	String filename = fileChooser.open();
	List<String> paths = new ArrayList<String>();
	if (filename != null) {
		String filePath = null;
		String[] files = fileChooser.getFileNames();
		for (int i = 0; i < files.length ; i++) {
			filePath = new String();
			filePath += fileChooser.getFilterPath();
			if (filePath.charAt(filePath.length() - 1) != File.separatorChar) {
				filePath += File.separatorChar;
			}
			filePath += files[i];
			paths.add(filePath);
		}
	}	
	for (String path : paths)	 { 
		File file = new File(path);
		if (file != null)
			importImageToWorkspace(new File(path));
	}
}
 
開發者ID:ShoukriKattan,項目名稱:ForgedUI-Eclipse,代碼行數:34,代碼來源:ImageBrowserDialog.java

示例13: run

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
/**
     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
     */
    public void run(IAction action) {
        // Model model;
        //
        // if (!(firstSelectedEObject instanceof Model)) {
        // Package pack = (Package) firstSelectedEObject;
        // model = pack.getModel();
        // } else {
        // model = (Model) firstSelectedEObject;
        // }

        Package pack = (Package) firstSelectedEObject;

        Shell shell = UiCorePlugin.getShell();
        FileDialog dialog = new FileDialog(shell, SWT.MULTI);

        dialog.setFilterNames(new String[] { UICoreConstant.EXCEL_IO_IMPORT_XLS }); //$NON-NLS-1$
        dialog.setFilterExtensions(new String[] { UICoreConstant.EXCEL_IO_IMPORT_XLS }); //$NON-NLS-1$

        dialog.open();
        String filePath = dialog.getFilterPath();
        String[] fileNames = dialog.getFileNames();

        ImportIoCommand cmd = new ImportIoCommand(pack, filePath, fileNames);

//        ProjectResourceSetListenerController.getInstance().fireSkipChangeEvent(true);
//        ((UMLDiagramCommandStack) DomainRegistry.getUMLDomain().getCommandStackListener()).execute(cmd);
//        ProjectResourceSetListenerController.getInstance().fireSkipChangeEvent(false);
        
        // 2012.05.07 modified by nspark  Transaction.OPTION_NO_NOTIFICATIONS  true 적용
        ((UMLDiagramCommandStack) DomainRegistry.getUMLDomain().getCommandStackListener()).execute(cmd, Boolean.TRUE);
        
        ProjectUtil.refreshNodeInExplorer(pack);
    }
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:37,代碼來源:ImportIoAction.java

示例14: metamodelBrowse

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
private void metamodelBrowse() {
	final FileDialog fd = new FileDialog(getShell(), SWT.MULTI);

	final IPath workspaceRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation();
	fd.setFilterPath(workspaceRoot.toFile().toString());
	fd.setFilterExtensions(getKnownMetamodelFilePatterns());
	fd.setText("Select metamodels");
	String result = fd.open();

	if (result != null) {

		String[] metaModels = fd.getFileNames();
		File[] metaModelFiles = new File[metaModels.length];

		boolean error = false;

		for (int i = 0; i < metaModels.length; i++) {
			File file = new File(fd.getFilterPath() + File.separator
					+ metaModels[i]);
			if (!file.exists() || !file.canRead() || !file.isFile())
				error = true;
			else
				metaModelFiles[i] = file;

		}

		if (!error) {
			hawkModel.registerMeta(metaModelFiles);
			updateMetamodelList();
		}
	}

}
 
開發者ID:mondo-project,項目名稱:mondo-hawk,代碼行數:34,代碼來源:HConfigDialog.java

示例15: openProfileDialog

import org.eclipse.swt.widgets.FileDialog; //導入方法依賴的package包/類
/**
 * 프로파일 적용하는 다이얼로그 열기
 * 
 * void
 */
protected void openProfileDialog() {
    profileDialog = new FileDialog(getShell(), SWT.MULTI);
    profileDialog.setFilterPath(lastProfilePath);
    profileDialog.setFilterExtensions(UICoreConstant.PROJECT_CONSTANTS__UML_PROFILE_FILE_EXTENSIONS);

    Resource profileResource = null;
    // Profile newProfile = null;
    // RecordingCommand command = null;

    if (profileDialog.open() != null) {
        String[] filenames = profileDialog.getFileNames();
        String filePath = profileDialog.getFilterPath();
        StringBuffer uri = new StringBuffer();

        for (int i = 0; i < filenames.length; i++) {
            if (applyingProfileList != null) {
                for (Profile profile : applyingProfileList) {
                    if (!filenames[i].equals(profile.getName())) {
                        if (uri.length() > 0) {
                            uri.delete(0, uri.length());
                        }
                        uri.append(filePath).append(UICoreConstant.PROJECT_CONSTANTS__SLASH).append(filenames[i]);

                        profileResource = DomainRegistry.getUMLDomain()
                            .getResourceSet()
                            .getResource(URI.createFileURI(uri.toString()), true);
                        newProfile = (org.eclipse.uml2.uml.Profile) EcoreUtil.getObjectByType(profileResource.getContents(),
                            UMLPackage.Literals.PROFILE);

                        applyingProfileList.add(newProfile);

                        // command = new
                        // HandleProfileCommand(DomainRegistry.getEditingDomain(),
                        // model, newProfile, true);
                        // DomainUtil.executeCommand(command);
                    }
                }
            } else {
                if (uri.length() > 0) {
                    uri.delete(0, uri.length());
                }
                uri.append(filePath).append(UICoreConstant.PROJECT_CONSTANTS__SLASH).append(filenames[i]);

                profileResource = DomainRegistry.getUMLDomain()
                    .getResourceSet()
                    .getResource(URI.createFileURI(uri.toString()), true);
                newProfile = (org.eclipse.uml2.uml.Profile) EcoreUtil.getObjectByType(profileResource.getContents(),
                    UMLPackage.Literals.PROFILE);

                applyingProfileList.add(newProfile);

                // command = new
                // HandleProfileCommand(DomainRegistry.getEditingDomain(),
                // model, newProfile, true);
                // DomainUtil.executeCommand(command);
            }
        }

        profileTableViewer.setInput(applyingProfileList.toArray());
        profileTableViewer.refresh();
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:68,代碼來源:ApplyProfileWizardPage.java


注:本文中的org.eclipse.swt.widgets.FileDialog.getFilterPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。