Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit')
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/IValidateEditContext.java30
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateInputProvider.java60
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidator.java57
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorImpl.java446
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorPresenter.java50
-rw-r--r--plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ValidateEditHeadlessContext.java97
6 files changed, 0 insertions, 740 deletions
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/IValidateEditContext.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/IValidateEditContext.java
deleted file mode 100644
index e965900b8..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/IValidateEditContext.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on May 18, 2004
- */
-package org.eclipse.wst.common.internal.emfworkbench.validateedit;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-
-
-/**
- * @author jlanuti This is the abstraction layer for validate edit
- */
-public interface IValidateEditContext extends ResourceStateValidatorPresenter {
-
- public static final String CLASS_KEY = "ValidateEditContext"; //$NON-NLS-1$
-
- public void setEditModel(EditModel fValidator);
-
- public IStatus validateState(EditModel fValidator);
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateInputProvider.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateInputProvider.java
deleted file mode 100644
index 4b8bc6054..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateInputProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.wst.common.internal.emfworkbench.validateedit;
-
-
-import java.util.List;
-
-public interface ResourceStateInputProvider {
- /**
- * Return true if any of the controlled resources or files has been modified.
- *
- * @return boolean
- */
- boolean isDirty();
-
- /**
- * Return a <code>List</code> of the MOF Resources that are being managed. Synchronization
- * checking will only work if you are using the emf.workbench plugin apis for loading resources.
- * This will ensure that you get an instance of a <code>ReferencedResource</code>. This
- * resource type is capable of caching its last known synchronization stamp that may be used to
- * test if the resource is consitent with the underlying IFile.
- *
- * @return List
- */
- List getResources();
-
- /**
- * Return a <code>List</code> of IFiles that are not MOF Resources that are also being
- * modified.
- *
- * @return List
- */
- List getNonResourceFiles();
-
- /**
- * Return a subset of the List from getNonResourceFiles() that are inconsistent with the
- * underlying java.io.File.
- *
- * @return List
- * @see ResourceStateInputProvider#getNonResourceFiles()
- */
- List getNonResourceInconsistentFiles();
-
- /**
- * It is the responsibility of the provider to cache the synchronization stamp for the List of
- * <code>roNonResourceFiles</code>. This stamp will be used to determine the inconsistent
- * files. This is only necessary of IFiles that are not MOF resources.
- *
- * @param roNonResourceFiles
- * @see ResourceStateInputProvider#getNonResourceInconsistentFiles()
- */
- void cacheNonResourceValidateState(List roNonResourceFiles);
-}
-
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidator.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidator.java
deleted file mode 100644
index ef337c447..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidator.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.emfworkbench.validateedit;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jem.util.plugin.JEMUtilPlugin;
-
-public interface ResourceStateValidator {
- static final IStatus OK_STATUS = new Status(IStatus.OK, JEMUtilPlugin.ID, 0, "", null); //$NON-NLS-1$
-
- /**
- * This method should be called whenever a <code>presenter</code> is activated (becomes
- * active). This will check the timestamps of the underlying files to see if they are different
- * from the last cached modified value. The <code>presenter</code> should be prepared to
- * prompt the user if they would like to refresh with the contents on disk if we are dirty.
- */
- void checkActivation(ResourceStateValidatorPresenter presenter) throws CoreException;
-
- /**
- * This method should be called whenever a <code>presenter</code> looses activation. This will
- * check the timestamps of the underlying files to see if they are different from the last
- * cached modified value. The <code>presenter</code> should be prepared to prompt the user if
- * they would like to refresh with the contents on disk if we are dirty.
- */
- void lostActivation(ResourceStateValidatorPresenter presenter) throws CoreException;
-
- /**
- * This method should be called the first time the files are about to be modified after a
- * <code>presenter</code> becomes active. The returned IStatus may have an ERROR status which
- * should be presented to the user.
- */
- IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException;
-
- /**
- * This method should be called prior to the <code>presenter</code> saving the modified
- * contents. This will check the consistency of the underlying files to ensure that they are
- * synchronized. If true is returned, the save can proceed.
- */
- boolean checkSave(ResourceStateValidatorPresenter presenter) throws CoreException;
-
- /**
- * Return true if there are any read only files.
- */
- boolean checkReadOnly();
-}
-
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorImpl.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorImpl.java
deleted file mode 100644
index 729443f9f..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorImpl.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.emfworkbench.validateedit;
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jem.util.emf.workbench.WorkbenchResourceHelperBase;
-import org.eclipse.wst.common.internal.emf.resource.ReferencedResource;
-import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper;
-
-public class ResourceStateValidatorImpl implements ResourceStateValidator {
- protected ResourceStateInputProvider provider;
- protected Map lastNonRefreshStateMap;
- protected boolean isCheckingConsistency;
-
- class RefreshRunnable implements IWorkspaceRunnable {
- CoreException thrownException;
- List files;
- List resources;
-
- RefreshRunnable(List someFiles, List inconsistentResources) {
- files = someFiles;
- resources = inconsistentResources;
- }
-
- public CoreException getThrownException() {
- return thrownException;
- }
-
- public void run(IProgressMonitor aMonitor) {
- try {
- prepareResourcesForRefresh(resources);
- primRefreshFiles(files);
- } catch (CoreException e) {
- thrownException = e;
- }
- }
- }
-
- /**
- * Constructor for ResourceStateValidator.
- */
- public ResourceStateValidatorImpl(ResourceStateInputProvider aProvider) {
- provider = aProvider;
- }
-
- /**
- * This method should be called whenever <code>aListener</code> is activated (becomes active).
- * This will check the timestamps of the underlying files to see if they are different from the
- * last cached modified value. <code>aListener</code> should be prepared to prompt the user if
- * they would like to refresh with the contents on disk if we are dirty.
- */
- public void checkActivation(ResourceStateValidatorPresenter presenter) throws CoreException {
- checkConsistency(presenter);
- }
-
- public void lostActivation(ResourceStateValidatorPresenter presenter) throws CoreException {
- checkConsistency(presenter);
- }
-
- public boolean checkSave(ResourceStateValidatorPresenter presenter) throws CoreException {
- if (presenter == null)
- return false;
- if (!provider.isDirty())
- return false;
- List inconsistentResources = getInconsistentResources();
- List inconsistentFiles = getFiles(inconsistentResources);
- inconsistentFiles = addOtherInconsistentFiles(inconsistentFiles);
- if (inconsistentFiles == null || inconsistentFiles.isEmpty())
- return true;
- return presenter.promptForInconsistentFileOverwrite(inconsistentFiles);
- }
-
- /**
- * @see ResourceStateValidator#checkReadOnly()
- */
- public boolean checkReadOnly() {
- boolean result = checkReadOnlyResources();
- if (!result)
- result = checkReadOnlyNonResourceFiles();
- return result;
- }
-
- /**
- * Method checkReadOnlyNonResourceFiles.
- *
- * @return boolean
- */
- private boolean checkReadOnlyNonResourceFiles() {
- List files = provider.getNonResourceFiles();
- if (files == null || files.isEmpty())
- return false;
- int size = files.size();
- IFile file = null;
- for (int i = 0; i < size; i++) {
- file = (IFile) files.get(i);
- if (file.isReadOnly())
- return true;
- }
- return false;
- }
-
- /**
- * Method checkReadOnlyResources.
- *
- * @return boolean
- */
- private boolean checkReadOnlyResources() {
- List resources = provider.getResources();
- if (resources == null || resources.isEmpty())
- return false;
- int size = resources.size();
- Resource res = null;
- IFile file = null;
- for (int i = 0; i < size; i++) {
- res = (Resource) resources.get(i);
- file = WorkbenchResourceHelper.getFile(res);
- if (file != null && file.isReadOnly())
- return true;
- }
- return false;
- }
-
- protected void checkConsistency(ResourceStateValidatorPresenter presenter) throws CoreException {
- if (isCheckingConsistency || presenter == null)
- return;
- isCheckingConsistency = true;
- try {
- List inconsistentResources = getInconsistentResources();
- List inconsistentFiles = getFiles(inconsistentResources);
- inconsistentFiles = addOtherInconsistentFiles(inconsistentFiles);
- if (inconsistentFiles == null || inconsistentFiles.isEmpty())
- return;
- boolean shouldRefreshFiles = true;
- //Defect 208654 & 209631 want prompt no matter what.
- if (anyFileChangedSinceLastRefreshPrompt(inconsistentFiles)) {
- clearLastNonRefreshStateMap();
- shouldRefreshFiles = presenter.promptForInconsistentFileRefresh(inconsistentFiles);
- } else
- return;
- if (shouldRefreshFiles)
- refreshFiles(inconsistentFiles, inconsistentResources);
- else
- cacheLastNonRefreshFileStamps(inconsistentFiles);
- } finally {
- isCheckingConsistency = false;
- }
- }
-
- /**
- * Method cacheLastNonRefreshFileStamps.
- *
- * @param inconsistentFiles
- */
- private void cacheLastNonRefreshFileStamps(List inconsistentFiles) {
- if (inconsistentFiles != null && !inconsistentFiles.isEmpty()) {
- Map map = getLastNonRefreshStateMap();
- IFile file = null;
- long stamp = 0;
- for (int i = 0; i < inconsistentFiles.size(); i++) {
- file = (IFile) inconsistentFiles.get(i);
- stamp = WorkbenchResourceHelper.computeModificationStamp(file);
- map.put(file, new Long(stamp));
- }
- }
- }
-
- /**
- * Method cacheValidateState.
- *
- * @param result
- */
- private void cacheValidateState(IStatus aStatus, List readOnlyResources, List roNonResourceFiles) {
- if (aStatus.isOK()) {
- if (readOnlyResources != null && !readOnlyResources.isEmpty()) {
- ReferencedResource res = null;
- for (int i = 0; i < readOnlyResources.size(); i++) {
- res = (ReferencedResource) readOnlyResources.get(i);
- WorkbenchResourceHelper.setSynhronizationStamp(res, computeModificationStamp(res));
- }
- }
- provider.cacheNonResourceValidateState(roNonResourceFiles);
- }
- }
-
- private void clearLastNonRefreshStateMap() {
- if (lastNonRefreshStateMap != null)
- lastNonRefreshStateMap.clear();
- }
-
- /**
- * Method anyFileChangedSinceLastRefreshPrompt.
- *
- * @param inconsistentFiles
- * @return boolean
- */
- private boolean anyFileChangedSinceLastRefreshPrompt(List inconsistentFiles) {
- if (inconsistentFiles == null || inconsistentFiles.isEmpty())
- return false;
- if (lastNonRefreshStateMap == null || lastNonRefreshStateMap.isEmpty())
- return true;
- int size = inconsistentFiles.size();
- IFile file = null;
- Long stamp = null;
- for (int i = 0; i < size; i++) {
- file = (IFile) inconsistentFiles.get(i);
- stamp = (Long) getLastNonRefreshStateMap().get(file);
- if (stamp == null || (stamp.longValue() != WorkbenchResourceHelper.computeModificationStamp(file)))
- return true;
- }
- return false;
- }
-
- protected List addOtherInconsistentFiles(List inconsistentFiles) {
- if (inconsistentFiles == null || inconsistentFiles.isEmpty())
- return getNonResourceInconsistentFiles();
- List nonResFiles = getNonResourceInconsistentFiles();
- if (nonResFiles != null)
- inconsistentFiles.addAll(nonResFiles);
- return inconsistentFiles;
- }
-
- /**
- * Method getNonResourceInconsistentFiles.
- *
- * @return List
- */
- private List getNonResourceInconsistentFiles() {
- List files = provider.getNonResourceInconsistentFiles();
- if (files != null && !files.isEmpty())
- return files;
- //Determine consistency based on the synchronization of the IFile
- files = provider.getNonResourceFiles();
- if (files == null || files.isEmpty())
- return Collections.EMPTY_LIST;
- List inconsistent = null;
- int size = files.size();
- IFile file = null;
- for (int i = 0; i < size; i++) {
- file = (IFile) files.get(i);
- if (file.isAccessible() && !file.isSynchronized(IResource.DEPTH_ZERO)) {
- if (inconsistent == null)
- inconsistent = new ArrayList();
- inconsistent.add(file);
- }
- }
- if (inconsistent == null)
- inconsistent = Collections.EMPTY_LIST;
- return inconsistent;
- }
-
- protected List getInconsistentResources() {
- List mofResources = provider.getResources();
- List inconsistent = null;
- int size = mofResources.size();
- Resource res = null;
- ReferencedResource refRes = null;
- for (int i = 0; i < size; i++) {
- res = (Resource) mofResources.get(i);
- if (WorkbenchResourceHelper.isReferencedResource(res)) {
- refRes = (ReferencedResource) res;
- if (!WorkbenchResourceHelper.isConsistent(refRes) && (refRes.isLoaded() && !refRes.isNew())) {
- if (inconsistent == null)
- inconsistent = new ArrayList();
- inconsistent.add(refRes);
- }
- }
- }
- if (inconsistent == null)
- inconsistent = Collections.EMPTY_LIST;
- return inconsistent;
- }
-
- protected List getFiles(List refResources) {
- List files = new ArrayList(refResources.size());
- IFile file = null;
- ReferencedResource refRes = null;
- for (int i = 0; i < refResources.size(); i++) {
- refRes = (ReferencedResource) refResources.get(i);
- file = WorkbenchResourceHelper.getFile(refRes);
- if (file != null)
- files.add(file);
- }
- return files;
- }
-
- /**
- * This method should be called at least the first time a ResourceStateValidatorPresenter
- * becomes active and is about to edit its contents. The returned IStatus may have an ERROR
- * status which should be presented to the user.
- */
- public IStatus validateState(ResourceStateValidatorPresenter presenter) throws CoreException {
- List roResources, nonResROFiles, roFiles = null;
- List[] readOnly = selectReadOnlyResources(provider.getResources());
- roResources = readOnly[0];
- roFiles = readOnly[1];
- nonResROFiles = selectReadOnlyFiles(provider.getNonResourceFiles());
- if (nonResROFiles != null) {
- if (roFiles == null)
- roFiles = nonResROFiles;
- else
- roFiles.addAll(nonResROFiles);
- }
- if (roFiles == null || roFiles.isEmpty())
- return OK_STATUS;
- IFile[] files = new IFile[roFiles.size()];
- roFiles.toArray(files);
- Object ctx = presenter != null ? presenter.getValidateEditContext() : null;
- IStatus result = ResourcesPlugin.getWorkspace().validateEdit(files, ctx);
- cacheValidateState(result, roResources, nonResROFiles);
- if (!result.isOK())
- checkConsistency(presenter);
- return result;
- }
-
- /**
- * Method selectReadOnlyFiles.
- *
- * @param list
- * @param roFiles
- */
- private List selectReadOnlyFiles(List files) {
- if (files == null || files.isEmpty())
- return files;
- int size = files.size();
- List readOnly = null;
- IFile file = null;
- for (int i = 0; i < size; i++) {
- file = (IFile) files.get(i);
- if (file.isReadOnly()) {
- if (readOnly == null)
- readOnly = new ArrayList(size);
- readOnly.add(file);
- }
- }
- return readOnly;
- }
-
- /**
- * Method selectReadOnlyResources.
- *
- * @param list
- * @param roFiles
- * @return List
- */
- private List[] selectReadOnlyResources(List resources) {
- if (resources == null || resources.isEmpty())
- return new List[]{resources, null};
- IFile file = null;
- int size = resources.size();
- Resource res = null;
- List readOnly = null;
- List roFiles = null;
- for (int i = 0; i < size; i++) {
- res = (Resource) resources.get(i);
- file = WorkbenchResourceHelper.getFile(res);
- if (file != null && file.isReadOnly()) {
- if (readOnly == null)
- readOnly = new ArrayList(size);
- readOnly.add(res);
- if (roFiles == null)
- roFiles = new ArrayList(size);
- roFiles.add(file);
- }
- }
- return new List[]{readOnly, roFiles};
- }
-
- protected long computeModificationStamp(ReferencedResource resource) {
- return WorkbenchResourceHelper.computeModificationStamp(resource);
- }
-
-
- protected void refreshFiles(List someFiles, List inconsitentResources) throws CoreException {
- RefreshRunnable runnable = new RefreshRunnable(someFiles, inconsitentResources);
- ResourcesPlugin.getWorkspace().run(runnable, null);
- if (runnable.getThrownException() != null)
- throw runnable.getThrownException();
- }
-
- protected void primRefreshFiles(List someFiles) throws CoreException {
- int size = someFiles.size();
- IFile file = null;
- for (int i = 0; i < size; i++) {
- file = (IFile) someFiles.get(i);
- if (!file.isSynchronized(IResource.DEPTH_ZERO))
- file.refreshLocal(IResource.DEPTH_ONE, null);
- else
- refreshResource(file);
- }
- }
-
- /**
- * We need to remove the Resource that corresponds to the <code>file</code> to force a
- * refresh.
- */
- protected void refreshResource(IFile file) {
- Resource res = WorkbenchResourceHelperBase.getResource(file);
- if (res != null)
- res.unload();
- }
-
- /**
- * Force the resources to not be dirty to ensure that they will be removed from their
- * ResourceSet when their file is refreshed.
- */
- protected void prepareResourcesForRefresh(List refResources) {
- ReferencedResource res = null;
- for (int i = 0; i < refResources.size(); i++) {
- res = (ReferencedResource) refResources.get(i);
- res.setForceRefresh(true);
- }
- }
-
- /**
- * Gets the lastNonRefreshStateMap.
- *
- * @return Returns a Map
- */
- protected Map getLastNonRefreshStateMap() {
- if (lastNonRefreshStateMap == null)
- lastNonRefreshStateMap = new HashMap();
- return lastNonRefreshStateMap;
- }
-}
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorPresenter.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorPresenter.java
deleted file mode 100644
index 47545d304..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ResourceStateValidatorPresenter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.wst.common.internal.emfworkbench.validateedit;
-
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-
-public interface ResourceStateValidatorPresenter {
- /**
- * Present to the user that the <code>inconsistentFiles</code> will need to be refreshed in
- * the workbench. Return true if the refresh should occur. The List will be a list of IFiles.
- *
- * @param inconsistentFiles
- * @return boolean
- */
- boolean promptForInconsistentFileRefresh(List inconsistentFiles);
-
- /**
- * Return the context (Shell) that would be passed to the validateEdit method. If this method
- * returns null, a prompt to check out code will not be presented to the user.
- *
- * @see org.eclipse.core.resources.IWorkspace#validateEdit(org.eclipse.core.resources.IFile[],
- * java.lang.Object)
- */
- Object getValidateEditContext();
-
- /**
- * Present a dialog to the user that indicates that the user is about to save and overwrite the
- * list of <code>inconsitentFiles</codes>. Return true if
- * the overwrite should proceed. The list of <code>inconsitentFiles</codes> will
- * be a list of IFiles.
- * @param inconsistentFiles
- * @return boolean
- */
- boolean promptForInconsistentFileOverwrite(List inconsistentFiles);
-
- /**
- * This method should be called by any action that is about to edit any contents of any IFile.
- */
- public IStatus validateState();
-}
-
diff --git a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ValidateEditHeadlessContext.java b/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ValidateEditHeadlessContext.java
deleted file mode 100644
index 11efe031b..000000000
--- a/plugins/org.eclipse.wst.common.emfworkbench.integration/src/org/eclipse/wst/common/internal/emfworkbench/validateedit/ValidateEditHeadlessContext.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on May 18, 2004
- */
-package org.eclipse.wst.common.internal.emfworkbench.validateedit;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.wst.common.internal.emfworkbench.integration.EditModel;
-
-
-/**
- * @author jlanuti Headless Validate Edit Context Implementation
- */
-public class ValidateEditHeadlessContext implements IValidateEditContext {
-
- protected boolean fNeedsStateValidation = true;
- protected boolean fMessageUp = false;
- protected EditModel fValidator = null;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.IValidateEditContext#validateState()
- */
- public IStatus validateState() {
- // For now do nothing in headless state
- return Status.OK_STATUS;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter#getValidateEditContext()
- */
- public Object getValidateEditContext() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter#promptForInconsistentFileOverwrite(java.util.List)
- */
- public boolean promptForInconsistentFileOverwrite(List inconsistentFiles) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorPresenter#promptForInconsistentFileRefresh(java.util.List)
- */
- public boolean promptForInconsistentFileRefresh(List inconsistentFiles) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /**
- * @see IValidateEditListener#setNeedsStateValidation(boolean)
- */
- public void setNeedsStateValidation(boolean needsStateValidation) {
- fNeedsStateValidation = needsStateValidation;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.IValidateEditContext#setEditModel(org.eclipse.wst.common.internal.emfworkbench.integration.EditModel)
- */
- public void setEditModel(EditModel fValidator) {
- this.fValidator = fValidator;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.common.internal.emfworkbench.validateedit.IValidateEditContext#validateState(org.eclipse.wst.common.internal.emfworkbench.integration.EditModel)
- */
- public IStatus validateState(EditModel editModel) {
- setEditModel(editModel);
- return validateState();
- }
-} \ No newline at end of file

Back to the top