protected ClasspathModel createClasspathModel() { return new ClasspathModel(null, true); }
public void performDefaults() { model.resetClassPathSelection(); refresh(); isDirty = false; model.dispose(); }
/** * Sets the manfest on the archive, updates the classpath selection, and notifies */ public void setManifest(ArchiveManifest newManifest) { try { J2EEProjectUtilities.writeManifest(getProject(), newManifest); } catch (IOException e) { handleOpenFailureException(e); } getClassPathSelection(); // Ensure the selection is initialized. fireNotification(new ClasspathModelEvent(ClasspathModelEvent.MANIFEST_CHANGED)); }
public void setProject(IProject project) { this.project = project; initializeComponent(); getAvailableEARComponents(); }
public void refresh() { ArchiveManifest mf = null; if (getComponent() != null) mf = J2EEProjectUtilities.readManifest(getProject()); refreshAvailableEARs(); resetClassPathSelection(mf); }
ClasspathModel clpModel = new ClasspathModel(null); IVirtualComponent earComponent = ComponentCore.createComponent( earProject ); if( !earComponent.exists() ) return OK_STATUS; clpModel.setSelectedEARComponent( earComponent ); clpModel.setProject( proj ); for (int i = 0; i < jarList.size(); i++) { String jarName = (String) jarList.get(i); clpModel.selectDependencyIfNecessary(jarName); clpModel.selectDependencyIfNecessary( refproj ); for (int i = 0; i < jarList.size(); i++) { String jarName = (String) jarList.get(i); clpModel.removeDependency(jarName); clpModel.getClassPathSelection().invertClientJARSelection( refproj, oppositeProject ); if (clpModel.isDirty()) try { saveModel(clpModel, monitor); clpModel.dispose(); if (monitor != null) monitor.done();
public boolean selectDependencyIfNecessary(IProject referencedProject) { getClassPathSelection(); if (classPathSelection == null || classPathSelection.hasDirectOrIndirectDependencyTo(referencedProject)) return false; ClasspathElement element = classPathSelection.getClasspathElement(referencedProject); if (element != null) { setSelection(element, true); return true; } return false; }
public void moveUp(List toMoveUp) { getClassPathSelection().moveUp(toMoveUp); updateManifestClasspath(); }
protected ClassPathSelection getClasspathSelection() { if (model == null || model.getSelectedEARComponent() == null && !(J2EEProjectUtilities.isStandaloneProject(model.getComponent().getProject()))) return null; return model.getClassPathSelection(); }
/** * Sets the isSelected for the classpath element and sends out a notification of type * {@link ClasspathModelEvent#CLASS_PATH_CHANGED} */ public void setSelection(ClasspathElement element, boolean selected) { element.setSelected(selected); if (!isWLPModel()) { updateManifestClasspath(); } else { // at least fire the change event fireNotification(new ClasspathModelEvent(ClasspathModelEvent.CLASS_PATH_CHANGED)); } }
/** * Returns false if page should not be displayed for the project. */ protected void initialize() { model = createClasspathModel(); model.setProject(project); if (model.getComponent() != null) { model.addListener(this); updateModelManifest(); initializeValidateEditListener(); } }
protected void createClassPathSelection() { if (getComponent() != null && selectedEARComponent != null ) classPathSelection = new ClassPathSelection(getComponent(), selectedEARComponent); else classPathSelection = null; }
public void refreshText() { ClassPathSelection sel = model.getClassPathSelection(); if (sel != null && classPathText != null) classPathText.setText(sel == null ? "" : sel.toString()); //$NON-NLS-1$ }
private void createRef(String aComponentName){ IVirtualComponent archive = ComponentCore.createArchiveComponent(model.getComponent().getProject(), aComponentName); // To do: check if archive component already exists IVirtualReference ref = ComponentCore.createReference(model.getComponent(), archive, new Path("/WEB-INF/lib")); //$NON-NLS-1$ model.getComponent().addReferences(new IVirtualReference [] { ref }); ClasspathElement element = createClassPathElement(archive, archive.getName()); // ClassPathSelection selection = createClassPathSelectionForExternalJar(element); model.getClassPathSelectionForWLPs().getClasspathElements().add(element); }
public void setSelectedEARComponent(IVirtualComponent component) { selectedEARComponent = component; fireNotification(new ClasspathModelEvent(ClasspathModelEvent.EAR_PROJECT_CHANGED)); }
public void selectEAR(int index) { ArchiveManifest mf = new ArchiveManifestImpl((ArchiveManifestImpl) getArchive().getManifest()); JavaEEArchiveUtilities.INSTANCE.closeArchive(earFile); selectedEARComponent = availableEARComponents[index]; initializeSelection(mf); fireNotification(new ClasspathModelEvent(ClasspathModelEvent.EAR_PROJECT_CHANGED)); }
public boolean performOk() { if (model.getComponent() == null || !isValidWebModule()) { return true; } if (!isDirty) { return true; } try { boolean createdFlexProjects = runWLPOp(createFlexProjectOperations()); boolean createdComponentDependency = false; if (createdFlexProjects) { createdComponentDependency = runWLPOp(createComponentDependencyOperations()); isDirty = false; } // treat as a classpath change for refresh purposes // XXX this refresh is not working - suspect it is because the virtual component dependencies are // not consistently being recomputed //handleClasspathChange(); return createdComponentDependency; } finally { model.dispose(); } }
/** * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ public boolean performOk() { if (!isDirty) return true; WorkspaceModifyComposedOperation composed = new WorkspaceModifyComposedOperation(createManifestOperation()); createClasspathAttributeUpdateOperation(composed, model.getClassPathSelection(), false); try { new ProgressMonitorDialog(propPage.getShell()).run(true, true, composed); } catch (InvocationTargetException ex) { String title = ManifestUIResourceHandler.An_internal_error_occurred_ERROR_; String msg = title; if (ex.getTargetException() != null && ex.getTargetException().getMessage() != null) msg = ex.getTargetException().getMessage(); MessageDialog.openError(propPage.getShell(), title, msg); org.eclipse.jem.util.logger.proxy.Logger.getLogger().logError(ex); return false; } catch (InterruptedException e) { // cancelled return false; } finally { model.dispose(); } isDirty = false; return true; }
protected void availableJARCheckStateChanged(CheckStateChangedEvent event) { if (!J2EEProjectUtilities.isStandaloneProject(model.getComponent().getProject()) && (isReadOnly() || !validatateEdit() || (isMyClientJAR(event) && !event.getChecked()))) { availableJARsViewer.setChecked(event.getElement(), !event.getChecked()); return; } ClasspathElement element = (ClasspathElement) event.getElement(); model.setSelection(element, event.getChecked()); }
protected UpdateJavaBuildPathOperation createBuildPathOperation(ClasspathModel aModel) { IJavaProject javaProject = JemProjectUtilities.getJavaProject(aModel.getProject()); return new UpdateJavaBuildPathOperation(javaProject, aModel.getClassPathSelection()); }