Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2009 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: IBM Corporation - initial API and implementation /
 
 
 package org.eclipse.ant.internal.ui.launchConfigurations;
 
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.layout.GridData;
 import  org.eclipse.swt.widgets.Composite;
 
 public class AntJRETab extends JavaJRETab {
 
 	private static final String MAIN_TYPE_NAME"org.eclipse.ant.internal.ui.antsupport.InternalAntRunner"//$NON-NLS-1$
 	
 
 	/* (non-Javadoc)
 	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
 	 */
 	public void createControl(Composite parent) {
 		super.createControl(parent);
 		Composite comp= (Composite).getControl();
 		((GridData)comp.getLayoutData()).grabExcessVerticalSpacetrue;
 		((GridData)comp.getLayoutData()).verticalAlignment= SWT.FILL;
 		
 		((GridData).getControl().getLayoutData()).horizontalSpan= 2;
 						
 		((GridData).getControl().getLayoutData()).horizontalSpan= 2;
 	}
 
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab#getDefaultJREDescriptor()
 	 */
 		return new JREDescriptor() {
 			/* (non-Javadoc)
 			 * @see org.eclipse.jdt.internal.debug.ui.jres.JREDescriptor#getDescription()
 			 */
 			public String getDescription() {
 			}
 		};
 	}
 	
 	/* (non-Javadoc)
 	 * @see org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab#getSpecificJREDescriptor()
 	 */
 		return new JREDescriptor() {
 			/* (non-Javadoc)
 			 * @see org.eclipse.jdt.internal.debug.ui.jres.JREDescriptor#getDescription()
 			 */
 			public String getDescription() {
 			}
 		};
 	}
 		
 	/* (non-Javadoc)
 	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
 	 */
 	public void performApply(ILaunchConfigurationWorkingCopy configuration) {
 		boolean isDefaultJRE = .isDefaultJRE();
         .setEnabled(!isDefaultJRE);
 		.setEnabled(!isDefaultJRE);
 		if (isDefaultJRE) {
else {
			super.performApply(configuration);
			if (useDefaultSeparateJRE(configuration)) {
else {
			}
		}
	}
	private boolean useDefaultSeparateJRE(ILaunchConfigurationWorkingCopy configuration) {
		boolean defltfalse;
		String vmInstallTypenull;
        String jreContainerPathnull;
		try {
            jreContainerPathconfiguration.getAttribute(., (String)null);
catch (CoreException e) {
		}
		if (vmInstallType != null) {
		}
        if (jreContainerPath != null) {
        }
		IVMInstall defaultVMInstallgetDefaultVMInstall(configuration);
		if (defaultVMInstall != null) {
			defltdefaultVMInstall.equals(vm);
		}
		if (vmInstallType != null) {
		}
        if (jreContainerPath != null) {
            configuration.setAttribute(.jreContainerPath);
        }
		return deflt;
	}
		//only set to use the remote ant process factory if the user
		//has not set to use a logger...bug 84608
        boolean userLoggerfalse;
        try {
    		String args = configuration.getAttribute(., (Stringnull);
    		if (args != null) {
    			Pattern pattern = Pattern.compile("\\$\\{.*_prompt.*\\}"); //$NON-NLS-1$
    			IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
    			String[] arguments = ExternalToolsUtil.parseStringIntoList(args);
    			if (arguments != null) {
                    for (int i = 0; i < arguments.lengthi++) {
                        String arg = arguments[i];
                        if (arg.equals("-logger")) { //$NON-NLS-1$
                            userLoggertrue;
                            break;
                        } else if (!pattern.matcher(arg).find()) {
    						String resolved = manager.performStringSubstitution(argfalse);
    						if (resolved.equals("-logger")) { //$NON-NLS-1$
                                userLoggertrue;
                                break;
                            }
    					}
                    }
                }
    		}
        } catch (CoreException e) {
        }
        if (userLogger) {
            configuration.setAttribute(., (Stringnull);
        } else {
        }
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
	 */
	public void initializeFrom(ILaunchConfiguration configuration) {
		try {
			 boolean isDefaultVMInstallconfiguration.getAttribute(.false);
			 if (isDefaultVMInstall) {
			 	if (configuration instanceof ILaunchConfigurationWorkingCopy) {
			 		copy= (ILaunchConfigurationWorkingCopyconfiguration;
			 	} else {
			 		copyconfiguration.getWorkingCopy();
			 	}
			 	
			 	//null out the vm type and jre container path to get the default vm install from JavaRuntime
			 	IVMInstall defaultVMInstallgetDefaultVMInstall(copy);
			 	if (defaultVMInstall != null) {
			 		//update if required
			 		setDefaultVMInstallAttributes(defaultVMInstallcopy);
			 	}
				if (copy.isDirty() && !copy.isReadOnly()) {
					configurationcopy.doSave();
				}
			 }
        } catch (CoreException ce) {
        	AntUIPlugin.log(ce);
        }
		super.initializeFrom(configuration);
		boolean separateVM= !.isDefaultJRE();
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
	 */
	public boolean isValid(ILaunchConfiguration config) {
		return super.isValid(config) && .isValid(config);
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setLaunchConfigurationDialog(org.eclipse.debug.ui.ILaunchConfigurationDialog)
	 */
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getErrorMessage()
	 */
	public String getErrorMessage() {
		String m = super.getErrorMessage();
		if (m == null) {
		}
		return m;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getMessage()
	 */
	public String getMessage() {
		String m = super.getMessage();
		if (m == null) {
		}
		return m;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
	 */
	public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
	 */
		super.setDefaults(config);
		config.setAttribute(."org.eclipse.ant.ui.AntClasspathProvider"); //$NON-NLS-1$
		IVMInstall defaultVMInstallgetDefaultVMInstall(config);
		if (defaultVMInstall != null) {
			setDefaultVMInstallAttributes(defaultVMInstallconfig);
		}
	}
		IVMInstall defaultVMInstall;
		try {
			defaultVMInstall = JavaRuntime.computeVMInstall(config);
catch (CoreException e) {
			//core exception thrown for non-Java project
			defaultVMInstall= JavaRuntime.getDefaultVMInstall();
		}
		return defaultVMInstall;
	}
	private void setDefaultVMInstallAttributes(IVMInstall defaultVMInstallILaunchConfigurationWorkingCopy config) {
		String vmName = defaultVMInstall.getName();
		String vmTypeID = defaultVMInstall.getVMInstallType().getId();
	}
	/* (non-Javadoc)
	 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
	 */
	public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
	}
New to GrepCode? Check out our FAQ X