List of usage examples for org.eclipse.jdt.core IJavaProject getOption
String getOption(String optionName, boolean inheritJavaCoreOptions);
From source file:mpj_express_debugger.JavaJRETab.java
License:Open Source License
/** * Checks to make sure the class file compliance level and the selected VM are * compatible i.e. such that the selected JRE can run the currently compiled * code//from w w w.j a v a 2 s .c om * * @since 3.3 */ private IStatus checkCompliance() { IJavaProject javaProject = getJavaProject(); if (javaProject == null) { return Status.OK_STATUS; } String source = LauncherMessages.JavaJRETab_3; String compliance = javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, false); if (compliance == null) { compliance = javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true); source = LauncherMessages.JavaJRETab_4; } IPath vmPath = fJREBlock.getPath(); IVMInstall vm = null; if (JavaRuntime.newDefaultJREContainerPath().equals(vmPath)) { if (javaProject.isOpen()) { try { vm = JavaRuntime.getVMInstall(getJavaProject()); } catch (CoreException e) { JDIDebugUIPlugin.log(e); return Status.OK_STATUS; } if (vm == null) { vm = JavaRuntime.getVMInstall(vmPath); } } } else { vm = JavaRuntime.getVMInstall(vmPath); } String environmentId = JavaRuntime.getExecutionEnvironmentId(vmPath); if (vm instanceof AbstractVMInstall) { AbstractVMInstall install = (AbstractVMInstall) vm; String vmver = install.getJavaVersion(); if (vmver != null) { int val = compliance.compareTo(vmver); if (val > 0) { String setting = null; if (environmentId == null) { setting = LauncherMessages.JavaJRETab_2; } else { setting = LauncherMessages.JavaJRETab_1; } return new Status(IStatus.ERROR, IJavaDebugUIConstants.PLUGIN_ID, IStatus.ERROR, MessageFormat .format(LauncherMessages.JavaJRETab_0, new String[] { setting, source, compliance }), null); } } } return Status.OK_STATUS; }
From source file:org.antlr.eclipse.ui.editor.AntlrConfiguration.java
License:Open Source License
/** {@inheritDoc} */ @Override// w w w. ja v a 2 s. c om public String[] getIndentPrefixes(final ISourceViewer sourceViewer, final String contentType) { ArrayList<String> prefixes = new ArrayList<String>(); int tabWidth = 0; boolean useSpaces; IJavaProject project = getProject(); String tabSize; if (project != null) { tabSize = project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE, true); useSpaces = JavaCore.SPACE .equals(project.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, true)); } else { tabSize = JavaCore.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE); useSpaces = JavaCore.SPACE.equals(JavaCore.getOption(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR)); } try { tabWidth = Integer.parseInt(tabSize); } catch (NumberFormatException e) { tabWidth = 4; } // prefix[0] is either '\t' or ' ' x tabWidth, depending on useSpaces for (int i = 0; i <= tabWidth; i++) { StringBuffer prefix = new StringBuffer(); if (useSpaces) { for (int j = 0; j + i < tabWidth; j++) prefix.append(' '); if (i != 0) prefix.append('\t'); } else { for (int j = 0; j < i; j++) prefix.append(' '); if (i != tabWidth) prefix.append('\t'); } prefixes.add(prefix.toString()); } prefixes.add(""); //$NON-NLS-1$ return prefixes.toArray(new String[prefixes.size()]); }
From source file:org.codecover.eclipse.builder.CodeCoverCompilationParticipant.java
License:Open Source License
/** * This method is called for each project separately. *///w ww . jav a 2 s . co m @Override public void buildStarting(BuildContext[] files, boolean isBatch) { if (files.length == 0) { return; } final IProject iProject = files[0].getFile().getProject(); final IPath projectFullPath = iProject.getFullPath(); final IPath projectLocation = iProject.getLocation(); final String projectFolderLocation = iProject.getLocation().toOSString(); final Queue<SourceTargetContainer> sourceTargetContainers = new LinkedList<SourceTargetContainer>(); final String instrumentedFolderLocation = CodeCoverPlugin.getDefault() .getPathToInstrumentedSources(iProject).toOSString(); // try to get all source folders final Queue<String> possibleSourceFolders = new LinkedList<String>(); try { final IJavaProject javaProject = JavaCore.create(iProject); for (IPackageFragmentRoot thisRoot : javaProject.getAllPackageFragmentRoots()) { IResource resource = thisRoot.getCorrespondingResource(); if (resource != null) { possibleSourceFolders.add(resource.getLocation().toOSString()); } } } catch (JavaModelException e) { eclipseLogger.fatal("JavaModelException in CompilationParticipant", e); //$NON-NLS-1$ return; } InstrumentableItemsManager instrumentableItemsManager = CodeCoverPlugin.getDefault() .getInstrumentableItemsManager(); TSContainerManager tscManager = CodeCoverPlugin.getDefault().getTSContainerManager(); // ////////////////////////////////////////////////////////////////////// // CREATE THE SOURCE TARGET CONTAINERS AND COPY THE UNINSTRUMENTED // FILES TO THE INSTRUMENTEDFOLDERLOCATION // ////////////////////////////////////////////////////////////////////// fillSourceTargetContainers(files, possibleSourceFolders, sourceTargetContainers, instrumentedFolderLocation, eclipseLogger, instrumentableItemsManager); // ////////////////////////////////////////////////////////////////////// // SEARCH IN ALL TSC OF THIS PROJECT IF A TSC CAN BE REUSED // ////////////////////////////////////////////////////////////////////// TestSessionContainer tsc; if (SEARCH_IN_ALL_TSC) { tsc = searchUseableTSC(iProject, files, instrumentableItemsManager, tscManager); } else { tsc = getUseableTSC(files, instrumentableItemsManager, tscManager); } // ////////////////////////////////////////////////////////////////////// // PREPARE INSTRUMENTATION // ////////////////////////////////////////////////////////////////////// InstrumenterDescriptor descriptor = new org.codecover.instrumentation.java15.InstrumenterDescriptor(); if (descriptor == null) { eclipseLogger.fatal("NullPointerException in CompilationParticipant"); //$NON-NLS-1$ } // check whether TSC's criteria match // with the selected criteria of the project if (tsc != null) { Set<Criterion> tscCriteria = tsc.getCriteria(); for (Criterion criterion : tscCriteria) { if (!CodeCoverPlugin.getCriterionSelectedState(iProject, criterion)) { // the TSC uses a criterion which is not selected for the project // therefore it can't be used tsc = null; } } // all selected criteria must be active for the TSC for (Criterion criterion : descriptor.getSupportedCriteria()) { if (CodeCoverPlugin.getCriterionSelectedState(iProject, criterion)) { if (!tscCriteria.contains(criterion)) { // the TSC doesn't use a criterion which is selected // for the project, this means we can't use the TSC tsc = null; } } } } eclipseLogger.debug("can reuse TSC: " + (tsc != null ? tsc : "no")); //$NON-NLS-1$ //$NON-NLS-2$ InstrumenterFactory factory = new DefaultInstrumenterFactory(); factory.setDescriptor(descriptor); // only instrument with the selected criteria for (Criterion criterion : descriptor.getSupportedCriteria()) { if (CodeCoverPlugin.getCriterionSelectedState(iProject, criterion)) { factory.addCriterion(criterion); } } factory.setCharset(DEFAULT_CHARSET_FOR_COMPILING); Instrumenter instrumenter = null; try { instrumenter = factory.getInstrumenter(); } catch (FactoryMisconfigurationException e) { eclipseLogger.fatal("FactoryMisconfigurationException in CompilationParticipant"); //$NON-NLS-1$ } // ////////////////////////////////////////////////////////////////////// // INSTRUMENT // ////////////////////////////////////////////////////////////////////// File rootFolder = new File(projectFolderLocation); File targetFolder = new File(instrumentedFolderLocation); MASTBuilder builder = new MASTBuilder(eclipseLogger); Map<String, Object> instrumenterDirectives = descriptor.getDefaultDirectiveValues(); CodeCoverPlugin plugin = CodeCoverPlugin.getDefault(); eclipseLogger.debug("Plugin: " + plugin); IPath coverageLogPath = CodeCoverPlugin.getDefault().getPathToCoverageLogs(iProject); coverageLogPath = coverageLogPath.append("coverage-log-file.clf"); //$NON-NLS-1$ instrumenterDirectives.put( org.codecover.instrumentation.java15.InstrumenterDescriptor.CoverageLogPathDirective.KEY, coverageLogPath.toOSString()); if (tsc != null) { // we can reuse the TSC instrumenterDirectives.put(org.codecover.instrumentation.UUIDDirective.KEY, tsc.getId()); } TestSessionContainer testSessionContainer; try { testSessionContainer = instrumenter.instrument(rootFolder, targetFolder, sourceTargetContainers, builder, instrumenterDirectives); } catch (InstrumentationIOException e) { eclipseLogger.fatal("InstrumentationIOException in CompilationParticipant", e); //$NON-NLS-1$ return; } catch (InstrumentationException e) { eclipseLogger.fatal("InstrumentationException in CompilationParticipant", e); //$NON-NLS-1$ return; } // ////////////////////////////////////////////////////////////////////// // SAVE TSC // ////////////////////////////////////////////////////////////////////// if (tsc == null) { // we have to create a new TSC try { tscManager.addTestSessionContainer(testSessionContainer, iProject, false, null, null); } catch (FileSaveException e) { eclipseLogger.fatal("FileSaveException in CompilationParticipant", e); //$NON-NLS-1$ } catch (TSCFileCreateException e) { eclipseLogger.fatal("CoreException in CompilationParticipant", e); //$NON-NLS-1$ } catch (FileLoadException e) { eclipseLogger.fatal("CoreException in CompilationParticipant", e); //$NON-NLS-1$ } catch (InvocationTargetException e) { // can't happen because we didn't pass a runnable eclipseLogger.warning("InvocationTargetException in CompilationParticipant", e); //$NON-NLS-1$ } catch (CancelException e) { eclipseLogger.warning("User canceled writing of" + //$NON-NLS-1$ " new test session container in" + //$NON-NLS-1$ " CompilationParticipant"); //$NON-NLS-1$ } } // TODO handle compilation errors IJavaProject javaProject = JavaCore.create(iProject); // set up classpath StringBuilder runCommand = new StringBuilder(1024); IClasspathEntry[] cpEntries; try { cpEntries = javaProject.getResolvedClasspath(true); } catch (JavaModelException e) { eclipseLogger.fatal("JavaModelException in CompilationParticipant", e); //$NON-NLS-1$ return; } for (int i = 0; i < cpEntries.length; i++) { IClasspathEntry thisEntry = cpEntries[i]; if (thisEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { if (runCommand.length() == 0) { // this is the first entry -> create the class path option runCommand.append("-cp "); //$NON-NLS-1$ } else { // this is not the first -> we need a separator runCommand.append(File.pathSeparatorChar); } runCommand.append("\""); //$NON-NLS-1$ IPath itsIPath = thisEntry.getPath(); if (projectFullPath.isPrefixOf(itsIPath)) { itsIPath = itsIPath.removeFirstSegments(1); itsIPath = projectLocation.append(itsIPath); } runCommand.append(itsIPath.toOSString()); runCommand.append("\""); //$NON-NLS-1$ } } // check java version related options String targetVersion = javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true); runCommand.append(" -target "); //$NON-NLS-1$ runCommand.append(targetVersion); String sourceVersion = javaProject.getOption(JavaCore.COMPILER_SOURCE, true); runCommand.append(" -source "); //$NON-NLS-1$ runCommand.append(sourceVersion); // no warnings runCommand.append(" -nowarn"); //$NON-NLS-1$ // use the default charset for the encoding // all files have been instrumented or copied using this charset runCommand.append(" -encoding "); //$NON-NLS-1$ runCommand.append(DEFAULT_CHARSET_FOR_COMPILING.toString()); // the directory to compile // put the path in "", because the commandline tokenizes this path runCommand.append(" \""); //$NON-NLS-1$ runCommand.append(instrumentedFolderLocation); runCommand.append("\""); //$NON-NLS-1$ eclipseLogger.debug("I run this compile command now:\n" + runCommand); //$NON-NLS-1$ StringWriter out = new StringWriter(); StringWriter err = new StringWriter(); boolean result; result = org.eclipse.jdt.internal.compiler.batch.Main.compile(runCommand.toString(), new PrintWriter(out), new PrintWriter(err)); eclipseLogger.debug("ECJ Output: " + out.toString()); //$NON-NLS-1$ eclipseLogger.debug("ECJ Error Output: " + err.toString()); //$NON-NLS-1$ if (!result) { eclipseLogger.fatal("An error occured when trying to compile the instrumented sources."); //$NON-NLS-1$ } super.buildStarting(files, isBatch); }
From source file:org.continuousassurance.swamp.eclipse.dialogs.ConfigDialog.java
License:Apache License
/** * Handles Eclipse project being selected * @param index index of the selected Eclipse project *//* w ww.j a v a 2s.co m*/ private void handleEclipseProjectSelection(int index) { if (index < 0) { prjFilePathText.setText(""); pkgTypeCombo.setItems(""); buildSysCombo.setItems(""); packageRTButton.setSelection(false); packageRTButton.setEnabled(false); } else { pkgTypeCombo.setEnabled(true); buildSysCombo.setEnabled(true); IProject project = eclipseProjects[index]; String lang = getProjectLanguage(project); if (lang.equals(JAVA_LANG)) { IJavaProject jp = JavaCore.create(project); // JavaCore.COMPILER_COMPLIANCE String complianceVersion = jp.getOption(ECLIPSE_JAVA_COMPLIANCE_OPTION, true); if (complianceVersion != null) { if (complianceVersion.equals(JAVA_COMPLIANCE_VERSION_17)) { System.out.println("Java 7 package"); // set package type to Java 7 // This API doesn't really make sense for our purposes //setPackageType(api.getPkgTypeString("Java", "java-7", "", null)); setPkgTypeOptions(JAVA_LANG); setPackageType(JAVA_7_SRC_PKG_TYPE); setBuildSysOptions(JAVA_LANG); } else if (complianceVersion.equals(JAVA_COMPLIANCE_VERSION_18)) { System.out.println("Java 8 package"); // set package type to Java 8 //setPackageType(api.getPkgTypeString("Java", "java-8", "", null)); setPkgTypeOptions(JAVA_LANG); setPackageType(JAVA_8_SRC_PKG_TYPE); setBuildSysOptions(JAVA_LANG); } else { System.out.println("Other version Java package"); setPkgTypeOptions(JAVA_LANG); setBuildSysOptions(JAVA_LANG); } } setPredictedJavaBuildSys(project); } else if (lang.equals(CCPP_LANG)) { packageRTButton.setEnabled(false); setPkgTypeOptions(CCPP_LANG); setPackageType(CCPP_LANG); setBuildSysOptions(CCPP_LANG); setBuildSystem(ECLIPSE_GENERATED_STRING); } else { packageRTButton.setEnabled(true); setPkgTypeOptions(ALL_OPTION); setBuildSysOptions(ALL_OPTION); } prjFilePathText.setText(project.getLocation().toOSString()); } }
From source file:org.deved.antlride.jdt.launch.AntlrAbstractJavaLauncher.java
License:Open Source License
protected void compile(IProgressMonitor monitor, AntlrBuildUnit unit, IJavaProject javaProject, IRuntimeClasspathEntry[] classpath, IPath compilerPath, IPath src, IPath classes) throws CoreException, InterruptedException { ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); ILaunchConfigurationType type = manager.getLaunchConfigurationType(ID_JAVA_APPLICATION); ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(null, "Compiling " + unit.getGrammar().getElementName()); workingCopy.setAttribute(ATTR_PROJECT_NAME, javaProject.getElementName()); workingCopy.setAttribute(ATTR_MAIN_TYPE_NAME, "org.eclipse.jdt.internal.compiler.batch.Main"); workingCopy.setAttribute(ATTR_DEFAULT_CLASSPATH, false); IRuntimeClasspathEntry compilerEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(compilerPath); compilerEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); workingCopy.setAttribute(ATTR_CLASSPATH, Arrays.asList(compilerEntry.getMemento())); StringBuilder compilerArgs = new StringBuilder(); compilerArgs.append("-showversion "); compilerArgs.append("-cp "); for (IRuntimeClasspathEntry rcp : classpath) { compilerArgs.append(safeArg(rcp.getLocation())); compilerArgs.append(File.pathSeparator); }/* w w w . ja v a 2 s . com*/ compilerArgs.setLength(compilerArgs.length() - 1); String sourceLevel = "-" + javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true); compilerArgs.append(" -nowarn "); compilerArgs.append(sourceLevel); compilerArgs.append(" -d "); compilerArgs.append(safeArg(classes.toOSString())); compilerArgs.append(" "); compilerArgs.append(safeArg(src.toOSString())); workingCopy.setAttribute(ATTR_PROGRAM_ARGUMENTS, compilerArgs.toString()); // create and run the launch configuration ILaunchConfiguration config = workingCopy.doSave(); ILaunch launch = config.launch(ILaunchManager.RUN_MODE, monitor); while (!launch.isTerminated()) { Thread.sleep(500L); } // delete the configuration config.delete(); int exitValue = launch.getProcesses()[0].getExitValue(); if (exitValue != 0) { throw new CoreException(new Status(IStatus.ERROR, AntlrJDT.PLUGIN_ID, "Compilation fails")); } }
From source file:org.drools.eclipse.DroolsEclipsePlugin.java
License:Apache License
@SuppressWarnings("unchecked") public DRLInfo generateParsedResource(String content, IResource resource, boolean useCache, boolean compile) throws DroolsParserException { useCache = useCache && useCachePreference; DrlParser parser = new DrlParser(); try {/* w w w . jav a 2s . c o m*/ Reader dslReader = DSLAdapter.getDSLContent(content, resource); ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); ClassLoader newLoader = DroolsBuilder.class.getClassLoader(); String level = null; // resource could be null when opening a read-only remote file if (resource != null && resource.getProject().getNature("org.eclipse.jdt.core.javanature") != null) { IJavaProject project = JavaCore.create(resource.getProject()); newLoader = ProjectClassLoader.getProjectClassLoader(project); level = project.getOption(JavaCore.COMPILER_COMPLIANCE, true); } try { Thread.currentThread().setContextClassLoader(newLoader); PackageBuilderConfiguration builder_configuration = new PackageBuilderConfiguration(); if (level != null) { JavaDialectConfiguration javaConf = (JavaDialectConfiguration) builder_configuration .getDialectConfiguration("java"); javaConf.setJavaLanguageLevel(level); } builder_configuration.getClassLoader().addClassLoader(newLoader); // first parse the source PackageDescr packageDescr = null; List<DroolsError> parserErrors = null; if (useCache && resource != null) { DRLInfo cachedDrlInfo = (DRLInfo) parsedRules.get(resource); if (cachedDrlInfo != null) { packageDescr = cachedDrlInfo.getPackageDescr(); parserErrors = cachedDrlInfo.getParserErrors(); } } if (packageDescr == null) { if (dslReader != null) { packageDescr = parser.parse(true, content, dslReader); } else { packageDescr = parser.parse(true, content); } parserErrors = parser.getErrors(); } PackageBuilder builder = new PackageBuilder(builder_configuration); DRLInfo result = null; // compile parsed rules if necessary if (packageDescr != null && compile && !parser.hasErrors()) { // check whether a .package file exists and add it if (resource != null && resource.getParent() != null) { MyResourceVisitor visitor = new MyResourceVisitor(); resource.getParent().accept(visitor, IResource.DEPTH_ONE, IResource.NONE); IResource packageDef = visitor.getPackageDef(); if (packageDef != null) { PackageDescr desc = parseResource(packageDef, false).getPackageDescr(); if (desc != null) { builder.addPackage(desc); } } } builder.addPackage(packageDescr); // make sure the namespace is set, use default if necessary, as this is used to build the DRLInfo if (StringUtils.isEmpty(packageDescr.getNamespace())) { packageDescr.setNamespace(builder.getPackageBuilderConfiguration().getDefaultPackageName()); } result = new DRLInfo(resource == null ? "" : resource.getProjectRelativePath().toString(), packageDescr, parserErrors, builder.getPackageRegistry(packageDescr.getNamespace()).getPackage(), builder.getErrors().getErrors(), builder.getPackageRegistry(packageDescr.getNamespace()) .getDialectCompiletimeRegistry()); } else { result = new DRLInfo(resource == null ? "" : resource.getProjectRelativePath().toString(), packageDescr, parserErrors, new PackageRegistry(builder, new Package("")).getDialectCompiletimeRegistry()); } // cache result if (useCache && resource != null) { if (compile && !parser.hasErrors()) { parsedRules.remove(resource); compiledRules.put(resource, result); RuleInfo[] ruleInfos = result.getRuleInfos(); for (int i = 0; i < ruleInfos.length; i++) { ruleInfoByClassNameMap.put(ruleInfos[i].getClassName(), ruleInfos[i]); } FunctionInfo[] functionInfos = result.getFunctionInfos(); for (int i = 0; i < functionInfos.length; i++) { functionInfoByClassNameMap.put(functionInfos[i].getClassName(), functionInfos[i]); } } else { parsedRules.put(resource, result); } } return result; } finally { Thread.currentThread().setContextClassLoader(oldLoader); } } catch (CoreException e) { log(e); } return null; }
From source file:org.drools.eclipse.DroolsEclipsePlugin.java
License:Apache License
public ProcessInfo parseProcess(String input, IResource resource) { try {/* w ww .ja v a 2 s. c o m*/ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); ClassLoader newLoader = this.getClass().getClassLoader(); String level = null; if (resource.getProject().getNature("org.eclipse.jdt.core.javanature") != null) { IJavaProject project = JavaCore.create(resource.getProject()); newLoader = ProjectClassLoader.getProjectClassLoader(project); level = project.getOption(JavaCore.COMPILER_COMPLIANCE, true); } try { Thread.currentThread().setContextClassLoader(newLoader); PackageBuilderConfiguration configuration = new PackageBuilderConfiguration(); if (level != null) { JavaDialectConfiguration javaConf = (JavaDialectConfiguration) configuration .getDialectConfiguration("java"); javaConf.setJavaLanguageLevel(level); } configuration.getClassLoader().addClassLoader(newLoader); SemanticModules modules = configuration.getSemanticModules(); modules.addSemanticModule(new BPMNSemanticModule()); modules.addSemanticModule(new BPMNDISemanticModule()); modules.addSemanticModule(new ProcessSemanticModule()); XmlProcessReader xmlReader = new XmlProcessReader(modules); List<org.drools.definition.process.Process> processes = (List<org.drools.definition.process.Process>) xmlReader .read(new StringReader(input)); if (processes != null) { for (org.drools.definition.process.Process process : processes) { if (process != null) { return parseProcess((Process) process, resource, configuration); } else { throw new IllegalArgumentException("Could not parse process " + resource); } } } } finally { Thread.currentThread().setContextClassLoader(oldLoader); } } catch (Exception e) { log(e); } return null; }
From source file:org.eclipse.ajdt.core.builder.AJBuilder.java
License:Open Source License
/** * Tidies up the output folder before a build. JDT does this by going * through the source and deleting the relevant .class files. That works ok * if you are also listening to things like resource deletes so that you * tidy up some .class files as you go along. AJDT does not do this, so we * use a different approach here. We go through the output directory and * recursively delete all .class files. This, of course, doesn't cope with * resources that might be in the output directory - but I can't delete * everything because some people have the output directory set to the top * level of their project.//from w w w .j ava 2 s . co m * * There is a subtlety with linked folders being used as output folders, but * it does work, I added an AJDTUtils helper method which attempts IPath * dereferencing. if the IPath is a 'linked folder' then the helper method * returns the dereferenced value. */ protected void cleanOutputFolders(IJavaProject project, boolean refresh) throws CoreException { // Check the project property boolean deleteAll = JavaCore.CLEAN .equals(project.getOption(JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, true)); if (deleteAll) { int numberDeleted = 0; IPath[] paths = CoreUtils.getOutputFolders(project); for (int i = 0; i < paths.length; i++) { numberDeleted += cleanFolder(project, paths[i], refresh); } // clean inpath out folder String inpathOut = AspectJCorePreferences.getProjectInpathOutFolder(project.getProject()); if (inpathOut != null && !inpathOut.equals("")) { //$NON-NLS-1$ IPath inpathOutfolder = new Path(inpathOut); numberDeleted += cleanFolder(project, inpathOutfolder, refresh); } AJLog.log(AJLog.BUILDER, "Builder: Tidied output folder(s), removed class files and derived resources"); //$NON-NLS-1$ } }
From source file:org.eclipse.ajdt.internal.ui.ajdocexport.AJdocOptionsManager.java
License:Open Source License
private void loadFromDialogStore(IDialogSettings settings, List sel) { fInitialElements = getInitialElementsFromSelection(sel); IJavaProject project = getSingleProjectFromInitialSelection(); fAccess = settings.get(VISIBILITY);/* w w w. ja v a2 s. c o m*/ if (fAccess == null) fAccess = PROTECTED; //this is defaulted to false. fFromStandard = settings.getBoolean(FROMSTANDARD); //doclet is loaded even if the standard doclet is being used fDocletpath = settings.get(DOCLETPATH); fDocletname = settings.get(DOCLETNAME); if (fDocletpath == null || fDocletname == null) { fFromStandard = true; fDocletpath = ""; //$NON-NLS-1$ fDocletname = ""; //$NON-NLS-1$ } if (project != null) { fAntpath = getRecentSettings().getAntpath(project); } else { fAntpath = settings.get(ANTPATH); if (fAntpath == null) { fAntpath = ""; //$NON-NLS-1$ } } if (project != null) { fDestination = getRecentSettings().getDestination(project); } else { fDestination = settings.get(DESTINATION); if (fDestination == null) { fDestination = ""; //$NON-NLS-1$ } } fTitle = settings.get(TITLE); if (fTitle == null) fTitle = ""; //$NON-NLS-1$ fStylesheet = settings.get(STYLESHEETFILE); if (fStylesheet == null) fStylesheet = ""; //$NON-NLS-1$ fVMParams = settings.get(VMOPTIONS); if (fVMParams == null) fVMParams = ""; //$NON-NLS-1$ fAdditionalParams = settings.get(EXTRAOPTIONS); if (fAdditionalParams == null) fAdditionalParams = ""; //$NON-NLS-1$ fOverview = settings.get(OVERVIEW); if (fOverview == null) fOverview = ""; //$NON-NLS-1$ fUse = loadBoolean(settings.get(USE)); fAuthor = loadBoolean(settings.get(AUTHOR)); fVersion = loadBoolean(settings.get(VERSION)); fNodeprecated = loadBoolean(settings.get(NODEPRECATED)); fNoDeprecatedlist = loadBoolean(settings.get(NODEPRECATEDLIST)); fNonavbar = loadBoolean(settings.get(NONAVBAR)); fNoindex = loadBoolean(settings.get(NOINDEX)); fNotree = loadBoolean(settings.get(NOTREE)); fSplitindex = loadBoolean(settings.get(SPLITINDEX)); fOpenInBrowser = loadBoolean(settings.get(OPENINBROWSER)); fSource = settings.get(SOURCE); if (project != null) { fSource = project.getOption(JavaCore.COMPILER_SOURCE, true); } if (project != null) { fHRefs = getRecentSettings().getHRefs(project); } else { fHRefs = new String[0]; } }
From source file:org.eclipse.ajdt.internal.ui.ajdocexport.AJdocOptionsManager.java
License:Open Source License
private void loadDefaults(List sel) { fInitialElements = getInitialElementsFromSelection(sel); IJavaProject project = getSingleProjectFromInitialSelection(); if (project != null) { fAntpath = getRecentSettings().getAntpath(project); fDestination = getRecentSettings().getDestination(project); fHRefs = getRecentSettings().getHRefs(project); } else {//from w ww.j av a 2 s . c o m fAntpath = ""; //$NON-NLS-1$ fDestination = ""; //$NON-NLS-1$ fHRefs = new String[0]; } fAccess = PUBLIC; fDocletname = ""; //$NON-NLS-1$ fDocletpath = ""; //$NON-NLS-1$ fTitle = ""; //$NON-NLS-1$ fStylesheet = ""; //$NON-NLS-1$ fVMParams = ""; //$NON-NLS-1$ fAdditionalParams = ""; //$NON-NLS-1$ fOverview = ""; //$NON-NLS-1$ fUse = true; fAuthor = true; fVersion = true; fNodeprecated = false; fNoDeprecatedlist = false; fNonavbar = false; fNoindex = false; fNotree = false; fSplitindex = true; fOpenInBrowser = false; fSource = "1.3"; //$NON-NLS-1$ if (project != null) { fSource = project.getOption(JavaCore.COMPILER_SOURCE, true); } //by default it is empty all project map to the empty string fFromStandard = true; }