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


Java IDialogConstants.OK_ID属性代码示例

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


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

示例1: chooseWorkspace

protected void chooseWorkspace ()
{
    final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
    dialog.setTitle ( "Select driver exporter configuration file" );
    dialog.setMessage ( "Choose a driver exporter file for the configuration" );
    dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
    dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
    dialog.setAllowMultiple ( true );
    dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
    if ( dialog.open () == IDialogConstants.OK_ID )
    {
        final IResource resource = (IResource)dialog.getFirstResult ();
        if ( resource != null )
        {
            final String arg = resource.getFullPath ().toString ();
            final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
            this.fileText.setText ( fileLoc );
            makeDirty ();
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:HiveTab.java

示例2: browseSchemaSelectionDialog

/**
 * 
 * Open selection dialog for schema files, File selection restricted to ".schema" extension. 
 * @param filterExtension
 * @param fileName
 */
private void browseSchemaSelectionDialog(String filterExtension, Text fileName) {
	String externalSchemaTextBoxValue = "";
	ExternalSchemaFileSelectionDialog dialog = new ExternalSchemaFileSelectionDialog("Project",
			"Select Schema File (.schema or.xml)",  new String[]{filterExtension,Extensions.XML.toString()}, this);
	if (dialog.open() == IDialogConstants.OK_ID) {
		String file = fileNameTextBoxValue;
		IResource resource = (IResource) dialog.getFirstResult();
		String path[] = resource.getFullPath().toString().split("/");
		if (file.isEmpty()) {
			for (int i = 1; i < path.length; i++) {
				externalSchemaTextBoxValue = externalSchemaTextBoxValue + path[i] + "/";
			}
		} else {
			for (int i = 1; i < path.length; i++) {
				if (!path[i].endsWith(".schema") && !path[i].endsWith(".xml")) {
					externalSchemaTextBoxValue = externalSchemaTextBoxValue + path[i] + "/";
				}
			}
			externalSchemaTextBoxValue = externalSchemaTextBoxValue + file;
		}
		fileName.setText(externalSchemaTextBoxValue);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:29,代码来源:FilterOperationClassUtility.java

示例3: browseXMLSelectionDialog

/**
 * @param filterExtension
 * @param fileName
 * Open the dialog to browse .xml file for expression, operation or outputfields
 */
private void browseXMLSelectionDialog(String filterExtension, Text fileName) {
	String externalSchemaTextBoxValue = "";
	ExternalSchemaFileSelectionDialog dialog = new ExternalSchemaFileSelectionDialog("Project",
			"Select Input File (.xml)",  new String[]{filterExtension,Extensions.XML.toString()}, this);
	if (dialog.open() == IDialogConstants.OK_ID) {
		String file = fileNameTextBoxValue;
		IResource resource = (IResource) dialog.getFirstResult();
		String path[] = resource.getFullPath().toString().split("/");
		if (file.isEmpty()) {
			for (int i = 1; i < path.length; i++) {
				externalSchemaTextBoxValue = externalSchemaTextBoxValue + path[i] + "/";
			}
		} else {
			for (int i = 1; i < path.length; i++) {
				if (!path[i].endsWith(".xml")) {
					externalSchemaTextBoxValue = externalSchemaTextBoxValue + path[i] + "/";
				}
			}
			externalSchemaTextBoxValue = externalSchemaTextBoxValue + file;
		}
		fileName.setText(externalSchemaTextBoxValue);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:28,代码来源:FilterOperationClassUtility.java

示例4: buttonPressed

protected void buttonPressed(int buttonId) {
	if (IDialogConstants.OK_ID == buttonId) {
		okPressed();
	} else if (IDialogConstants.CANCEL_ID == buttonId) {
		cancelPressed();
	} else if (UPDATE_ID == buttonId) {

		Display.getDefault().asyncExec(new Runnable() {

			@Override
			public void run() {
				try {
					propEditor.updatePropertyBrowser();
					treeViewer.setInput(XmlReader.loadXmlReader(path));
				} catch (Exception e) {
					e.printStackTrace();
					// TODO: handle exception
				} finally {
					treeViewer.refresh();
				}
			}
		});
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:24,代码来源:PropertyBrowser.java

示例5: addPackage

private void addPackage(TreeViewer treeViewer) {
	IJavaProject jProject = ProjectHelper.getCurrentJavaProject();
	if (jProject == null) {
		alertAndClose();
		return;
	}
	PackageSelectionDialog dialog = createPackageSelectionDialog(jProject);
	if (dialog.open() == IDialogConstants.OK_ID) {
		String packageName = getPackageName(dialog);
		if (nodeListManager.addNodesFromPackage(jProject, packageName,
				getFile(jProject, packageName).list())) {
			setTreeViewer(treeViewer);
			setPageComplete(false);
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:16,代码来源:SelectClassPage.java

示例6: createRememberDecisonDialog

public static MessageDialogWithToggle createRememberDecisonDialog(String title, String text, String toggletext,
		Runnable okRunnable) {
	final String[] buttons = new String[] { IDialogConstants.CLOSE_LABEL, IDialogConstants.OK_LABEL, };

	return new MessageDialogWithToggle(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title,
			null, text, MessageDialog.QUESTION, buttons, 0, toggletext, false) {
		protected void buttonPressed(int buttonId) {
			if (okRunnable != null && IDialogConstants.OK_ID == buttonId) {
				okRunnable.run();
				return;
			}
			super.buttonPressed(buttonId);
		}
	};
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:15,代码来源:DialogManager.java

示例7: buttonPressed

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        value = valueFromSelection(viewer.getSelection());
        liftValueAndSave();
    } else {
        value = null;
    }
    super.buttonPressed(buttonId);
}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:9,代码来源:FolderSelectionDialog.java

示例8: buttonPressed

protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
    	name = nameText.getText().trim();
        value = valueText.getText().trim();
        parent = getParentTxt();
    } else {
    	name = null;
        value = null;
        parent = null;
    }
    super.buttonPressed(buttonId);
}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:12,代码来源:NewPreferenceDialog.java

示例9: browseJavaSelectionDialog

/**
	 * Open selection dialog for Java files, File selection restricted to ".java" extension.
	 * @param filterExtension
	 * @param fileName
	 */
	public static void browseJavaSelectionDialog(String filterExtension, Text fileName) {
		ResourceFileSelectionDialog dialog = new ResourceFileSelectionDialog(
				"Project", "Select Java Class (.java)", new String[] { filterExtension });
		if (dialog.open() == IDialogConstants.OK_ID) {
			IResource resource = (IResource) dialog.getFirstResult();
			String filePath = resource.getRawLocation().toOSString();
			java.nio.file.Path path =Paths.get(filePath); 
			String classFile=path.getFileName().toString();
			String name = "";
			try(BufferedReader reader= new BufferedReader(new FileReader(filePath))){ 
				String firstLine= reader.readLine();
				if(firstLine.contains(Constants.PACKAGE)){
					name= firstLine.replaceFirst(Constants.PACKAGE, "").replace(";", "");
					if(!name.equalsIgnoreCase("")){
						name=name+"."+classFile.substring(0, classFile.lastIndexOf('.'));
					}
					
				}else{
					name=classFile.substring(0, classFile.lastIndexOf('.'));
				}
				
			} catch (IOException e) { 
				logger.error("Unable to read file " + filePath,e );
			}
			fileName.setText(name.trim());
			filePath = resource.getRawLocation().toOSString();
			fileName.setData("path", resource.getFullPath().toString());
}
	}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:34,代码来源:FilterOperationClassUtility.java

示例10: browseJobSelectionDialog

/**
 * Open selection dialog for job files, File selection restricted to ".job" extension.
 * @param filterExtension
 * @param fileName
 */
private void browseJobSelectionDialog(String filterExtension, Text fileName) {
	ResourceFileSelectionDialog dialog = new ResourceFileSelectionDialog(
			"Project", "Select Sub Job (.job)", new String[] { filterExtension });
	if (dialog.open() == IDialogConstants.OK_ID) {
		IResource resource = (IResource) dialog.getFirstResult();
		String filePath = resource.getFullPath().toString();
		if(isFileExistsOnLocalFileSystem(new Path(filePath), fileName)){
			fileName.setText(filePath.substring(1));
		}
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:16,代码来源:FilterOperationClassUtility.java

示例11: jobIsSaved

private boolean jobIsSaved(){
	ELTGraphicalEditor editor = SubJobUtility.getCurrentEditor();
	if(editor.isDirty())
	{
		if(!StringUtils.equals(Activator.getDefault().getPreferenceStore().getString(JobRunPreference.SAVE_JOB_BEFORE_RUN_PREFRENCE), MessageDialogWithToggle.ALWAYS)){
		SaveJobFileBeforeRunDialog messageBox = new SaveJobFileBeforeRunDialog(Display.getCurrent().getActiveShell(),"'"+editor.getEditorInput().getName()+"' "+Messages.CONFIRM_TO_SAVE_JOB_BEFORE_RUN );
	    int rc = messageBox.open();
	    if(rc!=IDialogConstants.OK_ID){
	    	return false;
	    	}
	    }
	PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().doSave(null);	    
	}
	return true;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:15,代码来源:JobHandler.java

示例12: getParameterFileDialog

/**
 * Gets the parameter file dialog.
 *
 * @return the parameter file dialog
 */
private MultiParameterFileDialog getParameterFileDialog(){
    String activeProjectLocation=MultiParameterFileUIUtils.getActiveProjectLocation();
	List<ParameterFile> filepathList = new LinkedList<>();
	
	updateParameterFileListWithJobSpecificFile(filepathList,activeProjectLocation);
	
	File jobSpecificParamFile = new File(getComponentCanvas().getParameterFile());
	if(!jobSpecificParamFile.exists()){
		try {
			jobSpecificParamFile.createNewFile();
		} catch (IOException e) {
			logger.debug("Unable to create job specific file ", e);
			MessageBox.INSTANCE.showMessage(MessageBox.ERROR, Messages.UNABLE_TO_CREATE_JOB_SPECIFIC_FILE);
		}
	}
	
			
	
	filepathList.addAll(getComponentCanvas().getJobLevelParamterFiles());
	MultiParameterFileDialog parameterFileDialog = new MultiParameterFileDialog(Display.getDefault().getActiveShell(), activeProjectLocation);
	parameterFileDialog.setParameterFiles(filepathList);
	parameterFileDialog.setJobLevelParamterFiles(getComponentCanvas().getJobLevelParamterFiles());
	parameterFileDialog.open();
	if(SubJobUtility.getCurrentEditor().isDirty())
	{
	   if(!StringUtils.equals(Activator.getDefault().getPreferenceStore()
			.getString(JobRunPreference.SAVE_JOB_BEFORE_RUN_PREFRENCE), MessageDialogWithToggle.ALWAYS)){
		   	SaveJobFileBeforeRunDialog messageBox = new SaveJobFileBeforeRunDialog
		    (Display.getCurrent().getActiveShell(),"'"+SubJobUtility.getCurrentEditor().getEditorInput().getName()+"' "+Messages.DO_YOU_WANT_TO_SAVE_CHANGES );
		   	if(messageBox.open()==IDialogConstants.OK_ID){
		   		SubJobUtility.getCurrentEditor().doSave(null);
		   		SubJobUtility.getCurrentEditor().setDirty(false);
	    	}
	   }
	   else{
		   SubJobUtility.getCurrentEditor().doSave(null);
		   SubJobUtility.getCurrentEditor().setDirty(false);
	   }	
	}
	
	return parameterFileDialog;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:47,代码来源:JobManager.java


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