use of org.erlide.wrangler.refactoring.backend.ChangedFile in project erlide_eclipse by erlang.
the class WranglerUtils method notifyErlide.
/**
* Notifies Erlide about the changed files.
*
* @param changedFiles
* changed files
*/
public static void notifyErlide(final List<ChangedFile> changedFiles) {
final IErlModel model = ErlangEngine.getInstance().getModel();
for (final ChangedFile f : changedFiles) {
IFile file;
try {
file = WranglerUtils.getFileFromPath(f.getNewPath());
final IErlElement element = model.findElement(file);
final IErlModule m = (IErlModule) element;
m.resourceChanged(null);
final IEditorPart editor = GlobalParameters.getEditor();
if (editor instanceof ErlangEditor) {
((ErlangEditor) editor).resetAndCacheScannerAndParser();
}
model.notifyChange(m);
} catch (final Exception e) {
ErlLogger.error(e);
}
}
}
use of org.erlide.wrangler.refactoring.backend.ChangedFile in project erlide_eclipse by erlang.
the class RenameModuleRefactoring method createChange.
@Override
public Change createChange(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
final CompositeChange c = (CompositeChange) super.createChange(pm);
for (final ChangedFile f : changedFiles) {
if (f.isNameChanged()) {
final IPath p = f.getPath();
final String s = f.getNewName();
final RenameResourceChange rch = new RenameResourceChange(p, s);
c.add(rch);
}
}
return c;
}
use of org.erlide.wrangler.refactoring.backend.ChangedFile in project erlide_eclipse by erlang.
the class WranglerRefactoring method createChange.
@Override
public Change createChange(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
pm.beginTask("Creating changes", changedFiles.size() + 1);
final CompositeChange change = new CompositeChange(getName());
pm.internalWorked(1);
try {
Change c;
for (final ChangedFile e : changedFiles) {
c = e.createChanges();
if (c != null) {
change.add(c);
pm.internalWorked(1);
}
}
} catch (final IOException e) {
final Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage());
throw new CoreException(s);
} finally {
pm.done();
}
return change;
}
use of org.erlide.wrangler.refactoring.backend.ChangedFile in project erlide_eclipse by erlang.
the class AbstractRefactoringRpcMessage method parseFileList.
protected ArrayList<ChangedFile> parseFileList(final OtpErlangList fileList) {
final ArrayList<ChangedFile> ret = new ArrayList<>();
OtpErlangTuple e;
OtpErlangString oldPath;
OtpErlangString newPath;
for (int i = 0; i < fileList.arity(); ++i) {
e = (OtpErlangTuple) fileList.elementAt(i);
oldPath = (OtpErlangString) e.elementAt(0);
newPath = (OtpErlangString) e.elementAt(1);
final String newContent = OtpErlang.asString(e.elementAt(2));
ret.add(new ChangedFile(oldPath.stringValue(), newPath.stringValue(), newContent));
}
return ret;
}
Aggregations