當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。