-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
334 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
plugin-maven/src/main/java/dev/equo/ide/maven/Welcome.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 EquoTech, Inc. and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* EquoTech, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package dev.equo.ide.maven; | ||
|
||
import org.apache.maven.plugins.annotations.Parameter; | ||
import org.sonatype.inject.Nullable; | ||
|
||
public class Welcome { | ||
@Parameter @Nullable String openUrl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 EquoTech, Inc. and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* EquoTech, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package dev.equo.ide; | ||
|
||
public class IdeHookWelcome implements IdeHook { | ||
String openUrl; | ||
|
||
public IdeHookWelcome openUrl(String openUrl) { | ||
this.openUrl = openUrl; | ||
return this; | ||
} | ||
|
||
@Override | ||
public IdeHookInstantiated instantiate() { | ||
try { | ||
var clazz = Class.forName("dev.equo.ide.Welcome"); | ||
var constructor = clazz.getDeclaredConstructor(IdeHookWelcome.class); | ||
return (IdeHookInstantiated) constructor.newInstance(this); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
100 changes: 100 additions & 0 deletions
100
solstice/src/main/java/dev/equo/ide/ui/PartDescriptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 EquoTech, Inc. and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* EquoTech, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package dev.equo.ide.ui; | ||
|
||
import java.util.function.Consumer; | ||
import org.eclipse.jface.resource.ImageDescriptor; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.ui.IEditorInput; | ||
import org.eclipse.ui.IPersistableElement; | ||
import org.eclipse.ui.IWorkbenchPage; | ||
import org.eclipse.ui.PartInitException; | ||
import org.eclipse.ui.PlatformUI; | ||
|
||
/** Creates Eclipse parts using only code, no metadata. */ | ||
public class PartDescriptor { | ||
private Consumer<Composite> coat; | ||
private ImageDescriptor tabIcon; | ||
private String tabName; | ||
private String toolTipText; | ||
|
||
public static PartDescriptor create(String tabName, Consumer<Composite> coat) { | ||
return new PartDescriptor(tabName, coat); | ||
} | ||
|
||
private PartDescriptor(String tabName, Consumer<Composite> coat) { | ||
this.tabName = tabName; | ||
this.coat = coat; | ||
} | ||
|
||
public PartDescriptor tabIcon(ImageDescriptor tabIcon) { | ||
this.tabIcon = tabIcon; | ||
return this; | ||
} | ||
|
||
public PartDescriptor toolTipText(String toolTipText) { | ||
this.toolTipText = toolTipText; | ||
return this; | ||
} | ||
|
||
public void openOn(IWorkbenchPage page) { | ||
try { | ||
page.openEditor(new Input(), PartDescriptorHelper.EDITOR_ID); | ||
} catch (PartInitException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public void openOnActivePage() { | ||
var workbench = PlatformUI.getWorkbench(); | ||
var window = workbench.getActiveWorkbenchWindow(); | ||
openOn(window.getActivePage()); | ||
} | ||
|
||
class Input implements IEditorInput { | ||
@Override | ||
public boolean exists() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public ImageDescriptor getImageDescriptor() { | ||
return tabIcon; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return tabName; | ||
} | ||
|
||
@Override | ||
public String getToolTipText() { | ||
return toolTipText; | ||
} | ||
|
||
@Override | ||
public IPersistableElement getPersistable() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public <T> T getAdapter(Class<T> adapter) { | ||
return null; | ||
} | ||
|
||
void createPartControl(Composite parentCmp) { | ||
coat.accept(parentCmp); | ||
} | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
solstice/src/main/java/dev/equo/ide/ui/PartDescriptorHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2022 EquoTech, Inc. and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* EquoTech, Inc. - initial API and implementation | ||
*******************************************************************************/ | ||
package dev.equo.ide.ui; | ||
|
||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.swt.widgets.Composite; | ||
import org.eclipse.ui.IEditorInput; | ||
import org.eclipse.ui.IEditorSite; | ||
import org.eclipse.ui.part.EditorPart; | ||
|
||
/** NOT FOR END-USER USAGE, use {@link PartDescriptor}. */ | ||
public class PartDescriptorHelper extends EditorPart { | ||
static final String EDITOR_ID = "dev.equo.ide.ui.PartDescriptorHelper"; | ||
|
||
@Override | ||
public void createPartControl(Composite parentCmp) { | ||
var input = (PartDescriptor.Input) getEditorInput(); | ||
input.createPartControl(parentCmp); | ||
} | ||
|
||
@SuppressWarnings("unchecked") | ||
@Override | ||
public void init(IEditorSite site, IEditorInput input) { | ||
setSite(site); | ||
setInput(input); | ||
|
||
var inputCast = (PartDescriptor.Input) getEditorInput(); | ||
setPartName(inputCast.getName()); | ||
var image = inputCast.getImageDescriptor(); | ||
if (image == null) { | ||
setTitleImage(null); | ||
} else { | ||
setTitleImage(image.createImage()); | ||
} | ||
setTitleToolTip(inputCast.getToolTipText()); | ||
} | ||
|
||
@Override | ||
public final boolean isSaveAsAllowed() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDirty() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void doSave(IProgressMonitor monitor) {} | ||
|
||
@Override | ||
public void doSaveAs() {} | ||
|
||
@Override | ||
public void setFocus() {} | ||
} |
Oops, something went wrong.