List of usage examples for org.eclipse.jdt.core IJavaProject getProject
IProject getProject();
IProject
on which this IJavaProject
was created. From source file:com.iw.plugins.spindle.core.eclipse.TapestryProject.java
License:Mozilla Public License
static public IStatus removeTapestryNature(IJavaProject project) { try {//from w w w.j a va2 s.co m EclipsePluginUtils.removeNatureFromProject(project.getProject(), TapestryCorePlugin.NATURE_ID); } catch (CoreException ex) { TapestryCore.log(ex.getMessage()); return ex.getStatus(); } return SpindleStatus.OK_STATUS; }
From source file:com.iw.plugins.spindle.core.eclipse.TapestryProject.java
License:Mozilla Public License
/** * @return a TapestryProject if this javaProject has the tapestry nature or null if Project has * not tapestry nature//from w ww . jav a 2s . co m */ static public TapestryProject create(IJavaProject javaProject) { TapestryProject result = null; try { result = (TapestryProject) javaProject.getProject().getNature(TapestryCorePlugin.NATURE_ID); } catch (CoreException ex) { TapestryCore.log(ex.getMessage()); } return result; }
From source file:com.iw.plugins.spindle.core.TapestryProject.java
License:Mozilla Public License
static public IStatus removeTapestryNature(IJavaProject project) { try {/*from ww w. j ava 2 s . c o m*/ TapestryCore.removeNatureFromProject(project.getProject(), TapestryCore.NATURE_ID); } catch (CoreException ex) { TapestryCore.log(ex.getMessage()); return ex.getStatus(); } return SpindleStatus.OK_STATUS; }
From source file:com.iw.plugins.spindle.core.TapestryProject.java
License:Mozilla Public License
/** * @return a TapestryProject if this javaProject has the tapestry nature or null if Project has * not tapestry nature//from w ww. j a v a2s . co m */ static public TapestryProject create(IJavaProject javaProject) { TapestryProject result = null; try { result = (TapestryProject) javaProject.getProject().getNature(TapestryCore.NATURE_ID); } catch (CoreException ex) { TapestryCore.log(ex.getMessage()); } return result; }
From source file:com.iw.plugins.spindle.model.manager.TapestryProjectModelManager.java
License:Mozilla Public License
private boolean isSupportedElement(IStorage storage) { IJavaProject jproject = null; try {/*from w w w . j a va2 s.c o m*/ jproject = TapestryPlugin.getDefault().getJavaProjectFor(storage); } catch (CoreException e) { } if (jproject == null) { return false; } if (!jproject.getProject().equals(project)) { return false; } String extension = extension(storage); return modelDelegates.containsKey(extension); }
From source file:com.iw.plugins.spindle.project.actions.AbstractTapestryProjectAction.java
License:Mozilla Public License
protected boolean checkSelection(IStructuredSelection selection) { IJavaProject jproject = (IJavaProject) selection.getFirstElement(); IProject project = jproject.getProject(); try {// w w w . ja v a2 s .c om return !project.hasNature(TapestryPlugin.NATURE_ID); } catch (CoreException e) { return false; } }
From source file:com.iw.plugins.spindle.project.actions.ConvertToTapestryProjectAction.java
License:Mozilla Public License
/** * @see org.eclipse.ui.IActionDelegate#run(IAction) *///from w ww. jav a2s . c om public void run(IAction action) { Shell shell = TapestryPlugin.getDefault().getActiveWorkbenchShell(); IJavaProject jproject = (IJavaProject) selection.getFirstElement(); IProject project = jproject.getProject(); if (!checkHasServletJars(jproject)) { MessageDialog.openInformation(shell, "Conversion Problem", "Can't continue with conversion.\n\nAdd:\n\n javax.servlet.jar\n\n to the project build path.\n\nThen try converting again"); return; } if (!checkHasTapestryJars(jproject)) { MessageDialog.openInformation(shell, "Conversion Problem", "Can't continue with conversion.\n\nAdd:\n\n net.sf.tapestry.jar (2.2 or better)\n\n to the project build path.\n\nThen try converting again"); return; } ConvertToTapestryProjectWizard wizard = new ConvertToTapestryProjectWizard(); wizard.init(TapestryPlugin.getDefault().getWorkbench(), selection); WizardDialog dialog = new WizardDialog(shell, wizard); PixelConverter converter = new PixelConverter(TapestryPlugin.getDefault().getActiveWorkbenchShell()); dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20)); dialog.create(); dialog.getShell().setText("Tapestry Project Conversion"); dialog.open(); }
From source file:com.iw.plugins.spindle.project.actions.JumpToTapestryProjectAction.java
License:Mozilla Public License
public void run(IAction action) { Shell shell = TapestryPlugin.getDefault().getActiveWorkbenchShell(); IJavaProject jproject = (IJavaProject) selection.getFirstElement(); IProject project = jproject.getProject(); ITapestryModel projectModel = null;/*from w w w .java2 s .c om*/ try { ITapestryProject tproject = TapestryPlugin.getDefault().getTapestryProjectFor(project); projectModel = tproject.getProjectModel(); } catch (CoreException e) { SpindleMultiStatus status = new SpindleMultiStatus(SpindleMultiStatus.ERROR, "could not open project resource"); status.addStatus(e.getStatus()); ErrorDialog.openError(shell, "Spindle Error", "open project application/library failed.", status); } if (projectModel != null) { IStorage storage = projectModel.getUnderlyingStorage(); IEditorPart editor = Utils.getEditorFor(storage); if (editor != null) { TapestryPlugin.getDefault().getActiveWorkbenchWindow().getActivePage().bringToTop(editor); } else { TapestryPlugin.getDefault().openTapestryEditor(storage); } } }
From source file:com.iw.plugins.spindle.project.actions.MigrateToTapestryDTD13.java
License:Mozilla Public License
/** * @see org.eclipse.ui.IActionDelegate#run(IAction) *///from w ww .j a va2s. c om public void run(IAction action) { Shell shell = TapestryPlugin.getDefault().getActiveWorkbenchShell(); IJavaProject jproject = (IJavaProject) selection.getFirstElement(); project = jproject.getProject(); try { if (!project.hasNature(TapestryPlugin.NATURE_ID)) { reportProblem(shell, "You must convert the project to a Tapestry project before migrating"); return; } } catch (CoreException e) { reportError(e.getStatus()); return; } if (!checkHasServletJars(jproject)) { MessageDialog.openInformation(shell, "Conversion Problem", "Can't continue with conversion.\n\nAdd:\n\n javax.servlet.jar\n\n to the project build path.\n\nThen try converting again"); return; } if (!checkHasTapestryJars(jproject)) { MessageDialog.openInformation(shell, "Conversion Problem", "Can't continue with conversion.\n\nAdd:\n\n net.sf.tapestry.jar (2.2 or better)\n\n to the project build path.\n\nThen try converting again"); return; } StructuredSelection actionSelection = new StructuredSelection(project); WorkspaceAction closeAction = new CloseResourceAction(shell); closeAction.selectionChanged(actionSelection); closeAction.run(); if (project.isOpen()) { return; } WorkspaceAction openAction = new OpenResourceAction(shell); openAction.selectionChanged(actionSelection); openAction.run(); ITapestryProject tproject = null; try { tproject = (ITapestryProject) project.getNature(TapestryPlugin.NATURE_ID); } catch (CoreException e) { //the action has already checked to ensure the project exists. } findAllModels(); List badModels = mgr.checkForUnloadableModels(); if (!badModels.isEmpty()) { reportModelErrors(badModels); return; } if (!checkForMultipleLibsApps(tproject)) { return; } launchWizard(shell, tproject); }
From source file:com.iw.plugins.spindle.TapestryPlugin.java
License:Mozilla Public License
public ITapestryProject addTapestryProjectNatureTo(IJavaProject jproject, IProgressMonitor monitor) throws CoreException { IProject project = jproject.getProject(); if (project.hasNature(NATURE_ID)) { return null; }/*ww w . j av a2 s . c o m*/ IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = NATURE_ID; description.setNatureIds(newNatures); project.setDescription(description, monitor); return getTapestryProjectFor(jproject); }