本文整理匯總了Java中org.eclipse.core.resources.IProject.accept方法的典型用法代碼示例。如果您正苦於以下問題:Java IProject.accept方法的具體用法?Java IProject.accept怎麽用?Java IProject.accept使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.resources.IProject
的用法示例。
在下文中一共展示了IProject.accept方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getActiveFile
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
@Override
public IFile getActiveFile() {
IProject projectWithEcore = this.getProject(this.gemocLanguageProject);
FileFinderVisitor ecoreFinder = new FileFinderVisitor("ecore");
try {
projectWithEcore.accept(ecoreFinder);
} catch (CoreException e) {
Activator.error(e.getMessage(), e);
}
if(ecoreFinder.getFiles().size() > 0){
return ecoreFinder.getFiles().get(0);
} else {
return null;
}
}
示例2: getActiveFile
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
@Override
public IFile getActiveFile() {
IProject projectWithGenmodel = this.getProject(this.gemocLanguageProject);
FileFinderVisitor genmodelFinder = new FileFinderVisitor("genmodel");
try {
projectWithGenmodel.accept(genmodelFinder);
} catch (CoreException e) {
Activator.error(e.getMessage(), e);
}
if(genmodelFinder.getFiles().size() > 0){
return genmodelFinder.getFiles().get(0);
} else {
return null;
}
}
示例3: validateAll
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
protected void validateAll ( final IProject project, final ComposedAdapterFactory adapterFactory, final Set<String> extensions, final IProgressMonitor monitor )
{
logger.debug ( "Validating all resources of {}", project );
try
{
project.accept ( new IResourceVisitor () {
@Override
public boolean visit ( final IResource resource ) throws CoreException
{
return handleResource ( null, resource, adapterFactory, extensions, monitor );
}
} );
}
catch ( final CoreException e )
{
StatusManager.getManager ().handle ( e.getStatus () );
}
}
示例4: openPossibleFileWithExtensionInProject
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
/**
* Open the only solution if only one file has the correct extension
* Otherwise invite to select the file to open
* @param project
* @param fileExtension
*/
public static void openPossibleFileWithExtensionInProject(IProject project, String fileExtension) {
FileFinderVisitor finder = new FileFinderVisitor(fileExtension);
try {
project.accept(finder);
List<IFile> list =finder.getFiles();
if(list.size() == 1) {
openIFile(list.get(0));
}
else{
openPossibleFileInProject(project,"*."+fileExtension);
}
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
示例5: initProjects
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
/**
* Initialise les projets respectant le filtre.
*
* @param filter Filtre.
*/
private void initProjects(Predicate<IProject> filter) {
/* Charge les projets ouverts. */
JavaProjectMap projectMap = ResourceUtils.getProjectMap();
try {
/* Parcourt les projets ouverts. */
for (Entry<IProject, IJavaProject> entry : projectMap.entrySet()) {
IProject project = entry.getKey();
IJavaProject javaProject = entry.getValue();
/* Filtre les projets */
if (!filter.test(project)) {
continue;
}
/* Parcours les resources du projet. */
project.accept(new ItemVisitor(project, javaProject));
}
} catch (Exception e) {
ErrorUtils.handle(e);
}
}
示例6: createNewXTextProject
import org.eclipse.core.resources.IProject; //導入方法依賴的package包/類
protected void createNewXTextProject() {
/*
* MessageDialog.openWarning(
* PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
* "Gemoc Language Workbench UI",
* "Action not completly implemented yet");
*/
// create xtext project from existing ecore model
// wizard id =
// org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard
// launch the appropriate wizard
IWizardDescriptor descriptor = WizardFinder
.findNewWizardDescriptor("org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard");
// Then if we have a wizard, open it.
if (descriptor != null) {
// add a listener to capture the creation of the resulting project
NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
ResourcesPlugin.getWorkspace().addResourceChangeListener(
workspaceListener);
try {
IWizard wizard;
wizard = descriptor.createWizard();
// this wizard need some dedicated initialization
// ((EcoreModelerWizard )wizard).init(PlatformUI.getWorkbench(),
// (IStructuredSelection)
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection());
// ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
// (IStructuredSelection) selection);
WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), wizard);
wd.create();
wd.setTitle(wizard.getWindowTitle());
int res = wd.open();
if (res == WizardDialog.OK) {
ResourcesPlugin.getWorkspace()
.removeResourceChangeListener(workspaceListener);
ArrayList<IProject> newlyCreatedProjects = workspaceListener
.getNewlyCreatedProjects();
// find the created project with xtext files in it
FileFinderVisitor fileFinder = new FileFinderVisitor(
"xtext");
for (Iterator<IProject> iterator = newlyCreatedProjects
.iterator(); iterator.hasNext();) {
IProject iProject = (IProject) iterator.next();
iProject.accept(fileFinder);
if (fileFinder.getFile() != null) {
createdProject = iProject;
break;
}
}
// update the project configuration model
if (createdProject != null) {
// maybe we should do something in the melange file ?
} else {
Activator
.error("not able to detect which project was created by wizard",
null);
}
}
} catch (CoreException e) {
Activator.error(e.getMessage(), e);
} finally {
// make sure to remove listener in all situations
ResourcesPlugin.getWorkspace().removeResourceChangeListener(
workspaceListener);
}
} else {
Activator
.error("wizard with id=org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard not found",
null);
}
}
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:75,代碼來源:CreateEditorProjectWizardContextAction.java