当前位置: 首页>>代码示例>>Java>>正文


Java SWT.OPEN属性代码示例

本文整理汇总了Java中org.eclipse.swt.SWT.OPEN属性的典型用法代码示例。如果您正苦于以下问题:Java SWT.OPEN属性的具体用法?Java SWT.OPEN怎么用?Java SWT.OPEN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.OPEN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: importText

protected void importText() {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Open");
		String[] filterExt = { "*.txt;*.TXT" };
		String[] filterNames = { "TXT files" };
		fd.setFilterExtensions(filterExt);
		fd.setFilterNames(filterNames);
		String lastPath = Config.getInstance().getString(Config.LAST_OPEN_TEXT_PATH);
		if (lastPath != null && !lastPath.isEmpty())
			fd.setFileName(lastPath);
		String selected = fd.open();
		if (selected != null) {
			importTextFile(new File(selected));
			Config.getInstance().putValue(Config.LAST_OPEN_TEXT_PATH, selected);
			try {
				Config.getInstance().save();
			} catch (IOException e) {
				// The user do not NEED to know about this...
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:23,代码来源:PmTrans.java

示例2: openTranscription

public void openTranscription() {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Select the transcription file");
		String[] filterExt = { "*.xpmt;*.XPMT" };
		String[] filterNames = { "pmTrans transcription files" };
		fd.setFilterExtensions(filterExt);
		fd.setFilterNames(filterNames);
		String lastPath = Config.getInstance().getString(Config.LAST_OPEN_TEXT_PATH);
		if (lastPath != null && !lastPath.isEmpty())
			fd.setFileName(lastPath);
		String selected = fd.open();
		if (selected != null) {
			openTranscriptionFile(new File(selected));
			Config.getInstance().putValue(Config.LAST_OPEN_TEXT_PATH, selected);
			try {
				Config.getInstance().save();
			} catch (IOException e) {
				// The user do not NEED to know about this...
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:23,代码来源:PmTrans.java

示例3: importTextFile

protected void importTextFile(File f) {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Import text");
		fd.setFilterExtensions(new String[] { "*.txt;*.TXT" });
		fd.setFilterNames(new String[] { "Plain text files (*.txt)" });
		String selected = fd.open();
		if (selected != null) {
			try {
				textEditor.importText(new File(selected));
			} catch (IOException e) {
				e.printStackTrace();
				MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
				diag.setMessage("Unable to open file " + transcriptionFile.getPath());
				diag.open();
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:19,代码来源:PmTrans.java

示例4: selectFile

protected void selectFile ()
{
    final FileDialog dlg = new FileDialog ( getShell (), SWT.OPEN );
    dlg.setFilterExtensions ( new String[] { "*.oscar", "*.json", "*.*" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    dlg.setFilterNames ( new String[] { Messages.LocalDataPage_OSCARFilterDescription, Messages.LocalDataPage_JSONFilterDescription, Messages.LocalDataPage_AllFilterDescription } );

    if ( this.fileName.getText ().length () > 0 )
    {
        dlg.setFileName ( this.fileName.getText () );
    }
    dlg.setFilterIndex ( 0 );

    final String file = dlg.open ();
    if ( file != null )
    {
        this.fileName.setText ( file );
        loadFile ();
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:LocalDataPage.java

示例5: handleLoadLocal

protected void handleLoadLocal ()
{
    final FileDialog dlg = new FileDialog ( getShell (), SWT.OPEN );
    dlg.setFilterExtensions ( new String[] { "*.oscar", "*.json", "*.*" } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    dlg.setFilterNames ( new String[] { Messages.LocalDataPage_OSCARFilterDescription, Messages.LocalDataPage_JSONFilterDescription, Messages.LocalDataPage_AllFilterDescription } );

    final String selectedFileName = getWizard ().getDialogSettings ().get ( "localDataPage.file" ); //$NON-NLS-1$

    if ( selectedFileName != null && selectedFileName.length () > 0 )
    {
        dlg.setFileName ( selectedFileName );
    }
    dlg.setFilterIndex ( 0 );

    final String file = dlg.open ();
    if ( file != null )
    {
        getWizard ().getDialogSettings ().put ( "localDataPage.file", file ); //$NON-NLS-1$
        loadFromLocalFile ( file );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:RemoteDataPage.java

示例6: handleAdd

protected void handleAdd ()
{
    final FileDialog dlg = new FileDialog ( getShell (), SWT.OPEN );
    final String result = dlg.open ();
    if ( result != null )
    {
        try
        {
            this.factory.addFile ( result );
        }
        catch ( final Exception e )
        {
            ErrorDialog.openError ( getShell (), "Error", "Failed to add file", StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:PreferencePage.java

示例7: openFileDirectly

/**
 * Open the file dialog for the direct opening of a file. If a file is returned,
 * expand the directory tree accordingly.
 */
public void openFileDirectly() {
	FileDialog fileDialog = new FileDialog(this.shell, SWT.OPEN);
	String[] extensions = {"*.class", "*.jar", "*.war", "*.ear"};
	String[] names = {"Class file (*.class)", "Jar archive (*.jar)", "War archive (*.war)", "Ear archive (*.ear)"};
	fileDialog.setFilterExtensions(extensions);
	fileDialog.setFilterNames(names);
	String path = fileDialog.open();
	if (path != null) {
		// First of all replace double backslashes against slashes.
		path = path.replace("\\\\", "\\");

		// different handling of class and jar files
		if (JarFileEntry.isArchive(path) || (path.length() > 6 && path.substring(path.length() - 6).equals(".class")))
		{
			// Browse through the directory tree.
			browseTroughTheDirectoryTree(path, null);
		} else {
			StaticGuiSupport.showMessageBox(FileSelectionComposite.this.shell, "Information", "This file cannot be processed.", SWT.OK | SWT.ICON_WARNING);
		}
	}
}
 
开发者ID:wwu-pi,项目名称:tap17-muggl-javaee,代码行数:25,代码来源:FileSelectionComposite.java

示例8: importSchema

private void importSchema(Button importButton) {
	GenericImportExportFileDialog importFileDialog = new GenericImportExportFileDialog(
			importButton.getShell(), SWT.OPEN);
	importFileDialog.setFileName(StringUtils.EMPTY);
	importFileDialog.setTitle(Messages.IMPORT_SCHEMA_DIALOG_TITLE);
	importFileDialog.setFilterNames(new String[] { IMPORT_SCHEMA_FILE_EXTENSION_NAME });
	importFileDialog.setFilterExtensions(new String[] { IMPORT_SCHEMA_FILE_EXTENSION_FILTER });

	String filePath = importFileDialog.open();
	if (StringUtils.isNotBlank(filePath)) {
		
		 File schemaFile = new File(filePath);
		 if (schemaFile == null || !schemaFile.exists()){
			 return;
		 }
		 loadSchemaIntoTable(schemaFile);
		 setSchemaUpdated(true);
		 propertyDialogButtonBar.enableApplyButton(true);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:20,代码来源:ELTSchemaGridWidget.java

示例9: selectAsciispec

private void selectAsciispec(Event e) {
	switch (e.type) {
	case SWT.Selection:
		DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell(), SWT.OPEN | SWT.MULTI);
		dialog.setText("Select the Asciispec binary directory");
		String result = dialog.open();
		if (result != null && !result.isEmpty()) {
			txtAsciispecBinaryDir.setText(result);
			saveAsciispecBinDir(result);
		}
		break;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:13,代码来源:SpecConfigOutputPage.java

示例10: selectDocRoot

private void selectDocRoot(Event e) {
	switch (e.type) {
	case SWT.Selection:
		DirectoryDialog dialog = new DirectoryDialog(Display.getCurrent().getActiveShell(), SWT.OPEN | SWT.MULTI);
		dialog.setText("Select the documentation root directory");
		String result = dialog.open();
		if (result != null && !result.isEmpty()) {
			txtDocRootDirName.setText(result);
			saveProperty(result);
			checkPageComplete();
		}
		break;
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:SpecConfigAdocPage.java

示例11: selecinarDiretorio

private String selecinarDiretorio() {
    FileDialog fd = new FileDialog(s, SWT.OPEN);
    fd.setText("Abrir");
    fd.setFilterPath("C:/");
    String[] filterExt = {"*.*", "*.png", "*.bmp", "*.jpg"};
    fd.setFilterExtensions(filterExt);
    String selected = fd.open();
    if (selected != null) {
        return selected;
    }
    return "";
}
 
开发者ID:nbfontana,项目名称:pdi,代码行数:12,代码来源:Interface.java

示例12: getFile

/**
   * Helper to open the file chooser dialog.
   * @param startingDirectory the directory to open the dialog on.
   * @return File The File the user selected or <code>null</code> if they
   * do not.
   */
  private File getFile(File startingDirectory) {

      FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
      dialog.setText("Select a project file");
      dialog.setFilterExtensions(filterExtensions);
      dialog.setFilterNames(filterNames);
      
      if (!getTextControl().getText().equals("")) {
      	dialog.setFilterPath(getTextControl().getText());
      } else {
      	dialog.setFilterPath(Engine.PROJECTS_PATH);
      }

      if (startingDirectory != null) {
	dialog.setFileName(startingDirectory.getPath());
}

      String file = dialog.open();
      if (file != null) {
          file = file.trim();
          if (file.length() > 0) {
		return new File(file);
	}
      }

      return null;
  }
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:33,代码来源:ProjectFileFieldEditor.java

示例13: getFile

/**
   * Helper to open the file chooser dialog.
   * @param startingDirectory the directory to open the dialog on.
   * @return File The File the user selected or <code>null</code> if they
   * do not.
   */
  private File getFile(File startingDirectory) {

      FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
      dialog.setText("Select a project file");
      dialog.setFilterExtensions(getFilterExtensions());
      dialog.setFilterNames(getFilterNames());
      
      if (!getTextControl().getText().equals("")) {
      	dialog.setFilterPath(getTextControl().getText());
      } else {
      	dialog.setFilterPath(getFilterPath());
      }

      if (startingDirectory != null) {
	dialog.setFileName(startingDirectory.getPath());
}

      String file = dialog.open();
      if (file != null) {
          file = file.trim();
          if (file.length() > 0) {
		return new File(file);
	}
      }

      return null;
  }
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:33,代码来源:FileFieldEditor.java

示例14: openFile

/**
 * Open a file.
 */
protected void openFile() {
	FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
	FilenameFilter[] fileFilters = Disk.getFilenameFilters();
	String[] names = new String[fileFilters.length];
	String[] extensions = new String[fileFilters.length];
	for (int i=0; i<fileFilters.length; i++) {
		names[i] = fileFilters[i].getNames();
		extensions[i] = fileFilters[i].getExtensions();
	}
	fileDialog.setFilterNames(names);
	fileDialog.setFilterExtensions(extensions);
	fileDialog.setFilterPath(userPreferences.getDiskImageDirectory());
	String fullpath = fileDialog.open();
	
	if (fullpath != null) {
		userPreferences.setDiskImageDirectory(fileDialog.getFilterPath());
		try {
			Disk disk = new Disk(fullpath);
			FormattedDisk[] formattedDisks = disk.getFormattedDisks();
			if (formattedDisks != null) {
				DiskWindow window = new DiskWindow(shell, formattedDisks, imageManager);
				window.open();
			} else {
				showUnrecognizedDiskFormatMessage(fullpath);
			}
		} catch (Exception ignored) {
			ignored.printStackTrace();
			showUnrecognizedDiskFormatMessage(fullpath);
		}
	}
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:34,代码来源:SwtAppleCommander.java

示例15: initializeFileDialog

private FileDialog initializeFileDialog(Shell shell) {
	String[] filterExt = { "*.properties" };
	FileDialog fileDialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
	fileDialog.setText(MultiParameterFileDialogConstants.OPEN_FILE_DIALOG_NAME);				
	fileDialog.setFilterExtensions(filterExt);
	return fileDialog;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:7,代码来源:MultiParameterFileDialog.java


注:本文中的org.eclipse.swt.SWT.OPEN属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。