List of usage examples for org.eclipse.jface.preference PreferenceStore getString
@Override
public String getString(String name)
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * Find Aadl source file in file system, i.e., a file with the extension * aadl. Search in the project source folder. Search for file according type * by looking in packages or propertysets as necessary. * /*from www .j a v a 2 s .c om*/ * @param name name of AadlSpec, AadlPackage, or propertyset. Package name * may have "::" as separator. * @return IFile the file */ public IFile findAadlSourceFile(String name) { IFile f = null; String filename; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_SOURCE_DIR); filename = name.replaceAll(WorkspacePlugin.AADL_PACKAGE_SEPARATOR, WorkspacePlugin.FILE_PACKAGE_SEPARATOR) + "." + WorkspacePlugin.SOURCE_FILE_EXT; f = findAadlFile(new Path(currentPath), filename); if (f == null) { f = tryOtherPackageSeparators(name, WorkspacePlugin.SOURCE_FILE_EXT, currentPath); } return f; }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * Find Aadl model file in file system, i.e., a file with the extension * aaxl. Search in the project model folder. Search for file according type * by looking in packages or propertysets as necessary * /*from w w w. j a v a 2 s.c om*/ * @param name name of AadlSpec, AadlPackage, or propertyset. Package name * may have "::" as separator. * @return IFile the file */ public IFile findAadlModelFile(String name) { PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR); IFile f = null; String filename = name + "." + WorkspacePlugin.MODEL_FILE_EXT; f = findAadlFile(new Path(currentPath), filename); return f; }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * return the path to the AAXL file that corresponds to the specified aadl * file/*from w w w.j a v a 2 s . co m*/ * * @param file * @return IPath path */ public IPath getAaxlPath(IFile file) { IPath p = file.getProjectRelativePath(); IPath result = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); IPath src = new Path(projectProperties.getString(WorkspacePlugin.PROJECT_SOURCE_DIR)); if (src.isPrefixOf(p)) { int i = src.segmentCount(); result = new Path(projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR)) .append(p.removeFirstSegments(i)); result = result.removeFileExtension().addFileExtension(WorkspacePlugin.MODEL_FILE_EXT); result = new Path(project.getName()).append(result); } else { result = new Path(project.getName()) .append(p.removeFileExtension().addFileExtension(WorkspacePlugin.MODEL_FILE_EXT)); } return result; }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * return the Aadl folder corresponding to the aaxl folder * //from ww w .ja v a 2 s . c om * @param folder * @return */ public IFolder getComplementFolder(IFolder folder) { IPath p = folder.getProjectRelativePath(); PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); IPath mdl = new Path(projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR)); IPath text = new Path(projectProperties.getString(WorkspacePlugin.PROJECT_SOURCE_DIR)); IPath result = new Path("/" + project.getName()); if (mdl.isPrefixOf(p)) { int i = mdl.segmentCount(); result = result.append(text).append(p.removeFirstSegments(i)); } else if (text.isPrefixOf(p)) { int i = text.segmentCount(); result = result.append(mdl).append(p.removeFirstSegments(i)); } else { result = result.append(p); } IFolder outFolder = getProject().getFolder(result.removeFirstSegments(1)); return outFolder; }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * clean all declarative model files, i.e., files with the extension aaxl * that contain AadlSpec, AadlPacakge, or PropertySet cleaning them means * marking them as having syntax errors which will cause the compile to * occur//from w w w . java2s .co m */ public void cleanAllDeclarativeModelFiles(final IProgressMonitor monitor) { IPath path = null; IContainer folder = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR); IPath modelfolder = new Path(currentPath); path = modelfolder; if (path.segmentCount() == 0) { folder = project; } else { folder = project.getFolder(path); } if (folder.exists()) { new ForAllIFile() { protected void process(IFile theFile) { String filename = theFile.getName(); if (filename.endsWith(WorkspacePlugin.MODEL_FILE_EXT) && !filename.endsWith(instanceEnd)) { IResourceUtility.tagModelWithSyntaxErrors(theFile); } } }.traverse(folder); } }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * clean all AADL Text files, i.e., make sure they are not marked as derived * In the new scheme of things text filees are always up to date with XML * models thus can be used to do a clean build *//*from ww w . j a v a2 s. c om*/ public void cleanAllAADLTextFiles(final IProgressMonitor monitor) { IPath path = null; IContainer folder = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_SOURCE_DIR); IPath modelfolder = new Path(currentPath); path = modelfolder; if (path.segmentCount() == 0) { folder = project; } else { folder = project.getFolder(path); } if (folder.exists()) { new ForAllIFile() { protected void process(IFile theFile) { String filename = theFile.getName(); if (filename.endsWith(WorkspacePlugin.SOURCE_FILE_EXT)) { try { theFile.setDerived(false); } catch (CoreException e) { WorkspacePlugin.log(e); } } } }.traverse(folder); } }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * get all instance model files//w w w . ja v a 2s. c o m */ public EList<IFile> getAllInstanceModelFiles(final IProgressMonitor monitor) { IPath path = null; IContainer folder = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR); IPath modelfolder = new Path(currentPath); path = modelfolder; if (path.segmentCount() == 0) { folder = project; } else { folder = project.getFolder(path); } if (folder.exists()) { EList<IFile> result = new ForAllIFile() { protected boolean suchThat(IFile obj) { String filename = obj.getName(); return filename.endsWith(instanceEnd); } }.traverse(folder); return result; } return new BasicEList<IFile>(); }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * delete all model instance files, i.e., files with the extension aaxl that * contain instance models. The file is recognized by the filename ending in * "_instance.aaxl"//from w ww . ja va 2 s . c om */ public void deleteAllInstanceModelFiles(final IProgressMonitor monitor) { IPath path = null; IContainer folder = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR); IPath modelfolder = new Path(currentPath); path = modelfolder; if (path.segmentCount() == 0) { folder = project; } else { folder = project.getFolder(path); } if (folder.exists()) { new ForAllIFile() { protected void process(IFile theFile) { String name = theFile.getName(); if (name.endsWith(instanceEnd)) { try { theFile.delete(true, monitor); } catch (CoreException e) { WorkspacePlugin.log(e); } } } }.traverse(folder); } }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * add all source files to be processed//w ww.ja v a 2 s . co m */ public EList<IFile> getAllSourceFiles() { IPath path = null; IContainer folder = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_SOURCE_DIR); IPath modelfolder = new Path(currentPath); path = modelfolder; if (path.segmentCount() == 0) { folder = project; } else { folder = project.getFolder(path); } if (folder.exists()) { EList<IFile> result = new ForAllIFile() { protected boolean suchThat(IFile obj) { String name = obj.getName(); return name.endsWith(WorkspacePlugin.SOURCE_FILE_EXT); } }.traverse(folder); return result; } return new BasicEList<IFile>(); }
From source file:org.osate.internal.workspace.AadlProject.java
License:Open Source License
/** * Get all the model files (declarative and instance) in the Aadl Project. */// w ww.j a va 2s . c o m public EList<IFile> getAllModelFiles() { IPath path = null; IContainer folder = null; PreferenceStore projectProperties = WorkspacePlugin.getPreferenceStore(project); String currentPath = projectProperties.getString(WorkspacePlugin.PROJECT_MODEL_DIR); IPath modelfolder = new Path(currentPath); path = modelfolder; if (path.segmentCount() == 0) { folder = project; } else { folder = project.getFolder(path); } if (folder.exists()) { EList<IFile> result = new ForAllIFile() { protected boolean suchThat(IFile obj) { String name = obj.getName(); return name.endsWith(WorkspacePlugin.MODEL_FILE_EXT); } }.traverse(folder); return result; } return new BasicEList<IFile>(); }