Clean up code

This commit is contained in:
MrLetsplay 2024-02-04 17:57:49 +01:00
parent e092ba0548
commit 1a120f98eb
Signed by: mr
SSH Key Fingerprint: SHA256:92jBH80vpXyaZHjaIl47pjRq+Yt7XGTArqQg1V7hSqg

View File

@ -8,7 +8,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Adapters; import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.handlers.HandlerUtil;
import me.mrletsplay.shareclient.ShareClient; import me.mrletsplay.shareclient.ShareClient;
@ -18,8 +17,6 @@ public class ShareProjectHandler extends AbstractHandler {
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event); IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event);
if(selection.isEmpty()) return null; if(selection.isEmpty()) return null;
@ -36,67 +33,6 @@ public class ShareProjectHandler extends AbstractHandler {
if(session == null) return null; if(session == null) return null;
ShareClient.getDefault().addSharedProject(project); ShareClient.getDefault().addSharedProject(project);
// IEditorPart editor = window.getActivePage().getActiveEditor();
// if(!(editor instanceof ITextEditor)) return null;
//
// ITextEditor textEditor = (ITextEditor) editor;
//
// IDocument eclipseDocument = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
//
// AtomicBoolean ignoreChanges = new AtomicBoolean(false);
// SharedDocument doc = new SharedDocument(con);
// doc.localInsert(0, eclipseDocument.get());
//
// doc.addListener(new DocumentListener() {
//
// @Override
// public void onInsert(int index, char character) {
// Display.getDefault().asyncExec(() -> {
// try {
// ignoreChanges.set(true);
// eclipseDocument.replace(index, 0, String.valueOf(character));
// ignoreChanges.set(false);
// } catch (BadLocationException e) {
// e.printStackTrace();
// }
// });
//
// }
//
// @Override
// public void onDelete(int index) {
// Display.getDefault().asyncExec(() -> {
// try {
// ignoreChanges.set(true);
// eclipseDocument.replace(index, 1, "");
// ignoreChanges.set(false);
// } catch (BadLocationException e) {
// e.printStackTrace();
// }
// });
// }
// });
//
// eclipseDocument.addDocumentListener(new IDocumentListener() {
//
// @Override
// public void documentChanged(DocumentEvent event) {
// if(ignoreChanges.get()) return; // TODO: not very ideal
//
// if(event.getLength() > 0) {
// doc.localDelete(event.getOffset(), event.getLength());
// }
//
// doc.localInsert(event.getOffset(), event.getText());
// }
//
// @Override
// public void documentAboutToBeChanged(DocumentEvent event) {
//
// }
// });
return null; return null;
} }
} }