下面列出了java.awt.event.HierarchyBoundsListener#javax.swing.event.AncestorEvent 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public void ancestorAdded(AncestorEvent event) {
Config config = PersistentConfig.getInstance().getInitConfig();
if (config == null) {
return;
} else {
//如果存在历史版本,并且为2版本之前,则复制历史数据到新缓存目录下,并且更新版本号
if (Constant.PLUGIN_CONFIG_VERSION_1.equals(config.getVersion()) || config.getVersion() == null) {
File oldFile = new File(config.getFilePath() + File.separator + PersistentConfig.OLDPATH + File.separator);
if (oldFile.getParentFile().exists()) {
File newFile = new File(config.getFilePath() + File.separator + PersistentConfig.PATH + File.separator);
if (!newFile.getParentFile().exists()) {
newFile.getParentFile().mkdirs();
}
try {
FileUtils.copyDirectory(oldFile, newFile);
} catch (IOException e) {
}
}
config.setVersion(Constant.PLUGIN_CONFIG_VERSION_2);
PersistentConfig.getInstance().setInitConfig(config);
}
}
}
@Override
public void ancestorAdded(AncestorEvent event) {
ExplorerManager em = ExplorerManager.find(treeView);
em.addPropertyChangeListener(this);
if (dividerSet) {
if (lastDividerLoc != 0) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run () {
diffView.setDividerLocation(lastDividerLoc);
}
});
}
} else {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
dividerSet = true;
diffView.setDividerLocation(0.33);
}
});
}
}
@Override
public void ancestorAdded(AncestorEvent event) {
ExplorerManager em = ExplorerManager.find(treeView);
em.addPropertyChangeListener(this);
if (dividerSet) {
if (lastDividerLoc != 0) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run () {
diffView.setDividerLocation(lastDividerLoc);
}
});
}
} else {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
dividerSet = true;
diffView.setDividerLocation(0.33);
}
});
}
}
@Override
public void ancestorAdded ( final AncestorEvent event )
{
/**
* Do nothing by default.
*/
}
@Override
public void ancestorAdded(AncestorEvent arg0) {
if (thread == null) {
thread = new PanelThread(this);
thread.start();
}
}
@Override
public void ancestorAdded(AncestorEvent event) {
ToolWindow log = EventLog.getEventLog(myProject);
if (log != null && log.isVisible()) {
EventLog.getLogModel(myProject).logShown();
}
}
@Override
public void ancestorMoved ( final AncestorEvent event )
{
/**
* Do nothing by default.
*/
}
@Override
public void ancestorAdded(AncestorEvent event) {
ToolWindow log = ConsoleLog.getLogWindow(myProject);
if (log != null && log.isVisible()) {
ConsoleLogModel model = ConsoleLog.getLogModel(myProject);
if(model != null) {
model.logShown();
}
}
}
@Override
public void ancestorAdded(AncestorEvent e) {
JComponent component = e.getComponent();
component.requestFocusInWindow();
if (removeListener)
component.removeAncestorListener( this );
}
@Override
public void ancestorAdded(AncestorEvent event) {
Item item = item(event.getComponent());
if (item.runningTimer != null) {
item.runningTimer.stop();
item.runningTimer = null;
}
itemMadeDisplayable(item);
}
private void installTip ( final File file, final JComponent component, final boolean showFullName )
{
final WebPanel panel = new WebPanel ( new VerticalFlowLayout ( 4, 4 ) );
panel.setOpaque ( false );
if ( showFullName )
{
// Full file name
panel.add ( new WebLabel ( FileUtils.getDisplayFileName ( file ), FileUtils.getFileIcon ( file ) ) );
panel.add ( new WebSeparator ( WebSeparator.HORIZONTAL ) );
}
// File description
panel.add ( new WebLabel ( FileUtils.getFileTypeDescription ( file ), typeIcon ) );
if ( FileUtils.isFile ( file ) )
{
// File modification date
panel.add ( new WebLabel ( FileUtils.getDisplayFileModificationDate ( file ), dateIcon ) );
// File size
panel.add ( new WebLabel ( FileUtils.getDisplayFileSize ( file ), sizeIcon ) );
}
// Registering tooltip
TooltipManager.setTooltip ( component, panel );
// Removing tooltip when component is removed
component.addAncestorListener ( new AncestorAdapter ()
{
@Override
public void ancestorRemoved ( final AncestorEvent event )
{
TooltipManager.removeTooltips ( component );
}
} );
}
@Override
public void ancestorMoved ( @NotNull final AncestorEvent event )
{
/**
* Updating hover properly upon component ancestor updates.
*/
updateHover ();
}
@Override
public void ancestorRemoved ( @NotNull final AncestorEvent event )
{
/**
* No extra updates required on this event.
*/
}
@Override
public void ancestorAdded(AncestorEvent event) {
if (!displayed) {
displayed = true;
setDefaultColumnSizes();
}
}
public void ancestorMoved(AncestorEvent event) {
}
@Override
public void ancestorMoved(final AncestorEvent event) {}
public void ancestorMoved(AncestorEvent arg0) {
}
@Override public void ancestorMoved(AncestorEvent e) {
/* not needed */
}
public TabFrameContentPane() {
super(new BorderLayout());
cont.setBackground(Color.YELLOW);
PopupContainer leftBottomPanel = new PopupContainer();
PopupContainer rightTopPanel = new PopupContainer();
PopupContainer rightBottomPanel = new PopupContainer();
PopupContainer topLeftPanel = new PopupContainer();
PopupContainer topRightPanel = new PopupContainer();
PopupContainer bottomLeftPanel = new PopupContainer();
PopupContainer bottomRightPanel = new PopupContainer();
PopupContainer leftTopPanel = new PopupContainer();
rightSplitter = createSplitPane("rightSplitter");
rightSplitter.setOrientation(JSplitPane.VERTICAL_SPLIT);
rightSplitter.setTopComponent(rightTopPanel);
rightSplitter.setBottomComponent(rightBottomPanel);
leftSplitter = createSplitPane("leftSplitter");
leftSplitter.setOrientation(JSplitPane.VERTICAL_SPLIT);
leftSplitter.setTopComponent(leftTopPanel);
leftSplitter.setBottomComponent(leftBottomPanel);
topSplitter = createSplitPane("topSplitter");
topSplitter.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
topSplitter.setLeftComponent(topLeftPanel);
topSplitter.setRightComponent(topRightPanel);
bottomSplitter = createSplitPane("bottomSplitter");
bottomSplitter.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
bottomSplitter.setLeftComponent(bottomLeftPanel);
bottomSplitter.setRightComponent(bottomRightPanel);
topSplit = createSplitPane("topSplit");
bottomSplit = createSplitPane("bottomSplit");
topSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
bottomSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
topSplit.setTopComponent(topSplitter);
topSplit.setBottomComponent(bottomSplit);
bottomSplit.setBottomComponent(bottomSplitter);
leftSplit = createSplitPane("leftSplit");
rightSplit = createSplitPane("rightSplit");
leftSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
rightSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
bottomSplit.setTopComponent(leftSplit);
leftSplit.setLeftComponent(leftSplitter);
leftSplit.setRightComponent(rightSplit);
rightSplit.setRightComponent(rightSplitter);
rightSplit.setLeftComponent(cont);
topSplit.setResizeWeight(0.0d);
leftSplit.setResizeWeight(0.0d);
bottomSplit.setResizeWeight(1.0d);
rightSplit.setResizeWeight(1.0d);
setupSplitterPanes(JSplitPane::setResizeWeight, 0.5d);
setupSplitPanes(JSplitPane::setEnabled, false);
setupSplitPanes(ToggleSplitPane::setResizable, false);
setupSplitterPanes(JSplitPane::setEnabled, false);
setupSplitterPanes(ToggleSplitPane::setResizable, false);
add(topSplit, BorderLayout.CENTER);
addAncestorListener(new AncestorAdapter() {
@Override
public void ancestorAdded(final AncestorEvent event) {
removeAncestorListener(this);
SwingUtilities.invokeLater(() -> init());
}
});
}
@Override public void ancestorAdded(AncestorEvent e) {
e.getComponent().requestFocusInWindow();
}
@Override public void ancestorAdded(AncestorEvent e) {
e.getComponent().requestFocusInWindow();
}
public void ancestorRemoved(AncestorEvent event) {
makeHighlightsDirty();
}
@Override
public void ancestorMoved(AncestorEvent event) {
}
@Override
public void ancestorAdded(AncestorEvent event) {
setComboValue(getValue(), getDefaultValue(), component);
component.addActionListener(this);
}
@Override
public void ancestorMoved(AncestorEvent event) {
}
@Override
public void ancestorRemoved(AncestorEvent e) {}
@Override
public void ancestorRemoved(AncestorEvent event) {
component.getDocument().removeDocumentListener(this);
}
public void ancestorAdded(AncestorEvent event) {
}
@Override
public void ancestorAdded(AncestorEvent event) {
loadArtifacts();
}
public void ancestorAdded(AncestorEvent event) {
}